btstack_audio: add set_volume() to sink and set_gain() to source interfaces (nop implementations for portaudio and embedded)

This commit is contained in:
Matthias Ringwald 2020-06-26 15:12:53 +02:00
parent 5f4f94c7c2
commit 1b7f8fa10e
4 changed files with 35 additions and 3 deletions

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- CVSD PLC: treat zero frames as good and allow to mark data as bad, e.g. if reported by controller as erroneous
- btstack_audio: add set_volume() to sink and set_gain() to source interfaces
## Changes May 2020

View File

@ -147,6 +147,14 @@ static int btstack_audio_embedded_source_init(
return 0;
}
static void btstack_audio_embedded_sink_set_volume(uint8_t volume){
UNUSED(volume);
}
static void btstack_audio_embedded_source_set_gain(uint8_t gain){
UNUSED(gain);
}
static void btstack_audio_embedded_sink_start_stream(void){
output_buffer_count = hal_audio_sink_get_num_output_buffers();
output_buffer_samples = hal_audio_sink_get_num_output_buffer_samples();
@ -227,6 +235,7 @@ static void btstack_audio_embedded_source_close(void){
static const btstack_audio_sink_t btstack_audio_embedded_sink = {
/* int (*init)(..);*/ &btstack_audio_embedded_sink_init,
/* void (*set_volume)(uint8_t volume); */ &btstack_audio_embedded_sink_set_volume,
/* void (*start_stream(void));*/ &btstack_audio_embedded_sink_start_stream,
/* void (*stop_stream)(void) */ &btstack_audio_embedded_sink_stop_stream,
/* void (*close)(void); */ &btstack_audio_embedded_sink_close
@ -234,6 +243,7 @@ static const btstack_audio_sink_t btstack_audio_embedded_sink = {
static const btstack_audio_source_t btstack_audio_embedded_source = {
/* int (*init)(..);*/ &btstack_audio_embedded_source_init,
/* void (*set_gain)(uint8_t gain); */ &btstack_audio_embedded_source_set_gain,
/* void (*start_stream(void));*/ &btstack_audio_embedded_source_start_stream,
/* void (*stop_stream)(void) */ &btstack_audio_embedded_source_stop_stream,
/* void (*close)(void); */ &btstack_audio_embedded_source_close

View File

@ -302,6 +302,14 @@ static int btstack_audio_portaudio_source_init(
return 0;
}
static void btstack_audio_portaudio_sink_set_volume(uint8_t volume){
UNUSED(volume);
}
static void btstack_audio_portaudio_source_set_gain(uint8_t gain){
UNUSED(gain);
}
static void btstack_audio_portaudio_sink_start_stream(void){
if (!playback_callback) return;
@ -409,7 +417,6 @@ static void btstack_audio_portaudio_sink_close(void){
btstack_audio_portaudio_close_pa_if_not_needed();
}
static void btstack_audio_portaudio_source_close(void){
if (!recording_callback) return;
@ -430,6 +437,7 @@ static void btstack_audio_portaudio_source_close(void){
static const btstack_audio_sink_t btstack_audio_portaudio_sink = {
/* int (*init)(..);*/ &btstack_audio_portaudio_sink_init,
/* void (*set_volume)(uint8_t volume); */ &btstack_audio_portaudio_sink_set_volume,
/* void (*start_stream(void));*/ &btstack_audio_portaudio_sink_start_stream,
/* void (*stop_stream)(void) */ &btstack_audio_portaudio_sink_stop_stream,
/* void (*close)(void); */ &btstack_audio_portaudio_sink_close
@ -437,6 +445,7 @@ static const btstack_audio_sink_t btstack_audio_portaudio_sink = {
static const btstack_audio_source_t btstack_audio_portaudio_source = {
/* int (*init)(..);*/ &btstack_audio_portaudio_source_init,
/* void (*set_gain)(uint8_t gain); */ &btstack_audio_portaudio_source_set_gain,
/* void (*start_stream(void));*/ &btstack_audio_portaudio_source_start_stream,
/* void (*stop_stream)(void) */ &btstack_audio_portaudio_source_stop_stream,
/* void (*close)(void); */ &btstack_audio_portaudio_source_close

View File

@ -63,7 +63,13 @@ typedef struct {
uint32_t samplerate,
void (*playback) (int16_t * buffer, uint16_t num_samples));
/**
/**
* @brief Set volume
* @param Volume 0..127
*/
void (*set_volume)(uint8_t volume);
/**
* @brief Start stream
*/
void (*start_stream)(void);
@ -94,7 +100,13 @@ typedef struct {
uint32_t samplerate,
void (*recording)(const int16_t * buffer, uint16_t num_samples));
/**
/**
* @brief Set Gain
* @param Gain 0..127
*/
void (*set_gain)(uint8_t gain);
/**
* @brief Start stream
*/
void (*start_stream)(void);