[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.47,2.48
Jamieson Christian
jamieson630 at users.sourceforge.net
Wed May 21 12:34:07 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v2.cpp,2.98,2.99
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sky/compacts 0compact.h,1.4,1.5 101comp.h,1.4,1.5 102comp.h,1.4,1.5 10comp.h,1.5,1.6 11comp.h,1.5,1.6 12comp.h,1.5,1.6 13comp.h,1.5,1.6 14comp.h,1.5,1.6 15comp.h,1.5,1.6 16comp.h,1.5,1.6 17comp.h,1.5,1.6 18comp.h,1.5,1.6 19comp.h,1.5,1.6 1compact.h,1.4,1.5 20comp.h,1.5,1.6 21comp.h,1.5,1.6 22comp.h,1.5,1.6 23comp.h,1.5,1.6 24comp.h,1.5,1.6 25comp.h,1.5,1.6 26comp.h,1.5,1.6 27comp.h,1.5,1.6 28comp.h,1.5,1.6 29comp.h,1.5,1.6 2compact.h,1.5,1.6 30comp.h,1.5,1.6 31comp.h,1.5,1.6 32comp.h,1.5,1.6 33comp.h,1.5,1.6 34comp.h,1.5,1.6 36comp.h,1.5,1.6 37comp.h,1.5,1.6 38comp.h,1.5,1.6 39comp.h,1.5,1.6 3compact.h,1.5,1.6 40comp.h,1.5,1.6 41comp.h,1.5,1.6 42comp.h,1.4,1.5 44comp.h,1.5,1.6 45comp.h,1.5,1.6 46comp.h,1.5,1.6 47comp.h,1.5,1.6 48comp.h,1.5,1.6 4compact.h,1.5,1.6 5compact.h,1.5,1.6 65comp.h,1.5,1.6 66comp.h,1.4,1.5 67comp.h,1.5,1.6 68comp.h,1.5,1.6 69comp.h,1.5,1.6 70comp.h,1.5,1.6 71comp.h,1.5,1.6 72comp.h,1.5,1.6 73comp.h,1.5,1.6 74comp.h,1.5,1.6 75comp.h,1.5,1.6 76comp.h,1.5,1.6 77comp.h,1.5,1.6 78comp.h,1.5,1.6 79comp.h,1.5,1.6 80comp.h,1.4,1.5 81comp.h,1.4,1.5 82comp.h,1.4,1.5 85comp.h,1.4,1.5 90comp.h,1.5,1.6 91comp.h,1.5,1.6 92comp.h,1.5,1.6 93comp.h,1.5,1.6 94comp.h,1.5,1.6 95comp.h,1.5,1.6 96comp.h,1.5,1.6 9compact.h,1.5,1.6 linc_gen.h,1.4,1.5 lincmenu.h,1.4,1.5 objects.h,1.4,1.5 z_compac.h,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv1715/scummvm/scumm
Modified Files:
imuse.cpp
Log Message:
Integrated VolumeFader into each Player
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.47
retrieving revision 2.48
diff -u -d -r2.47 -r2.48
--- imuse.cpp 21 May 2003 18:09:46 -0000 2.47
+++ imuse.cpp 21 May 2003 19:33:50 -0000 2.48
@@ -51,6 +51,7 @@
// compile time.
struct Part;
+struct Player;
struct HookDatas {
byte _jump[2];
@@ -78,6 +79,27 @@
int a, b, c, d, e, f;
};
+struct VolumeFader {
+ Player *player;
+ bool active;
+ byte curvol;
+ uint16 speed_lo_max, num_steps;
+ int8 speed_hi;
+ int8 direction;
+ int8 speed_lo;
+ uint16 speed_lo_counter;
+
+ void initialize() {
+ active = false;
+ }
+ void on_timer(bool probe);
+ byte fading_to();
+
+ VolumeFader() {
+ memset(this,0,sizeof(VolumeFader));
+ }
+};
+
struct Player {
IMuseInternal *_se;
MidiDriver *_midi;
@@ -116,6 +138,7 @@
HookDatas _hook;
ParameterFade _parameterFades[4];
+ VolumeFader _volumeFader;
bool _mt32emulate;
bool _isGM;
@@ -176,32 +199,11 @@
void sequencer_timer();
Player() {
- memset(this,0,sizeof(Player)); // palmos
+ memset(this,0,sizeof(Player));
}
};
-struct VolumeFader {
- Player *player;
- bool active;
- byte curvol;
- uint16 speed_lo_max, num_steps;
- int8 speed_hi;
- int8 direction;
- int8 speed_lo;
- uint16 speed_lo_counter;
-
- void initialize() {
- active = false;
- }
- void on_timer(bool probe);
- byte fading_to();
-
- VolumeFader() {
- memset(this,0,sizeof(VolumeFader)); //palmos
- }
-};
-
struct SustainingNotes {
SustainingNotes *next;
SustainingNotes *prev;
@@ -312,9 +314,7 @@
private:
bool _paused;
- bool _active_volume_faders;
bool _initialized;
- byte _volume_fader_counter;
int _tempoFactor;
@@ -340,7 +340,6 @@
Player _players[8];
SustainingNotes _sustaining_notes[24];
- VolumeFader _volume_fader[8];
Part _parts[32];
uint16 _active_notes[128];
@@ -357,13 +356,11 @@
void initMidiDriver (MidiDriver *midi);
void init_players();
void init_parts();
- void init_volume_fader();
void init_sustaining_notes();
void init_queue();
void sequencer_timers (MidiDriver *midi);
void expire_sustain_notes (MidiDriver *midi);
- void expire_volume_faders (MidiDriver *midi);
MidiDriver *getBestMidiDriver (int sound);
Player *allocate_player(byte priority);
@@ -386,7 +383,6 @@
int set_channel_volume(uint chan, uint vol);
void update_volumes();
void reset_tick();
- VolumeFader *allocate_volume_fader();
int set_volchan(int sound, int volchan);
@@ -400,7 +396,7 @@
public:
IMuseInternal() {
- memset(this,0,sizeof(IMuseInternal)); // palmos
+ memset(this,0,sizeof(IMuseInternal));
}
~IMuseInternal();
@@ -762,6 +758,7 @@
for (i = ARRAYSIZE(_players); i != 0; i--, player++) {
player->_active = false;
player->_se = this;
+ player->_volumeFader.initialize();
}
}
@@ -779,16 +776,6 @@
_sustain_notes_free = next;
}
-void IMuseInternal::init_volume_fader() {
- VolumeFader *vf = _volume_fader;
- int i;
-
- for (i = ARRAYSIZE(_volume_fader); i != 0; i--, vf++)
- vf->initialize();
-
- _active_volume_faders = false;
-}
-
void IMuseInternal::init_parts() {
Part *part;
int i;
@@ -832,7 +819,6 @@
handleDeferredCommands (midi);
sequencer_timers (midi);
expire_sustain_notes (midi);
- expire_volume_faders (midi);
}
void IMuseInternal::sequencer_timers (MidiDriver *midi) {
@@ -954,27 +940,6 @@
}
}
-void IMuseInternal::expire_volume_faders (MidiDriver *midi) {
- VolumeFader *vf;
- int i;
-
- if (++_volume_fader_counter & 7)
- return;
-
- if (!_active_volume_faders)
- return;
-
- _active_volume_faders = false;
- vf = _volume_fader;
- for (i = ARRAYSIZE(_volume_fader); i != 0; i--, vf++) {
- if (vf->active) {
- _active_volume_faders = true;
- if (vf->player->_midi == midi)
- vf->on_timer(false);
- }
- }
-}
-
void VolumeFader::on_timer(bool probe) {
byte newvol;
@@ -1634,22 +1599,6 @@
return 0;
}
-VolumeFader *IMuseInternal::allocate_volume_fader() {
- VolumeFader *vf;
- int i;
-
- vf = _volume_fader;
- for (i = ARRAYSIZE(_volume_fader); vf->active;) {
- vf++;
- if (!--i)
- return NULL;
- }
-
- vf->active = true;
- _active_volume_faders = true;
- return vf;
-}
-
Player *IMuseInternal::get_player_byid(int id) {
int i;
Player *player, *found = NULL;
@@ -1732,7 +1681,6 @@
init_players();
init_sustaining_notes();
- init_volume_fader();
init_queue();
init_parts();
@@ -1786,10 +1734,9 @@
return 0;
}
- vf = _se->allocate_volume_fader();
- if (vf == NULL)
- return -1;
+ vf = &_volumeFader;
+ vf->active = true;
vf->player = this;
vf->num_steps = vf->speed_lo_max = time;
vf->curvol = _volume;
@@ -1807,14 +1754,7 @@
}
bool Player::is_fading_out() {
- VolumeFader *vf = _se->_volume_fader;
- int i;
-
- for (i = 0; i < 8; i++, vf++) {
- if (vf->active && vf->direction < 0 && vf->player == this && vf->fading_to() == 0)
- return true;
- }
- return false;
+ return (_volumeFader.active && _volumeFader.direction < 0 && _volumeFader.fading_to() == 0);
}
void Player::clear() {
@@ -1921,13 +1861,7 @@
}
void Player::cancel_volume_fade() {
- VolumeFader *vf = _se->_volume_fader;
- int i;
-
- for (i = 0; i < 8; i++, vf++) {
- if (vf->active && vf->player == this)
- vf->active = false;
- }
+ _volumeFader.active = false;
}
void Player::uninit_parts() {
@@ -2944,6 +2878,10 @@
}
}
}
+
+ // Now handle any volume fades
+ if (_volumeFader.active)
+ _volumeFader.on_timer (false);
}
void IMuseInternal::handleDeferredCommands (MidiDriver *midi) {
@@ -3225,14 +3163,19 @@
}
}
- ser->saveLoadArrayOf(_volume_fader, ARRAYSIZE(_volume_fader),
- sizeof(_volume_fader[0]), volumeFaderEntries);
+ // Volume faders used to be managed by IMuseInternal, but
+ // they are now maintained by each individual player.
+ {
+ int i;
+ for (i = 0; i < ARRAYSIZE(_players); ++i) {
+ ser->saveLoadEntries (&_players[i]._volumeFader, volumeFaderEntries);
+ }
+ }
if (!ser->isSaving()) {
// Load all sounds that we need
fix_players_after_load(scumm);
init_sustaining_notes();
- _active_volume_faders = true;
fix_parts_after_load();
set_master_volume (_master_volume);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v2.cpp,2.98,2.99
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sky/compacts 0compact.h,1.4,1.5 101comp.h,1.4,1.5 102comp.h,1.4,1.5 10comp.h,1.5,1.6 11comp.h,1.5,1.6 12comp.h,1.5,1.6 13comp.h,1.5,1.6 14comp.h,1.5,1.6 15comp.h,1.5,1.6 16comp.h,1.5,1.6 17comp.h,1.5,1.6 18comp.h,1.5,1.6 19comp.h,1.5,1.6 1compact.h,1.4,1.5 20comp.h,1.5,1.6 21comp.h,1.5,1.6 22comp.h,1.5,1.6 23comp.h,1.5,1.6 24comp.h,1.5,1.6 25comp.h,1.5,1.6 26comp.h,1.5,1.6 27comp.h,1.5,1.6 28comp.h,1.5,1.6 29comp.h,1.5,1.6 2compact.h,1.5,1.6 30comp.h,1.5,1.6 31comp.h,1.5,1.6 32comp.h,1.5,1.6 33comp.h,1.5,1.6 34comp.h,1.5,1.6 36comp.h,1.5,1.6 37comp.h,1.5,1.6 38comp.h,1.5,1.6 39comp.h,1.5,1.6 3compact.h,1.5,1.6 40comp.h,1.5,1.6 41comp.h,1.5,1.6 42comp.h,1.4,1.5 44comp.h,1.5,1.6 45comp.h,1.5,1.6 46comp.h,1.5,1.6 47comp.h,1.5,1.6 48comp.h,1.5,1.6 4compact.h,1.5,1.6 5compact.h,1.5,1.6 65comp.h,1.5,1.6 66comp.h,1.4,1.5 67comp.h,1.5,1.6 68comp.h,1.5,1.6 69comp.h,1.5,1.6 70comp.h,1.5,1.6 71comp.h,1.5,1.6 72comp.h,1.5,1.6 73comp.h,1.5,1.6 74comp.h,1.5,1.6 75comp.h,1.5,1.6 76comp.h,1.5,1.6 77comp.h,1.5,1.6 78comp.h,1.5,1.6 79comp.h,1.5,1.6 80comp.h,1.4,1.5 81comp.h,1.4,1.5 82comp.h,1.4,1.5 85comp.h,1.4,1.5 90comp.h,1.5,1.6 91comp.h,1.5,1.6 92comp.h,1.5,1.6 93comp.h,1.5,1.6 94comp.h,1.5,1.6 95comp.h,1.5,1.6 96comp.h,1.5,1.6 9compact.h,1.5,1.6 linc_gen.h,1.4,1.5 lincmenu.h,1.4,1.5 objects.h,1.4,1.5 z_compac.h,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list