From cabe27e5c8b8cb7cdc4e152f1cf013a89adc7a71 Mon Sep 17 00:00:00 2001 From: k1o0 Date: Wed, 9 Sep 2020 00:38:21 +0300 Subject: [PATCH] Issue #305 - better handling of empty audio devices --- +eui/SignalsTest.m | 19 +++++++++++++++---- alyx-matlab | 2 +- docs/scripts/release_notes_v260.m | 2 ++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/+eui/SignalsTest.m b/+eui/SignalsTest.m index 0567ace5..65f7b772 100644 --- a/+eui/SignalsTest.m +++ b/+eui/SignalsTest.m @@ -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 diff --git a/alyx-matlab b/alyx-matlab index 3df7cef8..d81f0cba 160000 --- a/alyx-matlab +++ b/alyx-matlab @@ -1 +1 @@ -Subproject commit 3df7cef88dee66c738d81c8aea6783f08884c85e +Subproject commit d81f0cba0d2ed525798d966aa1c6c0c8723bb509 diff --git a/docs/scripts/release_notes_v260.m b/docs/scripts/release_notes_v260.m index 9fb9edf8..0923ab5c 100644 --- a/docs/scripts/release_notes_v260.m +++ b/docs/scripts/release_notes_v260.m @@ -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* %