Add tab for loop station
This commit is contained in:
@ -15,19 +15,20 @@ SOURCES += \
|
|||||||
audioformat.cpp \
|
audioformat.cpp \
|
||||||
audioplayer.cpp \
|
audioplayer.cpp \
|
||||||
drummachinesettings.cpp \
|
drummachinesettings.cpp \
|
||||||
filesmodel.cpp \
|
drumpadfilesmodel.cpp \
|
||||||
|
drumpadpresets.cpp \
|
||||||
|
drumpadpresetsmodel.cpp \
|
||||||
graphrenderer.cpp \
|
graphrenderer.cpp \
|
||||||
jsonconverters.cpp \
|
jsonconverters.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
midicontainers.cpp \
|
midicontainers.cpp \
|
||||||
midiinwrapper.cpp \
|
midiinwrapper.cpp \
|
||||||
midioutwrapper.cpp \
|
midioutwrapper.cpp \
|
||||||
presets.cpp \
|
|
||||||
presetsmodel.cpp \
|
|
||||||
synthisizer.cpp \
|
synthisizer.cpp \
|
||||||
treetotableproxymodel.cpp \
|
treetotableproxymodel.cpp \
|
||||||
widgets/djwidget.cpp \
|
widgets/djwidget.cpp \
|
||||||
widgets/drumpadwidget.cpp \
|
widgets/drumpadwidget.cpp \
|
||||||
|
widgets/loopstationwidget.cpp \
|
||||||
widgets/mainwindow.cpp \
|
widgets/mainwindow.cpp \
|
||||||
widgets/midibutton.cpp \
|
widgets/midibutton.cpp \
|
||||||
widgets/presetdetailwidget.cpp \
|
widgets/presetdetailwidget.cpp \
|
||||||
@ -44,18 +45,19 @@ HEADERS += \
|
|||||||
audioformat.h \
|
audioformat.h \
|
||||||
audioplayer.h \
|
audioplayer.h \
|
||||||
drummachinesettings.h \
|
drummachinesettings.h \
|
||||||
filesmodel.h \
|
drumpadfilesmodel.h \
|
||||||
|
drumpadpresets.h \
|
||||||
|
drumpadpresetsmodel.h \
|
||||||
graphrenderer.h \
|
graphrenderer.h \
|
||||||
jsonconverters.h \
|
jsonconverters.h \
|
||||||
midicontainers.h \
|
midicontainers.h \
|
||||||
midiinwrapper.h \
|
midiinwrapper.h \
|
||||||
midioutwrapper.h \
|
midioutwrapper.h \
|
||||||
presets.h \
|
|
||||||
presetsmodel.h \
|
|
||||||
synthisizer.h \
|
synthisizer.h \
|
||||||
treetotableproxymodel.h \
|
treetotableproxymodel.h \
|
||||||
widgets/djwidget.h \
|
widgets/djwidget.h \
|
||||||
widgets/drumpadwidget.h \
|
widgets/drumpadwidget.h \
|
||||||
|
widgets/loopstationwidget.h \
|
||||||
widgets/mainwindow.h \
|
widgets/mainwindow.h \
|
||||||
widgets/midibutton.h \
|
widgets/midibutton.h \
|
||||||
widgets/presetdetailwidget.h \
|
widgets/presetdetailwidget.h \
|
||||||
@ -70,6 +72,7 @@ HEADERS += \
|
|||||||
FORMS += \
|
FORMS += \
|
||||||
widgets/djwidget.ui \
|
widgets/djwidget.ui \
|
||||||
widgets/drumpadwidget.ui \
|
widgets/drumpadwidget.ui \
|
||||||
|
widgets/loopstationwidget.ui \
|
||||||
widgets/mainwindow.ui \
|
widgets/mainwindow.ui \
|
||||||
widgets/presetdetailwidget.ui \
|
widgets/presetdetailwidget.ui \
|
||||||
widgets/sampleswidget.ui \
|
widgets/sampleswidget.ui \
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <QAudioFormat>
|
#include <QAudioFormat>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
static constexpr int frameRate = 44100;
|
static constexpr int frameRate = 44100;
|
||||||
static constexpr int channelCount = 2;
|
static constexpr int channelCount = 2;
|
||||||
static constexpr int sampleSize = 32;
|
static constexpr int sampleSize = 32;
|
||||||
@ -9,6 +11,6 @@ static constexpr auto codec = "audio/pcm";
|
|||||||
static constexpr QAudioFormat::Endian byteOrder = QAudioFormat::LittleEndian;
|
static constexpr QAudioFormat::Endian byteOrder = QAudioFormat::LittleEndian;
|
||||||
static constexpr QAudioFormat::SampleType sampleType = QAudioFormat::Float;
|
static constexpr QAudioFormat::SampleType sampleType = QAudioFormat::Float;
|
||||||
using sample_t = float;
|
using sample_t = float;
|
||||||
using frame_t = std::array<sample_t, channelCount>;
|
struct frame_t : std::array<sample_t, channelCount> {};
|
||||||
|
|
||||||
const QAudioFormat &audioFormat();
|
const QAudioFormat &audioFormat();
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
|
|
||||||
AudioPlayer::AudioPlayer(QObject *parent) :
|
AudioPlayer::AudioPlayer(QObject *parent) :
|
||||||
QObject{parent}
|
QObject{parent}
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
#include "audioformat.h"
|
struct frame_t;
|
||||||
|
|
||||||
class AudioPlayer : public QObject
|
class AudioPlayer : public QObject
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "filesmodel.h"
|
#include "drumpadfilesmodel.h"
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
@ -14,26 +14,26 @@ enum {
|
|||||||
NumberOfColumns
|
NumberOfColumns
|
||||||
};
|
};
|
||||||
|
|
||||||
FilesModel::~FilesModel() = default;
|
DrumPadFilesModel::~DrumPadFilesModel() = default;
|
||||||
|
|
||||||
const presets::File &FilesModel::getFile(const QModelIndex &index) const
|
const drumpad_presets::File &DrumPadFilesModel::getFile(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
return getFile(index.row());
|
return getFile(index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
const presets::File &FilesModel::getFile(int row) const
|
const drumpad_presets::File &DrumPadFilesModel::getFile(int row) const
|
||||||
{
|
{
|
||||||
return m_files->at(row);
|
return m_files->at(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilesModel::setPreset(const presets::Preset &preset)
|
void DrumPadFilesModel::setPreset(const drumpad_presets::Preset &preset)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_files = preset.files;
|
m_files = preset.files;
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
int FilesModel::rowCount(const QModelIndex &parent) const
|
int DrumPadFilesModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
@ -43,14 +43,14 @@ int FilesModel::rowCount(const QModelIndex &parent) const
|
|||||||
return std::size(*m_files);
|
return std::size(*m_files);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FilesModel::columnCount(const QModelIndex &parent) const
|
int DrumPadFilesModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
return NumberOfColumns;
|
return NumberOfColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FilesModel::data(const QModelIndex &index, int role) const
|
QVariant DrumPadFilesModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::FontRole && role != Qt::ForegroundRole)
|
if (role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::FontRole && role != Qt::ForegroundRole)
|
||||||
return {};
|
return {};
|
||||||
@ -63,7 +63,7 @@ QVariant FilesModel::data(const QModelIndex &index, int role) const
|
|||||||
return {};
|
return {};
|
||||||
if (index.row() < 0)
|
if (index.row() < 0)
|
||||||
return {};
|
return {};
|
||||||
if (index.row() >= std::size(*m_files))
|
if (index.row() >= int(std::size(*m_files)))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const auto &file = getFile(index);
|
const auto &file = getFile(index);
|
||||||
@ -103,7 +103,7 @@ QVariant FilesModel::data(const QModelIndex &index, int role) const
|
|||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FilesModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant DrumPadFilesModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
if (role != Qt::DisplayRole && role != Qt::EditRole)
|
if (role != Qt::DisplayRole && role != Qt::EditRole)
|
||||||
return {};
|
return {};
|
@ -4,22 +4,22 @@
|
|||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
#include "presets.h"
|
#include "drumpadpresets.h"
|
||||||
|
|
||||||
namespace presets { class Preset; class File; }
|
namespace drumpad_presets { class Preset; class File; }
|
||||||
|
|
||||||
class FilesModel : public QAbstractTableModel
|
class DrumPadFilesModel : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using QAbstractTableModel::QAbstractTableModel;
|
using QAbstractTableModel::QAbstractTableModel;
|
||||||
~FilesModel() override;
|
~DrumPadFilesModel() override;
|
||||||
|
|
||||||
const presets::File &getFile(const QModelIndex &index) const;
|
const drumpad_presets::File &getFile(const QModelIndex &index) const;
|
||||||
const presets::File &getFile(int row) const;
|
const drumpad_presets::File &getFile(int row) const;
|
||||||
|
|
||||||
void setPreset(const presets::Preset &preset);
|
void setPreset(const drumpad_presets::Preset &preset);
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent) const override;
|
int rowCount(const QModelIndex &parent) const override;
|
||||||
int columnCount(const QModelIndex &parent) const override;
|
int columnCount(const QModelIndex &parent) const override;
|
||||||
@ -27,5 +27,5 @@ public:
|
|||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::optional<std::array<presets::File, 24>> m_files;
|
std::optional<std::array<drumpad_presets::File, 24>> m_files;
|
||||||
};
|
};
|
@ -1,6 +1,6 @@
|
|||||||
#include "presets.h"
|
#include "drumpadpresets.h"
|
||||||
|
|
||||||
namespace presets
|
namespace drumpad_presets
|
||||||
{
|
{
|
||||||
|
|
||||||
bool File::operator==(const File &other) const
|
bool File::operator==(const File &other) const
|
@ -8,7 +8,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
namespace presets
|
namespace drumpad_presets
|
||||||
{
|
{
|
||||||
struct Filter
|
struct Filter
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ struct Preset
|
|||||||
std::optional<QString> imagePreview1;
|
std::optional<QString> imagePreview1;
|
||||||
std::optional<QString> videoPreview;
|
std::optional<QString> videoPreview;
|
||||||
std::optional<QString> videoTutorial;
|
std::optional<QString> videoTutorial;
|
||||||
std::optional<std::array<presets::File, 24>> files;
|
std::optional<std::array<drumpad_presets::File, 24>> files;
|
||||||
std::optional<std::map<QString, std::vector<Sequence>>> beatSchool;
|
std::optional<std::map<QString, std::vector<Sequence>>> beatSchool;
|
||||||
std::optional<std::map<QString, std::vector<Sequence>>> easyPlay;
|
std::optional<std::map<QString, std::vector<Sequence>>> easyPlay;
|
||||||
std::optional<QDateTime> timestamp;
|
std::optional<QDateTime> timestamp;
|
@ -1,11 +1,11 @@
|
|||||||
#include "presetsmodel.h"
|
#include "drumpadpresetsmodel.h"
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
#include "presets.h"
|
#include "drumpadpresets.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ColumnId,
|
ColumnId,
|
||||||
@ -32,96 +32,96 @@ enum {
|
|||||||
NumberOfColumns
|
NumberOfColumns
|
||||||
};
|
};
|
||||||
|
|
||||||
PresetsModel::PresetsModel(QObject *parent) :
|
DrumPadPresetsModel::DrumPadPresetsModel(QObject *parent) :
|
||||||
QAbstractTableModel{parent}
|
QAbstractTableModel{parent}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PresetsModel::PresetsModel(const std::map<QString, presets::Preset> &presets, QObject *parent) :
|
DrumPadPresetsModel::DrumPadPresetsModel(const std::map<QString, drumpad_presets::Preset> &drumpad_presets, QObject *parent) :
|
||||||
QAbstractTableModel{parent}
|
QAbstractTableModel{parent}
|
||||||
{
|
{
|
||||||
m_presets.reserve(std::size(presets));
|
m_drumpad_presets.reserve(std::size(drumpad_presets));
|
||||||
for (const auto &pair : presets)
|
for (const auto &pair : drumpad_presets)
|
||||||
m_presets.emplace_back(pair.second);
|
m_drumpad_presets.emplace_back(pair.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
PresetsModel::PresetsModel(std::vector<presets::Preset> &&presets, QObject *parent) :
|
DrumPadPresetsModel::DrumPadPresetsModel(std::vector<drumpad_presets::Preset> &&drumpad_presets, QObject *parent) :
|
||||||
QAbstractTableModel{parent}
|
QAbstractTableModel{parent}
|
||||||
{
|
{
|
||||||
m_presets = std::move(presets);
|
m_drumpad_presets = std::move(drumpad_presets);
|
||||||
}
|
}
|
||||||
|
|
||||||
PresetsModel::PresetsModel(const std::vector<presets::Preset> &presets, QObject *parent) :
|
DrumPadPresetsModel::DrumPadPresetsModel(const std::vector<drumpad_presets::Preset> &drumpad_presets, QObject *parent) :
|
||||||
QAbstractTableModel{parent}
|
QAbstractTableModel{parent}
|
||||||
{
|
{
|
||||||
m_presets = presets;
|
m_drumpad_presets = drumpad_presets;
|
||||||
}
|
}
|
||||||
|
|
||||||
PresetsModel::~PresetsModel() = default;
|
DrumPadPresetsModel::~DrumPadPresetsModel() = default;
|
||||||
|
|
||||||
void PresetsModel::setPresets(const std::map<QString, presets::Preset> &presets)
|
void DrumPadPresetsModel::setPresets(const std::map<QString, drumpad_presets::Preset> &drumpad_presets)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_presets.clear();
|
m_drumpad_presets.clear();
|
||||||
m_presets.reserve(std::size(presets));
|
m_drumpad_presets.reserve(std::size(drumpad_presets));
|
||||||
for (const auto &pair : presets)
|
for (const auto &pair : drumpad_presets)
|
||||||
m_presets.emplace_back(pair.second);
|
m_drumpad_presets.emplace_back(pair.second);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PresetsModel::setPresets(std::vector<presets::Preset> &&presets)
|
void DrumPadPresetsModel::setPresets(std::vector<drumpad_presets::Preset> &&drumpad_presets)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_presets = std::move(presets);
|
m_drumpad_presets = std::move(drumpad_presets);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PresetsModel::setPresets(const std::vector<presets::Preset> &presets)
|
void DrumPadPresetsModel::setPresets(const std::vector<drumpad_presets::Preset> &drumpad_presets)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_presets = presets;
|
m_drumpad_presets = drumpad_presets;
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
const presets::Preset &PresetsModel::getPreset(const QModelIndex &index) const
|
const drumpad_presets::Preset &DrumPadPresetsModel::getPreset(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
return getPreset(index.row());
|
return getPreset(index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
const presets::Preset &PresetsModel::getPreset(int row) const
|
const drumpad_presets::Preset &DrumPadPresetsModel::getPreset(int row) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(row >= 0 && row < std::size(m_presets));
|
Q_ASSERT(row >= 0 && row < std::size(m_drumpad_presets));
|
||||||
return m_presets.at(row);
|
return m_drumpad_presets.at(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex PresetsModel::findPresetById(const QString &id) const
|
QModelIndex DrumPadPresetsModel::findPresetById(const QString &id) const
|
||||||
{
|
{
|
||||||
for (auto iter = std::cbegin(m_presets); iter != std::cend(m_presets); iter++)
|
for (auto iter = std::cbegin(m_drumpad_presets); iter != std::cend(m_drumpad_presets); iter++)
|
||||||
{
|
{
|
||||||
if (iter->id != id)
|
if (iter->id != id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return createIndex(std::distance(std::cbegin(m_presets), iter), 0);
|
return createIndex(std::distance(std::cbegin(m_drumpad_presets), iter), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
int PresetsModel::rowCount(const QModelIndex &parent) const
|
int DrumPadPresetsModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
return std::size(m_presets);
|
return std::size(m_drumpad_presets);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PresetsModel::columnCount(const QModelIndex &parent) const
|
int DrumPadPresetsModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
return NumberOfColumns;
|
return NumberOfColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant PresetsModel::data(const QModelIndex &index, int role) const
|
QVariant DrumPadPresetsModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::FontRole && role != Qt::ForegroundRole)
|
if (role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::FontRole && role != Qt::ForegroundRole)
|
||||||
return {};
|
return {};
|
||||||
@ -132,7 +132,7 @@ QVariant PresetsModel::data(const QModelIndex &index, int role) const
|
|||||||
return {};
|
return {};
|
||||||
if (index.row() < 0)
|
if (index.row() < 0)
|
||||||
return {};
|
return {};
|
||||||
if (index.row() >= std::size(m_presets))
|
if (index.row() >= std::size(m_drumpad_presets))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const auto &preset = getPreset(index);
|
const auto &preset = getPreset(index);
|
||||||
@ -230,7 +230,7 @@ QVariant PresetsModel::data(const QModelIndex &index, int role) const
|
|||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant PresetsModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant DrumPadPresetsModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
if (role != Qt::DisplayRole && role != Qt::EditRole)
|
if (role != Qt::DisplayRole && role != Qt::EditRole)
|
||||||
return {};
|
return {};
|
36
drumpadpresetsmodel.h
Executable file
36
drumpadpresetsmodel.h
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
|
namespace drumpad_presets { class Preset; }
|
||||||
|
|
||||||
|
class DrumPadPresetsModel : public QAbstractTableModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DrumPadPresetsModel(QObject *parent = nullptr);
|
||||||
|
DrumPadPresetsModel(const std::map<QString, drumpad_presets::Preset> &drumpad_presets, QObject *parent = nullptr);
|
||||||
|
DrumPadPresetsModel(std::vector<drumpad_presets::Preset> &&drumpad_presets, QObject *parent = nullptr);
|
||||||
|
DrumPadPresetsModel(const std::vector<drumpad_presets::Preset> &drumpad_presets, QObject *parent = nullptr);
|
||||||
|
~DrumPadPresetsModel() override;
|
||||||
|
|
||||||
|
void setPresets(const std::map<QString, drumpad_presets::Preset> &drumpad_presets);
|
||||||
|
void setPresets(std::vector<drumpad_presets::Preset> &&drumpad_presets);
|
||||||
|
void setPresets(const std::vector<drumpad_presets::Preset> &drumpad_presets);
|
||||||
|
|
||||||
|
const drumpad_presets::Preset &getPreset(const QModelIndex &index) const;
|
||||||
|
const drumpad_presets::Preset &getPreset(int row) const;
|
||||||
|
|
||||||
|
QModelIndex findPresetById(const QString &id) const;
|
||||||
|
|
||||||
|
int rowCount(const QModelIndex &parent) const override;
|
||||||
|
int columnCount(const QModelIndex &parent) const override;
|
||||||
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<drumpad_presets::Preset> m_drumpad_presets;
|
||||||
|
};
|
@ -5,6 +5,10 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
#include <QRect>
|
||||||
|
#include <QPoint>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
|
|
||||||
QPixmap GraphRenderer::render(const QSize &size, const frame_t *begin, const frame_t *end, const QPalette &palette)
|
QPixmap GraphRenderer::render(const QSize &size, const frame_t *begin, const frame_t *end, const QPalette &palette)
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
class QPixmap;
|
class QPixmap;
|
||||||
class QSize;
|
class QSize;
|
||||||
class QPainter;
|
class QPainter;
|
||||||
class QPalette;
|
class QPalette;
|
||||||
|
class QRect;
|
||||||
|
class QPoint;
|
||||||
|
|
||||||
#include "audioformat.h"
|
struct frame_t;
|
||||||
|
|
||||||
namespace GraphRenderer
|
namespace GraphRenderer
|
||||||
{
|
{
|
||||||
|
@ -83,9 +83,9 @@ std::vector<int> parseIntVectorIgnoreNulls(const QJsonValue &jsonValue)
|
|||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
presets::PresetsConfig parsePresetsConfig(const QJsonObject &jsonObj)
|
drumpad_presets::PresetsConfig parseDrumPadPresetsConfig(const QJsonObject &jsonObj)
|
||||||
{
|
{
|
||||||
presets::PresetsConfig presetConfig;
|
drumpad_presets::PresetsConfig presetConfig;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
{
|
{
|
||||||
@ -100,12 +100,12 @@ presets::PresetsConfig parsePresetsConfig(const QJsonObject &jsonObj)
|
|||||||
return presetConfig;
|
return presetConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<presets::Category> parseCategoryVector(const QJsonValue &jsonValue)
|
std::vector<drumpad_presets::Category> parseCategoryVector(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isArray())
|
if (!jsonValue.isArray())
|
||||||
throw std::runtime_error{"json value for vector of Category is not an array"};
|
throw std::runtime_error{"json value for vector of Category is not an array"};
|
||||||
|
|
||||||
std::vector<presets::Category> vector;
|
std::vector<drumpad_presets::Category> vector;
|
||||||
|
|
||||||
for (const auto &jsonValue : jsonValue.toArray())
|
for (const auto &jsonValue : jsonValue.toArray())
|
||||||
vector.emplace_back(parseCategory(jsonValue));
|
vector.emplace_back(parseCategory(jsonValue));
|
||||||
@ -113,14 +113,14 @@ std::vector<presets::Category> parseCategoryVector(const QJsonValue &jsonValue)
|
|||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<QString, presets::Preset> parsePresetMap(const QJsonValue &jsonValue)
|
std::map<QString, drumpad_presets::Preset> parsePresetMap(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for Preset map is not an object"};
|
throw std::runtime_error{"json value for Preset map is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
std::map<QString, presets::Preset> map;
|
std::map<QString, drumpad_presets::Preset> map;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
map[iter.key()] = parsePreset(iter.value());
|
map[iter.key()] = parsePreset(iter.value());
|
||||||
@ -128,14 +128,14 @@ std::map<QString, presets::Preset> parsePresetMap(const QJsonValue &jsonValue)
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
presets::Category parseCategory(const QJsonValue &jsonValue)
|
drumpad_presets::Category parseCategory(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for Category is not an object"};
|
throw std::runtime_error{"json value for Category is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
presets::Category category;
|
drumpad_presets::Category category;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
{
|
{
|
||||||
@ -150,14 +150,14 @@ presets::Category parseCategory(const QJsonValue &jsonValue)
|
|||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
presets::Filter parseFilter(const QJsonValue &jsonValue)
|
drumpad_presets::Filter parseFilter(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for Filters is not an object"};
|
throw std::runtime_error{"json value for Filters is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
presets::Filter filters;
|
drumpad_presets::Filter filters;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
{
|
{
|
||||||
@ -170,14 +170,14 @@ presets::Filter parseFilter(const QJsonValue &jsonValue)
|
|||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
presets::Preset parsePreset(const QJsonValue &jsonValue)
|
drumpad_presets::Preset parsePreset(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for Preset is not an object"};
|
throw std::runtime_error{"json value for Preset is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
presets::Preset preset;
|
drumpad_presets::Preset preset;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
{
|
{
|
||||||
@ -241,7 +241,7 @@ presets::Preset parsePreset(const QJsonValue &jsonValue)
|
|||||||
return preset;
|
return preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<presets::File, 24> parseFileArray(const QJsonValue &jsonValue)
|
std::array<drumpad_presets::File, 24> parseFileArray(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for File array is not an object"};
|
throw std::runtime_error{"json value for File array is not an object"};
|
||||||
@ -251,7 +251,7 @@ std::array<presets::File, 24> parseFileArray(const QJsonValue &jsonValue)
|
|||||||
if (jsonObj.size() != 24)
|
if (jsonObj.size() != 24)
|
||||||
throw std::runtime_error{"json value for File array doesn't have exactly 24 entries"};
|
throw std::runtime_error{"json value for File array doesn't have exactly 24 entries"};
|
||||||
|
|
||||||
std::array<presets::File, 24> array;
|
std::array<drumpad_presets::File, 24> array;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
{
|
{
|
||||||
@ -267,14 +267,14 @@ std::array<presets::File, 24> parseFileArray(const QJsonValue &jsonValue)
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
presets::File parseFile(const QJsonValue &jsonValue)
|
drumpad_presets::File parseFile(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for File is not an object"};
|
throw std::runtime_error{"json value for File is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
presets::File file;
|
drumpad_presets::File file;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
{
|
{
|
||||||
@ -296,12 +296,12 @@ presets::File parseFile(const QJsonValue &jsonValue)
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<presets::Sequence> parseSequenceVector(const QJsonValue &jsonValue)
|
std::vector<drumpad_presets::Sequence> parseSequenceVector(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isArray())
|
if (!jsonValue.isArray())
|
||||||
throw std::runtime_error{"json value for vector of Sequence is not an array"};
|
throw std::runtime_error{"json value for vector of Sequence is not an array"};
|
||||||
|
|
||||||
std::vector<presets::Sequence> vector;
|
std::vector<drumpad_presets::Sequence> vector;
|
||||||
|
|
||||||
for (const auto &jsonValue : jsonValue.toArray())
|
for (const auto &jsonValue : jsonValue.toArray())
|
||||||
vector.emplace_back(parseSequence(jsonValue));
|
vector.emplace_back(parseSequence(jsonValue));
|
||||||
@ -309,14 +309,14 @@ std::vector<presets::Sequence> parseSequenceVector(const QJsonValue &jsonValue)
|
|||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
presets::Sequence parseSequence(const QJsonValue &jsonValue)
|
drumpad_presets::Sequence parseSequence(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for File is not an object"};
|
throw std::runtime_error{"json value for File is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
presets::Sequence sequence;
|
drumpad_presets::Sequence sequence;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
{
|
{
|
||||||
@ -342,14 +342,14 @@ presets::Sequence parseSequence(const QJsonValue &jsonValue)
|
|||||||
return sequence;
|
return sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<QString, std::vector<presets::Sequence>> parseSequenceVectorMap(const QJsonValue &jsonValue)
|
std::map<QString, std::vector<drumpad_presets::Sequence>> parseSequenceVectorMap(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for Sequence vector map is not an object"};
|
throw std::runtime_error{"json value for Sequence vector map is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
std::map<QString, std::vector<presets::Sequence>> map;
|
std::map<QString, std::vector<drumpad_presets::Sequence>> map;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
map[iter.key()] = parseSequenceVector(iter.value());
|
map[iter.key()] = parseSequenceVector(iter.value());
|
||||||
@ -357,14 +357,14 @@ std::map<QString, std::vector<presets::Sequence>> parseSequenceVectorMap(const Q
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
presets::SequencePad parseSequencePad(const QJsonValue &jsonValue)
|
drumpad_presets::SequencePad parseSequencePad(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for File is not an object"};
|
throw std::runtime_error{"json value for File is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
presets::SequencePad sequencePad;
|
drumpad_presets::SequencePad sequencePad;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
{
|
{
|
||||||
@ -381,12 +381,12 @@ presets::SequencePad parseSequencePad(const QJsonValue &jsonValue)
|
|||||||
return sequencePad;
|
return sequencePad;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<presets::SequencePad> parseSequencePadVector(const QJsonValue &jsonValue)
|
std::vector<drumpad_presets::SequencePad> parseSequencePadVector(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isArray())
|
if (!jsonValue.isArray())
|
||||||
throw std::runtime_error{"json value for vector of SequencePad is not an array"};
|
throw std::runtime_error{"json value for vector of SequencePad is not an array"};
|
||||||
|
|
||||||
std::vector<presets::SequencePad> vector;
|
std::vector<drumpad_presets::SequencePad> vector;
|
||||||
|
|
||||||
for (const auto &jsonValue : jsonValue.toArray())
|
for (const auto &jsonValue : jsonValue.toArray())
|
||||||
vector.emplace_back(parseSequencePad(jsonValue));
|
vector.emplace_back(parseSequencePad(jsonValue));
|
||||||
@ -394,14 +394,14 @@ std::vector<presets::SequencePad> parseSequencePadVector(const QJsonValue &jsonV
|
|||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<QString, std::vector<presets::SequencePad>> parseSequencePadVectorMap(const QJsonValue &jsonValue)
|
std::map<QString, std::vector<drumpad_presets::SequencePad>> parseSequencePadVectorMap(const QJsonValue &jsonValue)
|
||||||
{
|
{
|
||||||
if (!jsonValue.isObject())
|
if (!jsonValue.isObject())
|
||||||
throw std::runtime_error{"json value for SequencePad vector map is not an object"};
|
throw std::runtime_error{"json value for SequencePad vector map is not an object"};
|
||||||
|
|
||||||
const auto jsonObj = jsonValue.toObject();
|
const auto jsonObj = jsonValue.toObject();
|
||||||
|
|
||||||
std::map<QString, std::vector<presets::SequencePad>> map;
|
std::map<QString, std::vector<drumpad_presets::SequencePad>> map;
|
||||||
|
|
||||||
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
for (auto iter = std::cbegin(jsonObj); iter != std::cend(jsonObj); iter++)
|
||||||
map[iter.key()] = parseSequencePadVector(iter.value());
|
map[iter.key()] = parseSequencePadVector(iter.value());
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
#include "presets.h"
|
#include "drumpadpresets.h"
|
||||||
|
|
||||||
namespace json_converters
|
namespace json_converters
|
||||||
{
|
{
|
||||||
@ -17,18 +17,18 @@ bool parseBool(const QJsonValue &jsonValue);
|
|||||||
std::vector<int> parseIntVector(const QJsonValue &jsonValue);
|
std::vector<int> parseIntVector(const QJsonValue &jsonValue);
|
||||||
std::vector<int> parseIntVectorIgnoreNulls(const QJsonValue &jsonValue);
|
std::vector<int> parseIntVectorIgnoreNulls(const QJsonValue &jsonValue);
|
||||||
|
|
||||||
presets::PresetsConfig parsePresetsConfig(const QJsonObject &jsonObj);
|
drumpad_presets::PresetsConfig parseDrumPadPresetsConfig(const QJsonObject &jsonObj);
|
||||||
std::vector<presets::Category> parseCategoryVector(const QJsonValue &jsonValue);
|
std::vector<drumpad_presets::Category> parseCategoryVector(const QJsonValue &jsonValue);
|
||||||
std::map<QString, presets::Preset> parsePresetMap(const QJsonValue &jsonValue);
|
std::map<QString, drumpad_presets::Preset> parsePresetMap(const QJsonValue &jsonValue);
|
||||||
presets::Category parseCategory(const QJsonValue &jsonValue);
|
drumpad_presets::Category parseCategory(const QJsonValue &jsonValue);
|
||||||
presets::Filter parseFilter(const QJsonValue &jsonValue);
|
drumpad_presets::Filter parseFilter(const QJsonValue &jsonValue);
|
||||||
presets::Preset parsePreset(const QJsonValue &jsonValue);
|
drumpad_presets::Preset parsePreset(const QJsonValue &jsonValue);
|
||||||
std::array<presets::File, 24> parseFileArray(const QJsonValue &jsonValue);
|
std::array<drumpad_presets::File, 24> parseFileArray(const QJsonValue &jsonValue);
|
||||||
presets::File parseFile(const QJsonValue &jsonValue);
|
drumpad_presets::File parseFile(const QJsonValue &jsonValue);
|
||||||
std::vector<presets::Sequence> parseSequenceVector(const QJsonValue &jsonValue);
|
std::vector<drumpad_presets::Sequence> parseSequenceVector(const QJsonValue &jsonValue);
|
||||||
presets::Sequence parseSequence(const QJsonValue &jsonValue);
|
drumpad_presets::Sequence parseSequence(const QJsonValue &jsonValue);
|
||||||
std::map<QString, std::vector<presets::Sequence>> parseSequenceVectorMap(const QJsonValue &jsonValue);
|
std::map<QString, std::vector<drumpad_presets::Sequence>> parseSequenceVectorMap(const QJsonValue &jsonValue);
|
||||||
presets::SequencePad parseSequencePad(const QJsonValue &jsonValue);
|
drumpad_presets::SequencePad parseSequencePad(const QJsonValue &jsonValue);
|
||||||
std::vector<presets::SequencePad> parseSequencePadVector(const QJsonValue &jsonValue);
|
std::vector<drumpad_presets::SequencePad> parseSequencePadVector(const QJsonValue &jsonValue);
|
||||||
std::map<QString, std::vector<presets::SequencePad>> parseSequencePadVectorMap(const QJsonValue &jsonValue);
|
std::map<QString, std::vector<drumpad_presets::SequencePad>> parseSequencePadVectorMap(const QJsonValue &jsonValue);
|
||||||
}
|
}
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
|
||||||
|
|
||||||
namespace presets { class Preset; }
|
|
||||||
|
|
||||||
class PresetsModel : public QAbstractTableModel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
PresetsModel(QObject *parent = nullptr);
|
|
||||||
PresetsModel(const std::map<QString, presets::Preset> &presets, QObject *parent = nullptr);
|
|
||||||
PresetsModel(std::vector<presets::Preset> &&presets, QObject *parent = nullptr);
|
|
||||||
PresetsModel(const std::vector<presets::Preset> &presets, QObject *parent = nullptr);
|
|
||||||
~PresetsModel() override;
|
|
||||||
|
|
||||||
void setPresets(const std::map<QString, presets::Preset> &presets);
|
|
||||||
void setPresets(std::vector<presets::Preset> &&presets);
|
|
||||||
void setPresets(const std::vector<presets::Preset> &presets);
|
|
||||||
|
|
||||||
const presets::Preset &getPreset(const QModelIndex &index) const;
|
|
||||||
const presets::Preset &getPreset(int row) const;
|
|
||||||
|
|
||||||
QModelIndex findPresetById(const QString &id) const;
|
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent) const override;
|
|
||||||
int columnCount(const QModelIndex &parent) const override;
|
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<presets::Preset> m_presets;
|
|
||||||
};
|
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
|
|
||||||
constexpr double pi = std::acos(-1);
|
constexpr double pi = std::acos(-1);
|
||||||
|
|
||||||
void Synthisizer::writeSamples(frame_t *begin, frame_t *end)
|
void Synthisizer::writeSamples(frame_t *begin, frame_t *end)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "audioformat.h"
|
struct frame_t;
|
||||||
|
|
||||||
class DrumMachineSettings;
|
class DrumMachineSettings;
|
||||||
|
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
|
#include "midicontainers.h"
|
||||||
|
|
||||||
DjWidget::DjWidget(QWidget *parent) :
|
DjWidget::DjWidget(QWidget *parent) :
|
||||||
QWidget{parent},
|
QWidget{parent},
|
||||||
m_ui{std::make_unique<Ui::DjWidget>()}
|
m_ui{std::make_unique<Ui::DjWidget>()}
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "audioformat.h"
|
|
||||||
#include "midicontainers.h"
|
|
||||||
#include "treetotableproxymodel.h"
|
#include "treetotableproxymodel.h"
|
||||||
|
|
||||||
namespace Ui { class DjWidget; }
|
namespace Ui { class DjWidget; }
|
||||||
class DrumMachineSettings;
|
class DrumMachineSettings;
|
||||||
|
struct frame_t;
|
||||||
|
namespace midi { struct MidiMessage; }
|
||||||
|
|
||||||
class DjWidget : public QWidget
|
class DjWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
<height>519</height>
|
<height>519</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1">
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
#include "midicontainers.h"
|
#include "midicontainers.h"
|
||||||
#include "jsonconverters.h"
|
#include "jsonconverters.h"
|
||||||
#include "drummachinesettings.h"
|
#include "drummachinesettings.h"
|
||||||
@ -181,7 +182,7 @@ void DrumPadWidget::requestFinished()
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto result = json_converters::parsePresetsConfig(json_converters::loadJson(reply->readAll()));
|
auto result = json_converters::parseDrumPadPresetsConfig(json_converters::loadJson(reply->readAll()));
|
||||||
|
|
||||||
if (!result.presets)
|
if (!result.presets)
|
||||||
throw std::runtime_error("presets missing in response");
|
throw std::runtime_error("presets missing in response");
|
||||||
|
@ -5,9 +5,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "audioformat.h"
|
#include "drumpadpresetsmodel.h"
|
||||||
#include "presetsmodel.h"
|
#include "drumpadfilesmodel.h"
|
||||||
#include "filesmodel.h"
|
|
||||||
|
|
||||||
namespace Ui { class DrumPadWidget; }
|
namespace Ui { class DrumPadWidget; }
|
||||||
class SamplesWidget;
|
class SamplesWidget;
|
||||||
@ -18,6 +17,7 @@ class QThread;
|
|||||||
class DrumMachineSettings;
|
class DrumMachineSettings;
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
namespace midi { struct MidiMessage; }
|
namespace midi { struct MidiMessage; }
|
||||||
|
struct frame_t;
|
||||||
|
|
||||||
class DrumPadWidget : public QSplitter
|
class DrumPadWidget : public QSplitter
|
||||||
{
|
{
|
||||||
@ -55,10 +55,10 @@ private:
|
|||||||
|
|
||||||
DrumMachineSettings *m_settings{};
|
DrumMachineSettings *m_settings{};
|
||||||
|
|
||||||
PresetsModel m_presetsModel;
|
DrumPadPresetsModel m_presetsModel;
|
||||||
QSortFilterProxyModel m_presetsProxyModel;
|
QSortFilterProxyModel m_presetsProxyModel;
|
||||||
|
|
||||||
FilesModel m_filesModel;
|
DrumPadFilesModel m_filesModel;
|
||||||
|
|
||||||
QNetworkAccessManager *m_networkAccessManager{};
|
QNetworkAccessManager *m_networkAccessManager{};
|
||||||
|
|
||||||
|
48
widgets/loopstationwidget.cpp
Normal file
48
widgets/loopstationwidget.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include "loopstationwidget.h"
|
||||||
|
#include "ui_loopstationwidget.h"
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
|
|
||||||
|
LoopStationWidget::LoopStationWidget(QWidget *parent) :
|
||||||
|
QWidget{parent},
|
||||||
|
m_ui{std::make_unique<Ui::LoopStationWidget>()}
|
||||||
|
{
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
LoopStationWidget::~LoopStationWidget() = default;
|
||||||
|
|
||||||
|
void LoopStationWidget::writeSamples(frame_t *begin, frame_t *end)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoopStationWidget::injectNetworkAccessManager(QNetworkAccessManager &networkAccessManager)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoopStationWidget::injectDecodingThread(QThread &thread)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoopStationWidget::loadSettings(DrumMachineSettings &settings)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoopStationWidget::unsendColors()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoopStationWidget::sendColors()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoopStationWidget::midiReceived(const midi::MidiMessage &message)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
36
widgets/loopstationwidget.h
Normal file
36
widgets/loopstationwidget.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace Ui { class LoopStationWidget; }
|
||||||
|
namespace midi { struct MidiMessage; }
|
||||||
|
class QNetworkAccessManager;
|
||||||
|
class DrumMachineSettings;
|
||||||
|
struct frame_t;
|
||||||
|
|
||||||
|
class LoopStationWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit LoopStationWidget(QWidget *parent = nullptr);
|
||||||
|
~LoopStationWidget() override;
|
||||||
|
|
||||||
|
void writeSamples(frame_t *begin, frame_t *end);
|
||||||
|
void injectNetworkAccessManager(QNetworkAccessManager &networkAccessManager);
|
||||||
|
void injectDecodingThread(QThread &thread);
|
||||||
|
void loadSettings(DrumMachineSettings &settings);
|
||||||
|
void unsendColors();
|
||||||
|
void sendColors();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sendMidi(const midi::MidiMessage &midiMsg);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void midiReceived(const midi::MidiMessage &message);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::unique_ptr<Ui::LoopStationWidget> m_ui;
|
||||||
|
};
|
29
widgets/loopstationwidget.ui
Normal file
29
widgets/loopstationwidget.ui
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>LoopStationWidget</class>
|
||||||
|
<widget class="QWidget" name="LoopStationWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>40</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>261</width>
|
||||||
|
<height>18</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Hier könnte ihre LoopStation stehen.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -9,7 +9,7 @@
|
|||||||
#include <QAudioDeviceInfo>
|
#include <QAudioDeviceInfo>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "midiinwrapper.h"
|
#include "audioformat.h"
|
||||||
#include "midicontainers.h"
|
#include "midicontainers.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -38,6 +38,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
m_networkAccessManager.setCache(&m_cache);
|
m_networkAccessManager.setCache(&m_cache);
|
||||||
|
|
||||||
m_ui->drumPadWidget->injectNetworkAccessManager(m_networkAccessManager);
|
m_ui->drumPadWidget->injectNetworkAccessManager(m_networkAccessManager);
|
||||||
|
m_ui->loopStationWidget->injectNetworkAccessManager(m_networkAccessManager);
|
||||||
|
|
||||||
connect(&m_midiIn, &MidiInWrapper::midiReceived, this, &MainWindow::midiReceived);
|
connect(&m_midiIn, &MidiInWrapper::midiReceived, this, &MainWindow::midiReceived);
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_ui->drumPadWidget->injectDecodingThread(m_decoderThread);
|
m_ui->drumPadWidget->injectDecodingThread(m_decoderThread);
|
||||||
|
m_ui->loopStationWidget->injectDecodingThread(m_decoderThread);
|
||||||
m_ui->djWidget->injectDecodingThread(m_decoderThread);
|
m_ui->djWidget->injectDecodingThread(m_decoderThread);
|
||||||
|
|
||||||
updateAudioDevices();
|
updateAudioDevices();
|
||||||
@ -89,6 +91,7 @@ paDefault:
|
|||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
connect(m_ui->drumPadWidget, &DrumPadWidget::sendMidi, this, &MainWindow::sendMidi);
|
connect(m_ui->drumPadWidget, &DrumPadWidget::sendMidi, this, &MainWindow::sendMidi);
|
||||||
|
connect(m_ui->loopStationWidget, &LoopStationWidget::sendMidi, this, &MainWindow::sendMidi);
|
||||||
connect(m_ui->djWidget, &DjWidget::sendMidi, this, &MainWindow::sendMidi);
|
connect(m_ui->djWidget, &DjWidget::sendMidi, this, &MainWindow::sendMidi);
|
||||||
connect(m_ui->synthisizerWidget, &SynthisizerWidget::sendMidi, this, &MainWindow::sendMidi);
|
connect(m_ui->synthisizerWidget, &SynthisizerWidget::sendMidi, this, &MainWindow::sendMidi);
|
||||||
|
|
||||||
@ -109,6 +112,7 @@ int MainWindow::writeSamples(frame_t *begin, frame_t *end)
|
|||||||
std::fill(begin, end, frame_t{0.,0.});
|
std::fill(begin, end, frame_t{0.,0.});
|
||||||
|
|
||||||
m_ui->drumPadWidget->writeSamples(begin, end);
|
m_ui->drumPadWidget->writeSamples(begin, end);
|
||||||
|
m_ui->loopStationWidget->writeSamples(begin, end);
|
||||||
m_ui->djWidget->writeSamples(begin, end);
|
m_ui->djWidget->writeSamples(begin, end);
|
||||||
m_ui->synthisizerWidget->writeSamples(begin, end);
|
m_ui->synthisizerWidget->writeSamples(begin, end);
|
||||||
|
|
||||||
@ -229,8 +233,10 @@ void MainWindow::midiReceived(const midi::MidiMessage &message)
|
|||||||
if (m_ui->tabWidget->currentIndex() == 0)
|
if (m_ui->tabWidget->currentIndex() == 0)
|
||||||
m_ui->drumPadWidget->midiReceived(message);
|
m_ui->drumPadWidget->midiReceived(message);
|
||||||
else if (m_ui->tabWidget->currentIndex() == 1)
|
else if (m_ui->tabWidget->currentIndex() == 1)
|
||||||
m_ui->djWidget->midiReceived(message);
|
m_ui->loopStationWidget->midiReceived(message);
|
||||||
else if (m_ui->tabWidget->currentIndex() == 2)
|
else if (m_ui->tabWidget->currentIndex() == 2)
|
||||||
|
m_ui->djWidget->midiReceived(message);
|
||||||
|
else if (m_ui->tabWidget->currentIndex() == 3)
|
||||||
m_ui->synthisizerWidget->midiReceived(message);
|
m_ui->synthisizerWidget->midiReceived(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,6 +289,7 @@ void MainWindow::updateMidiOutDevices()
|
|||||||
void MainWindow::loadSettings()
|
void MainWindow::loadSettings()
|
||||||
{
|
{
|
||||||
m_ui->drumPadWidget->loadSettings(m_settings);
|
m_ui->drumPadWidget->loadSettings(m_settings);
|
||||||
|
m_ui->loopStationWidget->loadSettings(m_settings);
|
||||||
m_ui->djWidget->loadSettings(m_settings);
|
m_ui->djWidget->loadSettings(m_settings);
|
||||||
m_ui->synthisizerWidget->loadSettings(m_settings);
|
m_ui->synthisizerWidget->loadSettings(m_settings);
|
||||||
}
|
}
|
||||||
@ -292,8 +299,10 @@ void MainWindow::unsendColors(int index)
|
|||||||
if (index == 0)
|
if (index == 0)
|
||||||
m_ui->drumPadWidget->unsendColors();
|
m_ui->drumPadWidget->unsendColors();
|
||||||
else if (index == 1)
|
else if (index == 1)
|
||||||
m_ui->djWidget->unsendColors();
|
m_ui->loopStationWidget->unsendColors();
|
||||||
else if (index == 2)
|
else if (index == 2)
|
||||||
|
m_ui->djWidget->unsendColors();
|
||||||
|
else if (index == 3)
|
||||||
m_ui->synthisizerWidget->unsendColors();
|
m_ui->synthisizerWidget->unsendColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,8 +311,10 @@ void MainWindow::sendColors(int index)
|
|||||||
if (index == 0)
|
if (index == 0)
|
||||||
m_ui->drumPadWidget->sendColors();
|
m_ui->drumPadWidget->sendColors();
|
||||||
else if (index == 1)
|
else if (index == 1)
|
||||||
m_ui->djWidget->sendColors();
|
m_ui->loopStationWidget->sendColors();
|
||||||
else if (index == 2)
|
else if (index == 2)
|
||||||
|
m_ui->djWidget->sendColors();
|
||||||
|
else if (index == 3)
|
||||||
m_ui->synthisizerWidget->sendColors();
|
m_ui->synthisizerWidget->sendColors();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -9,14 +9,13 @@
|
|||||||
|
|
||||||
#include "portaudio.h"
|
#include "portaudio.h"
|
||||||
|
|
||||||
#include "audioformat.h"
|
|
||||||
#include "midiinwrapper.h"
|
#include "midiinwrapper.h"
|
||||||
#include "midioutwrapper.h"
|
#include "midioutwrapper.h"
|
||||||
#include "drummachinesettings.h"
|
#include "drummachinesettings.h"
|
||||||
|
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
namespace presets { struct PresetsConfig; }
|
|
||||||
namespace midi { struct MidiMessage; }
|
namespace midi { struct MidiMessage; }
|
||||||
|
struct frame_t;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
|
@ -210,6 +210,11 @@
|
|||||||
<string>DrumPad</string>
|
<string>DrumPad</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="LoopStationWidget" name="loopStationWidget">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>LoopStation</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
<widget class="DjWidget" name="djWidget">
|
<widget class="DjWidget" name="djWidget">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>DJ</string>
|
<string>DJ</string>
|
||||||
@ -255,6 +260,12 @@
|
|||||||
<header>widgets/synthisizerwidget.h</header>
|
<header>widgets/synthisizerwidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LoopStationWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>widgets/loopstationwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -10,7 +10,7 @@ PresetDetailWidget::PresetDetailWidget(QWidget *parent) :
|
|||||||
|
|
||||||
PresetDetailWidget::~PresetDetailWidget() = default;
|
PresetDetailWidget::~PresetDetailWidget() = default;
|
||||||
|
|
||||||
void PresetDetailWidget::setPreset(const presets::Preset &preset)
|
void PresetDetailWidget::setPreset(const drumpad_presets::Preset &preset)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
|
||||||
namespace Ui { class PresetDetailWidget; }
|
namespace Ui { class PresetDetailWidget; }
|
||||||
namespace presets { class Preset; }
|
namespace drumpad_presets { class Preset; }
|
||||||
|
|
||||||
class PresetDetailWidget : public QScrollArea
|
class PresetDetailWidget : public QScrollArea
|
||||||
{
|
{
|
||||||
@ -15,7 +15,7 @@ public:
|
|||||||
explicit PresetDetailWidget(QWidget *parent = nullptr);
|
explicit PresetDetailWidget(QWidget *parent = nullptr);
|
||||||
~PresetDetailWidget() override;
|
~PresetDetailWidget() override;
|
||||||
|
|
||||||
void setPreset(const presets::Preset &preset);
|
void setPreset(const drumpad_presets::Preset &preset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::unique_ptr<Ui::PresetDetailWidget> m_ui;
|
const std::unique_ptr<Ui::PresetDetailWidget> m_ui;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include "graphrenderer.h"
|
#include "graphrenderer.h"
|
||||||
|
#include "audioformat.h"
|
||||||
|
|
||||||
PreviewWidget::PreviewWidget(QWidget *parent) :
|
PreviewWidget::PreviewWidget(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
#include "midicontainers.h"
|
#include "midicontainers.h"
|
||||||
|
|
||||||
SamplesWidget::SamplesWidget(QWidget *parent) :
|
SamplesWidget::SamplesWidget(QWidget *parent) :
|
||||||
@ -34,7 +35,7 @@ void SamplesWidget::loadSettings(DrumMachineSettings &settings)
|
|||||||
widget.loadSettings(settings);
|
widget.loadSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamplesWidget::setPreset(const presets::Preset &preset)
|
void SamplesWidget::setPreset(const drumpad_presets::Preset &preset)
|
||||||
{
|
{
|
||||||
m_preset = preset;
|
m_preset = preset;
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "audioformat.h"
|
#include "drumpadpresets.h"
|
||||||
#include "presets.h"
|
|
||||||
|
|
||||||
namespace Ui { class SamplesWidget; }
|
namespace Ui { class SamplesWidget; }
|
||||||
namespace midi { struct MidiMessage; }
|
namespace midi { struct MidiMessage; }
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
class SampleWidget;
|
class SampleWidget;
|
||||||
class DrumMachineSettings;
|
class DrumMachineSettings;
|
||||||
|
struct frame_t;
|
||||||
|
|
||||||
class SamplesWidget : public QWidget
|
class SamplesWidget : public QWidget
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ public:
|
|||||||
|
|
||||||
void loadSettings(DrumMachineSettings &settings);
|
void loadSettings(DrumMachineSettings &settings);
|
||||||
|
|
||||||
void setPreset(const presets::Preset &preset);
|
void setPreset(const drumpad_presets::Preset &preset);
|
||||||
|
|
||||||
void midiReceived(const midi::MidiMessage &message);
|
void midiReceived(const midi::MidiMessage &message);
|
||||||
|
|
||||||
@ -53,5 +53,5 @@ private:
|
|||||||
|
|
||||||
const std::unique_ptr<Ui::SamplesWidget> m_ui;
|
const std::unique_ptr<Ui::SamplesWidget> m_ui;
|
||||||
|
|
||||||
presets::Preset m_preset;
|
drumpad_presets::Preset m_preset;
|
||||||
};
|
};
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
<height>421</height>
|
<height>421</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0" columnstretch="0,0,0,0,0,0,0,0,0">
|
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0" columnstretch="0,0,0,0,0,0,0,0,0">
|
||||||
<item row="3" column="3">
|
<item row="3" column="3">
|
||||||
<widget class="SampleWidget" name="sampleWidget_9" native="true"/>
|
<widget class="SampleWidget" name="sampleWidget_9" native="true"/>
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
#include "audiodecoder.h"
|
#include "audiodecoder.h"
|
||||||
#include "drummachinesettings.h"
|
#include "drummachinesettings.h"
|
||||||
#include "midicontainers.h"
|
#include "midicontainers.h"
|
||||||
@ -46,7 +47,7 @@ void SampleWidget::loadSettings(DrumMachineSettings &settings)
|
|||||||
m_settings = &settings;
|
m_settings = &settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SampleWidget::setFile(const QString &presetId, const presets::File &file)
|
void SampleWidget::setFile(const QString &presetId, const drumpad_presets::File &file)
|
||||||
{
|
{
|
||||||
m_presetId = presetId;
|
m_presetId = presetId;
|
||||||
m_file = file;
|
m_file = file;
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
#include "audioformat.h"
|
#include "drumpadpresets.h"
|
||||||
#include "presets.h"
|
|
||||||
#include "audioplayer.h"
|
#include "audioplayer.h"
|
||||||
|
|
||||||
namespace Ui { class SampleWidget; }
|
namespace Ui { class SampleWidget; }
|
||||||
@ -15,6 +14,7 @@ class QAudioBuffer;
|
|||||||
class AudioDecoder;
|
class AudioDecoder;
|
||||||
class DrumMachineSettings;
|
class DrumMachineSettings;
|
||||||
namespace midi { struct MidiMessage; }
|
namespace midi { struct MidiMessage; }
|
||||||
|
struct frame_t;
|
||||||
|
|
||||||
class SampleWidget : public QFrame
|
class SampleWidget : public QFrame
|
||||||
{
|
{
|
||||||
@ -29,7 +29,7 @@ public:
|
|||||||
|
|
||||||
void loadSettings(DrumMachineSettings &settings);
|
void loadSettings(DrumMachineSettings &settings);
|
||||||
|
|
||||||
void setFile(const QString &presetId, const presets::File &file);
|
void setFile(const QString &presetId, const drumpad_presets::File &file);
|
||||||
|
|
||||||
quint8 channel() const;
|
quint8 channel() const;
|
||||||
void setChannel(quint8 channel);
|
void setChannel(quint8 channel);
|
||||||
@ -86,7 +86,7 @@ private:
|
|||||||
AudioPlayer m_player;
|
AudioPlayer m_player;
|
||||||
|
|
||||||
QString m_presetId;
|
QString m_presetId;
|
||||||
std::optional<presets::File> m_file;
|
std::optional<drumpad_presets::File> m_file;
|
||||||
|
|
||||||
QNetworkAccessManager *m_networkAccessManager{};
|
QNetworkAccessManager *m_networkAccessManager{};
|
||||||
|
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
<height>157</height>
|
<height>157</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
#include "graphrenderer.h"
|
#include "graphrenderer.h"
|
||||||
|
|
||||||
ScratchWidget::ScratchWidget(QWidget *parent) :
|
ScratchWidget::ScratchWidget(QWidget *parent) :
|
||||||
QWidget{parent}
|
QWidget{parent},
|
||||||
|
m_framesPerBeat{frameRate/4}
|
||||||
{
|
{
|
||||||
connect(&m_timer, &QTimer::timeout, this, &ScratchWidget::timeout);
|
connect(&m_timer, &QTimer::timeout, this, &ScratchWidget::timeout);
|
||||||
m_timer.setSingleShot(true);
|
m_timer.setSingleShot(true);
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "audioformat.h"
|
|
||||||
|
|
||||||
class ScratchWidget : public QWidget
|
class ScratchWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -49,7 +47,7 @@ private:
|
|||||||
QCache<int, QPixmap> m_graphCache;
|
QCache<int, QPixmap> m_graphCache;
|
||||||
|
|
||||||
int m_beatWidth{100};
|
int m_beatWidth{100};
|
||||||
int m_framesPerBeat{frameRate/4};
|
int m_framesPerBeat;
|
||||||
|
|
||||||
bool m_scratching{};
|
bool m_scratching{};
|
||||||
bool m_dragging{};
|
bool m_dragging{};
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "presets.h"
|
#include "drumpadpresets.h"
|
||||||
#include "drummachinesettings.h"
|
#include "drummachinesettings.h"
|
||||||
#include "midicontainers.h"
|
#include "midicontainers.h"
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ void SequencerWidget::sendColors()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequencerWidget::setPreset(const presets::Preset &preset)
|
void SequencerWidget::setPreset(const drumpad_presets::Preset &preset)
|
||||||
{
|
{
|
||||||
if (preset.tempo)
|
if (preset.tempo)
|
||||||
m_ui->spinBoxTempo->setValue(*preset.tempo);
|
m_ui->spinBoxTempo->setValue(*preset.tempo);
|
||||||
@ -138,7 +138,7 @@ void SequencerWidget::setPreset(const presets::Preset &preset)
|
|||||||
m_sequences.clear();
|
m_sequences.clear();
|
||||||
m_selectedSequence = nullptr;
|
m_selectedSequence = nullptr;
|
||||||
|
|
||||||
const auto doit = [&](const QString &prefix, const std::optional<std::map<QString, std::vector<presets::Sequence>>> &value)
|
const auto doit = [&](const QString &prefix, const std::optional<std::map<QString, std::vector<drumpad_presets::Sequence>>> &value)
|
||||||
{
|
{
|
||||||
if (!value)
|
if (!value)
|
||||||
return;
|
return;
|
||||||
@ -223,7 +223,7 @@ void SequencerWidget::timeout()
|
|||||||
{
|
{
|
||||||
for (const auto &pair : *m_selectedSequence->pads)
|
for (const auto &pair : *m_selectedSequence->pads)
|
||||||
{
|
{
|
||||||
const auto iter = std::find_if(std::cbegin(pair.second), std::cend(pair.second), [&](const presets::SequencePad &sequencePad){
|
const auto iter = std::find_if(std::cbegin(pair.second), std::cend(pair.second), [&](const drumpad_presets::SequencePad &sequencePad){
|
||||||
return sequencePad.start && *sequencePad.start == m_pos;
|
return sequencePad.start && *sequencePad.start == m_pos;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
namespace Ui { class SequencerWidget; }
|
namespace Ui { class SequencerWidget; }
|
||||||
namespace presets { class Preset; class Sequence; }
|
namespace drumpad_presets { class Preset; class Sequence; }
|
||||||
class DrumMachineSettings;
|
class DrumMachineSettings;
|
||||||
namespace midi { struct MidiMessage; }
|
namespace midi { struct MidiMessage; }
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ public:
|
|||||||
void unsendColors();
|
void unsendColors();
|
||||||
void sendColors();
|
void sendColors();
|
||||||
|
|
||||||
void setPreset(const presets::Preset &preset);
|
void setPreset(const drumpad_presets::Preset &preset);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendMidi(const midi::MidiMessage &midiMsg);
|
void sendMidi(const midi::MidiMessage &midiMsg);
|
||||||
@ -50,8 +50,8 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
const std::unique_ptr<Ui::SequencerWidget> m_ui;
|
const std::unique_ptr<Ui::SequencerWidget> m_ui;
|
||||||
|
|
||||||
std::vector<presets::Sequence> m_sequences;
|
std::vector<drumpad_presets::Sequence> m_sequences;
|
||||||
const presets::Sequence *m_selectedSequence{};
|
const drumpad_presets::Sequence *m_selectedSequence{};
|
||||||
|
|
||||||
QTimer m_timer;
|
QTimer m_timer;
|
||||||
|
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
<height>611</height>
|
<height>611</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,1">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,1">
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
#include "midicontainers.h"
|
#include "midicontainers.h"
|
||||||
|
|
||||||
SynthisizerWidget::SynthisizerWidget(QWidget *parent) :
|
SynthisizerWidget::SynthisizerWidget(QWidget *parent) :
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "synthisizer.h"
|
#include "synthisizer.h"
|
||||||
#include "audioformat.h"
|
|
||||||
|
|
||||||
namespace Ui { class SynthisizerWidget; }
|
namespace Ui { class SynthisizerWidget; }
|
||||||
class DrumMachineSettings;
|
class DrumMachineSettings;
|
||||||
namespace midi { struct MidiMessage; }
|
namespace midi { struct MidiMessage; }
|
||||||
|
struct frame_t;
|
||||||
|
|
||||||
class SynthisizerWidget : public QWidget
|
class SynthisizerWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
|
|
||||||
|
#include "audioformat.h"
|
||||||
#include "audiodecoder.h"
|
#include "audiodecoder.h"
|
||||||
|
|
||||||
TrackDeck::TrackDeck(QWidget *parent) :
|
TrackDeck::TrackDeck(QWidget *parent) :
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "audioformat.h"
|
|
||||||
#include "audioplayer.h"
|
#include "audioplayer.h"
|
||||||
|
|
||||||
namespace Ui { class TrackDeck; }
|
namespace Ui { class TrackDeck; }
|
||||||
class AudioDecoder;
|
class AudioDecoder;
|
||||||
class QAudioBuffer;
|
class QAudioBuffer;
|
||||||
|
struct frame_t;
|
||||||
|
|
||||||
class TrackDeck : public QWidget
|
class TrackDeck : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
<property name="acceptDrops">
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0">
|
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0">
|
||||||
|
Reference in New Issue
Block a user