AudioCommon: extract AudioStretcher class for time-stretching

This commit is contained in:
Michael Maltese
2017-04-23 19:08:33 -07:00
parent a4508e85e8
commit 87a467fe42
7 changed files with 123 additions and 75 deletions

View File

@ -7,12 +7,10 @@
#include <array>
#include <atomic>
#include "AudioCommon/AudioStretcher.h"
#include "AudioCommon/WaveFile.h"
#include "Common/CommonTypes.h"
#include <soundtouch/STTypes.h>
#include <soundtouch/SoundTouch.h>
class CMixer final
{
public:
@ -76,17 +74,13 @@ private:
u32 m_frac = 0;
};
void StretchAudio(const short* in, unsigned int num_in, short* out, unsigned int num_out);
MixerFifo m_dma_mixer{this, 32000};
MixerFifo m_streaming_mixer{this, 48000};
MixerFifo m_wiimote_speaker_mixer{this, 3000};
unsigned int m_sampleRate;
bool m_is_stretching = false;
soundtouch::SoundTouch m_sound_touch;
double m_stretch_ratio = 1.0;
std::array<short, 2> m_last_stretched_sample = {};
AudioCommon::AudioStretcher m_stretcher;
std::array<short, MAX_SAMPLES * 2> m_stretch_buffer;
std::array<float, MAX_SAMPLES * 2> m_float_conversion_buffer;