Audio Specifics
by DALO · 09/29/2008 (3:53 pm) · 2 comments
Well well well, after quite a few weeks of trial and error I have finally solved my audio problems. What a pain the A$$. I thought I'd write a little blog post in order to help those who may have come into the same issues that I did. Some of the issues that were causing me great grief can be located here Audio Weirdness.
*NOTE* Maybe I'm out to lunch?? but following these steps seemed to fix my errors. These are just suggestions, not concrete solid information, and of course, all ways BACK UP your info before trying stuff.
To sum it up, sometimes my audio would work, sometimes it wouldn't. Clients that joined any servers would have really bizarre and funky audio occurrences. Sometimes the Main Music for the game would shut off based on location in the game and would randomly turn back on. So.......don't smash your screen, check these few tips below and hopefully that'll fix things for you.
Client Side:
=====================
1. For level music, gui sounds, anything that is more or less a 2d sound, keep them on the client side, for ex: client/ui/sounds.
2. I converted all of my audio to be stereo at 44.1khz. You want sound in both ears right?
3. Place all of your AudioDescription's in the audioProfiles.cs file. It get's compiled first thing on the client side. Now here is where I found a problem. If you place all of your AudioProfile's right after the AudioDescription's I've discovered that in the engine sometimes the sim id for the AudioDescription has not been created yet and will not find that id. Therefore your AudioProfile cannot link to the AudioDescription, then you have problems.
What I did was created a new script file called audioPart2.cs and in my ~/client/init.cs file I executed the audioPart2.cs file a few scripts after the audioProfiles.cs, BUT you have to make sure that you execute the AudioProfiles before any gui's need them. So if you have menu music, exec the audioPart.cs file before the main Menu Gui. My theory is that this allows the engine some time to process the AudioDescriptions and allows the AudioProfiles to link to the descriptions properly.
Server Side:
=====================
4. Do the same for the server side sounds by executing the audioProfiles.cs script with all of your AudioDescriptions first. Then place all of your AudioProfiles in a script (if you want) called audioPart2.cs (just like the client side) and execute that a few scripts somewhere after the audioProfiles.cs script. Make sure you execute the audioPart2.cs right before the first script that references an AudioDescription, I executed the audioPart2.cs script after the camera, markers, inventory, shapeBase, and a few other scripts and before player.cs, item.cs because they reference AudioDescriptions.
5. Convert all your server side sounds to mono sounds at 22 khz
6.Place all 3d sounds in the data folder, and keep it out of the client folder.
7. Don't use isStreaming. I don't know why but for some reason when I turn that feature on I get all sorts of funkyness, oh and Mac's really don't like isStreaming for some reason. Maybe someone can enlighten me on that matter.
So yeah, I think that's it, those are the steps that I took to flush out that nasty audio issue I had for several weeks. Hope this helps someone down the road............
*NOTE* Maybe I'm out to lunch?? but following these steps seemed to fix my errors. These are just suggestions, not concrete solid information, and of course, all ways BACK UP your info before trying stuff.
To sum it up, sometimes my audio would work, sometimes it wouldn't. Clients that joined any servers would have really bizarre and funky audio occurrences. Sometimes the Main Music for the game would shut off based on location in the game and would randomly turn back on. So.......don't smash your screen, check these few tips below and hopefully that'll fix things for you.
Client Side:
=====================
1. For level music, gui sounds, anything that is more or less a 2d sound, keep them on the client side, for ex: client/ui/sounds.
2. I converted all of my audio to be stereo at 44.1khz. You want sound in both ears right?
3. Place all of your AudioDescription's in the audioProfiles.cs file. It get's compiled first thing on the client side. Now here is where I found a problem. If you place all of your AudioProfile's right after the AudioDescription's I've discovered that in the engine sometimes the sim id for the AudioDescription has not been created yet and will not find that id. Therefore your AudioProfile cannot link to the AudioDescription, then you have problems.
What I did was created a new script file called audioPart2.cs and in my ~/client/init.cs file I executed the audioPart2.cs file a few scripts after the audioProfiles.cs, BUT you have to make sure that you execute the AudioProfiles before any gui's need them. So if you have menu music, exec the audioPart.cs file before the main Menu Gui. My theory is that this allows the engine some time to process the AudioDescriptions and allows the AudioProfiles to link to the descriptions properly.
Server Side:
=====================
4. Do the same for the server side sounds by executing the audioProfiles.cs script with all of your AudioDescriptions first. Then place all of your AudioProfiles in a script (if you want) called audioPart2.cs (just like the client side) and execute that a few scripts somewhere after the audioProfiles.cs script. Make sure you execute the audioPart2.cs right before the first script that references an AudioDescription, I executed the audioPart2.cs script after the camera, markers, inventory, shapeBase, and a few other scripts and before player.cs, item.cs because they reference AudioDescriptions.
5. Convert all your server side sounds to mono sounds at 22 khz
6.Place all 3d sounds in the data folder, and keep it out of the client folder.
7. Don't use isStreaming. I don't know why but for some reason when I turn that feature on I get all sorts of funkyness, oh and Mac's really don't like isStreaming for some reason. Maybe someone can enlighten me on that matter.
So yeah, I think that's it, those are the steps that I took to flush out that nasty audio issue I had for several weeks. Hope this helps someone down the road............
About the author
#2
10/01/2008 (4:03 pm)
I'm not really sure what you mean? From what I understand any sounds such as weapons sounds, pick up items, any 3d emitting sounds,...etc.....don't they need to be declared as datablocks in order to play these sounds for all clients to hear? 
Associate Konrad Kiss
Bitgap Games