Skip to content

Commit cabe27e

Browse files
committed
Issue #305 - better handling of empty audio devices
1 parent 98887dd commit cabe27e

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

+eui/SignalsTest.m

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,21 @@
196196

197197
InitializePsychSound
198198
d = PsychPortAudio('GetDevices');
199-
d = d([d.NrOutputChannels] == 2);
200-
[~,I] = min([d.LowOutputLatency]);
201-
obj.Hardware.audioDevices = d(I);
202-
obj.Hardware.audioDevices.DeviceName = 'default';
199+
200+
% Keep output devices
201+
d = d([d.NrOutputChannels] > 0);
202+
obj.Hardware.audioDevices = d([d.NrOutputChannels] > 0);
203+
204+
% Select the lowest latency stereo output as the default
205+
stereo = [d.NrOutputChannels] == 2;
206+
[~,I] = min([d(stereo).LowOutputLatency]);
207+
I = I + sum(~stereo(1:I));
208+
if isempty(I)
209+
warning('Rigbox:eui:SignalsTest:NoStereoOutput', ...
210+
'No stereo output audio devices detected; default unassigned')
211+
else
212+
obj.Hardware.audioDevices(I).DeviceName = 'default';
213+
end
203214
else
204215
obj.Hardware = rig;
205216
end

docs/scripts/release_notes_v260.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
% * |git.listVersions| - Lists the previous versions of Rigbox availiable
7979
% * |git.switchVersion| - Allows you to switched between Rigbox versions
8080
% * |git.repoVersion| - Returns release tag of repository, if available
81+
% * |eui.SignalsTest| - Warning instead of error when no stereo output
82+
% device found
8183
%
8284
% *Tests*
8385
%

0 commit comments

Comments
 (0)