コード例 #1
0
        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;
        }
コード例 #2
0
        public IText Translate(KeySwitch source)
        {
            var jsonRoot = KeySwitchToJsonModelHelper.Translate(source);
            var jsonText = JsonConvert.SerializeObject(jsonRoot, Formatted ? Formatting.Indented : Formatting.None);

            return(new PlainText(jsonText));
        }
コード例 #3
0
 public void KeyOffEvent(KeySwitch whichKey)
 {
     if (_controller == null)
     {
         return;
     }
     _controller.KeyOffEvent(whichKey);
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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)));
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
    // 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
        }
    }
コード例 #9
0
        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)
                       ));
        }
コード例 #10
0
        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));
        }
コード例 #11
0
		public void KeyOff(KeySwitch whichKey)
		{
			_keyState[(int) whichKey] = false;
			_keyWhen[(int) whichKey] = _timeService.Now();
		}
コード例 #12
0
 private static IReadOnlyDictionary <string, ICollection <Articulation> > CollectSlotTable(KeySwitch keySwitch)
 {
コード例 #13
0
 public void KeyOffEvent(KeySwitch whichKey)
 {
     if (_controller == null) return;
     _controller.KeyOffEvent(whichKey);
 }
コード例 #14
0
 public void SetKeySwitch(KeySwitch keySwitch)
 {
     this.keySwitch = keySwitch;
 }
コード例 #15
0
 public void KeyOff(KeySwitch whichKey)
 {
     _keyState[(int)whichKey] = false;
     _keyWhen[(int)whichKey]  = _timeService.Now();
 }
コード例 #16
0
 public void KeyOffEvent(KeySwitch whichKey)
 {
     _context.Keys.KeyOff(whichKey);
     State.KeyTurned();
 }
コード例 #17
0
 public Element(KeySwitch keySwitch, IText xmlText)
 {
     KeySwitch = keySwitch;
     XmlText   = xmlText;
 }
コード例 #18
0
 public void KeyOffEvent(KeySwitch whichKey)
 {
     _context.Keys.KeyOff(whichKey);
     State.KeyTurned();
 }