return false;
}
- if ( !arg || !strcmp( arg, "" ) )
- {
#ifndef __LINUX_ALSA__
- device_id = rt.getDefaultOutputDevice();
+ device_id = rt.getDefaultOutputDevice();
#endif
- }
- else if ( strcmp( arg, "default" ) )
+ if ( arg && strcmp( arg, "" ) && strcmp( arg, "default" ) )
{
// Get device ID by name
unsigned int n = rt.getDeviceCount();
break;
}
}
- // Name selection failed, treat arg as numeric
+ // Name selection failed, try arg as numeric
if ( i == n )
device_id = (int) strtol( arg, NULL, 0 );
}
// Default audio buffer
mlt_properties_set_int( properties, "audio_buffer", 1024 );
+ // Set the resource to the device name arg
+ mlt_properties_set( properties, "resource", arg );
+
// Ensure we don't join on a non-running object
joined = 1;
parameters.nChannels = channels;
parameters.firstChannel = 0;
RtAudio::StreamOptions options;
-#ifdef __LINUX_ALSA__
+ unsigned int bufferFrames = mlt_properties_get_int( properties, "audio_buffer" );
+
if ( device_id == -1 )
{
options.flags = RTAUDIO_ALSA_USE_DEFAULT;
parameters.deviceId = 0;
}
-#endif
- unsigned int bufferFrames = mlt_properties_get_int( properties, "audio_buffer" );
+ if ( mlt_properties_get( properties, "resource" ) )
+ parameters.deviceName = mlt_properties_get( properties, "resource" );
try {
rt.openStream( ¶meters, NULL, RTAUDIO_SINT16,
if ( rtaudio && !mlt_consumer_init( rtaudio->getConsumer(), rtaudio, profile ) )
{
// If initialises without error
- if ( rtaudio->open( arg ) )
+ if ( rtaudio->open( arg? arg : getenv( "AUDIODEV" ) ) )
{
// Setup callbacks
consumer = rtaudio->getConsumer();