Beispiel #1
0
        public Loader( string path )
        {
            TimeSpanLogger.Begin();

            FileStream stream = File.OpenRead( path );
            stream.Position = 0;
            streamName = stream.Name;

            try {
                headerInfo = HeaderParser.Parse( stream );

                trackInfos = new TrackInfo[ headerInfo.tracksCount ];

                for ( int i = 0; i < trackInfos.Length; i++ ) {
                    trackInfos[ i ] = new TrackParser().Parse( stream, i );
                }

            } catch ( MidiParseException e ) {
                Debug.LogError( e.ToString() );
            }

            stream.Close();

            TimeSpanLogger.EndAndLog( "Parsed " + streamName );
        }
Beispiel #2
0
        public static HeaderInfo Parse( Stream stream )
        {
            HeaderInfo headerInfo = new HeaderInfo();

            ParseMthd( stream );
            ParseHeaderSize( stream );

            headerInfo.format = ParseFormat( stream );
            headerInfo.tracksCount = ParseTracksCount( stream );
            headerInfo.deltasDivision = ParseDeltasDivision( stream );

            return headerInfo;
        }
Beispiel #3
0
 void PrepareTicksPerQuaterNote( HeaderInfo header )
 {
     DeltasDivision deltas = header.deltasDivision;
     if ( deltas is TicksPerQuaterNoteDeltasDivision ) {
         deltasPerQuaterNote = ( deltas as TicksPerQuaterNoteDeltasDivision ).ticksPerQuaterNote;
     } else {
         throw new FakeSequencerException( "Unsupported deltasDivision format: " + deltas.GetType() );
     }
 }
Beispiel #4
0
 static void LogStreamNameAndHeader( HeaderInfo info, string path, StringBuilder output )
 {
     output.AppendLine( "File: " + path + ":" );
     output.AppendLine( info.ToString() );
 }