Can someone explain to me exactly how this works? And more importantly, has anyone used it?
This is part of the new audio streaming system and probably shouldn’t be exposed as openly as this. It’s currently only used to load the first chunk of audio from a sound that has been marked for streaming, so that playback can be instantaneous.
Can this not be used to step through the data as it’s being played?
I’m actually looking for something similar to this function call in Unity. Unity - Scripting API: AudioSource.GetOutputData
I’d like to have access to the chunk of data in the wav file that is currently being output.
It’s not really designed for use like that as it’s a blocking function, you’d cause hitches while it loads the chunk you want. This is also compressed data, so you would need to use the same decompression code that’s used for streaming.
The only code we have to expose PCM data at present is in the SoundVisualization plugin, I don’t know if that might be similar to what you’re looking for?
Ok, I will look in to that. I need access to uncompressed data, so I can just create a standard uncompressed WAV file. I’m not sure yet if the API allows me to create my own audio source in code. This may work though. Is the documentation for that also listed into the API docs?
I believe Unity only had that one function as well that gave me access to that data, and from all the community discussion I could find on it, it was mainly used in audio visualizations. Hopefully they function similar enough.
But leave it to me to be different and use these functions in odd peculiar ways. So I’m not using this for a visualization.