Mercurial > hg > may
changeset 179:a1069ed26740
Use mat.concat, and make sure first matrix in series is row-major
author | Chris Cannam |
---|---|
date | Thu, 02 May 2013 22:17:49 +0100 |
parents | 032c4986b6b0 |
children | a5417e489e2b |
files | yetilab/stream/filter.yeti yetilab/stream/test/test_filter.yeti |
diffstat | 2 files changed, 6 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/yetilab/stream/filter.yeti Thu May 02 21:58:58 2013 +0100 +++ b/yetilab/stream/filter.yeti Thu May 02 22:17:49 2013 +0100 @@ -45,13 +45,9 @@ delayedBy nsamples s = //!!! should nsamples be a time in seconds? (var prepos = 0; delay = nsamples; - zeros n = + zeros n = mat.toRowMajor (prepos := prepos + n; mat.zeroMatrix { rows = s.channels, columns = n }); - glueMatrices m1 m2 = - mat.newMatrix (RowMajor ()) - (map2 do row1 row2: bl.concat [ row1, row2 ] done - (mat.asRows m1) (mat.asRows m2)); { get position () = if prepos < delay then prepos else s.position + delay fi, @@ -70,7 +66,7 @@ nleft = delay - prepos; left = zeros nleft; right = s.read (count - nleft); - glueMatrices left right; + mat.concat (Horizontal ()) [left, right]; fi, close = s.close });
--- a/yetilab/stream/test/test_filter.yeti Thu May 02 21:58:58 2013 +0100 +++ b/yetilab/stream/test/test_filter.yeti Thu May 02 22:17:49 2013 +0100 @@ -78,11 +78,11 @@ compare str.sampleRate 2 and compare str.available (Known 5) and compare str.finished? false and - compare (bl.list ((str.read 0).getRow 0)) [ ] and - compare str.position 0 and - compare str.available (Known 5) and + compare (bl.list ((str.read 1).getRow 0)) [ 0 ] and + compare str.position 1 and + compare str.available (Known 4) and compare str.finished? false and - compare (bl.list ((str.read 5).getRow 0)) [ 0, 0, 0, 0.5, 1 ] and + compare (bl.list ((str.read 4).getRow 0)) [ 0, 0, 0.5, 1 ] and compare str.position 5 and compare str.available (Known 0) and compare str.finished? true and