Mesen-SX/Core/SoundMixer.h

41 lines
924 B
C
Raw Normal View History

#pragma once
#include "stdafx.h"
#include "IAudioDevice.h"
class Console;
class Equalizer;
class SoundResampler;
2019-03-15 12:58:30 -04:00
class WaveRecorder;
2020-12-19 23:30:09 +03:00
class SoundMixer
{
private:
2020-12-19 23:30:09 +03:00
IAudioDevice* _audioDevice;
Console* _console;
unique_ptr<Equalizer> _equalizer;
unique_ptr<SoundResampler> _resampler;
2019-03-15 12:58:30 -04:00
shared_ptr<WaveRecorder> _waveRecorder;
2020-12-19 23:30:09 +03:00
int16_t* _sampleBuffer = nullptr;
int16_t _leftSample = 0;
int16_t _rightSample = 0;
2020-12-19 23:30:09 +03:00
void ProcessEqualizer(int16_t* samples, uint32_t sampleCount);
public:
2020-12-19 23:30:09 +03:00
SoundMixer(Console* console);
~SoundMixer();
2020-12-19 23:30:09 +03:00
void PlayAudioBuffer(int16_t* samples, uint32_t sampleCount, uint32_t sourceRate);
void StopAudio(bool clearBuffer = false);
2020-12-19 23:30:09 +03:00
void RegisterAudioDevice(IAudioDevice* audioDevice);
AudioStatistics GetStatistics();
double GetRateAdjustment();
2019-03-15 12:58:30 -04:00
void StartRecording(string filepath);
void StopRecording();
bool IsRecording();
2020-12-19 23:30:09 +03:00
void GetLastSamples(int16_t& left, int16_t& right);
};