Files
lmms/include/Keymap.h
Johannes Lorenz 7db3fa94a1 Improve includes (#6320)
* Update ringbuffer submodule to fix includes

* Remove cyclic includes

* Remove Qt include prefixes

* Include C++ versions of C headers

E.g.: assert.h -> cassert

* Move CLIP_BORDER_WIDTH into ClipView

This allows to remove includes to TrackView.h in ClipView cpp files.

* Elliminate useless includes

This improves the include structure by elliminating includes that are
not used. Most of this was done by using `include-what-you-use` with
`CMAKE_C_INCLUDE_WHAT_YOU_USE` and `CMAKE_CXX_INCLUDE_WHAT_YOU_USE`
set to (broken down here):

```
include-what-you-use;
    -Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp;
    -Xiwyu;--keep=*/xmmintrin.h;
    -Xiwyu;--keep=*/lmmsconfig.h;
    -Xiwyu;--keep=*/weak_libjack.h;
    -Xiwyu;--keep=*/sys/*;
    -Xiwyu;--keep=*/debug.h;
    -Xiwyu;--keep=*/SDL/*;
    -Xiwyu;--keep=*/alsa/*;
    -Xiwyu;--keep=*/FL/x.h;
    -Xiwyu;--keep=*/MidiApple.h;
    -Xiwyu;--keep=*/MidiWinMM.h;
    -Xiwyu;--keep=*/AudioSoundIo.h
```

* Fixup: Remove empty #if-#ifdef pairs

* Remove LMMS_HAVE_STD(LIB|INT)_H
2022-03-02 13:30:43 +01:00

79 lines
2.4 KiB
C++

/*
* Keymap.h - holds information about a key mapping
*
* 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 KEYMAP_H
#define KEYMAP_H
#include <vector>
#include <QObject>
#include <QString>
#include "SerializingObject.h"
class Keymap : public QObject, public SerializingObject
{
Q_OBJECT
public:
Keymap();
Keymap(
QString description,
std::vector<int> newMap,
int newFirst,
int newLast,
int newMiddle,
int newBaseKey,
float newBaseFreq
);
QString getDescription() const;
void setDescription(QString description);
int getMiddleKey() const {return m_middleKey;}
int getFirstKey() const {return m_firstKey;}
int getLastKey() const {return m_lastKey;}
int getBaseKey() const {return m_baseKey;}
float getBaseFreq() const {return m_baseFreq;}
std::size_t getSize() const {return m_map.size();}
int getDegree(int key) const;
int getOctave(int key) const;
const std::vector<int> &getMap() const {return m_map;}
void saveSettings(QDomDocument &doc, QDomElement &element) override;
void loadSettings(const QDomElement &element) override;
inline QString nodeName() const override {return "keymap";}
private:
QString m_description; //!< name or description of the keymap
std::vector<int> m_map; //!< key to scale degree mapping
int m_firstKey; //!< first key that will be mapped
int m_lastKey; //!< last key that will be mapped
int m_middleKey; //!< first line of the map refers to this key
int m_baseKey; //!< key which is assigned the reference "base note"
float m_baseFreq; //!< frequency of the base note (usually A4 @440 Hz)
};
#endif