[CLAM] Re: Question on the Midi file reader
Vincent SHAO
vince.shao at gmail.com
Mon Mar 9 09:24:06 PDT 2009
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 <vince.shao at gmail.com> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clam-project.org/pipermail/clam-users-clam-project.org/attachments/20090310/a5355288/attachment-0002.htm>
More information about the clam-users
mailing list