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

61 lines
1.5 KiB
C
Raw Normal View History

//
// 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"
namespace tgvoip{ namespace audio{
2017-07-04 15:50:02 +02:00
class AudioOutputModule : public AudioOutput{
public:
2017-07-13 18:03:33 +02:00
AudioOutputModule(std::string deviceID, VoIPController* controller);
2017-07-04 15:50:02 +02:00
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;
2017-07-09 21:12:01 +02:00
unsigned char * readSamples();
2017-07-04 15:50:02 +02:00
static void EnumerateDevices(std::vector<AudioOutputDevice>& devs);
2017-07-11 21:11:23 +02:00
static void* StartReceiverThread(void* output);
void RunReceiverThread();
2017-07-13 18:03:33 +02:00
bool unsetOutputFile();
bool setOutputFile(const char *file);
2017-07-11 21:11:23 +02:00
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;
2017-06-22 20:38:20 +02:00
private:
2017-07-11 21:11:23 +02:00
tgvoip_thread_t receiverThread;
VoIP *wrapper;
2017-07-13 18:03:33 +02:00
FILE *outputFile;
tgvoip_mutex_t outputMutex;
2017-07-19 12:42:01 +02:00
2017-07-13 18:03:33 +02:00
bool configuringOutput;
};
}}
#endif //LIBTGVOIP_AUDIOOUTPUTPHP_H