mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-30 01:35:34 +00:00
Droplet switch menu names
This commit is contained in:
parent
eb0b312c48
commit
5c5d51354b
@ -15,3 +15,15 @@ void DropletManager::SetSelected(DropletState state) {
|
|||||||
DropletState DropletManager::GetSelected() {
|
DropletState DropletManager::GetSelected() {
|
||||||
return selected_drop;
|
return selected_drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string DropletManager::OtherStateName(DropletState state) {
|
||||||
|
switch (state) {
|
||||||
|
case DropletState::kLeft:
|
||||||
|
return "Right";
|
||||||
|
case DropletState::kRight:
|
||||||
|
return "Left";
|
||||||
|
case DropletState::kFull:
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -35,6 +35,14 @@ public:
|
|||||||
* @return selected droplet
|
* @return selected droplet
|
||||||
*/
|
*/
|
||||||
DropletState GetSelected();
|
DropletState GetSelected();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the name of the other droplet
|
||||||
|
*
|
||||||
|
* @param state droplat state of the current
|
||||||
|
* @return other droplet name
|
||||||
|
*/
|
||||||
|
std::string OtherStateName(DropletState state);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CASCADE_DROPLETS_DROPLET_MANAGER_H_
|
#endif // CASCADE_DROPLETS_DROPLET_MANAGER_H_
|
||||||
|
12
src/main.cpp
12
src/main.cpp
@ -24,8 +24,8 @@ void ProcessControls() {
|
|||||||
if (patch.encoder.RisingEdge()) {
|
if (patch.encoder.RisingEdge()) {
|
||||||
left_menu.SetInMenu(false);
|
left_menu.SetInMenu(false);
|
||||||
if(left_menu.GetState() == MenuState::kSplit) {
|
if(left_menu.GetState() == MenuState::kSplit) {
|
||||||
state->ToggleSplit();
|
manager->ToggleSplit();
|
||||||
if (state->GetSplitMode()) {
|
if (manager->GetSplitMode()) {
|
||||||
droplet_left->UpdateState(DropletState::kLeft);
|
droplet_left->UpdateState(DropletState::kLeft);
|
||||||
droplet_right = GetDroplet(DropletState::kRight);
|
droplet_right = GetDroplet(DropletState::kRight);
|
||||||
} else {
|
} else {
|
||||||
@ -34,7 +34,7 @@ void ProcessControls() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delete droplet_left;
|
delete droplet_left;
|
||||||
if(state->GetSplitMode()) {
|
if(manager->GetSplitMode()) {
|
||||||
droplet_left = GetDroplet(DropletState::kLeft);
|
droplet_left = GetDroplet(DropletState::kLeft);
|
||||||
} else {
|
} else {
|
||||||
droplet_left = GetDroplet(DropletState::kFull);
|
droplet_left = GetDroplet(DropletState::kFull);
|
||||||
@ -54,7 +54,7 @@ void ProcessControls() {
|
|||||||
void ProcessOutputs() {
|
void ProcessOutputs() {
|
||||||
if(!left_menu.InMenu()) {
|
if(!left_menu.InMenu()) {
|
||||||
droplet_left->Control();
|
droplet_left->Control();
|
||||||
if (state->GetSplitMode()) {
|
if (manager->GetSplitMode()) {
|
||||||
droplet_right->Control();
|
droplet_right->Control();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ void ProcessOled() {
|
|||||||
left_menu.ProcessMenuOled();
|
left_menu.ProcessMenuOled();
|
||||||
} else {
|
} else {
|
||||||
droplet_left->Draw();
|
droplet_left->Draw();
|
||||||
if (state->GetSplitMode()) {
|
if (manager->GetSplitMode()) {
|
||||||
droplet_right->Draw();
|
droplet_right->Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ static void AudioThrough(float **in,
|
|||||||
float **out,
|
float **out,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
droplet_left->Process(in, out, size);
|
droplet_left->Process(in, out, size);
|
||||||
if (state->GetSplitMode()) {
|
if (manager->GetSplitMode()) {
|
||||||
droplet_right->Process(in, out, size);
|
droplet_right->Process(in, out, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
#include "droplets/vco_droplet.h"
|
#include "droplets/vco_droplet.h"
|
||||||
|
|
||||||
DaisyPatch patch;
|
DaisyPatch patch;
|
||||||
DropletManager* state = new DropletManager();
|
DropletManager* manager = new DropletManager();
|
||||||
Menu left_menu(&patch, "Right", state);
|
Menu left_menu(&patch, DropletState::kLeft, manager);
|
||||||
Menu right_menu(&patch, "Left", state);
|
Menu right_menu(&patch, DropletState::kRight, manager);
|
||||||
Droplet* droplet_left;
|
Droplet* droplet_left;
|
||||||
Droplet* droplet_right;
|
Droplet* droplet_right;
|
||||||
float sample_rate;
|
float sample_rate;
|
||||||
|
14
src/menu.cpp
14
src/menu.cpp
@ -1,10 +1,10 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
Menu::Menu(DaisyPatch* m_patch,
|
Menu::Menu(DaisyPatch* m_patch,
|
||||||
std::string m_name,
|
DropletState m_state,
|
||||||
DropletManager* m_state) {
|
DropletManager* m_manager) {
|
||||||
patch = m_patch;
|
patch = m_patch;
|
||||||
name = m_name;
|
state = m_state;
|
||||||
state = m_state;
|
state = m_state;
|
||||||
}
|
}
|
||||||
const std::string MENU_ITEMS[] = {"Split",
|
const std::string MENU_ITEMS[] = {"Split",
|
||||||
@ -38,10 +38,14 @@ std::string Menu::FilterMenuText(int position) {
|
|||||||
if (position >= MENU_SIZE || position < 0) {
|
if (position >= MENU_SIZE || position < 0) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
if (ConvertState(position) == MenuState::kSplit && (*state).GetSplitMode()) {
|
if (ConvertState(position) == MenuState::kSplit) {
|
||||||
|
if (!manager->GetSplitMode()) {
|
||||||
return "Merge";
|
return "Merge";
|
||||||
|
} else {
|
||||||
|
return "Split";
|
||||||
|
}
|
||||||
} else if (ConvertState(position) == MenuState::kChange) {
|
} else if (ConvertState(position) == MenuState::kChange) {
|
||||||
return name;
|
return manager->OtherStateName(state);
|
||||||
}
|
}
|
||||||
return MENU_ITEMS[position];
|
return MENU_ITEMS[position];
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,8 @@ enum class MenuState {kSplit, kChange, kVCO, kNoise};
|
|||||||
class Menu {
|
class Menu {
|
||||||
private:
|
private:
|
||||||
DaisyPatch* patch;
|
DaisyPatch* patch;
|
||||||
DropletManager* state;
|
DropletManager* manager;
|
||||||
DropletState menu_droplet;
|
DropletState state;
|
||||||
std::string name;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Converts a number to the related menu state.
|
* Converts a number to the related menu state.
|
||||||
@ -35,7 +34,7 @@ class Menu {
|
|||||||
* @param m_name name of the menu
|
* @param m_name name of the menu
|
||||||
* @param m_split one or two droplets
|
* @param m_split one or two droplets
|
||||||
*/
|
*/
|
||||||
Menu(DaisyPatch* m_patch, std::string m_name, DropletManager* m_state);
|
Menu(DaisyPatch* m_patch, DropletState m_state, DropletManager* m_manager);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gives if the user is currently in the menu.
|
* Gives if the user is currently in the menu.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user