Revision 225:8e04d298741b yetilab/stream/test/test_audiofile.yeti
| yetilab/stream/test/test_audiofile.yeti | ||
|---|---|---|
| 5 | 5 |
vec = load yetilab.vector.vector; |
| 6 | 6 |
mat = load yetilab.matrix.matrix; |
| 7 | 7 |
|
| 8 |
{ compare } = load yetilab.test.test;
|
|
| 8 |
ref = load yetilab.stream.test.audiofile_reference; |
|
| 9 |
|
|
| 10 |
{ compare, compareUsing } = load yetilab.test.test;
|
|
| 9 | 11 |
|
| 10 | 12 |
testfile name = "yetilab/test/data/\(name).wav"; |
| 11 | 13 |
|
| ... | ... | |
| 15 | 17 |
arr[0] := n; |
| 16 | 18 |
arr[0]); |
| 17 | 19 |
|
| 20 |
readAll stream = |
|
| 21 |
case stream.available of |
|
| 22 |
Known n: stream.read n; |
|
| 23 |
_: failWith "Known-duration stream required"; |
|
| 24 |
esac; |
|
| 25 |
|
|
| 26 |
testReferenceFile rate channels bitdepth = |
|
| 27 |
(test = readAll (af.open (testfile "\(rate)-\(channels)-\(bitdepth)")); |
|
| 28 |
ref = readAll (ref.afReference rate channels); |
|
| 29 |
compareUsing mat.equal test ref); |
|
| 30 |
|
|
| 18 | 31 |
[ |
| 19 | 32 |
|
| 20 | 33 |
"20samples-open": \( |
| ... | ... | |
| 41 | 54 |
done [ af.open, af.openMono ]); |
| 42 | 55 |
), |
| 43 | 56 |
|
| 57 |
"8000-1-8": \( |
|
| 58 |
testReferenceFile 8000 1 8; |
|
| 59 |
), |
|
| 60 |
|
|
| 61 |
"44100-2-16": \( |
|
| 62 |
testReferenceFile 44100 2 16; |
|
| 63 |
), |
|
| 64 |
|
|
| 44 | 65 |
] is hash<string, () -> boolean> |
| 45 | 66 |
|
Also available in: Unified diff