[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
The attached patch removes an ASSERT which I think is too strict.
See this:
void set_volume(int digi_volume, int midi_volume)
{
int *voice_vol;
int i;
if (digi_volume >= 0) {
voice_vol = malloc(sizeof(int)*VIRTUAL_VOICES);
/* Retrieve the (relative) volume of each voice. */
for (i=0; i<VIRTUAL_VOICES; i++)
voice_vol[i] = voice_get_volume(i);
_digi_volume = MID(0, digi_volume, 255);
/* Set the new (relative) volume for each voice. */
for (i=0; i<VIRTUAL_VOICES; i++)
voice_set_volume(i, voice_vol[i]);
free(voice_vol);
}
if (midi_volume >= 0)
_midi_volume = MID(0, midi_volume, 255);
}
voice_get_volume returns -1 for some voices (I don't know when, but it
does), which then gets passed to voice_set_volume. So now sound doesn't
work in debug mode since it asserts at the -1 in voice_set_volume.
--
Elias Pschernig
Index: src/sound.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/sound.c,v
retrieving revision 1.26
diff -u -p -r1.26 sound.c
--- src/sound.c 26 Jun 2005 14:46:29 -0000 1.26
+++ src/sound.c 28 Jun 2005 13:18:17 -0000
@@ -1586,8 +1586,8 @@ END_OF_FUNCTION(voice_get_volume);
void voice_set_volume(int voice, int volume)
{
ASSERT(voice >= 0 && voice < VIRTUAL_VOICES);
- ASSERT(volume >= 0 && volume <= 255);
-
+ ASSERT(volume <= 255);
+
if (_digi_volume >= 0)
volume = (volume * _digi_volume) / 255;