diff --git a/src/soundedit/WaveformView.as b/src/soundedit/WaveformView.as index be7fa3f..48d7100 100644 --- a/src/soundedit/WaveformView.as +++ b/src/soundedit/WaveformView.as @@ -278,14 +278,14 @@ public class WaveformView extends Sprite implements DragClient { recordSamples = new Vector.(); openMicrophone(); mic.addEventListener(SampleDataEvent.SAMPLE_DATA, recordData); - } + } editor.updateIndicators(); drawWave(); } public function isRecording():Boolean { return recordSamples != null } - private function stopRecording():void { + private function stopRecording():void { if (mic) mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, recordData); editor.levelMeter.clear(); 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. // 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). - // + // var max:int, i:int; var dups:int = 2 * (44100 / samplingRate); // number of copies of each samples to write if (dups & 1) dups++; // ensure that dups is even 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; for (var j:int = 0; j < dups; j++) evt.data.writeFloat(sample); - } - if (playbackStarting) { + } + if (playbackStarting) { if (i < count) { // Very short sound or selection; pad with enough zeros so sound actually plays. for (i = 0; i < 2048; i++) evt.data.writeFloat(0 / 32767); } playbackStarting = false; - } + } } /* Editing Operations */ @@ -443,7 +443,7 @@ public class WaveformView extends Sprite implements DragClient { var last:int = clipTo(condensedEnd * samplesPerCondensedSample, 0, samples.length); return samples.slice(first, last); } - + private function updateContents(newSamples:Vector., keepSelection:Boolean = false, newCondensation:int = -1):void { // Replace my contents with the given sample buffer. // Record change for undo. @@ -567,7 +567,7 @@ public class WaveformView extends Sprite implements DragClient { private var startOffset:int; // offset where drag started public function mouseDown(evt:MouseEvent):void { Scratch(root).gh.setDragClient(this, evt) } - + public function dragBegin(evt:MouseEvent):void { // Decide how to make or adjust the selection. const close:int = 8;