SoundCardData.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __SOUNDCARDDATA_H__
  2. #define __SOUNDCARDDATA_H__
  3. #include "GlobalVariable.h"
  4. #include <qlist.h>
  5. /**
  6. * @brief 声卡信息管理器
  7. * 1、这里可以设置当前声卡信息,获取当前选择的声卡信息,以免多个窗口声卡传递链特别长
  8. *
  9. */
  10. #define SoundCards SoundCardDataManager::getInstance()
  11. class SoundCardDataManager
  12. {
  13. SoundCardDataManager() = default;
  14. SoundCardDataManager(const SoundCardDataManager&) = delete;
  15. SoundCardDataManager& operator=(const SoundCardDataManager&) = delete;
  16. public:
  17. ~SoundCardDataManager();
  18. static SoundCardDataManager& getInstance()
  19. {
  20. static SoundCardDataManager instance;
  21. return instance;
  22. }
  23. /* 设置声卡列表 */
  24. void setSoundCardInfo(std::map<std::string, SoundCardPCMInfo_t>& mapSoundInfo);
  25. /* 获取声卡列表 */
  26. const std::map<std::string, SoundCardPCMInfo_t>& getSoundCardInfo() const { return m_mapSoundCardInfo; }
  27. /* 设置当前声卡 */
  28. bool setCurrentSoundCard(std::string strSoundCardName);
  29. /* 获取当前声卡信息 */
  30. const SoundCardPCMInfo_t& getCurrentSoundCardInfo() const { return m_currentSoundCardInfo; }
  31. void setShowSoundCardDesc(bool bShow) { m_isShowSoundCardDesc = bShow; }
  32. bool isShowSoundCardDesc() const { return m_isShowSoundCardDesc; }
  33. private:
  34. bool m_isShowSoundCardDesc = false; /* 是否显示PCM通道的描述信息,为false,则显示PCM名 */
  35. /* 声卡信息,key为声卡编号 */
  36. // QMap<int, SoundCardInfo_t> m_mapSoundCardInfo;
  37. std::map<std::string, SoundCardPCMInfo_t> m_mapSoundCardInfo;
  38. /* 当前选择的声卡 */
  39. SoundCardPCMInfo_t m_currentSoundCardInfo;
  40. /* 带有声卡信息的通道列表,设置当前声卡信息的时候会更新 */
  41. // QList<SoundCardRoadInfo_t> m_listSoundCardRoad;
  42. };
  43. #endif // __SOUNDCARDDATA_H__