PageRenderTime 51ms CodeModel.GetById 30ms app.highlight 2ms RepoModel.GetById 18ms app.codeStats 0ms

/flash/soundtouch-as3/src/com/ryanberdeen/soundtouch/StretchSS.as

http://echo-nest-remix.googlecode.com/
ActionScript | 30 lines | 25 code | 4 blank | 1 comment | 0 complexity | 17f7546b9e24e8a02b52299215af3287 MD5 | raw file
 1package com.ryanberdeen.soundtouch {
 2  import com.ryanberdeen.audio.ISampleSource;
 3  import flash.media.Sound;
 4  import flash.utils.ByteArray;
 5  public class StretchSS implements ISampleSource {
 6    private var stretch:Stretch;
 7    public function StretchSS(sound:Sound, tempo:Number):void {
 8      stretch = new Stretch();
 9      //stretch.setParameters(44100, 30, 75, Stretch.DEFAULT_OVERLAP_MS);
10      stretch.sound = sound;
11      stretch.tempo = tempo;
12    }
13    
14    public function set tempo(tempo:int):void {
15      stretch.tempo = tempo;
16    }
17    
18    public function extract(target:ByteArray, length:Number, startPosition:Number = -1):Number {
19      return stretch.process(target);
20    }
21
22    public function toSourcePosition(position:Number):Number {
23      return -1;
24    }
25    
26    public function get length():Number {
27      return -1;
28    }
29  }
30}