aboutsummaryrefslogtreecommitdiff
path: root/scumm/player_v2.h
diff options
context:
space:
mode:
authorJochen Hoenicke2003-05-31 16:54:46 +0000
committerJochen Hoenicke2003-05-31 16:54:46 +0000
commit3290d618d62f71b5c77e303ab7dcddc9d489cc85 (patch)
treec8cf0e6eaf972455cd23b956c34d741e1f04cf87 /scumm/player_v2.h
parent749782873437a7fcd86ef7c6489ea1914830f665 (diff)
downloadscummvm-rg350-3290d618d62f71b5c77e303ab7dcddc9d489cc85.tar.gz
scummvm-rg350-3290d618d62f71b5c77e303ab7dcddc9d489cc85.tar.bz2
scummvm-rg350-3290d618d62f71b5c77e303ab7dcddc9d489cc85.zip
Made thread-safe.
PCjr support. Rewrote the generator, so I can reuse more code between PCjr and speaker output. Added function to set master volume and to switch between PCjr and speaker. svn-id: r8185
Diffstat (limited to 'scumm/player_v2.h')
-rw-r--r--scumm/player_v2.h44
1 files changed, 32 insertions, 12 deletions
diff --git a/scumm/player_v2.h b/scumm/player_v2.h
index 9b36e9ea82..19558ba743 100644
--- a/scumm/player_v2.h
+++ b/scumm/player_v2.h
@@ -62,6 +62,9 @@ public:
Player_V2();
~Player_V2();
+ void set_pcjr(bool pcjr);
+ void set_master_volume(int vol);
+
void startSound(int nr, byte *data);
void stopSound(int nr);
void stopAllSounds();
@@ -69,18 +72,23 @@ public:
private:
SoundMixer *_mixer;
+
+
+ bool _pcjr;
+
+ int _sample_rate;
int _next_tick;
+ int _tick_len;
+ unsigned int _update_step;
+ unsigned int _decay;
+ unsigned int _level;
+ unsigned int _RNG;
+ unsigned int _volumetable[16];
- int sample_rate;
- int ticks_per_sample;
- int ticks_counted;
- int samples_left;
- int freq;
- int last_freq;
- int level;
- int pcjr;
- const uint16 *freqs_table;
- unsigned int decay;
+ int _timer_count[4];
+ int _timer_output;
+
+ const uint16 *_freqs_table;
ChannelInfo channels[4];
@@ -90,15 +98,27 @@ private:
byte *next_data;
byte *retaddr;
+ OSystem *_system;
+ void *_mutex;
+ void mutex_up() { _system->lock_mutex (_mutex); }
+ void mutex_down() { _system->unlock_mutex (_mutex); }
+
+ void restartSound();
void execute_cmd(ChannelInfo *channel);
void next_freqs(ChannelInfo *channel);
- void generate_samples(int16 *buf, int len);
- void on_timer();
void clear_channel(int i);
+ void chainSound(int nr, byte *data);
void chainNextSound();
static void premix_proc(void *param, int16 *buf, uint len);
void do_mix (int16 *buf, int len);
+
+ void lowPassFilter(int16 *data, int len);
+ void squareGenerator(int channel, int freq, int vol,
+ int noiseFeedback, int16 *sample, int len);
+ void generateSpkSamples(int16 *data, int len);
+ void generatePCjrSamples(int16 *data, int len);
+
};
#endif