| 45 | } |
| 46 | |
| 47 | bool CDSound::SetupDevice(int iDevice) |
| 48 | { |
| 49 | if (iDevice > (int)GetDeviceCount()) // // // |
| 50 | iDevice = 0; |
| 51 | |
| 52 | if (m_lpDirectSound) { |
| 53 | m_lpDirectSound->Release(); |
| 54 | m_lpDirectSound = NULL; |
| 55 | } |
| 56 | |
| 57 | if (FAILED(DirectSoundCreate((LPCGUID)&devices_[iDevice].second, &m_lpDirectSound, NULL))) { |
| 58 | m_lpDirectSound = NULL; |
| 59 | return false; |
| 60 | } |
| 61 | |
| 62 | if (m_hWndTarget != NULL && FAILED(m_lpDirectSound->SetCooperativeLevel(m_hWndTarget, DSSCL_PRIORITY))) { // // // |
| 63 | m_lpDirectSound = NULL; |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | return true; |
| 68 | } |
| 69 | |
| 70 | void CDSound::CloseDevice() |
| 71 | { |
no test coverage detected