-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloadFile.cpp
More file actions
44 lines (32 loc) · 1.18 KB
/
Copy pathloadFile.cpp
File metadata and controls
44 lines (32 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <cstdlib>
#include <unistd.h>
#include "jdksmidi/world.h"
#include "jdksmidi/track.h"
#include "jdksmidi/multitrack.h"
#include "jdksmidi/filereadmultitrack.h"
#include "jdksmidi/fileread.h"
#include "jdksmidi/fileshow.h"
#include "jdksmidi/sequencer.h"
using namespace jdksmidi;
#include <iostream>
using namespace std;
MIDISequencer* loadMIDIFile (std::string file)
{
const char *infile_name = file.c_str();
MIDIFileReadStreamFile *rs=new MIDIFileReadStreamFile( infile_name );
MIDIMultiTrack *tracks=new MIDIMultiTrack;
MIDIFileReadMultiTrack *track_loader=new MIDIFileReadMultiTrack( tracks );
MIDIFileRead *reader=new MIDIFileRead( rs, track_loader );
// set amount of tracks equal to midifile
tracks->ClearAndResize( reader->ReadNumTracks() );
// MIDISequencerGUIEventNotifierText notifier( stdout );
// MIDISequencer seq( &tracks, ¬ifier );
MIDISequencer *seq =new MIDISequencer( tracks );
// load the midifile into the multitrack object
if ( !reader->Parse() )
{
cerr << "\nError parse file " << infile_name << endl;
}
return seq;
}