Xaudio2 Positioned Sounds

This forum is currently in read-only mode.
From the Asset Store
Grenade Sound Library contains: 135 sounds 50 grenade sounds and 85 surface sounds
  • ok, this may be a no-brainer, but I've got the positioned sound working fine, but I can only seem to get 1 instance of the attached object to actually play the sound.

    I have a top down map with this beach see... and there's a shore, and all sorts of shore tiles, and I wanted the sound of waves to get louder as the player approaches the shore tiles, but so far, it only does it for one instance, is there a way to attach it to all of them? Or have them all play the same sound and I'll just compensate with the volumes?

    Is it just me or does Xaudio2 seem a bit counter-intuitive...

  • I have it working in my project. How are you playing the sound? I have mine set up using auto play. Also check that you have the listener set to the right objects etc.

  • It plays the sound fine, and it gets louder the closer the player gets to it, so all of that is fine. The problem is that I need multiple instance of the same object to be able to this at the same time, whereas right now, only the first instance does.

    If I have 8 copies of the shore tile that are supposed to play the sound of waves, then right now only the first one does, where I need all of them too.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I got what you meant chap, I have it working in my game, on multiple instances of the same object. I have not had to do anything special to get it working.

    Without anymore info I will just throw this out and say try something like "for all-shore tiles" play sound.

    If that doesn't help you will need to offer some more information into what you are doing.

  • oh haha sorry, I misunderstood. Here's what I began with...

    Start of layout: - set listener to "player"

    - play channel 3

    - attach channel 3 to "shore"

    this attached the sound played in channel 3 to the first instance of the shore object...

    then I tried...

    Start of layout: - set listener to "player"

    - play channel 3

    For each object "shore": - attach channel 3 to "shore"

    for some reason all this did was to attach channel 3 to the second instance of the shore object (which I can't understand at all)

    I really appreciate the help by the way, this problem is just frustrating me to no end and keeping me from focusing on the other functions I need to finish up...

  • Instead of using a preset channel, try using autoplay.

    I have mine set up as follows

    Trigger once

    -For each Object-XAudio2: Autoplay file "sound.wav"(Loop) at Object

    -XAudio2: Set channel XAudio2.LastChannel volume to 1dB

    I am thinking it might come down to being limited to 1 channel per object, so while this works, if you have 64 shore objects....you are going to run out of channels.

    Alternatively, you could try attaching the sound to the ocean/water body beyond the shore objects, it generates the the sound from the object as a whole instead of one point, then this might work for you. You will need to do some experimentation to see what works for you.

  • haha yeah...I've got WAY more than 64 shore tiles lol, this is the overhead world map for my game...

    but I'll definitely try what you said, I had tried a single object beyond the shore previously, but obviously couldn't get more than one to work, but that makes sense about autoplay using multiple channels

    I was hoping that there was a way to have each instance draw from the same source, but Xaudio2 just doesn't work that way I guess...

    Anyway, thanks so much for your help! Now I just need to get pixel perfect Fog of War...ugh

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