Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/+simulator/SimulatorInterface.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
% rendering mex-function
% @type function_handle
% @default @ssr_binaural
Renderer = @ssr_binaural;
Renderer = @ssr_virtualwfs;
% HRIR-dataset
% @type DirectionalIR
HRIRDataset;
Expand Down
44 changes: 44 additions & 0 deletions src/mex/ssr_virtualwfs.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
function [varargout] = ssr_virtualwfs(varargin)

isargchar(varargin{1})

varargout = {};

switch varargin{1}
case 'init'
if nargin > 3
error('too much input arguments for "%s"', varargin{1});
end
isargpositivescalar(varargin{2});

params = varargin{3};

% init wfs renderer
params.reproduction_setup = '8channels.asd';
params.prefilter_file = 'wfs_prefilter_100_1300_44100.wav';
ssr_wfs('init', varargin{2}, rmfield(params,'hrir_file'));

% get number and positions of loudspeakers
num = ssr_wfs('out_channels');
pos = ssr_wfs('loudspeaker_position');

% remove some fields from the params (just for convenience)
params = rmfield(params, {'prefilter_file', 'reproduction_setup'});

% init binaural renderer
ssr_binaural('init', num, params);
ssr_binaural('source_position', pos);
case 'clear'
if nargin > 1
error('too much input arguments for "%s"', varargin{1});
end
ssr_wfs('clear');
ssr_binaural('clear');
otherwise
if any(strcmp('process',varargin))
varargout{1} = ssr_wfs(varargin{:});
varargout{1} = ssr_binaural('process', varargout{1});
else
ssr_wfs(varargin{:});
end
end
Binary file added src/mex/ssr_wfs.mexa64
Binary file not shown.
55 changes: 55 additions & 0 deletions test/8channels.asd
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<asdf>
<header>
<name>8-channel equiangular configuration</name>
</header>

<reproduction_setup>

<loudspeaker>
<position x="1.5" y="0.0"/>
<orientation azimuth="-180"/>
</loudspeaker>

<loudspeaker>
<position x="1.06" y="1.06"/>
<orientation azimuth="-135"/>
</loudspeaker>

<loudspeaker>
<position x="0.0" y="1.5"/>
<orientation azimuth="-90"/>
</loudspeaker>

<loudspeaker>
<position x="-1.06" y="1.06"/>
<orientation azimuth="-45"/>
</loudspeaker>

<loudspeaker>
<position x="-1.5" y="0.0"/>
<orientation azimuth="0"/>
</loudspeaker>

<loudspeaker>
<position x="-1.06" y="-1.06"/>
<orientation azimuth="45"/>
</loudspeaker>

<loudspeaker>
<position x="0.0" y="-1.5"/>
<orientation azimuth="90"/>
</loudspeaker>

<loudspeaker>
<position x="1.06" y="-1.06"/>
<orientation azimuth="135"/>
</loudspeaker>

</reproduction_setup>
</asdf>

<!--
Settings for Vim (http://www.vim.org/), please do not remove:
vim:softtabstop=2:shiftwidth=2:expandtab:textwidth=80
-->
20 changes: 3 additions & 17 deletions test/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,24 @@
<scene
BlockSize="4096"
SampleRate="44100"
MaximumDelay="0.0"
MaximumDelay="0.05"
NumberOfThreads="1"
ReverberationMaxOrder="2"
HRIRs="impulse_responses/qu_kemar_anechoic/QU_KEMAR_anechoic_3m.sofa">
<source Position="0 -3 1.75"
<source Position="0 -1 1.75"
Type="point"
Name="Cello">
<buffer ChannelMapping="1"
Type="fifo"
File="stimuli/anechoic/instruments/anechoic_cello.wav"/>
</source>
<source Position="0 1 1.75"
<source Position="0 3 1.75"
Type="point"
Name="Castanets">
<buffer ChannelMapping="1"
Type="fifo"
File="stimuli/anechoic/instruments/anechoic_castanets.wav"/>
</source>
<source Name="Forest"
Type="direct"
Volume="0.1">
<buffer ChannelMapping="1 2"
Type="ring"
File="stimuli/binaural/binaural_forest.wav"/>
</source>
<source Type="direct"
Name="Noise">
<buffer ChannelMapping="1 2"
Type="noise"
Variance="0.02"
Mean="0.0"/>
</source>
<sink Position="0 0 1.75"
UnitFront="1 0 0"
UnitUp="0 0 1"
Expand Down
Binary file added test/wfs_prefilter_100_1300_44100.wav
Binary file not shown.