Skip to content

Commit

Permalink
Fixes #865: Set selected MIDI items name to first note - Ignores MIDI…
Browse files Browse the repository at this point in the history
… Octave Name Display Offset
  • Loading branch information
nofishonfriday committed Jul 27, 2017
1 parent 2afbbb4 commit 6cf20a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Fingers/MediaItemCommands.cpp
Expand Up @@ -10,6 +10,9 @@
#include "RprTrack.h"
#include "RprMidiTake.h"

// #865, for SNM_GetIntConfigVar()
#include "SnM\SnM_Misc.h"

void CmdCleanItemLengths(int flag, void *data);
void CmdLegatoItemLengths(int flag, void *data);
void CmdMoveItemsToEditCursor(int flag, void *data);
Expand Down Expand Up @@ -300,6 +303,9 @@ void CmdSetItemNameMidi::doCommand(int flag)
return;
}

// #865
int octOffset = SNM_GetIntConfigVar("midioctoffs", -666); // returns errvalue (-666) if failed

for (int i = 0; i < ctr->size(); i++)
{
if (!ctr->getAt(i).getActiveTake().isMIDI())
Expand All @@ -311,6 +317,14 @@ void CmdSetItemNameMidi::doCommand(int flag)
if (midiItem.countNotes() > 0)
{
int pitch = midiItem.getNoteAt(0)->getPitch();

// #865
// midioctoffs value in reaper.ini and value set in REAPER prefs differ by -1
// e.g. in reaper.ini: midioctoffs = 0 => offset set in REAPER prefs = -1
if (octOffset != -666 && octOffset != 1) {
pitch = pitch + (12 * (octOffset - 1));
}

static const char* noteNames[] = {"C", "C#", "D", "D#",
"E", "F", "F#", "G", "G#", "A", "A#", "B"};
int nameIndex = pitch % 12;
Expand Down
1 change: 1 addition & 0 deletions whatsnew.txt
@@ -1,4 +1,5 @@
Fixes:
+Issue 865: Fix SWS/FNG: Set selected MIDI items name to first note - Ignores MIDI Octave Name Display Offset
+Issue 860: Fix automation item removed after SWS/wol: Set selected envelope height... actions

!v2.9.4 pre-release build (April 6, 2017)
Expand Down

0 comments on commit 6cf20a1

Please sign in to comment.