MumbleCommunicator.hpp 794 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef MUMSI_MUMBLECOMMUNICATOR_HPP
  2. #define MUMSI_MUMBLECOMMUNICATOR_HPP
  3. extern "C" {
  4. #include "libmumble.h"
  5. }
  6. #include <string>
  7. #include <stdexcept>
  8. #include <opus.h>
  9. namespace mumble {
  10. constexpr unsigned int SAMPLE_RATE = 48000;
  11. class Exception : public std::runtime_error {
  12. public:
  13. Exception(const char *message) : std::runtime_error(message) { }
  14. };
  15. class MumbleCommunicator {
  16. public:
  17. MumbleCommunicator(std::string user, std::string password, std::string host, int port = 0);
  18. ~MumbleCommunicator();
  19. void loop();
  20. void receiveAudioFrameCallback(uint8_t *audio_data, uint32_t audio_data_size);
  21. private:
  22. mumble_struct *mumble;
  23. OpusDecoder *opusState;
  24. };
  25. }
  26. #endif //MUMSI_MUMBLECOMMUNICATOR_HPP