#ifndef SOUNDMANAGER_H #define SOUNDMANAGER_H #include #include #include #include #include #include #include class SoundManager : public QObject { Q_OBJECT public: explicit SoundManager(QObject *parent = 0); ~SoundManager(); enum SoundChannel { Channel1 = 0, Channel2 = 1 }; bool loadSound(SoundChannel channel, const QString &filePath); bool playSound(SoundChannel channel); bool pauseSound(SoundChannel channel); bool stopSound(SoundChannel channel); void setVolume(SoundChannel channel, int volume); // 0-100 bool isPlaying(SoundChannel channel); private: struct SoundDevice { IGraphBuilder *graphBuilder; IMediaControl *mediaControl; IMediaPosition *mediaPosition; IBasicAudio *basicAudio; IBaseFilter *audioRenderer; IAudioSessionManager2 *sessionManager; IAudioSessionControl *sessionControl; bool isLoaded; }; SoundDevice m_channels[2]; bool initializeChannel(SoundChannel channel); void cleanupChannel(SoundChannel channel); IBaseFilter* createAudioRenderer(); }; #endif // SOUNDMANAGER_H