aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/player_pce.h
diff options
context:
space:
mode:
authorTravis Howell2009-11-23 23:17:15 +0000
committerTravis Howell2009-11-23 23:17:15 +0000
commit9b8c088af5c56366f176fee334f636f40b1b156d (patch)
tree5f10f78651196c0a76eedca3b0e5f560ca3b1c7e /engines/scumm/player_pce.h
parentfe48378eb258bb045fac92213b70cbbf914c8c4b (diff)
downloadscummvm-rg350-9b8c088af5c56366f176fee334f636f40b1b156d.tar.gz
scummvm-rg350-9b8c088af5c56366f176fee334f636f40b1b156d.tar.bz2
scummvm-rg350-9b8c088af5c56366f176fee334f636f40b1b156d.zip
Add patch #2898231 - LOOM: Sound player for PC-Engine.
svn-id: r46110
Diffstat (limited to 'engines/scumm/player_pce.h')
-rw-r--r--engines/scumm/player_pce.h131
1 files changed, 131 insertions, 0 deletions
diff --git a/engines/scumm/player_pce.h b/engines/scumm/player_pce.h
new file mode 100644
index 0000000000..479ec5c506
--- /dev/null
+++ b/engines/scumm/player_pce.h
@@ -0,0 +1,131 @@
+/* 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SCUMM_PLAYER_PCE_H
+#define SCUMM_PLAYER_PCE_H
+
+#include "common/scummsys.h"
+#include "scumm/music.h"
+#include "sound/audiostream.h"
+#include "sound/mixer.h"
+
+namespace Scumm {
+
+class ScummEngine;
+class PSG_HuC6280;
+
+class Player_PCE : public Audio::AudioStream, public MusicEngine {
+private:
+ struct channel_t {
+ int id;
+
+ byte controlVec0;
+ byte controlVec1;
+ byte controlVec2;
+ byte controlVec5;
+ byte balance;
+ byte balance2;
+ byte controlVec8;
+ byte controlVec9;
+ byte controlVec10;
+ byte controlVec11;
+ int16 soundUpdateCounter;
+ byte controlVec18;
+ byte controlVec19;
+ byte waveformCtrl;
+ byte controlVec21;
+ bool controlVec23;
+ bool controlVec24;
+
+ uint16 controlVecShort02;
+ uint16 controlVecShort03;
+ int16 controlVecShort06;
+ uint16 freq;
+ uint16 controlVecShort09;
+ uint16 controlVecShort10;
+
+ const byte* soundDataPtr;
+ const byte* controlBufferPos;
+ };
+
+public:
+ Player_PCE(ScummEngine *scumm, Audio::Mixer *mixer);
+ virtual ~Player_PCE();
+
+ virtual void setMusicVolume(int vol) { _maxvol = vol; };
+ void startMusic(int songResIndex);
+ virtual void startSound(int sound);
+ virtual void stopSound(int sound);
+ virtual void stopAllSounds();
+ virtual int getSoundStatus(int sound) const;
+ virtual int getMusicTimer() const;
+
+ // AudioStream API
+ int readBuffer(int16 *buffer, const int numSamples);
+ bool isStereo() const { return true; }
+ bool endOfData() const { return false; }
+ int getRate() const { return _sample_rate; }
+
+private:
+ ScummEngine *_vm;
+ Audio::Mixer *_mixer;
+ Audio::SoundHandle _soundHandle;
+ int _sample_rate;
+ int _maxvol;
+
+private:
+ PSG_HuC6280 *_psg;
+ channel_t channels[12];
+ Common::Mutex _mutex;
+
+ // number of samples per timer period
+ int _samplesPerPeriod;
+ int16* _sampleBuffer;
+ int _sampleBufferCnt;
+
+ void init();
+ bool isPlaying();
+
+ void PSG_Write(int reg, byte data);
+
+ void setupWaveform(byte bank);
+ void procA541(channel_t *channel);
+ void updateSound();
+ void procA731(channel_t *channel);
+ void processSoundData(channel_t *channel);
+ void procA9F3(int x);
+ void procAA62(channel_t *channel, int a);
+ uint16 procAAF6(int x);
+ void procAB7F(channel_t *channel);
+ void procAC24(channel_t *channel);
+ void procACEA(channel_t *channel, int a);
+ void procAD21(int a, int x);
+ void procAD29(int value);
+ void procAD3D(int a, int x);
+};
+
+} // End of namespace Scumm
+
+#endif