lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
include
Keymap.h
Go to the documentation of this file.
1
/*
2
* Keymap.h - holds information about a key mapping
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_KEYMAP_H
26
#define LMMS_KEYMAP_H
27
28
#include <vector>
29
#include <QObject>
30
#include <QString>
31
32
#include "
SerializingObject.h
"
33
34
namespace
lmms
35
{
36
37
class
Keymap
:
public
QObject,
public
SerializingObject
38
{
39
Q_OBJECT
40
public
:
41
Keymap
();
42
Keymap
(
43
QString description,
44
std::vector<int> newMap,
45
int
newFirst,
46
int
newLast,
47
int
newMiddle,
48
int
newBaseKey,
49
float
newBaseFreq
50
);
51
52
QString
getDescription
()
const
;
53
void
setDescription
(QString description);
54
55
int
getMiddleKey
()
const
{
return
m_middleKey
;}
56
int
getFirstKey
()
const
{
return
m_firstKey
;}
57
int
getLastKey
()
const
{
return
m_lastKey
;}
58
int
getBaseKey
()
const
{
return
m_baseKey
;}
59
float
getBaseFreq
()
const
{
return
m_baseFreq
;}
60
61
std::size_t
getSize
()
const
{
return
m_map
.size();}
62
66
int
getDegree
(
int
key)
const
;
67
71
int
getOctave
(
int
key)
const
;
72
73
const
std::vector<int> &
getMap
()
const
{
return
m_map
;}
74
75
void
saveSettings
(QDomDocument &doc, QDomElement &element)
override
;
76
void
loadSettings
(
const
QDomElement &element)
override
;
77
inline
QString
nodeName
()
const override
{
return
"keymap"
;}
78
79
private
:
80
QString
m_description
;
81
82
std::vector<int>
m_map
;
83
int
m_firstKey
;
84
int
m_lastKey
;
85
int
m_middleKey
;
86
int
m_baseKey
;
87
float
m_baseFreq
;
88
};
89
90
}
// namespace lmms
91
92
#endif
// LMMS_KEYMAP_H
SerializingObject.h
lmms::Keymap::getBaseKey
int getBaseKey() const
Definition
Keymap.h:58
lmms::Keymap::getSize
std::size_t getSize() const
Definition
Keymap.h:61
lmms::Keymap::getDegree
int getDegree(int key) const
Return scale degree for a given key, based on current map and first/middle/last notes.
Definition
Keymap.cpp:67
lmms::Keymap::getMap
const std::vector< int > & getMap() const
Definition
Keymap.h:73
lmms::Keymap::getDescription
QString getDescription() const
Definition
Keymap.cpp:96
lmms::Keymap::getMiddleKey
int getMiddleKey() const
Definition
Keymap.h:55
lmms::Keymap::loadSettings
void loadSettings(const QDomElement &element) override
Definition
Keymap.cpp:127
lmms::Keymap::getFirstKey
int getFirstKey() const
Definition
Keymap.h:56
lmms::Keymap::getOctave
int getOctave(int key) const
Return octave offset for a given key, based on current map and the middle note.
Definition
Keymap.cpp:79
lmms::Keymap::Keymap
Keymap()
Definition
Keymap.cpp:36
lmms::Keymap::m_firstKey
int m_firstKey
first key that will be mapped
Definition
Keymap.h:83
lmms::Keymap::setDescription
void setDescription(QString description)
Definition
Keymap.cpp:102
lmms::Keymap::getLastKey
int getLastKey() const
Definition
Keymap.h:57
lmms::Keymap::getBaseFreq
float getBaseFreq() const
Definition
Keymap.h:59
lmms::Keymap::m_baseKey
int m_baseKey
key which is assigned the reference "base note"
Definition
Keymap.h:86
lmms::Keymap::m_baseFreq
float m_baseFreq
frequency of the base note (usually A4 @440 Hz)
Definition
Keymap.h:87
lmms::Keymap::nodeName
QString nodeName() const override
Definition
Keymap.h:77
lmms::Keymap::m_middleKey
int m_middleKey
first line of the map refers to this key
Definition
Keymap.h:85
lmms::Keymap::m_map
std::vector< int > m_map
key to scale degree mapping
Definition
Keymap.h:82
lmms::Keymap::m_lastKey
int m_lastKey
last key that will be mapped
Definition
Keymap.h:84
lmms::Keymap::saveSettings
void saveSettings(QDomDocument &doc, QDomElement &element) override
Definition
Keymap.cpp:108
lmms::Keymap::m_description
QString m_description
name or description of the keymap
Definition
Keymap.h:80
lmms::SerializingObject::SerializingObject
SerializingObject()
Definition
SerializingObject.cpp:32
lmms
Definition
RemotePluginBase.cpp:34
Generated on
for lmms by
1.18.0