Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental metronome state feedback #21

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
8258c9f
Fix off by one for knobs. The first knob in bank 0 now changes the ma…
Apr 24, 2019
04f71c9
Do not pause when pressing restart and we are already playing
Apr 24, 2019
af9ebd0
Repeat repeats the whole project
Apr 24, 2019
d184ae8
Merge pull request #1 from leonardder/moreActionsAndFixes
brummbrum May 13, 2019
8e434f3
Update niMidi.cpp
brummbrum May 13, 2019
6be3125
Track navigation in Mixer mode
brummbrum May 13, 2019
543e7c1
Merge pull request #2 from brummbrum/Test
brummbrum May 13, 2019
e5b1ef1
Stable
brummbrum May 13, 2019
4229c69
TrackSelect
brummbrum May 14, 2019
9b54422
More fixes
brummbrum May 14, 2019
9031be9
BankSelection Working
brummbrum May 15, 2019
59ccf32
Merge pull request #3 from brummbrum/BankSelection
brummbrum May 15, 2019
928a00e
Fixed Volume & Pan
brummbrum May 16, 2019
d871095
VU meter tests
brummbrum May 17, 2019
50ebd55
VU meter working
brummbrum May 17, 2019
87884f7
Cleanup1
brummbrum May 17, 2019
44cd80b
Cleanup2
brummbrum May 17, 2019
f3d2fcb
Merge branch 'MoreMixerUpdates' into master
brummbrum May 18, 2019
a4fda2c
Add log conversion library functions
brummbrum May 18, 2019
47a503f
Log VU meters calibrated
brummbrum May 18, 2019
77d5f22
fix & comment
brummbrum May 18, 2019
cf79108
Meter precision calibration finished
brummbrum May 20, 2019
3170cbd
Update niMidi.cpp
brummbrum May 20, 2019
b484e00
Ready for pulling Nav Patch
brummbrum May 20, 2019
ef46618
Merge branch 'master' into IncrNavPatch
brummbrum May 20, 2019
b6af0eb
Merge pull request #6 from brummbrum/IncrNavPatch
brummbrum May 20, 2019
0729a36
Update Readme
brummbrum May 20, 2019
24eda7a
Peak Meters Ready
brummbrum May 20, 2019
3b62589
Merge branch 'master' of https://github.com/brummbrum/reaKontrol
brummbrum May 20, 2019
e96e5f9
Peak Meters Calibrated
brummbrum May 20, 2019
8844e20
Substitute pow() with exp()
brummbrum May 20, 2019
f9e6eba
Code optimization (see comments)
brummbrum May 21, 2019
bbfec19
Bring back debug diagnostics
brummbrum May 21, 2019
75630b6
Update Readme
brummbrum May 21, 2019
00e1554
minus96dB and code simplification
brummbrum May 21, 2019
d753b28
Merge pull request #7 from brummbrum/MeterResolution-96dB
brummbrum May 22, 2019
27af86e
Sceleton for Volume Text
brummbrum May 22, 2019
23dfe72
Volume Text and Marker working
brummbrum May 22, 2019
8c082fb
Volume Text, Marker and Callback working
brummbrum May 23, 2019
7258d68
Merge pull request #8 from brummbrum/VolumeText_in_MixerView
brummbrum May 23, 2019
e814a3c
More ToDo comments
brummbrum May 23, 2019
d232fa7
Changes to tracklist update the Mixer View
brummbrum May 24, 2019
4b09ca3
Merge pull request #9 from brummbrum/TrackListChange
brummbrum May 24, 2019
291bba9
Transport Button Lights working
brummbrum May 24, 2019
4414a8a
Merge pull request #10 from brummbrum/Control_of_Button_Lights
brummbrum May 24, 2019
9657b30
Pan Marker and Callback working
brummbrum May 25, 2019
654ecac
Merge pull request #11 from brummbrum/PanText_in_Mixer_View
brummbrum May 25, 2019
4c93513
Volume & Pan change of selected track via 4D encoder
brummbrum May 25, 2019
4deff3e
Merge pull request #12 from brummbrum/SelectedTrack_Vol_Pan_Change
brummbrum May 25, 2019
72f06ea
Mute Solo Recarm
brummbrum May 27, 2019
48d9cc2
Mute and Solo Working
brummbrum May 27, 2019
2cb3c2e
Merge pull request #13 from brummbrum/Mute_Solo_RecArm_Callbacks
brummbrum May 27, 2019
a966ed4
Track names, master track, bank button lights
brummbrum May 27, 2019
a3108f7
Merge pull request #14 from brummbrum/TrackNameChanges
brummbrum May 27, 2019
7f3229d
Track(s) muted by solo implemented
brummbrum May 27, 2019
55271d8
Merge pull request #15 from brummbrum/TrackMutedBySolo
brummbrum May 27, 2019
2c2a2ab
Push Encoder to refocus bank
brummbrum May 27, 2019
547566b
Update readme.md
brummbrum May 27, 2019
e71fc66
Edit a few comments
brummbrum May 28, 2019
3d3c13a
Metronome Button Light Working
brummbrum May 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Log VU meters calibrated
- Calibration also valid for other keyboards than S Mk2?
  • Loading branch information
brummbrum committed May 18, 2019
commit 47a503f033597347b6832d332aaf22a0c9a14c3b
59 changes: 42 additions & 17 deletions src/niMidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ static unsigned char panToChar(double pan)
}
// End of conversion functions (C) 2006-2008 Cockos Incorporated

static unsigned char vuPeakToChar(double vol)
{
double d = (DB2SLIDER(VAL2DB(vol) - 52.0)); // Specific calibration for KK Mk2
if (d < 0.0)d = 0.0;
else if (d > 127.0)d = 127.0;

return (unsigned char)(d + 0.5);
}

class NiMidiSurface: public BaseSurface {
public:
NiMidiSurface(int inDev, int outDev)
Expand Down Expand Up @@ -291,11 +300,19 @@ class NiMidiSurface: public BaseSurface {
}

void _vuMixerUpdate() override {
// VU meters
char vuBank[17];
// VU meters
char vuBank[17]; // INIT??? = { 0 };
int j = 0;
double peakMidiValue = 0;
double peakValue = 0;

//ToDo: Peak levels of muted tracks should NOT be polled at all
//ToDo: Calibration to 0dB. If we calibrate in conversion function (~900.0 vs 1000.0 we are off at low levels)
// maybe calibrate before calling conversion or in first WDL conversion VAL2DB
// TRY FIRST: Use directly VAL2DB conversion
//ToDo: Clean up array Initialization , stop byte, array size, CMD_SEL_TRACK_PARAMS_CHANGED

vuBank[0] = 1; // there will alway be a master track
vuBank[1] = 1;
int numInBank = 0;
int bankEnd = this->_bankStart + BANK_NUM_TRACKS - 1;
int numTracks = CSurf_NumTracks(false); // If we ever want to show just MCP tracks in KK Mixer View (param) must be (true)
Expand All @@ -308,21 +325,28 @@ class NiMidiSurface: public BaseSurface {
break;
}
j = 2 * numInBank;
// ToDo: Will require some log conversion (not just multiply) for KK meter to mirror Reaper meter.
// Code can be cleaned up by putting this into a separate function, leave it for now.
// Also: Avoid any conversion if track volume is silent (save CPU)
peakMidiValue = 127 * Track_GetPeakInfo(track, 0); // left channel
if (peakMidiValue < 1) { peakMidiValue = 1; } // if 0 then channels further to the right are ignored !
if (peakMidiValue > 127) { peakMidiValue = 127; }
vuBank[j] = static_cast<char>(peakMidiValue);
peakMidiValue = 127 * Track_GetPeakInfo(track, 1); // right channel
if (peakMidiValue < 1) { peakMidiValue = 1; } // if 0 then channels further to the right are ignored !
if (peakMidiValue > 127) { peakMidiValue = 127; }
vuBank[j + 1] = static_cast<char>(peakMidiValue);
peakValue = Track_GetPeakInfo(track, 0); // left channel
if (peakValue == 0) {
// No log conversion necessary
vuBank[j] = 1; // if 0 then channels further to the right are ignored by KK display
}
else {
vuBank[j] = vuPeakToChar(peakValue);
if (vuBank[j] == 0) { vuBank[j] = 1; } // if 0 then channels further to the right are ignored by KK display
}
peakValue = Track_GetPeakInfo(track, 1); // right channel
if (peakValue == 0) {
// No log conversion necessary
vuBank[j+1] = 1; // if 0 then channels further to the right are ignored by KK display
}
else {
vuBank[j+1] = vuPeakToChar(peakValue);
if (vuBank[j+1] == 0) { vuBank[j+1] = 1; } // if 0 then channels further to the right are ignored by KK display
}
}
vuBank[16] = 0; // JUST A TEST - it seems a sort of stop bit/byte is needed here
this->_sendSysex(CMD_TRACK_VU, 2, 0, vuBank);
this->_sendSysex(CMD_SEL_TRACK_PARAMS_CHANGED, 0, 0); // Needed at all? Not fully working yet!!
vuBank[16] = 0; // JUST A TEST - it seems a sort of stop bit/byte is needed here. See also initialization above
this->_sendSysex(CMD_TRACK_VU, 2, 2, vuBank); // do the params have anything to do with calibration?
this->_sendSysex(CMD_SEL_TRACK_PARAMS_CHANGED, 0, 0); // Needed at all? Maybe we have to reference last track in bank to indicate end of updates?
}

private:
Expand Down Expand Up @@ -381,6 +405,7 @@ class NiMidiSurface: public BaseSurface {
MediaTrack* track = CSurf_TrackFromID(id, false);
int iSel = 1; // "Select"
// If we rather wanted to "Toggle" than just "Select" we would use:
// int iSel = 0;
// int iSel = *(int*)GetSetMediaTrackInfo(track, "I_SELECTED", nullptr) ? 0 : 1;
ClearSelected();
GetSetMediaTrackInfo(track, "I_SELECTED", &iSel);
Expand Down