-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature / Enable a new menu in Sound menu to make synths and sounddru…
…ms also send midi at the same time as they play a sound (#3313) * Enable a new menu in SoundDrum to make rows also send midi at the same time as they play a sound * DOcs * docs * docs * format * docs * format * Move midi sending code to SoundDrum * Send also aftertouch (same as MidiDrum does) * Revert "Send also aftertouch (same as MidiDrum does)" This reverts commit f809e91. * Revert "Move midi sending code to SoundDrum" This reverts commit 68d86d5. * format * Docs * wip * wip * wip * Cleanup * finally! * Remove log * remove logs
- Loading branch information
1 parent
93333f1
commit 3b718c0
Showing
20 changed files
with
385 additions
and
47 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
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,78 @@ | ||
/* | ||
* Copyright (c) 2014-2023 Synthstrom Audible Limited | ||
* | ||
* This file is part of The Synthstrom Audible Deluge Firmware. | ||
* | ||
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the | ||
* terms of the GNU General Public License as published by the Free Software Foundation, | ||
* either version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
#pragma once | ||
#include "definitions_cxx.hpp" | ||
#include "gui/menu_item/integer.h" | ||
#include "gui/ui/sound_editor.h" | ||
#include "hid/display/oled.h" | ||
#include "processing/sound/sound.h" | ||
|
||
namespace deluge::gui::menu_item::midi::sound { | ||
|
||
class OutputMidiChannel final : public Integer { | ||
public: | ||
using Integer::Integer; | ||
[[nodiscard]] int32_t getMinValue() const override { return 0; } | ||
[[nodiscard]] int32_t getMaxValue() const override { return 16; } | ||
void readCurrentValue() override { | ||
int32_t value = soundEditor.currentSound->outputMidiChannel; | ||
if (value == MIDI_CHANNEL_NONE) { | ||
value = 0; | ||
} | ||
else { | ||
value = value + 1; | ||
} | ||
this->setValue(value); | ||
} | ||
void writeCurrentValue() override { | ||
int32_t value = this->getValue(); | ||
if (value == 0) { | ||
value = MIDI_CHANNEL_NONE; | ||
} | ||
else { | ||
value = value - 1; | ||
} | ||
soundEditor.currentSound->outputMidiChannel = value; | ||
} | ||
|
||
void drawValue() override { | ||
int32_t value = this->getValue(); | ||
if (value == 0) { | ||
display->setScrollingText(l10n::get(l10n::String::STRING_FOR_OFF)); | ||
} | ||
else { | ||
char name[12]; | ||
snprintf(name, sizeof(name), "%d", value); | ||
display->setScrollingText(name); | ||
} | ||
} | ||
|
||
void drawInteger(int32_t textWidth, int32_t textHeight, int32_t yPixel) override { | ||
deluge::hid::display::oled_canvas::Canvas& canvas = hid::display::OLED::main; | ||
int32_t value = this->getValue(); | ||
if (value == 0) { | ||
canvas.drawStringCentred(l10n::get(l10n::String::STRING_FOR_OFF), yPixel + OLED_MAIN_TOPMOST_PIXEL, | ||
textWidth, textHeight); | ||
} | ||
else { | ||
char name[12]; | ||
snprintf(name, sizeof(name), "%d", value); | ||
canvas.drawStringCentred(name, yPixel + OLED_MAIN_TOPMOST_PIXEL, textWidth, textHeight); | ||
} | ||
} | ||
}; | ||
} // namespace deluge::gui::menu_item::midi::sound |
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,44 @@ | ||
/* | ||
* Copyright (c) 2014-2023 Synthstrom Audible Limited | ||
* | ||
* This file is part of The Synthstrom Audible Deluge Firmware. | ||
* | ||
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the | ||
* terms of the GNU General Public License as published by the Free Software Foundation, | ||
* either version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
#pragma once | ||
#include "definitions_cxx.hpp" | ||
#include "gui/menu_item/integer.h" | ||
#include "gui/ui/sound_editor.h" | ||
#include "hid/display/oled.h" | ||
#include "processing/sound/sound.h" | ||
#include <cstdint> | ||
|
||
namespace deluge::gui::menu_item::midi::sound { | ||
|
||
class OutputMidiNoteForDrum final : public Integer { | ||
public: | ||
using Integer::Integer; | ||
[[nodiscard]] int32_t getMinValue() const override { return 0; } | ||
[[nodiscard]] int32_t getMaxValue() const override { return kMaxMIDIValue; } | ||
bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) override { | ||
return soundEditor.editingKit() && !soundEditor.editingNonAudioDrumRow(); | ||
} | ||
void readCurrentValue() override { | ||
int32_t value = soundEditor.currentSound->outputMidiNoteForDrum; | ||
if (value == MIDI_NOTE_NONE) { | ||
value = kNoteForDrum; | ||
} | ||
this->setValue(value); | ||
} | ||
void writeCurrentValue() override { soundEditor.currentSound->outputMidiNoteForDrum = this->getValue(); } | ||
}; | ||
} // namespace deluge::gui::menu_item::midi::sound |
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
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
Oops, something went wrong.