cpp-lln-lab / CPP_PTB

a set of function to make it easier to create behavioral, EEG, fMRI experiment with psychtoolbox
https://cpp-ptb.readthedocs.io/en/latest/index.html#
MIT License
14 stars 13 forks source link

refactor initPTB #30

Closed Remi-Gau closed 4 years ago

Remi-Gau commented 4 years ago

This is a big refactoring of the initPTB function into many subfunctions.

Also allowing to set some defaults if they are not passed by the user.

Remi-Gau commented 4 years ago

As far as I can tell this should not break anything. But as I keep saying that I think we should have a basic set of "demo" to use as "tests" to make sure nothing breaks.

Remi-Gau commented 4 years ago

@CerenB

This should be how you would initialize for the audio set up.

Does this make sense?

I urgently need to create ways to test this.

Audio init

% in your main script
cfg.initAudio = true;
cfg.audio.useDevice = true; % set to false when you don't want to use it (on mac or linux)
cfg.audio.inputChannels = 0;
cfg.audio.channels = 2;
cfg.audio.deviceName = 'WASAPI';

cfg = initPTB(cfg);

% this should return these fields
cfg.audio.fs
cfg.audio.channels
cfg.audio.initVolume
cfg.audio.requestedLatency
cfg.audio.repeat
cfg.audio.startCue
cfg.audio.waitForDevice
cfg.audio.devIdx
cfg.audio.playbackMode
cfg.audio.pushSize
cfg.audio.requestOffsetTime
cfg.audio.reqsSampleOffset
Remi-Gau commented 4 years ago

@CerenB some of the names of the fields had to be changed to stick to the camelCase rule

CerenB commented 4 years ago

I'll test after the most sunny & hot day is over in Brussels! Thank you for implementing all these in such a short time <3