diff options
-rw-r--r-- | include/cubeb/cubeb.h | 36 | ||||
-rw-r--r-- | src/cubeb-internal.h | 4 | ||||
-rw-r--r-- | src/cubeb.c | 31 | ||||
-rw-r--r-- | src/cubeb_aaudio.cpp | 2 | ||||
-rw-r--r-- | src/cubeb_alsa.c | 2 | ||||
-rw-r--r-- | src/cubeb_audiotrack.c | 2 | ||||
-rw-r--r-- | src/cubeb_audiounit.cpp | 2 | ||||
-rw-r--r-- | src/cubeb_jack.cpp | 2 | ||||
-rw-r--r-- | src/cubeb_kai.c | 2 | ||||
-rw-r--r-- | src/cubeb_opensl.cpp | 2 | ||||
-rw-r--r-- | src/cubeb_oss.c | 2 | ||||
-rw-r--r-- | src/cubeb_pulse.c | 2 | ||||
-rw-r--r-- | src/cubeb_sndio.c | 2 | ||||
-rw-r--r-- | src/cubeb_sun.c | 2 | ||||
-rw-r--r-- | src/cubeb_wasapi.cpp | 2 | ||||
-rw-r--r-- | src/cubeb_winmm.c | 2 |
16 files changed, 97 insertions, 0 deletions
diff --git a/include/cubeb/cubeb.h b/include/cubeb/cubeb.h index b606695..5c66d58 100644 --- a/include/cubeb/cubeb.h +++ b/include/cubeb/cubeb.h @@ -258,6 +258,18 @@ typedef enum { the jack backend. */ } cubeb_stream_prefs; +/** + * Input stream audio processing parameters. Only applicable with + * CUBEB_STREAM_PREF_VOICE. + */ +typedef enum { + CUBEB_INPUT_PROCESSING_PARAM_NONE = 0x00, + CUBEB_INPUT_PROCESSING_PARAM_ECHO_CANCELLATION = 0x01, + CUBEB_INPUT_PROCESSING_PARAM_NOISE_SUPPRESSION = 0x02, + CUBEB_INPUT_PROCESSING_PARAM_AUTOMATIC_GAIN_CONTROL = 0x04, + CUBEB_INPUT_PROCESSING_PARAM_VOICE_ISOLATION = 0x08, +} cubeb_input_processing_params; + /** Stream format initialization parameters. */ typedef struct { cubeb_sample_format format; /**< Requested sample format. One of @@ -514,6 +526,18 @@ cubeb_get_min_latency(cubeb * context, cubeb_stream_params * params, CUBEB_EXPORT int cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate); +/** Get the supported input processing features for this backend. See + cubeb_stream_set_input_processing for how to set them for a particular input + stream. + @param context A pointer to the cubeb context. + @param params Out parameter for the input processing params supported by + this backend. + @retval CUBEB_OK + @retval CUBEB_ERROR_NOT_SUPPORTED */ +CUBEB_EXPORT int +cubeb_get_supported_input_processing_params( + cubeb * context, cubeb_input_processing_params * params); + /** Destroy an application context. This must be called after all stream have * been destroyed. @param context A pointer to the cubeb context.*/ @@ -641,6 +665,18 @@ CUBEB_EXPORT int cubeb_stream_get_current_device(cubeb_stream * stm, cubeb_device ** const device); +/** Set what input processing features to enable for this stream. + @param stream the stream for which to set input processing features. + @param params what input processing features to use + @retval CUBEB_OK + @retval CUBEB_ERROR if params could not be applied + @retval CUBEB_ERROR_INVALID_PARAMETER if a given param is not supported by + this backend, or if this stream does not have an input device + @retval CUBEB_ERROR_NOT_SUPPORTED */ +CUBEB_EXPORT int +cubeb_stream_set_input_processing_params(cubeb_stream * stream, + cubeb_input_processing_params params); + /** Destroy a cubeb_device structure. @param stream the stream passed in cubeb_stream_get_current_device @param devices the devices to destroy diff --git a/src/cubeb-internal.h b/src/cubeb-internal.h index 79326e1..c6d9b87 100644 --- a/src/cubeb-internal.h +++ b/src/cubeb-internal.h @@ -40,6 +40,8 @@ struct cubeb_ops { int (*get_min_latency)(cubeb * context, cubeb_stream_params params, uint32_t * latency_ms); int (*get_preferred_sample_rate)(cubeb * context, uint32_t * rate); + int (*get_supported_input_processing_params)( + cubeb * context, cubeb_input_processing_params * params); int (*enumerate_devices)(cubeb * context, cubeb_device_type type, cubeb_device_collection * collection); int (*device_collection_destroy)(cubeb * context, @@ -62,6 +64,8 @@ struct cubeb_ops { int (*stream_set_name)(cubeb_stream * stream, char const * stream_name); int (*stream_get_current_device)(cubeb_stream * stream, cubeb_device ** const device); + int (*stream_set_input_processing_params)( + cubeb_stream * stream, cubeb_input_processing_params params); int (*stream_device_destroy)(cubeb_stream * stream, cubeb_device * device); int (*stream_register_device_changed_callback)( cubeb_stream * stream, diff --git a/src/cubeb.c b/src/cubeb.c index eca2c63..c13a848 100644 --- a/src/cubeb.c +++ b/src/cubeb.c @@ -341,6 +341,21 @@ cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate) return context->ops->get_preferred_sample_rate(context, rate); } +int +cubeb_get_supported_input_processing_params( + cubeb * context, cubeb_input_processing_params * params) +{ + if (!context || !params) { + return CUBEB_ERROR_INVALID_PARAMETER; + } + + if (!context->ops->get_supported_input_processing_params) { + return CUBEB_ERROR_NOT_SUPPORTED; + } + + return context->ops->get_supported_input_processing_params(context, params); +} + void cubeb_destroy(cubeb * context) { @@ -501,6 +516,22 @@ cubeb_stream_get_current_device(cubeb_stream * stream, } int +cubeb_stream_set_input_processing_params(cubeb_stream * stream, + cubeb_input_processing_params params) +{ + if (!stream || !params) { + return CUBEB_ERROR_INVALID_PARAMETER; + } + + if (!stream->context->ops->stream_set_input_processing_params) { + return CUBEB_ERROR_NOT_SUPPORTED; + } + + return stream->context->ops->stream_set_input_processing_params(stream, + params); +} + +int cubeb_stream_device_destroy(cubeb_stream * stream, cubeb_device * device) { if (!stream || !device) { diff --git a/src/cubeb_aaudio.cpp b/src/cubeb_aaudio.cpp index f95f7f0..d4bc87a 100644 --- a/src/cubeb_aaudio.cpp +++ b/src/cubeb_aaudio.cpp @@ -1736,6 +1736,7 @@ const static struct cubeb_ops aaudio_ops = { /*.get_max_channel_count =*/aaudio_get_max_channel_count, /* .get_min_latency =*/aaudio_get_min_latency, /*.get_preferred_sample_rate =*/aaudio_get_preferred_sample_rate, + /*.get_supported_input_processing_params =*/nullptr, /*.enumerate_devices =*/nullptr, /*.device_collection_destroy =*/nullptr, /*.destroy =*/aaudio_destroy, @@ -1749,6 +1750,7 @@ const static struct cubeb_ops aaudio_ops = { /*.stream_set_volume =*/aaudio_stream_set_volume, /*.stream_set_name =*/nullptr, /*.stream_get_current_device =*/nullptr, + /*.stream_set_input_processing_params =*/nullptr, /*.stream_device_destroy =*/nullptr, /*.stream_register_device_changed_callback =*/nullptr, /*.register_device_collection_changed =*/nullptr}; diff --git a/src/cubeb_alsa.c b/src/cubeb_alsa.c index 6b53df0..45911e5 100644 --- a/src/cubeb_alsa.c +++ b/src/cubeb_alsa.c @@ -1472,6 +1472,7 @@ static struct cubeb_ops const alsa_ops = { .get_max_channel_count = alsa_get_max_channel_count, .get_min_latency = alsa_get_min_latency, .get_preferred_sample_rate = alsa_get_preferred_sample_rate, + .get_supported_input_processing_params = NULL, .enumerate_devices = alsa_enumerate_devices, .device_collection_destroy = alsa_device_collection_destroy, .destroy = alsa_destroy, @@ -1485,6 +1486,7 @@ static struct cubeb_ops const alsa_ops = { .stream_set_volume = alsa_stream_set_volume, .stream_set_name = NULL, .stream_get_current_device = NULL, + .stream_set_input_processing_params = NULL, .stream_device_destroy = NULL, .stream_register_device_changed_callback = NULL, .register_device_collection_changed = NULL}; diff --git a/src/cubeb_audiotrack.c b/src/cubeb_audiotrack.c index 59deba1..44119d2 100644 --- a/src/cubeb_audiotrack.c +++ b/src/cubeb_audiotrack.c @@ -454,6 +454,7 @@ static struct cubeb_ops const audiotrack_ops = { .get_max_channel_count = audiotrack_get_max_channel_count, .get_min_latency = audiotrack_get_min_latency, .get_preferred_sample_rate = audiotrack_get_preferred_sample_rate, + .get_supported_input_processing_params = NULL, .enumerate_devices = NULL, .device_collection_destroy = NULL, .destroy = audiotrack_destroy, @@ -467,6 +468,7 @@ static struct cubeb_ops const audiotrack_ops = { .stream_set_volume = audiotrack_stream_set_volume, .stream_set_name = NULL, .stream_get_current_device = NULL, + .stream_set_input_processing_params = NULL, .stream_device_destroy = NULL, .stream_register_device_changed_callback = NULL, .register_device_collection_changed = NULL}; diff --git a/src/cubeb_audiounit.cpp b/src/cubeb_audiounit.cpp index 37036a3..915a6c5 100644 --- a/src/cubeb_audiounit.cpp +++ b/src/cubeb_audiounit.cpp @@ -3665,6 +3665,7 @@ cubeb_ops const audiounit_ops = { /*.get_max_channel_count =*/audiounit_get_max_channel_count, /*.get_min_latency =*/audiounit_get_min_latency, /*.get_preferred_sample_rate =*/audiounit_get_preferred_sample_rate, + /*.get_supported_input_processing_params =*/NULL, /*.enumerate_devices =*/audiounit_enumerate_devices, /*.device_collection_destroy =*/audiounit_device_collection_destroy, /*.destroy =*/audiounit_destroy, @@ -3678,6 +3679,7 @@ cubeb_ops const audiounit_ops = { /*.stream_set_volume =*/audiounit_stream_set_volume, /*.stream_set_name =*/NULL, /*.stream_get_current_device =*/audiounit_stream_get_current_device, + /*.stream_set_input_processing_params =*/NULL, /*.stream_device_destroy =*/audiounit_stream_device_destroy, /*.stream_register_device_changed_callback =*/ audiounit_stream_register_device_changed_callback, diff --git a/src/cubeb_jack.cpp b/src/cubeb_jack.cpp index 218d7e4..573f0ab 100644 --- a/src/cubeb_jack.cpp +++ b/src/cubeb_jack.cpp @@ -160,6 +160,7 @@ static struct cubeb_ops const cbjack_ops = { .get_max_channel_count = cbjack_get_max_channel_count, .get_min_latency = cbjack_get_min_latency, .get_preferred_sample_rate = cbjack_get_preferred_sample_rate, + .get_supported_input_processing_params = NULL, .enumerate_devices = cbjack_enumerate_devices, .device_collection_destroy = cbjack_device_collection_destroy, .destroy = cbjack_destroy, @@ -173,6 +174,7 @@ static struct cubeb_ops const cbjack_ops = { .stream_set_volume = cbjack_stream_set_volume, .stream_set_name = NULL, .stream_get_current_device = cbjack_stream_get_current_device, + .stream_set_input_processing_params = NULL, .stream_device_destroy = cbjack_stream_device_destroy, .stream_register_device_changed_callback = NULL, .register_device_collection_changed = NULL}; diff --git a/src/cubeb_kai.c b/src/cubeb_kai.c index 0a0d676..dd2af87 100644 --- a/src/cubeb_kai.c +++ b/src/cubeb_kai.c @@ -351,6 +351,7 @@ static struct cubeb_ops const kai_ops = { /*.get_min_latency=*/kai_get_min_latency, /*.get_preferred_sample_rate =*/kai_get_preferred_sample_rate, /*.get_preferred_channel_layout =*/NULL, + /*.get_supported_input_processing_params =*/NULL, /*.enumerate_devices =*/NULL, /*.device_collection_destroy =*/NULL, /*.destroy =*/kai_destroy, @@ -364,6 +365,7 @@ static struct cubeb_ops const kai_ops = { /*.stream_set_volume =*/kai_stream_set_volume, /*.stream_set_name =*/NULL, /*.stream_get_current_device =*/NULL, + /*.stream_set_input_processing_params =*/NULL, /*.stream_device_destroy =*/NULL, /*.stream_register_device_changed_callback=*/NULL, /*.register_device_collection_changed=*/NULL}; diff --git a/src/cubeb_opensl.cpp b/src/cubeb_opensl.cpp index 8725173..c7d6227 100644 --- a/src/cubeb_opensl.cpp +++ b/src/cubeb_opensl.cpp @@ -1934,6 +1934,7 @@ struct cubeb_ops const opensl_ops = { .get_max_channel_count = opensl_get_max_channel_count, .get_min_latency = nullptr, .get_preferred_sample_rate = nullptr, + .get_supported_input_processing_params = nullptr, .enumerate_devices = nullptr, .device_collection_destroy = nullptr, .destroy = opensl_destroy, @@ -1947,6 +1948,7 @@ struct cubeb_ops const opensl_ops = { .stream_set_volume = opensl_stream_set_volume, .stream_set_name = nullptr, .stream_get_current_device = nullptr, + .stream_set_input_processing_params = nullptr, .stream_device_destroy = nullptr, .stream_register_device_changed_callback = nullptr, .register_device_collection_changed = nullptr}; diff --git a/src/cubeb_oss.c b/src/cubeb_oss.c index 8718fa3..7bda530 100644 --- a/src/cubeb_oss.c +++ b/src/cubeb_oss.c @@ -1335,6 +1335,7 @@ static struct cubeb_ops const oss_ops = { .get_max_channel_count = oss_get_max_channel_count, .get_min_latency = oss_get_min_latency, .get_preferred_sample_rate = oss_get_preferred_sample_rate, + .get_supported_input_processing_params = NULL, .enumerate_devices = oss_enumerate_devices, .device_collection_destroy = oss_device_collection_destroy, .destroy = oss_destroy, @@ -1348,6 +1349,7 @@ static struct cubeb_ops const oss_ops = { .stream_set_volume = oss_stream_set_volume, .stream_set_name = NULL, .stream_get_current_device = oss_get_current_device, + .stream_set_input_processing_params = NULL, .stream_device_destroy = oss_stream_device_destroy, .stream_register_device_changed_callback = NULL, .register_device_collection_changed = NULL}; diff --git a/src/cubeb_pulse.c b/src/cubeb_pulse.c index 6866405..636fc36 100644 --- a/src/cubeb_pulse.c +++ b/src/cubeb_pulse.c @@ -1690,6 +1690,7 @@ static struct cubeb_ops const pulse_ops = { .get_max_channel_count = pulse_get_max_channel_count, .get_min_latency = pulse_get_min_latency, .get_preferred_sample_rate = pulse_get_preferred_sample_rate, + .get_supported_input_processing_params = NULL, .enumerate_devices = pulse_enumerate_devices, .device_collection_destroy = pulse_device_collection_destroy, .destroy = pulse_destroy, @@ -1703,6 +1704,7 @@ static struct cubeb_ops const pulse_ops = { .stream_set_volume = pulse_stream_set_volume, .stream_set_name = pulse_stream_set_name, .stream_get_current_device = pulse_stream_get_current_device, + .stream_set_input_processing_params = NULL, .stream_device_destroy = pulse_stream_device_destroy, .stream_register_device_changed_callback = NULL, .register_device_collection_changed = diff --git a/src/cubeb_sndio.c b/src/cubeb_sndio.c index 944c28d..d5a26ae 100644 --- a/src/cubeb_sndio.c +++ b/src/cubeb_sndio.c @@ -667,6 +667,7 @@ static struct cubeb_ops const sndio_ops = { .get_max_channel_count = sndio_get_max_channel_count, .get_min_latency = sndio_get_min_latency, .get_preferred_sample_rate = sndio_get_preferred_sample_rate, + .get_supported_input_processing_params = NULL, .enumerate_devices = sndio_enumerate_devices, .device_collection_destroy = sndio_device_collection_destroy, .destroy = sndio_destroy, @@ -679,6 +680,7 @@ static struct cubeb_ops const sndio_ops = { .stream_set_volume = sndio_stream_set_volume, .stream_set_name = NULL, .stream_get_current_device = NULL, + .stream_set_input_processing_params = NULL, .stream_device_destroy = NULL, .stream_register_device_changed_callback = NULL, .register_device_collection_changed = NULL}; diff --git a/src/cubeb_sun.c b/src/cubeb_sun.c index d3dcb12..6c6f682 100644 --- a/src/cubeb_sun.c +++ b/src/cubeb_sun.c @@ -719,6 +719,7 @@ static struct cubeb_ops const sun_ops = { .get_max_channel_count = sun_get_max_channel_count, .get_min_latency = sun_get_min_latency, .get_preferred_sample_rate = sun_get_preferred_sample_rate, + .get_supported_input_processing_params = NULL, .enumerate_devices = sun_enumerate_devices, .device_collection_destroy = sun_device_collection_destroy, .destroy = sun_destroy, @@ -732,6 +733,7 @@ static struct cubeb_ops const sun_ops = { .stream_set_volume = sun_stream_set_volume, .stream_set_name = NULL, .stream_get_current_device = sun_get_current_device, + .stream_set_input_processing_params = NULL, .stream_device_destroy = sun_stream_device_destroy, .stream_register_device_changed_callback = NULL, .register_device_collection_changed = NULL}; diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp index 711836a..2ddf543 100644 --- a/src/cubeb_wasapi.cpp +++ b/src/cubeb_wasapi.cpp @@ -3561,6 +3561,7 @@ cubeb_ops const wasapi_ops = { /*.get_max_channel_count =*/wasapi_get_max_channel_count, /*.get_min_latency =*/wasapi_get_min_latency, /*.get_preferred_sample_rate =*/wasapi_get_preferred_sample_rate, + /*.get_supported_input_processing_params =*/NULL, /*.enumerate_devices =*/wasapi_enumerate_devices, /*.device_collection_destroy =*/wasapi_device_collection_destroy, /*.destroy =*/wasapi_destroy, @@ -3574,6 +3575,7 @@ cubeb_ops const wasapi_ops = { /*.stream_set_volume =*/wasapi_stream_set_volume, /*.stream_set_name =*/NULL, /*.stream_get_current_device =*/NULL, + /*.stream_set_input_processing_params =*/NULL, /*.stream_device_destroy =*/NULL, /*.stream_register_device_changed_callback =*/NULL, /*.register_device_collection_changed =*/ diff --git a/src/cubeb_winmm.c b/src/cubeb_winmm.c index 9aa176e..09c15df 100644 --- a/src/cubeb_winmm.c +++ b/src/cubeb_winmm.c @@ -1192,6 +1192,7 @@ static struct cubeb_ops const winmm_ops = { /*.get_max_channel_count=*/winmm_get_max_channel_count, /*.get_min_latency=*/winmm_get_min_latency, /*.get_preferred_sample_rate =*/winmm_get_preferred_sample_rate, + /*.get_supported_input_processing_params =*/NULL, /*.enumerate_devices =*/winmm_enumerate_devices, /*.device_collection_destroy =*/winmm_device_collection_destroy, /*.destroy =*/winmm_destroy, @@ -1205,6 +1206,7 @@ static struct cubeb_ops const winmm_ops = { /*.stream_set_volume =*/winmm_stream_set_volume, /*.stream_set_name =*/NULL, /*.stream_get_current_device =*/NULL, + /*.stream_set_input_processing_params =*/NULL, /*.stream_device_destroy =*/NULL, /*.stream_register_device_changed_callback=*/NULL, /*.register_device_collection_changed =*/NULL}; |