make frontend-util audio module config-agnostic
This commit is contained in:
parent
16252a85e7
commit
bc4a83abca
|
@ -124,9 +124,9 @@ void Init_Audio(int outputfreq);
|
||||||
int AudioOut_GetNumSamples(int outlen);
|
int AudioOut_GetNumSamples(int outlen);
|
||||||
|
|
||||||
// resample audio from the core audio output to match the frontend's
|
// resample audio from the core audio output to match the frontend's
|
||||||
// output frequency, and apply user-specified volume
|
// output frequency, and apply specified volume
|
||||||
// note: this assumes the output buffer is interleaved stereo
|
// note: this assumes the output buffer is interleaved stereo
|
||||||
void AudioOut_Resample(s16* inbuf, int inlen, s16* outbuf, int outlen);
|
void AudioOut_Resample(s16* inbuf, int inlen, s16* outbuf, int outlen, int volume);
|
||||||
|
|
||||||
// feed silence to the microphone input
|
// feed silence to the microphone input
|
||||||
void Mic_FeedSilence();
|
void Mic_FeedSilence();
|
||||||
|
|
|
@ -22,9 +22,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "FrontendUtil.h"
|
#include "FrontendUtil.h"
|
||||||
#include "Config.h"
|
|
||||||
#include "qt_sdl/PlatformConfig.h" // FIXME!!!
|
|
||||||
#include "Platform.h"
|
|
||||||
|
|
||||||
#include "NDS.h"
|
#include "NDS.h"
|
||||||
|
|
||||||
|
@ -63,14 +60,12 @@ int AudioOut_GetNumSamples(int outlen)
|
||||||
return len_in;
|
return len_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioOut_Resample(s16* inbuf, int inlen, s16* outbuf, int outlen)
|
void AudioOut_Resample(s16* inbuf, int inlen, s16* outbuf, int outlen, int volume)
|
||||||
{
|
{
|
||||||
float res_incr = inlen / (float)outlen;
|
float res_incr = inlen / (float)outlen;
|
||||||
float res_timer = 0;
|
float res_timer = 0;
|
||||||
int res_pos = 0;
|
int res_pos = 0;
|
||||||
|
|
||||||
int volume = Config::AudioVolume;
|
|
||||||
|
|
||||||
for (int i = 0; i < outlen; i++)
|
for (int i = 0; i < outlen; i++)
|
||||||
{
|
{
|
||||||
outbuf[i*2 ] = (inbuf[res_pos*2 ] * volume) >> 8;
|
outbuf[i*2 ] = (inbuf[res_pos*2 ] * volume) >> 8;
|
||||||
|
|
|
@ -110,7 +110,7 @@ void audioCallback(void* data, Uint8* stream, int len)
|
||||||
num_in = len_in-margin;
|
num_in = len_in-margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
Frontend::AudioOut_Resample(buf_in, num_in, (s16*)stream, len);
|
Frontend::AudioOut_Resample(buf_in, num_in, (s16*)stream, len, Config::AudioVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue