Commit 677a3ccc authored by Michael Kohnen's avatar Michael Kohnen

settting fft degree over 31 or setting samples lower than 31 will not

automatically be identified as fftdegree or samples anymore in itaAudio
parent d4a98d35
......@@ -9,7 +9,7 @@ function pos = VR_loudspeaker_position(varargin)
% Options
opts.virtualSpeaker = false; % true || Indicates whether to add virtual speaker achieve a more regular distribution (stabilizes the pseudoinverse in Ambisonics Decoding)
opts.coordSystem = 'itaCoordinates'; % 'openGL' || indicates in which coordinate system the output is
opts.isItaCoordinates = false; % true || indicates whether the output is a itaCoordinate or not (warning: if combined with coordSystem='opneGL', the angles for azimuth and elevation are not correct
opts.isItaCoordinates = true; % true || indicates whether the output is a itaCoordinate or not (warning: if combined with coordSystem='opneGL', the angles for azimuth and elevation are not correct
opts.heightCorrection = 0.0597; % in meter || ensures that the loudspeakers are around the point (0 0 0), standard value is height of the bigger loudspeaker in the horizontal plane
opts=ita_parse_arguments(opts, varargin);
......
......@@ -135,7 +135,10 @@ classdef itaAudio < itaSuper
end
function this = set.fftDegree(this, value)
nSamples = ita_nSamples(value);
if value>31
warning('FFT degree higher than 31 are not converted in to number of Samples anymore in itaAudio.setfftDegree! If you did not expect this message, please report to the toolbox support team.');
end
nSamples = ita_nSamples(value, 'fftDegree');
this = set_nSamples(this, nSamples);
end
......@@ -148,8 +151,11 @@ classdef itaAudio < itaSuper
function this = set.trackLength(this, value)
nSamples = this.samplingRate * double(value);
if nSamples<32
warning('Warning! Samples numbers smaller than 32 are not converted to FFT degree anymore in itaAudio.nSamples! If you did not expect this message, please report to the toolbox support team.');
end
if isfinite(nSamples)
this = set_nSamples(this, nSamples);
this = set_nSamples(this, nSamples, 'samples');
else
disp('Cannot set trackLength, nSamples are not finite. Check the samplingRate.');
end
......@@ -273,8 +279,11 @@ classdef itaAudio < itaSuper
end
function this = set_nSamples(this, nSamples)
if nSamples<32
warning('Warning! Samples numbers smaller than 32 are not converted to FFT degree anymore in itaAudio.nSamples! If you did not expect this message, please report to the toolbox support team.');
end
% set nSamples and trim audio time data accordingly
nSamples = ita_nSamples(nSamples);
nSamples = ita_nSamples(nSamples,'samples');
if nSamples == this.nSamples
return; % nothing to do, length is OK
elseif nSamples > this.nSamples
......
function [nSamples, fftDegree] = ita_nSamples(value)
function [nSamples, fftDegree] = ita_nSamples(value, inType)
%ITA_FFTDEGREE - Distinguish fftDegree and number of Samples
% This function converts fft degree or number of samples as input argument
% to even number of samples and corresponding fftDegree (if requested) at the output.
......@@ -6,33 +6,40 @@ function [nSamples, fftDegree] = ita_nSamples(value)
% Syntax:
% [nSamples fftDegree] = ita_nSamples(value)
%
% Reference page in Help browser
% Reference page in Help browser
% <a href="matlab:doc ita_nSamples">doc ita_nSamples</a>
%
% See also:
% ita_fftDegree, itaAudio
% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved.
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder.
% This file is part of the ITA-Toolbox. Some rights reserved.
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder.
% </ITA-Toolbox>
% Author: Pascal Dietrich -- Email: pdi@akustik.rwth-aachen.de
% Created: 13-Jun-2012
% Created: 13-Jun-2012
if nargin<2
inType='auto';
end
%% distinguish
if value < 32 % then we have an fftDegree
nSamples = 2.^value;
else
nSamples = value; % we have number of samples given
switch inType
case 'auto'
if value < 32 % then we have an fftDegree
nSamples = 2.^value;
else
nSamples = value; % we have number of samples given
end
case 'fftDegree'
nSamples = 2.^value;
case 'samples'
nSamples = value;
end
%% make it natural and even!
nSamples = round(nSamples / 2) * 2;
%% get corresponding fft degree
fftDegree = log2(nSamples);
end
\ No newline at end of file
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