Ejemplo n.º 1
0
        /// <summary>
        /// Returns the master volume for the audio system.
        /// The range of the volume is 0-10, with 0 being silent and 10 being full volume.
        /// </summary>
        /// <param name="volume">The current volume value.</param>
        /// <returns>
        /// MLResult.Result will be <c>MLResult.Code.Ok</c> if successful.
        /// MLResult.Result will be <c>MLResult.Code.UnspecifiedFailure</c> if failed due to internal error.
        /// MLResult.Result will be <c>MLResult.Code.InvalidParam</c> if a parameter is invalid.
        /// MLResult.Result will be <c>MLResult.Code.PrivilegeDenied</c> if <c>AudioCaptureMic</c> privilege is denied.
        /// MLResult.Result will be <c>MLResult.Code.AudioNotImplemented</c> if the function is not implemented.
        /// </returns>
        private MLResult.Code GetMasterVolume(out float volume)
        {
            MLResult.Code result;

            try
            {
                result = NativeBindings.MLAudioGetMasterVolume(out volume);
                if (result != MLResult.Code.Ok)
                {
                    MLPluginLog.ErrorFormat("MLAudio.GetMasterVolume failed to get the volume. Reason: {0}", result);
                }
            }
            catch (System.DllNotFoundException)
            {
                // Exception is caught in the Singleton BaseStart().
                throw;
            }

            return(result);
        }