Home » Questions » C++ Set3DPosition for Channel does not alter the channel. (nullptr)

Answered

0

0

Hello!

I have created a channel and applied it to a sound that gets played on a loop basis.
However, if I change the 3D coordinates for the channel, nothing happens.
I believe that this is due to the fact that there is no channel “creation”.
Every documentation I have found for Fmod simply just uses a channel, they never set it to anything, initializes it to anything. It’s just null.
I can’t find a constructor, I can’t find anything.
However, during my play of the sound, it should retrieve a channel from the audio function, but it doesn’t change the value.

Thanks a lot! I’ve changed my structure now but it still does not work. However, it does not return any errors (it says OK).
I’ve tried panning, and directly changing the 3D attributes, but always I hear the same audio at the same place. Do I have to create a listener?
It’s only for a 2D game so if SetPan could work that would be great.

You should leave SetChannelAttributes as FMOD::Channel*, only change PlaySound to FMOD::Channel**. Also I noticed you are passing in SoundClass to System::playSound, you should be passing in an FMOD::Sound*. I highly recommend you take a look at our examples and start with those, copying and modifying as necessary.

I send in a SoundClass which is typedef for FMOD::Sound* and then retrieve a channel and return it to the user of the function. I then alter that channel with error code “OK”. Still ordinary 1D sound though.

It works now! It was actually just missing a function call to system->update.. My bad! However, what settings for the listener is correct if i want to center the listener at the middle of the screen? (in my engine 0.5f, 0.5f)