public void SetMicVolume(float vol)
 {
     if (audAsyncDec != IntPtr.Zero)
     {
         MixCastAV.setMicVolume(audAsyncDec, vol);
     }
 }
        //multi tool function
        public RETURNCHANGETYPE SetPlay(string altName, int numChannels, int samplingRate, int bitsPerSample,
                                        MixCastAV.AUDIOCONFIG audioConfig, float micVolume, float desktopVolume, int delayMs)
        {
            if (_suppressingPlayback)
            {
                return(RETURNCHANGETYPE.NothingNewDoNothing);
            }
            //Debug.Log( "SetPlay()" );
            if (delayMs > 1000)
            {
                Debug.LogWarning("Delay is too high for the audio, " + delayMs + "ms, setting it to 1000ms.");
                delayMs = 1000;
            }

            //create the audio asynchronous interface
            string DeviceNameSwitch    = altName;
            int    nChannelsSwitch     = numChannels;
            int    samplingRateSwitch  = samplingRate;
            int    bitsPerSampleSwitch = bitsPerSample;

            MixCastAV.AUDIOCONFIG configSwitch = audioConfig;

            //when the string is null, we want to use some defaults for a null audio track still
            if (string.IsNullOrEmpty(altName) == true || altName.Contains(AudioDeviceManager.ALTNAMEFORNULL))
            {
                //dummy info for null track when no data found
                DeviceNameSwitch    = AudioDeviceManager.ALTNAMEFORNULL;
                nChannelsSwitch     = MixCastAV.DEFAUDIO_CHANNELS;
                samplingRateSwitch  = MixCastAV.DEFAUDIO_SAMPLING;
                bitsPerSampleSwitch = MixCastAV.DEFAUDIO_BITDEPTH;
            }


            //if it is exactly the same as last configuration
            if (audAsyncDec != IntPtr.Zero)
            {
                if (_adeviceAltName == altName &&
                    _adeviceBitsPerSample == bitsPerSample &&
                    _adeviceChannels == numChannels &&
                    _adeviceSamplingRate == samplingRate &&
                    _adeviceDelayMs == delayMs)
                {
                    if (_adeviceConfiguration == audioConfig)
                    {
                        //Debug.LogWarning( "No audio change for " + altName );
                        return(RETURNCHANGETYPE.NothingNewDoNothing); //nothing to do since it is the same as last time
                    }
                    else
                    {
                        // only audioConfig changed
                        SetAudioConfiguration(audioConfig);
                        //Debug.LogWarning( "Audio Config: " + audioConfig.ToString() );
                        return(RETURNCHANGETYPE.ConfigurationChangeOnly);
                    }
                }
                else
                {
                    Stop();
                }
            }

            //Debug.LogError("devicename: " + deviceName + ", nCh: " + numChannels + ", sampling: " + samplingRate + ", bitsPer: " + bitsPerSample + ", cfg: " + audioConfig);
            audAsyncDec = MixCastAV.createAudioDecodeAsync(DeviceNameSwitch, nChannelsSwitch,
                                                           samplingRateSwitch, bitsPerSampleSwitch, delayMs, MixCastAV.AUDIOCONFIG.MICROPHONE_AND_DESKTOP, MixCastAV.chunksPerSec);

            //Debug.Log("delay is set to : " + delayMs);

            if (audAsyncDec == IntPtr.Zero)
            {
                //Debug.LogError("Error creating Audio Device Async Interface." + audAsyncDec);
                Debug.LogWarning("Error creating decoder");
                return(RETURNCHANGETYPE.ErrorCreating);
            }
            else             //audAsyncDec is already ready
            {
                //successfully created, so save the variables
                _adeviceAltName       = DeviceNameSwitch;
                _adeviceChannels      = nChannelsSwitch;
                _adeviceSamplingRate  = samplingRateSwitch;
                _adeviceBitsPerSample = bitsPerSampleSwitch;
                _adeviceConfiguration = configSwitch;
                _adeviceDelayMs       = delayMs;

                MixCastAV.setMicVolume(audAsyncDec, micVolume);
                MixCastAV.setDesktopVolume(audAsyncDec, desktopVolume);
                Play();
                SetAudioConfiguration(audioConfig);
                //set intended configuration
                //if (LibAvStuff.checkStartedAudioDecodeAsync(audAsyncDec) == 0)

                // deviceName = _adeviceAltName; // commenting out so no import warning in SDK

                return(RETURNCHANGETYPE.MadeNewDevice);
            }
        }