protected static void Override <T>(VolumeParameter <T> parameter, ref T property) { if (parameter.overrideState) { property = parameter.value; } }
public override IEnumerable <Parameter> CreateParameters(string parameterPrefix) { MasterVolume = new VolumeParameter(parameterPrefix + "Vol", "Master Volume", false); return(new List <Parameter> { MasterVolume }); }
public override IEnumerable <Parameter> CreateParameters(string parameterPrefix) { Volume = new VolumeParameter(parameterPrefix + "Vol", "Oscillator Volume"); OscillatorType = new EnumParameter <WaveGenerator.EOscillatorType>(parameterPrefix + "Osc", "Oscillator Type", "Osc", false); Fine = new RealParameter(parameterPrefix + "Fine", "Oscillator pitch", "Fine", -2, 2, 0.01); Fine.SetDefaultValue(0); Panning = new RealParameter(parameterPrefix + "Pan", "Oscillator Panorama", "", 0, 1, 0.01); Panning.SetDefaultValue(0.5); return(new List <Parameter> { Volume, OscillatorType, Fine, Panning }); }
VolumeParameter[,] GetStates() { var fields = selectedComponentType .GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) .Where(t => t.FieldType.IsSubclassOf(typeof(VolumeParameter))) .ToArray(); VolumeParameter[,] states = new VolumeParameter[volumes.Length, fields.Length]; for (int i = 0; i < volumes.Length; i++) { for (int j = 0; j < fields.Length; j++) { states[i, j] = GetParameter(volumes[i], fields[j]); } } return(states); }
public override IEnumerable <Parameter> CreateParameters() { var parameters = new List <Parameter>(); parameters.Add(Power = new BypassParameter("CPwr", "Power", this, "Pwr", false)); parameters.Add(OscillatorsMix = new RealParameter("CMix", "Oscillators Mix", "Mix", 0, 1, 0.01)); parameters.Add(MasterVolume = new VolumeParameter("MVol", "Master Volume", false)); parameters.Add(Unison = new EnumParameter <EPowerStatus>("UPwr", "Unison", "Pwr", false)); OscillatorsMix.SetDefaultValue(0.5); parameters.AddRange(OscillatorA.CreateParameters("A")); parameters.AddRange(OscillatorB.CreateParameters("B")); parameters.AddRange(EnvelopeSound.CreateParameters("EM")); parameters.AddRange(FilterEnv.CreateParameters("EF")); parameters.AddRange(Filter.CreateParameters("F")); parameters.AddRange(Distortion.CreateParameters("D")); parameters.AddRange(LFOModifierA.CreateParameters("LA")); parameters.AddRange(LFOModifierB.CreateParameters("LB")); return(parameters); }
public ActionResult GeneratingPaper(VolumeParameter vp) { Document docx = new Document(Server.MapPath("~/medium/template/template.docx")); DocumentBuilder docxdb = new DocumentBuilder(docx); EODB eodb = new EODB(); QuestionInfo qi = new QuestionInfo(); int Num = 0; foreach (Guid i in vp.Question_Id) { Num++; qi = eodb.questioninfo.Find(i); docxdb.InsertHtml("<span style='font-size:small;'>" + "<label>" + Num.ToString() + "、 </label>" + (string.IsNullOrEmpty(qi.Question_Title)?string.Empty : qi.Question_Title.Replace("src=\"", "src=\"http://localhost") + "<br/><br/></span>")); } Guid guid = Guid.NewGuid(); docx.Save(Server.MapPath("~/medium/paper/" + guid.ToString() + ".docx")); PaperInfo paperinfo = new PaperInfo { Paper_Id = guid, Paper_Name = vp.Paper_Name, Paper_Author = vp.Paper_Author, Paper_Grade = vp.Paper_Grade, Paper_Subject = vp.Paper_Subject, Paper_Kind = vp.Paper_Kind, Paper_Province = vp.Paper_Province, Paper_State = true, Paper_Time = DateTime.Now, Paper_Download = 0, Paper_Path = "/medium/paper/" + guid.ToString() + ".docx" }; eodb.paperinfo.Add(paperinfo); eodb.SaveChanges(); return(Content(guid.ToString())); }
VolumeParameter[,] GetStates() { var fields = selectedComponentType .GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) .Where(t => t.FieldType.IsSubclassOf(typeof(VolumeParameter))) .ToArray(); VolumeParameter[,] states = new VolumeParameter[volumes.Length, fields.Length]; for (int i = 0; i < volumes.Length; i++) { var profile = volumes[i].HasInstantiatedProfile() ? volumes[i].profile : volumes[i].sharedProfile; if (!profile.TryGet(selectedComponentType, out VolumeComponent component)) { continue; } for (int j = 0; j < fields.Length; j++) { var param = GetParameter(component, fields[j]);; states[i, j] = param.overrideState ? param : null; } } return(states); }