XNA Creators Club Online
Page 1 of 1 (1 items)
Sort Posts: Previous Next

question about going from dsound to xaudio2 - 3d sounds

Last post 01/10/2009 22:02 by sirlemonhead. 0 replies.
  • 01/10/2009 22:02

    question about going from dsound to xaudio2 - 3d sounds

    Hey, I'm still struggling with XAudio2, after converting to it from direct sound. XAudio2 is a really nice api - I have my streaming background music playback working perfectly, but i'm having trouble with the actual 3d sound playback. When I try to use 3d positioning, the sounds play back very distorted, as if they're playing too loudly but are clipping at a maximum volume level. Can I just get something confirmed? Say I have a certain number of sounds I want to position in 3d space, and have them pan, decrease in volume when you move further away from them, etc.. Is the below exactly what I need to do? 1: Have a listener, which represents my player. Every frame or so, update the listener to where the player is positioned in terms of x, y and z. Also, set the top and front orientation of the listener (the code did this originally with dsound) 2: then, for each 3d sound I want to play, I then have an emitter for each sound which I also update per frame, with the sounds 3d x,y and z location. Then, for each sound, once the emitter is updated, call X3DAudioCalculate passing in the listener (my player) struct, the current sound's emitter, and some flags (what should I set for that, If I just want basic non reverbed positioning? I'm using only X3DAUDIO_CALCULATE_MATRIX at the moment) then, when that's done, call SetOutputMatrix. This is done for each sound after the X3DAudioCalculate function is called. Is this right? This will properly pan and attenuate my sounds? I can get the code up if someone wants to see but there's quite a lot of it. I'd just like some confirmation that i'm doing the right thing so far :) thanks!
Page 1 of 1 (1 items) Previous Next