// // 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_AUDIOIO_H #define LIBTGVOIP_AUDIOIO_H #include "AudioInput.h" #include "AudioOutput.h" #include "../tools/utils.h" #include #include namespace tgvoip { namespace audio { class AudioIO { public: AudioIO(){}; virtual ~AudioIO(){}; TGVOIP_DISALLOW_COPY_AND_ASSIGN(AudioIO); static std::unique_ptr Create(std::string inputDevice, std::string outputDevice); virtual std::shared_ptr GetInput() = 0; virtual std::shared_ptr GetOutput() = 0; bool Failed(); std::string GetErrorDescription(); protected: bool failed = false; std::string error; }; template class ContextlessAudioIO : public AudioIO { public: ContextlessAudioIO() { input = std::make_shared(); output = std::make_shared(); } ContextlessAudioIO(std::string inputDeviceID, std::string outputDeviceID) { input = std::make_shared(inputDeviceID); output = std::make_shared(outputDeviceID); } virtual std::shared_ptr GetInput() { return input; } virtual std::shared_ptr *GetOutput() { return output; } private: std::shared_ptr input; std::shared_ptr output; }; } // namespace audio } // namespace tgvoip #endif //LIBTGVOIP_AUDIOIO_H