Changeset 83238 in vbox
- Timestamp:
- Mar 10, 2020 9:57:28 AM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
-
VBoxMMNotificationClient.cpp (modified) (5 diffs)
-
VBoxMMNotificationClient.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/VBoxMMNotificationClient.cpp
r82968 r83238 126 126 127 127 /** 128 * Handler implementation which is called when an audio device state 129 * has been changed. 130 * 131 * @return HRESULT 132 * @param pwstrDeviceId Device ID the state is announced for. 133 * @param dwNewState New state the device is now in. 134 */ 135 STDMETHODIMP VBoxMMNotificationClient::OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) 136 { 137 char *pszState = "unknown"; 138 139 switch (dwNewState) 140 { 141 case DEVICE_STATE_ACTIVE: 142 pszState = "active"; 143 break; 144 case DEVICE_STATE_DISABLED: 145 pszState = "disabled"; 146 break; 147 case DEVICE_STATE_NOTPRESENT: 148 pszState = "not present"; 149 break; 150 case DEVICE_STATE_UNPLUGGED: 151 pszState = "unplugged"; 152 break; 153 default: 154 break; 155 } 156 157 LogRel2(("Audio: Device '%ls' has changed state to '%s'\n", pwstrDeviceId, pszState)); 158 128 * Helper function for invoking the audio connector callback (if any). 129 */ 130 void VBoxMMNotificationClient::doCallback(void) 131 { 159 132 #ifdef VBOX_WITH_AUDIO_CALLBACKS 160 133 AssertPtr(this->m_pDrvIns); … … 164 137 /* Ignore rc */ this->m_pfnCallback(this->m_pDrvIns, PDMAUDIOBACKENDCBTYPE_DEVICES_CHANGED, NULL, 0); 165 138 #endif 139 } 140 141 /** 142 * Handler implementation which is called when an audio device state 143 * has been changed. 144 * 145 * @return HRESULT 146 * @param pwstrDeviceId Device ID the state is announced for. 147 * @param dwNewState New state the device is now in. 148 */ 149 STDMETHODIMP VBoxMMNotificationClient::OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) 150 { 151 char *pszState = "unknown"; 152 153 switch (dwNewState) 154 { 155 case DEVICE_STATE_ACTIVE: 156 pszState = "active"; 157 break; 158 case DEVICE_STATE_DISABLED: 159 pszState = "disabled"; 160 break; 161 case DEVICE_STATE_NOTPRESENT: 162 pszState = "not present"; 163 break; 164 case DEVICE_STATE_UNPLUGGED: 165 pszState = "unplugged"; 166 break; 167 default: 168 break; 169 } 170 171 LogRel(("Audio: Device '%ls' has changed state to '%s'\n", pwstrDeviceId, pszState)); 172 173 doCallback(); 166 174 167 175 return S_OK; … … 176 184 STDMETHODIMP VBoxMMNotificationClient::OnDeviceAdded(LPCWSTR pwstrDeviceId) 177 185 { 178 RT_NOREF(pwstrDeviceId);179 LogFunc(("%ls\n", pwstrDeviceId)); 186 LogRel(("Audio: Device '%ls' has been added\n", pwstrDeviceId)); 187 180 188 return S_OK; 181 189 } … … 189 197 STDMETHODIMP VBoxMMNotificationClient::OnDeviceRemoved(LPCWSTR pwstrDeviceId) 190 198 { 191 RT_NOREF(pwstrDeviceId);192 LogFunc(("%ls\n", pwstrDeviceId)); 199 LogRel(("Audio: Device '%ls' has been removed\n", pwstrDeviceId)); 200 193 201 return S_OK; 194 202 } … … 205 213 STDMETHODIMP VBoxMMNotificationClient::OnDefaultDeviceChanged(EDataFlow eFlow, ERole eRole, LPCWSTR pwstrDefaultDeviceId) 206 214 { 207 RT_NOREF(eFlow, eRole, pwstrDefaultDeviceId); 215 RT_NOREF(eRole); 216 217 char *pszRole = "unknown"; 208 218 209 219 if (eFlow == eRender) 210 { 211 212 } 220 pszRole = "output"; 221 else if (eFlow == eCapture) 222 pszRole = "input"; 223 224 LogRel(("Audio: Default %s device has been changed to '%ls'\n", pszRole, pwstrDefaultDeviceId)); 225 226 doCallback(); 213 227 214 228 return S_OK; -
trunk/src/VBox/Devices/Audio/VBoxMMNotificationClient.h
r82968 r83238 70 70 void DetachFromEndpoint(); 71 71 72 void doCallback(void); 73 72 74 /** @name IMMNotificationClient interface 73 75 * @{ */
Note:
See TracChangeset
for help on using the changeset viewer.

