Changeset 18868 for lang/actionscript

Show
Ignore:
Timestamp:
09/05/08 02:16:34 (4 months ago)
Author:
tekisuke
Message:

lang/actionscript/flmml/: 試しにノートシフト入れてみた。バグってたらすんません。

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

Legend:

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

    r15293 r18868  
    1919        protected var m_maxGate:int; 
    2020        protected var m_form:int; 
     21        protected var m_noteShift:int; 
    2122        protected var m_warning:String; 
    2223 
     
    5354        protected function note(noteNo:int):void { 
    5455            //trace("note"+noteNo); 
    55             noteNo += getKeySig(); 
     56            noteNo += m_noteShift + getKeySig(); 
    5657            var len:int; 
    5758            len = getUInt(0); 
     
    195196        protected function firstLetter():void { 
    196197            var c:String = getCharNext(); 
     198            var c0:String; 
    197199            var i:int; 
    198200            switch(c) { 
     
    205207            case "b": note(11); break; 
    206208            case "r": rest(); break; 
    207             case "o": 
     209            case "o": // Octave 
    208210                m_octave = getUInt(m_octave); 
    209211                if (m_octave < -2) m_octave = -2; 
    210212                if (m_octave >  8) m_octave =  8; 
    211213                break; 
    212             case "v": 
     214            case "v": // Volume 
    213215                m_velocity = getUInt((m_velocity-7)/8) * 8 + 7; 
    214216                if (m_velocity < 0)   m_velocity = 0; 
    215217                if (m_velocity > 127) m_velocity = 127; 
    216218                break; 
    217             case "l": 
     219            case "l": // Length 
    218220                m_length = len2tick(getUInt(0)); 
    219221                m_length = getDot(m_length); 
    220222                break; 
    221             case "t": 
     223            case "t": // Tempo 
    222224                m_tempo = getUInt(m_tempo); 
    223225                if (m_tempo == 0) m_tempo = 1; 
    224226                m_tracks[MTrack.TEMPO_TRACK].recTempo(m_tracks[m_trackNo].getRecGlobalTick(), m_tempo); 
    225227                break; 
    226             case "q": 
     228            case "q": // gate time (rate) 
    227229                m_gate = getUInt(m_gate); 
    228230                m_tracks[m_trackNo].recGate(m_gate / m_maxGate); 
    229231                break; 
    230             case "<" : 
     232            case "<" : // octave shift 
    231233                if (m_relativeDir) m_octave++; else m_octave--; 
    232234                break; 
    233             case ">": 
     235            case ">": // octave shift 
    234236                if (m_relativeDir) m_octave--; else m_octave++; 
    235237                break; 
    236             case ';': 
    237                 //trace("nexttrack"); 
     238            case ";": // end of track 
    238239                if (m_tracks[m_trackNo].getNumEvents() > 0) { 
    239240                    m_tracks[++m_trackNo] = createTrack(); 
    240241                } 
    241242                break; 
    242             case '@': 
     243            case "@": 
    243244                atmark(); 
    244245                break; 
    245             case 'x': 
     246            case "x": 
    246247                m_tracks[m_trackNo].recVolMode(getUInt(1)); 
     248                break; 
     249            case "n": 
     250                c0 = getChar(); 
     251                if (c0 == "s") { // Note Shift 
     252                    next(); 
     253                    m_noteShift = getSInt(m_noteShift); 
     254                } 
     255                else 
     256                    warning(MWarning.UNKNOWN_COMMAND, c + c0); 
    247257                break; 
    248258            default: 
     
    328338            m_octave = 4; 
    329339            m_velocity = 100; 
     340            m_noteShift = 0; 
    330341            return new MTrack(); 
    331342        } 
     
    576587            m_maxGate = 16; 
    577588            m_form = MOscillator.PULSE; 
     589            m_noteShift = 0; 
    578590 
    579591            processComment(str);