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.
|
2003-09-24 06:56:30 +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.
|
2003-09-24 06:56:30 +00:00
|
|
|
*
|
2006-02-11 09:55:41 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-09-24 06:56:30 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-02-19 17:48:19 +00:00
|
|
|
#ifndef SCUMM_PLAYER_MOD_H
|
|
|
|
#define SCUMM_PLAYER_MOD_H
|
2003-09-24 06:56:30 +00:00
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
#include "scumm/scumm.h"
|
2004-11-27 16:12:11 +00:00
|
|
|
#include "sound/audiostream.h"
|
2007-02-20 18:50:17 +00:00
|
|
|
#include "sound/mixer.h"
|
2003-12-24 00:25:18 +00:00
|
|
|
|
2005-05-11 00:01:44 +00:00
|
|
|
namespace Audio {
|
|
|
|
class RateConverter;
|
|
|
|
}
|
2003-09-24 06:56:30 +00:00
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
namespace Scumm {
|
|
|
|
|
2003-10-03 23:34:06 +00:00
|
|
|
/**
|
|
|
|
* Generic Amiga MOD mixer - provides a 60Hz 'update' routine.
|
|
|
|
*/
|
2006-04-29 22:33:31 +00:00
|
|
|
class Player_MOD : public Audio::AudioStream {
|
2003-09-24 06:56:30 +00:00
|
|
|
public:
|
2006-10-21 12:44:10 +00:00
|
|
|
Player_MOD(Audio::Mixer *mixer);
|
2003-09-24 06:56:30 +00:00
|
|
|
virtual ~Player_MOD();
|
2004-11-28 21:24:02 +00:00
|
|
|
virtual void setMusicVolume(int vol);
|
2003-09-24 06:56:30 +00:00
|
|
|
|
2003-09-27 22:27:12 +00:00
|
|
|
virtual void startChannel(int id, void *data, int size, int rate, uint8 vol, int loopStart = 0, int loopEnd = 0, int8 pan = 0);
|
2003-09-24 06:56:30 +00:00
|
|
|
virtual void stopChannel(int id);
|
|
|
|
virtual void setChannelVol(int id, uint8 vol);
|
|
|
|
virtual void setChannelPan(int id, int8 pan);
|
|
|
|
virtual void setChannelFreq(int id, int freq);
|
|
|
|
|
|
|
|
typedef void ModUpdateProc(void *param);
|
|
|
|
|
|
|
|
virtual void setUpdateProc(ModUpdateProc *proc, void *param, int freq);
|
|
|
|
virtual void clearUpdateProc();
|
|
|
|
|
2004-11-27 16:18:50 +00:00
|
|
|
// AudioStream API
|
2004-11-27 16:12:11 +00:00
|
|
|
int readBuffer(int16 *buffer, const int numSamples) {
|
|
|
|
do_mix(buffer, numSamples / 2);
|
|
|
|
return numSamples;
|
|
|
|
}
|
|
|
|
bool isStereo() const { return true; }
|
|
|
|
bool endOfData() const { return false; }
|
|
|
|
int getRate() const { return _samplerate; }
|
|
|
|
|
2003-09-24 06:56:30 +00:00
|
|
|
private:
|
2003-10-03 23:34:06 +00:00
|
|
|
enum {
|
2004-03-16 07:02:21 +00:00
|
|
|
MOD_MAXCHANS = 24
|
2003-10-03 23:34:06 +00:00
|
|
|
};
|
2003-09-24 06:56:30 +00:00
|
|
|
|
2003-11-08 21:59:32 +00:00
|
|
|
struct soundChan {
|
2003-09-24 06:56:30 +00:00
|
|
|
int id;
|
|
|
|
uint8 vol;
|
|
|
|
int8 pan;
|
|
|
|
uint16 freq;
|
2005-05-11 00:01:44 +00:00
|
|
|
Audio::RateConverter *converter;
|
2006-04-29 22:33:31 +00:00
|
|
|
Audio::AudioStream *input;
|
2003-09-27 22:27:12 +00:00
|
|
|
};
|
2003-10-03 23:34:06 +00:00
|
|
|
|
2005-05-10 23:48:48 +00:00
|
|
|
Audio::Mixer *_mixer;
|
2007-02-20 18:50:17 +00:00
|
|
|
Audio::SoundHandle _soundHandle;
|
2003-10-03 23:34:06 +00:00
|
|
|
|
|
|
|
uint32 _mixamt;
|
|
|
|
uint32 _mixpos;
|
|
|
|
int _samplerate;
|
|
|
|
|
2003-09-27 22:27:12 +00:00
|
|
|
soundChan _channels[MOD_MAXCHANS];
|
2003-09-24 06:56:30 +00:00
|
|
|
|
|
|
|
uint8 _maxvol;
|
|
|
|
|
|
|
|
virtual void do_mix(int16 *buf, uint len);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-09-24 06:56:30 +00:00
|
|
|
ModUpdateProc *_playproc;
|
|
|
|
void *_playparam;
|
|
|
|
};
|
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
} // End of namespace Scumm
|
|
|
|
|
2003-09-24 06:56:30 +00:00
|
|
|
#endif
|