added ability to specify jack device name created by darkice,

thanks to Alessandro Baretta <alessandro.baretta@radiomaria.org>
re #24
This commit is contained in:
darkeye 2008-07-07 14:33:34 +00:00
parent d82cd56ffa
commit aa27bf95c0
9 changed files with 26 additions and 1 deletions

View File

@ -33,4 +33,5 @@ with contributions by:
Elod Horvath <elod@itfais.com>
Pierre Souchay <pierre@souchay.net>
Daniel Hazelbaker <daniel@highdesertchurch.com>
Alessandro Beretta <alessandro.baretta@radiomaria.org>

View File

@ -6,6 +6,8 @@ Darkice 0.19 to be released
thanks to Pierre Souchay <pierre@souchay.net>
o enable easier finding of jack libraries on MacOS X,
thanks to Daniel Hazelbaker <daniel@highdesertchurch.com>
o added ability to specify name of jack device created by darkice,
thanks to Alessandro Beretta <alessandro.baretta@radiomaria.org>
26-04-2007 DarkIce 0.18.1 released

View File

@ -107,6 +107,7 @@ Developed with contributions by
Elod Horvath <elod@itfais.com>
Pierre Souchay <pierre@souchay.net>
Daniel Hazelbaker <daniel@highdesertchurch.com>
Alessandro Beretta <alessandro.baretta@radiomaria.org>
.SH LINKS
Project homepage:

View File

@ -90,6 +90,10 @@ Number of bits to use for each sample (e.g. 8 bits or 16 bits)
.TP
.I channel
Number of channels to record (e.g. 1 for mono, 2 for stereo)
.TP
.I jackClientName
The name of the jack input channel created by darkice if device=jack
is specified.
.PP
.B [icecast-x]

View File

@ -60,6 +60,7 @@ static const char fileid[] = "$Id$";
*----------------------------------------------------------------------------*/
AudioSource *
AudioSource :: createDspSource( const char * deviceName,
const char * jackClientName,
int sampleRate,
int bitsPerSample,
int channel)
@ -101,6 +102,7 @@ AudioSource :: createDspSource( const char * deviceName,
#if defined( SUPPORT_JACK_DSP )
Reporter::reportEvent( 1, "Using JACK audio server as input device.");
return new JackDspSource( deviceName,
jackClientName,
sampleRate,
bitsPerSample,
channel);

View File

@ -272,6 +272,7 @@ class AudioSource : public Source, public virtual Reporter
*/
static AudioSource *
createDspSource( const char * deviceName,
const char * jackClientName,
int sampleRate = 44100,
int bitsPerSample = 16,
int channel = 2) throw ( Exception );

View File

@ -139,6 +139,7 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
unsigned int channel;
bool reconnect;
const char * device;
const char * jackClientName;
// the [general] section
if ( !(cs = config.get( "general")) ) {
@ -172,8 +173,10 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
str = cs->getForSure( "channel", " missing in section [input]");
channel = Util::strToL( str);
device = cs->getForSure( "device", " missing in section [input]");
jackClientName = cs->get ( "jackClientName");
dsp = AudioSource::createDspSource( device,
jackClientName,
sampleRate,
bitsPerSample,
channel );

View File

@ -188,7 +188,12 @@ JackDspSource :: open ( void ) throw ( Exception )
}
// Register client with Jack
snprintf(client_name, 255, "darkice-%d", getpid());
if ( jack_client_name != NULL ) {
snprintf(client_name, 255, "%s", jack_client_name);
} else {
snprintf(client_name, 255, "darkice-%d", getpid());
}
if ((client = jack_client_new(client_name)) == NULL) {
throw Exception( __FILE__, __LINE__, "JACK server not running?");
}

View File

@ -67,6 +67,10 @@
class JackDspSource : public AudioSource, public virtual Reporter
{
private:
/**
* The jack client name.
*/
const char * jack_client_name;
/**
* The jack port
@ -156,6 +160,7 @@ class JackDspSource : public AudioSource, public virtual Reporter
*/
inline
JackDspSource ( const char * name,
const char * jackClientName,
int sampleRate = 44100,
int bitsPerSample = 16,
int channels = 2 )
@ -163,6 +168,7 @@ class JackDspSource : public AudioSource, public virtual Reporter
: AudioSource( sampleRate, bitsPerSample, channels )
{
jack_client_name = jackClientName;
init( name );
}