diff util/classes/@audio/buffer.m @ 182:f8bc99a5470c danieleb

Added test for audio buffer function
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Mon, 09 Jan 2012 12:58:00 +0000
parents 1495bdfa13e9
children 2f5ce7c8792a f1e601cc916d
line wrap: on
line diff
--- a/util/classes/@audio/buffer.m	Thu Jan 05 15:46:13 2012 +0000
+++ b/util/classes/@audio/buffer.m	Mon Jan 09 12:58:00 2012 +0000
@@ -1,8 +1,14 @@
+%% Buffer function
+% Buffers the samples of the audio object into the columns of the matrix S
+% based on the input parameters
+%%
 function obj = buffer(obj,wLength,overlap,window,method)
 
 %% Check inputs & Defaults
 error(nargchk(2, 5, nargin, 'struct'));
-
+if rem(length(obj.s),wLength)
+	error('The wLength must be an integer divisor of the signal length!'); 
+end
 if ~exist('overlap','var') || isempty(overlap), overlap = 0; end
 if ~exist('method','var') || isempty(method), method = 'standard'; end
 
@@ -15,10 +21,10 @@
 			error('The window chosen is not valid because it cannot be inverted!');
 		end
 		obj.S = diag(window(wLength))*buffer(obj.s,wLength,overlap,'nodelay');
-	case 'lot'
-		if ~exist('window','var') || isempty(window), window = 'sin2'; end
-		s_lot = lot(obj.s,wLength,'id',overlap,window);
-		obj.S = buffer(s_lot,wLength);
+% 	case 'lot'
+% 		if ~exist('window','var') || isempty(window), window = 'sin2'; end
+% 		s_lot = lot(obj.s,wLength,'id',overlap,window);
+% 		obj.S = buffer(s_lot,wLength);
 	otherwise
 		error('Please specify a valid buffer method');
 end