pa_threaded_mainloop_signal(pClient->__mpMainloop, 0);
}
+void CPulseAudioClient::__successVolumeCb(pa_context *c, int success, void *user_data) {
+ AUDIO_IO_LOGD("pa_context[%p], success[%d], user_data[%p]", c, success, user_data);
+}
+
void CPulseAudioClient::initialize() {
if (__mIsInit)
return;
return ret;
}
//LCOV_EXCL_STOP
+
+void CPulseAudioClient::applyRecordVolume(double volume) {
+ if (!__mIsInit)
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+
+ checkRunningState();
+
+ if (__mDirection != EStreamDirection::STREAM_DIRECTION_RECORD)
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client can't use this function"); //LCOV_EXCL_LINE
+
+ try {
+ if (!isInThread())
+ pa_threaded_mainloop_lock(__mpMainloop);
+
+ pa_cvolume cv = { 0, };
+ pa_volume_t v = PA_VOLUME_NORM * volume;
+
+ pa_cvolume_set(&cv, __mSpec.getChannelMap().channels, v);
+
+ pa_operation_unref(pa_context_set_source_output_volume(__mpContext,
+ pa_stream_get_index(__mpStream), &cv, __successVolumeCb, NULL));
+
+ if (!isInThread())
+ pa_threaded_mainloop_unlock(__mpMainloop);
+ } catch (const CAudioError& e) {
+ if (!isInThread())
+ pa_threaded_mainloop_unlock(__mpMainloop);
+ throw;
+ }
+}
\ No newline at end of file