Ejemplo n.º 1
0
        internal double GetLoudness()
        {
            double       loudness;
            Ebur128Error result = SafeNativeMethods.GetLoudness(_handle, out loudness);

            if (result != Ebur128Error.Success)
            {
                throw new IOException(string.Format(CultureInfo.CurrentCulture,
                                                    Resources.NativeAnalyzerGetLoudnessError, result));
            }
            return(loudness);
        }
Ejemplo n.º 2
0
        internal void AddFrames(float[] frames)
        {
            Contract.Requires(frames != null);

            Ebur128Error result = SafeNativeMethods.AddFrames(_handle, frames,
                                                              new UIntPtr((uint)frames.Length / _channels));

            if (result != Ebur128Error.Success)
            {
                throw new IOException(string.Format(CultureInfo.CurrentCulture,
                                                    Resources.NativeAnalyzerAddFramesError, result));
            }
        }
Ejemplo n.º 3
0
        internal double GetLoudnessMultiple()
        {
            IntPtr[] handles = _groupState.Handles.ToArray().Select(handle => handle.DangerousGetHandle()).ToArray();

            double       loudness;
            Ebur128Error result = SafeNativeMethods.GetLoudnessMultiple(handles, new UIntPtr((uint)handles.Length),
                                                                        out loudness);

            if (result != Ebur128Error.Success)
            {
                throw new IOException(string.Format(CultureInfo.CurrentCulture,
                                                    Resources.NativeAnalyzerGetLoudnessError, result));
            }
            return(loudness);
        }
Ejemplo n.º 4
0
        internal double GetSamplePeak()
        {
            double combinedPeak = 0;

            for (uint channel = 0; channel < _channels; channel++)
            {
                double       channelPeak;
                Ebur128Error result = SafeNativeMethods.GetSamplePeak(_handle, channel, out channelPeak);
                if (result != Ebur128Error.Success)
                {
                    throw new IOException(string.Format(CultureInfo.CurrentCulture,
                                                        Resources.NativeAnalyzerGetLoudnessError, result));
                }
                combinedPeak = Math.Max(combinedPeak, channelPeak);
            }

            return(combinedPeak);
        }