1
0
mirror of https://github.com/danog/php-libtgvoip.git synced 2024-12-02 09:17:55 +01:00
php-libtgvoip/audio/AudioOutputModule.cpp

56 lines
1.2 KiB
C++
Raw Normal View History

2017-07-04 15:50:02 +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.
//
#include "AudioOutputModule.h"
#include <stdio.h>
#include "../libtgvoip/logging.h"
using namespace tgvoip;
using namespace tgvoip::audio;
AudioOutputModule::AudioOutputModule(std::string deviceID, void *controller){
2017-07-04 15:50:02 +02:00
wrapper = (VoIP *)((VoIPController *)controller)->implData;
}
AudioOutputModule::~AudioOutputModule(){
}
void AudioOutputModule::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){
wrapper->configureAudioOutput(sampleRate, bitsPerSample, channels);
}
void AudioOutputModule::Start(){
if(running)
return;
running = true;
wrapper->startOutput();
}
void AudioOutputModule::Stop(){
if(!running)
return;
wrapper->stopOutput();
running = false;
}
bool AudioOutputModule::IsPlaying(){
return running;
}
float AudioOutputModule::GetLevel(){
return wrapper->getOutputLevel();
}
unsigned char * AudioOutputModule::readFrames() {
unsigned char *buf = (unsigned char *) emalloc(960*2);
2017-07-04 15:50:02 +02:00
InvokeCallback(buf, 960*2);
return buf;
}
void AudioOutputModule::EnumerateDevices(std::vector<AudioOutputDevice>& devs) {
}