1
0
mirror of https://github.com/danog/php-libtgvoip.git synced 2024-12-02 09:17:55 +01:00
php-libtgvoip/audio/AudioOutputModule.h
2017-07-26 08:31:52 +02:00

56 lines
1.4 KiB
C++

//
// 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
#include "../libtgvoip/audio/AudioOutput.h"
#include "../libtgvoip/VoIPController.h"
#include "../main.h"
#include "../libtgvoip/threading.h"
namespace tgvoip
{
namespace audio
{
class AudioOutputModule : public AudioOutput
{
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:
bool isRunningThread;
tgvoip_thread_t receiverThread;
VoIP *wrapper;
};
}
}
#endif //LIBTGVOIP_AUDIOOUTPUTPHP_H