From a848f69f16f016e5ddb3d0a09c4332a61bae5560 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 26 Dec 2013 15:59:59 +0000 Subject: [PATCH] Jamulus now works with jack mono input and mono output devices --- linux/sound.cpp | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/linux/sound.cpp b/linux/sound.cpp index 800bea2e..2052396f 100755 --- a/linux/sound.cpp +++ b/linux/sound.cpp @@ -103,17 +103,7 @@ void CSound::OpenJack() JackPortIsPhysical | JackPortIsOutput ) ) == NULL ) { throw CGenErr ( tr ( "There are no physical capture ports available. " - "This software requires at least one stereo input channel available. " - "Maybe you have selected the wrong sound card in the Jack server " - "configuration.
" - "You can use a tool like QJackCtl " - "to adjust the Jack server settings." ) ); - } - - if ( !ports[1] ) - { - throw CGenErr ( tr ( "There are no physical capture ports available. " - "This software requires at least one stereo input channel available. " + "This software requires at least one input channel available. " "Maybe you have selected the wrong sound card in the Jack server " "configuration.
" "You can use a tool like QJackCtl " @@ -124,9 +114,15 @@ void CSound::OpenJack() { throw CGenErr ( tr ( "Cannot connect the Jack input ports" ) ); } - if ( jack_connect ( pJackClient, ports[1], jack_port_name ( input_port_right ) ) ) + + // before connecting the second stereo channel, check if the input is not + // mono + if ( ports[1] ) { - throw CGenErr ( tr ( "Cannot connect the Jack input ports" ) ); + if ( jack_connect ( pJackClient, ports[1], jack_port_name ( input_port_right ) ) ) + { + throw CGenErr ( tr ( "Cannot connect the Jack input ports" ) ); + } } free ( ports ); @@ -135,30 +131,27 @@ void CSound::OpenJack() JackPortIsPhysical | JackPortIsInput ) ) == NULL ) { throw CGenErr ( tr ( "There are no physical playback ports available. " - "This software requires at least one stereo output channel available. " + "This software requires at least one output channel available. " "Maybe you have selected the wrong sound card in the Jack server " "configuration.
" "You can use a tool like QJackCtl " "to adjust the Jack server settings." ) ); } - if ( !ports[1] ) - { - throw CGenErr ( tr ( "There are no physical playback ports available. " - "This software requires at least one stereo output channel available. " - "Maybe you have selected the wrong sound card in the Jack server " - "configuration.
" - "You can use a tool like QJackCtl " - "to adjust the Jack server settings." ) ); - } if ( jack_connect ( pJackClient, jack_port_name ( output_port_left ), ports[0] ) ) { throw CGenErr ( tr ( "Cannot connect the Jack output ports." ) ); } - if ( jack_connect ( pJackClient, jack_port_name ( output_port_right ), ports[1] ) ) + + // before connecting the second stereo channel, check if the output is not + // mono + if ( ports[1] ) { - throw CGenErr ( tr ( "Cannot connect the Jack output ports." ) ); + if ( jack_connect ( pJackClient, jack_port_name ( output_port_right ), ports[1] ) ) + { + throw CGenErr ( tr ( "Cannot connect the Jack output ports." ) ); + } } free ( ports ); @@ -302,4 +295,3 @@ void CSound::shutdownCallback ( void* ) "solve the issue." ) ); } #endif // WITH_SOUND -