Skip to content

Commit

Permalink
Issue #305 - better handling of empty audio devices
Browse files Browse the repository at this point in the history
  • Loading branch information
k1o0 committed Sep 8, 2020
1 parent ba26da5 commit 51c13f8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
19 changes: 15 additions & 4 deletions +eui/SignalsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,21 @@

InitializePsychSound
d = PsychPortAudio('GetDevices');
d = d([d.NrOutputChannels] == 2);
[~,I] = min([d.LowOutputLatency]);
obj.Hardware.audioDevices = d(I);
obj.Hardware.audioDevices.DeviceName = 'default';

% Keep output devices
d = d([d.NrOutputChannels] > 0);
obj.Hardware.audioDevices = d([d.NrOutputChannels] > 0);

% Select the lowest latency stereo output as the default
stereo = [d.NrOutputChannels] == 2;
[~,I] = min([d(stereo).LowOutputLatency]);
I = I + sum(~stereo(1:I));
if isempty(I)
warning('Rigbox:eui:SignalsTest:NoStereoOutput', ...
'No stereo output audio devices detected; default unassigned')
else
obj.Hardware.audioDevices(I).DeviceName = 'default';
end
else
obj.Hardware = rig;
end
Expand Down
2 changes: 1 addition & 1 deletion alyx-matlab
2 changes: 2 additions & 0 deletions docs/scripts/release_notes_v260.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
% * |git.listVersions| - Lists the previous versions of Rigbox availiable
% * |git.switchVersion| - Allows you to switched between Rigbox versions
% * |git.repoVersion| - Returns release tag of repository, if available
% * |eui.SignalsTest| - Warning instead of error when no stereo output
% device found
%
% *Tests*
%
Expand Down

0 comments on commit 51c13f8

Please sign in to comment.