Commit b8226338 authored by sletz's avatar sletz
Browse files

For audio device reservation, add card_to_num function.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3348 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 319a95c6
......@@ -22,10 +22,11 @@ Michael Voigt
---------------------------
Jackdmp changes log
---------------------------
2009-02-25 Stephane Letz <letz@grame.fr>
* Fix JackNetDriver::Close method.
* For audio device reservation, add card_to_num function.
2009-02-23 Stephane Letz <letz@grame.fr>
......
......@@ -47,6 +47,7 @@ SERVER_EXPORT int audio_reservation_finish()
{
if (connection)
dbus_connection_unref(connection);
return 0;
}
SERVER_EXPORT void* audio_acquire(int num)
......
......@@ -2138,6 +2138,21 @@ int JackAlsaDriver::Detach()
return JackAudioDriver::Detach();
}
static int card_to_num(const char *device)
{
const char* t;
int i;
if ((t = strchr(device, ':')))
device = t+1;
if ((i = snd_card_get_index(device)) < 0) {
i = atoi(device);
}
return i;
}
int JackAlsaDriver::Open(jack_nframes_t nframes,
jack_nframes_t user_nperiods,
jack_nframes_t samplerate,
......@@ -2174,18 +2189,18 @@ int JackAlsaDriver::Open(jack_nframes_t nframes,
if (audio_reservation_init() < 0) {
jack_error("Audio reservation sevice not available....");
} else if (strcmp(capture_driver_name, playback_driver_name) == 0) { // Same device for input and output
fReservedCaptureDevice = audio_acquire(0);
fReservedCaptureDevice = audio_acquire(card_to_num(capture_driver_name));
if (fReservedCaptureDevice == NULL) {
jack_error("Error audio device %s not available...", capture_driver_name);
return -1;
}
} else {
fReservedCaptureDevice = audio_acquire(0);
fReservedCaptureDevice = audio_acquire(card_to_num(capture_driver_name));
if (fReservedCaptureDevice == NULL) {
jack_error("Error capture audio device %s not available...", capture_driver_name);
return -1;
}
fReservedPlaybackDevice = audio_acquire(0);
fReservedPlaybackDevice = audio_acquire(card_to_num(playback_driver_name));
if (fReservedPlaybackDevice == NULL) {
jack_error("Error playback audio device %s not available...", playback_driver_name);
return -1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment