Skip to content

Commit

Permalink
Support for alternative tunings and keyboard mappings (#5522)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Zander <[email protected]>
Co-authored-by: Dominic Clark <[email protected]>
Co-authored-by: Martin <[email protected]>
  • Loading branch information
4 people authored Sep 9, 2021
1 parent ace502f commit e07861c
Show file tree
Hide file tree
Showing 42 changed files with 2,077 additions and 90 deletions.
163 changes: 163 additions & 0 deletions data/projects/templates/default.mpt
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,168 @@
<projectnotes width="640" x="700" y="10" maximized="0" height="400" visible="0" minimized="0"></projectnotes>
<timeline lp1pos="192" lp0pos="0" lpstate="0"/>
<controllers/>
<scales>
<scale description="12-tone EDO (default)">
<interval num="1" den="1"/>
<interval cents="100"/>
<interval cents="200"/>
<interval cents="300"/>
<interval cents="400"/>
<interval cents="500"/>
<interval cents="600"/>
<interval cents="700"/>
<interval cents="800"/>
<interval cents="900"/>
<interval cents="1000"/>
<interval cents="1100"/>
<interval num="2" den="1"/>
</scale>
<scale description="24-tone EDO">
<interval num="1" den="1"/>
<interval cents="50"/>
<interval cents="100"/>
<interval cents="150"/>
<interval cents="200"/>
<interval cents="250"/>
<interval cents="300"/>
<interval cents="350"/>
<interval cents="400"/>
<interval cents="450"/>
<interval cents="500"/>
<interval cents="550"/>
<interval cents="600"/>
<interval cents="650"/>
<interval cents="700"/>
<interval cents="750"/>
<interval cents="800"/>
<interval cents="850"/>
<interval cents="900"/>
<interval cents="950"/>
<interval cents="1000"/>
<interval cents="1050"/>
<interval cents="1100"/>
<interval cents="1150"/>
<interval num="2" den="1"/>
</scale>
<scale description="7-tone JI C-major (Ptolemaic)">
<interval num="1" den="1"/>
<interval num="9" den="8"/>
<interval num="5" den="4"/>
<interval num="4" den="3"/>
<interval num="3" den="2"/>
<interval num="5" den="3"/>
<interval num="15" den="8"/>
<interval num="2" den="1"/>
</scale>
<scale description="12-tone JI (3-limit / Pythagorean)">
<interval num="1" den="1"/>
<interval num="256" den="243"/>
<interval num="9" den="8"/>
<interval num="32" den="27"/>
<interval num="81" den="64"/>
<interval num="4" den="3"/>
<interval num="729" den="512"/>
<interval num="3" den="2"/>
<interval num="128" den="81"/>
<interval num="27" den="16"/>
<interval num="16" den="9"/>
<interval num="243" den="128"/>
<interval num="2" den="1"/>
</scale>
<scale description="5-tone A-minor (3-limit / Pythagorean)">
<interval num="1" den="1"/>
<interval num="32" den="27"/>
<interval num="4" den="3"/>
<interval num="3" den="2"/>
<interval num="16" den="9"/>
<interval num="2" den="1"/>
</scale>
</scales>
<keymaps>
<keymap middle_key="0" description="all keys 1:1 (default)" base_freq="440" last_key="127" first_key="0" base_key="69">
</keymap>
<keymap middle_key="60" description="white keys to 7 degrees" base_freq="440" last_key="127" first_key="0" base_key="69">
<degree value="0"/>
<degree value="-1"/>
<degree value="1"/>
<degree value="-1"/>
<degree value="2"/>
<degree value="3"/>
<degree value="-1"/>
<degree value="4"/>
<degree value="-1"/>
<degree value="5"/>
<degree value="-1"/>
<degree value="6"/>
</keymap>
<keymap middle_key="60" description="white keys to 12 degrees" base_freq="440" last_key="127" first_key="0" base_key="69">
<degree value="0"/>
<degree value="-1"/>
<degree value="2"/>
<degree value="-1"/>
<degree value="4"/>
<degree value="5"/>
<degree value="-1"/>
<degree value="7"/>
<degree value="-1"/>
<degree value="9"/>
<degree value="-1"/>
<degree value="11"/>
</keymap>
<keymap middle_key="60" description="white keys to 24 degrees" base_freq="440" last_key="127" first_key="0" base_key="69">
<degree value="0"/>
<degree value="-1"/>
<degree value="2"/>
<degree value="-1"/>
<degree value="4"/>
<degree value="5"/>
<degree value="-1"/>
<degree value="7"/>
<degree value="-1"/>
<degree value="9"/>
<degree value="-1"/>
<degree value="11"/>
<degree value="12"/>
<degree value="-1"/>
<degree value="14"/>
<degree value="-1"/>
<degree value="16"/>
<degree value="17"/>
<degree value="-1"/>
<degree value="19"/>
<degree value="-1"/>
<degree value="21"/>
<degree value="-1"/>
<degree value="23"/>
</keymap>
<keymap middle_key="60" description="black keys to 5 degrees" base_freq="440" last_key="127" first_key="0" base_key="61">
<degree value="-1"/>
<degree value="0"/>
<degree value="-1"/>
<degree value="1"/>
<degree value="-1"/>
<degree value="-1"/>
<degree value="2"/>
<degree value="-1"/>
<degree value="3"/>
<degree value="-1"/>
<degree value="4"/>
<degree value="-1"/>
</keymap>
<keymap middle_key="60" description="black keys to 12 degrees" base_freq="466.165" last_key="127" first_key="0" base_key="70">
<degree value="-1"/>
<degree value="1"/>
<degree value="-1"/>
<degree value="3"/>
<degree value="-1"/>
<degree value="-1"/>
<degree value="6"/>
<degree value="-1"/>
<degree value="8"/>
<degree value="-1"/>
<degree value="10"/>
<degree value="-1"/>
</keymap>
</keymaps>
</song>
</lmms-project>
Binary file added data/themes/classic/lcd_19green_dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/classic/lcd_19pink_dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/classic/lcd_19red_dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/classic/microtuner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/default/lcd_19green_dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/default/lcd_19pink_dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/default/lcd_19red_dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/default/microtuner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions include/ComboBoxModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifndef COMBOBOX_MODEL_H
#define COMBOBOX_MODEL_H

#include <cassert>
#include <memory>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -52,6 +53,8 @@ class LMMS_EXPORT ComboBoxModel : public IntModel

void addItem( QString item, std::unique_ptr<PixmapLoader> loader = nullptr );

void replaceItem(std::size_t index, QString item, std::unique_ptr<PixmapLoader> loader = nullptr);

void clear();

int findText( const QString& txt ) const;
Expand Down
3 changes: 3 additions & 0 deletions include/GuiApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class BBEditor;
class ControllerRackView;
class FxMixerView;
class MainWindow;
class MicrotunerConfig;
class PianoRollWindow;
class ProjectNotes;
class SongEditorWindow;
Expand All @@ -59,6 +60,7 @@ class LMMS_EXPORT GuiApplication : public QObject
BBEditor* getBBEditor() { return m_bbEditor; }
PianoRollWindow* pianoRoll() { return m_pianoRoll; }
ProjectNotes* getProjectNotes() { return m_projectNotes; }
MicrotunerConfig* getMicrotunerConfig() { return m_microtunerConfig; }
AutomationEditorWindow* automationEditor() { return m_automationEditor; }
ControllerRackView* getControllerRackView() { return m_controllerRackView; }

Expand All @@ -78,6 +80,7 @@ private slots:
BBEditor* m_bbEditor;
PianoRollWindow* m_pianoRoll;
ProjectNotes* m_projectNotes;
MicrotunerConfig* m_microtunerConfig;
ControllerRackView* m_controllerRackView;
QLabel* m_loadingProgressLabel;
};
Expand Down
18 changes: 0 additions & 18 deletions include/InstrumentMidiIOView.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,4 @@ class InstrumentMidiIOView : public QWidget, public ModelView

} ;

class InstrumentMiscView : public QWidget
{
Q_OBJECT
public:
InstrumentMiscView( InstrumentTrack *it, QWidget* parent );
~InstrumentMiscView();

GroupBox * pitchGroupBox()
{
return m_pitchGroupBox;
}

private:

GroupBox * m_pitchGroupBox;

};

#endif
63 changes: 63 additions & 0 deletions include/InstrumentMiscView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* InstrumentMiscView.h - widget in instrument-track-window for setting up
* miscellaneous options not covered by other tabs
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2020 Martin Pavelek <he29.HS/at/gmail.com>
*
* This file is part of LMMS - https://lmms.io
*
* This program 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 2 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#ifndef INSTRUMENT_MISC_VIEW_H
#define INSTRUMENT_MISC_VIEW_H

#include <QWidget>


class ComboBox;
class GroupBox;
class InstrumentTrack;
class LedCheckBox;


class InstrumentMiscView : public QWidget
{
Q_OBJECT
public:
InstrumentMiscView(InstrumentTrack *it, QWidget *parent);

GroupBox *pitchGroupBox() {return m_pitchGroupBox;}
GroupBox *microtunerGroupBox() {return m_microtunerGroupBox;}

ComboBox *scaleCombo() {return m_scaleCombo;}
ComboBox *keymapCombo() {return m_keymapCombo;}

LedCheckBox *rangeImportCheckbox() {return m_rangeImportCheckbox;}

private:
GroupBox *m_pitchGroupBox;
GroupBox *m_microtunerGroupBox;

ComboBox *m_scaleCombo;
ComboBox *m_keymapCombo;

LedCheckBox *m_rangeImportCheckbox;
};

#endif
13 changes: 12 additions & 1 deletion include/InstrumentTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "GroupBox.h"
#include "InstrumentFunctions.h"
#include "InstrumentSoundShaping.h"
#include "Microtuner.h"
#include "Midi.h"
#include "MidiCCRackView.h"
#include "MidiEventProcessor.h"
Expand Down Expand Up @@ -184,15 +185,23 @@ class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor
return &m_lastKeyModel;
}

int baseNote() const;
bool keyRangeImport() const;
bool isKeyMapped(int key) const;
int firstKey() const;
int lastKey() const;
int baseNote() const;
float baseFreq() const;

Piano *pianoModel()
{
return &m_piano;
}

Microtuner *microtuner()
{
return &m_microtuner;
}

bool isArpeggioEnabled() const
{
return m_arpeggio.m_arpEnabledModel.value();
Expand Down Expand Up @@ -305,6 +314,8 @@ protected slots:

Piano m_piano;

Microtuner m_microtuner;

std::unique_ptr<BoolModel> m_midiCCEnable;
std::unique_ptr<FloatModel> m_midiCCModel[MidiControllerCount];

Expand Down
Loading

0 comments on commit e07861c

Please sign in to comment.