2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-12-18 13:22:40 +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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2014-02-18 02:34:24 +01:00
|
|
|
*
|
2002-12-18 13:22:40 +00:00
|
|
|
*/
|
|
|
|
|
2007-02-19 17:48:19 +00:00
|
|
|
#ifndef SCUMM_IMUSE_INSTRUMENT_H
|
|
|
|
#define SCUMM_IMUSE_INSTRUMENT_H
|
2002-12-18 13:22:40 +00:00
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2002-12-18 13:22:40 +00:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
|
|
|
|
class MidiChannel;
|
2003-10-03 18:33:57 +00:00
|
|
|
|
|
|
|
namespace Scumm {
|
|
|
|
|
|
|
|
class Serializer;
|
2002-12-20 13:09:01 +00:00
|
|
|
class Instrument;
|
|
|
|
|
2002-12-18 13:22:40 +00:00
|
|
|
class InstrumentInternal {
|
|
|
|
public:
|
2005-10-22 22:18:44 +00:00
|
|
|
virtual ~InstrumentInternal() {}
|
2006-11-12 02:24:25 +00:00
|
|
|
virtual void saveOrLoad(Serializer *s) = 0;
|
|
|
|
virtual void send(MidiChannel *mc) = 0;
|
|
|
|
virtual void copy_to(Instrument *dest) = 0;
|
2003-05-07 19:24:14 +00:00
|
|
|
virtual bool is_valid() = 0;
|
2002-12-18 13:22:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Instrument {
|
|
|
|
private:
|
|
|
|
byte _type;
|
|
|
|
InstrumentInternal *_instrument;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
itNone = 0,
|
|
|
|
itProgram = 1,
|
2010-01-12 21:07:56 +00:00
|
|
|
itAdLib = 2,
|
2011-07-08 04:43:45 +02:00
|
|
|
itRoland = 3,
|
2012-09-20 01:57:53 +02:00
|
|
|
itPcSpk = 4,
|
|
|
|
itMacSfx = 5
|
2002-12-18 13:22:40 +00:00
|
|
|
};
|
|
|
|
|
2011-07-11 22:53:41 +02:00
|
|
|
Instrument() : _type(0), _instrument(0) { }
|
2003-07-04 13:16:48 +00:00
|
|
|
~Instrument() { delete _instrument; }
|
2006-11-12 02:24:25 +00:00
|
|
|
static void nativeMT32(bool native);
|
2005-04-12 22:41:25 +00:00
|
|
|
static const byte _gmRhythmMap[35];
|
2002-12-18 13:22:40 +00:00
|
|
|
|
|
|
|
void clear();
|
2006-11-12 02:24:25 +00:00
|
|
|
void copy_to(Instrument *dest) {
|
|
|
|
if (_instrument)
|
|
|
|
_instrument->copy_to(dest);
|
|
|
|
else
|
|
|
|
dest->clear();
|
|
|
|
}
|
2005-01-07 14:42:51 +00:00
|
|
|
|
2006-11-12 02:24:25 +00:00
|
|
|
void program(byte program, bool mt32);
|
|
|
|
void adlib(const byte *instrument);
|
|
|
|
void roland(const byte *instrument);
|
2011-07-08 04:43:45 +02:00
|
|
|
void pcspk(const byte *instrument);
|
2012-09-20 01:57:53 +02:00
|
|
|
void macSfx(byte program);
|
2002-12-18 13:22:40 +00:00
|
|
|
|
|
|
|
byte getType() { return _type; }
|
2003-05-07 19:24:14 +00:00
|
|
|
bool isValid() { return (_instrument ? _instrument->is_valid() : false); }
|
2006-11-12 02:24:25 +00:00
|
|
|
void saveOrLoad(Serializer *s);
|
|
|
|
void send(MidiChannel *mc) {
|
|
|
|
if (_instrument)
|
|
|
|
_instrument->send(mc);
|
|
|
|
}
|
2002-12-18 13:22:40 +00:00
|
|
|
};
|
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
} // End of namespace Scumm
|
|
|
|
|
2002-12-18 13:22:40 +00:00
|
|
|
#endif
|