示例#1
0
        private byte[] GetBandsContent()
        {
            var memStream = new MemoryStream();

            using (BinaryFile binFile = new BinaryFile(memStream, BinaryFile.ByteOrder.LittleEndian, Encoding.ASCII))
            {
                binFile.Write((UInt32)(int)Bands.Count * 13 + 22);

                for (int i = 0; i < 24; i++)
                {
                    if (i < Bands.Count)
                    {
                        binFile.Write((float)(Bands[i].Enabled ? 1 : 0));
                        binFile.Write((float)(1)); // unknown 1
                        binFile.Write((float)FabfilterProQ2.FreqConvert(Bands[i].Frequency));
                        binFile.Write((float)Bands[i].Gain);
                        binFile.Write((float)Bands[i].DynamicRange);
                        binFile.Write((float)(1)); // unknown 3
                        binFile.Write((float)Bands[i].DynamicThreshold);
                        binFile.Write((float)FabfilterProQ2.QConvert(Bands[i].Q));
                        binFile.Write((float)Bands[i].Shape);
                        binFile.Write((float)Bands[i].Slope);
                        binFile.Write((float)Bands[i].StereoPlacement);
                        binFile.Write((float)(1)); // unknown 5
                        binFile.Write((float)(0)); // unknown 6
                    }
                    else
                    {
                        binFile.Write((float)0);
                        binFile.Write((float)(1));  // unknown 1
                        binFile.Write((float)FabfilterProQ2.FreqConvert(1000));
                        binFile.Write((float)0);    // gain
                        binFile.Write((float)0);    // dynamic range
                        binFile.Write((float)(1));  // unknown 3
                        binFile.Write((float)(1));  // dynamic threshold
                        binFile.Write((float)FabfilterProQ2.QConvert(1));
                        binFile.Write((float)ProQ2Shape.Bell);
                        binFile.Write((float)ProQSlope.Slope24dB_oct);
                        binFile.Write((float)ProQ2StereoPlacement.Stereo);
                        binFile.Write((float)(1));  // unknown 5
                        binFile.Write((float)(0));  // unknown 6
                    }
                }

                // write the remaining floats
                foreach (var fUnknown in UnknownParameters)
                {
                    binFile.Write((float)fUnknown); // unknown
                }
            }

            return(memStream.ToArray());
        }
示例#2
0
        private byte[] GetBandsContent()
        {
            var memStream = new MemoryStream();

            using (BinaryFile binFile = new BinaryFile(memStream, BinaryFile.ByteOrder.LittleEndian, Encoding.ASCII))
            {
                binFile.Write((UInt32)(int)Bands.Count * 7 + 22);

                for (int i = 0; i < 24; i++)
                {
                    if (i < Bands.Count)
                    {
                        binFile.Write((float)(Bands[i].Enabled ? 1 : 2));
                        binFile.Write((float)FabfilterProQ2.FreqConvert(Bands[i].Frequency));
                        binFile.Write((float)Bands[i].Gain);
                        binFile.Write((float)FabfilterProQ2.QConvert(Bands[i].Q));
                        binFile.Write((float)Bands[i].Shape);
                        binFile.Write((float)Bands[i].Slope);
                        binFile.Write((float)Bands[i].StereoPlacement);
                    }
                    else
                    {
                        binFile.Write((float)2);
                        binFile.Write((float)FabfilterProQ2.FreqConvert(1000));
                        binFile.Write((float)0);
                        binFile.Write((float)FabfilterProQ2.QConvert(1));
                        binFile.Write((float)ProQ2Shape.Bell);
                        binFile.Write((float)ProQSlope.Slope24dB_oct);
                        binFile.Write((float)ProQ2StereoPlacement.Stereo);
                    }
                }

                // write the remaining floats
                binFile.Write((float)ProcessingMode);               // Zero Latency: 0.0, Natural Phase: 1.0, Linear Phase: 2.0
                binFile.Write((float)ProcessingResolution);         // 0 - 4, Medium
                binFile.Write((float)ChannelMode);                  // 0 = Left/Right, 1 = Mid/Side
                binFile.Write((float)GainScale);                    // 100%
                binFile.Write((float)OutputLevel);                  // 0.0 dB, -1 to 1 (- Infinity to +36 dB , 0 = 0 dB)
                binFile.Write((float)OutputPan);                    // Left 0 dB, Right: 0 dB, -1 to 1 (0 = middle)
                binFile.Write((float)ByPass);                       // Not Bypassed
                binFile.Write((float)OutputInvertPhase);            // Normal
                binFile.Write((float)AutoGain);                     // Off
                binFile.Write((float)AnalyzerShowPreProcessing);    // Disabled - 0: Off, 1: On
                binFile.Write((float)AnalyzerShowPostProcessing);   // Disabled - 0: Off, 1: On
                binFile.Write((float)AnalyzerShowSidechain);        // Disabled - 0: Off, 1: On
                binFile.Write((float)AnalyzerRange);                // Analyzer Range in dB. 0.0: 60dB, 1.0: 90dB, 2.0: 120dB
                binFile.Write((float)AnalyzerResolution);           // Analyzer Resolution. 0.0: Low, 1.0: Medium, 2.0: High, 3.00: Maximum
                binFile.Write((float)AnalyzerSpeed);                // Analyzer Speed. 0.0: Very Slow, 1.0: Slow, 2.0: Medium, 3.0 Fast, 4.0: Very Fast
                binFile.Write((float)AnalyzerTilt);                 // Analyzer Tilt in dB/oct. 0.0: 0.0, 1.0: 1.5, 2.0: 3.0, 3.0: 4.5, 4.0: 6.0
                binFile.Write((float)AnalyzerFreeze);               // 0: Off, 1: On
                binFile.Write((float)SpectrumGrab);                 // Enabled
                binFile.Write((float)DisplayRange);                 // 12dB
                binFile.Write((float)ReceiveMidi);                  // Enabled
                binFile.Write((float)SoloBand);                     // -1
                binFile.Write((float)SoloGain);                     // 0.00

                // Don't write the ex fields
                // binFile.Write((float)ExAutoGain);                   // (Other)
            }

            return(memStream.ToArray());
        }