Changeset 32952 for lang/actionscript

Show
Ignore:
Timestamp:
04/30/09 00:46:36 (3 years ago)
Author:
tekisuke
Message:

@x エクスプレッション(0-127)を追加しました。

Location:
lang/actionscript/flmml/trunk/src
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • lang/actionscript/flmml/trunk/src/com/txt_nifty/sketch/flmml/MChannel.as

    r30714 r32952  
    88        private var m_envelope1:MEnvelope;     // for VCO 
    99        private var m_envelope2:MEnvelope;     // for VCF 
    10         private var m_oscSet1:MOscillator;         // for original wave 
     10        private var m_oscSet1:MOscillator;     // for original wave 
    1111        private var m_oscMod1:MOscMod; 
    12         private var m_oscSet2:MOscillator;         // for Pitch LFO 
     12        private var m_oscSet2:MOscillator;     // for Pitch LFO 
    1313        private var m_oscMod2:MOscMod; 
    1414        private var m_osc2Connect:int; 
     
    1717        private var m_filterConnect:int; 
    1818        private var m_formant:MFormant; 
    19         private var m_velocity:Number;    // velocity (max:1.0) 
     19        private var m_expression:Number;       // expression (max:1.0) 
     20        private var m_velocity:Number;         // velocity (max:1.0) 
     21        private var m_ampLevel:Number;         // amplifier level (max:1.0) 
    2022        private var m_panL:Number; 
    2123        private var m_panR:Number; 
     
    5860            m_filterConnect = 0; 
    5961            m_formant = new MFormant(); 
    60             m_velocity = 100.0 / 127.0; 
     62            m_volMode  = 0; 
     63            setExpression(127); 
     64            setVelocity(100); 
    6165            setPan(64); 
    6266            m_onCounter = 0; 
     
    6771            m_lpfFrq   = 0; 
    6872            m_lpfRes   = 0; 
    69             m_volMode  = 0; 
    7073            setInput(0, 0); 
    7174            setOutput(0, 0); 
     
    101104            freqNo = (freqNo < 0) ? 0 : (freqNo >= s_frequencyLen) ? s_frequencyLen-1 : freqNo; 
    102105            return s_frequencyMap[freqNo]; 
     106        } 
     107        public function setExpression(ex:int):void { 
     108            m_expression = (m_volMode) ? s_volumeMap[ex] : ex / 127.0; 
     109            m_ampLevel = m_velocity * m_expression; 
     110        } 
     111        public function setVelocity(velocity:int):void { 
     112            m_velocity = (m_volMode) ? s_volumeMap[velocity] : velocity / 127.0; 
     113            m_ampLevel = m_velocity * m_expression; 
    103114        } 
    104115        public function setNoteNo(noteNo:int):void { 
     
    119130            m_oscMod2.resetPhase(); 
    120131            m_filter.reset(); 
    121             m_velocity = (m_volMode) ? s_volumeMap[velocity] : velocity / 127.0; 
     132            setVelocity(velocity); 
    122133            m_onCounter = 0; 
    123134 
     
    244255                    // no input, no LFO 
    245256                    m_oscMod1.getSamples(s_samples, start, end); 
    246                     if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, start, end, m_velocity); 
    247                     else m_envelope1.ampSamplesNonLinear(s_samples, start, end, m_velocity); 
     257                    if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, start, end, m_ampLevel); 
     258                    else m_envelope1.ampSamplesNonLinear(s_samples, start, end, m_ampLevel); 
    248259                } 
    249260                else { 
     
    261272                        m_oscMod1.setFrequency(getFrequency(freqNo)); 
    262273                        m_oscMod1.getSamples(s_samples, s, e); 
    263                         if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, s, e, m_velocity); 
    264                         else m_envelope1.ampSamplesNonLinear(s_samples, s, e, m_velocity); 
     274                        if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, s, e, m_ampLevel); 
     275                        else m_envelope1.ampSamplesNonLinear(s_samples, s, e, m_ampLevel); 
    265276                        m_onCounter += e - s; 
    266277                        s = e; 
     
    278289                        s_samples[i] = m_oscMod1.getNextSampleOfs(s_pipeArr[m_inPipe][i] * m_inSens); 
    279290                    } 
    280                     if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, start, end, m_velocity); 
    281                     else m_envelope1.ampSamplesNonLinear(s_samples, start, end, m_velocity); 
     291                    if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, start, end, m_ampLevel); 
     292                    else m_envelope1.ampSamplesNonLinear(s_samples, start, end, m_ampLevel); 
    282293                } 
    283294                else { 
     
    292303                        m_onCounter++; 
    293304                    } 
    294                     if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, start, end, m_velocity); 
    295                     else m_envelope1.ampSamplesNonLinear(s_samples, start, end, m_velocity); 
     305                    if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, start, end, m_ampLevel); 
     306                    else m_envelope1.ampSamplesNonLinear(s_samples, start, end, m_ampLevel); 
    296307                } 
    297308            } 
  • lang/actionscript/flmml/trunk/src/com/txt_nifty/sketch/flmml/MEvent.as

    r29200 r32952  
    4242        public function setInput(sens:int, pipe:int):void     { set(MStatus.INPUT, sens, pipe); } 
    4343        public function setOutput(mode:int, pipe:int):void    { set(MStatus.OUTPUT, mode, pipe); } 
     44        public function setExpression(ex:int):void            { set(MStatus.EXPRESSION, ex, 0); } 
    4445        public function setDelta(delta:int):void              { m_delta = delta; } 
    4546        public function getStatus():int     { return m_status; } 
     
    7576        public function getOutputMode():int { return m_data0; } 
    7677        public function getOutputPipe():int { return m_data1; } 
     78        public function getExpression():int { return m_data0; } 
    7779    } 
    7880} 
  • lang/actionscript/flmml/trunk/src/com/txt_nifty/sketch/flmml/MML.as

    r32797 r32952  
    9494                m_velocity = getUInt(m_velocity); 
    9595                if (m_velocity > 127) m_velocity = 127; 
     96                break; 
     97            case 'x': // Expression 
     98                next(); 
     99                o = getUInt(127); 
     100                if (o > 127) o = 127; 
     101                m_tracks[m_trackNo].recExpression(o); 
    96102                break; 
    97103            case 'e': // Envelope 
  • lang/actionscript/flmml/trunk/src/com/txt_nifty/sketch/flmml/MStatus.as

    r29200 r32952  
    2727        public static const INPUT:int        = 24; 
    2828        public static const OUTPUT:int       = 25; 
     29        public static const EXPRESSION:int   = 26; 
    2930    } 
    3031} 
  • lang/actionscript/flmml/trunk/src/com/txt_nifty/sketch/flmml/MTrack.as

    r31640 r32952  
    137137                                m_ch.setOutput(e.getOutputMode(), e.getOutputPipe()); 
    138138                                break; 
     139                            case MStatus.EXPRESSION: 
     140                                m_ch.setExpression(e.getExpression()); 
     141                                break; 
    139142                            case MStatus.CLOSE: 
    140143                                m_ch.close(); 
     
    372375            recDelta(e); 
    373376            e.setOutput(mode, pipe); 
     377            m_events.push(e); 
     378        } 
     379 
     380        public function recExpression(ex:int):void { 
     381            var e:MEvent = new MEvent(); 
     382            recDelta(e); 
     383            e.setExpression(ex); 
    374384            m_events.push(e); 
    375385        }