VirtualBox

source: vbox/trunk/src/VBox/Devices/Audio/VBoxMMNotificationClient.h@ 73370

Last change on this file since 73370 was 69119, checked in by vboxsync, 7 years ago

Audio: More cleanups (missing keywords, incorrect #endif docs, stuff)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/* $Id: VBoxMMNotificationClient.h 69119 2017-10-17 19:08:38Z vboxsync $ */
2/** @file
3 * VBoxMMNotificationClient.h - Implementation of the IMMNotificationClient interface
4 * to detect audio endpoint changes.
5 */
6
7/*
8 * Copyright (C) 2017 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef ___VBOX_MMNOTIFICATIONCLIENT_H___
20#define ___VBOX_MMNOTIFICATIONCLIENT_H___
21
22#include <iprt/critsect.h>
23#include <iprt/win/windows.h>
24
25/* Should fix warning in include\ks.h. */
26#ifndef _WIN64
27# ifdef RT_ARCH_X86
28# define _WIN64 1
29# else
30# define _WIN64 0
31# endif
32#endif
33
34#include <Mmdeviceapi.h>
35
36#include "DrvAudio.h"
37
38class VBoxMMNotificationClient : IMMNotificationClient
39{
40public:
41
42 VBoxMMNotificationClient();
43 virtual ~VBoxMMNotificationClient();
44
45 HRESULT Initialize();
46 int RegisterCallback(PPDMDRVINS pDrvIns, PFNPDMHOSTAUDIOCALLBACK pfnCallback);
47 void UnregisterCallback(void);
48 void Dispose();
49
50 /** @name IUnknown interface
51 * @{ */
52 IFACEMETHODIMP_(ULONG) Release();
53 /** @} */
54
55private:
56
57 bool m_fRegisteredClient;
58 IMMDeviceEnumerator *m_pEnum;
59 IMMDevice *m_pEndpoint;
60
61 long m_cRef;
62
63 PPDMDRVINS m_pDrvIns;
64 PFNPDMHOSTAUDIOCALLBACK m_pfnCallback;
65
66 HRESULT AttachToDefaultEndpoint();
67 void DetachFromEndpoint();
68
69 /** @name IMMNotificationClient interface
70 * @{ */
71 IFACEMETHODIMP OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState);
72 IFACEMETHODIMP OnDeviceAdded(LPCWSTR pwstrDeviceId);
73 IFACEMETHODIMP OnDeviceRemoved(LPCWSTR pwstrDeviceId);
74 IFACEMETHODIMP OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDefaultDeviceId);
75 IFACEMETHODIMP OnPropertyValueChanged(LPCWSTR /*pwstrDeviceId*/, const PROPERTYKEY /*key*/) { return S_OK; }
76 IFACEMETHODIMP OnDeviceQueryRemove() { return S_OK; }
77 IFACEMETHODIMP OnDeviceQueryRemoveFailed() { return S_OK; }
78 IFACEMETHODIMP OnDeviceRemovePending() { return S_OK; }
79 /** @} */
80
81 /** @name IUnknown interface
82 * @{ */
83 IFACEMETHODIMP QueryInterface(const IID& iid, void** ppUnk);
84 IFACEMETHODIMP_(ULONG) AddRef();
85 /** @} */
86};
87#endif /* !___VBOX_MMNOTIFICATIONCLIENT_H___ */
88
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette