public static void LoadDefaultParameter( ref RuntimeUtils.ConfigProxy._ParamOfMovieMode sParameter) { sParameter.m_rPreVolume = 1f; sParameter.m_bConvolverEnabled = 0; sParameter.m_szConvolverIR = new char[260]; for (int index = 0; index < 256; ++index) { sParameter.m_szConvolverIR[index] = char.MinValue; } sParameter.m_rConvolverIRGain = 1f; sParameter.m_bViPERBassEnabled = 0; sParameter.m_nViPERBassSpkSize = 60; sParameter.m_rViPERBassFactor = 0.0f; sParameter.m_bViPERClarityEnabled = 0; sParameter.m_rViPERClarityFactor = 0.0f; sParameter.m_bSurroundEnabled = 0; sParameter.m_r3DSurroundStereo = 1f; sParameter.m_r3DSurroundImage = 1f; sParameter.m_bReverbEnabled = 0; sParameter.m_rReverbSize = 0.0f; sParameter.m_rReverbPredelay = 0.0f; sParameter.m_rReverbDamping = 0.0f; sParameter.m_rReverbDensity = 0.0f; sParameter.m_rReverbBandwidth = 1f; sParameter.m_rReverbDecay = 0.0f; sParameter.m_rReverbEarlyMix = 0.0f; sParameter.m_rReverbMix = 0.0f; sParameter.m_rReverbGain = 1f; sParameter.m_bEqualizerEnabled = 0; sParameter.m_rpEqualizerBands = new float[18]; for (int index = 0; index < 18; ++index) { sParameter.m_rpEqualizerBands[index] = 1f; } sParameter.m_bCompressorEnabled = 0; sParameter.m_bCompAutoKnee = 1; sParameter.m_bCompAutoGain = 1; sParameter.m_bCompAutoAttack = 1; sParameter.m_bCompAutoRelease = 1; sParameter.m_rCompThreshold = 0.0f; sParameter.m_rCompRatio = 0.0f; sParameter.m_rCompKneeWidth = 0.0f; sParameter.m_rCompGain = 0.0f; sParameter.m_rCompAttack = Parameters.LOG2PARAM(0.005f, 0.0001f, 0.2f); sParameter.m_rCompRelease = Parameters.LOG2PARAM(0.05f, 0.005f, 2f); sParameter.m_bSmartVolumeEnabled = 0; sParameter.m_rSVRatio = 0.5f; sParameter.m_rSVVolume = 1f; sParameter.m_rSVMaxGain = 4f; sParameter.m_rPostVolume = 1f; }
public static bool SavePreset( string szFilePathName, RuntimeUtils.ConfigProxy._ParamOfMovieMode paramMovieMode) { byte[] buffer1 = Parameters.ParameterSerialize(paramMovieMode); if (buffer1 == null) { return(false); } try { FileStream fileStream = new FileStream(szFilePathName, FileMode.Create); byte[] buffer2 = new byte[14] { 86, 105, 80, 69, 82, 52, 87, 105, 110, 100, 111, 119, 115, 88 }; fileStream.Write(buffer2, 0, buffer2.Length); fileStream.WriteByte(0); fileStream.WriteByte(0); fileStream.WriteByte(1); fileStream.WriteByte(0); fileStream.Write(buffer1, 0, buffer1.Length); fileStream.Flush(); fileStream.Close(); return(true); } catch { return(false); } }
public void UpdateParameter( RuntimeUtils.ConfigProxy._ParamOfMovieMode sParameter) { mxUpdatingMutex.WaitOne(); paramMovie = sParameter; if (ptrConfigProxy == IntPtr.Zero) { mxUpdatingMutex.ReleaseMutex(); } else { IntPtr num = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfMovieMode))); Marshal.StructureToPtr((object)paramMovie, num, false); RuntimeUtils.ConfigProxy.UpdateMovieParameter(num, (uint)Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfMovieMode)), ptrConfigProxy); Marshal.FreeHGlobal(num); mxUpdatingMutex.ReleaseMutex(); } }
public static RuntimeUtils.ConfigProxy._ParamOfMovieMode DeserializeParamOfMovieMode( byte[] baRawData) { System.Type type = typeof(RuntimeUtils.ConfigProxy._ParamOfMovieMode); int num1 = Marshal.SizeOf(type); if (num1 != baRawData.Length) { RuntimeUtils.ConfigProxy._ParamOfMovieMode sParameter = new RuntimeUtils.ConfigProxy._ParamOfMovieMode(); Parameters.LoadDefaultParameter(ref sParameter); return(sParameter); } IntPtr num2 = Marshal.AllocHGlobal(num1); Marshal.Copy(baRawData, 0, num2, num1); object structure = Marshal.PtrToStructure(num2, type); Marshal.FreeHGlobal(num2); return((RuntimeUtils.ConfigProxy._ParamOfMovieMode)structure); }
public static bool ReadPreset( string szFilePathName, ref RuntimeUtils.ConfigProxy._ParamOfBaseSystem paramBaseSystem, ref RuntimeUtils.ConfigProxy._ParamOfMusicMode paramMusicMode, ref RuntimeUtils.ConfigProxy._ParamOfMovieMode paramMovieMode, ref RuntimeUtils.ConfigProxy._ParamOfFreestyle paramFreestyle, out bool bPBaseSystem, out bool bPMusicMode, out bool bPMovieMode, out bool bPFreestyle) { if (szFilePathName == null) { bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } if (szFilePathName.Length <= 0) { bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } if (!File.Exists(szFilePathName)) { bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } long length; try { length = new FileInfo(szFilePathName).Length; } catch { bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } if (length <= 0L) { bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } try { FileStream fileStream = new FileStream(szFilePathName, FileMode.Open); byte[] numArray1 = new byte[14] { 86, 105, 80, 69, 82, 52, 87, 105, 110, 100, 111, 119, 115, 88 }; byte[] buffer = new byte[14]; if (fileStream.Read(buffer, 0, buffer.Length) != buffer.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } for (int index = 0; index < numArray1.Length; ++index) { if (buffer[index] != numArray1[index]) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } } int num1 = fileStream.ReadByte(); int num2 = fileStream.ReadByte(); int num3 = fileStream.ReadByte(); int num4 = fileStream.ReadByte(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; long num5 = 18; if (num1 == 1) { num5 += Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfBaseSystem)); } if (num2 == 1) { num5 += Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfMusicMode)); } if (num3 == 1) { num5 += Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfMovieMode)); } if (num4 == 1) { num5 += Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfFreestyle)); } if (num5 != length) { long num6 = 18; if (num1 == 1) { num6 += Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfBaseSystem_1_0_1)); } if (num2 == 1) { num6 += Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfMusicMode)); } if (num3 == 1) { num6 += Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfMovieMode)); } if (num4 == 1) { num6 += Marshal.SizeOf(typeof(RuntimeUtils.ConfigProxy._ParamOfFreestyle)); } if (num6 == length) { if (num1 == 1) { byte[] numArray2 = new byte[Marshal.SizeOf((object)new RuntimeUtils.ConfigProxy._ParamOfBaseSystem_1_0_1())]; if (fileStream.Read(numArray2, 0, numArray2.Length) != numArray2.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } RuntimeUtils.ConfigProxy._ParamOfBaseSystem_1_0_1 paramOfBaseSystem101 = Parameters.DeserializeParamOfBaseSystem_1_0_1(numArray2); Parameters.LoadDefaultParameter(ref paramBaseSystem); paramBaseSystem.m_bEffectEnabled = paramOfBaseSystem101.m_bEffectEnabled; paramBaseSystem.m_nEffectMode = paramOfBaseSystem101.m_nEffectMode; paramBaseSystem.m_nFilterShortLen = paramOfBaseSystem101.m_nFilterShortLen; paramBaseSystem.m_nFilterMediumLen = paramOfBaseSystem101.m_nFilterMediumLen; paramBaseSystem.m_nFilterLongLen = paramOfBaseSystem101.m_nFilterLongLen; paramBaseSystem.m_rChannelPan = paramOfBaseSystem101.m_rChannelPan; bPBaseSystem = true; } if (num2 == 1) { byte[] numArray2 = new byte[Marshal.SizeOf((object)paramMusicMode)]; if (fileStream.Read(numArray2, 0, numArray2.Length) != numArray2.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } paramMusicMode = Parameters.DeserializeParamOfMusicMode(numArray2); bPMusicMode = true; } if (num3 == 1) { byte[] numArray2 = new byte[Marshal.SizeOf((object)paramMovieMode)]; if (fileStream.Read(numArray2, 0, numArray2.Length) != numArray2.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } paramMovieMode = Parameters.DeserializeParamOfMovieMode(numArray2); bPMovieMode = true; } if (num4 == 1) { byte[] numArray2 = new byte[Marshal.SizeOf((object)paramFreestyle)]; if (fileStream.Read(numArray2, 0, numArray2.Length) != numArray2.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } paramFreestyle = Parameters.DeserializeParamOfFreestyle(numArray2); bPFreestyle = true; } fileStream.Close(); if (bPBaseSystem && bPMusicMode && (bPMovieMode && bPFreestyle)) { Parameters.SaveLocalPreset(szFilePathName, paramBaseSystem, paramMusicMode, paramMovieMode, paramFreestyle); } return(true); } fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } if (num1 == 1) { byte[] numArray2 = new byte[Marshal.SizeOf((object)paramBaseSystem)]; if (fileStream.Read(numArray2, 0, numArray2.Length) != numArray2.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } paramBaseSystem = Parameters.DeserializeParamOfBaseSystem(numArray2); bPBaseSystem = true; } if (num2 == 1) { byte[] numArray2 = new byte[Marshal.SizeOf((object)paramMusicMode)]; if (fileStream.Read(numArray2, 0, numArray2.Length) != numArray2.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } paramMusicMode = Parameters.DeserializeParamOfMusicMode(numArray2); bPMusicMode = true; } if (num3 == 1) { byte[] numArray2 = new byte[Marshal.SizeOf((object)paramMovieMode)]; if (fileStream.Read(numArray2, 0, numArray2.Length) != numArray2.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } paramMovieMode = Parameters.DeserializeParamOfMovieMode(numArray2); bPMovieMode = true; } if (num4 == 1) { byte[] numArray2 = new byte[Marshal.SizeOf((object)paramFreestyle)]; if (fileStream.Read(numArray2, 0, numArray2.Length) != numArray2.Length) { fileStream.Close(); bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } paramFreestyle = Parameters.DeserializeParamOfFreestyle(numArray2); bPFreestyle = true; } fileStream.Close(); return(true); } catch { bPBaseSystem = false; bPMusicMode = false; bPMovieMode = false; bPFreestyle = false; return(false); } }
public static void SaveLocalPreset( string szFilePathName, RuntimeUtils.ConfigProxy._ParamOfBaseSystem paramBaseSystem, RuntimeUtils.ConfigProxy._ParamOfMusicMode paramMusicMode, RuntimeUtils.ConfigProxy._ParamOfMovieMode paramMovieMode, RuntimeUtils.ConfigProxy._ParamOfFreestyle paramFreestyle) { byte[] buffer1 = Parameters.ParameterSerialize(paramBaseSystem); byte[] buffer2 = Parameters.ParameterSerialize(paramMusicMode); byte[] buffer3 = Parameters.ParameterSerialize(paramMovieMode); byte[] buffer4 = Parameters.ParameterSerialize(paramFreestyle); if (buffer1 == null || buffer2 == null || buffer3 == null) { return; } if (buffer4 == null) { return; } try { FileStream fileStream = new FileStream(szFilePathName, FileMode.Create); byte[] buffer5 = new byte[14] { 86, 105, 80, 69, 82, 52, 87, 105, 110, 100, 111, 119, 115, 88 }; fileStream.Write(buffer5, 0, buffer5.Length); fileStream.WriteByte(1); fileStream.WriteByte(1); fileStream.WriteByte(1); fileStream.WriteByte(1); fileStream.Write(buffer1, 0, buffer1.Length); fileStream.Write(buffer2, 0, buffer2.Length); fileStream.Write(buffer3, 0, buffer3.Length); fileStream.Write(buffer4, 0, buffer4.Length); fileStream.Flush(); fileStream.Close(); } catch (Exception ex) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(GlobalMessages.ERROR); stringBuilder.AppendLine(GlobalMessages.TECHNICAL_INFO); stringBuilder.AppendLine(ex.Message); int num = (int)MessageBox.Show(stringBuilder.ToString(), GlobalMessages.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Hand); } }