haiku/src/tests/kits/midi/test1.cpp
shatty 9eff9ec6bb fixed newline at end of file.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-09-28 11:00:22 +00:00

38 lines
885 B
C++

#include <MidiStore.h>
#include <MidiText.h>
#include <Entry.h>
#include <iostream.h>
int main(int argc, char * argv[]) {
if(argc < 2) {
cerr << "Must supply a filename (*.mid)!" << endl;
return 1;
}
BMidiText * text = new BMidiText();
BMidiStore * store = new BMidiStore();
BEntry entry(argv[1],true);
if(!entry.Exists()) {
cerr << "File does not exist." << endl;
return 2;
}
entry_ref e_ref;
entry.GetRef(&e_ref);
store->Import(&e_ref);
store->Connect(text);
uint32 start_time = B_NOW;
store->Start();
while(store->IsRunning()) {
snooze(100000);
}
store->Stop();
uint32 stop_time = B_NOW;
cout << "Start Time: " << dec << start_time << "ms" << endl;
cout << "Stop Time: " << dec << stop_time << "ms" << endl;
cout << "Total time: " << dec << stop_time - start_time << "ms" << endl;
store->Disconnect(text);
delete store;
delete text;
return 0;
}