Game Development Community

dev|Pro Game Development Curriculum

Sound Upgrade

by Marcelo Oliveira · 12/14/2004 (11:08 pm) · 57 comments

Download Code File

Install instructions:

- Download the attached zip;
- Delete all files in the engine\audio directory;
- Decompress (or copy) all zip stuff into your torque directory, overwrite when asked;
- Apply the patch (created by using the HEAD version);
- Add lib\vorbis\win32\ogg_static.lib and lib\vorbis\win32\vorbisfile_static.lib to your project linker;
- Remove ambientAudioManager.cc and ambientAudioManager.h from compilation;
- Remove all the engine\audio files from project and add only the files included in this packet;

How it works:
It centralize all the audio functions into a global object called AudioManager, you can check the included audioEmitter.cc to see how can you directly use the interface.

It also includes a oldaudio.cc file that is a wrapper to the new interface, this way you can still use the alxNNNN() functions where needed, example:
void alxListenerMatrixF(const MatrixF *transform, const Point3F *velocity)
{
   AudioManager->setListenerTransform(transform, velocity);
}


* Note that this is an old code, the audio layer is being rewritten from scratch to support multiple API's such as DirectSound and OpenAL. This code is also windows only, but should't be difficult to port it by adapting the platform audio.

* If you have problems on windows XP please download the default latest openal here and put in your game directory, also you will need to delete your original OpenAL32.dll from System32 directory so the game can run the supplied one.
Page «Previous 1 2 3 Last »
#1
12/15/2004 (3:28 am)
Great Marcelo !!

I give it a try .
#2
12/15/2004 (4:11 am)
I am getting 32 error in guiAviBitmapCtrl.cc and guiAviBitmapCtrl.h:

c:\temp\Lighting Pack 1.3\SynapseGaming\contentPacks\LightingPack\engine\gui\guiAviBitmapCtrl.h(49): error C2146: syntax error : missing ';' before identifier 'mWavHandle'

I can't figure out what's wrong. Any help is apreciated.

Marrion Cox
#3
12/15/2004 (4:43 am)
Marrion,

Try changing the line 26 from #include "audio/audio.h" to #include "audio/oldaudio.h", I've not included it since the control is disabled in the HEAD version I think.

Maybe you'll need to fix these "mIs3d", "mVolume" and "mIsLoopiong" to "is3d", "volume" and "isLooping" only. Remove the m prexif in all the AudioDescription members.
#4
12/15/2004 (4:51 am)
Thanks Marcelo,

I am now down to 13:

Anything else I need to change?

Thanks again for your help Marcelo,

Marrion Cox
#5
12/15/2004 (5:01 am)
If I change audio/oldAudio.h to platform/platformAudio.h it passes this, but gives these errors:

Torque Demo error LNK2019: unresolved external symbol "unsigned int __cdecl alxCreateSource(struct Audio::Description const *,char const *,class MatrixF const *,class AudioSampleEnvironment *)" (?alxCreateSource@@YAIPBUDescription@Audio@@PBDPBVMatrixF@@PAVAudioSampleEnvironment@@@Z) referenced in function "protected: bool __thiscall GuiAviBitmapCtrl::sndOpen(void)" (?sndOpen@GuiAviBitmapCtrl@@IAE_NXZ)
Torque Demo error LNK2019: unresolved external symbol "unsigned int __cdecl alxCreateSource(class AudioProfile const *,class MatrixF const *)" (?alxCreateSource@@YAIPBVAudioProfile@@PBVMatrixF@@@Z) referenced in function "public: virtual void __thiscall GuiIconCtrl::onMouseDown(struct GuiEvent const &)" (?onMouseDown@GuiIconCtrl@@UAEXABUGuiEvent@@@Z)
Torque Demo error LNK2019: unresolved external symbol _ov_time_total referenced in function "public: virtual bool __thiscall VorbisStream::attachStream(class Stream *)" (?attachStream@VorbisStream@@UAE_NPAVStream@@@Z)
Torque Demo error LNK2019: unresolved external symbol _ov_pcm_total referenced in function "public: virtual bool __thiscall VorbisStream::attachStream(class Stream *)" (?attachStream@VorbisStream@@UAE_NPAVStream@@@Z)
Torque Demo error LNK2019: unresolved external symbol _ov_info referenced in function "public: virtual bool __thiscall VorbisStream::attachStream(class Stream *)" (?attachStream@VorbisStream@@UAE_NPAVStream@@@Z)
Torque Demo error LNK2019: unresolved external symbol _ov_open_callbacks referenced in function "public: virtual bool __thiscall VorbisStream::attachStream(class Stream *)" (?attachStream@VorbisStream@@UAE_NPAVStream@@@Z)
Torque Demo error LNK2019: unresolved external symbol _ov_clear referenced in function "public: virtual void __thiscall VorbisStream::detachStream(void)" (?detachStream@VorbisStream@@UAEXXZ)
Torque Demo error LNK2019: unresolved external symbol _ov_pcm_tell referenced in function "public: virtual unsigned int __thiscall VorbisStream::getPosition(void)const " (?getPosition@VorbisStream@@UBEIXZ)
Torque Demo error LNK2019: unresolved external symbol _ov_pcm_seek referenced in function "public: virtual bool __thiscall VorbisStream::setPosition(unsigned int)" (?setPosition@VorbisStream@@UAE_NI@Z)
Torque Demo error LNK2019: unresolved external symbol _ov_time_tell referenced in function "public: virtual float __thiscall VorbisStream::getTime(void)" (?getTime@VorbisStream@@UAEMXZ)
Torque Demo error LNK2019: unresolved external symbol _ov_time_seek referenced in function "public: virtual bool __thiscall VorbisStream::setTime(float)" (?setTime@VorbisStream@@UAE_NM@Z)
Torque Demo error LNK2019: unresolved external symbol _ov_read referenced in function "protected: virtual bool __thiscall VorbisStream::_read(unsigned int,void *)" (?_read@VorbisStream@@MAE_NIPAX@Z)
Torque Demo fatal error LNK1120: 12 unresolved externals


I think that Audio in oldAudio.h does not contain the same things as platformAudio. I am not a C++ programmer by trade, so I don't know for sure why this does not work. Any help is apreciated.

Marrion Cox
#6
12/15/2004 (5:29 am)
If I disable guiAviBitmapCtrl.cc then I still get the above errors. Any idea What these error mean?

Marrion

After changing the lib files in links and disabling a couple of things in my guiIconCtrl it now compiles just fine.

Thanks again,

Marrion
#7
12/15/2004 (5:48 am)
Marrion,

Did you followed the install instructions? Seems that it's not linking the ogg libraries. If so, try a rebuild all.

Also, I don't have this GuiIconCtrl class here, but I think that the problems is the same, change to oldaudio.h.

Please edit your posts to clean the space, if there's still any building errors please send it to marcelo@greenlandstudios.com
#8
12/15/2004 (12:24 pm)
Is the going into HEAD GG?
#9
12/15/2004 (2:55 pm)
OK. I have this working correctly and it is a noticible improvement to the audio, but I wonder - what is the purpose of the empty file audioFunctions.cc? Is it there for some type of compatibility reason?
#10
12/15/2004 (2:58 pm)
@Westy,

Probably not, since if you read it carefuly he has said that this is part of a larger project he is doing for GG. This is not cross-platform and he is redoing the whole thing to use OpenAl or DirectSound3D natively.
#11
12/16/2004 (3:23 am)
After changing all my music to mono the distance falloff is working, but for some reason the pitch is changing when I move around inside the sphere. All my music/audio files are:

Mono, 44100Hz, 16-Bit, OGG

Is this correct? I noticed that the stocl TGE audio files are 22050. Is the pitch of my audio files changing because of this? Mabie some of my code is wrong? I tried changing my ogg files into wav but they are doing the same thing.

Update: The pitch only changes while I am moving; when I stop the pitch goes back to normal. Is there any way to fix this?

Update: Doppler is in:

C:\temp\Lighting Pack 1.3\SynapseGaming\contentPacks\LightingPack\engine\audio\audio.cc(161): alDopplerFactor(0);
C:\temp\Lighting Pack 1.3\SynapseGaming\contentPacks\LightingPack\engine\audio\audio.cc(163): //alDopplerFactor(0);
C:\temp\Lighting Pack 1.3\SynapseGaming\contentPacks\LightingPack\engine\audio\audio.cc(164): //alDopplerVelocity(1);

but alDopplerFactor is not defined anywhere. That's the only doppler in Torque. What do I change to disable it?


Thanks for your help,

Marrion
#12
12/16/2004 (4:10 am)
Marcelo

I have integrated your resource and it works fine for me except for interiors. I have a wind sound effect that loops continuously while the player is outside. When the player goes into any interior the wind sound effect keeps playing. Before the upgrade the effect always dropped off when ever you enter an interior.

Any ideas??? I'll start digging into this and post what I find. I was just curious if you have encountered this yourself.

Thanks
#13
12/16/2004 (4:17 am)
Westy: I think not, due to the reason David posted.

David: audioFunctions.cc is there because I forgot to delete it. :)

Marrion: This should be the doppler effect, you can disable it or attenuate it, search your .cc files for doppler.

Jackie: I dropped ambientAudioManager.cc due to compatibility vs. time problems, but you can reintegrate it.
#14
12/16/2004 (5:17 am)
@Marcelo
I have a problem
When i use ogg files it works really good but when i use the wave files all my sounds , sounds like a humblebee or something.
And it doesnt matter if it is a emitter or player sound.
Tried differnt OpenAl.dll but it didnt help.
Any hints ?

Used test version SDK 1.3 , Soundcards Sblive.
#15
12/16/2004 (7:26 am)
@Billy,
That's really strange, since both the wav and ogg files are filtered to raw PCM stream before being played on OpenAL, these errors happens when you run torquedemo?

That's why we decided to move on to a multiple API support, unfortunately OpenAL seem to be very buggy at the moment, at least at windows platform.
#16
12/16/2004 (10:58 am)
@Marcelo
I use SDK 1.3 starter.fps and the only thing added is this patch.
I moved some of my working wave files from my game , converted them to all kind
of wave formats and get the beep sound on all emitters.
Strange thing.
#17
12/16/2004 (2:05 pm)
Marcelo

I too am in the same boat with time. I will try and address my issues later. I do like your updates though. I have gone back to my original audio design. I have everything working fine using it like directional audio, looping audio, full EAX support....etc..... When I get some more time I'll get back on this.

This is a good resource!
Thanks....
#18
12/16/2004 (2:15 pm)
@Billy: If I understood, this problem happens even on the original starter.fps?
Have you tried this? "If you have problems on windows XP please download the default latest openal here and put in your game directory, also you will need to delete your original OpenAL32.dll from System32 directory so the game can run the supplied one."
Because the only problem I was having was fixed in this dll version.


@Jackie: I was developing EAX support too, but I've stopped it to work on the new interface. :)
#19
12/16/2004 (6:59 pm)
Good deal Marcelo. I really like how you have this all cleaned up. I look forward to seeing your updates. Let me know if I can be of any help to you.

Thanks....
#20
12/21/2004 (10:38 am)
Marcelo - just wanted to say what a great resource this is. It appears to solve a long standing memory leak caused by streaming ogg files, and the quality of the audio is much improved.

Thanks for all your hard work.
Page «Previous 1 2 3 Last »