2017-06-18 19:32:20 +02:00
|
|
|
//
|
|
|
|
// libtgvoip is free and unencumbered public domain software.
|
|
|
|
// For more information, see http://unlicense.org or the UNLICENSE file
|
|
|
|
// you should have received with this source code distribution.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef LIBTGVOIP_AUDIOOUTPUTPHP_H
|
|
|
|
#define LIBTGVOIP_AUDIOOUTPUTPHP_H
|
|
|
|
|
2017-06-22 14:48:52 +02:00
|
|
|
#include "../libtgvoip/audio/AudioOutput.h"
|
2017-07-01 19:40:28 +02:00
|
|
|
#include "../libtgvoip/VoIPController.h"
|
2017-07-10 12:30:13 +02:00
|
|
|
#include "../main.h"
|
2017-07-11 21:11:23 +02:00
|
|
|
#include "../libtgvoip/threading.h"
|
2017-06-18 19:32:20 +02:00
|
|
|
|
2017-07-20 16:24:17 +02:00
|
|
|
namespace tgvoip
|
|
|
|
{
|
|
|
|
namespace audio
|
|
|
|
{
|
|
|
|
class AudioOutputModule : public AudioOutput
|
|
|
|
{
|
|
|
|
|
2017-07-23 17:49:47 +02:00
|
|
|
public:
|
|
|
|
AudioOutputModule(std::string deviceID, VoIPController *controller);
|
|
|
|
virtual ~AudioOutputModule();
|
|
|
|
virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
|
|
|
virtual void Start();
|
|
|
|
virtual void Stop();
|
|
|
|
virtual bool IsPlaying() override;
|
|
|
|
virtual float GetLevel() override;
|
|
|
|
static void EnumerateDevices(std::vector<AudioOutputDevice> &devs);
|
|
|
|
|
|
|
|
static void *StartReceiverThread(void *output);
|
|
|
|
void RunReceiverThread();
|
|
|
|
|
|
|
|
int outputBitsPerSample;
|
|
|
|
int outputSampleRate;
|
|
|
|
int outputChannels;
|
|
|
|
int outputSamplePeriod;
|
|
|
|
int outputWritePeriod;
|
|
|
|
double outputSamplePeriodSec;
|
|
|
|
double outputWritePeriodSec;
|
|
|
|
int outputSampleNumber;
|
|
|
|
int outputSamplesSize;
|
|
|
|
size_t outputCSamplesSize;
|
|
|
|
float outputLevel = 0.0;
|
|
|
|
|
|
|
|
private:
|
2017-07-26 08:31:52 +02:00
|
|
|
bool isRunningThread;
|
2017-07-23 17:49:47 +02:00
|
|
|
tgvoip_thread_t receiverThread;
|
|
|
|
VoIP *wrapper;
|
2017-06-18 19:32:20 +02:00
|
|
|
};
|
2017-07-20 16:24:17 +02:00
|
|
|
}
|
|
|
|
}
|
2017-06-18 19:32:20 +02:00
|
|
|
|
|
|
|
#endif //LIBTGVOIP_AUDIOOUTPUTPHP_H
|