|
|||||||
| Forum Home | Register | Members List | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||||||||
|
Member
Location: N. America |
I am not sure where to post this, but here!
So, I am at the stage, where I am planning ahead to add sounds to my game. As of now, I just want to learn what all options I have and be ready with the code to integrate it. I was going through a bunch of tutorials, but from a programmer's perspective, I could not decide what to use and to what extent. Broadly speaking; here are the effects that I have in mind: - background in-game sound - sound effects like whenever a player takes a hit or an enemy fires a bullet. - (if I can make it happen tho..) I have a enemy unit called frogger. I want the volume to grow as I approach it( some would recognise it as doppler effect), the way u have the noise of flies/ croaking of a frog in a swamp. The options, that I am aware of are:: - SoundEffectInstance - MediaPlayer.Play(Song) - using XACT The first two options let me use mp3, while XACT only allows wav format. My concern is: I dont know which one is good from a memory perspective. Both can play the sound..but what would be a better way...are there any memory leaks that I need to think about or what? I am also interested in exploring the intent behind these three ways, as in, are they custom made with something specific in mind. I would appreciate any suggestions as to what should i go ahead with.. Thanks |
||||||||
|
|
|
|
|
#2 | ||||||||
|
Administrator
Location: UK |
(Guessing from experience with other APIS)
MediaPlayer is mainly used for background music (ie long tracks that are played in the background) and it should be streaming the music from disk rather then decoding the entire song in one go. SoundEffectInstance and XACT will decompress all the audio data into a memory ready format so it can played at a moments notice with minimal delay (the audio backend is usually on a separate thread).
__________________
Steven Yau [Alix Games Blog] [Portfolio] [How I broke into the Games Industry] [Why I left my Games Job] [How to be a Games Tester] [Getting back into the Game] |
||||||||
|
|
|
|
|
#3 | ||||||||
|
Member
Location: N. America |
Thanks yaustar for the insights. I finally tried it out and it works without much effort. I also see the purpose of each of these constructs..
But, you got me inquisitive there about using a different thread for running sounds. I did google to find out something, but couldn't find a reasonable answer. I am still looking for it, but if you can guide me or provide me some leads which could get me going, that would be great! Thanks a lot ![]() |
||||||||
|
|
|
|
|
#4 | ||||||||
|
Administrator
Location: UK |
Since you are using XNA, my guess is that the multithreading is done for you so you shouldn't need to do anything beyond what the API supplies you.
__________________
Steven Yau [Alix Games Blog] [Portfolio] [How I broke into the Games Industry] [Why I left my Games Job] [How to be a Games Tester] [Getting back into the Game] |
||||||||
|
|
|
|
|
#5 | ||||||||
|
Administrator
Location: London, UK |
If you find that it doesn't then using threads is really easy in C# anyway.
__________________
Michael 'Adrir' Scott :: Games, Virtual Worlds, Education Networking | Research | Teaching |
||||||||
|
|
|
|
|
#6 | ||||||||
|
Member
Location: N. America |
After trying out a few things and more googling, I came to this conclusion that XACT should be used as much as possible, since it compresses for you, thereby reducing the load-time. Well, that limits me to .wav files, but I think its worth it. Xact also provides a lot of configuration options. Not familiar with a lot of sound editing utilities, I dint delve much into it. But, I see using Xact is the preferred way to go.
Also, I am still trying to find out about multi-threading and xact. I know multi-threading from java, and am familiar with the concepts. Actually, this makes me want even more to try it out in my game ![]() If I dont find anything, I will try to post a scheme, on my own, for the same and would really appreciate if you guys can comment on that also. Thanks |
||||||||
|
|
|
|
|
#7 | ||||||||
|
Moderator
Location: Philadelphia, PA |
Yup Xact is preferred way for XNA for sure.
__________________
Grant Shonkwiler() "I would love to fix the world if someone would just give me the source code" Website Industry blog LinkedIn |
||||||||
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
All times are GMT -8. The time now is 10:18 PM.




























Linear Mode

