Sorry, I've known where the bug is. When i write xml file, the newly generated file overwrite the midi file, thus when i run it the second, it pops back that error.
Thanks. ;-) Cheers Vincent On Tue, Mar 10, 2009 at 12:11 AM, Vincent SHAO <[email protected]> wrote: > Hi, all: > Sorry to bother again. I encountered a problem that i have no clue and need > your help. > > I am intending to extract the melody information from a midi file, I wrote > the following codes: > > *MIDIFileIOConfig midiFConfig; > midiFConfig.SetFileName(filename); > MIDIFileReader midiFReader(midiFConfig); > MIDISong midiSong; > midiFReader.Do(midiSong); > Array<MIDITrack> tracks = midiSong.GetTracks(); > int tracksNumber = midiSong.GetNumberOfTracks(); > cout<<"Track number is : "<<tracksNumber<<endl; > for(int i =0; i< tracksNumber; i++){ > MIDIMelody midiMelody = tracks[i].GetTrackMelody(); > XMLStorage x; > x.UseIndentation(true); > x.Dump(midiMelody,"Analyzed_MIDIMelody",filename+(char)i); > }* > > 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: > > *Expected a header chunk. > terminate called after throwing an instance of 'MIDI::Reader::Error' > Aborted* > > Did i miss something, like i have to close the midi file reader? Can't > locate the bug and need your help. > > A huge thank to all of you. > > Cheers > > Vincent > >
_______________________________________________ CLAM mailing list [email protected] http://clam.iua.upf.edu
