SoundCardData.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __SOUNDCARDDATA_H__
  2. #define __SOUNDCARDDATA_H__
  3. #include "GlobalVariable.h"
  4. #include "AudioRecord.h"
  5. #include "spdlog/spdlog.h"
  6. /**
  7. * @brief 全局的声卡信息
  8. *
  9. */
  10. #define SoundCards SoundCardManager::Instance()
  11. class SoundCardManager
  12. {
  13. SoundCardManager() = default;
  14. SoundCardManager(const SoundCardManager&) = delete;
  15. SoundCardManager& operator=(const SoundCardManager&) = delete;
  16. public:
  17. ~SoundCardManager() = default;
  18. static SoundCardManager& Instance()
  19. {
  20. static SoundCardManager instance;
  21. return instance;
  22. }
  23. /* 初始化数据,获取声卡信息 */
  24. bool InitData();
  25. /* 获取声卡信息 */
  26. const std::list<AudioDevice_t>& getListAudioDevice() const { return m_listAudioDevice; }
  27. private:
  28. /* 打印声卡列表 */
  29. void printAudioDevices();
  30. /* 打印声卡描述列表 */
  31. void printAudioDeviceDesc(std::list<AudioDeviceDesc_t>& pcmDevices);
  32. private:
  33. /* 声卡设备列表 */
  34. std::list<AudioDevice_t> m_listAudioDevice;
  35. };
  36. #endif // __SOUNDCARDDATA_H__