cnaq_path = root_dir;\r
config_path = [cnaq_path filesep 'config' filesep];\r
tools_path = [cnaq_path filesep 'tools' filesep];\r
-pa_path = [cnaq_path filesep 'pa_wavplay' filesep];\r
+pa_path = [cnaq_path filesep 'lib' filesep 'pa_wavplay' filesep];\r
path(path, cnaq_path);\r
path(path, tools_path);\r
path(path, pa_path);\r
[device, latency] = asio();\r
\r
% Get home directory\r
-home_dir = uigetdir(root_dir, 'Choose your home directory');\r
+home_dir = uigetdir(root_dir, 'Choose your workspace');\r
\r
% Get/Set ID\r
id = get_id(handles);\r
set(handles.ID,'String',id);\r
set(handles.home_dir_box,'String',home_dir);\r
-set(handles.info1_text,'String',['CNAQ v' cnaq_version ' - Copyright (C) 2007']);\r
+set(handles.info1_text,'String',['CNAQ v' cnaq_version ' - Copyright (C) 2007-2008']);\r
set(handles.info2_text,'String','Guillaume Pellerin, Manuel Melon (CNAM Paris) http://svn.parisson.org/cnaq/');\r
\r
% Set default values\r
%set(handles.out_on_off,'Value',0);\r
set(handles.in_on_off,'Value',0);\r
set(handles.gen_on_off,'Value',0);\r
-set(handles.sig_type,'String','Sinus|Chirp');\r
+set(handles.sig_type,'String','Sinus|Chirp|White noise|Pink noise');\r
set(handles.voices_in,'String','1|1 2|1 2 3|1 2 3 4');\r
set(handles.voices_out,'String','1|1 2|1 2 3|1 2 3 4');\r
\r
fs_ind = 1;\r
elseif f_s == 48000\r
fs_ind = 2;\r
- elseif f_s == 96000\r
+ elseif f_s == 88200\r
fs_ind = 3;\r
+ elseif f_s == 96000\r
+ fs_ind = 4;\r
+ elseif f_s == 192000\r
+ fs_ind = 5;\r
end\r
set(handles.f_s,'Value',fs_ind);\r
\r
gain_out = get(handles.gain_out,'Value');\r
gain_out = 10^(gain_out/20);\r
t = [0:1/f_s:time];\r
+ n_t = length(t);\r
\r
if sig_type == 1\r
% SINUS\r
elseif sig_type == 2\r
% CHIRP\r
sig = gain_out*chirp(t,f_min,time,f_max,'logarithmic');\r
+ elseif sig_type == 3\r
+ % WHITE NOISE\r
+ sig = gain_out*white_noise(n_t);\r
+ elseif sig_type == 4\r
+ % PINK NOISE\r
+ sig = gain_out*pink_noise(n_t);\r
end\r
\r
sig_out = [];\r
\r
% Increment ID\r
increment_id(handles);\r
- \r
+\r
+\r
% --- Executes on button press in load.\r
function load_Callback(hObject, eventdata, handless)\r
% hObject handle to load (see GCBO)\r
--- /dev/null
+
+To play audio:
+pa_wavplay(buffer, [samplerate], [deviceid], [devicetype]);
+
+To record audio:
+inputbuffer = pa_wavrecord(channels, nsamples, [samplerate], [deviceid], [devicetype]);
+
+To play and record audio simultaneously:
+inputbuffer = pa_wavplayrecord(playbuffer,[playdevice],[samplerate], [recnsamples], [recchannels], [recdevice],[devicetype])
+
+see help for each of these commands for much more information.
\ No newline at end of file
--- /dev/null
+function pa_wavplay(varargin)\r
+% pa_wavplay: playback a matrix to multichannel sound hardware\r
+%\r
+% Usage: pa_wavplay([devicetype])\r
+% pa_wavplay(buffer, [samplerate], [deviceid], [devicetype])\r
+% \r
+% pa_wavplay is a tool for playing multi-channel audio through your ASIO\r
+% device. Arguments in [] are optional\r
+%\r
+% pa_wavplay([devicetype]) will list all your audio devices for that\r
+% device type then exit.\r
+%\r
+% - buffer is the matrix to play\r
+% - samplerate is the sampling frequency. Default: 44100\r
+% - deviceid is the device id to use for output. Default: 0\r
+% - devicetype determines which sound driver to use\r
+% 'win' Windows Multimedia Device\r
+% 'dx' DirectX DirectSound driver\r
+% 'asio' ASIO Driver (default)\r
+% \r
+% For stereo playback, buffer should be an N-by-2 matrix. The number of\r
+% audio channels supported is hardware dependent.\r
+% \r
+% samplerate should be a valid integer sample rate, eg. 22050 44100 etc.\r
+% \r
+% As of pa_wavplay 0.2, buffer should be either of type double or\r
+% single. pa_wavplay uses 32-bit floats (single) internally.\r
+%\r
+% SEE ALSO: pa_wavrecord, pa_wavplayrecord\r
+\r
+% check right num of args\r
+error(nargchk(0,4,nargin));\r
+\r
+% defaults\r
+device_opt = 1;\r
+device = 0;\r
+fs = 44100;\r
+\r
+% no args, print devices for asio\r
+if (nargin==0)\r
+ pawavplaya;\r
+ return;\r
+end\r
+\r
+% if devtype specified\r
+if ischar(varargin{end}),\r
+ s=varargin{end};\r
+ varargin(end)=[];\r
+ \r
+ device_opt = strmatch(s,{'asio','win', 'dx'});\r
+ if isempty(device_opt),\r
+ error(['Unrecognized DEVICETYPE: ' s]);\r
+ end\r
+\r
+ if (nargin==1)\r
+ if device_opt==1, % asio\r
+ pawavplaya;\r
+ end\r
+ if device_opt==2, % win\r
+ pawavplayw;\r
+ end \r
+ if device_opt==3, % dx\r
+ pawavplayx;\r
+ end\r
+ return;\r
+ end\r
+end\r
+\r
+% data buffer\r
+y = varargin{1};\r
+\r
+% sample rate\r
+if length(varargin)>=2,\r
+ fs=varargin{2};\r
+end\r
+\r
+% device id\r
+if length(varargin) >= 3,\r
+ if (~(ischar(varargin{3})))\r
+ device = varargin{3};\r
+ end\r
+end\r
+\r
+if device_opt==1, % asio\r
+ %fprintf('Using ASIO driver\n');\r
+ pawavplaya(y, device, fs, 0, 0, 0, -1);\r
+\r
+elseif device_opt==2, % win\r
+ fprintf('Using WMME driver\n');\r
+ pawavplayw(y, device, fs, 0, 0, 0, -1);\r
+ \r
+elseif device_opt==3, % dx\r
+ fprintf('Using DirectX driver\n');\r
+ pawavplayx(y, device, fs, 0, 0, 0, -1);\r
+end\r
+\r
+% [EOF] pa_wavplay.m
\ No newline at end of file
--- /dev/null
+function y = pa_wavplayrecord(varargin)\r
+% pa_wavplayrecord: simultaneous playback & record of multichannel sound\r
+%\r
+% Usage:\r
+% inputbuffer = pa_wavplayrecord(playbuffer,[playdevice],[samplerate],\r
+% [recnsamples], [recfirstchannel], [reclastchannel],\r
+% [recdevice], [devicetype])\r
+% \r
+% pa_wavplayrecord is a tool for playing and recording multi-channel\r
+% audio through your ASIO device. Arguments in [] are optional\r
+%\r
+% pa_wavplayrecord([devicetype]) will list all your audio devices for \r
+% that device type then exit.\r
+%\r
+% - playbuffer the matrix to play\r
+% - playdevice the device to play it on. Default: 0\r
+% - samplerate the sampling frequency. Default: 44100\r
+% - recnsamples the number of samples to record. Default: 0\r
+% if 0 then we'll record for the duration of playbuffer\r
+% - recfirstchannel the first channel to record from Default: 1\r
+% - reclastchannel the last channel to record from Default: 1\r
+% - recdevice the device to record from. Default: 0\r
+% - devicetype determines which sound driver to use\r
+% 'win' Windows Multimedia Device\r
+% 'dx' DirectX DirectSound driver\r
+% 'asio' ASIO Driver (default)\r
+% \r
+% See the help for pa_wavplay for a list of some of these arguments,\r
+% and the formatting of them.\r
+%\r
+% SEE ALSO: pa_wavrecord, pa_wavplayrecord\r
+\r
+% check right num of args\r
+error(nargchk(1,8,nargin));\r
+\r
+% defaults\r
+device_opt = 1;\r
+playdevice = 0;\r
+fs = 44100;\r
+recnsamples = 0;\r
+recfirstchannel = 1;\r
+reclastchannel = 1;\r
+recdevice = 0;\r
+\r
+% if devtype specified\r
+if ischar(varargin{end}),\r
+ s=varargin{end};\r
+ varargin(end)=[];\r
+ \r
+ device_opt = strmatch(s,{'asio','win', 'dx'});\r
+ if isempty(device_opt),\r
+ error(['Unrecognized DEVICETYPE: ' s]);\r
+ end\r
+\r
+ if (nargin==1)\r
+ if device_opt==1, % asio\r
+ pawavplaya;\r
+ end\r
+ if device_opt==2, % win\r
+ pawavplayw;\r
+ end \r
+ if device_opt==3, % dx\r
+ pawavplayx;\r
+ end\r
+ return;\r
+ end\r
+end\r
+\r
+% data buffer\r
+playbuffer = varargin{1};\r
+\r
+% play device\r
+if length(varargin)>=2,\r
+ playdevice=varargin{2};\r
+end\r
+\r
+% sample rate\r
+if length(varargin)>=3,\r
+ fs=varargin{3};\r
+end\r
+\r
+% recnsamples\r
+if length(varargin)>=4,\r
+ recnsamples=varargin{4};\r
+end\r
+\r
+% recfirstchannel\r
+if length(varargin)>=5,\r
+ recfirstchannel=varargin{5};\r
+end\r
+\r
+% reclastchannel\r
+if length(varargin)>=6,\r
+ reclastchannel=varargin{6};\r
+end\r
+\r
+% recdevice\r
+if length(varargin)>=7,\r
+ recdevice=varargin{7};\r
+end\r
+\r
+if device_opt==1, % asio\r
+ %fprintf('Using ASIO driver\n');\r
+ y = pawavplaya(playbuffer, playdevice, fs, recfirstchannel, reclastchannel, recnsamples, recdevice);\r
+elseif device_opt==2, % win\r
+ fprintf('Using WMME driver\n');\r
+ y = pawavplayw(playbuffer, playdevice, fs, recfirstchannel, reclastchannel, recnsamples, recdevice);\r
+elseif device_opt==3, % dx\r
+ fprintf('Using DirectX driver\n');\r
+ y = pawavplayx(playbuffer, playdevice, fs, recfirstchannel, reclastchannel, recnsamples, recdevice);\r
+end\r
+\r
+%fprintf('Converting result to doubles\n');\r
+y = double(y);\r
+\r
+% [EOF] pa_wavplayrecord.m
\ No newline at end of file
--- /dev/null
+function y = pa_wavrecord(varargin)\r
+% pa_wavrecord: record from multichannel sound hardware\r
+%\r
+% Usage: pa_wavrecord([devicetype])\r
+% inputbuffer = pa_wavrecord(firstchannel, lastchannel, nsamples, [samplerate],\r
+% [deviceid], [devicetype])\r
+%\r
+% pa_wavrecord is a tool for recording multi-channel audio through your \r
+% ASIO device. Arguments in [] are optional\r
+%\r
+% - firstchannel the first input channel to record from\r
+% - lastchannel the last input channel to record from\r
+% - nsamples the number of samples to record from each channel\r
+% - samplerate the sampling frequency. Default: 44100\r
+% - deviceid the device id to use for INPUT. Default: 0\r
+% - informat the desired data type of inputbuffer. Valid types\r
+% and the number of bits per sample are as follows:\r
+% - devicetype determines which sound driver to use\r
+% 'win' Windows Multimedia Device\r
+% 'dx' DirectX DirectSound driver\r
+% 'asio' ASIO Driver (default)\r
+% - inputbuffer is a variable that will hold the recorded audio, \r
+% running along rows, with a seperate column for \r
+% each channel\r
+%\r
+% SEE ALSO: pa_wavplay, pa_wavplayrecord\r
+\r
+% check right num of args\r
+error(nargchk(0,6,nargin));\r
+\r
+% defaults\r
+device_opt = 1;\r
+device = 0;\r
+fs = 44100;\r
+%in_opt = 2;\r
+\r
+% no args, print devices for asio\r
+if (nargin==0)\r
+ pawavplaya;\r
+ return;\r
+end\r
+\r
+% if devtype specified\r
+if ischar(varargin{end})\r
+ s=varargin{end};\r
+ varargin(end)=[];\r
+ \r
+ device_opt = strmatch(s,{'asio','win', 'dx'});\r
+ if isempty(device_opt),\r
+ error(['Unrecognized DEVICETYPE: ' s]);\r
+ end\r
+\r
+ if (nargin==1)\r
+ if device_opt==1, % asio\r
+ pawavplaya;\r
+ end\r
+ if device_opt==2, % win\r
+ pawavplayw;\r
+ end \r
+ if device_opt==3, % dx\r
+ pawavplayx;\r
+ end\r
+ return;\r
+ end\r
+end\r
+\r
+%{\r
+% if informat specified\r
+if ischar(varargin{end})\r
+ s=varargin{end};\r
+ varargin(end)=[];\r
+ \r
+ in_opt = strmatch(s,{'int16','double'});\r
+ if isempty(in_opt),\r
+ error(['Unrecognized informat: ' s]);\r
+ end\r
+end\r
+%}\r
+\r
+% channels\r
+firstchannel = varargin{1};\r
+lastchannel = varargin{2};\r
+\r
+% samples\r
+nsamples = varargin{3};\r
+\r
+% sample rate\r
+if length(varargin)>=4,\r
+ fs=varargin{4};\r
+end\r
+\r
+% device id\r
+if length(varargin) >= 5,\r
+ device = varargin{5};\r
+end\r
+\r
+if device_opt==1, % asio\r
+ %fprintf('Using ASIO driver\n');\r
+ y = pawavplaya(0, -1, fs, firstchannel, lastchannel, nsamples, device);\r
+\r
+elseif device_opt==2, % win\r
+ fprintf('Using WMME driver\n');\r
+ y = pawavplayw(0, -1, fs, firstchannel, lastchannel, nsamples, device);\r
+\r
+elseif device_opt==3, % dx\r
+ fprintf('Using DirectX driver\n');\r
+ y = pawavplayx(0, -1, fs, firstchannel, lastchannel, nsamples, device);\r
+end\r
+\r
+%fprintf('Converting result to doubles\n');\r
+y = double(y);\r
+\r
+% [EOF] pa_wavrecord.m
\ No newline at end of file
+++ /dev/null
-
-To play audio:
-pa_wavplay(buffer, [samplerate], [deviceid], [devicetype]);
-
-To record audio:
-inputbuffer = pa_wavrecord(channels, nsamples, [samplerate], [deviceid], [devicetype]);
-
-To play and record audio simultaneously:
-inputbuffer = pa_wavplayrecord(playbuffer,[playdevice],[samplerate], [recnsamples], [recchannels], [recdevice],[devicetype])
-
-see help for each of these commands for much more information.
\ No newline at end of file
+++ /dev/null
-function pa_wavplay(varargin)\r
-% pa_wavplay: playback a matrix to multichannel sound hardware\r
-%\r
-% Usage: pa_wavplay([devicetype])\r
-% pa_wavplay(buffer, [samplerate], [deviceid], [devicetype])\r
-% \r
-% pa_wavplay is a tool for playing multi-channel audio through your ASIO\r
-% device. Arguments in [] are optional\r
-%\r
-% pa_wavplay([devicetype]) will list all your audio devices for that\r
-% device type then exit.\r
-%\r
-% - buffer is the matrix to play\r
-% - samplerate is the sampling frequency. Default: 44100\r
-% - deviceid is the device id to use for output. Default: 0\r
-% - devicetype determines which sound driver to use\r
-% 'win' Windows Multimedia Device\r
-% 'dx' DirectX DirectSound driver\r
-% 'asio' ASIO Driver (default)\r
-% \r
-% For stereo playback, buffer should be an N-by-2 matrix. The number of\r
-% audio channels supported is hardware dependent.\r
-% \r
-% samplerate should be a valid integer sample rate, eg. 22050 44100 etc.\r
-% \r
-% As of pa_wavplay 0.2, buffer should be either of type double or\r
-% single. pa_wavplay uses 32-bit floats (single) internally.\r
-%\r
-% SEE ALSO: pa_wavrecord, pa_wavplayrecord\r
-\r
-% check right num of args\r
-error(nargchk(0,4,nargin));\r
-\r
-% defaults\r
-device_opt = 1;\r
-device = 0;\r
-fs = 44100;\r
-\r
-% no args, print devices for asio\r
-if (nargin==0)\r
- pawavplaya;\r
- return;\r
-end\r
-\r
-% if devtype specified\r
-if ischar(varargin{end}),\r
- s=varargin{end};\r
- varargin(end)=[];\r
- \r
- device_opt = strmatch(s,{'asio','win', 'dx'});\r
- if isempty(device_opt),\r
- error(['Unrecognized DEVICETYPE: ' s]);\r
- end\r
-\r
- if (nargin==1)\r
- if device_opt==1, % asio\r
- pawavplaya;\r
- end\r
- if device_opt==2, % win\r
- pawavplayw;\r
- end \r
- if device_opt==3, % dx\r
- pawavplayx;\r
- end\r
- return;\r
- end\r
-end\r
-\r
-% data buffer\r
-y = varargin{1};\r
-\r
-% sample rate\r
-if length(varargin)>=2,\r
- fs=varargin{2};\r
-end\r
-\r
-% device id\r
-if length(varargin) >= 3,\r
- if (~(ischar(varargin{3})))\r
- device = varargin{3};\r
- end\r
-end\r
-\r
-if device_opt==1, % asio\r
- %fprintf('Using ASIO driver\n');\r
- pawavplaya(y, device, fs, 0, 0, 0, -1);\r
-\r
-elseif device_opt==2, % win\r
- fprintf('Using WMME driver\n');\r
- pawavplayw(y, device, fs, 0, 0, 0, -1);\r
- \r
-elseif device_opt==3, % dx\r
- fprintf('Using DirectX driver\n');\r
- pawavplayx(y, device, fs, 0, 0, 0, -1);\r
-end\r
-\r
-% [EOF] pa_wavplay.m
\ No newline at end of file
+++ /dev/null
-function y = pa_wavplayrecord(varargin)\r
-% pa_wavplayrecord: simultaneous playback & record of multichannel sound\r
-%\r
-% Usage:\r
-% inputbuffer = pa_wavplayrecord(playbuffer,[playdevice],[samplerate],\r
-% [recnsamples], [recfirstchannel], [reclastchannel],\r
-% [recdevice], [devicetype])\r
-% \r
-% pa_wavplayrecord is a tool for playing and recording multi-channel\r
-% audio through your ASIO device. Arguments in [] are optional\r
-%\r
-% pa_wavplayrecord([devicetype]) will list all your audio devices for \r
-% that device type then exit.\r
-%\r
-% - playbuffer the matrix to play\r
-% - playdevice the device to play it on. Default: 0\r
-% - samplerate the sampling frequency. Default: 44100\r
-% - recnsamples the number of samples to record. Default: 0\r
-% if 0 then we'll record for the duration of playbuffer\r
-% - recfirstchannel the first channel to record from Default: 1\r
-% - reclastchannel the last channel to record from Default: 1\r
-% - recdevice the device to record from. Default: 0\r
-% - devicetype determines which sound driver to use\r
-% 'win' Windows Multimedia Device\r
-% 'dx' DirectX DirectSound driver\r
-% 'asio' ASIO Driver (default)\r
-% \r
-% See the help for pa_wavplay for a list of some of these arguments,\r
-% and the formatting of them.\r
-%\r
-% SEE ALSO: pa_wavrecord, pa_wavplayrecord\r
-\r
-% check right num of args\r
-error(nargchk(1,8,nargin));\r
-\r
-% defaults\r
-device_opt = 1;\r
-playdevice = 0;\r
-fs = 44100;\r
-recnsamples = 0;\r
-recfirstchannel = 1;\r
-reclastchannel = 1;\r
-recdevice = 0;\r
-\r
-% if devtype specified\r
-if ischar(varargin{end}),\r
- s=varargin{end};\r
- varargin(end)=[];\r
- \r
- device_opt = strmatch(s,{'asio','win', 'dx'});\r
- if isempty(device_opt),\r
- error(['Unrecognized DEVICETYPE: ' s]);\r
- end\r
-\r
- if (nargin==1)\r
- if device_opt==1, % asio\r
- pawavplaya;\r
- end\r
- if device_opt==2, % win\r
- pawavplayw;\r
- end \r
- if device_opt==3, % dx\r
- pawavplayx;\r
- end\r
- return;\r
- end\r
-end\r
-\r
-% data buffer\r
-playbuffer = varargin{1};\r
-\r
-% play device\r
-if length(varargin)>=2,\r
- playdevice=varargin{2};\r
-end\r
-\r
-% sample rate\r
-if length(varargin)>=3,\r
- fs=varargin{3};\r
-end\r
-\r
-% recnsamples\r
-if length(varargin)>=4,\r
- recnsamples=varargin{4};\r
-end\r
-\r
-% recfirstchannel\r
-if length(varargin)>=5,\r
- recfirstchannel=varargin{5};\r
-end\r
-\r
-% reclastchannel\r
-if length(varargin)>=6,\r
- reclastchannel=varargin{6};\r
-end\r
-\r
-% recdevice\r
-if length(varargin)>=7,\r
- recdevice=varargin{7};\r
-end\r
-\r
-if device_opt==1, % asio\r
- %fprintf('Using ASIO driver\n');\r
- y = pawavplaya(playbuffer, playdevice, fs, recfirstchannel, reclastchannel, recnsamples, recdevice);\r
-elseif device_opt==2, % win\r
- fprintf('Using WMME driver\n');\r
- y = pawavplayw(playbuffer, playdevice, fs, recfirstchannel, reclastchannel, recnsamples, recdevice);\r
-elseif device_opt==3, % dx\r
- fprintf('Using DirectX driver\n');\r
- y = pawavplayx(playbuffer, playdevice, fs, recfirstchannel, reclastchannel, recnsamples, recdevice);\r
-end\r
-\r
-%fprintf('Converting result to doubles\n');\r
-y = double(y);\r
-\r
-% [EOF] pa_wavplayrecord.m
\ No newline at end of file
+++ /dev/null
-function y = pa_wavrecord(varargin)\r
-% pa_wavrecord: record from multichannel sound hardware\r
-%\r
-% Usage: pa_wavrecord([devicetype])\r
-% inputbuffer = pa_wavrecord(firstchannel, lastchannel, nsamples, [samplerate],\r
-% [deviceid], [devicetype])\r
-%\r
-% pa_wavrecord is a tool for recording multi-channel audio through your \r
-% ASIO device. Arguments in [] are optional\r
-%\r
-% - firstchannel the first input channel to record from\r
-% - lastchannel the last input channel to record from\r
-% - nsamples the number of samples to record from each channel\r
-% - samplerate the sampling frequency. Default: 44100\r
-% - deviceid the device id to use for INPUT. Default: 0\r
-% - informat the desired data type of inputbuffer. Valid types\r
-% and the number of bits per sample are as follows:\r
-% - devicetype determines which sound driver to use\r
-% 'win' Windows Multimedia Device\r
-% 'dx' DirectX DirectSound driver\r
-% 'asio' ASIO Driver (default)\r
-% - inputbuffer is a variable that will hold the recorded audio, \r
-% running along rows, with a seperate column for \r
-% each channel\r
-%\r
-% SEE ALSO: pa_wavplay, pa_wavplayrecord\r
-\r
-% check right num of args\r
-error(nargchk(0,6,nargin));\r
-\r
-% defaults\r
-device_opt = 1;\r
-device = 0;\r
-fs = 44100;\r
-%in_opt = 2;\r
-\r
-% no args, print devices for asio\r
-if (nargin==0)\r
- pawavplaya;\r
- return;\r
-end\r
-\r
-% if devtype specified\r
-if ischar(varargin{end})\r
- s=varargin{end};\r
- varargin(end)=[];\r
- \r
- device_opt = strmatch(s,{'asio','win', 'dx'});\r
- if isempty(device_opt),\r
- error(['Unrecognized DEVICETYPE: ' s]);\r
- end\r
-\r
- if (nargin==1)\r
- if device_opt==1, % asio\r
- pawavplaya;\r
- end\r
- if device_opt==2, % win\r
- pawavplayw;\r
- end \r
- if device_opt==3, % dx\r
- pawavplayx;\r
- end\r
- return;\r
- end\r
-end\r
-\r
-%{\r
-% if informat specified\r
-if ischar(varargin{end})\r
- s=varargin{end};\r
- varargin(end)=[];\r
- \r
- in_opt = strmatch(s,{'int16','double'});\r
- if isempty(in_opt),\r
- error(['Unrecognized informat: ' s]);\r
- end\r
-end\r
-%}\r
-\r
-% channels\r
-firstchannel = varargin{1};\r
-lastchannel = varargin{2};\r
-\r
-% samples\r
-nsamples = varargin{3};\r
-\r
-% sample rate\r
-if length(varargin)>=4,\r
- fs=varargin{4};\r
-end\r
-\r
-% device id\r
-if length(varargin) >= 5,\r
- device = varargin{5};\r
-end\r
-\r
-if device_opt==1, % asio\r
- %fprintf('Using ASIO driver\n');\r
- y = pawavplaya(0, -1, fs, firstchannel, lastchannel, nsamples, device);\r
-\r
-elseif device_opt==2, % win\r
- fprintf('Using WMME driver\n');\r
- y = pawavplayw(0, -1, fs, firstchannel, lastchannel, nsamples, device);\r
-\r
-elseif device_opt==3, % dx\r
- fprintf('Using DirectX driver\n');\r
- y = pawavplayx(0, -1, fs, firstchannel, lastchannel, nsamples, device);\r
-end\r
-\r
-%fprintf('Converting result to doubles\n');\r
-y = double(y);\r
-\r
-% [EOF] pa_wavrecord.m
\ No newline at end of file