00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef HAVE_CONFIG_H
00020 # include <config.h>
00021 #endif
00022
00023
00024 #ifdef BEOS
00025
00026 #include "be_midi.h"
00027 #include "fnames.h"
00028
00029 #include <string.h>
00030 #include <stdio.h>
00031
00032 Be_midi::Be_midi()
00033 {
00034 FileOpen = false;
00035 }
00036
00037 void Be_midi::stop_track(void)
00038 {
00039 if (FileOpen) {
00040 midiSynthFile.UnloadFile();
00041 FileOpen = false;
00042 }
00043 }
00044
00045 Be_midi::~Be_midi(void)
00046 {
00047 stop_track();
00048 }
00049
00050 bool Be_midi::is_playing(void)
00051 {
00052 if (!FileOpen)
00053 return false;
00054
00055 return !midiSynthFile.IsFinished();
00056 }
00057
00058
00059 void Be_midi::start_track(XMIDIEventList *event_list,bool repeat)
00060 {
00061 const char *name = MIDITMPFILE;
00062 event_list->Write(name);
00063
00064 #if DEBUG
00065 cerr << "Stopping any running track" << endl;
00066 #endif
00067 stop_track();
00068
00069 #if DEBUG
00070 cerr << "Starting midi sequence with Be_midi, repeat = "
00071 << (repeat?"true":"false") << endl;
00072 #endif
00073
00074
00075 get_ref_for_path(name, &midiRef);
00076 midiSynthFile.LoadFile(&midiRef);
00077 FileOpen = true;
00078
00079
00080 midiSynthFile.EnableLooping(repeat);
00081
00082
00083 midiSynthFile.Start();
00084 }
00085
00086 const char *Be_midi::copyright(void)
00087 {
00088 return "Internal BeOS MIDI player";
00089 }
00090
00091
00092 #endif