Skip to content
Snippets Groups Projects
Commit f027625e authored by pippin's avatar pippin
Browse files

st3m_media: apply volume during pcm queing rather than audio task callback

parent f347bd8a
No related branches found
No related tags found
No related merge requests found
Pipeline #8799 failed
......@@ -111,6 +111,7 @@ void st3m_media_pcm_queue_s16(int hz, int ch, int count, int16_t *data) {
}
void st3m_media_pcm_queue_float(int hz, int ch, int count, float *data) {
if (!audio_media) return;
int16_t gain = audio_media->volume;
switch (hz) {
case 48000:
if (ch == 2)
......@@ -131,9 +132,11 @@ void st3m_media_pcm_queue_float(int hz, int ch, int count, float *data) {
if (ch == 2) {
for (int i = 0; i < count; i++) {
again2:
audio_buffer[audio_w++] = apply_gain(data[i * 2] * 32767,gain);
audio_buffer[audio_w++] =
apply_gain(data[i * 2] * 32767, gain);
ST3M_PCM_CLAMP_AUDIO_W;
audio_buffer[audio_w++] = apply_gain(data[i * 2 + 1] * 32767,gain);
audio_buffer[audio_w++] =
apply_gain(data[i * 2 + 1] * 32767, gain);
ST3M_PCM_CLAMP_AUDIO_W;
phase += fraction;
if (phase > 65536) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment