Hello, I am working on implementing custom system sounds to our aircraft
(CAWS, GPWS, etc.). I want to implement a system where when one alert sound
finishes, the next is played. The project is C++/WASM. Currently, the only way
I can imagine to achieve this is to know how long the sound is and record when
we started playing it. Is there a way to have an event or callback when the
sound is complete so we can play the next one?
I’m assuming you intend to use dxsound; if you’re using WWise then I have no
idea. Pseudo-code would be: - check which buffers are available (this may be
an existing one or if all are in use, create a new one) - allocate a buffer
as per above - start the sound - check for buffer in use - if the buffer is
not in use, your sound has finished playing. I know this approach works
because I built a dxsound black box in P3D. I haven’t yet ported it to MSFS
but I expect it to work as there are no ‘forbidden’ I/O calls in it.
You are correct - normally, that’s how I would do it. Unfortunately, to my
knowledge, none of the (real) Windows SDKs or DirectX SDKs are available in
the WASM/MSFS environment. As of now, we only have WWise that, to my
knowledge, can only start a sound or stop a sound via LocalVars/W: events. I
have yet to find in the SDK anything about state tracking or direct
interaction with the sound system. We did something similar with XAudio2 for
the 717 in P3D - it just checked to see if the buffer was empty for a
specified call ID. That’s simply not possible in MSFS from what I can tell.
I’m finding that a lot of the things we did in P3D and before are possible in
MSFS, but not at all the same way.
You too are correct. I started a port to MSFS two nights ago and found a
killer line lurking in one of the header files… '#include '. That was the
end of that idea…
Hello @turbofandude ! We do not expose Wwise Callbacks. However I can suggest
you a workaround for what you want to achieve, hope it can help you. - First,
create a Sequence Container in Wwise inside the Audio Work Unit of your
aircraft - Inside this Container put the sounds you want to be played one
after the other, and then put them inside the “playlist” field ( more details
about Sequence Containers
here
) - In your event, instead of playing your sound, play your Sequence
Container - If you don’t want all sounds to always be played, you can create
an RTPC and link it to the volume of your optional sounds. You can manage your
RTPCs by defining them inside your sound.xml like this :
Please tell me if this helped you. Regards, Alexandre
This would not work for us because the order/which sounds are playing is
dynamic in nature (they’re aural alerts for various aircraft configuration
issues). That said, I was able to implement a solution that accepts the
duration of the sound and records the time the command to start it was given,
therefore knowing if it’s “finished” as a function of time.