Skip to content

Commit

Permalink
Merge pull request #24 from LMMS/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
ryuukumar authored Aug 10, 2020
2 parents 9293a15 + ef961e5 commit 6a5e4a0
Show file tree
Hide file tree
Showing 24 changed files with 1,151 additions and 773 deletions.
13 changes: 12 additions & 1 deletion data/themes/classic/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ QMenu::indicator:selected {
background-color: #747474;
}

positionLine {
PositionLine {
qproperty-tailGradient: false;
qproperty-lineColor: rgb(255, 255, 255);
}
Expand All @@ -138,6 +138,17 @@ PianoRoll {
qproperty-ghostNoteBorders: true;
qproperty-barColor: #4afd85;
qproperty-markedSemitoneColor: rgba( 0, 255, 200, 60 );
/* Piano keys */
qproperty-whiteKeyWidth: 64;
qproperty-whiteKeyActiveTextColor: #000;
qproperty-whiteKeyActiveTextShadow: rgb( 240, 240, 240 );
qproperty-whiteKeyActiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #43e97b, stop:1 #3bcd6c);
qproperty-whiteKeyInactiveTextColor: rgb( 128, 128, 128);
qproperty-whiteKeyInactiveTextShadow: rgb( 240, 240, 240 );
qproperty-whiteKeyInactiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #eeeeee, stop:1 #ffffff);
qproperty-blackKeyWidth: 48;
qproperty-blackKeyActiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #43e97b, stop:1 #3bcd6c);
qproperty-blackKeyInactiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #333, stop:1 #000);
/* Grid colors */
qproperty-lineColor: rgba( 128, 128, 128, 80 );
qproperty-beatLineColor: rgba( 128, 128, 128, 160 );
Expand Down
13 changes: 12 additions & 1 deletion data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ QMenu::indicator:selected {
background-color: #101213;
}

positionLine {
PositionLine {
qproperty-tailGradient: true;
qproperty-lineColor: rgb(255, 255, 255);
}
Expand All @@ -170,6 +170,17 @@ PianoRoll {
qproperty-ghostNoteBorders: false;
qproperty-barColor: #078f3a;
qproperty-markedSemitoneColor: rgba(255, 255, 255, 30);
/* Piano keys */
qproperty-whiteKeyWidth: 64;
qproperty-whiteKeyActiveTextColor: #000;
qproperty-whiteKeyActiveTextShadow: #fff;
qproperty-whiteKeyActiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #43e97b, stop:1 #3bcd6c);
qproperty-whiteKeyInactiveTextColor: #000;
qproperty-whiteKeyInactiveTextShadow: #fff;
qproperty-whiteKeyInactiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #eeeeee, stop:1 #ffffff);
qproperty-blackKeyWidth: 48;
qproperty-blackKeyActiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #43e97b, stop:1 #3bcd6c);
qproperty-blackKeyInactiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #333, stop:1 #000);
/* Grid colors */
qproperty-lineColor: #292929;
qproperty-beatLineColor: #2d6b45;
Expand Down
81 changes: 81 additions & 0 deletions include/Lv2Features.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Lv2Features.h - Lv2Features class
*
* Copyright (c) 2020-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* 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 LV2FEATURES_H
#define LV2FEATURES_H

#include "lmmsconfig.h"

#ifdef LMMS_HAVE_LV2

#include <lv2.h>
#include <map>
#include <vector>
#include "Lv2Manager.h"

/**
Feature container
References all available features for a plugin and maps them to their URIs.
The public member functions should be called in descending order:
1. initCommon: map plugin-common features
2. operator[]: map plugin-specific features
3. createFeatureVectors: create the feature vectors required for
lilv_plugin_instantiate
4. access the latter
*/
class Lv2Features
{
public:
//! Return if a feature is supported by LMMS
static bool isFeatureSupported(const char *featName);

Lv2Features();

//! Register only plugin-common features
void initCommon();
//! Return reference to feature data with given URI featName
void*& operator[](const char* featName);
//! Fill m_features and m_featurePointers with all features
void createFeatureVectors();
//! Return LV2_Feature pointer vector, suited for lilv_plugin_instantiate
const LV2_Feature* const* featurePointers() const
{
return m_featurePointers.data();
}

private:
//! feature storage
std::vector<LV2_Feature> m_features;
//! pointers to m_features, required for lilv_plugin_instantiate
std::vector<const LV2_Feature*> m_featurePointers;
//! features + data, ordered by URI
std::map<const char*, void*, Lv2Manager::CmpStr> m_featureByUri;
};

#endif // LMMS_HAVE_LV2

#endif // LV2FEATURES_H
23 changes: 23 additions & 0 deletions include/Lv2Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
#ifdef LMMS_HAVE_LV2

#include <map>
#include <set>
#include <lilv/lilv.h>

#include "Lv2Basics.h"
#include "Lv2UridMap.h"
#include "Plugin.h"


Expand Down Expand Up @@ -114,10 +116,31 @@ class Lv2Manager
Iterator begin() { return m_lv2InfoMap.begin(); }
Iterator end() { return m_lv2InfoMap.end(); }

//! strcmp based key comparator for std::set and std::map
struct CmpStr
{
bool operator()(char const *a, char const *b) const;
};

UridMap& uridMap() { return m_uridMap; }
//! Return all
const std::set<const char*, CmpStr>& supportedFeatureURIs() const
{
return m_supportedFeatureURIs;
}
bool isFeatureSupported(const char* featName) const;

private:
// general data
bool m_debug; //!< if set, debug output will be printed
LilvWorld* m_world;
Lv2InfoMap m_lv2InfoMap;
std::set<const char*, CmpStr> m_supportedFeatureURIs;

// feature data that are common for all Lv2Proc
UridMap m_uridMap;

// functions
bool isSubclassOf(const LilvPluginClass *clvss, const char *uriStr);
};

Expand Down
4 changes: 4 additions & 0 deletions include/Lv2Proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <QObject>

#include "Lv2Basics.h"
#include "Lv2Features.h"
#include "LinkedModelGroups.h"
#include "Plugin.h"
#include "PluginIssue.h"
Expand Down Expand Up @@ -156,13 +157,16 @@ class Lv2Proc : public LinkedModelGroup

const LilvPlugin* m_plugin;
LilvInstance* m_instance;
Lv2Features m_features;

std::vector<std::unique_ptr<Lv2Ports::PortBase>> m_ports;
StereoPortRef m_inPorts, m_outPorts;

//! models for the controls, sorted by port symbols
std::map<std::string, AutomatableModel *> m_connectedModels;

void initPluginSpecificFeatures();

//! load a file in the plugin, but don't do anything in LMMS
void loadFileInternal(const QString &file);
//! allocate m_ports, fill all with metadata, and assign meaning of ports
Expand Down
69 changes: 69 additions & 0 deletions include/Lv2UridMap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Lv2UridMap.cpp - Lv2UridMap class
*
* Copyright (c) 2019 Johannes Lorenz <j.git$$$lorenz-ho.me, $$$=@>
*
* 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 LV2URIDMAP_H
#define LV2URIDMAP_H

#include "lmmsconfig.h"

#ifdef LMMS_HAVE_LV2

#include <lv2/lv2plug.in/ns/ext/urid/urid.h>
#include <mutex> // TODO: use semaphore, even though this is not realtime critical
#include <unordered_map>
#include <vector>

/**
* Complete implementation of the Lv2 Urid Map extension
*/
class UridMap
{
std::unordered_map<std::string, LV2_URID> m_map;
std::vector<const char*> m_unMap;

//! mutex for both m_map and m_unMap
//! the URID map is global, which is why a mutex is required here
std::mutex m_MapMutex;

LV2_URID_Map m_mapFeature;
LV2_URID_Unmap m_unmapFeature;

LV2_URID m_lastUrid = 0;

public:
//! constructor; will set up the features
UridMap();

//! map feature function
LV2_URID map(const char* uri);
//! unmap feature function
const char* unmap(LV2_URID urid);

// access the features
LV2_URID_Map* mapFeature() { return &m_mapFeature; }
LV2_URID_Unmap* unmapFeature() { return &m_unmapFeature; }
};

#endif // LMMS_HAVE_LV2
#endif // LV2URIDMAP_H
Loading

0 comments on commit 6a5e4a0

Please sign in to comment.