mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Reformat all the things. Have fun with merge conflicts.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -191,22 +191,22 @@ namespace ButtonManager
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ButtonState m_state;
|
ButtonState m_state;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Button() : m_state(BUTTON_RELEASED) {}
|
Button() : m_state(BUTTON_RELEASED) {}
|
||||||
void SetState(ButtonState state) { m_state = state; }
|
void SetState(ButtonState state) { m_state = state; }
|
||||||
bool Pressed() { return m_state == BUTTON_PRESSED; }
|
bool Pressed() { return m_state == BUTTON_PRESSED; }
|
||||||
|
|
||||||
~Button() {}
|
~Button() {}
|
||||||
};
|
};
|
||||||
class Axis
|
class Axis
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
float m_value;
|
float m_value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Axis() : m_value(0.0f) {}
|
Axis() : m_value(0.0f) {}
|
||||||
void SetValue(float value) { m_value = value; }
|
void SetValue(float value) { m_value = value; }
|
||||||
float AxisValue() { return m_value; }
|
float AxisValue() { return m_value; }
|
||||||
|
|
||||||
~Axis() {}
|
~Axis() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -219,10 +219,10 @@ namespace ButtonManager
|
|||||||
const float _neg;
|
const float _neg;
|
||||||
sBind(int padID, ButtonType buttontype, BindType bindtype, int bind, float neg)
|
sBind(int padID, ButtonType buttontype, BindType bindtype, int bind, float neg)
|
||||||
: _padID(padID), _buttontype(buttontype), _bindtype(bindtype), _bind(bind), _neg(neg)
|
: _padID(padID), _buttontype(buttontype), _bindtype(bindtype), _bind(bind), _neg(neg)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class InputDevice
|
class InputDevice
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -232,9 +232,9 @@ namespace ButtonManager
|
|||||||
|
|
||||||
// Key is padID and ButtonType
|
// Key is padID and ButtonType
|
||||||
std::map<std::pair<int, ButtonType>, sBind*> _inputbinds;
|
std::map<std::pair<int, ButtonType>, sBind*> _inputbinds;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputDevice(std::string dev)
|
InputDevice(std::string dev) : _dev(dev) {}
|
||||||
: _dev(dev) {}
|
|
||||||
~InputDevice()
|
~InputDevice()
|
||||||
{
|
{
|
||||||
for (const auto& bind : _inputbinds)
|
for (const auto& bind : _inputbinds)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
#include "AudioCommon/AOSoundStream.h"
|
#include "AudioCommon/AOSoundStream.h"
|
||||||
#include "AudioCommon/Mixer.h"
|
#include "AudioCommon/Mixer.h"
|
||||||
#include "Common/MsgHandler.h"
|
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
#include "Common/MsgHandler.h"
|
||||||
|
|
||||||
#if defined(HAVE_AO) && HAVE_AO
|
#if defined(HAVE_AO) && HAVE_AO
|
||||||
|
|
||||||
|
|||||||
@@ -38,10 +38,6 @@ public:
|
|||||||
void Stop() override;
|
void Stop() override;
|
||||||
void Update() override;
|
void Update() override;
|
||||||
|
|
||||||
static bool isValid()
|
static bool isValid() { return true; }
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,13 +6,12 @@
|
|||||||
|
|
||||||
#include "AudioCommon/AlsaSoundStream.h"
|
#include "AudioCommon/AlsaSoundStream.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Thread.h"
|
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
#include "Common/Thread.h"
|
||||||
|
|
||||||
AlsaSound::AlsaSound()
|
AlsaSound::AlsaSound()
|
||||||
: m_thread_status(ALSAThreadStatus::STOPPED)
|
: m_thread_status(ALSAThreadStatus::STOPPED), handle(nullptr),
|
||||||
, handle(nullptr)
|
frames_to_deliver(FRAME_COUNT_MIN)
|
||||||
, frames_to_deliver(FRAME_COUNT_MIN)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +78,6 @@ void AlsaSound::SoundLoop()
|
|||||||
m_thread_status.store(ALSAThreadStatus::STOPPED);
|
m_thread_status.store(ALSAThreadStatus::STOPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AlsaSound::Clear(bool muted)
|
void AlsaSound::Clear(bool muted)
|
||||||
{
|
{
|
||||||
m_muted = muted;
|
m_muted = muted;
|
||||||
@@ -188,7 +186,9 @@ bool AlsaSound::AlsaInit()
|
|||||||
// it is probably a bad idea to try to send more than one buffer of data
|
// it is probably a bad idea to try to send more than one buffer of data
|
||||||
if ((unsigned int)frames_to_deliver > buffer_size)
|
if ((unsigned int)frames_to_deliver > buffer_size)
|
||||||
frames_to_deliver = buffer_size;
|
frames_to_deliver = buffer_size;
|
||||||
NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver);
|
NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d "
|
||||||
|
"samples per fragments.\n",
|
||||||
|
buffer_size, periods, frames_to_deliver);
|
||||||
|
|
||||||
snd_pcm_sw_params_alloca(&swparams);
|
snd_pcm_sw_params_alloca(&swparams);
|
||||||
|
|
||||||
@@ -232,4 +232,3 @@ void AlsaSound::AlsaShutdown()
|
|||||||
handle = nullptr;
|
handle = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,7 @@ public:
|
|||||||
void Update() override;
|
void Update() override;
|
||||||
void Clear(bool) override;
|
void Clear(bool) override;
|
||||||
|
|
||||||
static bool isValid()
|
static bool isValid() { return true; }
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// maximum number of frames the buffer can hold
|
// maximum number of frames the buffer can hold
|
||||||
static constexpr size_t BUFFER_SIZE_MAX = 8192;
|
static constexpr size_t BUFFER_SIZE_MAX = 8192;
|
||||||
|
|||||||
@@ -2,22 +2,21 @@
|
|||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
|
||||||
#include "AudioCommon/AlsaSoundStream.h"
|
|
||||||
#include "AudioCommon/AOSoundStream.h"
|
|
||||||
#include "AudioCommon/AudioCommon.h"
|
#include "AudioCommon/AudioCommon.h"
|
||||||
|
#include "AudioCommon/AOSoundStream.h"
|
||||||
|
#include "AudioCommon/AlsaSoundStream.h"
|
||||||
#include "AudioCommon/CoreAudioSoundStream.h"
|
#include "AudioCommon/CoreAudioSoundStream.h"
|
||||||
#include "AudioCommon/Mixer.h"
|
#include "AudioCommon/Mixer.h"
|
||||||
#include "AudioCommon/NullSoundStream.h"
|
#include "AudioCommon/NullSoundStream.h"
|
||||||
#include "AudioCommon/OpenALStream.h"
|
#include "AudioCommon/OpenALStream.h"
|
||||||
#include "AudioCommon/OpenSLESStream.h"
|
#include "AudioCommon/OpenSLESStream.h"
|
||||||
#include "AudioCommon/PulseAudioStream.h"
|
#include "AudioCommon/PulseAudioStream.h"
|
||||||
#include "AudioCommon/XAudio2_7Stream.h"
|
|
||||||
#include "AudioCommon/XAudio2Stream.h"
|
#include "AudioCommon/XAudio2Stream.h"
|
||||||
|
#include "AudioCommon/XAudio2_7Stream.h"
|
||||||
#include "Common/Common.h"
|
#include "Common/Common.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/MsgHandler.h"
|
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
#include "Common/MsgHandler.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
|
|
||||||
@@ -58,8 +57,8 @@ namespace AudioCommon
|
|||||||
|
|
||||||
if (!g_sound_stream && NullSound::isValid())
|
if (!g_sound_stream && NullSound::isValid())
|
||||||
{
|
{
|
||||||
WARN_LOG(AUDIO, "Could not initialize backend %s, using %s instead.",
|
WARN_LOG(AUDIO, "Could not initialize backend %s, using %s instead.", backend.c_str(),
|
||||||
backend.c_str(), BACKEND_NULLSOUND);
|
BACKEND_NULLSOUND);
|
||||||
g_sound_stream = new NullSound();
|
g_sound_stream = new NullSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +67,8 @@ namespace AudioCommon
|
|||||||
UpdateSoundStream();
|
UpdateSoundStream();
|
||||||
if (!g_sound_stream->Start())
|
if (!g_sound_stream->Start())
|
||||||
{
|
{
|
||||||
ERROR_LOG(AUDIO, "Could not start backend %s, using %s instead",
|
ERROR_LOG(AUDIO, "Could not start backend %s, using %s instead", backend.c_str(),
|
||||||
backend.c_str(), BACKEND_NULLSOUND);
|
BACKEND_NULLSOUND);
|
||||||
delete g_sound_stream;
|
delete g_sound_stream;
|
||||||
g_sound_stream = new NullSound();
|
g_sound_stream = new NullSound();
|
||||||
g_sound_stream->Start();
|
g_sound_stream->Start();
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "AudioCommon/SoundStream.h"
|
#include "AudioCommon/SoundStream.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
|
||||||
class CMixer;
|
class CMixer;
|
||||||
|
|
||||||
extern SoundStream* g_sound_stream;
|
extern SoundStream* g_sound_stream;
|
||||||
|
|||||||
@@ -7,15 +7,13 @@
|
|||||||
#include "AudioCommon/CoreAudioSoundStream.h"
|
#include "AudioCommon/CoreAudioSoundStream.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
|
||||||
OSStatus CoreAudioSound::callback(void *inRefCon,
|
OSStatus CoreAudioSound::callback(void* inRefCon, AudioUnitRenderActionFlags* ioActionFlags,
|
||||||
AudioUnitRenderActionFlags *ioActionFlags,
|
|
||||||
const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
|
const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
|
||||||
UInt32 inNumberFrames, AudioBufferList* ioData)
|
UInt32 inNumberFrames, AudioBufferList* ioData)
|
||||||
{
|
{
|
||||||
for (UInt32 i = 0; i < ioData->mNumberBuffers; i++)
|
for (UInt32 i = 0; i < ioData->mNumberBuffers; i++)
|
||||||
((CoreAudioSound *)inRefCon)->m_mixer->
|
((CoreAudioSound*)inRefCon)
|
||||||
Mix((short *)ioData->mBuffers[i].mData,
|
->m_mixer->Mix((short*)ioData->mBuffers[i].mData, ioData->mBuffers[i].mDataByteSize / 4);
|
||||||
ioData->mBuffers[i].mDataByteSize / 4);
|
|
||||||
|
|
||||||
return noErr;
|
return noErr;
|
||||||
}
|
}
|
||||||
@@ -47,12 +45,9 @@ bool CoreAudioSound::Start()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FillOutASBDForLPCM(format, m_mixer->GetSampleRate(),
|
FillOutASBDForLPCM(format, m_mixer->GetSampleRate(), 2, 16, 16, false, false, false);
|
||||||
2, 16, 16, false, false, false);
|
err = AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0,
|
||||||
err = AudioUnitSetProperty(audioUnit,
|
&format, sizeof(AudioStreamBasicDescription));
|
||||||
kAudioUnitProperty_StreamFormat,
|
|
||||||
kAudioUnitScope_Input, 0, &format,
|
|
||||||
sizeof(AudioStreamBasicDescription));
|
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
{
|
{
|
||||||
ERROR_LOG(AUDIO, "error setting audio format");
|
ERROR_LOG(AUDIO, "error setting audio format");
|
||||||
@@ -61,19 +56,15 @@ bool CoreAudioSound::Start()
|
|||||||
|
|
||||||
callback_struct.inputProc = callback;
|
callback_struct.inputProc = callback;
|
||||||
callback_struct.inputProcRefCon = this;
|
callback_struct.inputProcRefCon = this;
|
||||||
err = AudioUnitSetProperty(audioUnit,
|
err = AudioUnitSetProperty(audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
|
||||||
kAudioUnitProperty_SetRenderCallback,
|
0, &callback_struct, sizeof callback_struct);
|
||||||
kAudioUnitScope_Input, 0, &callback_struct,
|
|
||||||
sizeof callback_struct);
|
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
{
|
{
|
||||||
ERROR_LOG(AUDIO, "error setting audio callback");
|
ERROR_LOG(AUDIO, "error setting audio callback");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = AudioUnitSetParameter(audioUnit,
|
err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0,
|
||||||
kHALOutputParam_Volume,
|
|
||||||
kAudioUnitScope_Output, 0,
|
|
||||||
m_volume / 100., 0);
|
m_volume / 100., 0);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
ERROR_LOG(AUDIO, "error setting volume");
|
ERROR_LOG(AUDIO, "error setting volume");
|
||||||
@@ -100,9 +91,7 @@ void CoreAudioSound::SetVolume(int volume)
|
|||||||
OSStatus err;
|
OSStatus err;
|
||||||
m_volume = volume;
|
m_volume = volume;
|
||||||
|
|
||||||
err = AudioUnitSetParameter(audioUnit,
|
err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0,
|
||||||
kHALOutputParam_Volume,
|
|
||||||
kAudioUnitScope_Output, 0,
|
|
||||||
volume / 100., 0);
|
volume / 100., 0);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
ERROR_LOG(AUDIO, "error setting volume");
|
ERROR_LOG(AUDIO, "error setting volume");
|
||||||
|
|||||||
@@ -20,19 +20,13 @@ public:
|
|||||||
void Stop() override;
|
void Stop() override;
|
||||||
void Update() override;
|
void Update() override;
|
||||||
|
|
||||||
static bool isValid()
|
static bool isValid() { return true; }
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioUnit audioUnit;
|
AudioUnit audioUnit;
|
||||||
int m_volume;
|
int m_volume;
|
||||||
|
|
||||||
static OSStatus callback(void *inRefCon,
|
static OSStatus callback(void* inRefCon, AudioUnitRenderActionFlags* ioActionFlags,
|
||||||
AudioUnitRenderActionFlags *ioActionFlags,
|
const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
|
||||||
const AudioTimeStamp *inTimeStamp,
|
UInt32 inNumberFrames, AudioBufferList* ioData);
|
||||||
UInt32 inBusNumber, UInt32 inNumberFrames,
|
|
||||||
AudioBufferList *ioData);
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ static T FIRFilter(const T *buf, int pos, int len, int count, const float *coeff
|
|||||||
if (pos >= count)
|
if (pos >= count)
|
||||||
{
|
{
|
||||||
pos -= count;
|
pos -= count;
|
||||||
count1 = count; count2 = 0;
|
count1 = count;
|
||||||
|
count2 = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -80,7 +81,8 @@ static T FIRFilter(const T *buf, int pos, int len, int count, const float *coeff
|
|||||||
// high part of window
|
// high part of window
|
||||||
const T* ptr = &buf[pos];
|
const T* ptr = &buf[pos];
|
||||||
|
|
||||||
float r1 = DotProduct(count1, ptr, coefficients); coefficients += count1;
|
float r1 = DotProduct(count1, ptr, coefficients);
|
||||||
|
coefficients += count1;
|
||||||
float r2 = DotProduct(count2, buf, coefficients);
|
float r2 = DotProduct(count2, buf, coefficients);
|
||||||
return T(r1 + r2);
|
return T(r1 + r2);
|
||||||
}
|
}
|
||||||
@@ -167,7 +169,6 @@ static float* DesignFIR(unsigned int *n, float* fc, float opt)
|
|||||||
g += 2 * w[end - i - 1]; // Total gain in filter
|
g += 2 * w[end - i - 1]; // Total gain in filter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Normalize gain
|
// Normalize gain
|
||||||
g = 1 / g;
|
g = 1 / g;
|
||||||
for (u32 i = 0; i < *n; i++)
|
for (u32 i = 0; i < *n; i++)
|
||||||
@@ -219,26 +220,24 @@ static float* CalculateCoefficients125HzLowpass(int rate)
|
|||||||
|
|
||||||
static float PassiveLock(float x)
|
static float PassiveLock(float x)
|
||||||
{
|
{
|
||||||
static const float MATAGCLOCK = 0.2f; /* AGC range (around 1) where the matrix behaves passively */
|
static const float MATAGCLOCK =
|
||||||
|
0.2f; /* AGC range (around 1) where the matrix behaves passively */
|
||||||
const float x1 = x - 1;
|
const float x1 = x - 1;
|
||||||
const float ax1s = fabs(x - 1) * (1.0f / MATAGCLOCK);
|
const float ax1s = fabs(x - 1) * (1.0f / MATAGCLOCK);
|
||||||
return x1 - x1 / (1 + ax1s * ax1s) + 1;
|
return x1 - x1 / (1 + ax1s * ax1s) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MatrixDecode(const float *in, const int k, const int il,
|
static void MatrixDecode(const float* in, const int k, const int il, const int ir, bool decode_rear,
|
||||||
const int ir, bool decode_rear,
|
const int _dlbuflen, float _l_fwr, float _r_fwr, float _lpr_fwr,
|
||||||
const int _dlbuflen,
|
float _lmr_fwr, float* _adapt_l_gain, float* _adapt_r_gain,
|
||||||
float _l_fwr, float _r_fwr,
|
float* _adapt_lpr_gain, float* _adapt_lmr_gain, float* _lf, float* _rf,
|
||||||
float _lpr_fwr, float _lmr_fwr,
|
float* _lr, float* _rr, float* _cf)
|
||||||
float *_adapt_l_gain, float *_adapt_r_gain,
|
|
||||||
float *_adapt_lpr_gain, float *_adapt_lmr_gain,
|
|
||||||
float *_lf, float *_rf, float *_lr,
|
|
||||||
float *_rr, float *_cf)
|
|
||||||
{
|
{
|
||||||
static const float M9_03DB = 0.3535533906f;
|
static const float M9_03DB = 0.3535533906f;
|
||||||
static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */
|
static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */
|
||||||
static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */
|
static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */
|
||||||
static const float MATCOMPGAIN = 0.37f; /* Cross talk compensation gain, 0.50 - 0.55 is full cancellation. */
|
static const float MATCOMPGAIN =
|
||||||
|
0.37f; /* Cross talk compensation gain, 0.50 - 0.55 is full cancellation. */
|
||||||
|
|
||||||
const int kr = (k + olddelay) % _dlbuflen;
|
const int kr = (k + olddelay) % _dlbuflen;
|
||||||
float l_gain = (_l_fwr + _r_fwr) / (1 + _l_fwr + _l_fwr);
|
float l_gain = (_l_fwr + _r_fwr) / (1 + _l_fwr + _l_fwr);
|
||||||
@@ -357,12 +356,9 @@ void DPL2Decode(float *samples, int numsamples, float *out)
|
|||||||
/* Matrix encoded 2 channel sources */
|
/* Matrix encoded 2 channel sources */
|
||||||
fwrbuf_l[k] = in[0];
|
fwrbuf_l[k] = in[0];
|
||||||
fwrbuf_r[k] = in[1];
|
fwrbuf_r[k] = in[1];
|
||||||
MatrixDecode(in, k, 0, 1, true, dlbuflen,
|
MatrixDecode(in, k, 0, 1, true, dlbuflen, l_fwr, r_fwr, lpr_fwr, lmr_fwr, &adapt_l_gain,
|
||||||
l_fwr, r_fwr,
|
&adapt_r_gain, &adapt_lpr_gain, &adapt_lmr_gain, &lf[0], &rf[0], &lr[0], &rr[0],
|
||||||
lpr_fwr, lmr_fwr,
|
&cf[0]);
|
||||||
&adapt_l_gain, &adapt_r_gain,
|
|
||||||
&adapt_lpr_gain, &adapt_lmr_gain,
|
|
||||||
&lf[0], &rf[0], &lr[0], &rr[0], &cf[0]);
|
|
||||||
|
|
||||||
out[cur + 0] = lf[k];
|
out[cur + 0] = lf[k];
|
||||||
out[cur + 1] = rf[k];
|
out[cur + 1] = rf[k];
|
||||||
|
|||||||
@@ -8,16 +8,15 @@
|
|||||||
#include "AudioCommon/Mixer.h"
|
#include "AudioCommon/Mixer.h"
|
||||||
#include "Common/CommonFuncs.h"
|
#include "Common/CommonFuncs.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/MathUtil.h"
|
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
#include "Common/MathUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
|
||||||
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
|
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
|
||||||
#include <tmmintrin.h>
|
#include <tmmintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CMixer::CMixer(unsigned int BackendSampleRate)
|
CMixer::CMixer(unsigned int BackendSampleRate) : m_sampleRate(BackendSampleRate)
|
||||||
: m_sampleRate(BackendSampleRate)
|
|
||||||
{
|
{
|
||||||
INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
|
INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
|
||||||
}
|
}
|
||||||
@@ -27,7 +26,8 @@ CMixer::~CMixer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Executed from sound stream thread
|
// Executed from sound stream thread
|
||||||
unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, bool consider_framelimit)
|
unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
|
||||||
|
bool consider_framelimit)
|
||||||
{
|
{
|
||||||
unsigned int currentSample = 0;
|
unsigned int currentSample = 0;
|
||||||
|
|
||||||
@@ -47,8 +47,10 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo
|
|||||||
float numLeft = (float)(((indexW - indexR) & INDEX_MASK) / 2);
|
float numLeft = (float)(((indexW - indexR) & INDEX_MASK) / 2);
|
||||||
m_numLeftI = (numLeft + m_numLeftI * (CONTROL_AVG - 1)) / CONTROL_AVG;
|
m_numLeftI = (numLeft + m_numLeftI * (CONTROL_AVG - 1)) / CONTROL_AVG;
|
||||||
float offset = (m_numLeftI - low_waterwark) * CONTROL_FACTOR;
|
float offset = (m_numLeftI - low_waterwark) * CONTROL_FACTOR;
|
||||||
if (offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT;
|
if (offset > MAX_FREQ_SHIFT)
|
||||||
if (offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT;
|
offset = MAX_FREQ_SHIFT;
|
||||||
|
if (offset < -MAX_FREQ_SHIFT)
|
||||||
|
offset = -MAX_FREQ_SHIFT;
|
||||||
|
|
||||||
// render numleft sample pairs to samples[]
|
// render numleft sample pairs to samples[]
|
||||||
// advance indexR with sample position
|
// advance indexR with sample position
|
||||||
@@ -167,7 +169,8 @@ void CMixer::PushStreamingSamples(const short *samples, unsigned int num_samples
|
|||||||
m_wave_writer_dtk.AddStereoSamplesBE(samples, num_samples);
|
m_wave_writer_dtk.AddStereoSamplesBE(samples, num_samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMixer::PushWiimoteSpeakerSamples(const short *samples, unsigned int num_samples, unsigned int sample_rate)
|
void CMixer::PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples,
|
||||||
|
unsigned int sample_rate)
|
||||||
{
|
{
|
||||||
short samples_stereo[MAX_SAMPLES * 2];
|
short samples_stereo[MAX_SAMPLES * 2];
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ public:
|
|||||||
// Called from main thread
|
// Called from main thread
|
||||||
void PushSamples(const short* samples, unsigned int num_samples);
|
void PushSamples(const short* samples, unsigned int num_samples);
|
||||||
void PushStreamingSamples(const short* samples, unsigned int num_samples);
|
void PushStreamingSamples(const short* samples, unsigned int num_samples);
|
||||||
void PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples, unsigned int sample_rate);
|
void PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples,
|
||||||
|
unsigned int sample_rate);
|
||||||
unsigned int GetSampleRate() const { return m_sampleRate; }
|
unsigned int GetSampleRate() const { return m_sampleRate; }
|
||||||
|
|
||||||
void SetDMAInputSampleRate(unsigned int rate);
|
void SetDMAInputSampleRate(unsigned int rate);
|
||||||
void SetStreamInputSampleRate(unsigned int rate);
|
void SetStreamInputSampleRate(unsigned int rate);
|
||||||
void SetStreamingVolume(unsigned int lvolume, unsigned int rvolume);
|
void SetStreamingVolume(unsigned int lvolume, unsigned int rvolume);
|
||||||
@@ -38,7 +38,6 @@ public:
|
|||||||
|
|
||||||
float GetCurrentSpeed() const { return m_speed.load(); }
|
float GetCurrentSpeed() const { return m_speed.load(); }
|
||||||
void UpdateSpeed(float val) { m_speed.store(val); }
|
void UpdateSpeed(float val) { m_speed.store(val); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr u32 MAX_SAMPLES = 1024 * 4; // 128 ms
|
static constexpr u32 MAX_SAMPLES = 1024 * 4; // 128 ms
|
||||||
static constexpr u32 INDEX_MASK = MAX_SAMPLES * 2 - 1;
|
static constexpr u32 INDEX_MASK = MAX_SAMPLES * 2 - 1;
|
||||||
@@ -50,14 +49,14 @@ private:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MixerFifo(CMixer* mixer, unsigned sample_rate)
|
MixerFifo(CMixer* mixer, unsigned sample_rate)
|
||||||
: m_mixer(mixer)
|
: m_mixer(mixer), m_input_sample_rate(sample_rate)
|
||||||
, m_input_sample_rate(sample_rate)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void PushSamples(const short* samples, unsigned int num_samples);
|
void PushSamples(const short* samples, unsigned int num_samples);
|
||||||
unsigned int Mix(short* samples, unsigned int numSamples, bool consider_framelimit = true);
|
unsigned int Mix(short* samples, unsigned int numSamples, bool consider_framelimit = true);
|
||||||
void SetInputSampleRate(unsigned int rate);
|
void SetInputSampleRate(unsigned int rate);
|
||||||
void SetVolume(unsigned int lvolume, unsigned int rvolume);
|
void SetVolume(unsigned int lvolume, unsigned int rvolume);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMixer* m_mixer;
|
CMixer* m_mixer;
|
||||||
unsigned m_input_sample_rate;
|
unsigned m_input_sample_rate;
|
||||||
|
|||||||
@@ -25,9 +25,12 @@ void NullSound::Update()
|
|||||||
// num_samples_to_render in this update - depends on SystemTimers::AUDIO_DMA_PERIOD.
|
// num_samples_to_render in this update - depends on SystemTimers::AUDIO_DMA_PERIOD.
|
||||||
constexpr u32 stereo_16_bit_size = 4;
|
constexpr u32 stereo_16_bit_size = 4;
|
||||||
constexpr u32 dma_length = 32;
|
constexpr u32 dma_length = 32;
|
||||||
const u64 audio_dma_period = SystemTimers::GetTicksPerSecond() / (AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length);
|
const u64 audio_dma_period =
|
||||||
|
SystemTimers::GetTicksPerSecond() /
|
||||||
|
(AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length);
|
||||||
const u64 ais_samples_per_second = 48000 * stereo_16_bit_size;
|
const u64 ais_samples_per_second = 48000 * stereo_16_bit_size;
|
||||||
const u64 num_samples_to_render = (audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond();
|
const u64 num_samples_to_render =
|
||||||
|
(audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond();
|
||||||
|
|
||||||
m_mixer->Mix(m_realtime_buffer.data(), (unsigned int)num_samples_to_render);
|
m_mixer->Mix(m_realtime_buffer.data(), (unsigned int)num_samples_to_render);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ public:
|
|||||||
void Update() override;
|
void Update() override;
|
||||||
|
|
||||||
static bool isValid() { return true; }
|
static bool isValid() { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr size_t BUFFER_SIZE = 48000 * 4 / 32;
|
static constexpr size_t BUFFER_SIZE = 48000 * 4 / 32;
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "AudioCommon/aldlist.h"
|
|
||||||
#include "AudioCommon/DPL2Decoder.h"
|
#include "AudioCommon/DPL2Decoder.h"
|
||||||
#include "AudioCommon/OpenALStream.h"
|
#include "AudioCommon/OpenALStream.h"
|
||||||
#include "Common/Thread.h"
|
#include "AudioCommon/aldlist.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
#include "Common/Thread.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
|
||||||
#if defined HAVE_OPENAL && HAVE_OPENAL
|
#if defined HAVE_OPENAL && HAVE_OPENAL
|
||||||
@@ -149,7 +149,8 @@ void OpenALStream::SoundLoop()
|
|||||||
memset(uiBuffers, 0, numBuffers * sizeof(ALuint));
|
memset(uiBuffers, 0, numBuffers * sizeof(ALuint));
|
||||||
uiSource = 0;
|
uiSource = 0;
|
||||||
|
|
||||||
// Checks if a X-Fi is being used. If it is, disable FLOAT32 support as this sound card has no support for it even though it reports it does.
|
// Checks if a X-Fi is being used. If it is, disable FLOAT32 support as this sound card has no
|
||||||
|
// support for it even though it reports it does.
|
||||||
if (strstr(alGetString(AL_RENDERER), "X-Fi"))
|
if (strstr(alGetString(AL_RENDERER), "X-Fi"))
|
||||||
float32_capable = false;
|
float32_capable = false;
|
||||||
|
|
||||||
@@ -171,13 +172,16 @@ void OpenALStream::SoundLoop()
|
|||||||
if (surround_capable)
|
if (surround_capable)
|
||||||
{
|
{
|
||||||
if (float32_capable)
|
if (float32_capable)
|
||||||
alBufferData(uiBuffers[i], AL_FORMAT_51CHN32, sampleBuffer, 4 * FRAME_SURROUND_FLOAT, ulFrequency);
|
alBufferData(uiBuffers[i], AL_FORMAT_51CHN32, sampleBuffer, 4 * FRAME_SURROUND_FLOAT,
|
||||||
|
ulFrequency);
|
||||||
else
|
else
|
||||||
alBufferData(uiBuffers[i], AL_FORMAT_51CHN16, sampleBuffer, 4 * FRAME_SURROUND_SHORT, ulFrequency);
|
alBufferData(uiBuffers[i], AL_FORMAT_51CHN16, sampleBuffer, 4 * FRAME_SURROUND_SHORT,
|
||||||
|
ulFrequency);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alBufferData(uiBuffers[i], AL_FORMAT_STEREO16, realtimeBuffer, 4 * FRAME_STEREO_SHORT, ulFrequency);
|
alBufferData(uiBuffers[i], AL_FORMAT_STEREO16, realtimeBuffer, 4 * FRAME_STEREO_SHORT,
|
||||||
|
ulFrequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alSourceQueueBuffers(uiSource, numBuffers, uiBuffers);
|
alSourceQueueBuffers(uiSource, numBuffers, uiBuffers);
|
||||||
@@ -209,11 +213,14 @@ void OpenALStream::SoundLoop()
|
|||||||
const u32 stereo_16_bit_size = 4;
|
const u32 stereo_16_bit_size = 4;
|
||||||
const u32 dma_length = 32;
|
const u32 dma_length = 32;
|
||||||
const u64 ais_samples_per_second = 48000 * stereo_16_bit_size;
|
const u64 ais_samples_per_second = 48000 * stereo_16_bit_size;
|
||||||
u64 audio_dma_period = SystemTimers::GetTicksPerSecond() / (AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length);
|
u64 audio_dma_period = SystemTimers::GetTicksPerSecond() /
|
||||||
u64 num_samples_to_render = (audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond();
|
(AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length);
|
||||||
|
u64 num_samples_to_render =
|
||||||
|
(audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond();
|
||||||
|
|
||||||
unsigned int numSamples = (unsigned int)num_samples_to_render;
|
unsigned int numSamples = (unsigned int)num_samples_to_render;
|
||||||
unsigned int minSamples = surround_capable ? 240 : 0; // DPL2 accepts 240 samples minimum (FWRDURATION)
|
unsigned int minSamples =
|
||||||
|
surround_capable ? 240 : 0; // DPL2 accepts 240 samples minimum (FWRDURATION)
|
||||||
|
|
||||||
numSamples = (numSamples > OAL_MAX_SAMPLES) ? OAL_MAX_SAMPLES : numSamples;
|
numSamples = (numSamples > OAL_MAX_SAMPLES) ? OAL_MAX_SAMPLES : numSamples;
|
||||||
numSamples = m_mixer->Mix(realtimeBuffer, numSamples, false);
|
numSamples = m_mixer->Mix(realtimeBuffer, numSamples, false);
|
||||||
@@ -256,7 +263,8 @@ void OpenALStream::SoundLoop()
|
|||||||
if (nSamples <= minSamples)
|
if (nSamples <= minSamples)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Remove the Buffer from the Queue. (uiBuffer contains the Buffer ID for the unqueued Buffer)
|
// Remove the Buffer from the Queue. (uiBuffer contains the Buffer ID for the unqueued
|
||||||
|
// Buffer)
|
||||||
if (iBuffersFilled == 0)
|
if (iBuffersFilled == 0)
|
||||||
{
|
{
|
||||||
alSourceUnqueueBuffers(uiSource, iBuffersProcessed, uiBufferTemp);
|
alSourceUnqueueBuffers(uiSource, iBuffersProcessed, uiBufferTemp);
|
||||||
@@ -283,7 +291,8 @@ void OpenALStream::SoundLoop()
|
|||||||
|
|
||||||
if (float32_capable)
|
if (float32_capable)
|
||||||
{
|
{
|
||||||
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN32, dpl2, nSamples * FRAME_SURROUND_FLOAT, ulFrequency);
|
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN32, dpl2,
|
||||||
|
nSamples * FRAME_SURROUND_FLOAT, ulFrequency);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -291,14 +300,16 @@ void OpenALStream::SoundLoop()
|
|||||||
for (u32 i = 0; i < nSamples * SURROUND_CHANNELS; ++i)
|
for (u32 i = 0; i < nSamples * SURROUND_CHANNELS; ++i)
|
||||||
surround_short[i] = (short)((float)dpl2[i] * (1 << 15));
|
surround_short[i] = (short)((float)dpl2[i] * (1 << 15));
|
||||||
|
|
||||||
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN16, surround_short, nSamples * FRAME_SURROUND_SHORT, ulFrequency);
|
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN16, surround_short,
|
||||||
|
nSamples * FRAME_SURROUND_SHORT, ulFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALenum err = alGetError();
|
ALenum err = alGetError();
|
||||||
if (err == AL_INVALID_ENUM)
|
if (err == AL_INVALID_ENUM)
|
||||||
{
|
{
|
||||||
// 5.1 is not supported by the host, fallback to stereo
|
// 5.1 is not supported by the host, fallback to stereo
|
||||||
WARN_LOG(AUDIO, "Unable to set 5.1 surround mode. Updating OpenAL Soft might fix this issue.");
|
WARN_LOG(AUDIO,
|
||||||
|
"Unable to set 5.1 surround mode. Updating OpenAL Soft might fix this issue.");
|
||||||
surround_capable = false;
|
surround_capable = false;
|
||||||
}
|
}
|
||||||
else if (err != 0)
|
else if (err != 0)
|
||||||
@@ -311,7 +322,8 @@ void OpenALStream::SoundLoop()
|
|||||||
{
|
{
|
||||||
if (float32_capable)
|
if (float32_capable)
|
||||||
{
|
{
|
||||||
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO_FLOAT32, sampleBuffer, nSamples * FRAME_STEREO_FLOAT, ulFrequency);
|
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO_FLOAT32, sampleBuffer,
|
||||||
|
nSamples * FRAME_STEREO_FLOAT, ulFrequency);
|
||||||
ALenum err = alGetError();
|
ALenum err = alGetError();
|
||||||
if (err == AL_INVALID_ENUM)
|
if (err == AL_INVALID_ENUM)
|
||||||
{
|
{
|
||||||
@@ -330,7 +342,8 @@ void OpenALStream::SoundLoop()
|
|||||||
for (u32 i = 0; i < nSamples * STEREO_CHANNELS; ++i)
|
for (u32 i = 0; i < nSamples * STEREO_CHANNELS; ++i)
|
||||||
stereo[i] = (short)((float)sampleBuffer[i] * (1 << 15));
|
stereo[i] = (short)((float)sampleBuffer[i] * (1 << 15));
|
||||||
|
|
||||||
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO16, stereo, nSamples * FRAME_STEREO_SHORT, ulFrequency);
|
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO16, stereo,
|
||||||
|
nSamples * FRAME_STEREO_SHORT, ulFrequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,4 +385,3 @@ void OpenALStream::SoundLoop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAVE_OPENAL
|
#endif // HAVE_OPENAL
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#define BOOL SoundTouch_BOOL
|
#define BOOL SoundTouch_BOOL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <soundtouch/SoundTouch.h>
|
|
||||||
#include <soundtouch/STTypes.h>
|
#include <soundtouch/STTypes.h>
|
||||||
|
#include <soundtouch/SoundTouch.h>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#undef BOOL
|
#undef BOOL
|
||||||
@@ -57,10 +57,7 @@ class OpenALStream final : public SoundStream
|
|||||||
{
|
{
|
||||||
#if defined HAVE_OPENAL && HAVE_OPENAL
|
#if defined HAVE_OPENAL && HAVE_OPENAL
|
||||||
public:
|
public:
|
||||||
OpenALStream() : uiSource(0)
|
OpenALStream() : uiSource(0) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Start() override;
|
bool Start() override;
|
||||||
void SoundLoop() override;
|
void SoundLoop() override;
|
||||||
void SetVolume(int volume) override;
|
void SetVolume(int volume) override;
|
||||||
@@ -69,7 +66,6 @@ public:
|
|||||||
void Update() override;
|
void Update() override;
|
||||||
|
|
||||||
static bool isValid() { return true; }
|
static bool isValid() { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::thread thread;
|
std::thread thread;
|
||||||
std::atomic<bool> m_run_thread;
|
std::atomic<bool> m_run_thread;
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
|
|||||||
|
|
||||||
// Render to the fresh buffer
|
// Render to the fresh buffer
|
||||||
g_mixer->Mix(reinterpret_cast<short*>(buffer[curBuffer]), BUFFER_SIZE_IN_SAMPLES);
|
g_mixer->Mix(reinterpret_cast<short*>(buffer[curBuffer]), BUFFER_SIZE_IN_SAMPLES);
|
||||||
SLresult result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[0]));
|
SLresult result =
|
||||||
|
(*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[0]));
|
||||||
curBuffer ^= 1; // Switch buffer
|
curBuffer ^= 1; // Switch buffer
|
||||||
|
|
||||||
// Comment from sample code:
|
// Comment from sample code:
|
||||||
@@ -64,15 +65,13 @@ bool OpenSLESStream::Start()
|
|||||||
assert(SL_RESULT_SUCCESS == result);
|
assert(SL_RESULT_SUCCESS == result);
|
||||||
|
|
||||||
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
|
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
|
||||||
SLDataFormat_PCM format_pcm = {
|
SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM,
|
||||||
SL_DATAFORMAT_PCM,
|
|
||||||
2,
|
2,
|
||||||
m_mixer->GetSampleRate() * 1000,
|
m_mixer->GetSampleRate() * 1000,
|
||||||
SL_PCMSAMPLEFORMAT_FIXED_16,
|
SL_PCMSAMPLEFORMAT_FIXED_16,
|
||||||
SL_PCMSAMPLEFORMAT_FIXED_16,
|
SL_PCMSAMPLEFORMAT_FIXED_16,
|
||||||
SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT,
|
SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT,
|
||||||
SL_BYTEORDER_LITTLEENDIAN
|
SL_BYTEORDER_LITTLEENDIAN};
|
||||||
};
|
|
||||||
|
|
||||||
SLDataSource audioSrc = {&loc_bufq, &format_pcm};
|
SLDataSource audioSrc = {&loc_bufq, &format_pcm};
|
||||||
|
|
||||||
@@ -83,15 +82,17 @@ bool OpenSLESStream::Start()
|
|||||||
// create audio player
|
// create audio player
|
||||||
const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME};
|
const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME};
|
||||||
const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
|
const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
|
||||||
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req);
|
result =
|
||||||
|
(*engineEngine)
|
||||||
|
->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req);
|
||||||
assert(SL_RESULT_SUCCESS == result);
|
assert(SL_RESULT_SUCCESS == result);
|
||||||
|
|
||||||
result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE);
|
result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE);
|
||||||
assert(SL_RESULT_SUCCESS == result);
|
assert(SL_RESULT_SUCCESS == result);
|
||||||
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay);
|
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay);
|
||||||
assert(SL_RESULT_SUCCESS == result);
|
assert(SL_RESULT_SUCCESS == result);
|
||||||
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE,
|
result =
|
||||||
&bqPlayerBufferQueue);
|
(*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, &bqPlayerBufferQueue);
|
||||||
assert(SL_RESULT_SUCCESS == result);
|
assert(SL_RESULT_SUCCESS == result);
|
||||||
result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr);
|
result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr);
|
||||||
assert(SL_RESULT_SUCCESS == result);
|
assert(SL_RESULT_SUCCESS == result);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ public:
|
|||||||
bool Start() override;
|
bool Start() override;
|
||||||
void Stop() override;
|
void Stop() override;
|
||||||
static bool isValid() { return true; }
|
static bool isValid() { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::thread thread;
|
std::thread thread;
|
||||||
Common::Event soundSyncEvent;
|
Common::Event soundSyncEvent;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user