How do you use XAudio2 object in your game?

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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.

  • 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~?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)