mirror of
https://github.com/jhbruhn/eurorack.git
synced 2025-03-15 02:55:49 +00:00
Implement StringListMenuItem
This commit is contained in:
parent
0fd1657c60
commit
433ff597ab
3 changed files with 21 additions and 3 deletions
|
@ -150,6 +150,22 @@ class BoolMenuItem : public NumberMenuItem<bool> {
|
||||||
, off_string(_off_string) {};
|
, off_string(_off_string) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class StringListMenuItem : public NumberMenuItem<uint32_t> {
|
||||||
|
private:
|
||||||
|
const char** string_labels;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const char* get_format_string()
|
||||||
|
{
|
||||||
|
return this->string_labels[this->get_value()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
StringListMenuItem(const char* _label, uint32_t _initialValue, const char** _stringLabels, size_t _itemCount)
|
||||||
|
: NumberMenuItem(_label, _initialValue, 0, _itemCount - 1, 1)
|
||||||
|
, string_labels(_stringLabels) {};
|
||||||
|
};
|
||||||
|
|
||||||
class MidiNoteMenuItem : public NumberMenuItem<uint8_t> {
|
class MidiNoteMenuItem : public NumberMenuItem<uint8_t> {
|
||||||
private:
|
private:
|
||||||
char string_buffer[4];
|
char string_buffer[4];
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
#include "../menu/menu_items.h"
|
#include "../menu/menu_items.h"
|
||||||
#include <u8g2.h>
|
#include <u8g2.h>
|
||||||
|
|
||||||
|
static const char* kVoiceDetailStrings[] = {"S", "M", "L", "XL"};
|
||||||
|
|
||||||
PartMenu::PartMenu()
|
PartMenu::PartMenu()
|
||||||
: item_voice_count("voice count", 1, 1, 4, 1)
|
: item_voice_count("voice count", 1, 1, 4, 1)
|
||||||
, item_voice_detail("voice detail", 1, 1, 4, 1)
|
, item_voice_detail("voice detail", 0, kVoiceDetailStrings, 4)
|
||||||
, item_midi_filter_enabled("MIDI filter", 1, "on", "off")
|
, item_midi_filter_enabled("MIDI filter", 1, "on", "off")
|
||||||
, item_midi_channel("MIDI channel", 0, 0, 100, 1)
|
, item_midi_channel("MIDI channel", 0, 0, 16, 1)
|
||||||
, item_midi_lowest_note("MIDI lowest", 0)
|
, item_midi_lowest_note("MIDI lowest", 0)
|
||||||
, item_midi_highest_note("MIDI highest", 127)
|
, item_midi_highest_note("MIDI highest", 127)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ class PartMenu {
|
||||||
private:
|
private:
|
||||||
Menu menu;
|
Menu menu;
|
||||||
UIntMenuItem item_voice_count;
|
UIntMenuItem item_voice_count;
|
||||||
UIntMenuItem item_voice_detail;
|
StringListMenuItem item_voice_detail;
|
||||||
BoolMenuItem item_midi_filter_enabled;
|
BoolMenuItem item_midi_filter_enabled;
|
||||||
UIntMenuItem item_midi_channel;
|
UIntMenuItem item_midi_channel;
|
||||||
MidiNoteMenuItem item_midi_lowest_note;
|
MidiNoteMenuItem item_midi_lowest_note;
|
||||||
|
|
Loading…
Reference in a new issue