예제 #1
0
        static Dictionary <double, float[]> GetGainDifferences(List <HRTFSetEntry> entries, List <double> hValues)
        {
            Dictionary <double, float[]> result = new Dictionary <double, float[]>(); // Distance; array by hValues

            for (int entry = 0, count = entries.Count; entry < count; ++entry)
            {
                HRTFSetEntry setEntry = entries[entry];
                float        maxGain = float.MinValue, minGain = float.MaxValue;
                for (int channel = 0; channel < setEntry.Data.Length; ++channel)
                {
                    float peak = QMath.GainToDb(WaveformUtils.GetRMS(setEntry.Data[channel]));
                    if (maxGain < peak)
                    {
                        maxGain = peak;
                    }
                    if (minGain > peak)
                    {
                        minGain = peak;
                    }
                }
                if (!result.ContainsKey(setEntry.Distance))
                {
                    result[setEntry.Distance] = new float[hValues.Count];
                }
                result[setEntry.Distance][hValues.IndexOf(setEntry.Azimuth)] = maxGain - minGain;
            }
            return(result);
        }