Hi, all:<br>Sorry to bother again. I encountered a problem that i have no clue and need your help.<br><br>I am intending to extract the melody information from a midi file, I wrote the following codes:<br><br> <i><b>MIDIFileIOConfig midiFConfig;<br>
midiFConfig.SetFileName(filename);<br> MIDIFileReader midiFReader(midiFConfig);<br> MIDISong midiSong;<br> midiFReader.Do(midiSong);<br> Array<MIDITrack> tracks = midiSong.GetTracks();<br> int tracksNumber = midiSong.GetNumberOfTracks();<br>
cout<<"Track number is : "<<tracksNumber<<endl;<br> for(int i =0; i< tracksNumber; i++){<br> MIDIMelody midiMelody = tracks[i].GetTrackMelody();<br> XMLStorage x;<br> x.UseIndentation(true);<br>
x.Dump(midiMelody,"Analyzed_MIDIMelody",filename+(char)i);<br> }</b></i><br><br>The code is working all right for the first time and can generate the melody file as i wanted, yet it won't work again, i mean i can't run this code again. When i run this it pops back the error:<br>
<br><b>Expected a header chunk.<br>terminate called after throwing an instance of 'MIDI::Reader::Error'<br>Aborted</b><br clear="all"><br>Did i miss something, like i have to close the midi file reader? Can't locate the bug and need your help. <br>
<br>A huge thank to all of you. <br><br>Cheers<br><br>Vincent<br><br>