MumbleCommunicator.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef MUMSI_MUMBLECOMMUNICATOR_HPP
  2. #define MUMSI_MUMBLECOMMUNICATOR_HPP
  3. #include "ISamplesBuffer.hpp"
  4. #include <mumlib.hpp>
  5. #include <string>
  6. #include <stdexcept>
  7. #include <log4cpp/Category.hh>
  8. #include <sndfile.hh>
  9. #include <thread>
  10. namespace mumble {
  11. class Exception : public std::runtime_error {
  12. public:
  13. Exception(const char *message) : std::runtime_error(message) { }
  14. };
  15. class MumlibCallback;
  16. class MumbleCommunicator {
  17. public:
  18. MumbleCommunicator(
  19. boost::asio::io_service &ioService,
  20. ISamplesBuffer &samplesBuffer,
  21. std::string user,
  22. std::string password,
  23. std::string host,
  24. int port = 0);
  25. ~MumbleCommunicator();
  26. // void senderThreadFunction();
  27. //void receiveAudioFrameCallback(uint8_t *audio_data, uint32_t audio_data_size);
  28. public:
  29. boost::asio::io_service &ioService;
  30. log4cpp::Category &logger;
  31. ISamplesBuffer &samplesBuffer;
  32. std::shared_ptr<mumlib::Mumlib> mum;
  33. std::unique_ptr<std::thread> senderThread;
  34. SndfileHandle fileHandle;
  35. std::unique_ptr<MumlibCallback> callback;
  36. bool quit;
  37. friend class MumlibCallback;
  38. };
  39. }
  40. #endif //MUMSI_MUMBLECOMMUNICATOR_HPP