Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.9 KiB

  1. #ifndef _AUDIOCTL_H_
  2. #define _AUDIOCTL_H_
  3. #include "SDKInternal.h"
  4. #include "mixer.h"
  5. interface IAudioEvent
  6. {
  7. public:
  8. virtual void OnLevelChange(BOOL fSpeaker, DWORD dwVolume) = 0;
  9. virtual void OnMuteChange(BOOL fSpeaker, BOOL fMute) = 0;
  10. };
  11. class CMixerDevice;
  12. class CAudioControl
  13. {
  14. private:
  15. CMixerDevice* m_pRecMixer;
  16. CMixerDevice* m_pSpkMixer;
  17. MIXVOLUME m_dwMicVolume;
  18. MIXVOLUME m_dwSpkVolume;
  19. BOOL m_fMicMuted;
  20. BOOL m_fSpkMuted;
  21. DWORD m_dwRecordDevice;
  22. DWORD m_dwPlaybackDevice;
  23. DWORD m_dwSilenceLevel;
  24. BOOL m_fAutoMix;
  25. INmChannelAudio * m_pChannelMic;
  26. INmChannelAudio * m_pChannelSpk;
  27. IAudioEvent * m_pAudioEvent;
  28. HWND m_hwndParent;
  29. MIXVOLUME m_dwSpkVolumeOld;
  30. protected:
  31. BOOL LoadSettings();
  32. BOOL SaveSettings();
  33. public:
  34. CAudioControl(HWND hwnd);
  35. ~CAudioControl();
  36. void OnChannelChanged(NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel);
  37. void RefreshMixer();
  38. VOID OnDeviceChanged();
  39. VOID OnAGC_Changed();
  40. VOID OnSilenceLevelChanged();
  41. void RegisterAudioEventHandler(IAudioEvent *pEvent)
  42. { m_pAudioEvent = pEvent; }
  43. BOOL CanSetRecorderVolume();
  44. BOOL CanSetSpeakerVolume();
  45. void SetRecorderVolume(MIXVOLUME *pdwVolume);
  46. void SetSpeakerVolume(MIXVOLUME *pdwVolume);
  47. void SetRecorderVolume(DWORD dwVolume);
  48. void SetSpeakerVolume(DWORD dwVolume);
  49. void GetRecorderVolume(MIXVOLUME *pdwVolume);
  50. void GetSpeakerVolume(MIXVOLUME *pdwVolume);
  51. DWORD GetRecorderVolume() { return max(m_dwMicVolume.leftVolume , m_dwMicVolume.rightVolume); }
  52. DWORD GetSpeakerVolume() { return max(m_dwSpkVolume.leftVolume , m_dwSpkVolume.rightVolume); }
  53. void MuteAudio(BOOL fSpeaker, BOOL fMute);
  54. DWORD GetAudioSignalLevel(BOOL fSpeaker);
  55. BOOL IsSpkMuted() { return m_fSpkMuted;}
  56. BOOL IsRecMuted() { return m_fMicMuted;}
  57. HRESULT SetProperty(BOOL fSpeaker, NM_AUDPROP uID, ULONG_PTR uValue);
  58. HRESULT GetProperty(BOOL fSpeaker, NM_AUDPROP uID, ULONG_PTR *puValue);
  59. };
  60. #endif // _AUDIOCTL_H_