Subversion Repositories svn.mios32

Compare Revisions

Ignore whitespace Rev 1267 → Rev 1268

/trunk/apps/controllers/midio128_v3/src/mios32_config.h
40,7 → 40,6
#define MIOS32_ENC28J60_MY_MAC_ADDR5 0
#define MIOS32_ENC28J60_MY_MAC_ADDR6 0
 
 
// EEPROM emulation
#define EEPROM_EMULATED_SIZE 128
 
/trunk/apps/controllers/midio128_v3/src/midio_file_p.c
185,8 → 185,73
return 0; // invalid IP
}
 
/////////////////////////////////////////////////////////////////////////////
// help function which parses a SR definition (<dec>.D<dec>)
// returns >= 0 if value is valid
// returns -1 if value is invalid
// returns -2 if SR number 0 has been passed (could disable a SR definition)
/////////////////////////////////////////////////////////////////////////////
static s32 get_sr(char *word)
{
if( word == NULL )
return -1;
 
// check for '.D' separator
char *word2 = word;
while( *word2 != '.' )
if( *word2++ == 0 )
return -1;
word2++;
if( *word2++ != 'D' )
return -1;
 
s32 srNum = get_dec(word);
if( srNum < 0 )
return -1;
 
if( srNum == 0 )
return -2; // SR has been disabled...
 
s32 pinNum = get_dec(word2);
if( pinNum < 0 )
return -1;
 
if( pinNum >= 8 )
return -1;
 
return 8*(srNum-1) + pinNum;
}
 
/////////////////////////////////////////////////////////////////////////////
// help function which parses a binary value
// returns >= 0 if value is valid
// returns -1 if value is invalid
/////////////////////////////////////////////////////////////////////////////
static s32 get_bin(char *word, int numBits)
{
if( word == NULL )
return -1;
 
s32 value = 0;
int bit = 0;
while( 1 ) {
if( *word == '1' ) {
value |= 1 << bit;
} else if( *word != '0' ) {
break;
}
++word;
++bit;
}
 
if( bit != numBits )
return -1; // invalid number of bits
 
return value;
}
 
 
/////////////////////////////////////////////////////////////////////////////
// reads the patch file content (again)
// returns < 0 on errors (error codes are documented in midio_file.h)
/////////////////////////////////////////////////////////////////////////////
234,6 → 299,171
 
if( *parameter == '#' ) {
// ignore comments
} else if( strcmp(parameter, "DIN") == 0 ) {
s32 sr;
char *word = strtok_r(NULL, separators, &brkt);
if( (sr=get_sr(word)) < 0 || sr >= MIDIO_PATCH_NUM_DIN ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid SR.Pin format for parameter '%s'\n", parameter);
#endif
} else {
s32 enabled_ports;
char *word = strtok_r(NULL, separators, &brkt);
if( (enabled_ports=get_bin(word, 16)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid MIDI port format for parameter '%s %2d.D%d'\n", parameter, (sr/8)+1, sr%8);
#endif
} else {
s32 mode;
char *word = strtok_r(NULL, separators, &brkt);
if( (mode=get_dec(word)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid Mode format for parameter '%s %2d.D%d'\n", parameter, (sr/8)+1, sr%8);
#endif
} else {
u8 events[6];
int i;
for(i=0; i<6; ++i) {
char *word = strtok_r(NULL, separators, &brkt);
if( (events[i]=get_dec(word)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid Event format for parameter '%s %2d.D%d'\n", parameter, (sr/8)+1, sr%8);
#endif
break;
} else {
events[i] &= 0x7f;
}
}
 
if( i == 6 ) {
// finally a valid line!
midio_patch_din_entry_t *din_cfg = (midio_patch_din_entry_t *)&midio_patch_din[sr];
din_cfg->enabled_ports = enabled_ports;
din_cfg->mode = mode;
din_cfg->evnt0_on = events[0];
din_cfg->evnt1_on = events[1];
din_cfg->evnt2_on = events[2];
din_cfg->evnt0_off = events[3];
din_cfg->evnt1_off = events[4];
din_cfg->evnt2_off = events[5];
}
}
}
}
} else if( strcmp(parameter, "DOUT") == 0 ) {
s32 sr;
char *word = strtok_r(NULL, separators, &brkt);
if( (sr=get_sr(word)) < 0 || sr >= MIDIO_PATCH_NUM_DIN ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid SR.Pin format for parameter '%s'\n", parameter);
#endif
} else {
s32 enabled_ports;
char *word = strtok_r(NULL, separators, &brkt);
if( (enabled_ports=get_bin(word, 16)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid MIDI port format for parameter '%s %2d.D%d'\n", parameter, (sr/8)+1, 7-(sr%8));
#endif
} else {
u8 events[2];
int i;
for(i=0; i<2; ++i) {
char *word = strtok_r(NULL, separators, &brkt);
if( (events[i]=get_dec(word)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid Event format for parameter '%s %2d.D%d'\n", parameter, (sr/8)+1, (7-sr%8));
#endif
break;
} else {
events[i] &= 0x7f;
}
}
 
if( i == 2 ) {
// finally a valid line!
sr ^= 7; // DOUT SR pins are mirrored
midio_patch_dout_entry_t *dout_cfg = (midio_patch_dout_entry_t *)&midio_patch_dout[sr];
dout_cfg->enabled_ports = enabled_ports;
dout_cfg->evnt0 = events[0];
dout_cfg->evnt1 = events[1];
}
}
}
} else if( strcmp(parameter, "MergerMode") == 0 ) {
u32 value;
if( (value=get_dec(brkt)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid format for parameter '%s'\n", parameter);
#endif
} else {
midio_patch_cfg.flags.MERGER_MODE = value;
}
} else if( strcmp(parameter, "ForwardIO") == 0 ) {
u32 value;
if( (value=get_dec(brkt)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid format for parameter '%s'\n", parameter);
#endif
} else {
midio_patch_cfg.flags.FORWARD_IO = value;
}
} else if( strcmp(parameter, "InverseDIN") == 0 ) {
u32 value;
if( (value=get_dec(brkt)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid format for parameter '%s'\n", parameter);
#endif
} else {
midio_patch_cfg.flags.INVERSE_DIN = value;
}
} else if( strcmp(parameter, "InverseDOUT") == 0 ) {
u32 value;
if( (value=get_dec(brkt)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid format for parameter '%s'\n", parameter);
#endif
} else {
midio_patch_cfg.flags.INVERSE_DOUT = value;
}
} else if( strcmp(parameter, "AltProgramChange") == 0 ) {
u32 value;
if( (value=get_dec(brkt)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid format for parameter '%s'\n", parameter);
#endif
} else {
midio_patch_cfg.flags.ALT_PROGCHNG = value;
}
} else if( strcmp(parameter, "DebounceCtr") == 0 ) {
u32 value;
if( (value=get_dec(brkt)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid format for parameter '%s'\n", parameter);
#endif
} else {
midio_patch_cfg.debounce_ctr = value;
}
} else if( strcmp(parameter, "GlobalChannel") == 0 ) {
u32 value;
if( (value=get_dec(brkt)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid format for parameter '%s'\n", parameter);
#endif
} else {
midio_patch_cfg.global_chn = value;
}
} else if( strcmp(parameter, "AllNotesOffChannel") == 0 ) {
u32 value;
if( (value=get_dec(brkt)) < 0 ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MIDIO_FILE_P] ERROR invalid format for parameter '%s'\n", parameter);
#endif
} else {
midio_patch_cfg.all_notes_off_chn = value;
}
 
#if !defined(MIOS32_FAMILY_EMULATION)
} else if( strcmp(parameter, "ETH_LocalIp") == 0 ) {
u32 value;
375,7 → 605,59
 
#define FLUSH_BUFFER if( !write_to_file ) { DEBUG_MSG(line_buffer); } else { status |= FILE_WriteBuffer((u8 *)line_buffer, strlen(line_buffer)); }
 
{
// SR/Pin MIDI OUT ports mode ON Event OFF event
// DIN 1.D0 1111111111111111 0 0x90 0x30 0x7F 0x90 0x30 0x00
sprintf(line_buffer, "\n\n# SR/Pin MIDI OUT ports mode ON Event OFF event\n");
FLUSH_BUFFER;
 
int din;
midio_patch_din_entry_t *din_cfg = (midio_patch_din_entry_t *)&midio_patch_din[0];
for(din=0; din<MIDIO_PATCH_NUM_DIN; ++din, ++din_cfg) {
char ports_bin[17];
int bit;
for(bit=0; bit<16; ++bit)
ports_bin[bit] = (din_cfg->enabled_ports & (1 << bit)) ? '1' : '0';
ports_bin[16] = 0;
 
sprintf(line_buffer, "DIN %2d.D%d %s %2d 0x%02X 0x%02X 0x%02X 0x%02x 0x%02x 0x%02x\n",
(din / 8) + 1,
din % 8,
ports_bin,
din_cfg->mode,
din_cfg->evnt0_on | 0x80, din_cfg->evnt1_on, din_cfg->evnt2_on,
din_cfg->evnt0_off | 0x80, din_cfg->evnt1_off, din_cfg->evnt2_off);
FLUSH_BUFFER;
}
}
 
{
// SR/Pin MIDI IN ports Event
// DOUT 1.D7 1111111111111111 0x90 0x30
sprintf(line_buffer, "\n\n# SR/Pin MIDI IN ports Event\n");
FLUSH_BUFFER;
 
int dout;
midio_patch_dout_entry_t *dout_cfg = (midio_patch_dout_entry_t *)&midio_patch_dout[0];
for(dout=0; dout<MIDIO_PATCH_NUM_DOUT; ++dout, ++dout_cfg) {
char ports_bin[17];
int bit;
for(bit=0; bit<16; ++bit)
ports_bin[bit] = (dout_cfg->enabled_ports & (1 << bit)) ? '1' : '0';
ports_bin[16] = 0;
 
sprintf(line_buffer, "DOUT %2d.D%d %s 0x%02X 0x%02X\n",
(dout / 8) + 1,
7 - (dout % 8),
ports_bin,
dout_cfg->evnt0 | 0x80, dout_cfg->evnt1);
FLUSH_BUFFER;
}
}
 
#if !defined(MIOS32_FAMILY_EMULATION)
sprintf(line_buffer, "\n\n# Ethernet Setup\n");
FLUSH_BUFFER;
{
u32 value = UIP_TASK_IP_AddressGet();
sprintf(line_buffer, "ETH_LocalIp %d.%d.%d.%d\n",
433,6 → 715,27
}
#endif
 
sprintf(line_buffer, "\n\n# Misc. Configuration\n");
FLUSH_BUFFER;
 
sprintf(line_buffer, "MergerMode %d\n", midio_patch_cfg.flags.MERGER_MODE);
FLUSH_BUFFER;
sprintf(line_buffer, "ForwardIO %d\n", midio_patch_cfg.flags.FORWARD_IO);
FLUSH_BUFFER;
sprintf(line_buffer, "InverseDIN %d\n", midio_patch_cfg.flags.INVERSE_DIN);
FLUSH_BUFFER;
sprintf(line_buffer, "InverseDOUT %d\n", midio_patch_cfg.flags.INVERSE_DOUT);
FLUSH_BUFFER;
sprintf(line_buffer, "AltProgramChange %d\n", midio_patch_cfg.flags.ALT_PROGCHNG);
FLUSH_BUFFER;
sprintf(line_buffer, "DebounceCtr %d\n", midio_patch_cfg.debounce_ctr);
FLUSH_BUFFER;
sprintf(line_buffer, "GlobalChannel %d\n", midio_patch_cfg.global_chn);
FLUSH_BUFFER;
sprintf(line_buffer, "AllNotesOffChannel %d\n", midio_patch_cfg.all_notes_off_chn);
FLUSH_BUFFER;
 
 
return status;
}
 
/trunk/apps/controllers/midio128_v3/src/app.c
152,7 → 152,7
 
// start tasks
xTaskCreate(TASK_Period_1mS, (signed portCHAR *)"1mS", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_PERIOD_1mS, NULL);
xTaskCreate(TASK_Period_1mS_LP, (signed portCHAR *)"1mS_LP", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_PERIOD_1mS_LP, NULL);
xTaskCreate(TASK_Period_1mS_LP, (signed portCHAR *)"1mS_LP", 2*configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_PERIOD_1mS_LP, NULL);
 
}
 
/trunk/apps/controllers/midio128_v3/src/scs_config.c
36,6 → 36,8
// Local defines
/////////////////////////////////////////////////////////////////////////////
 
static u8 selectedDin;
static u8 selectedDout;
 
/////////////////////////////////////////////////////////////////////////////
// Local parameter variables
45,10 → 47,29
/////////////////////////////////////////////////////////////////////////////
// String Conversion Functions
/////////////////////////////////////////////////////////////////////////////
static void stringEmpty(u32 ix, u16 value, char *label) { label[0] = 0; }
static void stringDec(u32 ix, u16 value, char *label) { sprintf(label, "%3d ", value); }
static void stringDecP1(u32 ix, u16 value, char *label) { sprintf(label, "%3d ", value+1); }
static void stringDec000(u32 ix, u16 value, char *label) { sprintf(label, "%03d ", value); }
static void stringEmpty(u32 ix, u16 value, char *label) { label[0] = 0; }
static void stringDec(u32 ix, u16 value, char *label) { sprintf(label, "%4d ", value); }
static void stringDecP1(u32 ix, u16 value, char *label) { sprintf(label, "%4d ", value+1); }
static void stringDecPM(u32 ix, u16 value, char *label) { sprintf(label, "%4d ", (int)value - 64); }
static void stringDec03(u32 ix, u16 value, char *label) { sprintf(label, " %03d ", value); }
static void stringHex2(u32 ix, u16 value, char *label) { sprintf(label, " %02x ", value); }
static void stringHex2O80(u32 ix, u16 value, char *label) { sprintf(label, " %02x ", value | 0x80); }
static void stringBin4(u32 ix, u16 value, char *label) { sprintf(label, "%c%c%c%c ",
(value & (1 << 0)) ? '1' : '0',
(value & (1 << 1)) ? '1' : '0',
(value & (1 << 2)) ? '1' : '0',
(value & (1 << 3)) ? '1' : '0'); }
static void stringDIN_SR(u32 ix, u16 value, char *label) { sprintf(label, "%2d.%d", (value/8)+1, value%8); }
static void stringDOUT_SR(u32 ix, u16 value, char *label) { sprintf(label, "%2d.%d", (value/8)+1, 7-(value%8)); }
static void stringDIN_Mode(u32 ix, u16 value, char *label)
{
switch( value ) {
case 0: sprintf(label, "Norm"); break;
case 1: sprintf(label, "OnOf"); break;
case 2: sprintf(label, "Togl"); break;
case 3: sprintf(label, "%3d ", value); break;
}
}
 
 
/////////////////////////////////////////////////////////////////////////////
101,8 → 122,85
static u16 dummyGet(u32 ix) { return 0; }
static void dummySet(u32 ix, u16 value) { }
 
static u16 dinGet(u32 ix) { return selectedDin; }
static void dinSet(u32 ix, u16 value) { selectedDin = value; }
 
static u16 dinModeGet(u32 ix) { return midio_patch_din[selectedDin].mode; }
static void dinModeSet(u32 ix, u16 value) { midio_patch_din[selectedDin].mode = value; }
 
static u16 dinEvntGet(u32 ix)
{
midio_patch_din_entry_t *din_cfg = (midio_patch_din_entry_t *)&midio_patch_din[selectedDin];
switch( ix ) {
case 0: return din_cfg->evnt0_on;
case 1: return din_cfg->evnt1_on;
case 2: return din_cfg->evnt2_on;
case 3: return din_cfg->evnt0_off;
case 4: return din_cfg->evnt1_off;
case 5: return din_cfg->evnt2_off;
}
return 0; // error...
}
static void dinEvntSet(u32 ix, u16 value)
{
midio_patch_din_entry_t *din_cfg = (midio_patch_din_entry_t *)&midio_patch_din[selectedDin];
switch( ix ) {
case 0: din_cfg->evnt0_on = value; break;
case 1: din_cfg->evnt1_on = value; break;
case 2: din_cfg->evnt2_on = value; break;
case 3: din_cfg->evnt0_off = value; break;
case 4: din_cfg->evnt1_off = value; break;
case 5: din_cfg->evnt2_off = value; break;
}
}
 
static u16 dinPortGet(u32 ix)
{
midio_patch_din_entry_t *din_cfg = (midio_patch_din_entry_t *)&midio_patch_din[selectedDin];
return (din_cfg->enabled_ports >> (4*ix)) & 0xf;
}
static void dinPortSet(u32 ix, u16 value)
{
midio_patch_din_entry_t *din_cfg = (midio_patch_din_entry_t *)&midio_patch_din[selectedDin];
din_cfg->enabled_ports &= ~(15 << (4*ix));
din_cfg->enabled_ports |= (value << (4*ix));
}
 
static u16 doutGet(u32 ix) { return selectedDout; }
static void doutSet(u32 ix, u16 value) { selectedDout = value; }
 
static u16 doutEvntGet(u32 ix)
{
midio_patch_dout_entry_t *dout_cfg = (midio_patch_dout_entry_t *)&midio_patch_dout[selectedDout];
switch( ix ) {
case 0: return dout_cfg->evnt0;
case 1: return dout_cfg->evnt1;
}
return 0; // error...
}
static void doutEvntSet(u32 ix, u16 value)
{
midio_patch_dout_entry_t *dout_cfg = (midio_patch_dout_entry_t *)&midio_patch_dout[selectedDout];
switch( ix ) {
case 0: dout_cfg->evnt0 = value; break;
case 1: dout_cfg->evnt1 = value; break;
}
}
 
static u16 doutPortGet(u32 ix)
{
midio_patch_dout_entry_t *dout_cfg = (midio_patch_dout_entry_t *)&midio_patch_dout[selectedDout];
return (dout_cfg->enabled_ports >> (4*ix)) & 0xf;
}
static void doutPortSet(u32 ix, u16 value)
{
midio_patch_dout_entry_t *dout_cfg = (midio_patch_dout_entry_t *)&midio_patch_dout[selectedDout];
dout_cfg->enabled_ports &= ~(15 << (4*ix));
dout_cfg->enabled_ports |= (value << (4*ix));
}
 
 
 
/////////////////////////////////////////////////////////////////////////////
// Special output functions for Disk page
/////////////////////////////////////////////////////////////////////////////
120,13 → 218,40
// Menu Structure
/////////////////////////////////////////////////////////////////////////////
 
const scs_menu_item_t pageDIN[] = {
SCS_ITEM("Pin# ", 0, MIDIO_PATCH_NUM_DIN-1, dinGet, dinSet, selectNOP, stringDec, NULL),
SCS_ITEM(" DIN ", 0, MIDIO_PATCH_NUM_DIN-1, dinGet, dinSet, selectNOP, stringDIN_SR, NULL),
SCS_ITEM("Mode ", 0, 2, dinModeGet, dinModeSet, selectNOP, stringDIN_Mode,NULL),
SCS_ITEM("E0On ", 0, 0x7f, dinEvntGet, dinEvntSet, selectNOP, stringHex2O80, NULL),
SCS_ITEM("E1On ", 1, 0x7f, dinEvntGet, dinEvntSet, selectNOP, stringHex2, NULL),
SCS_ITEM("E2On ", 2, 0x7f, dinEvntGet, dinEvntSet, selectNOP, stringHex2, NULL),
SCS_ITEM("E0Of ", 3, 0x7f, dinEvntGet, dinEvntSet, selectNOP, stringHex2O80, NULL),
SCS_ITEM("E1Of ", 4, 0x7f, dinEvntGet, dinEvntSet, selectNOP, stringHex2, NULL),
SCS_ITEM("E2Of ", 5, 0x7f, dinEvntGet, dinEvntSet, selectNOP, stringHex2, NULL),
SCS_ITEM("USB ", 0, 15, dinPortGet, dinPortSet, selectNOP, stringBin4, NULL),
SCS_ITEM("MIDI ", 1, 15, dinPortGet, dinPortSet, selectNOP, stringBin4, NULL),
SCS_ITEM("OSC ", 3, 15, dinPortGet, dinPortSet, selectNOP, stringBin4, NULL),
};
 
const scs_menu_item_t pageDOUT[] = {
SCS_ITEM("Pin# ", 0, MIDIO_PATCH_NUM_DOUT-1, doutGet, doutSet, selectNOP, stringDec, NULL),
SCS_ITEM("DOUT ", 0, MIDIO_PATCH_NUM_DOUT-1, doutGet, doutSet, selectNOP, stringDOUT_SR, NULL),
SCS_ITEM("Evn0 ", 0, 0x7f, doutEvntGet, doutEvntSet, selectNOP, stringHex2O80, NULL),
SCS_ITEM("Evn1 ", 1, 0x7f, doutEvntGet, doutEvntSet, selectNOP, stringHex2, NULL),
SCS_ITEM("USB ", 0, 15, doutPortGet, doutPortSet, selectNOP, stringBin4, NULL),
SCS_ITEM("MIDI ", 1, 15, doutPortGet, doutPortSet, selectNOP, stringBin4, NULL),
SCS_ITEM("OSC ", 3, 15, doutPortGet, doutPortSet, selectNOP, stringBin4, NULL),
};
 
const scs_menu_item_t pageDsk[] = {
SCS_ITEM("Load", 0, 0, dummyGet, dummySet, selectLOAD, stringEmpty, NULL),
SCS_ITEM("Save", 0, 0, dummyGet, dummySet, selectSAVE, stringEmpty, NULL),
SCS_ITEM("Load ", 0, 0, dummyGet, dummySet, selectLOAD, stringEmpty, NULL),
SCS_ITEM("Save ", 0, 0, dummyGet, dummySet, selectSAVE, stringEmpty, NULL),
};
 
const scs_menu_page_t rootMode0[] = {
SCS_PAGE("Dsk ", pageDsk, pageDskStringLine1, pageDskStringLine2),
SCS_PAGE("DIN ", pageDIN, SCS_StringStandardItems, SCS_StringStandardValues),
SCS_PAGE("DOUT ", pageDOUT, SCS_StringStandardItems, SCS_StringStandardValues),
SCS_PAGE("Disk ", pageDsk, pageDskStringLine1, pageDskStringLine2),
};
 
 
/trunk/apps/examples/speech_synth/scs_config.c
59,11 → 59,12
// String Conversion Functions
/////////////////////////////////////////////////////////////////////////////
static void stringEmpty(u32 ix, u16 value, char *label) { label[0] = 0; }
static void stringDec(u32 ix, u16 value, char *label) { sprintf(label, "%3d ", value); }
static void stringDecP1(u32 ix, u16 value, char *label) { sprintf(label, "%3d ", value+1); }
static void stringDecPM(u32 ix, u16 value, char *label) { sprintf(label, "%3d ", (int)value - 64); }
static void stringDec000(u32 ix, u16 value, char *label) { sprintf(label, "%03d ", value); }
static void stringPlay(u32 ix, u16 value, char *label) { sprintf(label, " %c ", SYNTH_PhraseIsPlayed(selectedPhrase) ? '*' : 'o'); }
static void stringDec(u32 ix, u16 value, char *label) { sprintf(label, "%4d ", value); }
static void stringDecP1(u32 ix, u16 value, char *label) { sprintf(label, "%4d ", value+1); }
static void stringDecPM(u32 ix, u16 value, char *label) { sprintf(label, "%4d ", (int)value - 64); }
static void stringDec03(u32 ix, u16 value, char *label) { sprintf(label, " %03d ", value); }
static void stringHex2(u32 ix, u16 value, char *label) { sprintf(label, " %02x ", value); }
static void stringPlay(u32 ix, u16 value, char *label) { sprintf(label, " [%c] ", SYNTH_PhraseIsPlayed(selectedPhrase) ? '*' : 'o'); }
 
/////////////////////////////////////////////////////////////////////////////
// Parameter Selection Functions
140,41 → 141,41
/////////////////////////////////////////////////////////////////////////////
 
const scs_menu_item_t pageGlb[] = {
SCS_ITEM("DwS ", SYNTH_GLOBAL_PAR_DOWNSAMPLING_FACTOR, 63, globalGet, globalSet, selectNOP, stringDec, NULL),
SCS_ITEM("Res ", SYNTH_GLOBAL_PAR_RESOLUTION, 16, globalGet, globalSet, selectNOP, stringDec, NULL),
SCS_ITEM("XOR ", SYNTH_GLOBAL_PAR_XOR, 0x7f, globalGet, globalSet, selectNOP, stringDec, NULL),
SCS_ITEM("DwnS ", SYNTH_GLOBAL_PAR_DOWNSAMPLING_FACTOR, 63, globalGet, globalSet, selectNOP, stringDec, NULL),
SCS_ITEM("Res. ", SYNTH_GLOBAL_PAR_RESOLUTION, 16, globalGet, globalSet, selectNOP, stringDec, NULL),
SCS_ITEM("XOR ", SYNTH_GLOBAL_PAR_XOR, 0x7f, globalGet, globalSet, selectNOP, stringDec, NULL),
};
 
const scs_menu_item_t pagePhr[] = {
SCS_ITEM("PLY ", 0, 1, playGet, playSet, selectPLAY,stringPlay, NULL),
SCS_ITEM("Phr ", 0, SYNTH_NUM_PHRASES-1, phraseGet, phraseSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Len ", SYNTH_PHRASE_PAR_LENGTH, SYNTH_PHRASE_MAX_LENGTH-1, phraseParGet, phraseParSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Tun ", SYNTH_PHRASE_PAR_TUNE, 0x7f, phraseParGet, phraseParSet, selectNOP, stringDecPM, NULL),
SCS_ITEM("Ix ", 0, SYNTH_PHRASE_MAX_LENGTH-1, phonemeIxGet, phonemeIxSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Ph ", SYNTH_PHONEME_PAR_PH, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Env ", SYNTH_PHONEME_PAR_ENV, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Ton ", SYNTH_PHONEME_PAR_TONE, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Typ ", SYNTH_PHONEME_PAR_TYPE, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("PrP ", SYNTH_PHONEME_PAR_PREPAUSE, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Amp ", SYNTH_PHONEME_PAR_AMP, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("New ", SYNTH_PHONEME_PAR_NEWWORD, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Flg ", SYNTH_PHONEME_PAR_FLAGS, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Len ", SYNTH_PHONEME_PAR_LENGTH, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Pt1 ", SYNTH_PHONEME_PAR_PITCH1, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Pt2 ", SYNTH_PHONEME_PAR_PITCH2, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("SIx ", SYNTH_PHONEME_PAR_SOURCE_IX, SYNTH_PHRASE_MAX_LENGTH-1, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("PLAY ", 0, 1, playGet, playSet, selectPLAY,stringPlay, NULL),
SCS_ITEM("Phrs ", 0, SYNTH_NUM_PHRASES-1, phraseGet, phraseSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Len. ", SYNTH_PHRASE_PAR_LENGTH, SYNTH_PHRASE_MAX_LENGTH-1, phraseParGet, phraseParSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Tune ", SYNTH_PHRASE_PAR_TUNE, 0x7f, phraseParGet, phraseParSet, selectNOP, stringDecPM, NULL),
SCS_ITEM("Ix ", 0, SYNTH_PHRASE_MAX_LENGTH-1, phonemeIxGet, phonemeIxSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Phr ", SYNTH_PHONEME_PAR_PH, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Env ", SYNTH_PHONEME_PAR_ENV, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Tone ", SYNTH_PHONEME_PAR_TONE, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Type ", SYNTH_PHONEME_PAR_TYPE, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("PrP ", SYNTH_PHONEME_PAR_PREPAUSE, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Amp. ", SYNTH_PHONEME_PAR_AMP, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("New ", SYNTH_PHONEME_PAR_NEWWORD, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Flag ", SYNTH_PHONEME_PAR_FLAGS, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Len. ", SYNTH_PHONEME_PAR_LENGTH, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Pt1 ", SYNTH_PHONEME_PAR_PITCH1, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("Pt2 ", SYNTH_PHONEME_PAR_PITCH2, 0x7f, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
SCS_ITEM("SIx ", SYNTH_PHONEME_PAR_SOURCE_IX, SYNTH_PHRASE_MAX_LENGTH-1, phonemeParGet, phonemeParSet, selectNOP, stringDec, NULL),
};
 
const scs_menu_item_t pageDsk[] = {
SCS_ITEM("Bnk ", 0, 3, selBankGet, selBankSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Pat ", 0, 63, selPatchGet, selPatchSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Save", 0, 0, dummyGet, dummySet, selectSAVE, stringEmpty, NULL),
SCS_ITEM("Bank ", 0, 3, selBankGet, selBankSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Pat. ", 0, 63, selPatchGet, selPatchSet, selectNOP, stringDecP1, NULL),
SCS_ITEM("Save ", 0, 0, dummyGet, dummySet, selectSAVE, stringEmpty, NULL),
};
 
const scs_menu_page_t rootMode0[] = {
SCS_PAGE("Dsk ", pageDsk, SCS_StringStandardItems, SCS_StringStandardValues),
SCS_PAGE("Glb ", pageGlb, SCS_StringStandardItems, SCS_StringStandardValues),
SCS_PAGE("Phr ", pagePhr, SCS_StringStandardItems, SCS_StringStandardValues),
SCS_PAGE("Disk ", pageDsk, SCS_StringStandardItems, SCS_StringStandardValues),
SCS_PAGE("Glb. ", pageGlb, SCS_StringStandardItems, SCS_StringStandardValues),
SCS_PAGE("Phr. ", pagePhr, SCS_StringStandardItems, SCS_StringStandardValues),
};