void Transpose(int direction) { history.AddHistroyAtSelection( ); if (patternView.boxSelection.isSelecting) { patternView.boxSelection.FinalizeSelection(); } if (patternView.boxSelection.hasSelection) { patternView.boxSelection.DoOperation((int line, int chn, int col) => { if (col != 0) { return; } int newNote = TransposeNote(direction, songData.GetData(chn, line, col)); songData.SetData(chn, line, col, newNote); }); } else if (patternView.position.dataColumn == 0) { int newNote = TransposeNote(direction, patternView.GetDataAtSelection()); patternView.SetDataAtSelection(newNote); } }
public void SetNoteOn(Note note, int octave, int velocity = 0xF) { if (patternView.position.dataColumn != 0) { return; } if (patternView.recording) { byte noteData = EncodeNoteInfo(( int )note, octave); history.AddHistroyAtSelection(); patternView.SetDataAtSelection(noteData); if (note != Note.NoteOff) { patternView.SetDataAtSelection(( byte )currentInstrument, 1); } if (velocity != 0xF) { patternView.SetDataAtSelection((byte)velocity, 2); } if (!playback.isPlaying) { patternView.MoveVertical(patternAdd); } } if (playback.isPlaying) { return; } for (int i = 0; i < m_Instruments.Length; i++) { if (m_Instruments [i].note == Note.None || m_Instruments [i].note == Note.NoteOff) { m_Instruments [i] = instruments.presets [currentInstrument]; m_Instruments [i].note = note; m_Instruments [i].octave = octave; m_Instruments [i].relativeVolume = velocity; break; } } }