Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion include/pinmap/esp32s3-wroom-1.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@
#define PIN_LED_BT GPIO_NUM_NC
#endif

/* C64 IEC Pins */
// Reset line is available
// #define IEC_HAS_RESET
// #define PIN_IEC_RESET GPIO_NUM_14
#define PIN_IEC_ATN GPIO_NUM_38
#define PIN_IEC_CLK_IN GPIO_NUM_39
#define PIN_IEC_CLK_OUT GPIO_NUM_40
#define PIN_IEC_DATA_IN GPIO_NUM_41
#define PIN_IEC_DATA_OUT GPIO_NUM_42
#define PIN_IEC_SRQ GPIO_NUM_2 // FujiLoaf

/* Atari SIO Pins */
#define PIN_INT GPIO_NUM_38 // sio.h
#define PIN_PROC GPIO_NUM_39
Expand All @@ -45,8 +56,16 @@
#define PIN_MTR GPIO_NUM_42
#define PIN_CMD GPIO_NUM_2


/* Audio Output */
#define PIN_DAC1 GPIO_NUM_NC
#define PIN_DAC1 GPIO_NUM_21 //GPIO_NUM_NC

/* I2S Audio Output */
#ifdef ESP32S3_I2S_OUT
#define PIN_I2S_SCK GPIO_NUM_6
#define PIN_I2S_WS GPIO_NUM_5
#define PIN_I2S_SDO GPIO_NUM_4
#endif

#endif /* PINMAP_ESP32S3_WROOM_1 */

99 changes: 90 additions & 9 deletions lib/device/sio/voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,87 @@ using namespace std;

#define EOL 0x9B


void sioVoice::sio_sam_presets(int pr)
{
// DESCRIPTION SPEED PITCH THROAT MOUTH
// SAM 72 64 128 128
// Elf 72 64 110 160
// Little Robot 92 60 190 190
// Stuffy Guy 82 72 110 105
// Little Old Lady 82 32 145 145
// Extra-Terrestrial 100 64 150 200

switch (pr)
{
case 0: //SAM
speed = "72";
pitch = "64";
throat = "128";
mouth = "128";
break;
case 1: //Elf
speed = "72";
pitch = "64";
throat = "110";
mouth = "160";
break;
case 2: //Little Robot
speed = "92";
pitch = "60";
throat = "190";
mouth = "190";
break;
case 3: //Stuffy Guy
speed = "82";
pitch = "72";
throat = "110";
mouth = "105";
break;
case 4: //Little Old Lady
speed = "82";
pitch = "32";
throat = "145";
mouth = "145";
break;
case 5: //Extra-Terrestrial
speed = "100";
pitch = "64";
throat = "150";
mouth = "200";
break;
default:
break;
}


}

void sioVoice::sio_sam_parameters()
{
string s = string((char *)lineBuffer); // change to lineBuffer
vector<string> tokens = util_tokenize(s, ' ');



for (vector<string>::iterator it = tokens.begin(); it != tokens.end(); ++it)
{
string t = *it;


switch (t[0])
{
#ifdef ESP32S3_I2S_OUT
case 0x01: // ^A i2sOut
i2sOut = *(++it);
break;
#endif
// case 0x02: // ^B SampleRate
// samplerate = *(++it);
// break;
case 0x03: // ^C Preset
sio_sam_presets(atoi((*(++it)).c_str()));
break;
case 0x07: // ^G SING
sing = true;
break;
Expand All @@ -35,11 +105,8 @@ void sioVoice::sio_sam_parameters()
break;
case 0x12: // ^R RESET
sing = false;
pitch.clear();
mouth.clear();
phonetic = false;
speed.clear();
throat.clear();
sio_sam_presets(0);
break;
case 0x13: // ^S Speed
speed = *(++it);
Expand Down Expand Up @@ -71,8 +138,25 @@ void sioVoice::sio_sam()

sio_sam_parameters();


// if (!samplerate.empty())
// {
// a[n++] = (char *)("-samplerate");
// a[n++] = (char *)(samplerate.c_str());
// }

#ifdef ESP32S3_I2S_OUT
if (!i2sOut.empty())
{
a[n++] = (char *)("-i2sOut");
a[n++] = (char *)(i2sOut.c_str());
}
#endif

if (sing == true)
a[n++] = (char *)("-sing");
else
a[n++] = (char *)("-no-sing");

if (!pitch.empty())
{
Expand All @@ -88,12 +172,9 @@ void sioVoice::sio_sam()

if (phonetic == true)
a[n++] = (char *)("-phonetic");
// else
// a[n++] = (char *)("-no-phonetic");

if (!pitch.empty())
{
a[n++] = (char *)("-pitch");
a[n++] = (char *)(pitch.c_str());
}

if (!speed.empty())
{
Expand Down
5 changes: 5 additions & 0 deletions lib/device/sio/voice.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ class sioVoice : public virtualDevice
bool phonetic = false;
std::string speed;
std::string throat;
// std::string samplerate;
#ifdef ESP32S3_I2S_OUT
std::string i2sOut;
#endif

void sio_sam();
void sio_sam_parameters();
void sio_sam_presets(int pr);

public:
};
Expand Down
1 change: 1 addition & 0 deletions lib/sam/sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void SetPitch(unsigned char _pitch) { pitch = _pitch; }
void SetMouth(unsigned char _mouth) { mouth = _mouth; }
void SetThroat(unsigned char _throat) { throat = _throat; }
void EnableSingmode() { singmode = 1; }
void DisableSingmode() { singmode = 0; }
char *GetBuffer() { return buffer; }
int GetBufferLength() { return bufferpos; }
void FreeBuffer() { free(buffer); }
Expand Down
1 change: 1 addition & 0 deletions lib/sam/sam.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern "C"
void SetMouth(unsigned char _mouth);
void SetThroat(unsigned char _throat);
void EnableSingmode();
void DisableSingmode();
void EnableDebug();

int SAMMain();
Expand Down
Loading
Loading