Commit 8711d06e authored by sletz's avatar sletz
Browse files

Improve JackCoreAudioDriver and JackCoreAudioAdapter : when no devices are...

Improve JackCoreAudioDriver and JackCoreAudioAdapter : when no devices are described, takes default input and output and aggregate them.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3929 0c269be4-1314-0410-8aa9-9f06e86f4224
parent ef30f5ba
......@@ -29,7 +29,11 @@ Mario Lang
Jackdmp changes log
---------------------------
2010-02-15 Gabriel M. Beddingfield <gabriel@teuton.org>
2010-03-02 Stephane Letz <letz@grame.fr>
* Improve JackCoreAudioDriver and JackCoreAudioAdapter : when no devices are described, takes default input and output and aggregate them.
2010-02-15 Stephane Letz <letz@grame.fr>
* Version 1.9.6 started.
......
......@@ -545,10 +545,23 @@ int JackCoreAudioAdapter::SetupDevices(const char* capture_driver_uid,
// Creates aggregate device
AudioDeviceID captureID, playbackID;
if (GetDeviceIDFromUID(capture_driver_uid, &captureID) != noErr)
return -1;
if (GetDeviceIDFromUID(playback_driver_uid, &playbackID) != noErr)
return -1;
if (GetDeviceIDFromUID(capture_driver_uid, &captureID) != noErr) {
jack_log("Will take default input");
if (GetDefaultInputDevice(&captureID) != noErr) {
jack_error("Cannot open default input device");
return -1;
}
}
if (GetDeviceIDFromUID(playback_driver_uid, &playbackID) != noErr) {
jack_log("Will take default output");
if (GetDefaultOutputDevice(&playbackID) != noErr) {
jack_error("Cannot open default output device");
return -1;
}
}
if (CreateAggregateDevice(captureID, playbackID, samplerate, &fDeviceID) != noErr)
return -1;
}
......@@ -558,7 +571,7 @@ int JackCoreAudioAdapter::SetupDevices(const char* capture_driver_uid,
jack_log("JackCoreAudioAdapter::Open capture only");
if (GetDeviceIDFromUID(capture_driver_uid, &fDeviceID) != noErr) {
if (GetDefaultInputDevice(&fDeviceID) != noErr) {
jack_error("Cannot open default device");
jack_error("Cannot open default input device");
return -1;
}
}
......@@ -572,7 +585,7 @@ int JackCoreAudioAdapter::SetupDevices(const char* capture_driver_uid,
jack_log("JackCoreAudioAdapter::Open playback only");
if (GetDeviceIDFromUID(playback_driver_uid, &fDeviceID) != noErr) {
if (GetDefaultOutputDevice(&fDeviceID) != noErr) {
jack_error("Cannot open default device");
jack_error("Cannot open default output device");
return -1;
}
}
......@@ -583,14 +596,31 @@ int JackCoreAudioAdapter::SetupDevices(const char* capture_driver_uid,
// Use default driver in duplex mode
} else {
jack_log("JackCoreAudioAdapter::Open default driver");
jack_log("JackCoreAudioDriver::Open default driver");
if (GetDefaultDevice(&fDeviceID) != noErr) {
jack_error("Cannot open default device");
return -1;
}
if (GetDeviceNameFromID(fDeviceID, capture_driver_name) != noErr || GetDeviceNameFromID(fDeviceID, playback_driver_name) != noErr) {
jack_error("Cannot get device name from device ID");
return -1;
jack_error("Cannot open default device in duplex mode, so aggregate default input and default output");
// Creates aggregate device
AudioDeviceID captureID, playbackID;
if (GetDeviceIDFromUID(capture_driver_uid, &captureID) != noErr) {
jack_log("Will take default input");
if (GetDefaultInputDevice(&captureID) != noErr) {
jack_error("Cannot open default input device");
return -1;
}
}
if (GetDeviceIDFromUID(playback_driver_uid, &playbackID) != noErr) {
jack_log("Will take default output");
if (GetDefaultOutputDevice(&playbackID) != noErr) {
jack_error("Cannot open default output device");
return -1;
}
}
if (CreateAggregateDevice(captureID, playbackID, samplerate, &fDeviceID) != noErr)
return -1;
}
}
......
......@@ -922,7 +922,7 @@ int JackCoreAudioDriver::SetupDevices(const char* capture_driver_uid,
if (GetDeviceIDFromUID(capture_driver_uid, &captureID) != noErr) {
jack_log("Will take default input");
if (GetDefaultInputDevice(&captureID) != noErr) {
jack_error("Cannot open default device");
jack_error("Cannot open default input device");
return -1;
}
}
......@@ -930,7 +930,7 @@ int JackCoreAudioDriver::SetupDevices(const char* capture_driver_uid,
if (GetDeviceIDFromUID(playback_driver_uid, &playbackID) != noErr) {
jack_log("Will take default output");
if (GetDefaultOutputDevice(&playbackID) != noErr) {
jack_error("Cannot open default device");
jack_error("Cannot open default output device");
return -1;
}
}
......@@ -945,7 +945,7 @@ int JackCoreAudioDriver::SetupDevices(const char* capture_driver_uid,
if (GetDeviceIDFromUID(capture_driver_uid, &fDeviceID) != noErr) {
jack_log("Will take default input");
if (GetDefaultInputDevice(&fDeviceID) != noErr) {
jack_error("Cannot open default device");
jack_error("Cannot open default input device");
return -1;
}
}
......@@ -960,7 +960,7 @@ int JackCoreAudioDriver::SetupDevices(const char* capture_driver_uid,
if (GetDeviceIDFromUID(playback_driver_uid, &fDeviceID) != noErr) {
jack_log("Will take default output");
if (GetDefaultOutputDevice(&fDeviceID) != noErr) {
jack_error("Cannot open default device");
jack_error("Cannot open default output device");
return -1;
}
}
......@@ -973,12 +973,29 @@ int JackCoreAudioDriver::SetupDevices(const char* capture_driver_uid,
} else {
jack_log("JackCoreAudioDriver::Open default driver");
if (GetDefaultDevice(&fDeviceID) != noErr) {
jack_error("Cannot open default device");
return -1;
}
if (GetDeviceNameFromID(fDeviceID, capture_driver_name) != noErr || GetDeviceNameFromID(fDeviceID, playback_driver_name) != noErr) {
jack_error("Cannot get device name from device ID");
return -1;
jack_error("Cannot open default device in duplex mode, so aggregate default input and default output");
// Creates aggregate device
AudioDeviceID captureID, playbackID;
if (GetDeviceIDFromUID(capture_driver_uid, &captureID) != noErr) {
jack_log("Will take default input");
if (GetDefaultInputDevice(&captureID) != noErr) {
jack_error("Cannot open default input device");
return -1;
}
}
if (GetDeviceIDFromUID(playback_driver_uid, &playbackID) != noErr) {
jack_log("Will take default output");
if (GetDefaultOutputDevice(&playbackID) != noErr) {
jack_error("Cannot open default output device");
return -1;
}
}
if (CreateAggregateDevice(captureID, playbackID, samplerate, &fDeviceID) != noErr)
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