LMMS
Loading...
Searching...
No Matches
Microtuner.h
Go to the documentation of this file.
1/*
2 * Microtuner.h - manage tuning and scale information of an instrument
3 *
4 * Copyright (c) 2020 Martin Pavelek <he29.HS/at/gmail.com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_MICROTUNER_H
26#define LMMS_MICROTUNER_H
27
28#include "AutomatableModel.h"
29#include "ComboBoxModel.h"
30#include "JournallingObject.h"
31
32namespace lmms
33{
34
35class LMMS_EXPORT Microtuner : public Model, public JournallingObject
36{
37 Q_OBJECT
38public:
39 explicit Microtuner();
40
41 bool enabled() const {return m_enabledModel.value();}
42 bool keyRangeImport() const {return enabled() && m_keyRangeImportModel.value();}
43 int currentScale() const {return m_scaleModel.value();}
44 int currentKeymap() const {return m_keymapModel.value();}
45
50
51 int firstKey() const;
52 int lastKey() const;
53 int baseKey() const;
54 float baseFreq() const;
55
56 float keyToFreq(int key, int userBaseNote) const;
57 int octaveSize() const;
58
59 QString nodeName() const override {return "microtuner";}
60 void saveSettings(QDomDocument & document, QDomElement &element) override;
61 void loadSettings(const QDomElement &element) override;
62
63protected slots:
64 void updateScaleList(int index);
65 void updateKeymapList(int index);
66
67private:
72
73};
74
75} // namespace lmms
76
77#endif // LMMS_MICROTUNER_H
Definition AutomatableModel.h:497
Definition ComboBoxModel.h:39
JournallingObject()
Definition JournallingObject.cpp:36
int currentKeymap() const
Definition Microtuner.h:44
float baseFreq() const
int octaveSize() const
Definition Microtuner.cpp:111
bool enabled() const
Definition Microtuner.h:41
bool keyRangeImport() const
Definition Microtuner.h:42
ComboBoxModel * scaleModel()
Definition Microtuner.h:47
BoolModel * keyRangeImportModel()
Definition Microtuner.h:49
int firstKey() const
QString nodeName() const override
Definition Microtuner.h:59
int lastKey() const
float keyToFreq(int key, int userBaseNote) const
Return frequency for a given MIDI key, using the active mapping and scale.
Definition Microtuner.cpp:65
int baseKey() const
int currentScale() const
Definition Microtuner.h:43
BoolModel m_keyRangeImportModel
Definition Microtuner.h:71
ComboBoxModel m_scaleModel
Definition Microtuner.h:69
BoolModel * enabledModel()
Definition Microtuner.h:46
ComboBoxModel * keymapModel()
Definition Microtuner.h:48
BoolModel m_enabledModel
Enable microtuner (otherwise using 12-TET @440 Hz).
Definition Microtuner.h:68
ComboBoxModel m_keymapModel
Definition Microtuner.h:70
Microtuner()
Definition Microtuner.cpp:40
Model(Model *parent, QString displayName=QString(), bool defaultConstructed=false)
Definition Model.cpp:30
Definition AudioAlsa.cpp:35
ZCONST char * key
Definition crypt.c:587