From 4ba8f6b76bc457fda6f625db382c94cc89f6baea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 13 Jul 2011 15:37:26 +0200 Subject: [PATCH] Add possibility for main to be mono --- jack_mixer.c | 5 +++-- jack_mixer.h | 3 ++- jack_mixer_c.c | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/jack_mixer.c b/jack_mixer.c index 8ddd811..a8703a3 100644 --- a/jack_mixer.c +++ b/jack_mixer.c @@ -991,7 +991,8 @@ process( jack_mixer_t create( - const char * jack_client_name_ptr) + const char * jack_client_name_ptr, + bool stereo) { int ret; struct jack_mixer * mixer_ptr; @@ -1033,7 +1034,7 @@ create( LOG_DEBUG("Sample rate: %" PRIu32, jack_get_sample_rate(mixer_ptr->jack_client)); - mixer_ptr->main_mix_channel = create_output_channel(mixer_ptr, "MAIN", true, false); + mixer_ptr->main_mix_channel = create_output_channel(mixer_ptr, "MAIN", stereo, false); if (mixer_ptr->main_mix_channel == NULL) { LOG_ERROR("Cannot create main mix channel"); goto close_jack; diff --git a/jack_mixer.h b/jack_mixer.h index 3de773a..5e38576 100644 --- a/jack_mixer.h +++ b/jack_mixer.h @@ -41,7 +41,8 @@ typedef void * jack_mixer_threshold_t; jack_mixer_t create( - const char * jack_client_name_ptr); + const char * jack_client_name_ptr, + bool stereo); void destroy( diff --git a/jack_mixer_c.c b/jack_mixer_c.c index c5e56fb..5bff6f9 100644 --- a/jack_mixer_c.c +++ b/jack_mixer_c.c @@ -795,13 +795,14 @@ Mixer_new(PyTypeObject *type, PyObject *args, PyObject *kwds) static int Mixer_init(MixerObject *self, PyObject *args, PyObject *kwds) { - static char *kwlist[] = {"name", NULL}; + static char *kwlist[] = {"name", "stereo", NULL}; char *name; + int stereo = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &name)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|b", kwlist, &name, &stereo)) return -1; - self->mixer = create(name); + self->mixer = create(name, (bool)stereo); if (self->mixer == NULL) { PyErr_SetString(PyExc_RuntimeError, "error creating mixer, probably jack is not running"); -- 2.11.4.GIT