Hello,
I'm using Asio SoundCard with Motu driver and have 3 Speaker. I want to specify at a given time whether the sound will be played on Speaker 1 / 2 / 3 .
How could I specify which Speaker should be used (numbers ? physical adress? )
I'm using the function below , I've an output I think from the first Speaker even of the three speaker are plugged :
function BasicMultiSoundOutputDemo(repetitions, wavfilename)
AssertOpenGL;
repetitions=2
wavfilename='1.wav'
% Read WAV file from filesystem:
[y, freq ] = wavread(wavfilename);
wavedata = y';
nrchannels = size(wavedata,1); % Number of rows == number of channels.
% Open sound card
InitializePsychSound();
devices = PsychPortAudio('GetDevices');
nDevices = numel(devices);
% Found MOTU ASIO
MOTUASIOIndice = [];
for deviceIndex = 1:nDevices
%fprintf(1, 'Examining device %s\n', outputDevices(deviceIndex).DeviceName);
if strcmp(devices(deviceIndex).DeviceName, 'MOTU Audio ASIO')
fprintf('Found MOTU ASIO device\n');
MOTUASIOIndice = deviceIndex;
disp(devices(MOTUASIOIndice));
break;
end
end
if isempty(MOTUASIOIndice)
ME = MException('Experience_Contol:MOTUSoundCardNotFound', 'Can''t find MOTU sound card\n Check that it is plugged and that ASIO drivers are installed');
throw(ME);
end;
MOTUASIODevice = devices(MOTUASIOIndice);
disp(MOTUASIODevice.DeviceIndex)
pahandle2 = PsychPortAudio('Open', 1, [], 1, freq, nrchannels);
% Fill the audio playback buffer with the audio data 'wavedata':
PsychPortAudio('FillBuffer', pahandle2, wavedata);
t1 = PsychPortAudio('Start', pahandle2, repetitions, 0, 1);
% Wait for release of all keys on keyboard:
KbReleaseWait;
fprintf('Audio playback started, press any key for about 1 second to quit.\n');
fprintf('Will play a beep tone of 0.1 secs duration every second.\n');
tlast = t1 + 4;
% Stay in a little loop until keypress:
while ~KbCheck
when = tlast + 1;
tlast = PsychPortAudio('Start', pahandle2, 1, when, 1);
fprintf('Delta between onset of this beep and onset of sound track is %f secs.\n', tlast - t1);
s = PsychPortAudio('GetStatus', pahandle2);
PsychPortAudio('Stop', pahandle2, 1);
PsychPortAudio('FillBuffer', pahandle2, wavedata);
end
% Stop playback of background sound track:
PsychPortAudio('Stop', pahandle2);
% Close the audio devices:
PsychPortAudio('Close', pahandle2);
%PsychPortAudio('Close', pahandle2);
% Done.
fprintf('Demo finished, bye!\n');
Thanks for help
Lenar