Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: third_party/WebKit/LayoutTests/webaudio/resources/note-grain-on-testing.js

Issue 2895963003: Apply layout-test-tidy to LayoutTests/webaudio (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/webaudio/resources/note-grain-on-testing.js
diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/note-grain-on-testing.js b/third_party/WebKit/LayoutTests/webaudio/resources/note-grain-on-testing.js
index f19d57e245062dcecda99f33316fecd8819f1a5a..6c948f7346fca235b21fcd9606464cb814e6c3d9 100644
--- a/third_party/WebKit/LayoutTests/webaudio/resources/note-grain-on-testing.js
+++ b/third_party/WebKit/LayoutTests/webaudio/resources/note-grain-on-testing.js
@@ -29,22 +29,21 @@ let renderedData;
// Create a buffer containing the data that we want. The function f
// returns the desired value at sample frame k.
function createSignalBuffer(context, f) {
+ // Make sure the buffer has enough data for all of the possible
+ // grain offsets and durations. Need to include the extra frames
+ // for HRTF. The additional 1 is for any round-off errors.
+ let signalLength = Math.floor(
+ 1 + extraFramesHRTF +
+ sampleRate * (numberOfTests * grainOffsetStep + duration));
+
+ let buffer = context.createBuffer(2, signalLength, sampleRate);
+ let data = buffer.getChannelData(0);
+
+ for (let k = 0; k < signalLength; ++k) {
+ data[k] = f(k);
+ }
- // Make sure the buffer has enough data for all of the possible
- // grain offsets and durations. Need to include the extra frames
- // for HRTF. The additional 1 is for any round-off errors.
- let signalLength = Math.floor(
- 1 + extraFramesHRTF +
- sampleRate * (numberOfTests * grainOffsetStep + duration));
-
- let buffer = context.createBuffer(2, signalLength, sampleRate);
- let data = buffer.getChannelData(0);
-
- for (let k = 0; k < signalLength; ++k) {
- data[k] = f(k);
- }
-
- return buffer;
+ return buffer;
}
// From the data array, find the start and end sample frame for each
@@ -75,9 +74,9 @@ function findStartAndEndSamples(data) {
lookForStart = true;
}
}
- }
+ }
- return {start : startTime, end : endTime};
+ return {start: startTime, end: endTime};
}
function playGrain(context, source, time, offset, duration) {
@@ -101,9 +100,9 @@ function playAllGrains(context, source, numberOfNotes) {
playGrain(context, source, timeOffset, grainOffset, duration);
startTimes[k] = timeOffset;
offsets[k] = grainOffset;
- }
+ }
- return { startTimes : startTimes, grainOffsetTimes : offsets };
+ return {startTimes: startTimes, grainOffsetTimes: offsets};
}
// Verify that the start and end frames for each grain match our
@@ -150,7 +149,8 @@ function verifyStartAndEndFrames(startEndFrames, should) {
.beEqualTo(numberOfTests);
} else {
should(
- errorCountStart, 'Number of grains out of ' + numberOfTests +
+ errorCountStart,
+ 'Number of grains out of ' + numberOfTests +
'that started at the wrong time')
.beEqualTo(0);
}
@@ -160,7 +160,8 @@ function verifyStartAndEndFrames(startEndFrames, should) {
.beEqualTo(numberOfTests);
} else {
should(
- errorCountEnd, 'Number of grains out of ' + numberOfTests +
+ errorCountEnd,
+ 'Number of grains out of ' + numberOfTests +
' that ended at the wrong time')
.beEqualTo(0);
}

Powered by Google App Engine
This is Rietveld 408576698