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_AUDIOINPUTPHP_H
|
|
|
|
#define LIBTGVOIP_AUDIOINPUTPHP_H
|
|
|
|
|
2017-06-22 14:48:52 +02:00
|
|
|
#include "../libtgvoip/audio/AudioInput.h"
|
|
|
|
#include "../libtgvoip/threading.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-01 19:40:28 +02:00
|
|
|
|
|
|
|
using namespace tgvoip;
|
|
|
|
using namespace tgvoip::audio;
|
2017-06-18 19:32:20 +02:00
|
|
|
|
2017-07-10 12:30:13 +02:00
|
|
|
|
2017-07-23 17:49:47 +02:00
|
|
|
namespace tgvoip {
|
|
|
|
namespace audio {
|
|
|
|
class AudioInputModule : public AudioInput {
|
2017-06-18 19:32:20 +02:00
|
|
|
|
|
|
|
public:
|
2017-07-23 17:49:47 +02:00
|
|
|
AudioInputModule(std::string deviceID, VoIPController *controller);
|
|
|
|
virtual ~AudioInputModule();
|
2017-06-19 15:39:45 +02:00
|
|
|
|
2017-07-23 17:49:47 +02:00
|
|
|
virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
|
|
|
virtual void Start();
|
|
|
|
virtual void Stop();
|
|
|
|
static void EnumerateDevices(std::vector<AudioInputDevice>& devs);
|
2017-07-13 18:03:33 +02:00
|
|
|
|
2017-07-23 17:49:47 +02:00
|
|
|
static void* StartSenderThread(void* input);
|
|
|
|
void RunSenderThread();
|
2017-07-13 18:03:33 +02:00
|
|
|
|
2017-07-11 21:11:23 +02:00
|
|
|
int inputBitsPerSample;
|
|
|
|
int inputSampleRate;
|
|
|
|
int inputChannels;
|
|
|
|
int inputSamplePeriod;
|
|
|
|
int inputWritePeriod;
|
2017-07-13 18:03:33 +02:00
|
|
|
double inputSamplePeriodSec;
|
|
|
|
double inputWritePeriodSec;
|
2017-07-11 21:11:23 +02:00
|
|
|
int inputSampleNumber;
|
|
|
|
int inputSamplesSize;
|
|
|
|
size_t inputCSamplesSize;
|
2017-07-13 18:03:33 +02:00
|
|
|
|
|
|
|
|
2017-07-04 15:50:02 +02:00
|
|
|
|
2017-06-18 19:32:20 +02:00
|
|
|
private:
|
2017-07-11 21:11:23 +02:00
|
|
|
|
|
|
|
|
2017-07-23 17:49:47 +02:00
|
|
|
tgvoip_thread_t senderThread;
|
|
|
|
VoIP *wrapper;
|
2017-06-18 19:32:20 +02:00
|
|
|
};
|
2017-07-23 17:49:47 +02:00
|
|
|
}
|
|
|
|
}
|
2017-06-18 19:32:20 +02:00
|
|
|
|
|
|
|
#endif //LIBTGVOIP_AUDIOINPUTPHP_H
|