diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp index 9d57b4b0..de2d2e3c 100644 --- a/src/cubeb_wasapi.cpp +++ b/src/cubeb_wasapi.cpp @@ -395,10 +395,6 @@ struct cubeb_stream { com_ptr output_client; /* Interface pointer to use the event-driven interface. */ com_ptr render_client; -#ifdef CUBEB_WASAPI_USE_IAUDIOSTREAMVOLUME - /* Interface pointer to use the volume facilities. */ - com_ptr audio_stream_volume; -#endif /* Interface pointer to use the stream audio clock. */ com_ptr audio_clock; /* Frames written to the stream since it was opened. Reset on device @@ -1087,7 +1083,6 @@ refill(cubeb_stream * stm, void * input_buffer, long input_frames_count, XASSERT(out_frames == output_frames_needed || stm->draining || !has_output(stm) || stm->has_dummy_output); -#ifndef CUBEB_WASAPI_USE_IAUDIOSTREAMVOLUME if (has_output(stm) && !stm->has_dummy_output && volume != 1.0) { // Adjust the output volume. // Note: This could be integrated with the remixing below. @@ -1115,7 +1110,6 @@ refill(cubeb_stream * stm, void * input_buffer, long input_frames_count, } } } -#endif // We don't bother mixing dummy output as it will be silenced, otherwise mix // output if needed @@ -1819,43 +1813,6 @@ current_stream_delay(cubeb_stream * stm) return delay; } - -#ifdef CUBEB_WASAPI_USE_IAUDIOSTREAMVOLUME -int -stream_set_volume(cubeb_stream * stm, float volume) -{ - stm->stream_reset_lock.assert_current_thread_owns(); - - if (!stm->audio_stream_volume) { - return CUBEB_ERROR; - } - - uint32_t channels; - HRESULT hr = stm->audio_stream_volume->GetChannelCount(&channels); - if (FAILED(hr)) { - LOG("could not get the channel count: %lx", hr); - return CUBEB_ERROR; - } - - /* up to 9.1 for now */ - if (channels > 10) { - return CUBEB_ERROR_NOT_SUPPORTED; - } - - float volumes[10]; - for (uint32_t i = 0; i < channels; i++) { - volumes[i] = volume; - } - - hr = stm->audio_stream_volume->SetAllVolumes(channels, volumes); - if (FAILED(hr)) { - LOG("could not set the channels volume: %lx", hr); - return CUBEB_ERROR; - } - - return CUBEB_OK; -} -#endif } // namespace extern "C" { @@ -2732,15 +2689,6 @@ setup_wasapi_stream(cubeb_stream * stm) } HRESULT hr = 0; -#ifdef CUBEB_WASAPI_USE_IAUDIOSTREAMVOLUME - hr = stm->output_client->GetService(__uuidof(IAudioStreamVolume), - stm->audio_stream_volume.receive_vpp()); - if (FAILED(hr)) { - LOG("Could not get the IAudioStreamVolume: %lx", hr); - return CUBEB_ERROR; - } -#endif - XASSERT(stm->frames_written == 0); hr = stm->output_client->GetService(__uuidof(IAudioClock), stm->audio_clock.receive_vpp()); @@ -2764,14 +2712,6 @@ setup_wasapi_stream(cubeb_stream * stm) } else { LOG("Could not get the IAudioSessionControl: %lx", hr); } - -#ifdef CUBEB_WASAPI_USE_IAUDIOSTREAMVOLUME - /* Restore the stream volume over a device change. */ - if (stream_set_volume(stm, stm->volume) != CUBEB_OK) { - LOG("Could not set the volume."); - return CUBEB_ERROR; - } -#endif } /* If we have both input and output, we resample to @@ -3041,9 +2981,6 @@ close_wasapi_stream(cubeb_stream * stm) stm->session_control = nullptr; } -#ifdef CUBEB_WASAPI_USE_IAUDIOSTREAMVOLUME - stm->audio_stream_volume = nullptr; -#endif stm->audio_clock = nullptr; stm->render_client = nullptr; stm->output_client = nullptr; @@ -3345,12 +3282,6 @@ wasapi_stream_set_volume(cubeb_stream * stm, float volume) return CUBEB_ERROR; } -#ifdef CUBEB_WASAPI_USE_IAUDIOSTREAMVOLUME - if (stream_set_volume(stm, volume) != CUBEB_OK) { - return CUBEB_ERROR; - } -#endif - stm->volume = volume; return CUBEB_OK;