From 5214cb3463804bda39b10d52e4a7f6ccd943780d Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Mon, 18 Nov 2002 09:08:45 +0000 Subject: Added support for volume and pause control to Simon music. Note that MidiStreamer is now used as a streaming wrapper for ALL MidiDriver types, even those that natively support streaming. This is because MidiStreamer supports a hybrid of streamed and non-streamed MIDI, which is necessary to support interactive events. svn-id: r5596 --- simon/midi.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'simon/midi.h') diff --git a/simon/midi.h b/simon/midi.h index 064acca416..3653a37316 100644 --- a/simon/midi.h +++ b/simon/midi.h @@ -28,15 +28,17 @@ struct MidiEvent; class MidiPlayer { public: - void read_all_songs(File *in, uint music); - void read_all_songs_old(File *in, uint music); + MidiPlayer(); + + void read_all_songs (File *in, uint music); + void read_all_songs_old (File *in, uint music); void initialize(); void shutdown(); void play(); - void pause(bool b); - uint get_volume(); - void set_volume(uint volume); - void set_driver(MidiDriver *md); + void pause (bool b); + int get_volume(); + void set_volume (int volume); + void set_driver (MidiDriver *md); private: struct Track { @@ -69,8 +71,9 @@ private: uint _lastDelay; Song *_currentSong; Song _songs[8]; - uint32 _volumeTable[16]; - + byte _volumeTable[16]; // 0-127 + byte _masterVolume; // 0-255 + bool _paused; void read_mthd(File *in, Song *s, bool old, uint music); @@ -79,8 +82,8 @@ private: static uint32 track_read_gamma(Track *t); static byte track_read_byte(Track *t); - int fill(MidiEvent *me, int num_event); - bool fill_helper(NoteRec *nr, MidiEvent *me); + int fill (MidiEvent *me, int num_event); + bool fill_helper (NoteRec *nr, MidiEvent *me); void reset_tracks(); void read_next_note(Track *t, NoteRec *nr); -- cgit v1.2.3