チェンジセット 3516
- コミット日時:
- 2010/03/11 02:32:19 (2 年前)
- ファイル:
-
- as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLSequencer.as (更新) (2 diffs)
- as3/SiOPM/trunk/src/org/si/sion/utils/SiONUtil.as (更新) (3 diffs)
- as3/SiOPM/trunk/src/org/si/sound/mdx (追加)
- as3/SiOPM/trunk/src/org/si/sound/mdx/MDXData.as (追加)
- as3/SiOPM/trunk/src/org/si/sound/mdx/MDXEvent.as (追加)
- as3/SiOPM/trunk/src/org/si/sound/mdx/MDXTrack.as (追加)
- as3/SiOPM/trunk/src/org/si/sound/mdx/PDXData.as (追加)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLSequencer.as
r3480 r3516 207 207 newMMLEventListener('!na', _onAmplitudeEnvTSSCP); 208 208 newMMLEventListener('po', _onPortament); 209 210 // global event 211 newMMLEventListener('@fadeout', _onFadeOut, true); 209 212 210 213 // processing events … … 1596 1599 } 1597 1600 1601 1602 // @fadeout 1603 private function _onFadeOut(e:MMLEvent) : MMLEvent 1604 { 1605 return e.next; 1606 } 1598 1607 1599 1608 as3/SiOPM/trunk/src/org/si/sion/utils/SiONUtil.as
r3450 r3516 85 85 * @param src The Sound data extracting from. 86 86 * @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. 88 88 * @param length The maximum sample count to extract. The length of returning vector is limited by this value. 89 89 * @param startPosition Start position to extract. -1 to set extraction continuously. 90 90 * @return extracted data. 91 91 */ 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> 93 93 { 94 94 var wave:ByteArray = new ByteArray(), i:int, imax:int; … … 96 96 if (dst == null) dst = new Vector.<Number>(); 97 97 wave.position = 0; 98 if ( channelCount == 2) {98 if (dstChannelCount == 2) { 99 99 // stereo 100 100 imax = wave.length >> 2; … … 111 111 } 112 112 } 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 113 159 return dst; 114 160 }

