Browse Source

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
tags/1.9.2
sletz 16 years ago
parent
commit
b822633846
3 changed files with 21 additions and 4 deletions
  1. +2
    -1
      ChangeLog
  2. +1
    -0
      dbus/audio_reserve.c
  3. +18
    -3
      linux/alsa/JackAlsaDriver.cpp

+ 2
- 1
ChangeLog View File

@@ -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>


+ 1
- 0
dbus/audio_reserve.c View File

@@ -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)


+ 18
- 3
linux/alsa/JackAlsaDriver.cpp View File

@@ -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;


Loading…
Cancel
Save