Re: [AD] too strict assert?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wed, 2005-06-29 at 18:47 +1000, Peter Wang wrote:
> On 2005-06-28, Elias Pschernig <elias@xxxxxxxxxx> wrote:
> > The attached patch removes an ASSERT which I think is too strict.
> ...
> > 
> > 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.
> 
> Perhaps this patch is better? (untested)  I just copied the description
> of voice_get_volume() from sound.c.
> 
> Maybe you're right that voice_set_volume() is too strict though, in
> which case both patches should be in.
> 

Well, your patch does the same.. the question is though, given the
asynchronous nature of voices, can we really disallow -1?

Look at this:

if (voice_vol[i] >= 0)
           voice_set_volume(i, voice_vol[i]);

What if the background thread pre-empties the voice just after the if
(in another thread)?


-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/