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-05-26 22:03:04 +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-05-26 22:03:04 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-02-19 17:48:19 +00:00
|
|
|
#ifndef SCUMM_PLAYER_V2_H
|
|
|
|
#define SCUMM_PLAYER_V2_H
|
2003-05-26 22:03:04 +00:00
|
|
|
|
2010-10-25 16:42:24 +00:00
|
|
|
#include "scumm/player_v2base.h"
|
2003-10-03 18:33:57 +00:00
|
|
|
|
|
|
|
namespace Scumm {
|
|
|
|
|
2003-10-03 23:34:06 +00:00
|
|
|
/**
|
2003-10-05 17:32:38 +00:00
|
|
|
* Scumm V2 PC-Speaker MIDI driver.
|
|
|
|
* This simulates the pc speaker sound, which is driven by the 8253 (square
|
|
|
|
* wave generator) and a low-band filter.
|
2003-10-03 23:34:06 +00:00
|
|
|
*/
|
2010-10-25 16:42:24 +00:00
|
|
|
class Player_V2 : public Player_V2Base {
|
2003-05-26 22:03:04 +00:00
|
|
|
public:
|
2006-10-21 12:44:10 +00:00
|
|
|
Player_V2(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr);
|
2003-08-14 02:28:19 +00:00
|
|
|
virtual ~Player_V2();
|
2003-05-26 22:03:04 +00:00
|
|
|
|
2010-10-25 16:42:24 +00:00
|
|
|
// MusicEngine API
|
2004-11-28 21:24:02 +00:00
|
|
|
virtual void setMusicVolume(int vol);
|
2003-10-03 13:44:12 +00:00
|
|
|
virtual void startSound(int sound);
|
|
|
|
virtual void stopSound(int sound);
|
2003-08-14 02:28:19 +00:00
|
|
|
virtual void stopAllSounds();
|
2010-10-25 16:42:24 +00:00
|
|
|
// virtual int getMusicTimer();
|
2003-10-03 13:44:12 +00:00
|
|
|
virtual int getSoundStatus(int sound) const;
|
2003-05-26 22:03:04 +00:00
|
|
|
|
2004-11-27 16:18:50 +00:00
|
|
|
// AudioStream API
|
2011-08-07 13:58:27 +00:00
|
|
|
virtual int readBuffer(int16 *buffer, const int numSamples);
|
2004-11-27 16:12:11 +00:00
|
|
|
|
2003-08-14 02:28:19 +00:00
|
|
|
protected:
|
2003-05-31 16:54:46 +00:00
|
|
|
unsigned int _update_step;
|
|
|
|
unsigned int _decay;
|
2003-09-30 17:10:03 +00:00
|
|
|
int _level;
|
2003-05-31 16:54:46 +00:00
|
|
|
unsigned int _RNG;
|
|
|
|
unsigned int _volumetable[16];
|
2003-05-26 22:03:04 +00:00
|
|
|
|
2003-05-31 16:54:46 +00:00
|
|
|
int _timer_count[4];
|
|
|
|
int _timer_output;
|
|
|
|
|
2003-09-19 14:43:57 +00:00
|
|
|
protected:
|
|
|
|
virtual void generateSpkSamples(int16 *data, uint len);
|
|
|
|
virtual void generatePCjrSamples(int16 *data, uint len);
|
2003-05-31 16:54:46 +00:00
|
|
|
|
2003-08-05 17:52:47 +00:00
|
|
|
void lowPassFilter(int16 *data, uint len);
|
2003-05-31 16:54:46 +00:00
|
|
|
void squareGenerator(int channel, int freq, int vol,
|
2003-11-08 21:59:32 +00:00
|
|
|
int noiseFeedback, int16 *sample, uint len);
|
2003-05-26 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
} // End of namespace Scumm
|
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
#endif
|