mumsi/MumbleCommunicator.hpp

62 lines
1.3 KiB
C++
Raw Normal View History

#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>
#include <string>
#include <stdexcept>
2015-09-29 02:26:45 +02:00
#include <log4cpp/Category.hh>
#include <sndfile.hh>
2015-10-16 22:41:37 +02:00
#include <thread>
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 {
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);
~MumbleCommunicator();
2015-10-30 13:43:06 +01:00
// void senderThreadFunction();
//void receiveAudioFrameCallback(uint8_t *audio_data, uint32_t audio_data_size);
2015-11-02 23:41:49 +01:00
void sendAudioFrame(int16_t *samples, int length);
2015-10-16 22:41:37 +02:00
2015-10-30 13:43:06 +01:00
public:
boost::asio::io_service &ioService;
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;
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;
};
}
#endif //MUMSI_MUMBLECOMMUNICATOR_HPP