チェンジセット 3516

差分発生行の前後
無視リスト:
コミット日時:
2010/03/11 02:32:19 (2 年前)
コミッタ:
keim
ログメッセージ:

SiON ver0.59 updated. This version is only for development.

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLSequencer.as

    r3480 r3516  
    207207            newMMLEventListener('!na', _onAmplitudeEnvTSSCP); 
    208208            newMMLEventListener('po',  _onPortament); 
     209 
     210            // global event 
     211            newMMLEventListener('@fadeout', _onFadeOut, true); 
    209212             
    210213            // processing events 
     
    15961599        } 
    15971600         
     1601 
     1602        // @fadeout 
     1603        private function _onFadeOut(e:MMLEvent) : MMLEvent 
     1604        { 
     1605            return e.next; 
     1606        } 
    15981607         
    15991608         
  • as3/SiOPM/trunk/src/org/si/sion/utils/SiONUtil.as

    r3450 r3516  
    8585         *  @param src The Sound data extracting from.  
    8686         *  @param dst The Vector.<Number> instance to put result. You can pass null to create new Vector.<Number> inside. 
    87          *  @param channelCount channel count of extracted data. 1 for monoral, 2 for stereo. 
     87         *  @param dstChannelCount channel count of extracted data. 1 for monoral, 2 for stereo. 
    8888         *  @param length The maximum sample count to extract. The length of returning vector is limited by this value. 
    8989         *  @param startPosition Start position to extract. -1 to set extraction continuously. 
    9090         *  @return extracted data. 
    9191         */ 
    92         static public function extract(src:Sound, dst:Vector.<Number>=null, channelCount:int=1, length:int=1048576, startPosition:int=-1) : Vector.<Number> 
     92        static public function extract(src:Sound, dst:Vector.<Number>=null, dstChannelCount:int=1, length:int=1048576, startPosition:int=-1) : Vector.<Number> 
    9393        { 
    9494            var wave:ByteArray = new ByteArray(), i:int, imax:int; 
     
    9696            if (dst == null) dst = new Vector.<Number>(); 
    9797            wave.position = 0; 
    98             if (channelCount == 2) { 
     98            if (dstChannelCount == 2) { 
    9999                // stereo 
    100100                imax = wave.length >> 2; 
     
    111111                } 
    112112            } 
     113            return dst; 
     114        } 
     115         
     116         
     117        /** extract ADPCM data 
     118         *  @param src The ADPCM ByteArray data extracting from.  
     119         *  @param dst The Vector.<Number> instance to put result. You can pass null to create new Vector.<Number> inside. 
     120         *  @param dstChannelCount channel count of extracted data. 1 for monoral, 2 for stereo. 
     121         *  @return extracted data. 
     122         */ 
     123        static public function extractADPCM(src:ByteArray, dst:Vector.<Number>=null, dstChannelCount:int=1) : Vector.<Number> 
     124        { 
     125            var data:int, r0:int, r1:int, i:int, imax:int,  
     126                predRate:int = 127, output:int = 0; 
     127         
     128            // chaging ratio table 
     129            var crTable:Vector.<int> = Vector.<int>([1,3,5,7,9,11,13,15,-1,-3,-5,-7,-9,-11,-13,-15]); 
     130            // prediction updating table 
     131            var puTable:Vector.<int> = Vector.<int>([57,57,57,57,77,102,128,153,57,57,57,57,77,102,128,153]); 
     132             
     133            imax = src.length * 2; 
     134            if (dst == null) dst = new Vector.<Number>(); 
     135            dst.length = imax; 
     136             
     137            for (i=0; i<imax;) { 
     138                data = src.readUnsignedByte(); 
     139                r0 = (data >> 4) & 0x0f; 
     140                r1 = data & 0x0f; 
     141                 
     142                predRate = (predRate * crTable[r0]) >> 3; 
     143                output += predRate; 
     144                dst[i] = output * 0.000030517578125; 
     145                predRate = (predRate * puTable[r0]) >> 6; 
     146                     if (predRate < 127)   predRate = 127; 
     147                else if (predRate > 24576) predRate = 24576; 
     148                i++; 
     149                 
     150                predRate = (predRate * crTable[r1]) >> 3; 
     151                output += predRate; 
     152                dst[i] = output * 0.000030517578125; 
     153                predRate = (predRate * puTable[r1]) >> 6; 
     154                     if (predRate < 127)   predRate = 127; 
     155                else if (predRate > 24576) predRate = 24576; 
     156                i++; 
     157            } 
     158             
    113159            return dst; 
    114160        }