mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-04 21:21:06 -05:00
Fixed whitespace in soundedit.WaveformView
This commit is contained in:
parent
453f26559c
commit
3ca6d42232
1 changed files with 9 additions and 9 deletions
|
@ -278,14 +278,14 @@ public class WaveformView extends Sprite implements DragClient {
|
||||||
recordSamples = new Vector.<int>();
|
recordSamples = new Vector.<int>();
|
||||||
openMicrophone();
|
openMicrophone();
|
||||||
mic.addEventListener(SampleDataEvent.SAMPLE_DATA, recordData);
|
mic.addEventListener(SampleDataEvent.SAMPLE_DATA, recordData);
|
||||||
}
|
}
|
||||||
editor.updateIndicators();
|
editor.updateIndicators();
|
||||||
drawWave();
|
drawWave();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isRecording():Boolean { return recordSamples != null }
|
public function isRecording():Boolean { return recordSamples != null }
|
||||||
|
|
||||||
private function stopRecording():void {
|
private function stopRecording():void {
|
||||||
if (mic) mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, recordData);
|
if (mic) mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, recordData);
|
||||||
editor.levelMeter.clear();
|
editor.levelMeter.clear();
|
||||||
if (recordSamples && (recordSamples.length > 0)) appendRecording(recordSamples);
|
if (recordSamples && (recordSamples.length > 0)) appendRecording(recordSamples);
|
||||||
|
@ -376,22 +376,22 @@ public class WaveformView extends Sprite implements DragClient {
|
||||||
// sample to convert from lower original sampling rates (11025 or 22050) and mono->stereo.
|
// sample to convert from lower original sampling rates (11025 or 22050) and mono->stereo.
|
||||||
// Note: This "cheap trick" of duplicating samples can also approximate imported sounds
|
// Note: This "cheap trick" of duplicating samples can also approximate imported sounds
|
||||||
// at sampling rates of 16000 and 8000 (actual playback rates: 14700 and 8820).
|
// at sampling rates of 16000 and 8000 (actual playback rates: 14700 and 8820).
|
||||||
//
|
//
|
||||||
var max:int, i:int;
|
var max:int, i:int;
|
||||||
var dups:int = 2 * (44100 / samplingRate); // number of copies of each samples to write
|
var dups:int = 2 * (44100 / samplingRate); // number of copies of each samples to write
|
||||||
if (dups & 1) dups++; // ensure that dups is even
|
if (dups & 1) dups++; // ensure that dups is even
|
||||||
var count:int = 6000 / dups;
|
var count:int = 6000 / dups;
|
||||||
for (i = 0; i < count && (playIndex < playEndIndex); i++) {
|
for (i = 0; i < count && (playIndex < playEndIndex); i++) {
|
||||||
var sample:Number = samples[playIndex++] / 32767;
|
var sample:Number = samples[playIndex++] / 32767;
|
||||||
for (var j:int = 0; j < dups; j++) evt.data.writeFloat(sample);
|
for (var j:int = 0; j < dups; j++) evt.data.writeFloat(sample);
|
||||||
}
|
}
|
||||||
if (playbackStarting) {
|
if (playbackStarting) {
|
||||||
if (i < count) {
|
if (i < count) {
|
||||||
// Very short sound or selection; pad with enough zeros so sound actually plays.
|
// Very short sound or selection; pad with enough zeros so sound actually plays.
|
||||||
for (i = 0; i < 2048; i++) evt.data.writeFloat(0 / 32767);
|
for (i = 0; i < 2048; i++) evt.data.writeFloat(0 / 32767);
|
||||||
}
|
}
|
||||||
playbackStarting = false;
|
playbackStarting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Editing Operations */
|
/* Editing Operations */
|
||||||
|
@ -443,7 +443,7 @@ public class WaveformView extends Sprite implements DragClient {
|
||||||
var last:int = clipTo(condensedEnd * samplesPerCondensedSample, 0, samples.length);
|
var last:int = clipTo(condensedEnd * samplesPerCondensedSample, 0, samples.length);
|
||||||
return samples.slice(first, last);
|
return samples.slice(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateContents(newSamples:Vector.<int>, keepSelection:Boolean = false, newCondensation:int = -1):void {
|
private function updateContents(newSamples:Vector.<int>, keepSelection:Boolean = false, newCondensation:int = -1):void {
|
||||||
// Replace my contents with the given sample buffer.
|
// Replace my contents with the given sample buffer.
|
||||||
// Record change for undo.
|
// Record change for undo.
|
||||||
|
@ -567,7 +567,7 @@ public class WaveformView extends Sprite implements DragClient {
|
||||||
private var startOffset:int; // offset where drag started
|
private var startOffset:int; // offset where drag started
|
||||||
|
|
||||||
public function mouseDown(evt:MouseEvent):void { Scratch(root).gh.setDragClient(this, evt) }
|
public function mouseDown(evt:MouseEvent):void { Scratch(root).gh.setDragClient(this, evt) }
|
||||||
|
|
||||||
public function dragBegin(evt:MouseEvent):void {
|
public function dragBegin(evt:MouseEvent):void {
|
||||||
// Decide how to make or adjust the selection.
|
// Decide how to make or adjust the selection.
|
||||||
const close:int = 8;
|
const close:int = 8;
|
||||||
|
|
Loading…
Reference in a new issue