Native audio Plugin SDK channels question
Can someone else confirm that whilst parameters such as sample rate (state->samplerate) and DSP buffer size (state->dspbuffersize) are available at the point UNITY_AUDIODSP_RESULT UNITY_AUDIODSP_CALLBACK CreateCallback(UnityAudioEffectState* state) is called, channel input data (e.g. 1 = mono, 2 = stereo, 8 = 7.1 surround etc.) isn't available? More importantly, why is this - when all mentioned parameters are accessible from Unity's AudioManager and seem to have default values? Is there a way around this, if one requires speaker setup info at the initialization of the plugin as opposed to when audio begins streaming?
Thanks, Chris
PS Input and output channel values are accessible once ProcessCallback is called (inchannels, outchannels), but this isn't ideal as a first point of access to channel info.
Answer by Sinnerboy_GHZ · Dec 08, 2016 at 02:11 PM
Duplicate question on forum received following reply: " New
Hi Sinnerboy,
I'm not an audio expert but I will attempt an answer.
As far as I understand it, you're trying to get the configuration of the speakers from the system at the beginning of the game, right? When you say "channel input data" you expect to get one of the values from AudioSpeakerMode?
As you already know, you can define a default speakerMode in the Audio Manager settings in-editor, but once the game runs this setting is in the AudioSettings.speakerMode.
Unfortunately this can'd be changed directly, but you can use AudioSettings.GetConfiguration to get the current one, and then in the OnAudioConfigurationChanged callback you can read (and possibly change with AudioSettings.Reset) the current audio configuration. You should be able to find the current speakerMode in there.
Hope this solves your problem, apologies if I didn't understand the question in the first place!
Ciro Continisio Technical Evangelist @ Unity @CiroContns"
To which I've replied:
"Hi Ciro, Thanks for the reply. I'm not able to access AudioSettings. This may be due to the Native Audio DSP SDK being in C++ and the compiled code being in DLL format, whereas I imagine a C# script sitting in the Editor folder would be able to access those objects/classes without issue. I believe any audio parameter information sent from Unity to the audio plugin is captured with the AudioPluginInterface header and source within the SDK, and I'd merely like to confirm this information doesn't include the desired input/output channel configuration of the plugin (and why this is). This is fairly fundamental information a DSP plugin requires, ideally upon initialization.
Thanks, Chris"
Until it's clear where I should be directing these kinds of enquiries I'll keep posting on both this and the forum.
Your answer
Follow this Question
Related Questions
Changing Impulse Response AudioClip in Convolution Reverb Demo plugin of the Native Audio Plugin SDK 2 Answers
Audio Spatializer SDK. Source/Listener location matrix 0 Answers
Playback bit rate is faster than recording bit rate in Audio Spatializer SDK 0 Answers
Native audio plugin xcode build problem "undefined symbols" 0 Answers
Audio Spatializer Plugin SDK: how can plugin get channel count of input audio source? 0 Answers