diff --git a/conf/autoload_configs/portaudio.conf.xml b/conf/autoload_configs/portaudio.conf.xml index 1f758de896..7389bf49cd 100644 --- a/conf/autoload_configs/portaudio.conf.xml +++ b/conf/autoload_configs/portaudio.conf.xml @@ -5,12 +5,14 @@ or the device number prefixed with # eg "#1" (or blank for default) --> - + - + + - + + @@ -29,7 +31,30 @@ - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index baa33d456e..d02a3ead07 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -106,6 +106,34 @@ struct audio_stream { }; typedef struct audio_stream audio_stream_t; +typedef struct _pa_shared_device { + /*! Sampling rate */ + int sample_rate; + /*! */ + int codec_ms; + /*! Device number */ + int devno; + /*! Running stream (if a stream is already running for devno) */ + audio_stream_t *stream; + /*! The actual portaudio device number */ + /*! It's a shared device after all */ + switch_mutex_t *mutex; +} pa_shared_device_t; + +typedef struct _pa_endpoint { + /*! Input device for this endpoint */ + pa_shared_device_t *indev; + + /*! Output device for this endpoint */ + pa_shared_device_t *outdev; + + /*! Channel index within the input device stream */ + int inchan; + + /*! Channel index within the input device stream */ + int outchan; +} pa_endpoint_t; + static struct { int debug; int port; diff --git a/src/mod/endpoints/mod_portaudio/pablio.h b/src/mod/endpoints/mod_portaudio/pablio.h index 0bd3c41e46..6d99d2f012 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.h +++ b/src/mod/endpoints/mod_portaudio/pablio.h @@ -56,17 +56,19 @@ extern "C" { #include - typedef struct { - PaUtilRingBuffer inFIFO; - PaUtilRingBuffer outFIFO; - PaStream *istream; - PaStream *ostream; - PaStream *iostream; - int bytesPerFrame; - int do_dual; - int has_in; - int has_out; - } PABLIO_Stream; +#define MAX_IO_CHANNELS 2 +typedef struct { + PaStream *istream; + PaStream *ostream; + PaStream *iostream; + int bytesPerFrame; + int do_dual; + int has_in; + int has_out; + PaUtilRingBuffer inFIFOs[2] + PaUtilRingBuffer outFIFOs[2] + int channelCount; +} PABLIO_Stream; /* Values for flags for OpenAudioStream(). */ #define PABLIO_READ (1<<0)