Ejemplo n.º 1
0
        public bool SetEqualizer(int[] leftChannelBandData, int[] rightChannelBandData)
        {
            if (leftChannelBandData == null)
            {
                throw new ArgumentNullException("leftChannelBandData");
            }
            if (rightChannelBandData == null)
            {
                throw new ArgumentNullException("rightChannelBandData");
            }
            if (leftChannelBandData.Length != 16)
            {
                throw new ArgumentException("The equalizer's left channel band data must consist of 16 values between 0 and 100");
            }
            if (rightChannelBandData.Length != 16)
            {
                throw new ArgumentException("The equalizer's right channel band data must consist of 16 values between 0 and 100");
            }
            if (!this.wrapper.IsInitialized)
            {
                this.wrapper.OnLogError("LCD.SetEqualizer(): Not initialized");
                throw new InvalidOperationException("The display is not initialized");
            }

            iMonNativeApi.iMonDisplayEqualizerData eqLeftData = new iMonNativeApi.iMonDisplayEqualizerData();
            eqLeftData.BandData = leftChannelBandData;
            iMonNativeApi.iMonDisplayEqualizerData eqRightData = new iMonNativeApi.iMonDisplayEqualizerData();
            eqRightData.BandData = rightChannelBandData;

            this.wrapper.OnLog("IMON_Display_SetLcdEqData()");
            iMonNativeApi.iMonDisplayResult result = iMonNativeApi.IMON_Display_SetLcdEqData(ref eqLeftData, ref eqRightData);

            switch (result)
            {
                case iMonNativeApi.iMonDisplayResult.Succeeded:
                    return true;

                case iMonNativeApi.iMonDisplayResult.InvalidPointer:
                    this.wrapper.OnLogError("IMON_Display_SetLcdEqData() => Invalid pointer");
                    throw new NullReferenceException();

                case iMonNativeApi.iMonDisplayResult.NotInitialized:
                    this.wrapper.OnLogError("IMON_Display_SetLcdEqData() => Not initialized");
                    throw new InvalidOperationException("The display is not initialized");
            }

            return false;
        }
Ejemplo n.º 2
0
        public bool SetEqualizer(int[] leftChannelBandData, int[] rightChannelBandData)
        {
            if (leftChannelBandData == null)
            {
                throw new ArgumentNullException("leftChannelBandData");
            }
            if (rightChannelBandData == null)
            {
                throw new ArgumentNullException("rightChannelBandData");
            }
            if (leftChannelBandData.Length != 16)
            {
                throw new ArgumentException("The equalizer's left channel band data must consist of 16 values between 0 and 100");
            }
            if (rightChannelBandData.Length != 16)
            {
                throw new ArgumentException("The equalizer's right channel band data must consist of 16 values between 0 and 100");
            }
            if (!this.wrapper.IsInitialized)
            {
                this.wrapper.OnLogError("LCD.SetEqualizer(): Not initialized");
                throw new InvalidOperationException("The display is not initialized");
            }

            iMonNativeApi.iMonDisplayEqualizerData eqLeftData = new iMonNativeApi.iMonDisplayEqualizerData();
            eqLeftData.BandData = leftChannelBandData;
            iMonNativeApi.iMonDisplayEqualizerData eqRightData = new iMonNativeApi.iMonDisplayEqualizerData();
            eqRightData.BandData = rightChannelBandData;

            this.wrapper.OnLog("IMON_Display_SetLcdEqData()");
            iMonNativeApi.iMonDisplayResult result = iMonNativeApi.IMON_Display_SetLcdEqData(ref eqLeftData, ref eqRightData);

            switch (result)
            {
            case iMonNativeApi.iMonDisplayResult.Succeeded:
                return(true);

            case iMonNativeApi.iMonDisplayResult.InvalidPointer:
                this.wrapper.OnLogError("IMON_Display_SetLcdEqData() => Invalid pointer");
                throw new NullReferenceException();

            case iMonNativeApi.iMonDisplayResult.NotInitialized:
                this.wrapper.OnLogError("IMON_Display_SetLcdEqData() => Not initialized");
                throw new InvalidOperationException("The display is not initialized");
            }

            return(false);
        }