forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhrtf-database.html
More file actions
70 lines (59 loc) · 2.08 KB
/
Copy pathhrtf-database.html
File metadata and controls
70 lines (59 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<title>
Test FLAC-encoded HRTF databse
</title>
<script src="../../imported/w3c/web-platform-tests/resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit.js"></script>
<script src="../resources/buffer-loader.js"></script>
</head>
<body>
<script id="layout-test-code">
// This MUST be the sample rate used by the HTRF database!
let sampleRate = 44100;
let context;
let wavBuffer;
let flacBuffer;
let audit = Audit.createTaskRunner();
audit.define(
{label: 'loadfiles', description: 'Load HRTF database files'},
function(task, should) {
// Any valid context with the right sample rate will do.
context = new OfflineAudioContext(1, 1, sampleRate);
let bufferLoader = new BufferLoader(
context,
[
'../resources/hrtf/Composite.wav',
'../resources/hrtf/Composite.flac',
],
function(bufferList) {
should(bufferList.length, 'Number of buffers loaded')
.beEqualTo(2);
wavBuffer = bufferList[0];
flacBuffer = bufferList[1];
task.done();
});
bufferLoader.load();
});
audit.define(
{
label: 'verify-flac',
description: 'Verify FLAC-encoded HRTF database matches original'
},
function(task, should) {
should(flacBuffer.numberOfChannels, 'Number of FLAC channels')
.beEqualTo(wavBuffer.numberOfChannels);
for (let k = 0; k < wavBuffer.numberOfChannels; ++k) {
should(
flacBuffer.getChannelData(k),
'FLAC-encoded HRTF database channel ' + k)
.beEqualToArray(wavBuffer.getChannelData(k));
}
task.done();
});
audit.run();
</script>
</body>
</html>