Skip to content

Commit 30dd54a

Browse files
committed
change if block to use specific device
1 parent 48b563f commit 30dd54a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

initPTB.m

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,16 @@ function initDebug(cfg)
170170
cfg.audio.devIdx= [];
171171
cfg.audio.playbackMode = 1;
172172

173-
if IsWin
173+
if isfield(cfg.audio, 'useDevice')
174174

175175
% get audio device list
176176
audioDev = PsychPortAudio('GetDevices');
177177

178-
% find output device using WASAPI driver
178+
% find output device to use
179179
idx = find(...
180-
audioDev.NrInputChannels == 0 && ...
181-
audioDev.NrOutputChannels == 2 && ...
182-
~cellfun(@isempty, regexp({audioDev.HostAudioAPIName}, 'WASAPI')));
180+
audioDev.NrInputChannels == cfg.audio.inputChannels && ...
181+
audioDev.NrOutputChannels == cfg.audio.channels && ...
182+
~cellfun(@isempty, regexp({audioDev.HostAudioAPIName}, cfg.audio.deviceName)));
183183

184184
% save device ID
185185
cfg.audio.devIdx = audioDev(idx).DeviceIndex;
@@ -216,8 +216,6 @@ function initDebug(cfg)
216216
[cfg.win, cfg.winRect] = Screen('OpenWindow', cfg.screen, cfg.backgroundColor);
217217
end
218218

219-
%TODO make this optional
220-
221219
% Enable alpha-blending, set it to a blend equation useable for linear
222220
% superposition with alpha-weighted source.
223221
Screen('BlendFunction', cfg.win, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

0 commit comments

Comments
 (0)