2015-09-28 23:25:12 +02:00
|
|
|
#ifndef MUMSI_MUMBLECOMMUNICATOR_HPP
|
|
|
|
#define MUMSI_MUMBLECOMMUNICATOR_HPP
|
|
|
|
|
2015-10-16 22:41:37 +02:00
|
|
|
#include "ISamplesBuffer.hpp"
|
2015-10-30 13:43:06 +01:00
|
|
|
#include <mumlib.hpp>
|
2015-09-28 23:25:12 +02:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <stdexcept>
|
2015-09-29 02:26:45 +02:00
|
|
|
#include <log4cpp/Category.hh>
|
2015-10-04 22:30:10 +02:00
|
|
|
#include <sndfile.hh>
|
2015-10-16 22:41:37 +02:00
|
|
|
#include <thread>
|
2015-09-28 23:25:12 +02:00
|
|
|
|
|
|
|
namespace mumble {
|
|
|
|
|
|
|
|
class Exception : public std::runtime_error {
|
|
|
|
public:
|
|
|
|
Exception(const char *message) : std::runtime_error(message) { }
|
|
|
|
};
|
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
class MumlibCallback;
|
|
|
|
|
2015-10-16 22:41:37 +02:00
|
|
|
class MumbleCommunicator {
|
2015-09-28 23:25:12 +02:00
|
|
|
public:
|
2015-09-29 02:26:45 +02:00
|
|
|
MumbleCommunicator(
|
2015-10-30 13:43:06 +01:00
|
|
|
boost::asio::io_service &ioService,
|
2015-10-16 22:41:37 +02:00
|
|
|
ISamplesBuffer &samplesBuffer,
|
2015-09-29 02:26:45 +02:00
|
|
|
std::string user,
|
|
|
|
std::string password,
|
|
|
|
std::string host,
|
|
|
|
int port = 0);
|
2015-09-28 23:25:12 +02:00
|
|
|
|
|
|
|
~MumbleCommunicator();
|
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
// void senderThreadFunction();
|
|
|
|
|
|
|
|
//void receiveAudioFrameCallback(uint8_t *audio_data, uint32_t audio_data_size);
|
2015-09-28 23:25:12 +02:00
|
|
|
|
2015-10-16 22:41:37 +02:00
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
public:
|
|
|
|
boost::asio::io_service &ioService;
|
2015-09-28 23:25:12 +02:00
|
|
|
|
2015-09-29 02:26:45 +02:00
|
|
|
log4cpp::Category &logger;
|
|
|
|
|
2015-10-16 22:41:37 +02:00
|
|
|
ISamplesBuffer &samplesBuffer;
|
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
std::shared_ptr<mumlib::Mumlib> mum;
|
2015-09-29 02:26:45 +02:00
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
std::unique_ptr<std::thread> senderThread;
|
2015-10-04 22:30:10 +02:00
|
|
|
|
|
|
|
SndfileHandle fileHandle;
|
2015-10-16 22:41:37 +02:00
|
|
|
|
2015-10-30 13:43:06 +01:00
|
|
|
std::unique_ptr<MumlibCallback> callback;
|
|
|
|
|
2015-10-16 22:41:37 +02:00
|
|
|
bool quit;
|
2015-10-30 13:43:06 +01:00
|
|
|
|
|
|
|
friend class MumlibCallback;
|
2015-09-28 23:25:12 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //MUMSI_MUMBLECOMMUNICATOR_HPP
|