How do you use XAudio2 object in your game?

For questions about using Classic.

Post » Thu Sep 02, 2010 9:54 am

It's very interesting to hear how do you use XAudio2 object in your game or if you don't use it how do you work with sound generally, which formats do you use for audio files, do you experience bugs , if yes, then what kind of bugs is that, in short, everything?

I started this topic because of one silly bug - white screen on game start, I'm sure it has to do with sound. My audio card is Audigy 2 and video card is NVidia GS8400, PC is Dual core Athlon X64(2.81 Ghz each), DDR2 2 GB RAM.

I used XAudio2 for my demo, marked it as Global, made sounds load into each channel per layout(24 sounds t o24 channels, all of them are oggs) and then encountered that bug(white screen). After 20 seconds of hard thoughts I decided to load some sounds not per layout but in certain layouts and leave the main sounds(walking, punch, death, etc.) per layout(6 sounds). From that moment the game works fine for me but sometimes people tell me there's still white screen on their computers (that happened 2 times already). Strange but their pc's are quite good.
B
78
S
23
G
6
Posts: 234
Reputation: 7,662

Post » Thu Sep 02, 2010 10:45 am

I'm still trying to figure that out myself really - I have noticed I'm getting a lot of glitches when I 'autoplay file' when my character spawns a bullet every 6 ticks, the gunshots just don't load in fast enough so some cut out. I also have no clear idea of how to fade channels or music out generally or when transitioning between layers.

At the moment I'm using a new XAudio 2 object for every layout and just repeating the code but changing the object - when I was loading it all from one event sheet I was running into 'black' screens, black screens I get quite a lot while working in Construct, what is that - a memory thing~?
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Sat Sep 04, 2010 12:40 am

OP -

Why are you loading your sounds to channels? Does your game specifically require control over each channel?

Otherwise, just use autoplay file [at]* object for all your sound needs. Make sure your .wav files are all in standard frequencies:
44,100
22,050
11,025
16/8 bit, mono/stereo

*optional

If you want to specifically stop a certain object from playing whichever sound: use a PV and set it to "xaudio.lastautoplay" when it's played. Then xaudio "stop channel" (PV).


Mik
Have you made sure that you've checked 'Cache sounds under x MB' (def. 3)? Also - if you want sound to fade between layouts, the layout transition 'fade' does this for you (if that hels)
B
2
G
2
Posts: 42
Reputation: 734


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest