Skip to content
Snippets Groups Projects
Commit 140730d9 authored by Vincent Lucas's avatar Vincent Lucas
Browse files

Corrects PortAudio not running on Linux: checks if CoreAudio is supported for the current system.

parent 83c2a25a
No related branches found
No related tags found
No related merge requests found
......@@ -15,20 +15,32 @@
*/
public class CoreAudioDevice
{
/**
* Loads CoreAudioDevice if we are using MacOsX or Windows Vista/7/8.
*/
static
{
isLoaded = false;
if(OSUtils.IS_MAC)
{
System.loadLibrary("jnmaccoreaudio");
isLoaded = true;
}
else if(OSUtils.IS_WINDOWS_VISTA
|| OSUtils.IS_WINDOWS_7
|| OSUtils.IS_WINDOWS_8)
{
System.loadLibrary("jnwincoreaudio");
isLoaded = true;
}
}
/**
* Tells if the CoreAudio library used by this CoreAudioDevice is correctly
* loaded: if we are under a supported operating system.
*/
public static boolean isLoaded;
public static native int initDevices();
public static native void freeDevices();
......
......@@ -264,7 +264,8 @@ protected void doInitialize()
= new LinkedList<ExtendedCaptureDeviceInfo>();
final boolean loggerIsDebugEnabled = logger.isDebugEnabled();
CoreAudioDevice.initDevices();
if(CoreAudioDevice.isLoaded)
CoreAudioDevice.initDevices();
for (int deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++)
{
long deviceInfo = Pa.GetDeviceInfo(deviceIndex);
......@@ -281,8 +282,10 @@ protected void doInitialize()
= Pa.DeviceInfo_getTransportType(deviceInfo);
String deviceUID
= Pa.DeviceInfo_getDeviceUID(deviceInfo);
String modelIdentifier
= CoreAudioDevice.getDeviceModelIdentifier(deviceUID);
String modelIdentifier = null;
if(CoreAudioDevice.isLoaded)
modelIdentifier
= CoreAudioDevice.getDeviceModelIdentifier(deviceUID);
/*
* TODO The intention of reinitialize() was to perform the
......@@ -398,7 +401,8 @@ else if (maxOutputChannels > 0)
}
}
}
CoreAudioDevice.freeDevices();
if(CoreAudioDevice.isLoaded)
CoreAudioDevice.freeDevices();
/*
* Make sure that devices which support both capture and playback are
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment