@@ -102,9 +102,10 @@ static audio_fifo_t opl_out_fifo;
102102
103103static int16_t get_opl_sample ()
104104{
105- int16_t opl_current_sample;
105+ int16_t opl_current_sample;
106106 OPL_Pico_simple (&opl_current_sample, 1 );
107- return opl_current_sample;
107+ opl_current_sample = scale_sample (opl_current_sample << 2 , opl_volume, 0 );
108+ return opl_current_sample;
108109}
109110
110111static Resampler<get_opl_sample> resampler;
@@ -130,16 +131,17 @@ void audio_sample_handler(void) {
130131
131132#ifdef SOUND_SB
132133 uint32_t sb_sample = sbdsp_sample ();
133- sb_sample = scale_sample ((int32_t )sb_sample >> 1 , sb_volume, 1 );
134134 sample_l = sample_r = sb_sample;
135135#endif
136136
137137#ifdef CDROM
138138 static uint32_t cd_index = 0 ;
139139 const uint32_t has_cd_samples = fifo_take_samples_inline (cd_fifo, 2 );
140140 if (has_cd_samples) {
141- sample_l += cd_fifo->buffer [cd_index++];
142- sample_r += cd_fifo->buffer [cd_index++];
141+ sample_l += scale_sample (cd_fifo->buffer [cd_index++], cd_audio_volume, 0 );
142+ sample_r += scale_sample (cd_fifo->buffer [cd_index++], cd_audio_volume, 0 );
143+ // sample_l += cd_fifo->buffer[cd_index++];
144+ // sample_r += cd_fifo->buffer[cd_index++];
143145 cd_index &= AUDIO_FIFO_BITS;
144146 }
145147#endif
@@ -148,7 +150,6 @@ void audio_sample_handler(void) {
148150 const uint32_t has_opl_samples = fifo_take_samples_inline (&opl_out_fifo, 1 );
149151 if (has_opl_samples) {
150152 int16_t opl_sample = opl_out_fifo.buffer [opl_out_index++];
151- opl_sample = scale_sample (opl_sample << 2 , opl_volume, 0 );
152153 sample_l += opl_sample;
153154 sample_r += opl_sample;
154155 opl_out_index &= AUDIO_FIFO_BITS;
0 commit comments