2002-08-18 16:21:34 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2003-03-06 21:46:56 +00:00
|
|
|
* Copyright (C) 2001-2003 The ScummVM project
|
2002-08-18 16:21:34 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SIMON_MIDI_H
|
|
|
|
#define SIMON_MIDI_H
|
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
#include "sound/mididrv.h"
|
|
|
|
#include "sound/midiparser.h"
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
class File;
|
|
|
|
class OSystem;
|
2002-11-18 09:08:45 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
class MidiPlayer : public MidiDriver {
|
|
|
|
protected:
|
|
|
|
OSystem *_system;
|
|
|
|
void *_mutex;
|
|
|
|
MidiDriver *_driver;
|
|
|
|
MidiParser *_parser;
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
byte *_data;
|
2002-11-18 09:08:45 +00:00
|
|
|
byte _volumeTable[16]; // 0-127
|
|
|
|
byte _masterVolume; // 0-255
|
|
|
|
bool _paused;
|
2003-05-18 23:55:53 +00:00
|
|
|
byte _currentTrack;
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
byte _num_songs;
|
|
|
|
byte *_songs[16];
|
|
|
|
uint32 _song_sizes[16];
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
static void onTimer (void *data);
|
|
|
|
void clearConstructs();
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
public:
|
|
|
|
bool _midi_sfx_toggle;
|
|
|
|
|
|
|
|
MidiPlayer (OSystem *system);
|
|
|
|
~MidiPlayer();
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
void playSMF (File *in);
|
|
|
|
void playMultipleSMF (File *in);
|
|
|
|
void playXMIDI (File *in);
|
|
|
|
void jump (uint16 track, uint16 tick);
|
|
|
|
void stop();
|
|
|
|
void pause (bool b);
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
int get_volume() { return _masterVolume; }
|
|
|
|
void set_volume (int volume);
|
|
|
|
void set_driver (MidiDriver *md);
|
|
|
|
|
|
|
|
public:
|
|
|
|
// MidiDriver interface implementation
|
|
|
|
int open();
|
|
|
|
void close();
|
|
|
|
void send(uint32 b);
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
void metaEvent (byte type, byte *data, uint16 length);
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
// Timing functions - MidiDriver now operates timers
|
|
|
|
void setTimerCallback (void *timer_param, void (*timer_proc) (void *)) { }
|
|
|
|
uint32 getBaseTempo (void) { return _driver ? _driver->getBaseTempo() : 0x4A0000; }
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2003-05-18 23:55:53 +00:00
|
|
|
// Channel allocation functions
|
|
|
|
MidiChannel *allocateChannel() { return 0; }
|
|
|
|
MidiChannel *getPercussionChannel() { return 0; }
|
2002-08-18 16:21:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|