チェンジセット 2903
- コミット日時:
- 2009/07/06 00:31:22 (3 年前)
- ファイル:
-
- as3/SiOPM/trunk/src/org/si/sion/SiONData.as (更新) (3 diffs)
- as3/SiOPM/trunk/src/org/si/sion/SiONDriver.as (更新) (10 diffs)
- as3/SiOPM/trunk/src/org/si/sion/effector/SiEffectStereoReverb.as (更新) (2 diffs)
- as3/SiOPM/trunk/src/org/si/sion/effector/SiEffectWaveShaper.as (更新) (4 diffs)
- as3/SiOPM/trunk/src/org/si/sion/module/SiOPMChannelFM.as (更新) (6 diffs)
- as3/SiOPM/trunk/src/org/si/sion/module/SiOPMChannelSampler.as (更新) (1 diff)
- as3/SiOPM/trunk/src/org/si/sion/module/SiOPMOperator.as (更新) (4 diffs)
- as3/SiOPM/trunk/src/org/si/sion/module/SiOPMPCMData.as (更新) (3 diffs)
- as3/SiOPM/trunk/src/org/si/sion/module/SiOPMTable.as (更新) (2 diffs)
- as3/SiOPM/trunk/src/org/si/sion/module/SiOPMWaveTable.as (更新) (1 diff)
- as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLChannelSetting.as (更新) (1 diff)
- as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLSequencer.as (更新) (4 diffs)
- as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLTrack.as (更新) (2 diffs)
- as3/SiOPM/trunk/src/org/si/sion/sequencer/base/MMLData.as (更新) (5 diffs)
- as3/SiOPM/trunk/src/org/si/sion/utils/SiONUtil.as (更新) (1 diff)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/SiOPM/trunk/src/org/si/sion/SiONData.as
r2806 r2903 11 11 import org.si.sion.utils.SiONUtil; 12 12 import org.si.sion.module.SiOPMPCMData; 13 import org.si.sion.module.SiOPMSamplerData; 13 14 14 15 … … 39 40 * @param samplingOctave Sampling frequency. The value of 5 means that "o5a" is original frequency. 40 41 * @param sampleMax The maximum sample count to extract. The length of returning vector is limited by this value. 42 * @return created instance 41 43 */ 42 public function setPCMSound(index:int, sound:Sound, samplingOctave:int=5, sampleMax:int=1048576) : void44 public function setPCMSound(index:int, sound:Sound, samplingOctave:int=5, sampleMax:int=1048576) : SiOPMPCMData 43 45 { 44 46 var pcm:Vector.<int> = SiONUtil.logTrans(sound, null, sampleMax); 45 47 pcmData[index] = SiOPMPCMData.alloc(pcm, samplingOctave); 48 return pcmData[index]; 46 49 } 47 50 … … 53 56 * @param channelCount 1 for monoral, 2 for stereo. 54 57 * @param sampleMax The maximum sample count to extract. The length of returning vector is limited by this value. 58 * @return created instance 55 59 */ 56 public function setSamplerSound(index:int, sound:Sound, isOneShot:Boolean=true, channelCount:int=2, sampleMax:int=1048576) : void60 public function setSamplerSound(index:int, sound:Sound, isOneShot:Boolean=true, channelCount:int=2, sampleMax:int=1048576) : SiOPMSamplerData 57 61 { 58 62 var data:Vector.<Number> = SiONUtil.extract(sound, null, channelCount, sampleMax); 59 setSamplerData(index, data, isOneShot, channelCount);63 return setSamplerData(index, data, isOneShot, channelCount); 60 64 } 61 65 } as3/SiOPM/trunk/src/org/si/sion/SiONDriver.as
r2806 r2903 24 24 import org.si.sion.module.SiOPMModule; 25 25 import org.si.sion.module.SiOPMChannelParam; 26 import org.si.sion.module.SiOPMWaveTable; 27 import org.si.sion.module.SiOPMPCMData; 28 import org.si.sion.module.SiOPMSamplerData; 26 29 import org.si.sion.effector.SiEffectModule; 27 30 import org.si.sion.utils.SiONUtil; … … 50 53 //---------------------------------------- 51 54 /** version number */ 52 static public const VERSION:String = "0.5. 4";55 static public const VERSION:String = "0.5.5"; 53 56 54 57 … … 275 278 * @see #NEM_OVERWRITE 276 279 * @see #NEM_SHIFT 277 * @see #NEM_SHIFT_OVERWRITE278 280 */ 279 281 public function get noteOnExceptionMode() : int { return _noteOnExceptionMode; } … … 561 563 _soundChannel = null; 562 564 _latency = 0; 565 _fader.stop(); 563 566 _faderVolume = 1; 564 567 _soundTransform.volume = _masterVolume; … … 628 631 * @param table wave shape vector ranges in -1 to 1. 629 632 */ 630 public function setWaveTable(index:int, table:Vector.<Number>) : void633 public function setWaveTable(index:int, table:Vector.<Number>) : SiOPMWaveTable 631 634 { 632 635 var len:int, bits:int=-1; 633 636 for (len=table.length; len>0; len>>=1) bits++; 634 if (bits<2) return ;637 if (bits<2) return null; 635 638 var waveTable:Vector.<int> = SiONUtil.logTransVector(table); 636 639 waveTable.length = 1<<bits; 637 SiOPMTable.registerWaveTable(index, waveTable);640 return SiOPMTable.registerWaveTable(index, waveTable); 638 641 } 639 642 … … 646 649 * @see #render() 647 650 */ 648 public function setPCMData(index:int, data:Vector.<Number>, isDataStereo:Boolean=true, samplingOctave:int=5) : void651 public function setPCMData(index:int, data:Vector.<Number>, isDataStereo:Boolean=true, samplingOctave:int=5) : SiOPMPCMData 649 652 { 650 653 var pcm:Vector.<int> = SiONUtil.logTransVector(data, isDataStereo); 651 SiOPMTable.registerPCMData(index, pcm, samplingOctave);654 return SiOPMTable.registerPCMData(index, pcm, samplingOctave); 652 655 } 653 656 … … 659 662 * @param sampleMax The maximum sample count to extract. The length of returning vector is limited by this value. 660 663 */ 661 public function setPCMSound(index:int, sound:Sound, samplingOctave:int=5, sampleMax:int=1048576) : void664 public function setPCMSound(index:int, sound:Sound, samplingOctave:int=5, sampleMax:int=1048576) : SiOPMPCMData 662 665 { 663 666 var data:Vector.<int> = SiONUtil.logTrans(sound, null, sampleMax); 664 SiOPMTable.registerPCMData(index, data, samplingOctave);667 return SiOPMTable.registerPCMData(index, data, samplingOctave); 665 668 } 666 669 … … 673 676 * @see #render() 674 677 */ 675 public function setSamplerData(index:int, data:Vector.<Number>, isOneShot:Boolean=true, channelCount:int=1) : void676 { 677 SiOPMTable.registerSamplerData(index, data, isOneShot, channelCount);678 public function setSamplerData(index:int, data:Vector.<Number>, isOneShot:Boolean=true, channelCount:int=1) : SiOPMSamplerData 679 { 680 return SiOPMTable.registerSamplerData(index, data, isOneShot, channelCount); 678 681 } 679 682 … … 686 689 * @param sampleMax The maximum sample count to extract. The length of returning vector is limited by this value. 687 690 */ 688 public function setSamplerSound(index:int, sound:Sound, isOneShot:Boolean=true, channelCount:int=2, sampleMax:int=1048576) : void691 public function setSamplerSound(index:int, sound:Sound, isOneShot:Boolean=true, channelCount:int=2, sampleMax:int=1048576) : SiOPMSamplerData 689 692 { 690 693 var data:Vector.<Number> = SiONUtil.extract(sound, null, channelCount, sampleMax); 691 SiOPMTable.registerSamplerData(index, data, isOneShot, channelCount);694 return SiOPMTable.registerSamplerData(index, data, isOneShot, channelCount); 692 695 } 693 696 … … 1296 1299 1297 1300 private function errorDriverBusy(execID:int) : Error { 1298 var states:Array = [" compiling", "streaming", "rendering"];1301 var states:Array = ["???", "compiling", "streaming", "rendering"]; 1299 1302 return new Error("SiONDriver error: Driver busy. Call " + states[execID] + " while " + states[_listenEvent] + "."); 1300 1303 } as3/SiOPM/trunk/src/org/si/sion/effector/SiEffectStereoReverb.as
r2697 r2903 41 41 * @param feedback feedback decay(-1-1). Negative value to invert phase. 42 42 */ 43 public function setParameters(delay1:Number=0. 55, delay2:Number=0.15, feedback:Number=0.9) : void {43 public function setParameters(delay1:Number=0.7, delay2:Number=0.4, feedback:Number=0.8) : void { 44 44 if (delay1<0.01) delay1=0.01; 45 45 else if (delay1>0.99) delay1=0.99; … … 71 71 override public function mmlCallback(args:Vector.<Number>) : void 72 72 { 73 setParameters((!isNaN(args[1])) ? (args[1]*0.01) : 0. 55,74 (!isNaN(args[1])) ? (args[1]*0.01) : 0. 15,75 (!isNaN(args[2])) ? (args[2]*0.01) : 0. 9);73 setParameters((!isNaN(args[1])) ? (args[1]*0.01) : 0.7, 74 (!isNaN(args[1])) ? (args[1]*0.01) : 0.4, 75 (!isNaN(args[2])) ? (args[2]*0.01) : 0.8); 76 76 } 77 77 as3/SiOPM/trunk/src/org/si/sion/effector/SiEffectWaveShaper.as
r2806 r2903 12 12 //------------------------------------------------------------ 13 13 private var _coefficient:int; 14 private var _outputLevel:Number; 14 15 15 16 … … 23 24 24 25 26 25 27 // operations 26 28 //------------------------------------------------------------ 27 29 /** set parameters 28 30 * @param distortion distortion(0-1). 31 * @param outputLevel output level(0-1). 29 32 */ 30 public function setParameters(distortion:Number=0.5 ) : void {33 public function setParameters(distortion:Number=0.5, outputLevel:Number=1.0) : void { 31 34 if (distortion >= 1) distortion = 0.9999847412109375; //65535/65536 32 35 _coefficient = 2*distortion/(1-distortion); 36 _outputLevel = outputLevel; 33 37 } 34 38 … … 48 52 override public function mmlCallback(args:Vector.<Number>) : void 49 53 { 50 setParameters((!isNaN(args[0])) ? args[0]*0.01 : 0.5); 54 setParameters((!isNaN(args[0])) ? args[0]*0.01 : 0.5, 55 (!isNaN(args[0])) ? args[0]*0.01 : 1.0); 51 56 } 52 57 … … 64 69 startIndex <<= 1; 65 70 length <<= 1; 66 var i:int, n:Number, c1:Number= 1 + _coefficient, imax:int=startIndex+length;71 var i:int, n:Number, c1:Number=(1 + _coefficient)*_outputLevel, imax:int=startIndex+length; 67 72 for (i=startIndex; i<imax; i++) { 68 73 n = buffer[i]; as3/SiOPM/trunk/src/org/si/sion/module/SiOPMChannelFM.as
r2697 r2903 395 395 //-------------------------------------------------- 396 396 /** pitch = (note << 6) | (kf & 63) [0,8191] */ 397 override public function get pitch() : int { return operator[0].pitchIndex; } 398 override public function set pitch(p:int) : void 399 { 397 override public function get pitch() : int { return operator[_operatorCount-1].pitchIndex; } 398 override public function set pitch(p:int) : void { 400 399 for (var i:int=0; i<_operatorCount; i++) { 401 400 operator[i].pitchIndex = p; … … 404 403 405 404 /** active operator index (i) */ 406 override public function set activeOperatorIndex(i:int) : void 407 { 405 override public function set activeOperatorIndex(i:int) : void { 408 406 var opeIndex:int = (i<0) ? 0 : (i>=_operatorCount) ? (_operatorCount-1) : i; 409 407 activeOperator = operator[opeIndex]; … … 1080 1078 var t:int, l:int, i:int, n:Number; 1081 1079 var ope:SiOPMOperator = operator[0], 1082 phase_filter:int = SiOPMTable.PHASE_FILTER, 1083 tmax:int = ope._waveTable.length; 1080 phase_filter:int = SiOPMTable.PHASE_FILTER; 1084 1081 1085 1082 … … 1111 1108 //---------------------------------------- 1112 1109 ope._phase += ope._phase_step; 1113 t = (ope._phase + (ip.i<<_inputLevel)) >> 14; // pcm._waveFixedBits = 14 1114 if (t >= tmax) { 1115 ope._eg_shiftState(SiOPMOperator.EG_OFF); 1116 ope._eg_out = (ope._eg_levelTable[ope._eg_level] + ope._eg_total_level)<<3; 1117 for (;i<len; i++) { 1118 op.i = bp.i; 1119 ip = ip.next; 1120 bp = bp.next; 1121 op = op.next; 1110 t = (ope._phase + (ip.i<<_inputLevel)) >>> ope._waveFixedBits; 1111 if (t >= ope._pcm_endPoint) { 1112 if (ope._pcm_loopPoint == -1) { 1113 ope._eg_shiftState(SiOPMOperator.EG_OFF); 1114 ope._eg_out = (ope._eg_levelTable[ope._eg_level] + ope._eg_total_level)<<3; 1115 for (;i<len; i++) { 1116 op.i = bp.i; 1117 ip = ip.next; 1118 bp = bp.next; 1119 op = op.next; 1120 } 1121 break; 1122 } else { 1123 t -= ope._pcm_endPoint - ope._pcm_loopPoint; 1124 ope._phase -= (ope._pcm_endPoint - ope._pcm_loopPoint) << ope._waveFixedBits; 1122 1125 } 1123 break;1124 1126 } 1125 1127 l = ope._waveTable[t]; … … 1147 1149 var t:int, l:int, i:int, n:Number; 1148 1150 var ope:SiOPMOperator = operator[0], 1149 phase_filter:int = SiOPMTable.PHASE_FILTER, 1150 tmax:int = ope._waveTable.length; 1151 phase_filter:int = SiOPMTable.PHASE_FILTER; 1151 1152 1152 1153 // buffering … … 1190 1191 //---------------------------------------- 1191 1192 ope._phase += ope._phase_step; 1192 t = (ope._phase + (ip.i<<_inputLevel)) >> 14; // pcm._waveFixedBits = 14 1193 if (t >= tmax) { 1194 ope._eg_shiftState(SiOPMOperator.EG_OFF); 1195 ope._eg_out = (ope._eg_levelTable[ope._eg_level] + ope._eg_total_level)<<3; 1196 for (;i<len; i++) { 1197 op.i = bp.i; 1198 ip = ip.next; 1199 bp = bp.next; 1200 op = op.next; 1193 t = (ope._phase + (ip.i<<_inputLevel)) >>> ope._waveFixedBits; 1194 if (t >= ope._pcm_endPoint) { 1195 if (ope._pcm_loopPoint == -1) { 1196 ope._eg_shiftState(SiOPMOperator.EG_OFF); 1197 ope._eg_out = (ope._eg_levelTable[ope._eg_level] + ope._eg_total_level)<<3; 1198 for (;i<len; i++) { 1199 op.i = bp.i; 1200 ip = ip.next; 1201 bp = bp.next; 1202 op = op.next; 1203 } 1204 break; 1205 } else { 1206 t -= ope._pcm_endPoint - ope._pcm_loopPoint; 1207 ope._phase -= (ope._pcm_endPoint - ope._pcm_loopPoint) << ope._waveFixedBits; 1201 1208 } 1202 break;1203 1209 } 1204 1210 l = ope._waveTable[t]; as3/SiOPM/trunk/src/org/si/sion/module/SiOPMChannelSampler.as
r2697 r2903 229 229 _chip.streamBuffer[0].writeVectorInt(_sample, _sampleIndex, _bufferIndex, procLen, vol, _pan, _sampleChannelCount); 230 230 } 231 if ( len > procLen) {231 if (procLen < len) { 232 232 _isIdling = true; 233 233 _sample = null; as3/SiOPM/trunk/src/org/si/sion/module/SiOPMOperator.as
r2806 r2903 174 174 internal var _feedPipe:SLLint; 175 175 176 // for PCM wave 177 /** @private start point */ 178 internal var _pcm_startPoint:int; 179 /** @private end point */ 180 internal var _pcm_endPoint:int; 181 /** @private loop point */ 182 internal var _pcm_loopPoint:int; 176 183 177 184 … … 446 453 _eg_tl_offset = 0; // The _eg_tl_offset is controled by velocity and expression. 447 454 _pitchIndexShift2 = 0; // The _pitchIndexShift2 is controled by pitch modulation. 455 _pcm_startPoint = 0; 456 _pcm_endPoint = 0; 457 _pcm_loopPoint = -1; 448 458 449 459 // reset pg and eg status … … 549 559 { 550 560 _pgType = SiOPMTable.PG_USER_PCM; // -2 551 _waveTable = pcmData.wavelet; 552 _waveFixedBits = pcmData.pseudoFixedBits; 561 _waveTable = pcmData.wavelet; 562 _waveFixedBits = pcmData.pseudoFixedBits; 563 _pcm_startPoint = pcmData.startPoint; 564 _pcm_endPoint = pcmData.endPoint; 565 _pcm_loopPoint = pcmData.loopPoint; 566 _keyon_phase = _pcm_startPoint << _waveFixedBits; 553 567 ptType = SiOPMTable.PT_PCM; 554 568 } … … 743 757 var n:int = (_pitchIndex + _pitchIndexShift + _pitchIndexShift2) & _pitchTableFilter; 744 758 _updatePhaseStep(_pitchTable[n] >> _wavePhaseStepShift); 745 trace(_pitchTable[n], _wavePhaseStepShift);746 759 } 747 760 as3/SiOPM/trunk/src/org/si/sion/module/SiOPMPCMData.as
r2697 r2903 1 1 //---------------------------------------------------------------------------------------------------- 2 // class for SiOPM wave table2 // class for SiOPM PCM data 3 3 // Copyright (c) 2008 keim All rights reserved. 4 4 // Distributed under BSD-style license (see org.si.license.txt). … … 6 6 7 7 package org.si.sion.module { 8 /** PCM data class */ 8 9 public class SiOPMPCMData 9 10 { 11 // valiables 12 //---------------------------------------- 13 /** wave data */ 10 14 public var wavelet:Vector.<int>; 15 16 /** bits for fixed decimal */ 11 17 public var pseudoFixedBits:int; 18 19 /** wave starting position. */ 20 public var startPoint:int; 21 22 /** wave end position. */ 23 public var endPoint:int; 24 25 /** wave looping position. -1 means no repeat. */ 12 26 public var loopPoint:int; 13 27 14 28 15 function SiOPMPCMData(data:Vector.<Number>=null, samplingOctave:int=5) 29 30 31 // oprations 32 //---------------------------------------- 33 /** Constructor */ 34 function SiOPMPCMData(wavelet:Vector.<int>=null, samplingOctave:int=5, startPoint:int=0, endPoint:int=-1, loopPoint:int=-1) 16 35 { 17 wavelet = null; 18 pseudoFixedBits = 0; 19 loopPoint = -1; 36 this.wavelet = wavelet; 37 this.pseudoFixedBits = 11 + (samplingOctave-5); 38 if (wavelet != null) { 39 slice(startPoint, endPoint, loopPoint); 40 } else { 41 this.loopPoint = -1; 42 this.startPoint = 0; 43 this.endPoint = 0; 44 } 20 45 } 21 46 22 47 48 /** Free instance. Through this into free list. */ 23 49 public function free() : void 24 50 { … … 26 52 } 27 53 54 55 /** Slicer setting. You can cut samples and set repeating. 56 * @param startPoint slicing point to start data. 57 * @param endPoint slicing point to end data. The negative value calculates from the end. 58 * @param loopPoint slicing point to repeat data. -1 means no repeat 59 */ 60 public function slice(startPoint:int=0, endPoint:int=-1, loopPoint:int=-1) : void 61 { 62 if (endPoint < 0) endPoint = wavelet.length + endPoint; 63 if (wavelet.length < endPoint) endPoint = endPoint; 64 if (endPoint < loopPoint) loopPoint = -1; 65 if (endPoint < startPoint) endPoint = endPoint; 66 this.startPoint = startPoint; 67 this.endPoint = endPoint; 68 this.loopPoint = loopPoint; 69 } 28 70 71 72 // free list 29 73 static private var _freeList:Vector.<SiOPMPCMData> = new Vector.<SiOPMPCMData>(); 30 74 75 76 /** @private */ 31 77 static public function alloc(wavelet:Vector.<int>, samplingOctave:int=5) : SiOPMPCMData 32 78 { 33 79 var newInstance:SiOPMPCMData = _freeList.pop() || new SiOPMPCMData(); 34 80 newInstance.wavelet = wavelet; 35 newInstance.pseudoFixedBits = 1 4+ (samplingOctave-5);81 newInstance.pseudoFixedBits = 11 + (samplingOctave-5); 36 82 newInstance.loopPoint = -1; 83 newInstance.startPoint = 0; 84 newInstance.endPoint = wavelet.length; 37 85 return newInstance; 38 86 } as3/SiOPM/trunk/src/org/si/sion/module/SiOPMTable.as
r2806 r2903 1049 1049 1050 1050 /** Register wave table. */ 1051 static public function registerWaveTable(index:int, table:Vector.<int>) : void1051 static public function registerWaveTable(index:int, table:Vector.<int>) : SiOPMWaveTable 1052 1052 { 1053 1053 // register wave table … … 1061 1061 instance.waveTables[15 + index * 8 + PG_MA3_WAVE] = newWaveTable; 1062 1062 } 1063 1064 return newWaveTable; 1063 1065 } 1064 1066 1065 1067 1066 1068 /** Register PCM data. */ 1067 static public function registerPCMData(index:int, table:Vector.<int>, samplingOctave:int) : void1069 static public function registerPCMData(index:int, table:Vector.<int>, samplingOctave:int) : SiOPMPCMData 1068 1070 { 1069 1071 // register PCM data 1070 1072 index &= PCM_DATA_MAX-1; 1071 1073 instance.pcmData[index] = SiOPMPCMData.alloc(table, samplingOctave); 1074 return instance.pcmData[index]; 1072 1075 } 1073 1076 1074 1077 1075 1078 /** Register Sampler data. */ 1076 static public function registerSamplerData(index:int, table:Vector.<Number>, isOneShot:Boolean, channelCount:int) : void1079 static public function registerSamplerData(index:int, table:Vector.<Number>, isOneShot:Boolean, channelCount:int) : SiOPMSamplerData 1077 1080 { 1078 1081 // register sample 1079 1082 index &= SAMPLER_DATA_MAX-1; 1080 1083 instance.samplerData[index] = SiOPMSamplerData.alloc(table, isOneShot, channelCount); 1084 return instance.samplerData[index]; 1081 1085 } 1082 1086 as3/SiOPM/trunk/src/org/si/sion/module/SiOPMWaveTable.as
r2806 r2903 33 33 34 34 /** allocate. */ 35 static public function alloc(wavelet:Vector.<int>, defaultPTType:int= SiOPMTable.PT_OPM) : SiOPMWaveTable35 static public function alloc(wavelet:Vector.<int>, defaultPTType:int=0) : SiOPMWaveTable 36 36 { 37 37 var len:int, bits:int=0; as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLChannelSetting.as
r2806 r2903 85 85 track.channelNumber = (chNum<0) ? 0 : chNum; 86 86 track.channel.setAlgorism(1, 0); 87 track.channel.setType(_pgTypeList[channelTone], _ptTypeList[channelTone]);87 selectTone(track, channelTone); 88 88 return (chNum == -1) ? -1 : channelTone; 89 89 } as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLSequencer.as
r2806 r2903 143 143 setMMLEventListener(MMLEvent.OUTPUT_PIPE, _onOutput); 144 144 newMMLEventListener('%t', _setEventTrigger); 145 newMMLEventListener('%e', _ setEffectTrigger);145 newMMLEventListener('%e', _dispatchEvent); 146 146 147 147 // operator setting … … 1065 1065 private function _onPitchBend(e:MMLEvent) : MMLEvent 1066 1066 { 1067 if (e.next == null || e.next.id != MMLEvent.NOTE) return e.next; // check next note1068 var term:int = calcSampleCount(e.length); // changing time1069 _currentTrack.setPitchBend(e.next.data, term); // pitch bending1067 if (e.next == null || e.next.id != MMLEvent.NOTE) return e.next; // check next note 1068 var term:int = calcSampleCount(e.length); // changing time 1069 _currentTrack.setPitchBend(e.next.data, term); // pitch bending 1070 1070 return currentExecutor.publishProessingEvent(e); 1071 1071 } … … 1429 1429 var id :int = (_p[0] != int.MIN_VALUE) ? _p[0] : 0; 1430 1430 var typeOn :int = (_p[1] != int.MIN_VALUE) ? _p[1] : 1; 1431 var typeOff:int = (_p[2] != int.MIN_VALUE) ? _p[2] : 0;1431 var typeOff:int = (_p[2] != int.MIN_VALUE) ? _p[2] : 1; 1432 1432 _currentTrack.setEventTrigger(id, typeOn, typeOff); 1433 1433 return e.next; … … 1436 1436 1437 1437 // %e 1438 private function _setEffectTrigger(e:MMLEvent) : MMLEvent 1439 { 1440 e = e.getParameters(_p, 2); 1438 private function _dispatchEvent(e:MMLEvent) : MMLEvent 1439 { 1440 e = e.getParameters(_p, 2); 1441 var id :int = (_p[0] != int.MIN_VALUE) ? _p[0] : 0; 1442 var typeOn :int = (_p[1] != int.MIN_VALUE) ? _p[1] : 1; 1443 _currentTrack.dispatchNoteOnEvent(id, typeOn); 1441 1444 return e.next; 1442 1445 } as3/SiOPM/trunk/src/org/si/sion/sequencer/SiMMLTrack.as
r2806 r2903 513 513 _callbackBeforeNoteOn = (noteOnType) ? _eventTriggerOn : null; 514 514 _callbackBeforeNoteOff = (noteOffType) ? _eventTriggerOff : null; 515 } 516 517 518 /** dispatch note on event once (%e) 519 * @param id Event trigger ID of this track. This value can be refered from SiONTrackEvent.eventTriggerID. 520 * @param noteOnType Dispatching event type at note on. 0=no events, 1=NOTE_ON_FRAME, 2=NOTE_ON_STREAM, 3=both. 521 * @see org.si.sion.events.SiONTrackEvent 522 */ 523 public function dispatchNoteOnEvent(id:int, noteOnType:int=1) : void 524 { 525 if (noteOnType) { 526 var currentTID:int = _eventTriggerID, 527 currentType:int = _eventTriggerTypeOn; 528 _eventTriggerID = id; 529 _eventTriggerTypeOn = noteOnType; 530 _eventTriggerOn(this, 0); 531 _eventTriggerID = currentTID; 532 _eventTriggerTypeOn = currentType; 533 } 515 534 } 516 535 … … 959 978 internal function _setNote(note:int, length:int) : void 960 979 { 961 keyOn(note, int(length * quantRatio) - quantCount - keyOnDelay + 1); 980 length = int(length * quantRatio) - quantCount - keyOnDelay; 981 if (length < 1) length = 1; 982 keyOn(note, length); 962 983 } 963 984 as3/SiOPM/trunk/src/org/si/sion/sequencer/base/MMLData.as
r2697 r2903 111 111 * @param index wave table number. 112 112 * @param data Vector.<Number> wave shape data ranged from -1 to 1. 113 * @return created data instance 113 114 */ 114 public function setWaveTable(index:int, data:Vector.<Number>) : void115 public function setWaveTable(index:int, data:Vector.<Number>) : SiOPMWaveTable 115 116 { 116 117 index &= SiOPMTable.WAVE_TABLE_MAX-1; … … 119 120 for (i=0; i<imax; i++) table[i] = SiOPMTable.calcLogTableIndex(data[i]); 120 121 waveTables[index] = SiOPMWaveTable.alloc(table); 122 return waveTables[index]; 121 123 } 122 124 … … 127 129 * @param isDataStereo Flag that the wave data is stereo or monoral. 128 130 * @param samplingOctave Sampling frequency. The value of 5 means that "o5a" is original frequency. 131 * @return created data instance 129 132 * @see #org.si.sion.SiONDriver.render() 130 133 */ 131 public function setPCMData(index:int, data:Vector.<Number>, isDataStereo:Boolean=true, samplingOctave:int=5) : void134 public function setPCMData(index:int, data:Vector.<Number>, isDataStereo:Boolean=true, samplingOctave:int=5) : SiOPMPCMData 132 135 { 133 136 index &= SiOPMTable.PCM_DATA_MAX-1; … … 150 153 } 151 154 pcmData[index] = SiOPMPCMData.alloc(pcm, samplingOctave); 155 return pcmData[index]; 152 156 } 153 157 … … 158 162 * @param isOneShot True to set "one shot" sound. The "one shot" sound ignores note off. 159 163 * @param channelCount 1 for monoral, 2 for stereo. 164 * @return created data instance 160 165 * @see #org.si.sion.SiONDriver.render() 161 166 */ 162 public function setSamplerData(index:int, data:Vector.<Number>, isOneShot:Boolean=true, channelCount:int=2) : void167 public function setSamplerData(index:int, data:Vector.<Number>, isOneShot:Boolean=true, channelCount:int=2) : SiOPMSamplerData 163 168 { 164 169 index &= SiOPMTable.SAMPLER_DATA_MAX-1; 165 170 samplerData[index] = new SiOPMSamplerData(data, isOneShot, channelCount); 171 return samplerData[index]; 166 172 } 167 173 } as3/SiOPM/trunk/src/org/si/sion/utils/SiONUtil.as
r2697 r2903 111 111 return dst; 112 112 } 113 114 115 /** Calculate sample length from 16th beat. */ 116 static public function calcSampleLength(bpm:Number, beat16:Number) : Number 117 { 118 // 661500 = 44100*60/4 119 return beat16 * 661500 / bpm; 120 } 113 121 } 114 122 }

