Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DirectionalIR: added treatment of IRs with full head rotation range #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
35 changes: 27 additions & 8 deletions src/+simulator/+buffer/FIFO.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
classdef FIFO < simulator.buffer.Data
% basically implements a FIFO buffer

properties
startIdx;
end

methods
function obj = FIFO(mapping)
% function obj = Data(mapping)
Expand All @@ -12,6 +16,7 @@
mapping = 1;
end
obj = [email protected](mapping);
obj.startIdx = 1;
end
end

Expand All @@ -26,7 +31,8 @@ function appendData(obj, data)
if (size(data,2) ~= obj.NumberOfInputs)
error('number of columns does not match number of inputs');
end
obj.data = [obj.data; data];
obj.data = [obj.data(obj.startIdx:end,:); data];
obj.startIdx = 1;
end
function removeData(obj, length)
% function removeData(obj, length)
Expand All @@ -40,13 +46,26 @@ function removeData(obj, length)
if ~isempty(obj.data)
if nargin < 2
obj.data = [];
elseif length > size(obj.data,1)
elseif length > size(obj.data,1) + 1 - obj.startIdx
obj.data = [];
else
obj.data = obj.data(length+1:end,:);
if obj.startIdx >= 8192 * 50
obj.data = obj.data(obj.startIdx+length:end,:);
obj.startIdx = 1;
else
obj.startIdx = obj.startIdx + length;
end
end
end
end
function b = isEmpty(obj)
% function b = isEmpty(obj)
% indicates if buffer is empty
%
% Return values:
% b: indicates if buffer is empty @type logical
b = isempty(obj.data) || obj.startIdx > size( obj.data, 1 );
end
function data = getData(obj, length, channels)
% function data = getData(obj, length, channels)
% reads data from FIFO buffer of specified length
Expand All @@ -70,18 +89,18 @@ function removeData(obj, length)
end

if nargin < 2
if size(obj.data,1) > 0
data = obj.data(:,mapping);
if size(obj.data,1) + 1 - obj.startIdx > 0
data = obj.data(obj.startIdx:end,mapping);
else
data = [];
end
elseif length > size(obj.data,1)
elseif length > size(obj.data,1) + 1 - obj.startIdx
data = zeros(length, obj.NumberOfOutputs);
if size(obj.data,1) > 0
data(1:size(obj.data,1),:) = obj.data(:,mapping);
data(1:size(obj.data,1) + 1 - obj.startIdx,:) = obj.data(obj.startIdx:end,mapping);
end
else
data = obj.data(1:length,mapping);
data = obj.data(obj.startIdx:length+obj.startIdx-1,mapping);
end
end
end
Expand Down
13 changes: 8 additions & 5 deletions src/+simulator/DirectionalIR.m
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,15 @@ function plot(obj, id)
phiMin = availableAzimuths(adx);
phiMax = availableAzimuths( ...
mod(adx - 2,length(availableAzimuths)) + 1);
% center of this area
obj.TorsoAzimuth = phiMin + mod(phiMax - phiMin, 360)/2;

obj.maxHeadLeft = mod(phiMax - obj.TorsoAzimuth + 180, 360) - 180;
obj.maxHeadRight = mod(phiMin - obj.TorsoAzimuth + 180, 360) - 180;
else
phiMin = min( availableAzimuths );
phiMax = max( availableAzimuths );
end
% center of this area
obj.TorsoAzimuth = mod( phiMin + mod(phiMax - phiMin, 360)/2, 360 );

obj.maxHeadLeft = mod(phiMax - obj.TorsoAzimuth + 180, 360) - 180;
obj.maxHeadRight = mod(phiMin - obj.TorsoAzimuth + 180, 360) - 180;
% create regular grid with this distance
if resolution == 0
nangle = 1;
Expand Down
Empty file modified src/mex/ssr_aap.mexa64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_aap.mexmaci64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_binaural.mexa64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_binaural.mexmaci64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_brs.mexa64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_brs.mexmaci64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_generic.mexa64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_generic.mexmaci64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_nfc_hoa.mexa64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_nfc_hoa.mexmaci64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_vbap.mexa64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_vbap.mexmaci64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_wfs.mexa64
100755 → 100644
Empty file.
Empty file modified src/mex/ssr_wfs.mexmaci64
100755 → 100644
Empty file.