@@ -192,7 +192,7 @@ int synth_init(Synth *synth, int samplerate, int buffer_size, int voices) {
192192 // synth_play_startup_melody(synth); // Start the melody at startup
193193
194194 char param_name [16 ];
195- for (int i = 0 ; i < 6 ; ++ i ) { // Loop for all 6 oscillators
195+ for (int i = 0 ; i < 4 ; ++ i ) { // Loop for all 4 oscillators
196196 osc_init (& synth -> osc [i ], samplerate );
197197
198198 // Default parameters for main oscillators (0-3)
@@ -218,14 +218,7 @@ int synth_init(Synth *synth, int samplerate, int buffer_size, int voices) {
218218 }
219219
220220 // Specific default parameters for Bass (osc[4])
221- synth_set_param (synth , "osc5.waveform" , 1.0f ); // Saw wave for bass
222- synth_set_param (synth , "osc5.pitch" , -12.0f ); // One octave down
223- synth_set_param (synth , "osc5.gain" , 0.7f );
224-
225- // Specific default parameters for Percussion (osc[5])
226- synth_set_param (synth , "osc6.waveform" , 4.0f ); // Noise for percussion
227- synth_set_param (synth , "osc6.gain" , 0.5f );
228- // For percussion, we might want a very short envelope, but that's handled by voice/envelope, not directly by osc params.
221+
229222
230223 synth_set_param (synth , "osc1.waveform" , 0.0f );
231224 synth_set_param (synth , "osc2.waveform" , 0.0f );
@@ -331,7 +324,7 @@ void synth_handle_cc(Synth *synth, int cc, int value) {
331324void synth_set_param (Synth * synth , const char * param , float value ) {
332325 if (strncmp (param , "osc" , 3 ) == 0 ) {
333326 int i = param [3 ] - '1' ;
334- if (i >= 0 && i < 6 ) // Changed from i < 4 to i < 6
327+ if (i >= 0 && i < 4 )
335328 osc_set_param (& synth -> osc [i ], param + 5 , value );
336329 } else if (strncmp (param , "fx." , 3 ) == 0 ) {
337330 fx_set_param (& synth -> fx , param + 3 , value );
@@ -446,7 +439,7 @@ char* synth_save_preset_json(const Synth *synth) {
446439
447440 // Save Oscillator parameters
448441 cJSON * oscillators = cJSON_CreateArray ();
449- for (int i = 0 ; i < 6 ; ++ i ) {
442+ for (int i = 0 ; i < 4 ; ++ i ) {
450443 cJSON * osc = cJSON_CreateObject ();
451444 cJSON_AddNumberToObject (osc , "waveform" , synth -> osc [i ].waveform );
452445 cJSON_AddNumberToObject (osc , "pitch" , synth -> osc [i ].pitch );
@@ -588,7 +581,7 @@ void synth_load_preset_json(Synth *synth, const char *json_string) {
588581 cJSON * oscillators = cJSON_GetObjectItemCaseSensitive (root , "oscillators" );
589582 if (cJSON_IsArray (oscillators )) {
590583 int num_oscillators = cJSON_GetArraySize (oscillators );
591- for (int i = 0 ; i < num_oscillators && i < 6 ; ++ i ) { // Limit to 6 oscillators
584+ for (int i = 0 ; i < num_oscillators && i < 4 ; ++ i ) { // Limit to 4 oscillators
592585 cJSON * osc = cJSON_GetArrayItem (oscillators , i );
593586 if (cJSON_IsObject (osc )) {
594587 cJSON * waveform = cJSON_GetObjectItemCaseSensitive (osc , "waveform" );
@@ -845,8 +838,8 @@ void synth_load_default_config(Synth *synth) {
845838void synth_randomize_parameters (Synth * synth ) {
846839 char param_name [32 ];
847840
848- // Randomize all oscillators (0-5 )
849- for (int i = 0 ; i < 6 ; i ++ ) {
841+ // Randomize all oscillators (0-3 )
842+ for (int i = 0 ; i < 4 ; i ++ ) {
850843 // Randomize waveform (0-4: SINE, SAW, SQUARE, TRI, NOISE)
851844 float random_waveform = (float )(rand () % 5 );
852845 snprintf (param_name , sizeof (param_name ), "osc%d.waveform" , i + 1 );
@@ -885,7 +878,7 @@ void synth_randomize_parameters(Synth *synth) {
885878}
886879
887880void synth_randomize_oscillator (Synth * synth , int osc_index ) {
888- if (osc_index < 0 || osc_index >= 6 ) return ;
881+ if (osc_index < 0 || osc_index >= 4 ) return ;
889882
890883 char param_name [32 ];
891884
0 commit comments