I have problems choosing a specific audio device/API. When I call
PsychPortAudio('Open',...) with a specific device ID, the next
'GetStatus' aborts
the script with "Caught MathWorks::System::FatalException".
I observe this on several Windows machines (WinXP/32bit, Win7/64bit with PTB-32bit or 64bit, with older or latest version of PTB).
In the following boiled-down demo script I first retrieve the ID of PsychPortAudio's default device and then re-'Open' this device by explicitly specifying the device ID explicitly. According to the messages in the command window, everything looks fine and exactly the same, whether I let PsychPortAudio choose the device or specify it explicitly. Yet, in the latter case the next 'GetStatus' call fails. The weird thing is that I can play sound using this handle, so apparently it is just the 'GetStatus' call which fails - consistently so for different setups. Any idea what's going on here?
I'm aware that I don't have an ASIO audio card plugged in. So please, don't suggest that I should just get an ASIO card and everything will be fine. 'GetStatus' should work for all devices/API's offered by PsychPortAudio.
------------------------------------------------------------------------
function PortAudioDemo
commandwindow();
InitializePsychSound();
ahandle = PsychPortAudio('Open');
status = PsychPortAudio('GetStatus', ahandle);
fprintf('#### Retrieved the default device idx (ahandle=%d): %d\n',ahandle,status.OutDeviceIndex);
PsychPortAudio('Close',ahandle);
ahandle = PsychPortAudio('Open',status.OutDeviceIndex);
fprintf('#### Arriving at the critical call (ahandle=%d) ...\n',ahandle);
status = PsychPortAudio('GetStatus', ahandle);
fprintf('#### Passed the critical call!\n');
PsychPortAudio('Close',ahandle);
end
------------------------------------------------------------------------
According output:
PTB-INFO: Using specially modified PortAudio engine, based on offical version: PortAudio V19-devel WITH-DIM
Will use ASIO enhanced Portaudio driver DLL. See Psychtoolbox/PsychSound/PortAudioLICENSE.txt
for the exact terms of use for this dll.
Disclaimer: "ASIO is a trademark and software of Steinberg Media Technologies GmbH."
PTB-Warning: Although using the ASIO enabled Psychtoolbox sound driver,
PTB-Warning: could not find any ASIO capable soundcard in your system.
PTB-Warning: If you think you should have an ASIO card, please check your
PTB-Warning: system for properly installed and configured drivers and retry.
PTB-Warning: Read "help InitializePsychSound" for more info about ASIO et al.
PTB-INFO: New audio device with handle 0 opened as PortAudio stream:
PTB-INFO: For 2 channels Playback: Audio subsystem is Windows DirectSound, Audio device name is Primary Sound Driver
PTB-INFO: Real samplerate 44100.000000 Hz. Input latency 0.000000 msecs, Output latency 39.977324 msecs.
#### Retrieved the default device idx (ahandle=0): 6
PTB-INFO: Using specially modified PortAudio engine, based on offical version: PortAudio V19-devel WITH-DIM
PTB-INFO: New audio device with handle 0 opened as PortAudio stream:
PTB-INFO: For 2 channels Playback: Audio subsystem is Windows DirectSound, Audio device name is Primary Sound Driver
PTB-INFO: Real samplerate 44100.000000 Hz. Input latency 0.000000 msecs, Output latency 39.977324 msecs.
#### Arriving at the critical call (ahandle=0) ...
Caught MathWorks::System::FatalException
I observe this on several Windows machines (WinXP/32bit, Win7/64bit with PTB-32bit or 64bit, with older or latest version of PTB).
In the following boiled-down demo script I first retrieve the ID of PsychPortAudio's default device and then re-'Open' this device by explicitly specifying the device ID explicitly. According to the messages in the command window, everything looks fine and exactly the same, whether I let PsychPortAudio choose the device or specify it explicitly. Yet, in the latter case the next 'GetStatus' call fails. The weird thing is that I can play sound using this handle, so apparently it is just the 'GetStatus' call which fails - consistently so for different setups. Any idea what's going on here?
I'm aware that I don't have an ASIO audio card plugged in. So please, don't suggest that I should just get an ASIO card and everything will be fine. 'GetStatus' should work for all devices/API's offered by PsychPortAudio.
------------------------------------------------------------------------
function PortAudioDemo
commandwindow();
InitializePsychSound();
ahandle = PsychPortAudio('Open');
status = PsychPortAudio('GetStatus', ahandle);
fprintf('#### Retrieved the default device idx (ahandle=%d): %d\n',ahandle,status.OutDeviceIndex);
PsychPortAudio('Close',ahandle);
ahandle = PsychPortAudio('Open',status.OutDeviceIndex);
fprintf('#### Arriving at the critical call (ahandle=%d) ...\n',ahandle);
status = PsychPortAudio('GetStatus', ahandle);
fprintf('#### Passed the critical call!\n');
PsychPortAudio('Close',ahandle);
end
------------------------------------------------------------------------
According output:
PTB-INFO: Using specially modified PortAudio engine, based on offical version: PortAudio V19-devel WITH-DIM
Will use ASIO enhanced Portaudio driver DLL. See Psychtoolbox/PsychSound/PortAudioLICENSE.txt
for the exact terms of use for this dll.
Disclaimer: "ASIO is a trademark and software of Steinberg Media Technologies GmbH."
PTB-Warning: Although using the ASIO enabled Psychtoolbox sound driver,
PTB-Warning: could not find any ASIO capable soundcard in your system.
PTB-Warning: If you think you should have an ASIO card, please check your
PTB-Warning: system for properly installed and configured drivers and retry.
PTB-Warning: Read "help InitializePsychSound" for more info about ASIO et al.
PTB-INFO: New audio device with handle 0 opened as PortAudio stream:
PTB-INFO: For 2 channels Playback: Audio subsystem is Windows DirectSound, Audio device name is Primary Sound Driver
PTB-INFO: Real samplerate 44100.000000 Hz. Input latency 0.000000 msecs, Output latency 39.977324 msecs.
#### Retrieved the default device idx (ahandle=0): 6
PTB-INFO: Using specially modified PortAudio engine, based on offical version: PortAudio V19-devel WITH-DIM
PTB-INFO: New audio device with handle 0 opened as PortAudio stream:
PTB-INFO: For 2 channels Playback: Audio subsystem is Windows DirectSound, Audio device name is Primary Sound Driver
PTB-INFO: Real samplerate 44100.000000 Hz. Input latency 0.000000 msecs, Output latency 39.977324 msecs.
#### Arriving at the critical call (ahandle=0) ...
Caught MathWorks::System::FatalException
>>