Audio Spatializer Plugin SDK: how can plugin get channel count of input audio source?
Hello Unity friends!
I am working on a Spatializer plugin and my plugin DSP code and I understand that Unity passes audio to my plugin as stereo, regardless of whether the underlying audio Clip is mono, stereo or multi-channel, by up or down-mixing as necessary.
So given that my plugin will always "see" audio as stereo, how can I access per instance (i.e. per audio source) info on e.g. channel count of the source. The documentation on spatializer instance data includes the following: struct UnityAudioSpatializerData { float listenermatrix[16]; // Matrix that transforms sourcepos into the local space of the listener float sourcematrix[16]; // Transform matrix of audio source float spatialblend; // Distance-controlled spatial blend float reverbzonemix; // Reverb zone mix level parameter (and curve) on audio source float spread; // Spread parameter of the audio source (0..360 degrees) float stereopan; // Stereo panning parameter of the audio source (-1: fully left, 1: fully right) // The spatializer plugin may override the distance attenuation in order to // influence the voice prioritization (leave this callback as NULL to use the // built-in audio source attenuation curve) UnityAudioEffect_DistanceAttenuationCallback distanceattenuationcallback; };
I would have thought that a channel count in this struct would be useful. So is there a way to infer the mono/stereo/multi channel nature of the audio source from the above? (e.g. maybe stereopan is set to a specific value for mono sources?) It seems I must be missing something here because it's clear that a spatializer would want to spatialize an audio source differently depending on its number of channels.
Thanks!
Your answer
Follow this Question
Related Questions
plugin inspector not working for OSX bundle 1 Answer
Is there any audio editor in assets store can handle complex audio behaviors? 0 Answers
Unity - How to add native view to Unity main activity? 0 Answers
Playback bit rate is faster than recording bit rate in Audio Spatializer SDK 0 Answers
Using .framework for iOS as Plugin. 0 Answers