示例#1
0
        void Compile()
        {
            var metaTrack = new MmlSemanticTrack (0);
            foreach (var p in token_set.MetaTexts) {
                var use = new MmlOperationUse ("__MIDI_META", null);
                use.Arguments.Add (new MmlConstantExpr (MmlDataType.Number, p.Key));
                use.Arguments.Add (new MmlConstantExpr (MmlDataType.String, p.Value));
                metaTrack.Data.Add (use);
            }
            if (metaTrack.Data.Count > 0)
                result.Tracks.Add (metaTrack);
            // compile variable reference tokens into expr
            foreach (var variable in token_set.Variables)
                result.Variables.Add (variable.Name,BuildVariableDeclaration (variable));
            // build operation list for macros
            foreach (var macro in token_set.Macros)
                result.Macros.Add (BuildMacroOperationList (macro));

            // build operation list for tracks
            foreach (var track in token_set.Tracks)
                result.Tracks.Add (BuildTrackOperationList (track));
        }
示例#2
0
 MmlSemanticTrack BuildTrackOperationList(MmlTrack src)
 {
     var ret = new MmlSemanticTrack (src.Number);
     CompileOperationTokens (ret.Data, new TokenStream (src.Tokens, null));
     return ret;
 }