private bool InitAsio()
{
bool result = false;
Log.Info("BASS: Using ASIO device: {0}", Config.SoundDevice);
BASS_ASIO_DEVICEINFO[] asioDevices = BassAsio.BASS_ASIO_GetDeviceInfos();
// Check if the ASIO device read is amongst the one retrieved
for (int i = 0; i < asioDevices.Length; i++)
{
if (asioDevices[i].name == Config.SoundDevice && asioDevices[i].driver == Config.SoundDeviceID)
{
_deviceNumber = i;
break;
}
}
if (_deviceNumber > -1)
{
result = BassAsio.BASS_ASIO_Init(_deviceNumber, BASSASIOInit.BASS_ASIO_THREAD);
if (!result)
{
HandleBassError("InitAsio");
}
else
{
// Get some information about the Device
BASS_ASIO_INFO info = BassAsio.BASS_ASIO_GetInfo();
if (info != null)
{
_deviceOutputChannels = info.outputs;
Log.Info("BASS: Device Information");
Log.Info("BASS: ---------------------------------------------");
Log.Info("BASS: Name: {0} {1}", info.name, info.version);
Log.Info("BASS: # Input Channels: {0}", info.inputs);
Log.Info("BASS: # Output Channels: {0}", info.outputs);
Log.Debug("BASS: Minimum Buffer Samples: {0}", info.bufmin);
Log.Debug("BASS: Maximum Buffer Samples: {0}", info.bufmax);
Log.Debug("BASS: Default Buffer Length: {0}", info.bufpref);
Log.Info("BASS: ---------------------------------------------");
Log.Info("BASS: Channel Information");
Log.Info("BASS: ---------------------------------------------");
for (int i = 0; i < info.outputs; i++)
{
BASS_ASIO_CHANNELINFO chanInfo = BassAsio.BASS_ASIO_ChannelGetInfo(false, i);
if (chanInfo != null)
{
Log.Info("BASS: {0}", chanInfo.ToString());
}
}
Log.Info("BASS: ---------------------------------------------");
}
else
{
Log.Error("BASS: Error getting Device Info: {0}", BassAsio.BASS_ASIO_ErrorGetCode());
}
}
// When used in config the ASIO_INIT fails. Ignore it here, to be able using the visualisations
if (Application.ExecutablePath.Contains("Configuration"))
{
result = true;
}
}
else
{
Log.Error("BASS: Specified ASIO device not found. BASS is disabled.");
}
return result;
}