123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef __SOUNDCARDS_H__
- #define __SOUNDCARDS_H__
- #include "GlobalVariable.h"
- #include "AudioRecord.h"
- #include "spdlog/spdlog.h"
- #include <string>
- /**
- * @brief 全局的声卡信息
- *
- */
- #define SoundCards SoundCardManager::Instance()
- class SoundCardManager
- {
- SoundCardManager() = default;
- SoundCardManager(const SoundCardManager&) = delete;
- SoundCardManager& operator=(const SoundCardManager&) = delete;
- public:
- ~SoundCardManager() = default;
- static SoundCardManager& Instance()
- {
- static SoundCardManager instance;
- return instance;
- }
- /* 初始化数据,获取声卡信息 */
- bool InitData();
- /* 获取声卡信息 */
- // const std::list<AudioDevice_t>& getListAudioDevice() const { return m_listAudioDevice; }
- const std::list<AudioDeviceDesc_t>& getListAudioDeviceDesc() const { return m_listAudioDeviceDesc; }
- /* 获取声卡信息,将PCM通道根据规则分类 */
- const std::map<std::string, SoundCardPCMInfo_t>& getSoundCardInfo() { return m_mapSoundCardInfo; }
- private:
- /* 打印声卡列表 */
- // void printAudioDevices();
- /* 打印声卡描述列表 */
- void printAudioDeviceDesc(const std::map<std::string, SoundCardPCMInfo_t>& mapSoundCard);
- /* 将PCM通道分类 */
- void classifyPCMChannels();
- /* 取出dante声卡的PCM通道信息 */
- void getDanteSoundCardInfo(std::list<AudioDeviceDesc_t>& listPCM);
- /* 将剩余的PCM通道信息分类 */
- void classifyRemainingPCMChannels(std::list<AudioDeviceDesc_t>& listPCM);
- private:
- /* 声卡设备列表 */
- // std::list<AudioDevice_t> m_listAudioDevice;
- std::list<AudioDeviceDesc_t> m_listAudioDeviceDesc; /* 声卡字符设备列表 */
- std::map<std::string, SoundCardPCMInfo_t> m_mapSoundCardInfo; /* 声卡信息,key是声卡标识符 */
- };
- #endif // __SOUNDCARDS_H__
|