public static void SetDefaultCellStyle(IXLWorksheet sheet, KeySwitch template, int rowCount = 100) { var startRow = SpreadsheetConstants.RowDataBegin; var startColumn = SpreadsheetConstants.ColumnMidiMessageBegin; var row = startRow; var allExtraKeys = template.Articulations.SelectMany(x => x.ExtraData.Keys).Distinct().ToArray(); for (var r = 0; r < rowCount; r++) { var noteMaxColumn = template.Articulations.Max(x => x.MidiNoteOns.Count); var ccMaxColumn = template.Articulations.Max(x => x.MidiControlChanges.Count); var pcMaxColumn = template.Articulations.Max(x => x.MidiProgramChanges.Count); var column = startColumn; column = SetDefaultMidiNoteCellStyle(sheet, row, column, noteMaxColumn); column = SetDefaultMidiCcCellStyle(sheet, row, column, ccMaxColumn); column = SetDefaultMidiPcCellStyle(sheet, row, column, pcMaxColumn); _ = SetDefaultExtraCellStyle(sheet, row, column, allExtraKeys); row++; } sheet.ShowGridLines = false; }
public IText Translate(KeySwitch source) { var jsonRoot = KeySwitchToJsonModelHelper.Translate(source); var jsonText = JsonConvert.SerializeObject(jsonRoot, Formatted ? Formatting.Indented : Formatting.None); return(new PlainText(jsonText)); }
public void KeyOffEvent(KeySwitch whichKey) { if (_controller == null) { return; } _controller.KeyOffEvent(whichKey); }
public ExtraDataTranslator(KeySwitch keySwitch) { KeySwitch = keySwitch; // Build Column header cell text by all extra keys var allExtKeys = keySwitch.Articulations.SelectMany(x => x.ExtraData.Keys).Distinct(); HeaderTextList = new List <ExtraDataKey>(allExtKeys); }
public IText Translate(KeySwitch source) { var slotTable = CollectSlotTable(source); var listOfUSlotVisuals = ConvertUSlotVisualsList(source); var listOfPSoundSlot = ConvertPSoundSlotList(slotTable); var rootElement = ConvertRootElement( source, listOfPSoundSlot, listOfUSlotVisuals ); return(new PlainText(XmlHelper.ToXmlString(rootElement))); }
private static RootElement ConvertRootElement(KeySwitch source, ListElement listOfPSoundSlot, ListElement listOfUSlotVisuals) { // Construction of InstrumentMap element var slots = InstrumentMap.Slots(listOfPSoundSlot); var slotVisuals = InstrumentMap.SlotVisuals(listOfUSlotVisuals); var instrumentName = $"{source.ProductName.Value} {source.InstrumentName.Value}"; var rootElement = InstrumentMap.New(instrumentName); rootElement.Member.Add(slotVisuals); rootElement.Member.Add(slots); rootElement.StringElement.Value = instrumentName; return(rootElement); }
private static ListElement ConvertUSlotVisualsList(KeySwitch source) { var listOfUSlotVisuals = new ListElement(); foreach (var i in source.Articulations) { var type = ConvertArticulationType(i.ExtraData.GetValueOrDefault(ExtraDataKeys.ArticulationType, ExtraDataValue.Empty)); var group = ConvertArticulationGroup(i.ExtraData.GetValueOrDefault(ExtraDataKeys.GroupIndex, ExtraDataValue.Empty)); var slotVisual = USlotVisuals.New( i.ArticulationName.Value, i.ArticulationName.Value, 0, type, @group ); listOfUSlotVisuals.Obj.Add(slotVisual); } return(listOfUSlotVisuals); }
// Default Setup public MechanicalKey(KMSelectable key, KeySwitch keySwitch, Renderer screen, int condition, int number, char text) { this.key = key; this.keySwitch = keySwitch; this.screen = screen; this.condition = condition; this.number = number; this.text = text; pressSafe = true; pressTime = -1; doublePressTime = false; needRapidTapping = false; this.screen.material = this.keySwitch.GetMaterial(); if (this.keySwitch.GetClear() == true) { // Set a clear material to the key } }
public static KeySwitchModel Translate(KeySwitch source) { var articulationModels = new List <ArticulationModel>(); foreach (var i in source.Articulations) { var noteOn = new List <MidiMessageModel>(); var controlChange = new List <MidiMessageModel>(); var programChange = new List <MidiMessageModel>(); ConvertMessageList(i.MidiNoteOns, noteOn); ConvertMessageList(i.MidiControlChanges, controlChange); ConvertMessageList(i.MidiProgramChanges, programChange); var jsonObject = new ArticulationModel( i.ArticulationName.Value, new MidiModel( noteOn, controlChange, programChange ), ConvertExtraData(i.ExtraData) ); articulationModels.Add(jsonObject); } return(new KeySwitchModel( source.Id.Value, source.Author.Value, source.Description.Value, EntityDateTimeHelper.ToDateTime(source.Created), EntityDateTimeHelper.ToDateTime(source.LastUpdated), source.DeveloperName.Value, source.ProductName.Value, source.InstrumentName.Value, articulationModels, IExtraDataFactory.Default.Create(source.ExtraData) )); }
public static DirectoryPath CreateDirectoryTree(KeySwitch keySwitch, DirectoryPath baseDirectory, params DirectoryPath[] subDirectories) { var outputDirectory = baseDirectory.Path; foreach (var i in subDirectories) { outputDirectory = Path.Combine(outputDirectory, i.Path); } outputDirectory = Path.Combine( outputDirectory, keySwitch.DeveloperName.Value, keySwitch.ProductName.Value ); if (!Directory.Exists(outputDirectory)) { Directory.CreateDirectory(outputDirectory); } return(new DirectoryPath(outputDirectory)); }
public void KeyOff(KeySwitch whichKey) { _keyState[(int) whichKey] = false; _keyWhen[(int) whichKey] = _timeService.Now(); }
private static IReadOnlyDictionary <string, ICollection <Articulation> > CollectSlotTable(KeySwitch keySwitch) {
public void KeyOffEvent(KeySwitch whichKey) { if (_controller == null) return; _controller.KeyOffEvent(whichKey); }
public void SetKeySwitch(KeySwitch keySwitch) { this.keySwitch = keySwitch; }
public void KeyOff(KeySwitch whichKey) { _keyState[(int)whichKey] = false; _keyWhen[(int)whichKey] = _timeService.Now(); }
public void KeyOffEvent(KeySwitch whichKey) { _context.Keys.KeyOff(whichKey); State.KeyTurned(); }
public Element(KeySwitch keySwitch, IText xmlText) { KeySwitch = keySwitch; XmlText = xmlText; }