-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
88 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#pragma once | ||
|
||
#include "ZrPage.h" | ||
|
||
class ZrMasterPagePopulator { | ||
public: | ||
static const int H_COUNT = 1; | ||
static const int V_COUNT = 2; | ||
|
||
static void populate(ZrPage& currentPage) { | ||
char temp[50]; | ||
|
||
for (int h = 0; h < currentPage.m_hCount; h++) { | ||
for (int v = 0; v < currentPage.m_vCount; v++) { | ||
int channelNumber = h + 1; | ||
int ind = index(currentPage, h, v); | ||
ZrFunction& toPopulate = currentPage.m_functions[ind]; | ||
toPopulate.m_hPos = h; | ||
toPopulate.m_vPos = v; | ||
sprintf(temp, "CH%02d", channelNumber); | ||
toPopulate.m_humanChannelName = temp; | ||
toPopulate.m_typeDesc = posToFuncTypeDescription(h, v); | ||
switch (toPopulate.m_typeDesc.type()) { | ||
case EQ: | ||
sprintf(temp, "/ch/%02d/eq/on", channelNumber); | ||
toPopulate.m_oscAddr = temp; | ||
break; | ||
case FADER: | ||
sprintf(temp, "/ch/%02d/mix/fader", channelNumber); | ||
toPopulate.m_oscAddr = temp; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
private: | ||
static const int index(ZrPage& currentPage, int h, int v) { | ||
return h + v * currentPage.m_hCount; | ||
} | ||
|
||
static const ZrFuncType typeForPosition(int h, int v) { | ||
if (h >= 0 && h <= 17) { | ||
switch (v) { | ||
case 0: | ||
return EQ; | ||
case 1: | ||
return FADER; | ||
} | ||
} | ||
return TYPE_UNKNOWN; | ||
} | ||
|
||
static const ZrFuncTypeDescription posToFuncTypeDescription(int h, int v) { | ||
return ZrFuncTypeDescription::fromType(typeForPosition(h, v)); | ||
} | ||
}; |