Commit 2ce03460 authored by Günter Windau's avatar Günter Windau

lsldert audio stuff

parent bea4b094
client=lsldert_audioclient('raspi6');
for ii=1:10
fnii=sprintf('%d.wav',ii);
client.load(ii,fnii);
end
for jj=1:2
for ii=1:10
client.play(ii);
pause(1.5);
client.stop(ii);
end
end
%input('press enter >>>>');
delete(client);
classdef lsldert_audioclient < lsldert_pubclient
properties
maxbuf = 10;
end
methods
function this = lsldert_audioclient(varargin)
% LSLDERT_AUDIOCLIENT class constructor
%
% obj = lsldert_audioclient('lslsdert-host.local');
% creates a connection to the lsldert server listening
% on port 5555 at remote host 'lslsdert-host.local'.
% the port number can optionally be specified as a 2nd argument
% obj = lsldert_client('lsldert-host.local', 5555);
this@lsldert_pubclient(varargin{:});
end
function load(this,bufferno, filename)
if (bufferno < 0) || (bufferno > this.maxbuf)
ME = MException('lsldert_audioclient.load',...
'bufferno must be >=0 and <%d',...
this.maxbuf);
throw(ME);
end
[pcm_data,Fs]=audioread(filename);
nsamp=max(size(pcm_data));
nchan=min(size(pcm_data));
pcm_header=uint32([Fs, nchan, nsamp, 0, 0, 0]);
cmd=sprintf('AF %d',bufferno);
this.send(cmd, pcm_header, single(pcm_data));
end
function play(this,bufferno)
if (bufferno < 0) || (bufferno > this.maxbuf)
ME = MException('lsldert_audioclient.play',...
'bufferno must be >=0 and <%d',...
this.maxbuf);
throw(ME);
end
cmd=sprintf('AP %d',bufferno);
this.send(cmd);
end
function stop(this,bufferno)
if (bufferno < 0) || (bufferno > this.maxbuf)
ME = MException('lsldert_audioclient.stop',...
'bufferno must be >=0 and <%d',...
this.maxbuf);
throw(ME);
end
cmd=sprintf('AS %d',bufferno);
this.send(cmd);
end
end
end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment