Files
haiku-beta6/headers/os/midi/MidiStore.h
T

106 lines
2.2 KiB
C++
Raw Normal View History

2002-07-09 12:24:59 +00:00
2002-11-01 16:11:03 +00:00
#ifndef _MIDI_STORE_H
#define _MIDI_STORE_H
#include <BeBuild.h>
2002-07-09 12:24:59 +00:00
#include <Midi.h>
struct entry_ref;
2002-11-01 16:11:03 +00:00
2002-07-09 12:24:59 +00:00
class BMidiEvent;
2002-11-01 16:11:03 +00:00
class BList;
class BFile;
2002-07-09 12:24:59 +00:00
2002-11-01 16:11:03 +00:00
class BMidiStore : public BMidi
{
2002-07-09 12:24:59 +00:00
public:
2002-11-01 16:11:03 +00:00
BMidiStore();
virtual ~BMidiStore();
virtual void NoteOff(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void NoteOn(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void KeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
virtual void ControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
2002-07-09 12:24:59 +00:00
uint32 time = B_NOW);
2002-11-01 16:11:03 +00:00
virtual void ProgramChange(
uchar channel, uchar programNumber, uint32 time = B_NOW);
virtual void ChannelPressure(
uchar channel, uchar pressure, uint32 time = B_NOW);
virtual void PitchBend(
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
virtual void SystemExclusive(
void* data, size_t dataLength, uint32 time = B_NOW);
virtual void SystemCommon(
uchar status, uchar data1, uchar data2, uint32 time = B_NOW);
virtual void SystemRealTime(uchar status, uint32 time = B_NOW);
virtual void TempoChange(int32 beatsPerMinute, uint32 time = B_NOW);
virtual void AllNotesOff(bool justChannel = true, uint32 time = B_NOW);
status_t Import(const entry_ref* ref);
status_t Export(const entry_ref* ref, int32 format);
2002-07-09 12:24:59 +00:00
void SortEvents(bool force = false);
uint32 CountEvents() const;
2002-11-01 16:11:03 +00:00
2002-07-09 12:24:59 +00:00
uint32 CurrentEvent() const;
2002-11-01 16:11:03 +00:00
void SetCurrentEvent(uint32 eventNumber);
uint32 DeltaOfEvent(uint32 eventNumber) const;
2002-07-09 12:24:59 +00:00
uint32 EventAtDelta(uint32 time) const;
2002-11-01 16:11:03 +00:00
uint32 BeginTime() const;
void SetTempo(int32 beatsPerMinute);
2002-07-09 12:24:59 +00:00
int32 Tempo() const;
private:
2002-11-01 16:11:03 +00:00
virtual void _ReservedMidiStore1();
virtual void _ReservedMidiStore2();
2002-07-09 12:24:59 +00:00
virtual void Run();
2002-11-01 16:11:03 +00:00
BMidiEvent* EventAt(uint32 index) const;
static int CompareEvents(const void* event1, const void* event2);
void ReadFileHeader();
void ReadTrackHeader();
void ReadTrack();
int32 Read32Bit();
int16 Read16Bit();
void ReadData(uint8* data, size_t size);
2002-11-01 16:11:03 +00:00
BList* events;
uint32 tempo;
uint32 curEvent;
uint32 startTime;
uint32 ticksPerBeat;
BFile* file;
int32 numTracks;
int32 trackSize;
int16 division;
uint16 _reserved1;
uint32 _reserved2[17];
2002-07-09 12:24:59 +00:00
};
2002-11-01 16:11:03 +00:00
#endif // _MIDI_STORE_H