This repository was archived by the owner on Jun 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
231
231
#I2S_SOUND
232
232
# PWM mode for i2s driver
233
233
#AUDIO_PWM_PIN=26
234
- # CMS
234
+ CMS
235
235
#SOUND_BLASTER
236
236
#ADLIB
237
237
TANDY3V
Original file line number Diff line number Diff line change @@ -148,22 +148,26 @@ void __scratch_y("second_core") second_core() {
148
148
samples[active_buffer][sample_index * 2 ] = sample;
149
149
samples[active_buffer][sample_index * 2 + 1 ] = sample;
150
150
151
- #ifdef CMS
152
- cms_samples (&samples[active_buffer][sample_index * 2 ]);
153
- #endif
151
+
154
152
155
153
if (sample_index++ >= i2s_config.dma_trans_count ) {
156
154
sample_index = 0 ;
157
155
i2s_dma_write (&i2s_config, samples[active_buffer]);
158
156
active_buffer ^= 1 ;
159
157
}
160
158
#else
159
+ int16_t samples[2 ] = { sample, sample };
160
+ #ifdef CMS
161
+
162
+ cms_samples (samples);
163
+ #endif
161
164
// register uint8_t r_divider = snd_divider + 4; // TODO: tume up divider per channel
162
- uint16_t corrected_sample = (uint16_t )((int32_t )sample + 0x8000L ) >> 4 ;
165
+ uint16_t corrected_sample_l = (uint16_t )((int32_t )samples[0 ] + 0x8000L ) >> 4 ;
166
+ uint16_t corrected_sample_r = (uint16_t )((int32_t )samples[1 ] + 0x8000L ) >> 4 ;
163
167
// register uint8_t l_divider = snd_divider + 4;
164
168
// register uint16_t l_v = (uint16_t)((int32_t)sample + 0x8000L) >> 4;
165
- pwm_set_gpio_level (PWM_PIN0, corrected_sample );
166
- pwm_set_gpio_level (PWM_PIN1, corrected_sample );
169
+ pwm_set_gpio_level (PWM_PIN0, corrected_sample_l );
170
+ pwm_set_gpio_level (PWM_PIN1, corrected_sample_r );
167
171
#endif
168
172
last_sound_tick = tick;
169
173
}
You can’t perform that action at this time.
0 commit comments