Merge pull request #5701 from ligfx/renamecmixertomixer
Rename CMixer to Mixer
This commit is contained in:
commit
4ad46f1c7c
|
@ -181,7 +181,7 @@ void SendAIBuffer(const short* samples, unsigned int num_samples)
|
|||
else if (!SConfig::GetInstance().m_DumpAudio && s_audio_dump_start)
|
||||
StopAudioDump();
|
||||
|
||||
CMixer* pMixer = g_sound_stream->GetMixer();
|
||||
Mixer* pMixer = g_sound_stream->GetMixer();
|
||||
|
||||
if (pMixer && samples)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "AudioCommon/SoundStream.h"
|
||||
|
||||
class CMixer;
|
||||
class Mixer;
|
||||
|
||||
extern std::unique_ptr<SoundStream> g_sound_stream;
|
||||
|
||||
|
|
|
@ -14,20 +14,20 @@
|
|||
#include "Common/Swap.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
CMixer::CMixer(unsigned int BackendSampleRate)
|
||||
Mixer::Mixer(unsigned int BackendSampleRate)
|
||||
: m_sampleRate(BackendSampleRate), m_stretcher(BackendSampleRate)
|
||||
{
|
||||
INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
|
||||
DPL2Reset();
|
||||
}
|
||||
|
||||
CMixer::~CMixer()
|
||||
Mixer::~Mixer()
|
||||
{
|
||||
}
|
||||
|
||||
// Executed from sound stream thread
|
||||
unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
|
||||
bool consider_framelimit)
|
||||
unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
|
||||
bool consider_framelimit)
|
||||
{
|
||||
unsigned int currentSample = 0;
|
||||
|
||||
|
@ -117,7 +117,7 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
|
|||
return actual_sample_count;
|
||||
}
|
||||
|
||||
unsigned int CMixer::Mix(short* samples, unsigned int num_samples)
|
||||
unsigned int Mixer::Mix(short* samples, unsigned int num_samples)
|
||||
{
|
||||
if (!samples)
|
||||
return 0;
|
||||
|
@ -154,7 +154,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int num_samples)
|
|||
return num_samples;
|
||||
}
|
||||
|
||||
unsigned int CMixer::MixSurround(float* samples, unsigned int num_samples)
|
||||
unsigned int Mixer::MixSurround(float* samples, unsigned int num_samples)
|
||||
{
|
||||
if (!num_samples)
|
||||
return 0;
|
||||
|
@ -175,7 +175,7 @@ unsigned int CMixer::MixSurround(float* samples, unsigned int num_samples)
|
|||
return available_samples;
|
||||
}
|
||||
|
||||
void CMixer::MixerFifo::PushSamples(const short* samples, unsigned int num_samples)
|
||||
void Mixer::MixerFifo::PushSamples(const short* samples, unsigned int num_samples)
|
||||
{
|
||||
// Cache access in non-volatile variable
|
||||
// indexR isn't allowed to cache in the audio throttling loop as it
|
||||
|
@ -204,7 +204,7 @@ void CMixer::MixerFifo::PushSamples(const short* samples, unsigned int num_sampl
|
|||
m_indexW.fetch_add(num_samples * 2);
|
||||
}
|
||||
|
||||
void CMixer::PushSamples(const short* samples, unsigned int num_samples)
|
||||
void Mixer::PushSamples(const short* samples, unsigned int num_samples)
|
||||
{
|
||||
m_dma_mixer.PushSamples(samples, num_samples);
|
||||
int sample_rate = m_dma_mixer.GetInputSampleRate();
|
||||
|
@ -212,7 +212,7 @@ void CMixer::PushSamples(const short* samples, unsigned int num_samples)
|
|||
m_wave_writer_dsp.AddStereoSamplesBE(samples, num_samples, sample_rate);
|
||||
}
|
||||
|
||||
void CMixer::PushStreamingSamples(const short* samples, unsigned int num_samples)
|
||||
void Mixer::PushStreamingSamples(const short* samples, unsigned int num_samples)
|
||||
{
|
||||
m_streaming_mixer.PushSamples(samples, num_samples);
|
||||
int sample_rate = m_streaming_mixer.GetInputSampleRate();
|
||||
|
@ -220,8 +220,8 @@ void CMixer::PushStreamingSamples(const short* samples, unsigned int num_samples
|
|||
m_wave_writer_dtk.AddStereoSamplesBE(samples, num_samples, sample_rate);
|
||||
}
|
||||
|
||||
void CMixer::PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples,
|
||||
unsigned int sample_rate)
|
||||
void Mixer::PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples,
|
||||
unsigned int sample_rate)
|
||||
{
|
||||
short samples_stereo[MAX_SAMPLES * 2];
|
||||
|
||||
|
@ -239,27 +239,27 @@ void CMixer::PushWiimoteSpeakerSamples(const short* samples, unsigned int num_sa
|
|||
}
|
||||
}
|
||||
|
||||
void CMixer::SetDMAInputSampleRate(unsigned int rate)
|
||||
void Mixer::SetDMAInputSampleRate(unsigned int rate)
|
||||
{
|
||||
m_dma_mixer.SetInputSampleRate(rate);
|
||||
}
|
||||
|
||||
void CMixer::SetStreamInputSampleRate(unsigned int rate)
|
||||
void Mixer::SetStreamInputSampleRate(unsigned int rate)
|
||||
{
|
||||
m_streaming_mixer.SetInputSampleRate(rate);
|
||||
}
|
||||
|
||||
void CMixer::SetStreamingVolume(unsigned int lvolume, unsigned int rvolume)
|
||||
void Mixer::SetStreamingVolume(unsigned int lvolume, unsigned int rvolume)
|
||||
{
|
||||
m_streaming_mixer.SetVolume(lvolume, rvolume);
|
||||
}
|
||||
|
||||
void CMixer::SetWiimoteSpeakerVolume(unsigned int lvolume, unsigned int rvolume)
|
||||
void Mixer::SetWiimoteSpeakerVolume(unsigned int lvolume, unsigned int rvolume)
|
||||
{
|
||||
m_wiimote_speaker_mixer.SetVolume(lvolume, rvolume);
|
||||
}
|
||||
|
||||
void CMixer::StartLogDTKAudio(const std::string& filename)
|
||||
void Mixer::StartLogDTKAudio(const std::string& filename)
|
||||
{
|
||||
if (!m_log_dtk_audio)
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ void CMixer::StartLogDTKAudio(const std::string& filename)
|
|||
}
|
||||
}
|
||||
|
||||
void CMixer::StopLogDTKAudio()
|
||||
void Mixer::StopLogDTKAudio()
|
||||
{
|
||||
if (m_log_dtk_audio)
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ void CMixer::StopLogDTKAudio()
|
|||
}
|
||||
}
|
||||
|
||||
void CMixer::StartLogDSPAudio(const std::string& filename)
|
||||
void Mixer::StartLogDSPAudio(const std::string& filename)
|
||||
{
|
||||
if (!m_log_dsp_audio)
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ void CMixer::StartLogDSPAudio(const std::string& filename)
|
|||
}
|
||||
}
|
||||
|
||||
void CMixer::StopLogDSPAudio()
|
||||
void Mixer::StopLogDSPAudio()
|
||||
{
|
||||
if (m_log_dsp_audio)
|
||||
{
|
||||
|
@ -333,26 +333,26 @@ void CMixer::StopLogDSPAudio()
|
|||
}
|
||||
}
|
||||
|
||||
void CMixer::MixerFifo::SetInputSampleRate(unsigned int rate)
|
||||
void Mixer::MixerFifo::SetInputSampleRate(unsigned int rate)
|
||||
{
|
||||
m_input_sample_rate = rate;
|
||||
}
|
||||
|
||||
unsigned int CMixer::MixerFifo::GetInputSampleRate() const
|
||||
unsigned int Mixer::MixerFifo::GetInputSampleRate() const
|
||||
{
|
||||
return m_input_sample_rate;
|
||||
}
|
||||
|
||||
void CMixer::MixerFifo::SetVolume(unsigned int lvolume, unsigned int rvolume)
|
||||
void Mixer::MixerFifo::SetVolume(unsigned int lvolume, unsigned int rvolume)
|
||||
{
|
||||
m_LVolume.store(lvolume + (lvolume >> 7));
|
||||
m_RVolume.store(rvolume + (rvolume >> 7));
|
||||
}
|
||||
|
||||
unsigned int CMixer::MixerFifo::AvailableSamples() const
|
||||
unsigned int Mixer::MixerFifo::AvailableSamples() const
|
||||
{
|
||||
unsigned int samples_in_fifo = ((m_indexW.load() - m_indexR.load()) & INDEX_MASK) / 2;
|
||||
if (samples_in_fifo <= 1)
|
||||
return 0; // CMixer::MixerFifo::Mix always keeps one sample in the buffer.
|
||||
return 0; // Mixer::MixerFifo::Mix always keeps one sample in the buffer.
|
||||
return (samples_in_fifo - 1) * m_mixer->m_sampleRate / m_input_sample_rate;
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#include "AudioCommon/WaveFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class CMixer final
|
||||
class Mixer final
|
||||
{
|
||||
public:
|
||||
explicit CMixer(unsigned int BackendSampleRate);
|
||||
~CMixer();
|
||||
explicit Mixer(unsigned int BackendSampleRate);
|
||||
~Mixer();
|
||||
|
||||
// Called from audio threads
|
||||
unsigned int Mix(short* samples, unsigned int numSamples);
|
||||
|
@ -50,8 +50,7 @@ private:
|
|||
class MixerFifo final
|
||||
{
|
||||
public:
|
||||
MixerFifo(CMixer* mixer, unsigned sample_rate)
|
||||
: m_mixer(mixer), m_input_sample_rate(sample_rate)
|
||||
MixerFifo(Mixer* mixer, unsigned sample_rate) : m_mixer(mixer), m_input_sample_rate(sample_rate)
|
||||
{
|
||||
}
|
||||
void PushSamples(const short* samples, unsigned int num_samples);
|
||||
|
@ -62,7 +61,7 @@ private:
|
|||
unsigned int AvailableSamples() const;
|
||||
|
||||
private:
|
||||
CMixer* m_mixer;
|
||||
Mixer* m_mixer;
|
||||
unsigned m_input_sample_rate;
|
||||
std::array<short, MAX_SAMPLES * 2> m_buffer{};
|
||||
std::atomic<u32> m_indexW{0};
|
||||
|
|
|
@ -24,7 +24,7 @@ static SLPlayItf bqPlayerPlay;
|
|||
static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;
|
||||
static SLMuteSoloItf bqPlayerMuteSolo;
|
||||
static SLVolumeItf bqPlayerVolume;
|
||||
static CMixer* g_mixer;
|
||||
static Mixer* g_mixer;
|
||||
#define BUFFER_SIZE 512
|
||||
#define BUFFER_SIZE_IN_SAMPLES (BUFFER_SIZE / 2)
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
class SoundStream
|
||||
{
|
||||
protected:
|
||||
std::unique_ptr<CMixer> m_mixer;
|
||||
std::unique_ptr<Mixer> m_mixer;
|
||||
bool m_muted;
|
||||
|
||||
public:
|
||||
SoundStream() : m_mixer(new CMixer(48000)), m_muted(false) {}
|
||||
SoundStream() : m_mixer(new Mixer(48000)), m_muted(false) {}
|
||||
virtual ~SoundStream() {}
|
||||
static bool isValid() { return false; }
|
||||
CMixer* GetMixer() const { return m_mixer.get(); }
|
||||
Mixer* GetMixer() const { return m_mixer.get(); }
|
||||
virtual bool Start() { return false; }
|
||||
virtual void SetVolume(int) {}
|
||||
virtual void SoundLoop() {}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
struct StreamingVoiceContext : public IXAudio2VoiceCallback
|
||||
{
|
||||
private:
|
||||
CMixer* const m_mixer;
|
||||
Mixer* const m_mixer;
|
||||
Common::Event& m_sound_sync_event;
|
||||
IXAudio2SourceVoice* m_source_voice;
|
||||
std::unique_ptr<BYTE[]> xaudio_buffer;
|
||||
|
@ -24,7 +24,7 @@ private:
|
|||
void SubmitBuffer(PBYTE buf_data);
|
||||
|
||||
public:
|
||||
StreamingVoiceContext(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
|
||||
StreamingVoiceContext(IXAudio2* pXAudio2, Mixer* pMixer, Common::Event& pSyncEvent);
|
||||
virtual ~StreamingVoiceContext();
|
||||
|
||||
void Stop();
|
||||
|
@ -56,7 +56,7 @@ void StreamingVoiceContext::SubmitBuffer(PBYTE buf_data)
|
|||
m_source_voice->SubmitSourceBuffer(&buf);
|
||||
}
|
||||
|
||||
StreamingVoiceContext::StreamingVoiceContext(IXAudio2* pXAudio2, CMixer* pMixer,
|
||||
StreamingVoiceContext::StreamingVoiceContext(IXAudio2* pXAudio2, Mixer* pMixer,
|
||||
Common::Event& pSyncEvent)
|
||||
: m_mixer(pMixer), m_sound_sync_event(pSyncEvent),
|
||||
xaudio_buffer(new BYTE[NUM_BUFFERS * BUFFER_SIZE_BYTES]())
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
struct StreamingVoiceContext2_7 : public IXAudio2VoiceCallback
|
||||
{
|
||||
private:
|
||||
CMixer* const m_mixer;
|
||||
Mixer* const m_mixer;
|
||||
Common::Event& m_sound_sync_event;
|
||||
IXAudio2SourceVoice* m_source_voice;
|
||||
std::unique_ptr<BYTE[]> xaudio_buffer;
|
||||
|
@ -24,7 +24,7 @@ private:
|
|||
void SubmitBuffer(PBYTE buf_data);
|
||||
|
||||
public:
|
||||
StreamingVoiceContext2_7(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
|
||||
StreamingVoiceContext2_7(IXAudio2* pXAudio2, Mixer* pMixer, Common::Event& pSyncEvent);
|
||||
virtual ~StreamingVoiceContext2_7();
|
||||
|
||||
void Stop();
|
||||
|
@ -56,7 +56,7 @@ void StreamingVoiceContext2_7::SubmitBuffer(PBYTE buf_data)
|
|||
m_source_voice->SubmitSourceBuffer(&buf);
|
||||
}
|
||||
|
||||
StreamingVoiceContext2_7::StreamingVoiceContext2_7(IXAudio2* pXAudio2, CMixer* pMixer,
|
||||
StreamingVoiceContext2_7::StreamingVoiceContext2_7(IXAudio2* pXAudio2, Mixer* pMixer,
|
||||
Common::Event& pSyncEvent)
|
||||
: m_mixer(pMixer), m_sound_sync_event(pSyncEvent),
|
||||
xaudio_buffer(new BYTE[NUM_BUFFERS * BUFFER_SIZE_BYTES]())
|
||||
|
|
|
@ -918,7 +918,7 @@ void UpdateTitle()
|
|||
// Update the audio timestretcher with the current speed
|
||||
if (g_sound_stream)
|
||||
{
|
||||
CMixer* pMixer = g_sound_stream->GetMixer();
|
||||
Mixer* pMixer = g_sound_stream->GetMixer();
|
||||
pMixer->UpdateSpeed((float)Speed / 100);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue