Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » 64 Sound Channels?

This thread is locked; no one can reply to it. rss feed Print
 1   2 
64 Sound Channels?
Richard Phipps
Member #1,632
November 2001
avatar

I seem to have read on these forums that Allegro can (via DirectSound or Allegro's mixer) create upto 64 sounds at once for us to use.

Whatever I try to reserve any amount of voices, a subsequent check of digi_driver->voices (from memory I think that is right), brings up a measly 4 channels on my PC. If this is the number of hardware voices on my soundcard then this is still ok as long as channels are mixed before being sent to the card. However I do not seem to have mixing capabilites as playing 5 sounds resulted in the last sound (and the highest priority one) being skipped.

I know I've gone over my sound problems before, and I'm getting sick of it as well. But am I the only one who seems to have this very low amount of sound channels? Using Allegro 4.0.3 BTW..

Does anyone have an ideas/help for this one? I seem to recall Kitty Cat had an updated directX mixer? Any chance this will solve my problem?

Thanks!!

Evert
Member #794
November 2000
avatar

Quote:

Does anyone have an ideas/help for this one? I seem to recall Kitty Cat had an updated directX mixer? Any chance this will solve my problem?

Maybe. You'll have to try current CVS or wait for 4.1.15 WIP to test that though...

If this is for your shareware game, you'll probably want to stick with a stable release. Allegro 4.2 is a while off yet and the new mixer will not (unless Eric decides otherwise, which I don't think he will) be backported to the 4.0 branch, since it's not really a bugfix.
Which leaves trying to work around the problem in a different way... which I can't help you with, unfortunately.

Thomas Fjellstrom
Member #476
June 2000
avatar

If you havent already, use the Allegro mixer, instead of the default DX mixer, which just passes sound to DirectX, and it gets to decide how to deal with things.

As for KCs changes.. CVS has the new mixer, but not all of the new code, that requires the old DX mixer to be dropped totally (might happen in 4.2, I hope it does, might get hardware mixing with all drivers instead of just the DX one)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Richard Phipps
Member #1,632
November 2001
avatar

This is for my shareware game unfortunately. I will have to try the allegro mixer throughly tomorrow and see if this helps. If so I think the best thing would be to offer a choice of mixer ingame.

:-/

Thanks for the help though guys. :)

Thomas Fjellstrom
Member #476
June 2000
avatar

Ah yes. I forgot to mention, the DX mixer ignores ALL of the sound parameters you give to allegro ;) (another reason why it needs to die).

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Kitty Cat
Member #2,815
October 2002
avatar

Quote:

Does anyone have an ideas/help for this one? I seem to recall Kitty Cat had an updated directX mixer?

Actually, my mixer changes don't really touch the DX mixer (though I did do a small patch for it so the AllegMix driver is chosen by defualt instead.. though the patch hasn't been committed to CVS yet). Indeed, the changes I want to do require that the DX mixer be completely removed in favor of the AllegMix driver. After that, all the drivers can be enhanced and extended to provide hardware mixing at the same time as software mixing (so in case you have few hardware voices, you can still get a high voice count).

As for your problem.. I'd suggest using the AllegMix driver (AXA, AXB, etc). Allegro's "play" program (in the tests/ dir) will give you info on the selected digital and midi devices, including voice count. If your voice count is still low even with the AllegMix driver, make sure the digi_voices config var is set to a reasonable value (32 is the default, but it can be up to 64 I think).

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Richard Phipps
Member #1,632
November 2001
avatar

;D

I've got it working! I tried the play command and discovered that all the mixer's only gave me 4 channels apart from the allegro mixer which gave me 8. When I tried that in game I got all 8 channels but only at about half the volume of the directsound mixer.

I couldn't seem to reserve more voices than 8, no matter what value I used for reserve voices.

I then reread your last post Kitty Cat and added a digi_voices = 16 to my allegro.cfg and it worked! I now can have 16 voices at full volume using the directsound mixer.

However I seem to have found a problem. Reserve_voices did nothing if I used DIGI_AUTODETECT which is not mentioned in the docs. So I then tried something else, I put DIGI_CARD = AXA in the config file and used DIGI_DIRECTX(0) in the program. When I recompiled and ran my game I could tell from the sound volume and from the logfile where I print the driver name that the Allegro mixer was still being used! I reversed things and used DIGI_DIRECTAMX(0) in the program and DXA in the config file and it again used the config file settings.

This means that for me at least either those listed in the docs (DIRECT_AMX(n) etc..) are wrong, or that the driver name is ignored if the config file entry is present. This is not explained in the docs.

So, reserve voices does nothing for me no matter the driver used, the driver seems to be autodetected from the cfg file anyway and so it seems I will have to distribute the cfg file to give people more voices than 4.

I've got it working, but I'm a bit frustrated at these errors or unclear explanations in the docs.

Kitty Cat
Member #2,815
October 2002
avatar

Quote:

So, reserve voices does nothing for me no matter the driver used

Did you call reserve_voices before install_sound? If so, then it's possible reserve_voices maxes out at whatever was loaded from the config file. I'll have to check that out.

EDIT: boy, did I hit Post Reply way too soon

Quote:

However I seem to have found a problem. Reserve_voices did nothing if I used DIGI_AUTODETECT which is not mentioned in the docs.

The problem here is, DIGI_AUTODETECT will more than likely autodetect the DX mixer, which ignores the vast majority of sound-related configuration functions and variables allegro has. It's also not much use to fix it since the DX mixer is just a big hack as it is and will probably be removed in favor of extending and enhancing the AllegMix driver.

Quote:

So I then tried something else, I put DIGI_CARD = AXA in the config file and used DIGI_DIRECTX(0) in the program. When I recompiled and ran my game I could tell from the sound volume and from the logfile where I print the driver name that the Allegro mixer was still being used

This, however, I'll have to look into as well.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Richard Phipps
Member #1,632
November 2001
avatar

Yes, I called reserve_voices before install_sound. But even with no allegro.cfg file in my game directory it has no effect. Perhaps because it's looking in the Allegro directory?

I had a quick look at the sound.c source and it seems to work like the docs indicate. But that is not the result I get in my programs. I use Allegro 4.0.3 as well, which should be stable. Perhaps this only appears on a few PC's?

Kitty Cat
Member #2,815
October 2002
avatar

Could you perhaps try 4.1.14? It may have been already fixed. And unfortuantely I don't have the time to look through Allegro's source now as I'm about to pass out from exhaustion.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Richard Phipps
Member #1,632
November 2001
avatar

I may be able to try 4.1.14 later. I can't do it at the moment and since you are now passed out on the floor that won't help you either. :)

Matt Smith
Member #783
November 2000

The DX mixer proved useless for me, because it doesn't handle frequency sweeps. I force the software mixer with install_sound(DIGI_DIRECTAMX(0), MIDI_NONE, NULL); too.

I think the bestest solution would be to offload the mixing to the DSP on the sound card when possible. Does anyone have a datasheet for the emu10k1?

Kitty Cat
Member #2,815
October 2002
avatar

4.1.15 will default to using the software mixer. The DX mixer creates a large gap in the expected functionality between itself and Allegro's software mixer, creating problems like what you described.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Tobias Dammers
Member #2,604
August 2002
avatar

Does the allegro mixer still sound that bad? Otherwise I might consider using it myself...

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Kitty Cat
Member #2,815
October 2002
avatar

The Allegro mixer doesn't sound bad. Just make sure you set quality to 2 (which is the default, iirc), a nice frequency (44.1khz is the default here), and 16-bit stereo (both of which are defaults as well).

In 4.1.14 and earlier, however, there are a few issues.. namely that is only maxes out at 12-bit mixing, 8-bit samples don't interpolate right, and the default volume per voice is extremely low. 4.1.15 fixes these issues however.. it has 24-bit mixing, both 16- and 8-bit samples interpolate at full 24-bit precision, and the default volume is half (so a full-panned sample won't clip).

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Tobias Dammers
Member #2,604
August 2002
avatar

So that horrible clipping table is gone? I always wondered what that was supposed to do. Clipping means to me that you just do one or two < or > checks and set the sample value to min / max if true - what's the table for? Make it sound better? Not quite, can't be that. You'd need something like a limiter and more mixing overhead / excess precision for that. Speed? Hm, how could that table be any faster than 2 comparisons and 1 memory (or even register) write?

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Kitty Cat
Member #2,815
October 2002
avatar

Quote:

So that horrible clipping table is gone? I always wondered what that was supposed to do.

Yup, it's gone. What it was supposed to do is take a 12-bit sample (with 4-bit overflow protection), clamp it to 12-bit and resize it to a full 16-bit value to pass to the driver. The reason for that was you couldn't mix two full 16-bit samples together without risk of overflowing the 16-bit buffer, so they used 12-bit mixing. However, now it does 24-bit mixing in a 32-bit buffer, so the only way it could overflow is if you played more than 256 voices simulatiously at full volume, and Allegro doesn't allow that many (only 64).

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Richard Phipps
Member #1,632
November 2001
avatar

I haven't had chance to try the WIP versions for the problem I described earlier. It won't help me too much because I'm static linking with 4.0.3 for the shareware game.

Sounds like you are the new sound guru here Kitty Cat. :D

Kitty Cat
Member #2,815
October 2002
avatar

Quote:

It won't help me too much because I'm static linking with 4.0.3 for the shareware game.

Actually, if you're static linking, that'd be the best time to do it. Don't have to worry about tincompatible DLLs.

Quote:

Sounds like you are the new sound guru here Kitty Cat. :D

For better or for worse. :P;)

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Richard Phipps
Member #1,632
November 2001
avatar

But I don't want to link with a WIP allegro for a shareware game on the (maybe slim) chance that a bug will ruin the game.

BTW: I do find it hard to believe that nobody with 4.0.3 has ran into the same problem I have (or posted about it even).

X-G
Member #856
December 2000
avatar

Most people don't care so much about sound, or simply don't know how to make sound. So they don't get around to using it much (until near the end of their projects, occasionally), and thus the chance for bug reports to crop up is significantly lower than for the more oft-used modules.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Evert
Member #794
November 2000
avatar

Quote:

I haven't had chance to try the WIP versions for the problem I described earlier.

If you're going to try a WIP version at all, I'd suggest you wait for 4.1.15 rather than try out 4.1.14.
Hopefully, it should be around shortly.

Quote:

It won't help me too much because I'm static linking with 4.0.3 for the shareware game.

Why are you static linking? That will prevent your application from benefitting from bugfixes when 4.0.4 comes out. If you're static linking anyway, then using a WIP release may not be such a bad thing afterall.

I don't know when your publishing deadline is, but if you have the time, you may want to test a WIP release and see if it's stable enough first (they usually are).

Richard Phipps
Member #1,632
November 2001
avatar

I understood it was recommended practice that static linking with a stable library be used for release versions? Bear in mind this is a Shareware Game I need to make sure everything works as well as possible.

I'm looking at publishing in one months time. :)

Kitty Cat
Member #2,815
October 2002
avatar

Quote:

I understood it was recommended practice that static linking with a stable library be used for release versions?

It's the otherway around. You want to link dynamicly for stable releases (since any DLL within that branch will be compatible) for easy Allegro bugfix upgrades, or link staticly for the WIPs (since the DLL versions routinely break ABI compatibility).

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Richard Phipps
Member #1,632
November 2001
avatar

Hmm.. I'm sure people said we should static link.. Well, even for a shareware game is including a .DLL standard practise? Seems somewhat unprofessional to me for some reason..

 1   2 


Go to: