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