id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
20,257
|
ControllerView.h
|
LMMS_lmms/include/ControllerView.h
|
/*
* ControllerView.h - view-component for an control
*
* Copyright (c) 2008 Paul Giblock <drfaygo/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 LMMS_GUI_CONTROLLER_VIEW_H
#define LMMS_GUI_CONTROLLER_VIEW_H
#include <QFrame>
#include "AutomatableModel.h"
#include "Controller.h"
#include "ModelView.h"
class QGroupBox;
class QLabel;
class QPushButton;
class QMdiSubWindow;
namespace lmms::gui
{
class LedCheckBox;
class ControllerView : public QFrame, public ModelView
{
Q_OBJECT
public:
ControllerView( Controller * _controller, QWidget * _parent );
~ControllerView() override;
inline Controller * getController()
{
return( castModel<Controller>() );
}
inline const Controller * getController() const
{
return( castModel<Controller>() );
}
public slots:
void editControls();
void removeController();
void closeControls();
void renameController();
void moveUp();
void moveDown();
signals:
void movedUp(ControllerView* view);
void movedDown(ControllerView* view);
void removedController(ControllerView* view);
protected:
void contextMenuEvent( QContextMenuEvent * _me ) override;
void modelChanged() override;
void mouseDoubleClickEvent( QMouseEvent * event ) override;
private:
QMdiSubWindow * m_subWindow;
ControllerDialog * m_controllerDlg;
QLabel * m_nameLabel;
bool m_show;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_CONTROLLER_VIEW_H
| 2,168
|
C++
|
.h
| 73
| 27.69863
| 70
| 0.771828
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,258
|
LocaleHelper.h
|
LMMS_lmms/include/LocaleHelper.h
|
/*
* LocaleHelper.h - compatibility functions for handling decimal separators
* Providing helper functions which handle both periods and commas
* for decimal separators to load old projects correctly
*
* Copyright (c) 2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2018 Hyunjin Song <tteu.ingog/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 LMMS_LOCALEHELPER_H
#define LMMS_LOCALEHELPER_H
#include <QLocale>
#include <limits>
#include <cmath>
namespace lmms::LocaleHelper
{
inline double toDouble(QString str, bool* ok = nullptr)
{
bool isOkay;
QLocale c(QLocale::C);
c.setNumberOptions(QLocale::RejectGroupSeparator);
double value = c.toDouble(str, &isOkay);
if (!isOkay)
{
QLocale german(QLocale::German);
german.setNumberOptions(QLocale::RejectGroupSeparator);
value = german.toDouble(str, &isOkay);
}
if (ok != nullptr) {*ok = isOkay;}
return value;
}
inline float toFloat(QString str, bool* ok = nullptr)
{
double d = toDouble(str, ok);
if (!std::isinf(d) && std::fabs(d) > std::numeric_limits<float>::max())
{
if (ok != nullptr) {*ok = false;}
return 0.0f;
}
return static_cast<float>(d);
}
} // namespace lmms::LocaleHelper
#endif // LMMS_LOCALEHELPER_H
| 1,995
|
C++
|
.h
| 60
| 31.283333
| 75
| 0.748183
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,259
|
RemotePlugin.h
|
LMMS_lmms/include/RemotePlugin.h
|
/*
* RemotePlugin.h - base class providing RPC like mechanisms
*
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/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 LMMS_REMOTE_PLUGIN_H
#define LMMS_REMOTE_PLUGIN_H
#include "RemotePluginBase.h"
#include "SharedMemory.h"
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
#include <QRecursiveMutex>
#endif
namespace lmms
{
class RemotePlugin;
class SampleFrame;
class ProcessWatcher : public QThread
{
Q_OBJECT
public:
ProcessWatcher( RemotePlugin * );
~ProcessWatcher() override = default;
void stop()
{
m_quit = true;
quit();
}
void reset()
{
m_quit = false;
}
private:
void run() override;
RemotePlugin * m_plugin;
volatile bool m_quit;
} ;
class LMMS_EXPORT RemotePlugin : public QObject, public RemotePluginBase
{
Q_OBJECT
public:
RemotePlugin();
~RemotePlugin() override;
inline bool isRunning()
{
#ifdef DEBUG_REMOTE_PLUGIN
return true;
#else
return m_process.state() != QProcess::NotRunning;
#endif // DEBUG_REMOTE_PLUGIN
}
bool init( const QString &pluginExecutable, bool waitForInitDoneMsg, QStringList extraArgs = {} );
inline void waitForHostInfoGotten()
{
m_failed = waitForMessage( IdHostInfoGotten ).id
!= IdHostInfoGotten;
}
inline void waitForInitDone( bool _busyWaiting = true )
{
m_failed = waitForMessage( IdInitDone, _busyWaiting ).id != IdInitDone;
}
bool processMessage( const message & _m ) override;
bool process( const SampleFrame* _in_buf, SampleFrame* _out_buf );
void processMidiEvent( const MidiEvent&, const f_cnt_t _offset );
void updateSampleRate( sample_rate_t _sr )
{
lock();
sendMessage( message( IdSampleRateInformation ).addInt( _sr ) );
waitForMessage( IdInformationUpdated, true );
unlock();
}
virtual void toggleUI()
{
lock();
sendMessage( IdToggleUI );
unlock();
}
int isUIVisible()
{
lock();
sendMessage( IdIsUIVisible );
unlock();
message m = waitForMessage( IdIsUIVisible );
return m.id != IdIsUIVisible ? -1 : m.getInt() ? 1 : 0;
}
inline bool failed() const
{
return m_failed;
}
inline void lock()
{
m_commMutex.lock();
}
inline void unlock()
{
m_commMutex.unlock();
}
public slots:
virtual void showUI();
virtual void hideUI();
protected:
inline void setSplittedChannels( bool _on )
{
m_splitChannels = _on;
}
bool m_failed;
private:
void resizeSharedProcessingMemory();
QProcess m_process;
ProcessWatcher m_watcher;
QString m_exec;
QStringList m_args;
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QRecursiveMutex m_commMutex;
#else
QMutex m_commMutex;
#endif
bool m_splitChannels;
SharedMemory<float[]> m_audioBuffer;
std::size_t m_audioBufferSize;
int m_inputCount;
int m_outputCount;
#ifndef SYNC_WITH_SHM_FIFO
int m_server;
QString m_socketFile;
#endif // not SYNC_WITH_SHM_FIFO
friend class ProcessWatcher;
private slots:
void processFinished( int exitCode, QProcess::ExitStatus exitStatus );
void processErrored(QProcess::ProcessError err );
} ;
inline std::string QSTR_TO_STDSTR(QString const& qstr)
{
return qstr.toStdString();
}
} // namespace lmms
#endif // LMMS_REMOTE_PLUGIN_H
| 3,932
|
C++
|
.h
| 154
| 23.292208
| 99
| 0.749799
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,260
|
TabBar.h
|
LMMS_lmms/include/TabBar.h
|
/*
* TabBar.h - class tabBar
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/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 LMMS_GUI_TAB_BAR_H
#define LMMS_GUI_TAB_BAR_H
#include <QBoxLayout>
#include <QMap>
#include <QWidget>
#include "lmms_export.h"
namespace lmms::gui
{
class TabButton;
class LMMS_EXPORT TabBar : public QWidget
{
Q_OBJECT
public:
TabBar( QWidget * _parent,
QBoxLayout::Direction _dir = QBoxLayout::LeftToRight );
~TabBar() override = default;
TabButton * addTab( QWidget * _w, const QString & _text,
int _id, bool _add_stretch = false,
bool _text_is_tooltip = false,
// TODO Remove fixWidgetToParentSize once it is used
// with false everywhere.
// At the time of writing it is only used in
// LadspaBrowser with default parameters.
bool fixWidgetToParentSize = true );
void removeTab( int _id );
inline void setExclusive( bool _on )
{
m_exclusive = _on;
}
int activeTab();
public slots:
void setActiveTab( int _id );
protected:
bool tabState( int _id );
void setTabState( int _id, bool _checked );
bool allHidden();
protected slots:
void hideAll( int _exception = -1 );
void tabClicked( int _id );
private:
QMap<int, QPair<TabButton *, QWidget *> > m_tabs;
QBoxLayout * m_layout;
bool m_exclusive;
signals:
void allWidgetsHidden();
void widgetShown();
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_TAB_BAR_H
| 2,223
|
C++
|
.h
| 72
| 28.375
| 77
| 0.725176
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,261
|
PatternClipView.h
|
LMMS_lmms/include/PatternClipView.h
|
/*
* PatternClipView.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_PATTERN_CLIP_VIEW_H
#define LMMS_GUI_PATTERN_CLIP_VIEW_H
#include <QStaticText>
#include "ClipView.h"
namespace lmms
{
class PatternClip;
namespace gui
{
class PatternClipView : public ClipView
{
Q_OBJECT
public:
PatternClipView(Clip* clip, TrackView* tv);
~PatternClipView() override = default;
public slots:
void update() override;
protected slots:
void openInPatternEditor();
void resetName();
void changeName();
protected:
void paintEvent( QPaintEvent * pe ) override;
void mouseDoubleClickEvent( QMouseEvent * _me ) override;
void constructContextMenu( QMenu * ) override;
private:
PatternClip* m_patternClip;
QPixmap m_paintPixmap;
QStaticText m_staticTextName;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_PATTERN_CLIP_VIEW_H
| 1,699
|
C++
|
.h
| 56
| 28.357143
| 77
| 0.771411
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,262
|
Lv2Basics.h
|
LMMS_lmms/include/Lv2Basics.h
|
/*
* Lv2Basics.h - basic Lv2 utils
*
* Copyright (c) 2018-2024 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 LMMS_LV2BASICS_H
#define LMMS_LV2BASICS_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_LV2
#include <lilv/lilv.h>
#include <memory>
#include <QString>
#include <string>
namespace lmms
{
template<class T>
struct LilvPtrDeleter
{
void operator()(T* n) { lilv_free(static_cast<void*>(n)); }
};
struct LilvNodeDeleter
{
void operator()(LilvNode* n) { lilv_node_free(n); }
};
struct LilvNodesDeleter
{
void operator()(LilvNodes* n) { lilv_nodes_free(n); }
};
struct LilvScalePointsDeleter
{
void operator()(LilvScalePoints* s) { lilv_scale_points_free(s); }
};
template<class T>
using AutoLilvPtr = std::unique_ptr<T, LilvPtrDeleter<T>>;
using AutoLilvNode = std::unique_ptr<LilvNode, LilvNodeDeleter>;
using AutoLilvNodes = std::unique_ptr<LilvNodes, LilvNodesDeleter>;
using AutoLilvScalePoints = std::unique_ptr<LilvScalePoints, LilvScalePointsDeleter>;
/**
Return QString from a plugin's node, everything will be freed automatically
@param plug The plugin where the node is
@param getFunc The function to return the node from the plugin
*/
QString qStringFromPluginNode(const LilvPlugin* plug,
LilvNode * (*getFunc)(const LilvPlugin*));
//! Return port name as QString, everything will be freed automatically
QString qStringFromPortName(const LilvPlugin* plug, const LilvPort* port);
//! Return port name as std::string, everything will be freed automatically
std::string stdStringFromPortName(const LilvPlugin* plug, const LilvPort* port);
} // namespace lmms
#endif // LMMS_HAVE_LV2
#endif // LMMS_LV2BASICS_H
| 2,454
|
C++
|
.h
| 69
| 33.884058
| 85
| 0.769101
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,263
|
PathUtil.h
|
LMMS_lmms/include/PathUtil.h
|
/*
* PathUtil.h
*
* Copyright (c) 2019-2022 Spekular <Spekularr@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 LMMS_PATHUTIL_H
#define LMMS_PATHUTIL_H
#include "lmms_export.h"
#include <QDir>
namespace lmms::PathUtil
{
enum class Base { Absolute, ProjectDir, FactorySample, UserSample, UserVST, Preset,
UserLADSPA, DefaultLADSPA, UserSoundfont, DefaultSoundfont, UserGIG, DefaultGIG,
LocalDir };
//! Return the directory associated with a given base as a QString
//! Optionally, if a pointer to boolean is given the method will
//! use it to indicate whether the prefix could be resolved properly
//! or not.
QString LMMS_EXPORT baseLocation(const Base base, bool* error = nullptr);
//! Return the directory associated with a given base as a QDir.
//! Optional pointer to boolean to indicate if the prefix could
//! be resolved properly.
QDir LMMS_EXPORT baseQDir (const Base base, bool* error = nullptr);
//! Return the prefix used to denote this base in path strings
QString LMMS_EXPORT basePrefix(const Base base);
//! Check the prefix of a path and return the base it corresponds to
//! Defaults to Base::Absolute
Base LMMS_EXPORT baseLookup(const QString & path);
//! Remove the prefix from a path, iff there is one
QString LMMS_EXPORT stripPrefix(const QString & path);
//! Get the filename for a path, handling prefixed paths correctly
QString LMMS_EXPORT cleanName(const QString & path);
//! Upgrade prefix-less relative paths to the new format
QString LMMS_EXPORT oldRelativeUpgrade(const QString & input);
//! Make this path absolute. If a pointer to boolean is given
//! it will indicate whether the path was converted successfully
QString LMMS_EXPORT toAbsolute(const QString & input, bool* error = nullptr);
//! Make this path relative to a given base, return an absolute path if that fails
QString LMMS_EXPORT relativeOrAbsolute(const QString & input, const Base base);
//! Make this path relative to any base, choosing the shortest if there are
//! multiple options. allowLocal defines whether local paths should be considered.
//! Defaults to an absolute path if all bases fail.
QString LMMS_EXPORT toShortestRelative(const QString & input, bool allowLocal = false);
} // namespace lmms::PathUtil
#endif // LMMS_PATHUTIL_H
| 3,052
|
C++
|
.h
| 63
| 46.396825
| 88
| 0.767372
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,264
|
LadspaControlView.h
|
LMMS_lmms/include/LadspaControlView.h
|
/*
* LadspaControlView.h - widget for controlling a LADSPA port
*
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/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 LMMS_GUI_LADSPA_CONTROL_VIEW_H
#define LMMS_GUI_LADSPA_CONTROL_VIEW_H
#include <QWidget>
#include "ModelView.h"
namespace lmms
{
class LadspaControl;
namespace gui
{
class LMMS_EXPORT LadspaControlView : public QWidget, public ModelView
{
Q_OBJECT
public:
LadspaControlView( QWidget * _parent, LadspaControl * _ctl );
~LadspaControlView() override = default;
private:
LadspaControl * m_ctl;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_LADSPA_CONTROL_VIEW_H
| 1,510
|
C++
|
.h
| 45
| 31.666667
| 74
| 0.76584
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,265
|
AutomationClipView.h
|
LMMS_lmms/include/AutomationClipView.h
|
/*
* AutomationClipView.h - declaration of class AutomationClipView
*
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/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 LMMS_GUI_AUTOMATION_CLIP_VIEW_H
#define LMMS_GUI_AUTOMATION_CLIP_VIEW_H
#include <QStaticText>
#include "ClipView.h"
namespace lmms
{
class AutomationClip;
namespace gui
{
class AutomationClipView : public ClipView
{
Q_OBJECT
public:
AutomationClipView( AutomationClip * _clip, TrackView * _parent );
~AutomationClipView() override = default;
public slots:
/// Opens this view's clip in the global automation editor
void openInAutomationEditor();
void update() override;
protected slots:
void resetName();
void changeName();
void disconnectObject( QAction * _a );
void toggleRecording();
void flipY();
void flipX();
protected:
void constructContextMenu( QMenu * ) override;
void mouseDoubleClickEvent(QMouseEvent * me ) override;
void paintEvent( QPaintEvent * pe ) override;
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;
private:
AutomationClip * m_clip;
QPixmap m_paintPixmap;
QStaticText m_staticTextName;
void scaleTimemapToFit( float oldMin, float oldMax );
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_AUTOMATION_CLIP_VIEW_H
| 2,098
|
C++
|
.h
| 64
| 30.765625
| 77
| 0.772863
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,266
|
SampleFrame.h
|
LMMS_lmms/include/SampleFrame.h
|
/*
* SampleFrame.h - Representation of a stereo sample
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2024- Michael Gregorius
*
* 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 LMMS_SAMPLEFRAME_H
#define LMMS_SAMPLEFRAME_H
#include "lmms_basics.h"
#include <algorithm>
#include <array>
#include <cmath>
namespace lmms
{
class SampleFrame
{
public:
SampleFrame() : SampleFrame(0., 0.)
{
}
explicit SampleFrame(sample_t value) : SampleFrame(value, value)
{
}
SampleFrame(sample_t left, sample_t right) :
m_samples({ left, right })
{
}
sample_t* data()
{
return m_samples.data();
}
const sample_t* data() const
{
return m_samples.data();
}
sample_t& left()
{
return m_samples[0];
}
const sample_t& left() const
{
return m_samples[0];
}
void setLeft(const sample_t& value)
{
m_samples[0] = value;
}
sample_t& right()
{
return m_samples[1];
}
const sample_t& right() const
{
return m_samples[1];
}
void setRight(const sample_t& value)
{
m_samples[1] = value;
}
sample_t& operator[](size_t index)
{
return m_samples[index];
}
const sample_t& operator[](size_t index) const
{
return m_samples[index];
}
SampleFrame operator+(const SampleFrame& other) const
{
return SampleFrame(left() + other.left(), right() + other.right());
}
SampleFrame& operator+=(const SampleFrame& other)
{
auto & l = left();
auto & r = right();
l += other.left();
r += other.right();
return *this;
}
SampleFrame operator*(float value) const
{
return SampleFrame(left() * value, right() * value);
}
SampleFrame& operator*=(float value)
{
setLeft(left() * value);
setRight(right() * value);
return *this;
}
SampleFrame operator*(const SampleFrame& other) const
{
return SampleFrame(left() * other.left(), right() * other.right());
}
void operator*=(const SampleFrame& other)
{
left() *= other.left();
right() *= other.right();
}
sample_t sumOfSquaredAmplitudes() const
{
return left() * left() + right() * right();
}
SampleFrame abs() const
{
return SampleFrame{std::abs(this->left()), std::abs(this->right())};
}
SampleFrame absMax(const SampleFrame& other)
{
const auto a = abs();
const auto b = other.abs();
return SampleFrame(std::max(a.left(), b.left()), std::max(a.right(), b.right()));
}
sample_t average() const
{
return (left() + right()) / 2;
}
void clamp(sample_t low, sample_t high)
{
auto & l = left();
l = std::clamp(l, low, high);
auto & r = right();
r = std::clamp(r, low, high);
}
bool containsInf() const
{
return std::isinf(left()) || std::isinf(right());
}
bool containsNaN() const
{
return std::isnan(left()) || std::isnan(right());
}
private:
std::array<sample_t, DEFAULT_CHANNELS> m_samples;
};
inline void zeroSampleFrames(SampleFrame* buffer, size_t frames)
{
// The equivalent of the following operation which yields compiler warnings
// memset(buffer, 0, sizeof(SampleFrame) * frames);
std::fill(buffer, buffer + frames, SampleFrame());
}
inline SampleFrame getAbsPeakValues(SampleFrame* buffer, size_t frames)
{
SampleFrame peaks;
for (f_cnt_t i = 0; i < frames; ++i)
{
peaks = peaks.absMax(buffer[i]);
}
return peaks;
}
inline void copyToSampleFrames(SampleFrame* target, const float* source, size_t frames)
{
for (size_t i = 0; i < frames; ++i)
{
target[i].setLeft(source[2*i]);
target[i].setRight(source[2*i + 1]);
}
}
inline void copyFromSampleFrames(float* target, const SampleFrame* source, size_t frames)
{
for (size_t i = 0; i < frames; ++i)
{
target[2*i] = source[i].left();
target[2*i + 1] = source[i].right();
}
}
} // namespace lmms
#endif // LMMS_SAMPLEFRAME_H
| 4,492
|
C++
|
.h
| 185
| 21.962162
| 89
| 0.694203
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,267
|
SetupDialog.h
|
LMMS_lmms/include/SetupDialog.h
|
/*
* SetupDialog.h - dialog for setting up LMMS
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_SETUP_DIALOG_H
#define LMMS_GUI_SETUP_DIALOG_H
#include <QDialog>
#include <QMap>
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"
#include "lmmsconfig.h"
#include "MidiClient.h"
#include "MidiSetupWidget.h"
class QCheckBox;
class QComboBox;
class QLabel;
class QLineEdit;
class QSlider;
namespace lmms::gui
{
class TabBar;
class SetupDialog : public QDialog
{
Q_OBJECT
public:
enum class ConfigTab
{
GeneralSettings,
PerformanceSettings,
AudioSettings,
MidiSettings,
PathsSettings
};
SetupDialog(ConfigTab tab_to_open = ConfigTab::GeneralSettings);
~SetupDialog() override;
protected slots:
void accept() override;
private slots:
// General settings widget.
void toggleDisplaydBFS(bool enabled);
void toggleTooltips(bool enabled);
void toggleDisplayWaveform(bool enabled);
void toggleNoteLabels(bool enabled);
void toggleCompactTrackButtons(bool enabled);
void toggleOneInstrumentTrackWindow(bool enabled);
void toggleSideBarOnRight(bool enabled);
void toggleLetPreviewsFinish(bool enabled);
void toggleSoloLegacyBehavior(bool enabled);
void toggleTrackDeletionWarning(bool enabled);
void toggleMixerChannelDeletionWarning(bool enabled);
void toggleMMPZ(bool enabled);
void toggleDisableBackup(bool enabled);
void toggleOpenLastProject(bool enabled);
void loopMarkerModeChanged();
void setLanguage(int lang);
// Performance settings widget.
void setAutoSaveInterval(int time);
void resetAutoSave();
void toggleAutoSave(bool enabled);
void toggleRunningAutoSave(bool enabled);
void toggleSmoothScroll(bool enabled);
void toggleAnimateAFP(bool enabled);
void vstEmbedMethodChanged();
void toggleVSTAlwaysOnTop(bool en);
void toggleDisableAutoQuit(bool enabled);
// Audio settings widget.
void audioInterfaceChanged(const QString & driver);
void updateBufferSizeWarning(int value);
void setBufferSize(int value);
void resetBufferSize();
// MIDI settings widget.
void midiInterfaceChanged(const QString & driver);
void toggleMidiAutoQuantization(bool enabled);
// Paths settings widget.
void openWorkingDir();
void setWorkingDir(const QString & workingDir);
void openVSTDir();
void setVSTDir(const QString & vstDir);
void openLADSPADir();
void setLADSPADir(const QString & ladspaDir);
void openSF2Dir();
void setSF2Dir(const QString & sf2Dir);
void openSF2File();
void setSF2File(const QString & sf2File);
void openGIGDir();
void setGIGDir(const QString & gigDir);
void openThemeDir();
void setThemeDir(const QString & themeDir);
void openBackgroundPicFile();
void setBackgroundPicFile(const QString & backgroundPicFile);
void showRestartWarning();
private:
TabBar * m_tabBar;
// General settings widgets.
bool m_displaydBFS;
bool m_tooltips;
bool m_displayWaveform;
bool m_printNoteLabels;
bool m_compactTrackButtons;
bool m_oneInstrumentTrackWindow;
bool m_sideBarOnRight;
bool m_letPreviewsFinish;
bool m_soloLegacyBehavior;
bool m_trackDeletionWarning;
bool m_mixerChannelDeletionWarning;
bool m_MMPZ;
bool m_disableBackup;
bool m_openLastProject;
QString m_loopMarkerMode;
QComboBox* m_loopMarkerComboBox;
QString m_lang;
QStringList m_languages;
// Performance settings widgets.
int m_saveInterval;
bool m_enableAutoSave;
bool m_enableRunningAutoSave;
QSlider * m_saveIntervalSlider;
QLabel * m_saveIntervalLbl;
QCheckBox * m_autoSave;
QCheckBox * m_runningAutoSave;
bool m_smoothScroll;
bool m_animateAFP;
QLabel * m_vstEmbedLbl;
QComboBox* m_vstEmbedComboBox;
QString m_vstEmbedMethod;
QCheckBox * m_vstAlwaysOnTopCheckBox;
bool m_vstAlwaysOnTop;
bool m_disableAutoQuit;
using AswMap = QMap<QString, AudioDeviceSetupWidget*>;
using MswMap = QMap<QString, MidiSetupWidget*>;
using trMap = QMap<QString, QString>;
// Audio settings widgets.
QComboBox * m_audioInterfaces;
AswMap m_audioIfaceSetupWidgets;
trMap m_audioIfaceNames;
bool m_NaNHandler;
int m_bufferSize;
QSlider * m_bufferSizeSlider;
QLabel * m_bufferSizeLbl;
QLabel * m_bufferSizeWarnLbl;
// MIDI settings widgets.
QComboBox * m_midiInterfaces;
MswMap m_midiIfaceSetupWidgets;
trMap m_midiIfaceNames;
QComboBox * m_assignableMidiDevices;
bool m_midiAutoQuantize;
// Paths settings widgets.
QString m_workingDir;
QString m_vstDir;
QString m_ladspaDir;
QString m_gigDir;
QString m_sf2Dir;
#ifdef LMMS_HAVE_FLUIDSYNTH
QString m_sf2File;
#endif
QString m_themeDir;
QString m_backgroundPicFile;
QLineEdit * m_workingDirLineEdit;
QLineEdit * m_vstDirLineEdit;
QLineEdit * m_themeDirLineEdit;
QLineEdit * m_ladspaDirLineEdit;
QLineEdit * m_gigDirLineEdit;
QLineEdit * m_sf2DirLineEdit;
#ifdef LMMS_HAVE_FLUIDSYNTH
QLineEdit * m_sf2FileLineEdit;
#endif
QLineEdit * m_backgroundPicFileLineEdit;
QLabel * restartWarningLbl;
};
} // namespace lmms::gui
#endif // LMMS_GUI_SETUP_DIALOG_H
| 5,771
|
C++
|
.h
| 190
| 28.336842
| 77
| 0.805155
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,268
|
MidiEvent.h
|
LMMS_lmms/include/MidiEvent.h
|
/*
* MidiEvent.h - MidiEvent class
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_MIDI_EVENT_H
#define LMMS_MIDI_EVENT_H
#include <cstdlib>
#include "Midi.h"
#include "panning_constants.h"
#include "volume.h"
namespace lmms
{
class MidiEvent
{
public:
enum class Source { Internal, External };
MidiEvent(MidiEventTypes type = MidiActiveSensing,
int8_t channel = 0,
int16_t param1 = 0,
int16_t param2 = 0,
const void* sourcePort = nullptr,
Source source = Source::External) :
m_type( type ),
m_metaEvent( MidiMetaInvalid ),
m_channel( channel ),
m_sysExData( nullptr ),
m_sourcePort(sourcePort),
m_source(source)
{
m_data.m_param[0] = param1;
m_data.m_param[1] = param2;
}
MidiEvent(MidiEventTypes type, const char* sysExData, std::size_t dataLen, Source source = Source::External) :
m_type( type ),
m_metaEvent( MidiMetaInvalid ),
m_channel( 0 ),
m_sysExData( sysExData ),
m_sourcePort(nullptr),
m_source(source)
{
m_data.m_sysExDataLen = dataLen;
}
MidiEvent( const MidiEvent& other ) = default;
MidiEventTypes type() const
{
return m_type;
}
void setType( MidiEventTypes type )
{
m_type = type;
}
void setMetaEvent( MidiMetaEventType metaEvent )
{
m_metaEvent = metaEvent;
}
MidiMetaEventType metaEvent() const
{
return m_metaEvent;
}
int8_t channel() const
{
return m_channel;
}
void setChannel( int8_t channel )
{
m_channel = channel;
}
int16_t param( int i ) const
{
return m_data.m_param[i];
}
void setParam( int i, uint16_t value )
{
m_data.m_param[i] = value;
}
int16_t key() const
{
return param( 0 );
}
void setKey( int16_t key )
{
m_data.m_param[0] = key;
}
uint8_t velocity() const
{
return m_data.m_param[1] & 0x7F;
}
void setVelocity( int16_t velocity )
{
m_data.m_param[1] = velocity;
}
panning_t panning() const
{
return (panning_t) ( PanningLeft +
( (float)( midiPanning() - MidiMinPanning ) ) /
( (float)( MidiMaxPanning - MidiMinPanning ) ) *
( (float)( PanningRight - PanningLeft ) ) );
}
int16_t midiPanning() const
{
return m_data.m_param[1];
}
volume_t volume( int midiBaseVelocity ) const
{
return (volume_t)( velocity() * DefaultVolume / midiBaseVelocity );
}
const void* sourcePort() const
{
return m_sourcePort;
}
uint8_t controllerNumber() const
{
return param( 0 ) & 0x7F;
}
void setControllerNumber( uint8_t num )
{
setParam( 0, num );
}
uint8_t controllerValue() const
{
return param( 1 );
}
void setControllerValue( uint8_t value )
{
setParam( 1, value );
}
uint8_t program() const
{
return param( 0 );
}
uint8_t channelPressure() const
{
return param( 0 );
}
int16_t pitchBend() const
{
return param( 0 );
}
void setPitchBend( uint16_t pitchBend )
{
setParam( 0, pitchBend );
}
auto sysExData() const -> const char* { return m_sysExData; }
Source source() const
{
return m_source;
}
void setSource(Source value)
{
m_source = value;
}
private:
MidiEventTypes m_type; // MIDI event type
MidiMetaEventType m_metaEvent; // Meta event (mostly unused)
int8_t m_channel; // MIDI channel
union
{
int16_t m_param[2]; // first/second parameter (key/velocity)
uint8_t m_bytes[4]; // raw bytes
int32_t m_sysExDataLen; // len of m_sysExData
} m_data;
const char* m_sysExData;
const void* m_sourcePort;
// Stores the source of the MidiEvent: Internal or External (hardware controllers).
Source m_source;
} ;
} // namespace lmms
#endif // LMMS_MIDI_EVENT_H
| 4,373
|
C++
|
.h
| 187
| 20.909091
| 111
| 0.707982
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,269
|
DetuningHelper.h
|
LMMS_lmms/include/DetuningHelper.h
|
/*
* DetuningHelper.h - detuning automation helper
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/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 LMMS_DETUNING_HELPER_H
#define LMMS_DETUNING_HELPER_H
#include "InlineAutomation.h"
namespace lmms
{
class DetuningHelper : public InlineAutomation
{
Q_OBJECT
public:
DetuningHelper() :
InlineAutomation()
{
}
~DetuningHelper() override = default;
float defaultValue() const override
{
return 0;
}
QString displayName() const override
{
return tr( "Note detuning" );
}
inline QString nodeName() const override
{
return "detuning";
}
} ;
} // namespace lmms
#endif // LMMS_DETUNING_HELPER_H
| 1,534
|
C++
|
.h
| 53
| 26.867925
| 77
| 0.758339
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,270
|
versioninfo.h
|
LMMS_lmms/include/versioninfo.h
|
#ifndef LMMS_VERSION_INFO_H
#define LMMS_VERSION_INFO_H
#include "lmms_basics.h"
#if defined(__GNUC__)
constexpr const char* LMMS_BUILDCONF_COMPILER_VERSION = "GCC " __VERSION__;
#elif defined(__clang__)
constexpr const char* LMMS_BUILDCONF_COMPILER_VERSION = "Clang " __clang_version__;
#elif defined(_MSC_VER)
constexpr const char* LMMS_BUILDCONF_COMPILER_VERSION = "MSVC " LMMS_STRINGIFY(_MSC_FULL_VER);
#else
constexpr const char* LMMS_BUILDCONF_COMPILER_VERSION = "unknown compiler";
#endif
#if defined(LMMS_HOST_X86)
constexpr const char* LMMS_BUILDCONF_MACHINE = "i386";
#elif defined(LMMS_HOST_X86_64)
constexpr const char* LMMS_BUILDCONF_MACHINE = "x86_64";
#elif defined(LMMS_HOST_ARM32)
constexpr const char* LMMS_BUILDCONF_MACHINE = "arm32";
#elif defined(LMMS_HOST_ARM64)
constexpr const char* LMMS_BUILDCONF_MACHINE = "arm64";
#elif defined(LMMS_HOST_RISCV32)
constexpr const char* LMMS_BUILDCONF_MACHINE = "riscv32";
#elif defined(LMMS_HOST_RISCV64)
constexpr const char* LMMS_BUILDCONF_MACHINE = "riscv64";
#elif defined(LMMS_HOST_PPC32)
constexpr const char* LMMS_BUILDCONF_MACHINE = "ppc";
#elif defined(LMMS_HOST_PPC64)
constexpr const char* LMMS_BUILDCONF_MACHINE = "ppc64";
#else
constexpr const char* LMMS_BUILDCONF_MACHINE = "unknown processor";
#endif
#if defined(LMMS_BUILD_LINUX)
constexpr const char* LMMS_BUILDCONF_PLATFORM = "Linux";
#elif defined(LMMS_BUILD_APPLE)
constexpr const char* LMMS_BUILDCONF_PLATFORM = "OS X";
#elif defined(LMMS_BUILD_OPENBSD)
constexpr const char* LMMS_BUILDCONF_PLATFORM = "OpenBSD";
#elif defined(LMMS_BUILD_FREEBSD)
constexpr const char* LMMS_BUILDCONF_PLATFORM = "FreeBSD";
#elif defined(LMMS_BUILD_WIN32)
constexpr const char* LMMS_BUILDCONF_PLATFORM = "win32";
#elif defined(LMMS_BUILD_HAIKU)
constexpr const char* LMMS_BUILDCONF_PLATFORM = "Haiku";
#else
constexpr const char* LMMS_BUILDCONF_PLATFORM = "unknown platform";
#endif
#endif // LMMS_VERSION_INFO_H
| 1,931
|
C++
|
.h
| 47
| 39.978723
| 94
| 0.783395
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,271
|
AutomatableModelView.h
|
LMMS_lmms/include/AutomatableModelView.h
|
/*
* AutomatableModelView.h - provides AutomatableModelView base class and
* provides BoolModelView, FloatModelView, IntModelView subclasses.
*
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_AUTOMATABLE_MODEL_VIEW_H
#define LMMS_GUI_AUTOMATABLE_MODEL_VIEW_H
#include "ModelView.h"
#include "AutomatableModel.h"
class QMenu;
class QMouseEvent;
namespace lmms::gui
{
class LMMS_EXPORT AutomatableModelView : public ModelView
{
public:
AutomatableModelView( Model* model, QWidget* _this );
~AutomatableModelView() override = default;
// some basic functions for convenience
AutomatableModel* modelUntyped()
{
return castModel<AutomatableModel>();
}
const AutomatableModel* modelUntyped() const
{
return castModel<AutomatableModel>();
}
void setModel( Model* model, bool isOldModelValid = true ) override;
void unsetModel() override;
template<typename T>
inline T value() const
{
return modelUntyped() ? modelUntyped()->value<T>() : 0;
}
inline void setDescription( const QString& desc )
{
m_description = desc;
}
inline void setUnit( const QString& unit )
{
m_unit = unit;
}
void addDefaultActions( QMenu* menu );
void setConversionFactor( float factor );
float getConversionFactor();
protected:
virtual void mousePressEvent( QMouseEvent* event );
QString m_description;
QString m_unit;
float m_conversionFactor; // Factor to be applied when the m_model->value is displayed
} ;
class AutomatableModelViewSlots : public QObject
{
Q_OBJECT
public:
AutomatableModelViewSlots( AutomatableModelView* amv, QObject* parent );
public slots:
void execConnectionDialog();
void removeConnection();
void editSongGlobalAutomation();
void unlinkAllModels();
void removeSongGlobalAutomation();
private slots:
/// Copy the model's value to the clipboard.
void copyToClipboard();
/// Paste the model's value from the clipboard.
void pasteFromClipboard();
protected:
AutomatableModelView* m_amv;
} ;
template <typename ModelType> class LMMS_EXPORT TypedModelView : public AutomatableModelView
{
public:
TypedModelView( Model* model, QWidget* _this) :
AutomatableModelView( model, _this )
{}
ModelType* model()
{
return castModel<ModelType>();
}
const ModelType* model() const
{
return castModel<ModelType>();
}
};
using FloatModelView = TypedModelView<FloatModel>;
using IntModelView = TypedModelView<IntModel>;
using BoolModelView = TypedModelView<BoolModel>;
} // namespace lmms::gui
#endif // LMMS_GUI_AUTOMATABLE_MODEL_VIEW_H
| 3,349
|
C++
|
.h
| 109
| 28.642202
| 92
| 0.778124
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,272
|
FadeButton.h
|
LMMS_lmms/include/FadeButton.h
|
/*
* FadeButton.h - declaration of class fadeButton
*
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/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 LMMS_GUI_FADE_BUTTON_H
#define LMMS_GUI_FADE_BUTTON_H
#include <QAbstractButton>
#include <QColor>
#include <QElapsedTimer>
namespace lmms::gui
{
class FadeButton : public QAbstractButton
{
Q_OBJECT
public:
FadeButton( const QColor & _normal_color,
const QColor & _activated_color,
const QColor & _hold_color,
QWidget * _parent );
~FadeButton() override = default;
void setActiveColor( const QColor & activated_color );
public slots:
void activate();
void activateOnce();
void noteEnd();
protected:
void paintEvent( QPaintEvent * _pe ) override;
private:
QElapsedTimer m_stateTimer;
QElapsedTimer m_releaseTimer;
// the default color of the widget
QColor m_normalColor;
// the color on note play
QColor m_activatedColor;
// the color after the "play" fade is done but a note is still playing
QColor m_holdColor;
int activeNotes;
QColor fadeToColor(QColor, QColor, QElapsedTimer, float);
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_FADE_BUTTON_H
| 1,928
|
C++
|
.h
| 60
| 30.05
| 77
| 0.763115
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,273
|
ConfigManager.h
|
LMMS_lmms/include/ConfigManager.h
|
/*
* ConfigManager.h - class ConfigManager, a class for managing LMMS-configuration
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/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 LMMS_CONFIG_MANAGER_H
#define LMMS_CONFIG_MANAGER_H
#include "lmmsconfig.h"
#include <QMap>
#include <QPair>
#include <QStringList>
#include <QObject>
#include <vector>
#include "lmms_export.h"
namespace lmms
{
class Engine;
const QString PROJECTS_PATH = "projects/";
const QString TEMPLATE_PATH = "templates/";
const QString PRESETS_PATH = "presets/";
const QString SAMPLES_PATH = "samples/";
const QString GIG_PATH = "samples/gig/";
const QString SF2_PATH = "samples/soundfonts/";
const QString LADSPA_PATH ="plugins/ladspa/";
const QString DEFAULT_THEME_PATH = "themes/default/";
const QString TRACK_ICON_PATH = "track_icons/";
const QString LOCALE_PATH = "locale/";
const QString PORTABLE_MODE_FILE = "/portable_mode.txt";
class LMMS_EXPORT ConfigManager : public QObject
{
Q_OBJECT
using UpgradeMethod = void(ConfigManager::*)();
public:
static inline ConfigManager * inst()
{
if(s_instanceOfMe == nullptr )
{
s_instanceOfMe = new ConfigManager();
}
return s_instanceOfMe;
}
const QString & workingDir() const
{
return m_workingDir;
}
void initPortableWorkingDir();
void initInstalledWorkingDir();
void initDevelopmentWorkingDir();
const QString & dataDir() const
{
return m_dataDir;
}
QString factoryProjectsDir() const
{
return dataDir() + PROJECTS_PATH;
}
QString factoryTemplatesDir() const
{
return factoryProjectsDir() + TEMPLATE_PATH;
}
QString factoryPresetsDir() const
{
return dataDir() + PRESETS_PATH;
}
QString factorySamplesDir() const
{
return dataDir() + SAMPLES_PATH;
}
QString userProjectsDir() const
{
return workingDir() + PROJECTS_PATH;
}
QString userTemplateDir() const
{
return workingDir() + TEMPLATE_PATH;
}
QString userPresetsDir() const
{
return workingDir() + PRESETS_PATH;
}
QString userSamplesDir() const
{
return workingDir() + SAMPLES_PATH;
}
const QString & vstDir() const
{
return m_vstDir;
}
const QString & ladspaDir() const
{
return m_ladspaDir;
}
const QString & sf2Dir() const
{
return m_sf2Dir;
}
#ifdef LMMS_HAVE_FLUIDSYNTH
const QString & sf2File() const
{
return m_sf2File;
}
#endif
#ifdef LMMS_HAVE_STK
const QString & stkDir() const
{
return m_stkDir;
}
#endif
const QString & gigDir() const
{
return m_gigDir;
}
QString userVstDir() const
{
return m_vstDir;
}
QString userLadspaDir() const
{
return workingDir() + LADSPA_PATH;
}
QString userSf2Dir() const
{
return workingDir() + SF2_PATH;
}
QString userGigDir() const
{
return workingDir() + GIG_PATH;
}
QString defaultThemeDir() const
{
return m_dataDir + DEFAULT_THEME_PATH;
}
QString themeDir() const
{
return m_themeDir;
}
const QString & backgroundPicFile() const
{
return m_backgroundPicFile;
}
QString trackIconsDir() const
{
return m_dataDir + TRACK_ICON_PATH;
}
const QString recoveryFile() const
{
return m_workingDir + "recover.mmp";
}
inline const QStringList & recentlyOpenedProjects() const
{
return m_recentlyOpenedProjects;
}
QString localeDir() const
{
return m_dataDir + LOCALE_PATH;
}
const QString & version() const
{
return m_version;
}
// Used when the configversion attribute is not present in a configuration file.
// Returns the appropriate config file version based on the LMMS version.
unsigned int legacyConfigVersion();
QString defaultVersion() const;
static bool enableBlockedPlugins();
static QStringList availableVstEmbedMethods();
QString vstEmbedMethod() const;
// Returns true if the working dir (e.g. ~/lmms) exists on disk.
bool hasWorkingDir() const;
void addRecentlyOpenedProject(const QString & _file);
QString value(const QString& cls, const QString& attribute, const QString& defaultVal = "") const;
void setValue(const QString & cls, const QString & attribute,
const QString & value);
void deleteValue(const QString & cls, const QString & attribute);
void loadConfigFile(const QString & configFile = "");
void saveConfigFile();
void setWorkingDir(const QString & workingDir);
void setVSTDir(const QString & vstDir);
void setLADSPADir(const QString & ladspaDir);
void setSF2Dir(const QString & sf2Dir);
void setSF2File(const QString & sf2File);
void setSTKDir(const QString & stkDir);
void setGIGDir(const QString & gigDir);
void setThemeDir(const QString & themeDir);
void setBackgroundPicFile(const QString & backgroundPicFile);
// Creates the working directory & subdirectories on disk.
void createWorkingDir();
signals:
void valueChanged( QString cls, QString attribute, QString value );
private:
static ConfigManager * s_instanceOfMe;
ConfigManager();
ConfigManager(const ConfigManager & _c);
~ConfigManager() override;
void upgrade_1_1_90();
void upgrade_1_1_91();
void upgrade_1_2_2();
void upgrade();
// List of all upgrade methods
static const std::vector<UpgradeMethod> UPGRADE_METHODS;
QString m_workingDir;
QString m_dataDir;
QString m_vstDir;
QString m_ladspaDir;
QString m_sf2Dir;
#ifdef LMMS_HAVE_FLUIDSYNTH
QString m_sf2File;
#endif
#ifdef LMMS_HAVE_STK
QString m_stkDir;
#endif
QString m_gigDir;
QString m_themeDir;
QString m_backgroundPicFile;
QString m_lmmsRcFile;
QString m_version;
unsigned int m_configVersion;
QStringList m_recentlyOpenedProjects;
using stringPairVector = std::vector<QPair<QString, QString>>;
using settingsMap = QMap<QString, stringPairVector>;
settingsMap m_settings;
friend class Engine;
};
} // namespace lmms
#endif // LMMS_CONFIG_MANAGER_H
| 6,490
|
C++
|
.h
| 243
| 24.415638
| 99
| 0.761658
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,274
|
SongEditor.h
|
LMMS_lmms/include/SongEditor.h
|
/*
* SongEditor.h - declaration of class SongEditor, a window where you can
* setup your songs
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_SONG_EDITOR_H
#define LMMS_GUI_SONG_EDITOR_H
#include "AutomatableModel.h"
#include "Editor.h"
#include "TrackContainerView.h"
class QLabel;
class QScrollBar;
namespace lmms
{
class Song;
class ComboBoxModel;
namespace gui
{
class ActionGroup;
class AutomatableSlider;
class ComboBox;
class LcdSpinBox;
class MeterDialog;
class PositionLine;
class TextFloat;
class TimeLineWidget;
class SongEditor : public TrackContainerView
{
Q_OBJECT
public:
enum class EditMode
{
Draw,
Knife,
Select
};
SongEditor( Song * song );
~SongEditor() override = default;
void saveSettings( QDomDocument& doc, QDomElement& element ) override;
void loadSettings( const QDomElement& element ) override;
ComboBoxModel *snappingModel() const;
float getSnapSize() const;
QString getSnapSizeString() const;
public slots:
void scrolled( int new_pos );
void selectRegionFromPixels(int xStart, int xEnd);
void stopSelectRegion();
void updateRubberband();
void setEditMode( lmms::gui::SongEditor::EditMode mode );
void setEditModeDraw();
void setEditModeKnife();
void setEditModeSelect();
void toggleProportionalSnap();
void updatePosition( const lmms::TimePos & t );
void updatePositionLine();
void selectAllClips( bool select );
protected:
void closeEvent( QCloseEvent * ce ) override;
void mousePressEvent(QMouseEvent * me) override;
void mouseMoveEvent(QMouseEvent * me) override;
void mouseReleaseEvent(QMouseEvent * me) override;
private slots:
void setMasterVolume( int new_val );
void showMasterVolumeFloat();
void updateMasterVolumeFloat( int new_val );
void hideMasterVolumeFloat();
void setMasterPitch( int new_val );
void showMasterPitchFloat();
void updateMasterPitchFloat( int new_val );
void hideMasterPitchFloat();
void updateScrollBar(int len);
void zoomingChanged();
private:
void keyPressEvent( QKeyEvent * ke ) override;
void wheelEvent( QWheelEvent * we ) override;
bool allowRubberband() const override;
bool knifeMode() const override;
int calculatePixelsPerBar() const;
int calculateZoomSliderValue(int pixelsPerBar) const;
int trackIndexFromSelectionPoint(int yPos);
int indexOfTrackView(const TrackView* tv);
Song * m_song;
QScrollBar * m_leftRightScroll;
void adjustLeftRightScoll(int value);
LcdSpinBox * m_tempoSpinBox;
TimeLineWidget * m_timeLine;
MeterDialog * m_timeSigDisplay;
AutomatableSlider * m_masterVolumeSlider;
AutomatableSlider * m_masterPitchSlider;
TextFloat * m_mvsStatus;
TextFloat * m_mpsStatus;
PositionLine * m_positionLine;
IntModel* m_zoomingModel;
ComboBoxModel* m_snappingModel;
bool m_proportionalSnap;
bool m_scrollBack;
bool m_smoothScroll;
EditMode m_mode;
EditMode m_ctrlMode; // mode they were in before they hit ctrl
QPoint m_origin;
QPoint m_scrollPos;
QPoint m_mousePos;
int m_rubberBandStartTrackview;
TimePos m_rubberbandStartTimePos;
int m_rubberbandPixelsPerBar; //!< pixels per bar when selection starts
int m_trackHeadWidth;
bool m_selectRegion;
friend class SongEditorWindow;
signals:
void pixelsPerBarChanged(float);
void proportionalSnapChanged();
} ;
class SongEditorWindow : public Editor
{
Q_OBJECT
public:
SongEditorWindow( Song* song );
QSize sizeHint() const override;
SongEditor* m_editor;
void syncEditMode();
protected:
void resizeEvent( QResizeEvent * event ) override;
void changeEvent( QEvent * ) override;
protected slots:
void play() override;
void record() override;
void recordAccompany() override;
void stop() override;
void lostFocus();
void adjustUiAfterProjectLoad();
void updateSnapLabel();
signals:
void playTriggered();
void resized();
private:
QAction* m_addPatternTrackAction;
QAction* m_addSampleTrackAction;
QAction* m_addAutomationTrackAction;
QAction* m_setProportionalSnapAction;
ActionGroup * m_editModeGroup;
QAction* m_drawModeAction;
QAction* m_knifeModeAction;
QAction* m_selectModeAction;
QAction* m_crtlAction;
AutomatableSlider * m_zoomingSlider;
ComboBox * m_snappingComboBox;
QLabel* m_snapSizeLabel;
QAction* m_insertBarAction;
QAction* m_removeBarAction;
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_SONG_EDITOR_H
| 5,184
|
C++
|
.h
| 172
| 28.034884
| 77
| 0.792936
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,275
|
ExportFilter.h
|
LMMS_lmms/include/ExportFilter.h
|
/*
* ExportFilter.h - declaration of class ExportFilter, the base-class for all
* file export filters
*
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/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 LMMS_EXPORT_FILTER_H
#define LMMS_EXPORT_FILTER_H
#include <QFile>
#include "TrackContainer.h"
#include "Plugin.h"
namespace lmms
{
class LMMS_EXPORT ExportFilter : public Plugin
{
public:
ExportFilter( const Descriptor * _descriptor ) : Plugin( _descriptor, nullptr ) {}
~ExportFilter() override = default;
virtual bool tryExport(const TrackContainer::TrackList &tracks,
const TrackContainer::TrackList &patternTracks,
int tempo, int masterPitch, const QString &filename ) = 0;
protected:
void saveSettings( QDomDocument &, QDomElement & ) override
{
}
void loadSettings( const QDomElement & ) override
{
}
QString nodeName() const override
{
return "import_filter";
}
private:
} ;
} // namespace lmms
#endif // LMMS_EXPORT_FILTER_H
| 1,778
|
C++
|
.h
| 54
| 30.759259
| 83
| 0.752052
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,276
|
Song.h
|
LMMS_lmms/include/Song.h
|
/*
* Song.h - class song - the root of the model-tree
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_SONG_H
#define LMMS_SONG_H
#include <array>
#include <memory>
#include <QHash>
#include <QString>
#include "AudioEngine.h"
#include "Controller.h"
#include "Metronome.h"
#include "lmms_constants.h"
#include "MeterModel.h"
#include "Timeline.h"
#include "TrackContainer.h"
#include "VstSyncController.h"
namespace lmms
{
class AutomationTrack;
class Keymap;
class MidiClip;
class Scale;
namespace gui
{
class TimeLineWidget;
class SongEditor;
class ControllerRackView;
}
const bpm_t MinTempo = 10;
const bpm_t DefaultTempo = 140;
const bpm_t MaxTempo = 999;
const tick_t MaxSongLength = 9999 * DefaultTicksPerBar;
class LMMS_EXPORT Song : public TrackContainer
{
Q_OBJECT
mapPropertyFromModel( int,getTempo,setTempo,m_tempoModel );
mapPropertyFromModel( int,masterPitch,setMasterPitch,m_masterPitchModel );
mapPropertyFromModel( int,masterVolume,setMasterVolume, m_masterVolumeModel );
public:
enum class PlayMode
{
None,
Song,
Pattern,
MidiClip,
AutomationClip,
Count
} ;
constexpr static auto PlayModeCount = static_cast<std::size_t>(PlayMode::Count);
struct SaveOptions {
/**
* Should we discard MIDI ControllerConnections from project files?
*/
BoolModel discardMIDIConnections{false};
/**
* Should we save the project as a project bundle? (with resources)
*/
BoolModel saveAsProjectBundle{false};
void setDefaultOptions() {
discardMIDIConnections.setValue(false);
saveAsProjectBundle.setValue(false);
}
};
void clearErrors();
void collectError( const QString error );
bool hasErrors();
QString errorSummary();
class PlayPos : public TimePos
{
public:
PlayPos( const int abs = 0 ) :
TimePos( abs ),
m_currentFrame( 0.0f )
{
}
inline void setCurrentFrame( const float f )
{
m_currentFrame = f;
}
inline float currentFrame() const
{
return m_currentFrame;
}
inline void setJumped( const bool jumped )
{
m_jumped = jumped;
}
inline bool jumped() const
{
return m_jumped;
}
private:
float m_currentFrame;
bool m_jumped;
};
void processNextBuffer();
inline int getLoadingTrackCount() const
{
return m_nLoadingTrack;
}
inline int getMilliseconds() const
{
return getMilliseconds(m_playMode);
}
inline int getMilliseconds(PlayMode playMode) const
{
return m_elapsedMilliSeconds[static_cast<std::size_t>(playMode)];
}
inline void setToTime(TimePos const & pos)
{
setToTime(pos, m_playMode);
}
inline void setToTime(TimePos const & pos, PlayMode playMode)
{
m_elapsedMilliSeconds[static_cast<std::size_t>(playMode)] = pos.getTimeInMilliseconds(getTempo());
getPlayPos(playMode).setTicks(pos.getTicks());
}
inline void setToTimeByTicks(tick_t ticks)
{
setToTimeByTicks(ticks, m_playMode);
}
inline void setToTimeByTicks(tick_t ticks, PlayMode playMode)
{
m_elapsedMilliSeconds[static_cast<std::size_t>(playMode)] = TimePos::ticksToMilliseconds(ticks, getTempo());
getPlayPos(playMode).setTicks(ticks);
}
inline int getBars() const
{
return currentBar();
}
inline int ticksPerBar() const
{
return TimePos::ticksPerBar(m_timeSigModel);
}
// Returns the beat position inside the bar, 0-based
inline int getBeat() const
{
return getPlayPos().getBeatWithinBar(m_timeSigModel);
}
// the remainder after bar and beat are removed
inline int getBeatTicks() const
{
return getPlayPos().getTickWithinBeat(m_timeSigModel);
}
inline int getTicks() const
{
return currentTick();
}
inline f_cnt_t getFrames() const
{
return currentFrame();
}
inline bool isPaused() const
{
return m_paused;
}
inline bool isPlaying() const
{
return m_playing == true && m_exporting == false;
}
inline bool isStopped() const
{
return m_playing == false && m_paused == false;
}
inline bool isExporting() const
{
return m_exporting;
}
inline void setExportLoop( bool exportLoop )
{
m_exportLoop = exportLoop;
}
inline bool isRecording() const
{
return m_recording;
}
inline void setLoopRenderCount(int count)
{
if (count < 1)
m_loopRenderCount = 1;
else
m_loopRenderCount = count;
m_loopRenderRemaining = m_loopRenderCount;
}
inline int getLoopRenderCount() const
{
return m_loopRenderCount;
}
bool isExportDone() const;
int getExportProgress() const;
inline void setRenderBetweenMarkers( bool renderBetweenMarkers )
{
m_renderBetweenMarkers = renderBetweenMarkers;
}
inline PlayMode playMode() const
{
return m_playMode;
}
inline PlayPos & getPlayPos( PlayMode pm )
{
return m_playPos[static_cast<std::size_t>(pm)];
}
inline const PlayPos & getPlayPos( PlayMode pm ) const
{
return m_playPos[static_cast<std::size_t>(pm)];
}
inline PlayPos & getPlayPos()
{
return getPlayPos(m_playMode);
}
inline const PlayPos & getPlayPos() const
{
return getPlayPos(m_playMode);
}
auto getTimeline(PlayMode mode) -> Timeline& { return m_timelines[static_cast<std::size_t>(mode)]; }
auto getTimeline(PlayMode mode) const -> const Timeline& { return m_timelines[static_cast<std::size_t>(mode)]; }
auto getTimeline() -> Timeline& { return getTimeline(m_playMode); }
auto getTimeline() const -> const Timeline& { return getTimeline(m_playMode); }
void updateLength();
bar_t length() const
{
return m_length;
}
bpm_t getTempo();
AutomationTrack * globalAutomationTrack()
{
return m_globalAutomationTrack;
}
//TODO: Add Q_DECL_OVERRIDE when Qt4 is dropped
AutomatedValueMap automatedValuesAt(TimePos time, int clipNum = -1) const override;
// file management
void createNewProject();
void createNewProjectFromTemplate( const QString & templ );
void loadProject( const QString & filename );
bool guiSaveProject();
bool guiSaveProjectAs(const QString & filename);
bool saveProjectFile(const QString & filename, bool withResources = false);
const QString & projectFileName() const
{
return m_fileName;
}
bool isLoadingProject() const
{
return m_loadingProject;
}
void loadingCancelled()
{
m_isCancelled = true;
Engine::audioEngine()->clearNewPlayHandles();
}
bool isCancelled()
{
return m_isCancelled;
}
bool isModified() const
{
return m_modified;
}
QString nodeName() const override
{
return "song";
}
virtual bool fixedClips() const
{
return false;
}
void addController( Controller * c );
void removeController( Controller * c );
const ControllerVector & controllers() const
{
return m_controllers;
}
MeterModel & getTimeSigModel()
{
return m_timeSigModel;
}
IntModel& tempoModel()
{
return m_tempoModel;
}
void exportProjectMidi(QString const & exportFileName) const;
inline void setLoadOnLaunch(bool value) { m_loadOnLaunch = value; }
SaveOptions &getSaveOptions() {
return m_saveOptions;
}
bool isSavingProject() const;
std::shared_ptr<const Scale> getScale(unsigned int index) const;
std::shared_ptr<const Keymap> getKeymap(unsigned int index) const;
void setScale(unsigned int index, std::shared_ptr<Scale> newScale);
void setKeymap(unsigned int index, std::shared_ptr<Keymap> newMap);
const std::string& syncKey() const noexcept { return m_vstSyncController.sharedMemoryKey(); }
Metronome& metronome() { return m_metronome; }
public slots:
void playSong();
void record();
void playAndRecord();
void playPattern();
void playMidiClip( const lmms::MidiClip * midiClipToPlay, bool loop = true );
void togglePause();
void stop();
void startExport();
void stopExport();
void setModified();
void clearProject();
void addPatternTrack();
private slots:
void insertBar();
void removeBar();
void addSampleTrack();
void addAutomationTrack();
void setTempo();
void setTimeSignature();
void masterVolumeChanged();
void savePlayStartPosition();
void updateFramesPerTick();
private:
Song();
Song( const Song & );
~Song() override;
inline bar_t currentBar() const
{
return getPlayPos(m_playMode).getBar();
}
inline tick_t currentTick() const
{
return getPlayPos(m_playMode).getTicks();
}
inline f_cnt_t currentFrame() const
{
return getPlayPos(m_playMode).getTicks() * Engine::framesPerTick() +
getPlayPos(m_playMode).currentFrame();
}
void setPlayPos( tick_t ticks, PlayMode playMode );
void saveControllerStates( QDomDocument & doc, QDomElement & element );
void restoreControllerStates( const QDomElement & element );
void removeAllControllers();
void saveScaleStates(QDomDocument &doc, QDomElement &element);
void restoreScaleStates(const QDomElement &element);
void saveKeymapStates(QDomDocument &doc, QDomElement &element);
void restoreKeymapStates(const QDomElement &element);
void processAutomations(const TrackList& tracks, TimePos timeStart, fpp_t frames);
void processMetronome(size_t bufferOffset);
void setModified(bool value);
void setProjectFileName(QString const & projectFileName);
AutomationTrack * m_globalAutomationTrack;
IntModel m_tempoModel;
MeterModel m_timeSigModel;
int m_oldTicksPerBar;
IntModel m_masterVolumeModel;
IntModel m_masterPitchModel;
ControllerVector m_controllers;
int m_nLoadingTrack;
QString m_fileName;
QString m_oldFileName;
bool m_modified;
bool m_loadOnLaunch;
volatile bool m_recording;
volatile bool m_exporting;
volatile bool m_exportLoop;
volatile bool m_renderBetweenMarkers;
volatile bool m_playing;
volatile bool m_paused;
bool m_savingProject;
bool m_loadingProject;
bool m_isCancelled;
SaveOptions m_saveOptions;
QHash<QString, int> m_errors;
std::array<Timeline, PlayModeCount> m_timelines;
PlayMode m_playMode;
PlayPos m_playPos[PlayModeCount];
bar_t m_length;
const MidiClip* m_midiClipToPlay;
bool m_loopMidiClip;
double m_elapsedMilliSeconds[PlayModeCount];
tick_t m_elapsedTicks;
bar_t m_elapsedBars;
VstSyncController m_vstSyncController;
int m_loopRenderCount;
int m_loopRenderRemaining;
TimePos m_exportSongBegin;
TimePos m_exportLoopBegin;
TimePos m_exportLoopEnd;
TimePos m_exportSongEnd;
TimePos m_exportEffectiveLength;
std::shared_ptr<Scale> m_scales[MaxScaleCount];
std::shared_ptr<Keymap> m_keymaps[MaxKeymapCount];
AutomatedValueMap m_oldAutomatedValues;
Metronome m_metronome;
friend class Engine;
friend class gui::SongEditor;
friend class gui::ControllerRackView;
signals:
void projectLoaded();
void playbackStateChanged();
void playbackPositionChanged();
void lengthChanged( int bars );
void tempoChanged( lmms::bpm_t newBPM );
void timeSignatureChanged( int oldTicksPerBar, int ticksPerBar );
void controllerAdded( lmms::Controller * );
void controllerRemoved( lmms::Controller * );
void updateSampleTracks();
void stopped();
void modified();
void projectFileNameChanged();
void scaleListChanged(int index);
void keymapListChanged(int index);
} ;
} // namespace lmms
#endif // LMMS_SONG_H
| 11,735
|
C++
|
.h
| 430
| 24.846512
| 113
| 0.768694
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,277
|
Keymap.h
|
LMMS_lmms/include/Keymap.h
|
/*
* 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 LMMS_KEYMAP_H
#define LMMS_KEYMAP_H
#include <vector>
#include <QObject>
#include <QString>
#include "SerializingObject.h"
namespace lmms
{
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)
};
} // namespace lmms
#endif // LMMS_KEYMAP_H
| 2,553
|
C++
|
.h
| 70
| 34.414286
| 85
| 0.722672
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,278
|
denormals.h
|
LMMS_lmms/include/denormals.h
|
// Denormals stripping.
// These snippets should be common enough to be considered public domain.
#ifndef LMMS_DENORMALS_H
#define LMMS_DENORMALS_H
#ifdef __SSE__
#include <immintrin.h>
#ifdef __GNUC__
#include <x86intrin.h>
#endif // __GNUC__
#endif // __SSE__
namespace lmms
{
#ifdef __SSE__
// Intel® 64 and IA-32 Architectures Software Developer’s Manual,
// Volume 1: Basic Architecture,
// 11.6.3 Checking for the DAZ Flag in the MXCSR Register
int inline can_we_daz()
{
alignas(16) unsigned char buffer[512] = {0};
#if defined(LMMS_HOST_X86)
_fxsave(buffer);
#elif defined(LMMS_HOST_X86_64)
_fxsave64(buffer);
#endif // defined(LLMS_HOST_X86)
// Bit 6 of the MXCSR_MASK, i.e. in the lowest byte,
// tells if we can use the DAZ flag.
return ((buffer[28] & (1 << 6)) != 0);
}
#endif // __SSE__
// Set denormal protection for this thread.
void inline disable_denormals()
{
#ifdef __SSE__
/* Setting DAZ might freeze systems not supporting it */
if (can_we_daz()) {
_MM_SET_DENORMALS_ZERO_MODE( _MM_DENORMALS_ZERO_ON );
}
/* FTZ flag */
_MM_SET_FLUSH_ZERO_MODE( _MM_FLUSH_ZERO_ON );
#endif // __SSE__
}
} // namespace lmms
#endif // LMMS_DENORMALS_H
| 1,192
|
C++
|
.h
| 43
| 25.813953
| 73
| 0.693662
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,279
|
RingBuffer.h
|
LMMS_lmms/include/RingBuffer.h
|
/*
* RingBuffer.h - an effective and flexible implementation of a ringbuffer for LMMS
*
* Copyright (c) 2014 Vesa Kivim√§ki
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_RING_BUFFER_H
#define LMMS_RING_BUFFER_H
#include <cmath>
#include <QObject>
#include "lmms_basics.h"
#include "lmms_export.h"
namespace lmms
{
class SampleFrame;
/** \brief A basic LMMS ring buffer for single-thread use. For thread and realtime safe alternative see LocklessRingBuffer.
*/
class LMMS_EXPORT RingBuffer : public QObject
{
Q_OBJECT
public:
/** \brief Constructs a ringbuffer of specified size, will not care about samplerate changes
* \param size The size of the buffer in frames. The actual size will be size + period size
*/
RingBuffer( f_cnt_t size );
/** \brief Constructs a ringbuffer of specified samplerate-dependent size, which will be updated when samplerate changes
* \param size The size of the buffer in milliseconds. The actual size will be size + period size
*/
RingBuffer( float size );
~RingBuffer() override;
////////////////////////////////////
// Provided functions //
////////////////////////////////////
// utility functions
/** \brief Clears the ringbuffer of any data and resets the position to 0
*/
void reset();
/** \brief Changes the size of the ringbuffer. Clears all data.
* \param size New size in frames
*/
void changeSize( f_cnt_t size );
/** \brief Changes the size of the ringbuffer. Clears all data.
* \param size New size in milliseconds
*/
void changeSize( float size );
/** \brief Sets whether the ringbuffer size is adjusted for samplerate when samplerate changes
* \param b True if samplerate should affect buffer size
*/
void setSamplerateAware( bool b );
// position adjustment functions
/** \brief Advances the position by one period
*/
void advance();
/** \brief Moves position forwards/backwards by an amount of frames
* \param amount Number of frames to move, may be negative
*/
void movePosition( f_cnt_t amount );
/** \brief Moves position forwards/backwards by an amount of milliseconds
* \param amount Number of milliseconds to move, may be negative
*/
void movePosition( float amount );
// read functions
/** \brief Destructively reads a period-sized buffer from the current position, writes it
* to a specified destination, and advances the position by one period
* \param dst Destination pointer
*/
void pop( SampleFrame* dst );
// note: ringbuffer position is unaffected by all other read functions beside pop()
/** \brief Reads a period-sized buffer from the ringbuffer and writes it to a specified destination
* \param dst Destination pointer
* \param offset Offset in frames against current position, may be negative
*/
void read( SampleFrame* dst, f_cnt_t offset = 0 );
/** \brief Reads a period-sized buffer from the ringbuffer and writes it to a specified destination
* \param dst Destination pointer
* \param offset Offset in milliseconds against current position, may be negative
*/
void read( SampleFrame* dst, float offset );
/** \brief Reads a buffer of specified size from the ringbuffer and writes it to a specified destination
* \param dst Destination pointer
* \param offset Offset in frames against current position, may be negative
* \param length Length in frames of the buffer to read - must not be higher than the size of the ringbuffer!
*/
void read( SampleFrame* dst, f_cnt_t offset, f_cnt_t length );
/** \brief Reads a buffer of specified size from the ringbuffer and writes it to a specified destination
* \param dst Destination pointer
* \param offset Offset in milliseconds against current position, may be negative
* \param length Length in frames of the buffer to read - must not be higher than the size of the ringbuffer!
*/
void read( SampleFrame* dst, float offset, f_cnt_t length );
// write functions
/** \brief Writes a buffer of sampleframes to the ringbuffer at specified position
* \param src Pointer to the source buffer
* \param offset Offset in frames against current position, may *NOT* be negative
* \param length Length of the source buffer, if zero, period size is used - must not be higher than the size of the ringbuffer!
*/
void write( SampleFrame* src, f_cnt_t offset=0, f_cnt_t length=0 );
/** \brief Writes a buffer of sampleframes to the ringbuffer at specified position
* \param src Pointer to the source buffer
* \param offset Offset in milliseconds against current position, may *NOT* be negative
* \param length Length of the source buffer, if zero, period size is used - must not be higher than the size of the ringbuffer!
*/
void write( SampleFrame* src, float offset, f_cnt_t length=0 );
/** \brief Mixes a buffer of sampleframes additively to the ringbuffer at specified position
* \param src Pointer to the source buffer
* \param offset Offset in frames against current position, may *NOT* be negative
* \param length Length of the source buffer, if zero, period size is used - must not be higher than the size of the ringbuffer!
*/
void writeAdding( SampleFrame* src, f_cnt_t offset=0, f_cnt_t length=0 );
/** \brief Mixes a buffer of sampleframes additively to the ringbuffer at specified position
* \param src Pointer to the source buffer
* \param offset Offset in milliseconds against current position, may *NOT* be negative
* \param length Length of the source buffer, if zero, period size is used - must not be higher than the size of the ringbuffer!
*/
void writeAdding( SampleFrame* src, float offset, f_cnt_t length=0 );
/** \brief Mixes a buffer of sampleframes additively to the ringbuffer at specified position, with
* a specified multiplier applied to the frames
* \param src Pointer to the source buffer
* \param offset Offset in frames against current position, may *NOT* be negative
* \param length Length of the source buffer, if zero, period size is used - must not be higher than the size of the ringbuffer!
* \param level Multiplier applied to the frames before they're written to the ringbuffer
*/
void writeAddingMultiplied( SampleFrame* src, f_cnt_t offset, f_cnt_t length, float level );
/** \brief Mixes a buffer of sampleframes additively to the ringbuffer at specified position, with
* a specified multiplier applied to the frames
* \param src Pointer to the source buffer
* \param offset Offset in milliseconds against current position, may *NOT* be negative
* \param length Length of the source buffer, if zero, period size is used
* \param level Multiplier applied to the frames before they're written to the ringbuffer
*/
void writeAddingMultiplied( SampleFrame* src, float offset, f_cnt_t length, float level );
/** \brief Mixes a buffer of sampleframes additively to the ringbuffer at specified position, with
* a specified multiplier applied to the frames, with swapped channels
* \param src Pointer to the source buffer
* \param offset Offset in frames against current position, may *NOT* be negative
* \param length Length of the source buffer, if zero, period size is used - must not be higher than the size of the ringbuffer!
* \param level Multiplier applied to the frames before they're written to the ringbuffer
*/
void writeSwappedAddingMultiplied( SampleFrame* src, f_cnt_t offset, f_cnt_t length, float level );
/** \brief Mixes a buffer of sampleframes additively to the ringbuffer at specified position, with
* a specified multiplier applied to the frames, with swapped channels
* \param src Pointer to the source buffer
* \param offset Offset in milliseconds against current position, may *NOT* be negative
* \param length Length of the source buffer, if zero, period size is used
* \param level Multiplier applied to the frames before they're written to the ringbuffer
*/
void writeSwappedAddingMultiplied( SampleFrame* src, float offset, f_cnt_t length, float level );
protected slots:
void updateSamplerate();
private:
inline f_cnt_t msToFrames( float ms )
{
return static_cast<f_cnt_t>( ceilf( ms * (float)m_samplerate * 0.001f ) );
}
const fpp_t m_fpp;
sample_rate_t m_samplerate;
size_t m_size;
SampleFrame* m_buffer;
volatile unsigned int m_position;
};
} // namespace lmms
#endif // LMMS_RING_BUFFER_H
| 9,115
|
C++
|
.h
| 180
| 48.65
| 129
| 0.756413
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,280
|
Lv2ViewBase.h
|
LMMS_lmms/include/Lv2ViewBase.h
|
/*
* Lv2ViewBase.h - base class for Lv2 plugin views
*
* Copyright (c) 2018-2023 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 LMMS_GUI_LV2_VIEW_BASE_H
#define LMMS_GUI_LV2_VIEW_BASE_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_LV2
#include "LinkedModelGroupViews.h"
#include "lmms_export.h"
#include "Lv2Basics.h"
class QPushButton;
class QMdiSubWindow;
class QLabel;
namespace lmms
{
class Lv2Proc;
class Lv2ControlBase;
namespace gui
{
class LedCheckBox;
//! View for one processor, Lv2ViewBase contains 2 of those for mono plugins
class Lv2ViewProc : public LinkedModelGroupView
{
public:
//! @param colNum numbers of columns for the controls
Lv2ViewProc(QWidget *parent, Lv2Proc *proc, int colNum);
~Lv2ViewProc() override = default;
private:
static AutoLilvNode uri(const char *uriStr);
};
class HelpWindowEventFilter : public QObject
{
Q_OBJECT
class Lv2ViewBase* const m_viewBase;
protected:
bool eventFilter(QObject* obj, QEvent* event) override;
public:
HelpWindowEventFilter(class Lv2ViewBase* viewBase);
};
//! Base class for view for one Lv2 plugin
class LMMS_EXPORT Lv2ViewBase : public LinkedModelGroupsView
{
friend class HelpWindowEventFilter;
protected:
//! @param pluginWidget A child class which inherits QWidget
Lv2ViewBase(class QWidget *pluginWidget, Lv2ControlBase *ctrlBase);
~Lv2ViewBase();
// these widgets must be connected by child widgets
QPushButton* m_reloadPluginButton = nullptr;
QPushButton* m_toggleUIButton = nullptr;
QPushButton* m_helpButton = nullptr;
void toggleUI();
void toggleHelp(bool visible);
void closeHelpWindow();
// to be called by child virtuals
//! Reconnect models if model changed
void modelChanged(Lv2ControlBase* ctrlBase);
private:
enum Rows
{
ButtonRow,
ProcRow,
LinkChannelsRow
};
static AutoLilvNode uri(const char *uriStr);
LinkedModelGroupView* getGroupView() override { return m_procView; }
void onHelpWindowClosed();
Lv2ViewProc* m_procView;
//! Numbers of controls per row; must be multiple of 2 for mono effects
const int m_colNum = 6;
QMdiSubWindow* m_helpWindow = nullptr;
HelpWindowEventFilter m_helpWindowEventFilter;
};
} // namespace gui
} // namespace lmms
#endif // LMMS_HAVE_LV2
#endif // LMMS_GUI_LV2_VIEW_BASE_H
| 3,074
|
C++
|
.h
| 97
| 29.71134
| 80
| 0.783214
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,281
|
MixerChannelView.h
|
LMMS_lmms/include/MixerChannelView.h
|
/*
* MixerChannelView.h
*
* Copyright (c) 2024 saker
*
* 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 LMMS_GUI_MIXER_CHANNEL_VIEW_H
#define LMMS_GUI_MIXER_CHANNEL_VIEW_H
#include <QGraphicsView>
#include <QLabel>
#include <QLineEdit>
#include <QPixmap>
#include <QStackedWidget>
#include <QWidget>
#include "EffectRackView.h"
#include "Fader.h"
#include "Knob.h"
#include "LcdWidget.h"
#include "PixmapButton.h"
#include "SendButtonIndicator.h"
namespace lmms {
class MixerChannel;
}
namespace lmms::gui {
class PeakIndicator;
class MixerChannelView : public QWidget
{
Q_OBJECT
Q_PROPERTY(QBrush backgroundActive READ backgroundActive WRITE setBackgroundActive)
Q_PROPERTY(QColor strokeOuterActive READ strokeOuterActive WRITE setStrokeOuterActive)
Q_PROPERTY(QColor strokeOuterInactive READ strokeOuterInactive WRITE setStrokeOuterInactive)
Q_PROPERTY(QColor strokeInnerActive READ strokeInnerActive WRITE setStrokeInnerActive)
Q_PROPERTY(QColor strokeInnerInactive READ strokeInnerInactive WRITE setStrokeInnerInactive)
public:
MixerChannelView(QWidget* parent, MixerView* mixerView, int channelIndex);
void paintEvent(QPaintEvent* event) override;
void contextMenuEvent(QContextMenuEvent*) override;
void mousePressEvent(QMouseEvent*) override;
void mouseDoubleClickEvent(QMouseEvent*) override;
bool eventFilter(QObject* dist, QEvent* event) override;
void reset();
int channelIndex() const { return m_channelIndex; }
void setChannelIndex(int index);
QBrush backgroundActive() const { return m_backgroundActive; }
void setBackgroundActive(const QBrush& c) { m_backgroundActive = c; }
QColor strokeOuterActive() const { return m_strokeOuterActive; }
void setStrokeOuterActive(const QColor& c) { m_strokeOuterActive = c; }
QColor strokeOuterInactive() const { return m_strokeOuterInactive; }
void setStrokeOuterInactive(const QColor& c) { m_strokeOuterInactive = c; }
QColor strokeInnerActive() const { return m_strokeInnerActive; }
void setStrokeInnerActive(const QColor& c) { m_strokeInnerActive = c; }
QColor strokeInnerInactive() const { return m_strokeInnerInactive; }
void setStrokeInnerInactive(const QColor& c) { m_strokeInnerInactive = c; }
public slots:
void renameChannel();
void resetColor();
void selectColor();
void randomizeColor();
private slots:
void renameFinished();
void removeChannel();
void removeUnusedChannels();
void moveChannelLeft();
void moveChannelRight();
private:
bool confirmRemoval(int index);
QString elideName(const QString& name);
MixerChannel* mixerChannel() const;
auto isMasterChannel() const -> bool { return m_channelIndex == 0; }
private:
SendButtonIndicator* m_sendButton;
QLabel* m_receiveArrow;
QStackedWidget* m_receiveArrowOrSendButton;
int m_receiveArrowStackedIndex = -1;
int m_sendButtonStackedIndex = -1;
Knob* m_sendKnob;
LcdWidget* m_channelNumberLcd;
QLineEdit* m_renameLineEdit;
QGraphicsView* m_renameLineEditView;
QLabel* m_sendArrow;
PixmapButton* m_muteButton;
PixmapButton* m_soloButton;
PeakIndicator* m_peakIndicator = nullptr;
Fader* m_fader;
EffectRackView* m_effectRackView;
MixerView* m_mixerView;
int m_channelIndex = 0;
bool m_inRename = false;
QBrush m_backgroundActive;
QColor m_strokeOuterActive;
QColor m_strokeOuterInactive;
QColor m_strokeInnerActive;
QColor m_strokeInnerInactive;
friend class MixerView;
};
} // namespace lmms::gui
#endif // LMMS_GUI_MIXER_CHANNEL_VIEW_H
| 4,189
|
C++
|
.h
| 114
| 34.824561
| 93
| 0.800197
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,282
|
InstrumentTrackWindow.h
|
LMMS_lmms/include/InstrumentTrackWindow.h
|
/*
* InstrumentTrackWindow.h - declaration of InstrumentTrackWindow class
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_INSTRUMENT_TRACK_WINDOW_H
#define LMMS_GUI_INSTRUMENT_TRACK_WINDOW_H
#include <QWidget>
#include "ModelView.h"
#include "SerializingObject.h"
#include "PluginView.h"
class QLabel;
class QLineEdit;
class QWidget;
namespace lmms
{
class InstrumentTrack;
namespace gui
{
class EffectRackView;
class MixerChannelLcdSpinBox;
class InstrumentFunctionArpeggioView;
class InstrumentFunctionNoteStackingView;
class InstrumentMidiIOView;
class InstrumentTuningView;
class InstrumentSoundShapingView;
class InstrumentTrackShapingView;
class InstrumentTrackView;
class Knob;
class LcdSpinBox;
class LeftRightNav;
class PianoView;
class PluginView;
class TabWidget;
class InstrumentTrackWindow : public QWidget, public ModelView,
public SerializingObjectHook
{
Q_OBJECT
public:
InstrumentTrackWindow( InstrumentTrackView * _tv );
~InstrumentTrackWindow() override;
void resizeEvent(QResizeEvent* event) override;
// parent for all internal tab-widgets
TabWidget * tabWidgetParent()
{
return m_tabWidget;
}
InstrumentTrack * model()
{
return castModel<InstrumentTrack>();
}
const InstrumentTrack * model() const
{
return castModel<InstrumentTrack>();
}
void setInstrumentTrackView( InstrumentTrackView * _tv );
InstrumentTrackView *instrumentTrackView()
{
return m_itv;
}
PianoView * pianoView()
{
return m_pianoView;
}
static void dragEnterEventGeneric( QDragEnterEvent * _dee );
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;
public slots:
void textChanged( const QString & _new_name );
void toggleVisibility( bool _on );
void updateName();
void updateInstrumentView();
protected:
// capture close-events for toggling instrument-track-button
void closeEvent( QCloseEvent * _ce ) override;
void focusInEvent( QFocusEvent * _fe ) override;
void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
void loadSettings( const QDomElement & _this ) override;
protected slots:
void saveSettingsBtnClicked();
void viewNextInstrument();
void viewPrevInstrument();
private:
void modelChanged() override;
void viewInstrumentInDirection(int d);
//! adjust size of any child widget of the main tab
//! required to keep the old look when using a variable sized tab widget
void adjustTabSize(QWidget *w);
InstrumentTrack * m_track;
InstrumentTrackView * m_itv;
// widgets on the top of an instrument-track-window
QLineEdit * m_nameLineEdit;
LeftRightNav * m_leftRightNav;
Knob * m_volumeKnob;
Knob * m_panningKnob;
Knob * m_pitchKnob;
QLabel * m_pitchLabel;
LcdSpinBox* m_pitchRangeSpinBox;
QLabel * m_pitchRangeLabel;
MixerChannelLcdSpinBox * m_mixerChannelNumber;
// tab-widget with all children
TabWidget * m_tabWidget;
PluginView * m_instrumentView;
InstrumentSoundShapingView * m_ssView;
InstrumentFunctionNoteStackingView* m_noteStackingView;
InstrumentFunctionArpeggioView* m_arpeggioView;
QWidget* m_instrumentFunctionsView; // container of note stacking and arpeggio
InstrumentMidiIOView * m_midiView;
EffectRackView * m_effectView;
InstrumentTuningView *m_tuningView;
// test-piano at the bottom of every instrument-settings-window
PianoView * m_pianoView;
friend class InstrumentView;
friend class InstrumentTrackView;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_INSTRUMENT_TRACK_WINDOW_H
| 4,352
|
C++
|
.h
| 136
| 29.911765
| 79
| 0.797365
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,283
|
EffectView.h
|
LMMS_lmms/include/EffectView.h
|
/*
* EffectView.h - view-component for an effect
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2007-2010 Tobias Doerffel <tobydox/at/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 LMMS_GUI_EFFECT_VIEW_H
#define LMMS_GUI_EFFECT_VIEW_H
#include "AutomatableModel.h"
#include "PluginView.h"
#include "Effect.h"
class QGraphicsOpacityEffect;
class QGroupBox;
class QLabel;
class QPushButton;
class QMdiSubWindow;
namespace lmms::gui
{
class EffectControlDialog;
class Knob;
class LedCheckBox;
class TempoSyncKnob;
class EffectView : public PluginView
{
Q_OBJECT
public:
EffectView( Effect * _model, QWidget * _parent );
~EffectView() override;
inline Effect * effect()
{
return castModel<Effect>();
}
inline const Effect * effect() const
{
return castModel<Effect>();
}
static constexpr int DEFAULT_WIDTH = 215;
static constexpr int DEFAULT_HEIGHT = 60;
void mouseMoveEvent(QMouseEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
public slots:
void editControls();
void moveUp();
void moveDown();
void deletePlugin();
void closeEffects();
signals:
void movedUp(EffectView* view);
void movedDown(EffectView* view);
void deletedPlugin(EffectView* view);
protected:
void contextMenuEvent( QContextMenuEvent * _me ) override;
void paintEvent( QPaintEvent * _pe ) override;
void modelChanged() override;
private:
QPixmap m_bg;
LedCheckBox * m_bypass;
Knob * m_wetDry;
TempoSyncKnob * m_autoQuit;
Knob * m_gate;
QMdiSubWindow * m_subWindow;
EffectControlDialog * m_controlView;
bool m_dragging;
QGraphicsOpacityEffect* m_opacityEffect;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_EFFECT_VIEW_H
| 2,555
|
C++
|
.h
| 86
| 27.732558
| 77
| 0.774325
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,284
|
TrackRenameLineEdit.h
|
LMMS_lmms/include/TrackRenameLineEdit.h
|
/*
* TrackRenameLineEdit.h - class TrackRenameLineEdit
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2017 Alexandre Almeida <http://m374lx.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 LMMS_GUI_TRACK_RENAME_LINE_EDIT_H
#define LMMS_GUI_TRACK_RENAME_LINE_EDIT_H
#include <QLineEdit>
namespace lmms::gui
{
class TrackRenameLineEdit : public QLineEdit
{
Q_OBJECT
public:
TrackRenameLineEdit( QWidget * parent );
void show();
protected:
void keyPressEvent( QKeyEvent * ke ) override;
private:
QString m_oldName;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_TRACK_RENAME_LINE_EDIT_H
| 1,429
|
C++
|
.h
| 42
| 32.119048
| 78
| 0.76398
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,285
|
PresetPreviewPlayHandle.h
|
LMMS_lmms/include/PresetPreviewPlayHandle.h
|
/*
* PresetPreviewPlayHandle.h - a PlayHandle specialization for playback of a short
* preview of a preset or a file processed by a plugin
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_PRESET_PREVIEW_PLAY_HANDLE_H
#define LMMS_PRESET_PREVIEW_PLAY_HANDLE_H
#include "NotePlayHandle.h"
namespace lmms
{
class DataFile;
class InstrumentTrack;
class PreviewTrackContainer;
class LMMS_EXPORT PresetPreviewPlayHandle : public PlayHandle
{
public:
PresetPreviewPlayHandle( const QString& presetFile, bool loadByPlugin = false, DataFile *dataFile = 0 );
~PresetPreviewPlayHandle() override;
inline bool affinityMatters() const override
{
return true;
}
void play( SampleFrame* buffer ) override;
bool isFinished() const override;
bool isFromTrack( const Track * _track ) const override;
static void init();
static void cleanup();
static ConstNotePlayHandleList nphsOfInstrumentTrack( const InstrumentTrack* instrumentTrack );
static bool isPreviewing();
private:
static PreviewTrackContainer* s_previewTC;
NotePlayHandle* m_previewNote;
} ;
} // namespace lmms
#endif // LMMS_PRESET_PREVIEW_PLAY_HANDLE_H
| 2,003
|
C++
|
.h
| 54
| 35.037037
| 105
| 0.773692
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,286
|
AudioAlsaSetupWidget.h
|
LMMS_lmms/include/AudioAlsaSetupWidget.h
|
/*
* AudioAlsaSetupWidget.h - Implements a setup widget for ALSA-PCM-output
*
* Copyright (c) 2004-2015 Tobias Doerffel <tobydox/at/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 LMMS_GUI_AUDIO_ALSA_SETUP_WIDGET_H
#define LMMS_GUI_AUDIO_ALSA_SETUP_WIDGET_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_ALSA
#include "AudioDeviceSetupWidget.h"
#include "AudioAlsa.h"
class QComboBox;
namespace lmms::gui
{
class LcdSpinBox;
class AudioAlsaSetupWidget : public AudioDeviceSetupWidget
{
Q_OBJECT
public:
AudioAlsaSetupWidget( QWidget * _parent );
~AudioAlsaSetupWidget() override;
void saveSettings() override;
public slots:
void onCurrentIndexChanged(int index);
private:
QComboBox * m_deviceComboBox;
LcdSpinBox * m_channels;
int m_selectedDevice;
AudioAlsa::DeviceInfoCollection m_deviceInfos;
};
} // namespace lmms::gui
#endif // LMMS_HAVE_ALSA
#endif // LMMS_GUI_AUDIO_ALSA_SETUP_WIDGET_H
| 1,696
|
C++
|
.h
| 51
| 31.294118
| 77
| 0.779348
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,287
|
MixHelpers.h
|
LMMS_lmms/include/MixHelpers.h
|
/*
* MixHelpers.h - helper functions for mixing buffers
*
* Copyright (c) 2014 Tobias Doerffel <tobydox/at/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 LMMS_MIX_HELPERS_H
#define LMMS_MIX_HELPERS_H
#include "lmms_basics.h"
namespace lmms
{
class ValueBuffer;
class SampleFrame;
namespace MixHelpers
{
bool isSilent( const SampleFrame* src, int frames );
bool useNaNHandler();
void setNaNHandler( bool use );
bool sanitize( SampleFrame* src, int frames );
/*! \brief Add samples from src to dst */
void add( SampleFrame* dst, const SampleFrame* src, int frames );
/*! \brief Multiply samples from `dst` by `coeff` */
void multiply(SampleFrame* dst, float coeff, int frames);
/*! \brief Add samples from src multiplied by coeffSrc to dst */
void addMultiplied( SampleFrame* dst, const SampleFrame* src, float coeffSrc, int frames );
/*! \brief Add samples from src multiplied by coeffSrc to dst, swap inputs */
void addSwappedMultiplied( SampleFrame* dst, const SampleFrame* src, float coeffSrc, int frames );
/*! \brief Add samples from src multiplied by coeffSrc and coeffSrcBuf to dst */
void addMultipliedByBuffer( SampleFrame* dst, const SampleFrame* src, float coeffSrc, ValueBuffer * coeffSrcBuf, int frames );
/*! \brief Add samples from src multiplied by coeffSrc and coeffSrcBuf to dst */
void addMultipliedByBuffers( SampleFrame* dst, const SampleFrame* src, ValueBuffer * coeffSrcBuf1, ValueBuffer * coeffSrcBuf2, int frames );
/*! \brief Same as addMultiplied, but sanitize output (strip out infs/nans) */
void addSanitizedMultiplied( SampleFrame* dst, const SampleFrame* src, float coeffSrc, int frames );
/*! \brief Add samples from src multiplied by coeffSrc and coeffSrcBuf to dst - sanitized version */
void addSanitizedMultipliedByBuffer( SampleFrame* dst, const SampleFrame* src, float coeffSrc, ValueBuffer * coeffSrcBuf, int frames );
/*! \brief Add samples from src multiplied by coeffSrc and coeffSrcBuf to dst - sanitized version */
void addSanitizedMultipliedByBuffers( SampleFrame* dst, const SampleFrame* src, ValueBuffer * coeffSrcBuf1, ValueBuffer * coeffSrcBuf2, int frames );
/*! \brief Add samples from src multiplied by coeffSrcLeft/coeffSrcRight to dst */
void addMultipliedStereo( SampleFrame* dst, const SampleFrame* src, float coeffSrcLeft, float coeffSrcRight, int frames );
/*! \brief Multiply dst by coeffDst and add samples from src multiplied by coeffSrc */
void multiplyAndAddMultiplied( SampleFrame* dst, const SampleFrame* src, float coeffDst, float coeffSrc, int frames );
/*! \brief Multiply dst by coeffDst and add samples from srcLeft/srcRight multiplied by coeffSrc */
void multiplyAndAddMultipliedJoined( SampleFrame* dst, const sample_t* srcLeft, const sample_t* srcRight, float coeffDst, float coeffSrc, int frames );
} // namespace MixHelpers
} // namespace lmms
#endif // LMMS_MIX_HELPERS_H
| 3,653
|
C++
|
.h
| 63
| 56.238095
| 151
| 0.778121
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,288
|
AutomationClip.h
|
LMMS_lmms/include/AutomationClip.h
|
/*
* AutomationClip.h - declaration of class AutomationClip, which contains
* all information about an automation clip
*
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/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 LMMS_AUTOMATION_CLIP_H
#define LMMS_AUTOMATION_CLIP_H
#include <QMap>
#include <QPointer>
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
#include <QRecursiveMutex>
#endif
#include "AutomationNode.h"
#include "Clip.h"
namespace lmms
{
class AutomationTrack;
class TimePos;
namespace gui
{
class AutomationClipView;
class AutomationEditor;
} // namespace gui
class LMMS_EXPORT AutomationClip : public Clip
{
Q_OBJECT
public:
enum class ProgressionType
{
Discrete,
Linear,
CubicHermite
} ;
using timeMap = QMap<int, AutomationNode>;
using objectVector = std::vector<QPointer<AutomatableModel>>;
using TimemapIterator = timeMap::const_iterator;
AutomationClip( AutomationTrack * _auto_track );
AutomationClip( const AutomationClip & _clip_to_copy );
~AutomationClip() override = default;
bool addObject( AutomatableModel * _obj, bool _search_dup = true );
const AutomatableModel * firstObject() const;
const objectVector& objects() const;
// progression-type stuff
inline ProgressionType progressionType() const
{
return m_progressionType;
}
void setProgressionType( ProgressionType _new_progression_type );
inline float getTension() const
{
return m_tension;
}
void setTension( QString _new_tension );
TimePos timeMapLength() const;
void updateLength();
TimePos putValue(
const TimePos & time,
const float value,
const bool quantPos = true,
const bool ignoreSurroundingPoints = true
);
TimePos putValues(
const TimePos & time,
const float inValue,
const float outValue,
const bool quantPos = true,
const bool ignoreSurroundingPoints = true
);
void removeNode(const TimePos & time);
void removeNodes(const int tick0, const int tick1);
void resetNodes(const int tick0, const int tick1);
/**
* @brief Resets the tangents from the nodes between the given ticks
* @param Int first tick of the range
* @param Int second tick of the range
*/
void resetTangents(const int tick0, const int tick1);
void recordValue(TimePos time, float value);
TimePos setDragValue( const TimePos & time,
const float value,
const bool quantPos = true,
const bool controlKey = false );
void applyDragValue();
bool isDragging() const
{
return m_dragging;
}
inline const timeMap & getTimeMap() const
{
return m_timeMap;
}
inline timeMap & getTimeMap()
{
return m_timeMap;
}
inline float getMin() const
{
return firstObject()->minValue<float>();
}
inline float getMax() const
{
return firstObject()->maxValue<float>();
}
inline bool hasAutomation() const
{
return m_timeMap.isEmpty() == false;
}
static bool supportsTangentEditing(ProgressionType pType)
{
// Update function if we have new progression types that support tangent editing
return pType == ProgressionType::CubicHermite;
}
inline bool canEditTangents() const
{
return supportsTangentEditing(m_progressionType);
}
float valueAt( const TimePos & _time ) const;
float *valuesAfter( const TimePos & _time ) const;
QString name() const;
// settings-management
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
static const QString classNodeName() { return "automationclip"; }
QString nodeName() const override { return classNodeName(); }
gui::ClipView * createView( gui::TrackView * _tv ) override;
static bool isAutomated( const AutomatableModel * _m );
static std::vector<AutomationClip*> clipsForModel(const AutomatableModel* _m);
static AutomationClip * globalAutomationClip( AutomatableModel * _m );
static void resolveAllIDs();
bool isRecording() const { return m_isRecording; }
void setRecording( const bool b ) { m_isRecording = b; }
static int quantization() { return s_quantization; }
static void setQuantization(int q) { s_quantization = q; }
public slots:
void clear();
void objectDestroyed( lmms::jo_id_t );
void flipY( int min, int max );
void flipY();
void flipX( int length = -1 );
private:
void cleanObjects();
void generateTangents();
void generateTangents(timeMap::iterator it, int numToGenerate);
float valueAt( timeMap::const_iterator v, int offset ) const;
/**
* @brief
* This function combines the song tracks, pattern store tracks,
* and the global automation track all in one vector.
*
* @return std::vector<Track*>
*/
static std::vector<Track*> combineAllTracks();
// Mutex to make methods involving automation clips thread safe
// Mutable so we can lock it from const objects
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
mutable QRecursiveMutex m_clipMutex;
#else
mutable QMutex m_clipMutex;
#endif
AutomationTrack * m_autoTrack;
std::vector<jo_id_t> m_idsToResolve;
objectVector m_objects;
timeMap m_timeMap; // actual values
timeMap m_oldTimeMap; // old values for storing the values before setDragValue() is called.
float m_tension;
bool m_hasAutomation;
ProgressionType m_progressionType;
bool m_dragging;
bool m_dragKeepOutValue; // Should we keep the current dragged node's outValue?
float m_dragOutValue; // The outValue of the dragged node's
bool m_dragLockedTan; // If the dragged node has it's tangents locked
float m_dragInTan; // The dragged node's inTangent
float m_dragOutTan; // The dragged node's outTangent
bool m_isRecording;
float m_lastRecordedValue;
static int s_quantization;
static const float DEFAULT_MIN_VALUE;
static const float DEFAULT_MAX_VALUE;
friend class gui::AutomationClipView;
friend class AutomationNode;
friend class gui::AutomationEditor;
} ;
//Short-hand functions to access node values in an automation clip;
// replacement for CPP macros with the same purpose; could be refactored
// further in the future.
inline float INVAL(AutomationClip::TimemapIterator it)
{
return it->getInValue();
}
inline float OUTVAL(AutomationClip::TimemapIterator it)
{
return it->getOutValue();
}
inline float OFFSET(AutomationClip::TimemapIterator it)
{
return it->getValueOffset();
}
inline float INTAN(AutomationClip::TimemapIterator it)
{
return it->getInTangent();
}
inline float OUTTAN(AutomationClip::TimemapIterator it)
{
return it->getOutTangent();
}
inline float LOCKEDTAN(AutomationClip::TimemapIterator it)
{
return it->lockedTangents();
}
inline int POS(AutomationClip::TimemapIterator it)
{
return it.key();
}
} // namespace lmms
#endif // LMMS_AUTOMATION_CLIP_H
| 7,500
|
C++
|
.h
| 235
| 29.685106
| 92
| 0.766944
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,289
|
RmsHelper.h
|
LMMS_lmms/include/RmsHelper.h
|
/*
* RmsHelper.h - helper class for calculating RMS
*
* Copyright (c) 2014 Vesa Kivim√§ki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/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 LMMS_RMS_HELPER_H
#define LMMS_RMS_HELPER_H
#include "lmms_math.h"
namespace lmms
{
class RmsHelper
{
public:
RmsHelper(std::size_t size) :
m_buffer( nullptr )
{
setSize( size );
}
virtual ~RmsHelper()
{
if( m_buffer ) delete[] m_buffer;
}
void setSize(std::size_t size)
{
if( m_buffer )
{
if( m_size < size )
{
delete m_buffer;
m_buffer = new float[ size ];
m_size = size;
reset();
}
else
{
m_size = size;
reset();
}
}
else
{
m_buffer = new float[ size ];
m_size = size;
reset();
}
}
inline void reset()
{
m_sizef = 1.0f / (float) m_size;
m_pos = 0;
m_sum = 0.0f;
memset( m_buffer, 0, m_size * sizeof( float ) );
}
inline float update( const float in )
{
m_sum -= m_buffer[ m_pos ];
m_sum += m_buffer[ m_pos ] = in * in;
++m_pos %= m_size;
return sqrtf( m_sum * m_sizef );
}
private:
float * m_buffer;
float m_sum;
std::size_t m_pos;
std::size_t m_size;
float m_sizef;
};
} // namespace lmms
#endif // LMMS_RMS_HELPER_H
| 2,042
|
C++
|
.h
| 88
| 20.590909
| 72
| 0.67491
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,290
|
RaiiHelpers.h
|
LMMS_lmms/include/RaiiHelpers.h
|
/*
* RaiiHelpers.h
*
* Copyright (c) 2022 Dominic Clark <mrdomclark/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 LMMS_RAII_HELPERS_H
#define LMMS_RAII_HELPERS_H
#include <cstddef>
#include <memory>
namespace lmms
{
template<typename T, T Null>
class NullableResource
{
public:
NullableResource() = default;
NullableResource(std::nullptr_t) noexcept { }
NullableResource(T value) noexcept : m_value{value} { }
operator T() const noexcept { return m_value; }
explicit operator bool() const noexcept { return m_value != Null; }
friend bool operator==(NullableResource a, NullableResource b) noexcept { return a.m_value == b.m_value; }
friend bool operator==(NullableResource a, T b) noexcept { return a.m_value == b; }
friend bool operator==(T a, NullableResource b) noexcept { return a == b.m_value; }
friend bool operator!=(NullableResource a, NullableResource b) noexcept { return a.m_value != b.m_value; }
friend bool operator!=(NullableResource a, T b) noexcept { return a.m_value != b; }
friend bool operator!=(T a, NullableResource b) noexcept { return a != b.m_value; }
private:
T m_value = Null;
};
template<typename T, T Null, auto Deleter>
struct NullableResourceDeleter
{
using pointer = NullableResource<T, Null>;
void operator()(T value) const noexcept { Deleter(value); }
};
template<typename T, T Null, auto Deleter>
using UniqueNullableResource = std::unique_ptr<T, NullableResourceDeleter<T, Null, Deleter>>;
} // namespace lmms
#endif // LMMS_RAII_HELPERS_H
| 2,272
|
C++
|
.h
| 57
| 38.052632
| 107
| 0.748753
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,291
|
TempoSyncBarModelEditor.h
|
LMMS_lmms/include/TempoSyncBarModelEditor.h
|
/*
* TempoSyncBarModelEditor.h - adds bpm to ms conversion for the bar editor class
*
* Copyright (c) 2005-2008 Danny McRae <khjklujn/at/yahoo.com>
* Copyright (c) 2009-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2023 Michael Gregorius
*
* 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 LMMS_GUI_TEMPO_SYNC_BAR_MODEL_EDITOR_H
#define LMMS_GUI_TEMPO_SYNC_BAR_MODEL_EDITOR_H
#include <QPixmap>
#include <QPointer>
#include "BarModelEditor.h"
#include "TempoSyncKnobModel.h"
namespace lmms::gui
{
class MeterDialog;
class LMMS_EXPORT TempoSyncBarModelEditor : public BarModelEditor
{
Q_OBJECT
public:
TempoSyncBarModelEditor(QString text, FloatModel * floatModel, QWidget * parent = nullptr);
~TempoSyncBarModelEditor() override;
const QString & syncDescription();
void setSyncDescription(const QString & new_description);
const QPixmap & syncIcon();
void setSyncIcon(const QPixmap & new_pix);
TempoSyncKnobModel * model()
{
return castModel<TempoSyncKnobModel>();
}
void modelChanged() override;
signals:
void syncDescriptionChanged(const QString & new_description);
void syncIconChanged();
protected:
void contextMenuEvent(QContextMenuEvent * me) override;
protected slots:
void updateDescAndIcon();
void showCustom();
private:
void updateTextDescription();
void updateIcon();
private:
QPixmap m_tempoSyncIcon;
QString m_tempoSyncDescription;
QPointer<MeterDialog> m_custom;
};
} // namespace lmms::gui
#endif // LMMS_GUI_TEMPO_SYNC_BAR_MODEL_EDITOR_H
| 2,281
|
C++
|
.h
| 67
| 32
| 92
| 0.782748
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,292
|
Sample.h
|
LMMS_lmms/include/Sample.h
|
/*
* Sample.h - State for container-class SampleBuffer
*
* Copyright (c) 2023 saker <sakertooth@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 LMMS_SAMPLE_H
#define LMMS_SAMPLE_H
#include <cmath>
#include <memory>
#include "AudioResampler.h"
#include "Note.h"
#include "SampleBuffer.h"
#include "lmms_export.h"
namespace lmms {
class LMMS_EXPORT Sample
{
public:
// values for buffer margins, used for various libsamplerate interpolation modes
// the array positions correspond to the converter_type parameter values in libsamplerate
// if there appears problems with playback on some interpolation mode, then the value for that mode
// may need to be higher - conversely, to optimize, some may work with lower values
static constexpr auto s_interpolationMargins = std::array<int, 5>{64, 64, 64, 4, 4};
enum class Loop
{
Off,
On,
PingPong
};
class LMMS_EXPORT PlaybackState
{
public:
PlaybackState(bool varyingPitch = false, int interpolationMode = SRC_LINEAR)
: m_resampler(interpolationMode, DEFAULT_CHANNELS)
, m_varyingPitch(varyingPitch)
{
}
auto resampler() -> AudioResampler& { return m_resampler; }
auto frameIndex() const -> int { return m_frameIndex; }
auto varyingPitch() const -> bool { return m_varyingPitch; }
auto backwards() const -> bool { return m_backwards; }
void setFrameIndex(int frameIndex) { m_frameIndex = frameIndex; }
void setVaryingPitch(bool varyingPitch) { m_varyingPitch = varyingPitch; }
void setBackwards(bool backwards) { m_backwards = backwards; }
private:
AudioResampler m_resampler;
int m_frameIndex = 0;
bool m_varyingPitch = false;
bool m_backwards = false;
friend class Sample;
};
Sample() = default;
Sample(const QByteArray& base64, int sampleRate = Engine::audioEngine()->outputSampleRate());
Sample(const SampleFrame* data, size_t numFrames, int sampleRate = Engine::audioEngine()->outputSampleRate());
Sample(const Sample& other);
Sample(Sample&& other);
explicit Sample(const QString& audioFile);
explicit Sample(std::shared_ptr<const SampleBuffer> buffer);
auto operator=(const Sample&) -> Sample&;
auto operator=(Sample&&) -> Sample&;
auto play(SampleFrame* dst, PlaybackState* state, size_t numFrames, float desiredFrequency = DefaultBaseFreq,
Loop loopMode = Loop::Off) const -> bool;
auto sampleDuration() const -> std::chrono::milliseconds;
auto sampleFile() const -> const QString& { return m_buffer->audioFile(); }
auto sampleRate() const -> int { return m_buffer->sampleRate(); }
auto sampleSize() const -> size_t { return m_buffer->size(); }
auto toBase64() const -> QString { return m_buffer->toBase64(); }
auto data() const -> const SampleFrame* { return m_buffer->data(); }
auto buffer() const -> std::shared_ptr<const SampleBuffer> { return m_buffer; }
auto startFrame() const -> int { return m_startFrame.load(std::memory_order_relaxed); }
auto endFrame() const -> int { return m_endFrame.load(std::memory_order_relaxed); }
auto loopStartFrame() const -> int { return m_loopStartFrame.load(std::memory_order_relaxed); }
auto loopEndFrame() const -> int { return m_loopEndFrame.load(std::memory_order_relaxed); }
auto amplification() const -> float { return m_amplification.load(std::memory_order_relaxed); }
auto frequency() const -> float { return m_frequency.load(std::memory_order_relaxed); }
auto reversed() const -> bool { return m_reversed.load(std::memory_order_relaxed); }
void setStartFrame(int startFrame) { m_startFrame.store(startFrame, std::memory_order_relaxed); }
void setEndFrame(int endFrame) { m_endFrame.store(endFrame, std::memory_order_relaxed); }
void setLoopStartFrame(int loopStartFrame) { m_loopStartFrame.store(loopStartFrame, std::memory_order_relaxed); }
void setLoopEndFrame(int loopEndFrame) { m_loopEndFrame.store(loopEndFrame, std::memory_order_relaxed); }
void setAllPointFrames(int startFrame, int endFrame, int loopStartFrame, int loopEndFrame);
void setAmplification(float amplification) { m_amplification.store(amplification, std::memory_order_relaxed); }
void setFrequency(float frequency) { m_frequency.store(frequency, std::memory_order_relaxed); }
void setReversed(bool reversed) { m_reversed.store(reversed, std::memory_order_relaxed); }
private:
void playRaw(SampleFrame* dst, size_t numFrames, const PlaybackState* state, Loop loopMode) const;
void advance(PlaybackState* state, size_t advanceAmount, Loop loopMode) const;
private:
std::shared_ptr<const SampleBuffer> m_buffer = SampleBuffer::emptyBuffer();
std::atomic<int> m_startFrame = 0;
std::atomic<int> m_endFrame = 0;
std::atomic<int> m_loopStartFrame = 0;
std::atomic<int> m_loopEndFrame = 0;
std::atomic<float> m_amplification = 1.0f;
std::atomic<float> m_frequency = DefaultBaseFreq;
std::atomic<bool> m_reversed = false;
};
} // namespace lmms
#endif
| 5,603
|
C++
|
.h
| 116
| 46.103448
| 114
| 0.75352
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,293
|
AutomatableSlider.h
|
LMMS_lmms/include/AutomatableSlider.h
|
/*
* AutomatableSlider.h - class AutomatableSlider, a QSlider with automation
*
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/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 LMMS_GUI_AUTOMATABLE_SLIDER_H
#define LMMS_GUI_AUTOMATABLE_SLIDER_H
#include <QSlider>
#include "AutomatableModelView.h"
namespace lmms::gui
{
class AutomatableSlider : public QSlider, public IntModelView
{
Q_OBJECT
public:
AutomatableSlider( QWidget * _parent, const QString & _name = QString() );
~AutomatableSlider() override = default;
bool showStatus()
{
return( m_showStatus );
}
signals:
void logicValueChanged( int _value );
void logicSliderMoved( int _value );
protected:
void contextMenuEvent( QContextMenuEvent * _me ) override;
void mousePressEvent( QMouseEvent * _me ) override;
void mouseReleaseEvent( QMouseEvent * _me ) override;
void wheelEvent( QWheelEvent * _me ) override;
void modelChanged() override;
private:
bool m_showStatus;
private slots:
void changeValue( int _value );
void moveSlider( int _value );
void updateSlider();
} ;
using sliderModel = IntModel;
} // namespace lmms::gui
#endif // LMMS_GUI_AUTOMATABLE_SLIDER_H
| 1,954
|
C++
|
.h
| 58
| 31.62069
| 80
| 0.765867
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,294
|
MeterModel.h
|
LMMS_lmms/include/MeterModel.h
|
/*
* MeterModel.h - model for meter specification
*
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/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 LMMS_METER_MODEL_H
#define LMMS_METER_MODEL_H
#include "AutomatableModel.h"
namespace lmms
{
class LMMS_EXPORT MeterModel : public Model
{
Q_OBJECT
mapPropertyFromModel(int,getNumerator,setNumerator,m_numeratorModel);
mapPropertyFromModel(int,getDenominator,setDenominator,m_denominatorModel);
public:
MeterModel( Model * _parent );
~MeterModel() override = default;
void saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name );
void loadSettings( const QDomElement & _this, const QString & _name );
void reset();
// Must have the sub-models exposed to programatically connect
// to automation or controllers
IntModel & numeratorModel()
{
return m_numeratorModel;
}
IntModel & denominatorModel()
{
return m_denominatorModel;
}
private:
IntModel m_numeratorModel;
IntModel m_denominatorModel;
} ;
} // namespace lmms
#endif // LMMS_METER_MODEL_H
| 1,846
|
C++
|
.h
| 56
| 30.803571
| 77
| 0.767324
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,295
|
BarModelEditor.h
|
LMMS_lmms/include/BarModelEditor.h
|
/*
* BarModelEditor.h - edit model values using a bar display
*
* Copyright (c) 2023-now Michael Gregorius
*
* 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.
*
*/
#pragma once
#ifndef LMMS_GUI_BAR_MODEL_EDITOR_H
#define LMMS_GUI_BAR_MODEL_EDITOR_H
#include "FloatModelEditorBase.h"
namespace lmms::gui
{
class LMMS_EXPORT BarModelEditor : public FloatModelEditorBase
{
Q_OBJECT
public:
Q_PROPERTY(QBrush backgroundBrush READ getBackgroundBrush WRITE setBackgroundBrush)
Q_PROPERTY(QBrush barBrush READ getBarBrush WRITE setBarBrush)
Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor)
BarModelEditor(QString text, FloatModel * floatModel, QWidget * parent = nullptr);
// Define how the widget will behave in a layout
QSizePolicy sizePolicy() const;
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
QBrush const & getBackgroundBrush() const;
void setBackgroundBrush(QBrush const & backgroundBrush);
QBrush const & getBarBrush() const;
void setBarBrush(QBrush const & barBrush);
QColor const & getTextColor() const;
void setTextColor(QColor const & textColor);
protected:
void paintEvent(QPaintEvent *event) override;
private:
QString const m_text;
QBrush m_backgroundBrush;
QBrush m_barBrush;
QColor m_textColor;
};
} // namespace lmms::gui
#endif // LMMS_GUI_BAR_MODEL_EDITOR_H
| 2,096
|
C++
|
.h
| 57
| 34.701754
| 84
| 0.786139
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,296
|
ControlLayout.h
|
LMMS_lmms/include/ControlLayout.h
|
/*
* ControlLayout.h - layout for controls
*
* Copyright (c) 2019-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.
*
*/
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef LMMS_GUI_CONTROL_LAYOUT_H
#define LMMS_GUI_CONTROL_LAYOUT_H
#include <QLayout>
#include <QMultiMap>
#include <QStyle>
class QLayoutItem;
class QRect;
class QString;
class QLineEdit;
namespace lmms::gui
{
/**
Layout for controls (models)
Originally token from Qt's FlowLayout example. Modified.
Features a search bar, as well as looking up widgets with string keys
Keys have to be provided in the widgets' objectNames
*/
class ControlLayout : public QLayout
{
Q_OBJECT
public:
explicit ControlLayout(QWidget *parent,
int margin = -1, int hSpacing = -1, int vSpacing = -1);
~ControlLayout() override;
void addItem(QLayoutItem *item) override;
int horizontalSpacing() const;
int verticalSpacing() const;
Qt::Orientations expandingDirections() const override;
bool hasHeightForWidth() const override;
int heightForWidth(int) const override;
int count() const override;
QLayoutItem *itemAt(int index) const override;
QLayoutItem *itemByString(const QString& key) const;
QSize minimumSize() const override;
void setGeometry(const QRect &rect) override;
QSize sizeHint() const override;
QLayoutItem *takeAt(int index) override;
//! remove focus from QLineEdit search bar
//! this may be useful if the mouse is outside the layout
void removeFocusFromSearchBar();
private slots:
void onTextChanged(const QString&);
private:
int doLayout(const QRect &rect, bool testOnly) const;
int smartSpacing(QStyle::PixelMetric pm) const;
QMap<QString, QLayoutItem *>::const_iterator pairAt(int index) const;
QMultiMap<QString, QLayoutItem *> m_itemMap;
int m_hSpace;
int m_vSpace;
// relevant dimension is width, as later, heightForWidth() will be called
// 400 looks good and is ~4 knobs in a row
constexpr const static int m_minWidth = 400;
QLineEdit* m_searchBar;
//! name of search bar, must be ASCII sorted before any alpha numerics
static constexpr const char* s_searchBarName = "!!searchBar!!";
};
} // namespace lmms::gui
#endif // LMMS_GUI_CONTROL_LAYOUT_H
| 5,316
|
C++
|
.h
| 128
| 39.9375
| 77
| 0.7471
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,297
|
lmms_constants.h
|
LMMS_lmms/include/lmms_constants.h
|
/*
* lmms_constants.h - defines system constants
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/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 LMMS_CONSTANTS_H
#define LMMS_CONSTANTS_H
namespace lmms
{
constexpr long double LD_PI = 3.14159265358979323846264338327950288419716939937510;
constexpr long double LD_2PI = LD_PI * 2.0;
constexpr long double LD_PI_2 = LD_PI * 0.5;
constexpr long double LD_PI_R = 1.0 / LD_PI;
constexpr long double LD_PI_SQR = LD_PI * LD_PI;
constexpr long double LD_E = 2.71828182845904523536028747135266249775724709369995;
constexpr long double LD_E_R = 1.0 / LD_E;
constexpr long double LD_SQRT_2 = 1.41421356237309504880168872420969807856967187537695;
constexpr double D_PI = (double) LD_PI;
constexpr double D_2PI = (double) LD_2PI;
constexpr double D_PI_2 = (double) LD_PI_2;
constexpr double D_PI_R = (double) LD_PI_R;
constexpr double D_PI_SQR = (double) LD_PI_SQR;
constexpr double D_E = (double) LD_E;
constexpr double D_E_R = (double) LD_E_R;
constexpr double D_SQRT_2 = (double) LD_SQRT_2;
constexpr float F_PI = (float) LD_PI;
constexpr float F_2PI = (float) LD_2PI;
constexpr float F_PI_2 = (float) LD_PI_2;
constexpr float F_PI_R = (float) LD_PI_R;
constexpr float F_PI_SQR = (float) LD_PI_SQR;
constexpr float F_E = (float) LD_E;
constexpr float F_E_R = (float) LD_E_R;
constexpr float F_SQRT_2 = (float) LD_SQRT_2;
constexpr float F_EPSILON = 1.0e-10f; // 10^-10
// Microtuner
constexpr unsigned int MaxScaleCount = 10; //!< number of scales per project
constexpr unsigned int MaxKeymapCount = 10; //!< number of keyboard mappings per project
// Frequency ranges (in Hz).
// Arbitrary low limit for logarithmic frequency scale; >1 Hz.
constexpr int LOWEST_LOG_FREQ = 5;
// Full range is defined by LOWEST_LOG_FREQ and current sample rate.
enum class FrequencyRange
{
Full = 0,
Audible,
Bass,
Mids,
High
};
constexpr int FRANGE_AUDIBLE_START = 20;
constexpr int FRANGE_AUDIBLE_END = 20000;
constexpr int FRANGE_BASS_START = 20;
constexpr int FRANGE_BASS_END = 300;
constexpr int FRANGE_MIDS_START = 200;
constexpr int FRANGE_MIDS_END = 5000;
constexpr int FRANGE_HIGH_START = 4000;
constexpr int FRANGE_HIGH_END = 20000;
// Amplitude ranges (in dBFS).
// Reference: full scale sine wave (-1.0 to 1.0) is 0 dB.
// Doubling or halving the amplitude produces 3 dB difference.
enum class AmplitudeRange
{
Extended = 0,
Audible,
Loud,
Silent
};
constexpr int ARANGE_EXTENDED_START = -80;
constexpr int ARANGE_EXTENDED_END = 20;
constexpr int ARANGE_AUDIBLE_START = -50;
constexpr int ARANGE_AUDIBLE_END = 0;
constexpr int ARANGE_LOUD_START = -30;
constexpr int ARANGE_LOUD_END = 0;
constexpr int ARANGE_SILENT_START = -60;
constexpr int ARANGE_SILENT_END = -10;
} // namespace lmms
#endif // LMMS_CONSTANTS_H
| 3,556
|
C++
|
.h
| 95
| 35.926316
| 88
| 0.755007
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,298
|
MidiOss.h
|
LMMS_lmms/include/MidiOss.h
|
/*
* MidiOss.h - OSS raw MIDI client
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_MIDI_OSS_H
#define LMMS_MIDI_OSS_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_OSS
#include <QThread>
#include <QFile>
#include "MidiClient.h"
namespace lmms
{
class MidiOss : public QThread, public MidiClientRaw
{
Q_OBJECT
public:
MidiOss();
~MidiOss() override;
static QString probeDevice();
inline static QString name()
{
return( QT_TRANSLATE_NOOP( "MidiSetupWidget",
"OSS Raw-MIDI (Open Sound System)" ) );
}
inline static QString configSection()
{
return "midioss";
}
protected:
void sendByte( const unsigned char c ) override;
void run() override;
private:
QFile m_midiDev;
volatile bool m_quit;
} ;
} // namespace lmms
#endif // LMMS_HAVE_OSS
#endif // LMMS_MIDI_OSS_H
| 1,643
|
C++
|
.h
| 58
| 26.189655
| 77
| 0.75032
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,299
|
NStateButton.h
|
LMMS_lmms/include/NStateButton.h
|
/*
* NStateButton.h - declaration of class nStateButton
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/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 LMMS_GUI_NSTATE_BUTTON_H
#define LMMS_GUI_NSTATE_BUTTON_H
#include <QPixmap>
#include <QVector>
#include <QPair>
#include "ToolButton.h"
namespace lmms::gui
{
class NStateButton : public ToolButton
{
Q_OBJECT
public:
NStateButton( QWidget * _parent );
~NStateButton() override;
void addState( const QPixmap & _pixmap, const QString & _tooltip = "" );
inline void setGeneralToolTip( const QString & _tooltip )
{
m_generalToolTip = _tooltip;
}
inline int state() const
{
return( m_curState );
}
public slots:
void changeState(int state);
signals:
void changedState(int state);
protected:
void mousePressEvent(QMouseEvent* me) override;
private:
QVector<QPair<QPixmap, QString>> m_states;
QString m_generalToolTip;
int m_curState;
};
} // namespace lmms::gui
#endif // LMMS_GUI_NSTATE_BUTTON_H
| 1,762
|
C++
|
.h
| 59
| 27.881356
| 73
| 0.758743
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,300
|
MidiJack.h
|
LMMS_lmms/include/MidiJack.h
|
/*
* MidiJack.h - MIDI client for Jack
*
* Copyright (c) 2015 Shane Ambler <develop/at/shaneware.biz>
*
* 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 LMMS_MIDI_JACK_H
#define LMMS_MIDI_JACK_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_JACK
#ifndef LMMS_HAVE_WEAKJACK
#include <jack/jack.h>
#include <jack/midiport.h>
#else
#include <weak_libjack.h>
#endif
#include <QThread>
#include "MidiClient.h"
class QLineEdit;
namespace lmms
{
constexpr size_t JACK_MIDI_BUFFER_MAX = 64; /* events */
class AudioJack;
class MidiJack : public QThread, public MidiClientRaw
{
Q_OBJECT
public:
MidiJack();
~MidiJack() override;
jack_client_t* jackClient();
static QString probeDevice();
inline static QString name()
{
return( QT_TRANSLATE_NOOP( "MidiSetupWidget",
"Jack-MIDI" ) );
}
void JackMidiWrite(jack_nframes_t nframes);
void JackMidiRead(jack_nframes_t nframes);
inline static QString configSection()
{
return "MidiJack";
}
protected:
void sendByte( const unsigned char c ) override;
void run() override;
private:
AudioJack *m_jackAudio;
jack_client_t *m_jackClient;
jack_port_t *m_input_port;
jack_port_t *m_output_port;
uint8_t m_jack_buffer[JACK_MIDI_BUFFER_MAX * 4];
void JackMidiOutEvent(uint8_t *buf, uint8_t len);
void lock();
void unlock();
void getPortInfo( const QString& sPortName, int& nClient, int& nPort );
volatile bool m_quit;
};
} // namespace lmms
#endif // LMMS_HAVE_JACK
#endif // LMMS_MIDI_JACK_H
| 2,233
|
C++
|
.h
| 77
| 26.844156
| 72
| 0.75047
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,301
|
Graph.h
|
LMMS_lmms/include/Graph.h
|
/*
* Graph.h - a QT widget for displaying and manipulating waveforms
*
* Copyright (c) 2006-2007 Andreas Brandmaier <andy/at/brandmaier/dot/de>
* 2008 Paul Giblock <drfaygo/at/gmail/dot/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 LMMS_GUI_GRAPH_H
#define LMMS_GUI_GRAPH_H
#include <QWidget>
#include <QPixmap>
#include <QCursor>
#include "Model.h"
#include "ModelView.h"
#include "lmms_basics.h"
namespace lmms
{
class graphModel;
namespace gui
{
class LMMS_EXPORT Graph : public QWidget, public ModelView
{
Q_OBJECT
public:
enum class Style
{
Nearest, //!< draw as stairs
Linear, //!< connect each 2 samples with a line, with wrapping
LinearNonCyclic, //!< Linear without wrapping
Bar, //!< draw thick bars
};
/**
* @brief Constructor
* @param _width Pixel width of widget
* @param _height Pixel height of widget
*/
Graph( QWidget * _parent, Style _style = Style::Linear,
int _width = 132,
int _height = 104
);
~Graph() override = default;
void setForeground( const QPixmap & _pixmap );
void setGraphColor( const QColor );
inline graphModel * model()
{
return castModel<graphModel>();
}
inline Style getGraphStyle()
{
return m_graphStyle;
}
inline void setGraphStyle( Style _s )
{
m_graphStyle = _s;
update();
}
signals:
void drawn();
protected:
void paintEvent( QPaintEvent * _pe ) override;
void dropEvent( QDropEvent * _de ) override;
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void mousePressEvent( QMouseEvent * _me ) override;
void mouseMoveEvent( QMouseEvent * _me ) override;
void mouseReleaseEvent( QMouseEvent * _me ) override;
protected slots:
void updateGraph( int _startPos, int _endPos );
void updateGraph();
private:
void modelChanged() override;
void changeSampleAt( int _x, int _y );
void drawLineAt( int _x, int _y, int _lastx );
QPixmap m_foreground;
QColor m_graphColor;
Style m_graphStyle;
bool m_mouseDown;
int m_lastCursorX;
} ;
} // namespace gui
/**
@brief 2 dimensional function plot
Function plot graph with discrete x scale and continous y scale
This makes it possible to display "#x" samples
*/
class LMMS_EXPORT graphModel : public Model
{
Q_OBJECT
public:
/**
* @brief Constructor
* @param _min Minimum y value to display
* @param _max Maximum y value to display
* @param _size Number of samples (e.g. x value)
* @param _step Step size on y axis where values snap to, or 0.0f
* for "no snapping"
*/
graphModel( float _min,
float _max,
int _size,
Model * _parent,
bool _default_constructed = false,
float _step = 0.0 );
~graphModel() override = default;
// TODO: saveSettings, loadSettings?
inline float minValue() const
{
return( m_minValue );
}
inline float maxValue() const
{
return( m_maxValue );
}
inline int length() const
{
return m_length;
}
inline const float * samples() const
{
return( m_samples.data() );
}
//! Make cyclic convolution
//! @param convolution Samples to convolve with
//! @param convolutionLength Number of samples to take for each sum
//! @param centerOffset Offset for resulting values
void convolve(const float *convolution,
const int convolutionLength, const int centerOffset);
public slots:
//! Set range of y values
void setRange( float _min, float _max );
void setLength( int _size );
//! Update one sample
void setSampleAt( int x, float val );
//! Update samples array
void setSamples( const float * _value );
void setWaveToSine();
void setWaveToTriangle();
void setWaveToSaw();
void setWaveToSquare();
void setWaveToNoise();
QString setWaveToUser();
void smooth();
void smoothNonCyclic();
void normalize();
void invert();
void shiftPhase( int _deg );
void clear();
void clearInvisible();
signals:
void lengthChanged();
void samplesChanged( int startPos, int endPos );
void rangeChanged();
private:
void drawSampleAt( int x, float val );
QVector<float> m_samples;
int m_length;
float m_minValue;
float m_maxValue;
float m_step;
friend class gui::Graph;
};
} // namespace lmms
#endif // LMMS_GUI_GRAPH_H
| 4,873
|
C++
|
.h
| 179
| 24.932961
| 73
| 0.732773
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,302
|
SystemSemaphore.h
|
LMMS_lmms/include/SystemSemaphore.h
|
/*
* SystemSemaphore.h
*
* Copyright (c) 2024 Dominic Clark
*
* 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 LMMS_SYSTEM_SEMAPHORE_H
#define LMMS_SYSTEM_SEMAPHORE_H
#include <memory>
#include <string>
namespace lmms {
namespace detail {
class SystemSemaphoreImpl;
} // namespace detail
class SystemSemaphore
{
public:
SystemSemaphore() noexcept;
SystemSemaphore(std::string key, unsigned int value);
explicit SystemSemaphore(std::string key);
~SystemSemaphore();
SystemSemaphore(SystemSemaphore&& other) noexcept;
auto operator=(SystemSemaphore&& other) noexcept -> SystemSemaphore&;
auto acquire() noexcept -> bool;
auto release() noexcept -> bool;
auto key() const noexcept -> const std::string& { return m_key; }
private:
std::string m_key;
std::unique_ptr<detail::SystemSemaphoreImpl> m_impl;
};
} // namespace lmms
#endif // LMMS_SYSTEM_SEMAPHORE_H
| 1,631
|
C++
|
.h
| 48
| 32.041667
| 70
| 0.764968
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,303
|
PerfLog.h
|
LMMS_lmms/include/PerfLog.h
|
/*
* PerfLog.h - Small performance logger
*
* Copyright (c) 2017-2018 LMMS Developers
*
* 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 LMMS_PERFLOG_H
#define LMMS_PERFLOG_H
#include <ctime>
#include <QString>
namespace lmms
{
/// \brief CPU time point
///
/// Represents a point in CPU time (not wall-clock time) intended for measuring
/// performance.
class PerfTime
{
public:
PerfTime();
bool valid() const;
clock_t real() const;
clock_t user() const;
clock_t system() const;
static PerfTime now();
static clock_t ticksPerSecond();
friend PerfTime operator-(const PerfTime& lhs, const PerfTime& rhs);
private:
clock_t m_real;
clock_t m_user;
clock_t m_system;
};
/// \brief The PerfLog class
///
/// Measures time between construction and destruction and prints the result to
/// stderr, along with \p name. Alternatively, call begin() and end() explicitly.
class PerfLogTimer
{
public:
PerfLogTimer(const QString& name);
~PerfLogTimer();
void begin();
void end();
private:
QString name;
PerfTime begin_time;
};
} // namespace lmms
#endif // LMMS_PERFLOG_H
| 1,848
|
C++
|
.h
| 66
| 26.166667
| 81
| 0.748869
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,304
|
NotePlayHandle.h
|
LMMS_lmms/include/NotePlayHandle.h
|
/*
* NotePlayHandle.h - declaration of class NotePlayHandle which manages
* playback of a single note by an instrument
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_NOTE_PLAY_HANDLE_H
#define LMMS_NOTE_PLAY_HANDLE_H
#include <memory>
#include "BasicFilters.h"
#include "Note.h"
#include "PlayHandle.h"
#include "Track.h"
class QReadWriteLock;
namespace lmms
{
class InstrumentTrack;
class NotePlayHandle;
using NotePlayHandleList = QList<NotePlayHandle*>;
using ConstNotePlayHandleList = QList<const NotePlayHandle*>;
class LMMS_EXPORT NotePlayHandle : public PlayHandle, public Note
{
public:
void * m_pluginData;
std::unique_ptr<BasicFilters<>> m_filter;
// length of the declicking fade in
fpp_t m_fadeInLength;
// specifies origin of NotePlayHandle
enum class Origin
{
MidiClip, /*! playback of a note from a MIDI clip */
MidiInput, /*! playback of a MIDI note input event */
NoteStacking, /*! created by note stacking instrument function */
Arpeggio, /*! created by arpeggio instrument function */
};
NotePlayHandle( InstrumentTrack* instrumentTrack,
const f_cnt_t offset,
const f_cnt_t frames,
const Note& noteToPlay,
NotePlayHandle* parent = nullptr,
int midiEventChannel = -1,
Origin origin = Origin::MidiClip );
~NotePlayHandle() override;
void * operator new ( size_t size, void * p )
{
return p;
}
void setVolume( volume_t volume ) override;
void setPanning( panning_t panning ) override;
int midiKey() const;
int midiChannel() const
{
return m_midiChannel;
}
/*! convenience function that returns offset for the first period and zero otherwise,
used by instruments to handle the offset: instruments have to check this property and
add the correct number of empty frames in the beginning of the period */
f_cnt_t noteOffset() const
{
return m_totalFramesPlayed == 0
? offset()
: 0;
}
const float& frequency() const
{
return m_frequency;
}
/*! Returns frequency without pitch wheel influence */
float unpitchedFrequency() const
{
return m_unpitchedFrequency;
}
//! Get the current per-note detuning for this note
float currentDetuning() const { return m_baseDetuning->value(); }
/*! Renders one chunk using the attached instrument into the buffer */
void play( SampleFrame* buffer ) override;
/*! Returns whether playback of note is finished and thus handle can be deleted */
bool isFinished() const override
{
return m_released && framesLeft() <= 0;
}
/*! Returns number of frames left for playback */
f_cnt_t framesLeft() const;
/*! Returns how many frames have to be rendered in current period */
fpp_t framesLeftForCurrentPeriod() const;
/*! Returns whether the play handle plays on a certain track */
bool isFromTrack( const Track* _track ) const override;
/*! Releases the note (and plays release frames) */
void noteOff( const f_cnt_t offset = 0 );
/*! Returns number of frames to be played until the note is going to be released */
f_cnt_t framesBeforeRelease() const
{
return m_framesBeforeRelease;
}
/*! Returns how many frames were played since release */
f_cnt_t releaseFramesDone() const
{
return m_releaseFramesDone;
}
/*! Returns the number of frames to be played after release according to
the release times in the envelopes */
f_cnt_t actualReleaseFramesToDo() const;
/*! Returns total numbers of frames to play (including release frames) */
f_cnt_t frames() const
{
return m_frames;
}
/*! Sets the total number of frames to play (including release frames) */
void setFrames( const f_cnt_t _frames );
/*! Returns whether note was released */
bool isReleased() const
{
return m_released;
}
bool isReleaseStarted() const
{
return m_releaseStarted;
}
/*! Returns total numbers of frames played so far */
f_cnt_t totalFramesPlayed() const
{
return m_totalFramesPlayed;
}
/*! Returns volume level at given frame (envelope/LFO) */
float volumeLevel( const f_cnt_t frame );
/*! Returns instrument track which is being played by this handle (const version) */
const InstrumentTrack* instrumentTrack() const
{
return m_instrumentTrack;
}
/*! Returns instrument track which is being played by this handle */
InstrumentTrack* instrumentTrack()
{
return m_instrumentTrack;
}
/*! Returns whether note has a parent, e.g. is not part of an arpeggio or a chord */
bool hasParent() const
{
return m_hasParent;
}
/*! Returns origin of note */
Origin origin() const
{
return m_origin;
}
/*! Returns whether note has children */
bool isMasterNote() const
{
return m_subNotes.size() > 0 || m_hadChildren;
}
void setMasterNote()
{
m_hadChildren = true;
setUsesBuffer( false );
}
/*! Returns whether note is muted */
bool isMuted() const
{
return m_muted;
}
/*! Mutes playback of note */
void mute();
/*! Returns index of NotePlayHandle in vector of note-play-handles
belonging to this instrument track - used by arpeggiator.
Ignores child note-play-handles, returns -1 when called on one */
int index() const;
/*! Returns list of note-play-handles belonging to given instrument track.
If allPlayHandles = true, also released note-play-handles and children
are returned */
static ConstNotePlayHandleList nphsOfInstrumentTrack( const InstrumentTrack* Track, bool allPlayHandles = false );
/*! Returns whether given NotePlayHandle instance is equal to *this */
bool operator==( const NotePlayHandle & _nph ) const;
/*! Returns whether NotePlayHandle belongs to pattern track and pattern track is muted */
bool isPatternTrackMuted()
{
return m_patternTrack && m_patternTrack->isMuted();
}
/*! Sets attached pattern track */
void setPatternTrack(Track* t)
{
m_patternTrack = t;
}
/*! Process note detuning automation */
void processTimePos(const TimePos& time, float pitchValue, bool isRecording);
/*! Updates total length (m_frames) depending on a new tempo */
void resize( const bpm_t newTempo );
/*! Set song-global offset (relative to containing MIDI clip) in order to properly perform the note detuning */
void setSongGlobalParentOffset( const TimePos& offset )
{
m_songGlobalParentOffset = offset;
}
/*! Returns song-global offset */
const TimePos& songGlobalParentOffset() const
{
return m_songGlobalParentOffset;
}
void setFrequencyUpdate()
{
m_frequencyNeedsUpdate = true;
}
private:
class BaseDetuning
{
public:
BaseDetuning( DetuningHelper* detuning );
void setValue( float val )
{
m_value = val;
}
float value() const
{
return m_value;
}
private:
float m_value;
} ;
void updateFrequency();
InstrumentTrack* m_instrumentTrack; // needed for calling
// InstrumentTrack::playNote
f_cnt_t m_frames; // total frames to play
f_cnt_t m_totalFramesPlayed; // total frame-counter - used for
// figuring out whether a whole note
// has been played
f_cnt_t m_framesBeforeRelease; // number of frames after which note
// is released
f_cnt_t m_releaseFramesToDo; // total numbers of frames to be
// played after release
f_cnt_t m_releaseFramesDone; // number of frames done after
// release of note
NotePlayHandleList m_subNotes; // used for chords and arpeggios
volatile bool m_released; // indicates whether note is released
bool m_releaseStarted;
bool m_hasMidiNote;
bool m_hasParent; // indicates whether note has parent
NotePlayHandle * m_parent; // parent note
bool m_hadChildren;
bool m_muted; // indicates whether note is muted
Track* m_patternTrack; // related pattern track
// tempo reaction
bpm_t m_origTempo; // original tempo
f_cnt_t m_origFrames; // original m_frames
int m_origBaseNote;
float m_frequency;
float m_unpitchedFrequency;
BaseDetuning* m_baseDetuning;
TimePos m_songGlobalParentOffset;
int m_midiChannel;
Origin m_origin;
bool m_frequencyNeedsUpdate; // used to update pitch
} ;
const int INITIAL_NPH_CACHE = 256;
const int NPH_CACHE_INCREMENT = 16;
class NotePlayHandleManager
{
public:
static void init();
static NotePlayHandle * acquire( InstrumentTrack* instrumentTrack,
const f_cnt_t offset,
const f_cnt_t frames,
const Note& noteToPlay,
NotePlayHandle* parent = nullptr,
int midiEventChannel = -1,
NotePlayHandle::Origin origin = NotePlayHandle::Origin::MidiClip );
static void release( NotePlayHandle * nph );
static void extend( int i );
static void free();
private:
static NotePlayHandle ** s_available;
static QReadWriteLock s_mutex;
static std::atomic_int s_availableIndex;
static int s_size;
};
} // namespace lmms
#endif // LMMS_NOTE_PLAY_HANDLE_H
| 9,588
|
C++
|
.h
| 292
| 30.089041
| 115
| 0.738833
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,305
|
AutomatableButton.h
|
LMMS_lmms/include/AutomatableButton.h
|
/*
* AutomatableButton.h - class automatableButton, the base for all buttons
*
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/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 LMMS_GUI_AUTOMATABLE_BUTTON_H
#define LMMS_GUI_AUTOMATABLE_BUTTON_H
#include <QPushButton>
#include "AutomatableModelView.h"
namespace lmms::gui
{
class automatableButtonGroup;
class LMMS_EXPORT AutomatableButton : public QPushButton, public BoolModelView
{
Q_OBJECT
public:
AutomatableButton( QWidget * _parent, const QString & _name
= QString() );
~AutomatableButton() override;
inline void setCheckable( bool _on )
{
QPushButton::setCheckable( _on );
model()->setJournalling( _on );
}
void modelChanged() override;
public slots:
virtual void update();
virtual void toggle();
virtual void setChecked( bool _on )
{
// QPushButton::setChecked is called in update-slot
model()->setValue( _on );
}
protected:
void contextMenuEvent( QContextMenuEvent * _me ) override;
void mousePressEvent( QMouseEvent * _me ) override;
void mouseReleaseEvent( QMouseEvent * _me ) override;
private:
automatableButtonGroup * m_group;
friend class automatableButtonGroup;
using QPushButton::setChecked;
using QPushButton::isChecked;
} ;
class LMMS_EXPORT automatableButtonGroup : public QWidget, public IntModelView
{
Q_OBJECT
public:
automatableButtonGroup( QWidget * _parent, const QString & _name
= QString() );
~automatableButtonGroup() override;
void addButton( AutomatableButton * _btn );
void removeButton( AutomatableButton * _btn );
void activateButton( AutomatableButton * _btn );
void modelChanged() override;
private slots:
void updateButtons();
private:
QList<AutomatableButton *> m_buttons;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_AUTOMATABLE_BUTTON_H
| 2,589
|
C++
|
.h
| 79
| 30.556962
| 78
| 0.770379
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,306
|
InstrumentMidiIOView.h
|
LMMS_lmms/include/InstrumentMidiIOView.h
|
/*
* InstrumentMidiIOView.h - widget in instrument-track-window for setting
* up MIDI-related stuff
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_INSTRUMENT_MIDI_IO_VIEW_H
#define LMMS_GUI_INSTRUMENT_MIDI_IO_VIEW_H
#include <QWidget>
#include "ModelView.h"
class QToolButton;
namespace lmms
{
class InstrumentTrack;
namespace gui
{
class GroupBox;
class LcdSpinBox;
class LedCheckBox;
class InstrumentMidiIOView : public QWidget, public ModelView
{
Q_OBJECT
public:
InstrumentMidiIOView( QWidget* parent );
~InstrumentMidiIOView() override = default;
private:
void modelChanged() override;
GroupBox * m_midiInputGroupBox;
LcdSpinBox * m_inputChannelSpinBox;
LcdSpinBox * m_fixedInputVelocitySpinBox;
QToolButton * m_rpBtn;
GroupBox * m_midiOutputGroupBox;
LcdSpinBox * m_outputChannelSpinBox;
LcdSpinBox * m_fixedOutputVelocitySpinBox;
LcdSpinBox * m_outputProgramSpinBox;
LcdSpinBox * m_fixedOutputNoteSpinBox;
QToolButton * m_wpBtn;
LcdSpinBox* m_baseVelocitySpinBox;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_INSTRUMENT_MIDI_IO_VIEW_H
| 1,966
|
C++
|
.h
| 60
| 30.8
| 77
| 0.776246
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,307
|
MidiAlsaSeq.h
|
LMMS_lmms/include/MidiAlsaSeq.h
|
/*
* MidiAlsaSeq.h - ALSA-sequencer-client
*
* Copyright (c) 2005-2013 Tobias Doerffel <tobydox/at/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 LMMS_MIDI_ALSA_SEQ_H
#define LMMS_MIDI_ALSA_SEQ_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_ALSA
#include <alsa/asoundlib.h>
#include <QMap>
#include <QMutex>
#include <QThread>
#include <QTimer>
#include "MidiClient.h"
struct pollfd;
namespace lmms
{
class MidiAlsaSeq : public QThread, public MidiClient
{
Q_OBJECT
public:
MidiAlsaSeq();
~MidiAlsaSeq() override;
static QString probeDevice();
inline static QString name()
{
return QT_TRANSLATE_NOOP( "MidiSetupWidget",
"ALSA-Sequencer (Advanced Linux Sound "
"Architecture)" );
}
inline static QString configSection()
{
return "Midialsaseq";
}
void processOutEvent( const MidiEvent & _me,
const TimePos & _time,
const MidiPort * _port ) override;
void applyPortMode( MidiPort * _port ) override;
void applyPortName( MidiPort * _port ) override;
void removePort( MidiPort * _port ) override;
// list seq-ports from ALSA
QStringList readablePorts() const override
{
return m_readablePorts;
}
QStringList writablePorts() const override
{
return m_writablePorts;
}
// return name of port which specified MIDI event came from
QString sourcePortName( const MidiEvent & ) const override;
// (un)subscribe given MidiPort to/from destination-port
void subscribeReadablePort( MidiPort * _port,
const QString & _dest,
bool _subscribe = true ) override;
void subscribeWritablePort( MidiPort * _port,
const QString & _dest,
bool _subscribe = true ) override;
void connectRPChanged( QObject * _receiver,
const char * _member ) override
{
connect( this, SIGNAL( readablePortsChanged() ),
_receiver, _member );
}
void connectWPChanged( QObject * _receiver,
const char * _member ) override
{
connect( this, SIGNAL( writablePortsChanged() ),
_receiver, _member );
}
private slots:
void changeQueueTempo( lmms::bpm_t _bpm );
void updatePortList();
private:
void run() override;
#ifdef LMMS_HAVE_ALSA
QMutex m_seqMutex;
snd_seq_t * m_seqHandle;
struct Ports
{
Ports() { p[0] = -1; p[1] = -1; }
int & operator[]( const int _i ) { return p[_i]; }
private: int p[2];
} ;
QMap<MidiPort *, Ports> m_portIDs;
#endif
int m_queueID;
volatile bool m_quit;
QTimer m_portListUpdateTimer;
QStringList m_readablePorts;
QStringList m_writablePorts;
int m_pipe[2];
signals:
void readablePortsChanged();
void writablePortsChanged();
} ;
} // namespace lmms
#endif // LMMS_HAVE_ALSA
#endif // LMMS_MIDI_ALSA_SEQ_H
| 3,439
|
C++
|
.h
| 118
| 26.398305
| 77
| 0.734289
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,308
|
AudioFileOgg.h
|
LMMS_lmms/include/AudioFileOgg.h
|
/*
* AudioFileOgg.h - Audio-device which encodes wave-stream and writes it
* into an OGG-file. This is used for song-export.
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_AUDIO_FILE_OGG_H
#define LMMS_AUDIO_FILE_OGG_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_OGGVORBIS
#include <vorbis/codec.h>
#include "AudioFileDevice.h"
namespace lmms
{
class AudioFileOgg : public AudioFileDevice
{
public:
AudioFileOgg( OutputSettings const & outputSettings,
const ch_cnt_t _channels,
bool & _success_ful,
const QString & _file,
AudioEngine* audioEngine );
~AudioFileOgg() override;
static AudioFileDevice * getInst( const QString & outputFilename,
OutputSettings const & outputSettings,
const ch_cnt_t channels,
AudioEngine* audioEngine,
bool & successful )
{
return new AudioFileOgg( outputSettings, channels, successful, outputFilename, audioEngine );
}
private:
void writeBuffer(const SampleFrame* _ab, const fpp_t _frames) override;
bool startEncoding();
void finishEncoding();
inline int writePage();
inline bitrate_t nominalBitrate() const
{
return getOutputSettings().getBitRateSettings().getBitRate();
}
inline bitrate_t minBitrate() const
{
if (nominalBitrate() > 64)
{
return nominalBitrate() - 64;
}
else
{
return 64;
}
}
inline bitrate_t maxBitrate() const
{
return nominalBitrate() + 64;
}
private:
bool m_ok;
ch_cnt_t m_channels;
sample_rate_t m_rate;
uint32_t m_serialNo;
vorbis_comment * m_comments;
// encoding setup - init by init_ogg_encoding
ogg_stream_state m_os;
ogg_page m_og;
ogg_packet m_op;
vorbis_dsp_state m_vd;
vorbis_block m_vb;
vorbis_info m_vi;
} ;
} // namespace lmms
#endif // LMMS_HAVE_OGGVORBIS
#endif // LMMS_AUDIO_FILE_OGG_H
| 2,649
|
C++
|
.h
| 90
| 26.866667
| 95
| 0.736489
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,309
|
Controller.h
|
LMMS_lmms/include/Controller.h
|
/*
* Controller.h - declaration of class controller, which provides a
* standard for all controllers and controller plugins
*
* Copyright (c) 2008-2009 Paul Giblock <pgllama/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 LMMS_CONTROLLER_H
#define LMMS_CONTROLLER_H
#include "lmms_export.h"
#include "Engine.h"
#include "Model.h"
#include "JournallingObject.h"
#include "ValueBuffer.h"
namespace lmms
{
class Controller;
class ControllerConnection;
namespace gui
{
class ControllerDialog;
} // namespace gui
using ControllerVector = std::vector<Controller*>;
class LMMS_EXPORT Controller : public Model, public JournallingObject
{
Q_OBJECT
public:
enum class ControllerType
{
Dummy,
Lfo,
Midi,
Peak,
/*
XY,
Equation
*/
} ;
Controller( ControllerType _type, Model * _parent,
const QString & _display_name );
~Controller() override;
virtual float currentValue( int _offset );
// The per-controller get-value-in-buffers function
virtual ValueBuffer * valueBuffer();
inline bool isSampleExact() const
{
return m_sampleExact;
}
void setSampleExact( bool _exact )
{
m_sampleExact = _exact;
}
inline ControllerType type() const
{
return( m_type );
}
// return whether this controller updates models frequently - used for
// determining when to update GUI
inline bool frequentUpdates() const
{
switch( m_type )
{
case ControllerType::Lfo: return( true );
case ControllerType::Peak: return( true );
default:
break;
}
return( false );
}
virtual const QString & name() const
{
return( m_name );
}
void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
void loadSettings( const QDomElement & _this ) override;
QString nodeName() const override;
static Controller * create( ControllerType _tt, Model * _parent );
static Controller * create( const QDomElement & _this,
Model * _parent );
inline static float fittedValue( float _val )
{
return std::clamp(_val, 0.0f, 1.0f);
}
static long runningPeriods()
{
return s_periods;
}
static unsigned int runningFrames();
static float runningTime();
static void triggerFrameCounter();
static void resetFrameCounter();
//Accepts a ControllerConnection * as it may be used in the future.
void addConnection( ControllerConnection * );
void removeConnection( ControllerConnection * );
int connectionCount() const;
bool hasModel( const Model * m ) const;
public slots:
virtual gui::ControllerDialog * createDialog( QWidget * _parent );
virtual void setName( const QString & _new_name )
{
m_name = _new_name;
}
protected:
// The internal per-controller get-value function
virtual float value( int _offset );
virtual void updateValueBuffer();
// buffer for storing sample-exact values in case there
// are more than one model wanting it, so we don't have to create it
// again every time
ValueBuffer m_valueBuffer;
// when we last updated the valuebuffer - so we know if we have to update it
long m_bufferLastUpdated;
float m_currentValue;
bool m_sampleExact;
int m_connectionCount;
QString m_name;
ControllerType m_type;
static ControllerVector s_controllers;
static long s_periods;
signals:
// The value changed while the audio engine isn't running (i.e: MIDI CC)
void valueChanged();
friend class gui::ControllerDialog;
} ;
} // namespace lmms
#endif // LMMS_CONTROLLER_H
| 4,175
|
C++
|
.h
| 143
| 26.811189
| 77
| 0.749875
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,310
|
LedCheckBox.h
|
LMMS_lmms/include/LedCheckBox.h
|
/*
* LedCheckBox.h - class LedCheckBox, an improved QCheckBox
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/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 LMMS_GUI_LED_CHECKBOX_H
#define LMMS_GUI_LED_CHECKBOX_H
#include "AutomatableButton.h"
class QPixmap;
namespace lmms::gui
{
class LMMS_EXPORT LedCheckBox : public AutomatableButton
{
Q_OBJECT
public:
enum class LedColor
{
Yellow,
Green,
Red
} ;
LedCheckBox( const QString & _txt, QWidget * _parent,
const QString & _name = QString(),
LedColor _color = LedColor::Yellow,
bool legacyMode = true);
LedCheckBox( QWidget * _parent,
const QString & _name = QString(),
LedColor _color = LedColor::Yellow,
bool legacyMode = true);
inline const QString & text()
{
return( m_text );
}
void setText( const QString& s );
Q_PROPERTY( QString text READ text WRITE setText )
protected:
void paintEvent( QPaintEvent * _pe ) override;
private:
QPixmap m_ledOnPixmap;
QPixmap m_ledOffPixmap;
QString m_text;
bool m_legacyMode;
void initUi( LedColor _color ); //!< to be called by ctors
void onTextUpdated(); //!< to be called when you updated @a m_text
void paintLegacy(QPaintEvent * p);
void paintNonLegacy(QPaintEvent * p);
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_LED_CHECKBOX_H
| 2,100
|
C++
|
.h
| 67
| 28.776119
| 77
| 0.738308
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,311
|
AutomatableModel.h
|
LMMS_lmms/include/AutomatableModel.h
|
/*
* AutomatableModel.h - declaration of class AutomatableModel
*
* Copyright (c) 2007-2014 Tobias Doerffel <tobydox/at/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 LMMS_AUTOMATABLE_MODEL_H
#define LMMS_AUTOMATABLE_MODEL_H
#include <cmath>
#include <QMap>
#include <QMutex>
#include <QRegularExpression>
#include "JournallingObject.h"
#include "Model.h"
#include "TimePos.h"
#include "ValueBuffer.h"
#include "ModelVisitor.h"
namespace lmms
{
// simple way to map a property of a view to a model
#define mapPropertyFromModelPtr(type,getfunc,setfunc,modelname) \
public: \
type getfunc() const \
{ \
return (type) modelname->value(); \
} \
public slots: \
void setfunc( const type val ) \
{ \
modelname->setValue( val ); \
}
#define mapPropertyFromModel(type,getfunc,setfunc,modelname) \
public: \
type getfunc() const \
{ \
return (type) modelname.value(); \
} \
public slots: \
void setfunc( const type val ) \
{ \
modelname.setValue( (float) val ); \
}
// use this to make subclasses visitable
#define MODEL_IS_VISITABLE \
void accept(ModelVisitor& v) override { v.visit(*this); } \
void accept(ConstModelVisitor& v) const override { v.visit(*this); }
class ControllerConnection;
class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject
{
Q_OBJECT
public:
using AutoModelVector = std::vector<AutomatableModel*>;
enum class ScaleType
{
Linear,
Logarithmic,
Decibel
};
~AutomatableModel() override;
// Implement those by using the MODEL_IS_VISITABLE macro
virtual void accept(ModelVisitor& v) = 0;
virtual void accept(ConstModelVisitor& v) const = 0;
public:
/**
@brief Return this class casted to Target
@test AutomatableModelTest.cpp
@param doThrow throw an assertion if the cast fails, instead of
returning a nullptr
@return the casted class if Target is the exact or a base class of
*this, nullptr otherwise
*/
template<class Target>
Target* dynamicCast(bool doThrow = false)
{
DCastVisitor<Target> vis; accept(vis);
if (doThrow && !vis.result) { Q_ASSERT(false); }
return vis.result;
}
//! const overload, see overloaded function
template<class Target>
const Target* dynamicCast(bool doThrow = false) const
{
ConstDCastVisitor<Target> vis; accept(vis);
if (doThrow && !vis.result) { Q_ASSERT(false); }
return vis.result;
}
bool isAutomated() const;
bool isAutomatedOrControlled() const
{
return isAutomated() || m_controllerConnection != nullptr;
}
ControllerConnection* controllerConnection() const
{
return m_controllerConnection;
}
void setControllerConnection( ControllerConnection* c );
template<class T>
static T castValue( const float v )
{
return (T)( v );
}
template<bool>
static bool castValue( const float v )
{
return (std::round(v) != 0);
}
template<class T>
inline T value( int frameOffset = 0 ) const
{
if (m_controllerConnection)
{
if (!m_useControllerValue)
{
return castValue<T>(m_value);
}
else
{
return castValue<T>(controllerValue(frameOffset));
}
}
else if (hasLinkedModels())
{
return castValue<T>( controllerValue( frameOffset ) );
}
return castValue<T>( m_value );
}
float controllerValue( int frameOffset ) const;
//! @brief Function that returns sample-exact data as a ValueBuffer
//! @return pointer to model's valueBuffer when s.ex.data exists, NULL otherwise
ValueBuffer * valueBuffer();
template<class T>
T initValue() const
{
return castValue<T>( m_initValue );
}
bool isAtInitValue() const
{
return m_value == m_initValue;
}
template<class T>
T minValue() const
{
return castValue<T>( m_minValue );
}
template<class T>
T maxValue() const
{
return castValue<T>( m_maxValue );
}
template<class T>
T step() const
{
return castValue<T>( m_step );
}
//! @brief Returns value scaled with the scale type and min/max values of this model
float scaledValue( float value ) const;
//! @brief Returns value applied with the inverse of this model's scale type
float inverseScaledValue( float value ) const;
void setInitValue( const float value );
void setAutomatedValue( const float value );
void setValue( const float value );
void incValue( int steps )
{
setValue( m_value + steps * m_step );
}
float range() const
{
return m_range;
}
void setRange( const float min, const float max, const float step = 1 );
void setScaleType( ScaleType sc ) {
m_scaleType = sc;
}
void setScaleLogarithmic( bool setToTrue = true )
{
setScaleType( setToTrue ? ScaleType::Logarithmic : ScaleType::Linear );
}
bool isScaleLogarithmic() const
{
return m_scaleType == ScaleType::Logarithmic;
}
void setStep( const float step );
float centerValue() const
{
return m_centerValue;
}
void setCenterValue( const float centerVal )
{
m_centerValue = centerVal;
}
//! link @p m1 and @p m2, let @p m1 take the values of @p m2
static void linkModels( AutomatableModel* m1, AutomatableModel* m2 );
static void unlinkModels( AutomatableModel* m1, AutomatableModel* m2 );
void unlinkAllModels();
/**
* @brief Saves settings (value, automation links and controller connections) of AutomatableModel into
* specified DOM element using <name> as attribute/node name
* @param doc TODO
* @param element Where this option shall be saved.
* Depending on the model, this can be done in an attribute or in a subnode.
* @param name Name to store this model as.
*/
virtual void saveSettings( QDomDocument& doc, QDomElement& element, const QString& name );
/*! \brief Loads settings (value, automation links and controller connections) of AutomatableModel from
specified DOM element using <name> as attribute/node name */
virtual void loadSettings( const QDomElement& element, const QString& name );
QString nodeName() const override
{
return "automatablemodel";
}
virtual QString displayValue( const float val ) const = 0;
bool hasLinkedModels() const
{
return !m_linkedModels.empty();
}
// a way to track changed values in the model and avoid using signals/slots - useful for speed-critical code.
// note that this method should only be called once per period since it resets the state of the variable - so if your model
// has to be accessed by more than one object, then this function shouldn't be used.
bool isValueChanged()
{
if( m_valueChanged || valueBuffer() )
{
m_valueChanged = false;
return true;
}
return false;
}
float globalAutomationValueAt( const TimePos& time );
void setStrictStepSize( const bool b )
{
m_hasStrictStepSize = b;
}
static void incrementPeriodCounter()
{
++s_periodCounter;
}
static void resetPeriodCounter()
{
s_periodCounter = 0;
}
bool useControllerValue()
{
return m_useControllerValue;
}
public slots:
virtual void reset();
void unlinkControllerConnection();
void setUseControllerValue(bool b = true);
protected:
AutomatableModel(
const float val = 0,
const float min = 0,
const float max = 0,
const float step = 0,
Model* parent = nullptr,
const QString& displayName = QString(),
bool defaultConstructed = false );
//! returns a value which is in range between min() and
//! max() and aligned according to the step size (step size 0.05 -> value
//! 0.12345 becomes 0.10 etc.). You should always call it at the end after
//! doing your own calculations.
float fittedValue( float value ) const;
private:
// dynamicCast implementation
template<class Target>
struct DCastVisitor : public ModelVisitor
{
Target* result = nullptr;
void visit(Target& tar) { result = &tar; }
};
// dynamicCast implementation
template<class Target>
struct ConstDCastVisitor : public ConstModelVisitor
{
const Target* result = nullptr;
void visit(const Target& tar) { result = &tar; }
};
static bool mustQuoteName(const QString &name);
void saveSettings( QDomDocument& doc, QDomElement& element ) override
{
saveSettings( doc, element, "value" );
}
void loadSettings( const QDomElement& element ) override
{
loadSettings( element, "value" );
}
void linkModel( AutomatableModel* model );
void unlinkModel( AutomatableModel* model );
//! @brief Scales @value from linear to logarithmic.
//! Value should be within [0,1]
template<class T> T logToLinearScale( T value ) const;
//! rounds @a value to @a where if it is close to it
//! @param value will be modified to rounded value
template<class T> void roundAt( T &value, const T &where ) const;
ScaleType m_scaleType; //!< scale type, linear by default
float m_value;
float m_initValue;
float m_minValue;
float m_maxValue;
float m_step;
float m_range;
float m_centerValue;
bool m_valueChanged;
// currently unused?
float m_oldValue;
int m_setValueDepth;
// used to determine if step size should be applied strictly (ie. always)
// or only when value set from gui (default)
bool m_hasStrictStepSize;
AutoModelVector m_linkedModels;
//! NULL if not appended to controller, otherwise connection info
ControllerConnection* m_controllerConnection;
ValueBuffer m_valueBuffer;
long m_lastUpdatedPeriod;
static long s_periodCounter;
bool m_hasSampleExactData;
// prevent several threads from attempting to write the same vb at the same time
QMutex m_valueBufferMutex;
bool m_useControllerValue;
signals:
void initValueChanged( float val );
void destroyed( lmms::jo_id_t id );
} ;
template <typename T> class LMMS_EXPORT TypedAutomatableModel : public AutomatableModel
{
public:
using AutomatableModel::AutomatableModel;
T value( int frameOffset = 0 ) const
{
return AutomatableModel::value<T>( frameOffset );
}
T initValue() const
{
return AutomatableModel::initValue<T>();
}
T minValue() const
{
return AutomatableModel::minValue<T>();
}
T maxValue() const
{
return AutomatableModel::maxValue<T>();
}
};
// some typed AutomatableModel-definitions
class LMMS_EXPORT FloatModel : public TypedAutomatableModel<float>
{
Q_OBJECT
MODEL_IS_VISITABLE
public:
FloatModel( float val = 0, float min = 0, float max = 0, float step = 0,
Model * parent = nullptr,
const QString& displayName = QString(),
bool defaultConstructed = false ) :
TypedAutomatableModel( val, min, max, step, parent, displayName, defaultConstructed )
{
}
float getRoundedValue() const;
int getDigitCount() const;
QString displayValue( const float val ) const override;
} ;
class LMMS_EXPORT IntModel : public TypedAutomatableModel<int>
{
Q_OBJECT
MODEL_IS_VISITABLE
public:
IntModel( int val = 0, int min = 0, int max = 0,
Model* parent = nullptr,
const QString& displayName = QString(),
bool defaultConstructed = false ) :
TypedAutomatableModel( val, min, max, 1, parent, displayName, defaultConstructed )
{
}
QString displayValue( const float val ) const override;
} ;
class LMMS_EXPORT BoolModel : public TypedAutomatableModel<bool>
{
Q_OBJECT
MODEL_IS_VISITABLE
public:
BoolModel( const bool val = false,
Model* parent = nullptr,
const QString& displayName = QString(),
bool defaultConstructed = false ) :
TypedAutomatableModel( val, false, true, 1, parent, displayName, defaultConstructed )
{
}
QString displayValue( const float val ) const override;
} ;
using AutomatedValueMap = QMap<AutomatableModel*, float>;
} // namespace lmms
#endif // LMMS_AUTOMATABLE_MODEL_H
| 12,378
|
C++
|
.h
| 409
| 27.616137
| 124
| 0.73239
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,312
|
Lv2SubPluginFeatures.h
|
LMMS_lmms/include/Lv2SubPluginFeatures.h
|
/*
* Lv2SubPluginFeatures.h - derivation from
* Plugin::Descriptor::SubPluginFeatures for
* hosting LV2 plugins
*
* Copyright (c) 2018-2023 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 LMMS_LV2_SUBPLUGIN_FEATURES_H
#define LMMS_LV2_SUBPLUGIN_FEATURES_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_LV2
#include <lilv/lilv.h>
#include "lmms_export.h"
#include "Plugin.h"
namespace lmms
{
class LMMS_EXPORT Lv2SubPluginFeatures : public Plugin::Descriptor::SubPluginFeatures
{
private:
static const LilvPlugin *getPlugin(const Key &k);
static QString pluginName(const LilvPlugin *plug);
public:
Lv2SubPluginFeatures(Plugin::Type type);
void fillDescriptionWidget(
QWidget *parent, const Key *k) const override;
QString additionalFileExtensions(const Key &k) const override;
QString displayName(const Key &k) const override;
QString description(const Key &k) const override;
const PixmapLoader *logo(const Key &k) const override;
void listSubPluginKeys(
const Plugin::Descriptor *desc, KeyList &kl) const override;
};
} // namespace lmms
#endif // LMMS_HAVE_LV2
#endif // LMMS_LV2_SUBPLUGIN_FEATURES_H
| 1,990
|
C++
|
.h
| 53
| 35.54717
| 85
| 0.756377
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,313
|
InstrumentView.h
|
LMMS_lmms/include/InstrumentView.h
|
/*
* InstrumentView.h - definition of InstrumentView-class
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/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 LMMS_GUI_INSTRUMENT_VIEW_H
#define LMMS_GUI_INSTRUMENT_VIEW_H
#include "Instrument.h"
#include "PluginView.h"
namespace lmms::gui
{
class InstrumentTrackWindow;
//! Instrument view with variable size
class LMMS_EXPORT InstrumentView : public PluginView
{
public:
InstrumentView( Instrument * _instrument, QWidget * _parent );
~InstrumentView() override;
Instrument * model()
{
return( castModel<Instrument>() );
}
const Instrument * model() const
{
return( castModel<Instrument>() );
}
void setModel( Model * _model, bool = false ) override;
InstrumentTrackWindow * instrumentTrackWindow();
} ;
//! Instrument view with fixed LMMS-default size
class LMMS_EXPORT InstrumentViewFixedSize : public InstrumentView
{
QSize sizeHint() const override { return QSize(250, 250); }
QSize minimumSizeHint() const override { return sizeHint(); }
public:
using InstrumentView::InstrumentView;
~InstrumentViewFixedSize() override = default;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_INSTRUMENT_VIEW_H
| 1,969
|
C++
|
.h
| 58
| 31.913793
| 72
| 0.765204
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,314
|
MidiApple.h
|
LMMS_lmms/include/MidiApple.h
|
/*
* MidiApple.h - Apple raw MIDI client
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2015 Maurizio Lo Bosco (rageboge on github)
*
* 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 LMMS_MIDI_APPLE_H
#define LMMS_MIDI_APPLE_H
#include "lmmsconfig.h"
#ifdef LMMS_BUILD_APPLE
#include "MidiClient.h"
#include "MidiPort.h"
#include <CoreMIDI/CoreMIDI.h>
class QLineEdit;
namespace lmms
{
class MidiApple : public QObject, public MidiClient
{
Q_OBJECT
public:
MidiApple();
virtual ~MidiApple();
inline static QString probeDevice()
{
return QString(); // no midi device name
}
inline static QString name()
{
return QT_TRANSLATE_NOOP( "MidiSetupWidget", "Apple MIDI" );
}
inline static QString configSection()
{
return QString(); // no configuration settings
}
virtual void processOutEvent( const MidiEvent & _me,
const TimePos & _time,
const MidiPort * _port );
virtual void applyPortMode( MidiPort * _port );
virtual void removePort( MidiPort * _port );
// list devices as ports
virtual QStringList readablePorts() const
{
return m_inputDevices.keys();
}
virtual QStringList writablePorts() const
{
return m_outputDevices.keys();
}
// return name of port which specified MIDI event came from
virtual QString sourcePortName( const MidiEvent & ) const;
// (un)subscribe given MidiPort to/from destination-port
virtual void subscribeReadablePort( MidiPort * _port,
const QString & _dest,
bool _subscribe = true );
virtual void subscribeWritablePort( MidiPort * _port,
const QString & _dest,
bool _subscribe = true );
virtual void connectRPChanged( QObject * _receiver,
const char * _member )
{
connect( this, SIGNAL( readablePortsChanged() ),
_receiver, _member );
}
virtual void connectWPChanged( QObject * _receiver,
const char * _member )
{
connect( this, SIGNAL( writablePortsChanged() ),
_receiver, _member );
}
virtual bool isRaw() const
{
return false;
}
private:// slots:
void updateDeviceList();
private:
void openDevices();
void closeDevices();
void openMidiReference( MIDIEndpointRef reference, QString refName,bool isIn );
MIDIClientRef getMidiClientRef();
void midiInClose( MIDIEndpointRef reference );
static void NotifyCallback( const MIDINotification *message, void *refCon );
static void ReadCallback( const MIDIPacketList *pktlist, void *readProcRefCon, void *srcConnRefCon );
void HandleReadCallback( const MIDIPacketList *pktlist, void *srcConnRefCon );
void notifyMidiPortList( MidiPortList portList, MidiEvent midiEvent);
char * getFullName( MIDIEndpointRef &endpoint_ref );
void sendMidiOut( MIDIEndpointRef & endPointRef, const MidiEvent& event );
MIDIPacketList createMidiPacketList( const MidiEvent& event );
MIDIClientRef mClient = 0;
QMap<QString, MIDIEndpointRef> m_inputDevices;
QMap<QString, MIDIEndpointRef> m_outputDevices;
QMap<MIDIEndpointRef, MIDIPortRef> m_sourcePortRef;
// subscriptions
using SubMap = QMap<QString, MidiPortList>;
SubMap m_inputSubs;
SubMap m_outputSubs;
signals:
void readablePortsChanged();
void writablePortsChanged();
} ;
} // namespace lmms
#endif // LMMS_BUILD_APPLE
#endif // LMMS_MIDI_APPLE_H
| 4,046
|
C++
|
.h
| 121
| 30.661157
| 102
| 0.755533
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,315
|
EffectChain.h
|
LMMS_lmms/include/EffectChain.h
|
/*
* EffectChain.h - class for processing and effects chain
*
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/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 LMMS_EFFECT_CHAIN_H
#define LMMS_EFFECT_CHAIN_H
#include "Model.h"
#include "SerializingObject.h"
#include "AutomatableModel.h"
namespace lmms
{
class Effect;
class SampleFrame;
namespace gui
{
class EffectRackView;
} // namespace gui
class LMMS_EXPORT EffectChain : public Model, public SerializingObject
{
Q_OBJECT
public:
EffectChain( Model * _parent );
~EffectChain() override;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return "fxchain";
}
void appendEffect( Effect * _effect );
void removeEffect( Effect * _effect );
void moveDown( Effect * _effect );
void moveUp( Effect * _effect );
bool processAudioBuffer( SampleFrame* _buf, const fpp_t _frames, bool hasInputNoise );
void startRunning();
void clear();
private:
using EffectList = std::vector<Effect*>;
EffectList m_effects;
BoolModel m_enabledModel;
friend class gui::EffectRackView;
signals:
void aboutToClear();
} ;
} // namespace lmms
#endif // LMMS_EFFECT_CHAIN_H
| 2,124
|
C++
|
.h
| 66
| 30.151515
| 87
| 0.763145
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,316
|
TimePos.h
|
LMMS_lmms/include/TimePos.h
|
/*
* TimePos.h - declaration of class TimePos which provides data type for
* position- and length-variables
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_TIME_POS_H
#define LMMS_TIME_POS_H
#include <algorithm>
#include <cassert>
#include "lmms_export.h"
#include "lmms_basics.h"
namespace lmms
{
// note: a bar was erroneously called "tact" in older versions of LMMS
const int DefaultTicksPerBar = 192;
const int DefaultStepsPerBar = 16;
const int DefaultBeatsPerBar = DefaultTicksPerBar / DefaultStepsPerBar;
class MeterModel;
/**
Represents a time signature, in which the numerator is the number of beats
in a bar, while the denominator is the type of note representing a beat.
Example: 6/8 means 6 beats in a bar with each beat having a duration of one 8th-note.
*/
class LMMS_EXPORT TimeSig
{
public:
TimeSig( int num, int denom );
TimeSig( const MeterModel &model );
int numerator() const { return m_num; }
int denominator() const { return m_denom; }
private:
int m_num;
int m_denom;
};
/**
Represents a position in time or length of a note or event, in ticks, beats, and bars
*/
class LMMS_EXPORT TimePos
{
public:
TimePos( const bar_t bar, const tick_t ticks );
TimePos( const tick_t ticks = 0 );
TimePos quantize(float) const;
TimePos toAbsoluteBar() const { return getBar() * s_ticksPerBar; }
TimePos& operator+=(const TimePos& time)
{
m_ticks += time.m_ticks;
return *this;
}
TimePos& operator-=(const TimePos& time)
{
m_ticks -= time.m_ticks;
return *this;
}
// return the bar, rounded down and 0-based
bar_t getBar() const { return m_ticks / s_ticksPerBar; }
// return the bar, rounded up and 0-based
bar_t nextFullBar() const { return (m_ticks + (s_ticksPerBar - 1)) / s_ticksPerBar; }
void setTicks(tick_t ticks) { m_ticks = ticks; }
tick_t getTicks() const { return m_ticks; }
operator int() const { return m_ticks; }
tick_t ticksPerBeat(const TimeSig& sig) const { return ticksPerBar(sig) / sig.numerator(); }
// Remainder ticks after bar is removed
tick_t getTickWithinBar(const TimeSig& sig) const { return m_ticks % ticksPerBar(sig); }
// Returns the beat position inside the bar, 0-based
tick_t getBeatWithinBar(const TimeSig& sig) const { return getTickWithinBar(sig) / ticksPerBeat(sig); }
// Remainder ticks after bar and beat are removed
tick_t getTickWithinBeat(const TimeSig& sig) const { return getTickWithinBar(sig) % ticksPerBeat(sig); }
// calculate number of frame that are needed this time
f_cnt_t frames(const float framesPerTick) const
{
// Before, step notes used to have negative length. This
// assert is a safeguard against negative length being
// introduced again (now using Note Types instead #5902)
assert(m_ticks >= 0);
return static_cast<f_cnt_t>(m_ticks * framesPerTick);
}
double getTimeInMilliseconds(bpm_t beatsPerMinute) const { return ticksToMilliseconds(getTicks(), beatsPerMinute); }
static TimePos fromFrames(const f_cnt_t frames, const float framesPerTick)
{
return TimePos(static_cast<int>(frames / framesPerTick));
}
static tick_t ticksPerBar() { return s_ticksPerBar; }
static tick_t ticksPerBar(const TimeSig& sig) { return DefaultTicksPerBar * sig.numerator() / sig.denominator(); }
static int stepsPerBar() { return std::max(1, ticksPerBar() / DefaultBeatsPerBar); }
static void setTicksPerBar(tick_t ticks) { s_ticksPerBar = ticks; }
static TimePos stepPosition(int step) { return step * ticksPerBar() / stepsPerBar(); }
static double ticksToMilliseconds(tick_t ticks, bpm_t beatsPerMinute)
{
return ticksToMilliseconds(static_cast<double>(ticks), beatsPerMinute);
}
static double ticksToMilliseconds(double ticks, bpm_t beatsPerMinute) { return (ticks * 1250) / beatsPerMinute; }
private:
tick_t m_ticks;
static tick_t s_ticksPerBar;
} ;
} // namespace lmms
#endif // LMMS_TIME_POS_H
| 4,710
|
C++
|
.h
| 117
| 38.128205
| 117
| 0.749726
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,317
|
Ladspa2LMMS.h
|
LMMS_lmms/include/Ladspa2LMMS.h
|
/*
* Ladspa2LMMS.h - class that identifies and instantiates LADSPA effects
* for use with LMMS
*
* Copyright (c) 2005-2008 Danny McRae <khjklujn@netscape.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 LMMS_LADSPA_2_LMMS_H
#define LMMS_LADSPA_2_LMMS_H
#include "LadspaManager.h"
namespace lmms
{
//! Class responsible for sorting found plugins (by LadspaManager)
//! into categories
class LMMS_EXPORT Ladspa2LMMS : public LadspaManager
{
public:
inline l_sortable_plugin_t getInstruments()
{
return( m_instruments );
}
inline l_sortable_plugin_t getValidEffects()
{
return( m_validEffects );
}
inline l_sortable_plugin_t getInvalidEffects()
{
return( m_invalidEffects );
}
inline l_sortable_plugin_t getAnalysisTools()
{
return( m_analysisTools );
}
inline l_sortable_plugin_t getOthers()
{
return( m_otherPlugins );
}
QString getShortName( const ladspa_key_t & _key );
private:
Ladspa2LMMS();
~Ladspa2LMMS() override = default;
l_sortable_plugin_t m_instruments;
l_sortable_plugin_t m_validEffects;
l_sortable_plugin_t m_invalidEffects;
l_sortable_plugin_t m_analysisTools;
l_sortable_plugin_t m_otherPlugins;
friend class Engine;
} ;
} // namespace lmms
#endif // LMMS_LADSPA_2_LMMS_H
| 2,027
|
C++
|
.h
| 67
| 28.029851
| 72
| 0.752583
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,318
|
ToolButton.h
|
LMMS_lmms/include/ToolButton.h
|
/*
* ToolButton.h - declaration of class toolButton
*
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/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 LMMS_GUI_TOOL_BUTTON_H
#define LMMS_GUI_TOOL_BUTTON_H
#include <QToolButton>
namespace lmms::gui
{
class ToolButton : public QToolButton
{
Q_OBJECT
public:
ToolButton(const QPixmap & _pixmap, const QString & _tooltip,
QObject * _receiver=nullptr, const char * _slot=nullptr,
QWidget * _parent=nullptr);
inline ToolButton(QWidget * _parent) :
QToolButton(_parent)
{ }
~ToolButton() override = default;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_TOOL_BUTTON_H
| 1,421
|
C++
|
.h
| 42
| 31.785714
| 77
| 0.751095
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,319
|
LmmsStyle.h
|
LMMS_lmms/include/LmmsStyle.h
|
/*
* LmmsStyle.h - the graphical style used by LMMS to create a consistent
* interface
*
* Copyright (c) 2007-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_LMMS_STYLE_H
#define LMMS_GUI_LMMS_STYLE_H
#include <QProxyStyle>
namespace lmms::gui
{
class LmmsStyle : public QProxyStyle
{
public:
LmmsStyle();
~LmmsStyle() override = default;
QPalette standardPalette() const override;
void drawComplexControl(
ComplexControl control,
const QStyleOptionComplex * option,
QPainter *painter,
const QWidget *widget ) const override;
void drawPrimitive( PrimitiveElement element,
const QStyleOption *option,
QPainter *painter,
const QWidget *widget = 0 ) const override;
int pixelMetric( PixelMetric metric,
const QStyleOption * option = 0,
const QWidget * widget = 0 ) const override;
static QPalette * s_palette;
private:
QImage colorizeXpm( const char * const * xpm, const QBrush& fill ) const;
void hoverColors( bool sunken, bool hover, bool active, QColor& color, QColor& blend ) const;
};
} // namespace lmms::gui
#endif // LMMS_GUI_LMMS_STYLE_H
| 1,949
|
C++
|
.h
| 54
| 33.425926
| 94
| 0.74588
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,321
|
panning_constants.h
|
LMMS_lmms/include/panning_constants.h
|
/*
* panning_constants.h - declaration of some constants, concerning the
* panning of a note
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/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 LMMS_PANNING_CONSTANTS_H
#define LMMS_PANNING_CONSTANTS_H
namespace lmms
{
constexpr panning_t PanningRight = ( 0 + 100 );
constexpr panning_t PanningLeft = - PanningRight;
constexpr panning_t PanningCenter = 0;
constexpr panning_t DefaultPanning = PanningCenter;
} // namespace lmms
#endif // LMMS_PANNING_CONSTANTS_H
| 1,316
|
C++
|
.h
| 34
| 36.823529
| 77
| 0.759216
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,322
|
TrackGrip.h
|
LMMS_lmms/include/TrackGrip.h
|
/*
* TrackGrip.h - Grip that can be used to move tracks
*
* Copyright (c) 2024- Michael Gregorius
*
* 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 LMMS_GUI_TRACK_GRIP_H
#define LMMS_GUI_TRACK_GRIP_H
#include <QWidget>
class QPixmap;
namespace lmms
{
class Track;
namespace gui
{
class TrackGrip : public QWidget
{
Q_OBJECT
public:
TrackGrip(Track* track, QWidget* parent = 0);
~TrackGrip() override = default;
signals:
void grabbed();
void released();
protected:
void mousePressEvent(QMouseEvent*) override;
void mouseReleaseEvent(QMouseEvent*) override;
void paintEvent(QPaintEvent*) override;
private:
Track* m_track = nullptr;
bool m_isGrabbed = false;
static QPixmap* s_grabbedPixmap;
static QPixmap* s_releasedPixmap;
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_TRACK_GRIP_H
| 1,579
|
C++
|
.h
| 54
| 27.351852
| 70
| 0.763071
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,323
|
MidiClipView.h
|
LMMS_lmms/include/MidiClipView.h
|
/*
* MidiClipView.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_MIDI_CLIP_VIEW_H
#define LMMS_GUI_MIDI_CLIP_VIEW_H
#include <QStaticText>
#include "ClipView.h"
#include "embed.h"
namespace lmms
{
class MidiClip;
namespace gui
{
class MidiClipView : public ClipView
{
Q_OBJECT
public:
MidiClipView( MidiClip* clip, TrackView* parent );
~MidiClipView() override = default;
Q_PROPERTY(QColor noteFillColor READ getNoteFillColor WRITE setNoteFillColor)
Q_PROPERTY(QColor noteBorderColor READ getNoteBorderColor WRITE setNoteBorderColor)
Q_PROPERTY(QColor mutedNoteFillColor READ getMutedNoteFillColor WRITE setMutedNoteFillColor)
Q_PROPERTY(QColor mutedNoteBorderColor READ getMutedNoteBorderColor WRITE setMutedNoteBorderColor)
QColor const & getNoteFillColor() const { return m_noteFillColor; }
void setNoteFillColor(QColor const & color) { m_noteFillColor = color; }
QColor const & getNoteBorderColor() const { return m_noteBorderColor; }
void setNoteBorderColor(QColor const & color) { m_noteBorderColor = color; }
QColor const & getMutedNoteFillColor() const { return m_mutedNoteFillColor; }
void setMutedNoteFillColor(QColor const & color) { m_mutedNoteFillColor = color; }
QColor const & getMutedNoteBorderColor() const { return m_mutedNoteBorderColor; }
void setMutedNoteBorderColor(QColor const & color) { m_mutedNoteBorderColor = color; }
public slots:
lmms::MidiClip* getMidiClip();
void update() override;
protected slots:
void openInPianoRoll();
void setGhostInPianoRoll();
void setGhostInAutomationEditor();
void resetName();
void changeName();
void transposeSelection();
protected:
void constructContextMenu( QMenu * ) override;
void mousePressEvent( QMouseEvent * _me ) override;
void mouseDoubleClickEvent( QMouseEvent * _me ) override;
void paintEvent( QPaintEvent * pe ) override;
void wheelEvent( QWheelEvent * _we ) override;
private:
QPixmap m_stepBtnOn0 = embed::getIconPixmap("step_btn_on_0");
QPixmap m_stepBtnOn200 = embed::getIconPixmap("step_btn_on_200");
QPixmap m_stepBtnOff = embed::getIconPixmap("step_btn_off");
QPixmap m_stepBtnOffLight = embed::getIconPixmap("step_btn_off_light");
MidiClip* m_clip;
QPixmap m_paintPixmap;
QColor m_noteFillColor;
QColor m_noteBorderColor;
QColor m_mutedNoteFillColor;
QColor m_mutedNoteBorderColor;
QStaticText m_staticTextName;
bool m_legacySEPattern;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_MIDI_CLIP_VIEW_H
| 3,315
|
C++
|
.h
| 84
| 37.380952
| 99
| 0.787633
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,324
|
Editor.h
|
LMMS_lmms/include/Editor.h
|
/*
* Editor.h - declaration of Editor class
*
* Copyright (c) 2014 Lukas W <lukaswhl/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 LMMS_GUI_EDITOR_H
#define LMMS_GUI_EDITOR_H
#include <QMainWindow>
#include <QToolBar>
class QAction;
namespace lmms::gui
{
static const int Quantizations[] = {
1, 2, 4, 8, 16, 32, 64,
3, 6, 12, 24, 48, 96, 192
};
class DropToolBar;
/// \brief Superclass for editors with a toolbar.
///
/// Those editors include the Song Editor, the Automation Editor, B&B Editor,
/// and the Piano Roll.
class Editor : public QMainWindow
{
Q_OBJECT
public:
void setPauseIcon(bool displayPauseIcon=true);
QAction *playAction() const;
protected:
DropToolBar * addDropToolBarToTop(QString const & windowTitle);
DropToolBar * addDropToolBar(Qt::ToolBarArea whereToAdd, QString const & windowTitle);
DropToolBar * addDropToolBar(QWidget * parent, Qt::ToolBarArea whereToAdd, QString const & windowTitle);
void closeEvent(QCloseEvent * event) override;
protected slots:
virtual void play() {}
virtual void record() {}
virtual void recordAccompany() {}
virtual void toggleStepRecording() {}
virtual void stop() {}
private slots:
/// Called by pressing the space key. Plays or stops.
void togglePlayStop();
/// Called by pressing shift+space. Toggles pause state.
void togglePause();
void toggleMaximize();
signals:
protected:
/// \brief Constructor.
///
/// \param record If set true, the editor's toolbar will contain record
/// buttons in addition to the play and stop buttons.
Editor(bool record = false, bool record_step = false);
~Editor() override = default;
DropToolBar* m_toolBar;
QAction* m_playAction;
QAction* m_recordAction;
QAction* m_recordAccompanyAction;
QAction* m_toggleStepRecordingAction;
QAction* m_stopAction;
};
/// Small helper class: A QToolBar that accepts and exposes drop events as signals
class DropToolBar : public QToolBar
{
Q_OBJECT
public:
DropToolBar(QWidget* parent=0);
signals:
void dragEntered(QDragEnterEvent* event);
void dropped(QDropEvent* event);
protected:
void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent* event) override;
};
} // namespace lmms::gui
#endif // LMMS_GUI_EDITOR_H
| 3,002
|
C++
|
.h
| 92
| 30.717391
| 105
| 0.763258
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,325
|
Delay.h
|
LMMS_lmms/include/Delay.h
|
/*
* Delay.h - Delay effect objects to use as building blocks in DSP
*
* Copyright (c) 2014 Vesa Kivim√§ki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/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 LMMS_DELAY_H
#define LMMS_DELAY_H
#include "lmms_basics.h"
#include "lmms_math.h"
#include "interpolation.h"
namespace lmms
{
// brief usage
// Classes:
// CombFeedback: a feedback comb filter - basically a simple delay line, makes a comb shape in the freq response
// CombFeedfwd: a feed-forward comb filter - an "inverted" comb filter, can be combined with CombFeedback to create a net allpass if negative gain is used
// CombFeedbackDualtap: same as CombFeedback but takes two delay values
// AllpassDelay: an allpass delay - combines feedback and feed-forward - has flat frequency response
// all classes are templated with channel count, any arbitrary channel count can be used for each fx
// Methods (for all classes):
// setDelay sets delay amount in frames. It's up to you to make this samplerate-agnostic.
// Fractions are allowed - linear interpolation is used to deal with them
// CombFeedbackDualTap is a special case: it requires 2 delay times
// setMaxDelay (re)sets the maximum allowed delay, in frames
// NOTE: for performance reasons, there's no bounds checking at setDelay, so make sure you set maxDelay >= delay!
// clearHistory clears the delay buffer
// setGain sets the feedback/feed-forward gain, in linear amplitude, negative values are allowed
// 1.0 is full feedback/feed-forward, -1.0 is full negative feedback/feed-forward
// update runs the fx for one frame - takes as arguments input and number of channel to run, returns output
template<ch_cnt_t CHANNELS>
class CombFeedback
{
public:
using frame = std::array<double, CHANNELS>;
CombFeedback( int maxDelay ) :
m_size( maxDelay ),
m_position( 0 ),
m_feedBack( 0.0 ),
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = new frame[maxDelay];
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
virtual ~CombFeedback()
{
delete[] m_buffer;
}
inline void setMaxDelay( int maxDelay )
{
if( maxDelay > m_size )
{
delete[] m_buffer;
m_buffer = new frame[maxDelay];
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;
m_position %= m_size;
}
inline void clearHistory()
{
memset( m_buffer, 0, sizeof( frame ) * m_size );
}
inline void setDelay( double delay )
{
m_delay = static_cast<int>( ceil( delay ) );
m_fraction = 1.0 - ( delay - floor( delay ) );
}
inline void setGain( double gain )
{
m_gain = gain;
}
inline double update( double in, ch_cnt_t ch )
{
int readPos = m_position - m_delay;
if( readPos < 0 ) { readPos += m_size; }
const double y = linearInterpolate( m_buffer[readPos][ch], m_buffer[( readPos + 1 ) % m_size][ch], m_fraction );
++m_position %= m_size;
m_buffer[m_position][ch] = in + m_gain * y;
return y;
}
private:
frame * m_buffer;
int m_size;
int m_position;
double m_gain;
int m_delay;
double m_fraction;
};
template<ch_cnt_t CHANNELS>
class CombFeedfwd
{
using frame = std::array<double, CHANNELS>;
CombFeedfwd( int maxDelay ) :
m_size( maxDelay ),
m_position( 0 ),
m_feedBack( 0.0 ),
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = new frame[maxDelay];
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
virtual ~CombFeedfwd()
{
delete[] m_buffer;
}
inline void setMaxDelay( int maxDelay )
{
if( maxDelay > m_size )
{
delete[] m_buffer;
m_buffer = new frame[maxDelay];
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;
m_position %= m_size;
}
inline void clearHistory()
{
memset( m_buffer, 0, sizeof( frame ) * m_size );
}
inline void setDelay( double delay )
{
m_delay = static_cast<int>( ceil( delay ) );
m_fraction = 1.0 - ( delay - floor( delay ) );
}
inline void setGain( double gain )
{
m_gain = gain;
}
inline double update( double in, ch_cnt_t ch )
{
int readPos = m_position - m_delay;
if( readPos < 0 ) { readPos += m_size; }
const double y = linearInterpolate( m_buffer[readPos][ch], m_buffer[( readPos + 1 ) % m_size][ch], m_fraction ) + in * m_gain;
++m_position %= m_size;
m_buffer[m_position][ch] = in;
return y;
}
private:
frame * m_buffer;
int m_size;
int m_position;
double m_gain;
int m_delay;
double m_fraction;
};
template<ch_cnt_t CHANNELS>
class CombFeedbackDualtap
{
using frame = std::array<double, CHANNELS>;
CombFeedbackDualtap( int maxDelay ) :
m_size( maxDelay ),
m_position( 0 ),
m_feedBack( 0.0 ),
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = new frame[maxDelay];
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
virtual ~CombFeedbackDualtap()
{
delete[] m_buffer;
}
inline void setMaxDelay( int maxDelay )
{
if( maxDelay > m_size )
{
delete[] m_buffer;
m_buffer = new frame[maxDelay];
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;
m_position %= m_size;
}
inline void clearHistory()
{
memset( m_buffer, 0, sizeof( frame ) * m_size );
}
inline void setDelays( double delay1, double delay2 )
{
m_delay1 = static_cast<int>( ceil( delay1 ) );
m_fraction1 = 1.0 - ( delay1 - floor( delay1 ) );
m_delay2 = static_cast<int>( ceil( delay2 ) );
m_fraction2 = 1.0 - ( delay2 - floor( delay2 ) );
}
inline void setGain( double gain )
{
m_gain = gain;
}
inline double update( double in, ch_cnt_t ch )
{
int readPos1 = m_position - m_delay1;
if( readPos1 < 0 ) { readPos1 += m_size; }
int readPos2 = m_position - m_delay2;
if( readPos2 < 0 ) { readPos2 += m_size; }
const double y = linearInterpolate( m_buffer[readPos1][ch], m_buffer[( readPos1 + 1 ) % m_size][ch], m_fraction1 ) +
linearInterpolate( m_buffer[readPos2][ch], m_buffer[( readPos2 + 1 ) % m_size][ch], m_fraction2 );
++m_position %= m_size;
m_buffer[m_position][ch] = in + m_gain * y;
return y;
}
private:
frame * m_buffer;
int m_size;
int m_position;
double m_gain;
int m_delay1;
int m_delay2;
double m_fraction1;
double m_fraction2;
};
template<ch_cnt_t CHANNELS>
class AllpassDelay
{
public:
using frame = std::array<double, CHANNELS>;
AllpassDelay( int maxDelay ) :
m_size( maxDelay ),
m_position( 0 ),
m_feedBack( 0.0 ),
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = new frame[maxDelay];
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
virtual ~AllpassDelay()
{
delete[] m_buffer;
}
inline void setMaxDelay( int maxDelay )
{
if( maxDelay > m_size )
{
delete[] m_buffer;
m_buffer = new frame[maxDelay];
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;
m_position %= m_size;
}
inline void clearHistory()
{
memset( m_buffer, 0, sizeof( frame ) * m_size );
}
inline void setDelay( double delay )
{
m_delay = static_cast<int>( ceil( delay ) );
m_fraction = 1.0 - ( delay - floor( delay ) );
}
inline void setGain( double gain )
{
m_gain = gain;
}
inline double update( double in, ch_cnt_t ch )
{
int readPos = m_position - m_delay;
if( readPos < 0 ) { readPos += m_size; }
const double y = linearInterpolate( m_buffer[readPos][ch], m_buffer[( readPos + 1 ) % m_size][ch], m_fraction ) + in * -m_gain;
const double x = in + m_gain * y;
++m_position %= m_size;
m_buffer[m_position][ch] = x;
return y;
}
private:
frame * m_buffer;
int m_size;
int m_position;
double m_gain;
int m_delay;
double m_fraction;
};
// convenience typedefs for stereo effects
using StereoCombFeedback = CombFeedback<2>;
using StereoCombFeedfwd = CombFeedfwd<2>;
using StereoCombFeedbackDualtap = CombFeedbackDualtap<2>;
using StereoAllpassDelay = AllpassDelay<2>;
} // namespace lmms
#endif // LMMS_DELAY_H
| 8,642
|
C++
|
.h
| 301
| 26.093023
| 154
| 0.69069
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,326
|
SamplePlayHandle.h
|
LMMS_lmms/include/SamplePlayHandle.h
|
/*
* SamplePlayHandle.h - play-handle for playing a sample
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_SAMPLE_PLAY_HANDLE_H
#define LMMS_SAMPLE_PLAY_HANDLE_H
#include "Sample.h"
#include "SampleBuffer.h"
#include "AutomatableModel.h"
#include "PlayHandle.h"
namespace lmms
{
class PatternTrack;
class SampleClip;
class Track;
class AudioPort;
class LMMS_EXPORT SamplePlayHandle : public PlayHandle
{
public:
SamplePlayHandle(Sample* sample, bool ownAudioPort = true);
SamplePlayHandle( const QString& sampleFile );
SamplePlayHandle( SampleClip* clip );
~SamplePlayHandle() override;
inline bool affinityMatters() const override
{
return true;
}
void play( SampleFrame* buffer ) override;
bool isFinished() const override;
bool isFromTrack( const Track * _track ) const override;
f_cnt_t totalFrames() const;
inline f_cnt_t framesDone() const
{
return( m_frame );
}
void setDoneMayReturnTrue( bool _enable )
{
m_doneMayReturnTrue = _enable;
}
void setPatternTrack(PatternTrack* pt)
{
m_patternTrack = pt;
}
void setVolumeModel( FloatModel * _model )
{
m_volumeModel = _model;
}
private:
Sample* m_sample;
bool m_doneMayReturnTrue;
f_cnt_t m_frame;
Sample::PlaybackState m_state;
const bool m_ownAudioPort;
FloatModel m_defaultVolumeModel;
FloatModel * m_volumeModel;
Track * m_track;
PatternTrack* m_patternTrack;
} ;
} // namespace lmms
#endif // LMMS_SAMPLE_PLAY_HANDLE_H
| 2,285
|
C++
|
.h
| 79
| 26.797468
| 77
| 0.766621
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,327
|
JournallingObject.h
|
LMMS_lmms/include/JournallingObject.h
|
/*
* JournallingObject.h - declaration of class JournallingObject
*
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/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 LMMS_JOURNALLING_OBJECT_H
#define LMMS_JOURNALLING_OBJECT_H
#include <QStack>
#include "lmms_basics.h"
#include "SerializingObject.h"
namespace lmms
{
class LMMS_EXPORT JournallingObject : public SerializingObject
{
public:
JournallingObject();
~JournallingObject() override;
inline jo_id_t id() const
{
return m_id;
}
void saveJournallingState( const bool newState )
{
m_journallingStateStack.push( m_journalling );
m_journalling = newState;
}
void restoreJournallingState()
{
if( !isJournallingStateStackEmpty())
{
m_journalling = m_journallingStateStack.pop();
}
}
void addJournalCheckPoint();
QDomElement saveState( QDomDocument & _doc,
QDomElement & _parent ) override;
void restoreState( const QDomElement & _this ) override;
inline bool isJournalling() const
{
return m_journalling;
}
inline void setJournalling( const bool _sr )
{
m_journalling = _sr;
}
inline bool testAndSetJournalling( const bool newState )
{
const bool oldJournalling = m_journalling;
m_journalling = newState;
return oldJournalling;
}
bool isJournallingStateStackEmpty() const
{
return m_journallingStateStack.isEmpty();
}
protected:
void changeID( jo_id_t _id );
private:
jo_id_t m_id;
bool m_journalling;
QStack<bool> m_journallingStateStack;
} ;
} // namespace lmms
#endif // LMMS_JOURNALLING_OBJECT_H
| 2,325
|
C++
|
.h
| 82
| 25.987805
| 77
| 0.763407
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,328
|
Knob.h
|
LMMS_lmms/include/Knob.h
|
/*
* Knob.h - powerful knob-widget
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/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 LMMS_GUI_KNOB_H
#define LMMS_GUI_KNOB_H
#include <memory>
#include <QTextDocument>
#include "FloatModelEditorBase.h"
class QPixmap;
namespace lmms::gui
{
class SimpleTextFloat;
enum class KnobType
{
Dark28, Bright26, Small17, Vintage32, Styled
} ;
void convertPixmapToGrayScale(QPixmap &pixMap);
class LMMS_EXPORT Knob : public FloatModelEditorBase
{
Q_OBJECT
Q_ENUMS( KnobType )
Q_PROPERTY(float innerRadius READ innerRadius WRITE setInnerRadius)
Q_PROPERTY(float outerRadius READ outerRadius WRITE setOuterRadius)
Q_PROPERTY(float centerPointX READ centerPointX WRITE setCenterPointX)
Q_PROPERTY(float centerPointY READ centerPointY WRITE setCenterPointY)
Q_PROPERTY(float lineWidth READ lineWidth WRITE setLineWidth)
// Unfortunately, the gradient syntax doesn't create our gradient
// correctly so we need to do this:
Q_PROPERTY(QColor outerColor READ outerColor WRITE setOuterColor)
Q_PROPERTY(QColor lineActiveColor MEMBER m_lineActiveColor)
Q_PROPERTY(QColor lineInactiveColor MEMBER m_lineInactiveColor)
Q_PROPERTY(QColor arcActiveColor MEMBER m_arcActiveColor)
Q_PROPERTY(QColor arcInactiveColor MEMBER m_arcInactiveColor)
Q_PROPERTY(KnobType knobNum READ knobNum WRITE setknobNum)
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
void initUi( const QString & _name ); //!< to be called by ctors
void onKnobNumUpdated(); //!< to be called when you updated @a m_knobNum
public:
Knob( KnobType _knob_num, QWidget * _parent = nullptr, const QString & _name = QString() );
Knob( QWidget * _parent = nullptr, const QString & _name = QString() ); //!< default ctor
Knob( const Knob& other ) = delete;
void setLabel( const QString & txt );
void setHtmlLabel( const QString &htmltxt );
void setTotalAngle( float angle );
// Begin styled knob accessors
float innerRadius() const;
void setInnerRadius( float r );
float outerRadius() const;
void setOuterRadius( float r );
KnobType knobNum() const;
void setknobNum( KnobType k );
QPointF centerPoint() const;
float centerPointX() const;
void setCenterPointX( float c );
float centerPointY() const;
void setCenterPointY( float c );
float lineWidth() const;
void setLineWidth( float w );
QColor outerColor() const;
void setOuterColor( const QColor & c );
QColor textColor() const;
void setTextColor( const QColor & c );
protected:
void paintEvent( QPaintEvent * _me ) override;
void changeEvent(QEvent * ev) override;
private:
QLineF calculateLine( const QPointF & _mid, float _radius,
float _innerRadius = 1) const;
void drawKnob( QPainter * _p );
bool updateAngle();
int angleFromValue( float value, float minValue, float maxValue, float totalAngle ) const
{
return static_cast<int>( ( value - 0.5 * ( minValue + maxValue ) ) / ( maxValue - minValue ) * m_totalAngle ) % 360;
}
QString m_label;
bool m_isHtmlLabel;
QTextDocument* m_tdRenderer;
std::unique_ptr<QPixmap> m_knobPixmap;
float m_totalAngle;
int m_angle;
QImage m_cache;
// Styled knob stuff, could break out
QPointF m_centerPoint;
float m_innerRadius;
float m_outerRadius;
float m_lineWidth;
QColor m_outerColor;
QColor m_lineActiveColor;
QColor m_lineInactiveColor;
QColor m_arcActiveColor;
QColor m_arcInactiveColor;
QColor m_textColor;
KnobType m_knobNum;
};
} // namespace lmms::gui
#endif // LMMS_GUI_KNOB_H
| 4,282
|
C++
|
.h
| 116
| 34.637931
| 118
| 0.773191
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,329
|
EnvelopeAndLfoView.h
|
LMMS_lmms/include/EnvelopeAndLfoView.h
|
/*
* EnvelopeAndLfoView.h - declaration of class EnvelopeAndLfoView which
* is used by envelope/lfo/filter-tab of instrument track
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/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 LMMS_GUI_ENVELOPE_AND_LFO_VIEW_H
#define LMMS_GUI_ENVELOPE_AND_LFO_VIEW_H
#include <QWidget>
#include "ModelView.h"
namespace lmms
{
class EnvelopeAndLfoParameters;
namespace gui
{
class automatableButtonGroup;
class Knob;
class LedCheckBox;
class PixmapButton;
class TempoSyncKnob;
class EnvelopeGraph;
class LfoGraph;
class EnvelopeAndLfoView : public QWidget, public ModelView
{
Q_OBJECT
public:
EnvelopeAndLfoView( QWidget * _parent );
~EnvelopeAndLfoView() override;
protected:
void modelChanged() override;
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;
protected slots:
void lfoUserWaveChanged();
private:
EnvelopeAndLfoParameters * m_params;
// envelope stuff
EnvelopeGraph* m_envelopeGraph;
Knob * m_predelayKnob;
Knob * m_attackKnob;
Knob * m_holdKnob;
Knob * m_decayKnob;
Knob * m_sustainKnob;
Knob * m_releaseKnob;
Knob * m_amountKnob;
// LFO stuff
LfoGraph* m_lfoGraph;
Knob * m_lfoPredelayKnob;
Knob * m_lfoAttackKnob;
TempoSyncKnob * m_lfoSpeedKnob;
Knob * m_lfoAmountKnob;
PixmapButton * m_userLfoBtn;
automatableButtonGroup * m_lfoWaveBtnGrp;
LedCheckBox * m_x100Cb;
LedCheckBox * m_controlEnvAmountCb;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_ENVELOPE_AND_LFO_VIEW_H
| 2,349
|
C++
|
.h
| 77
| 28.558442
| 80
| 0.772343
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,330
|
LocklessRingBuffer.h
|
LMMS_lmms/include/LocklessRingBuffer.h
|
/*
* LocklessRingBuffer.h - LMMS wrapper for a lockless ringbuffer library
*
* Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/dot/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 LMMS_LOCKLESS_RING_BUFFER_H
#define LMMS_LOCKLESS_RING_BUFFER_H
#include <QMutex>
#include <QWaitCondition>
#include <ringbuffer/ringbuffer.h>
#include "lmms_basics.h"
namespace lmms
{
//! A convenience layer for a realtime-safe and thread-safe multi-reader ringbuffer
template <class T>
class LocklessRingBuffer
{
template<class _T>
friend class LocklessRingBufferReader;
public:
LocklessRingBuffer(std::size_t sz) : m_buffer(sz)
{
m_buffer.touch(); // reserve storage space before realtime operation starts
}
~LocklessRingBuffer() = default;
std::size_t capacity() const {return m_buffer.maximum_eventual_write_space();}
std::size_t free() const {return m_buffer.write_space();}
void wakeAll() {m_notifier.wakeAll();}
std::size_t write(const T *src, std::size_t cnt, bool notify = false)
{
std::size_t written = LocklessRingBuffer<T>::m_buffer.write(src, cnt);
// Let all waiting readers know new data are available.
if (notify) {LocklessRingBuffer<T>::m_notifier.wakeAll();}
return written;
}
void mlock() { m_buffer.mlock(); }
protected:
ringbuffer_t<T> m_buffer;
QWaitCondition m_notifier;
};
//! Wrapper for lockless ringbuffer reader
template <class T>
class LocklessRingBufferReader : public ringbuffer_reader_t<T>
{
public:
LocklessRingBufferReader(LocklessRingBuffer<T> &rb) :
ringbuffer_reader_t<T>(rb.m_buffer),
m_notifier(&rb.m_notifier) {};
bool empty() const {return !this->read_space();}
void waitForData()
{
QMutex useless_lock;
useless_lock.lock();
m_notifier->wait(&useless_lock);
useless_lock.unlock();
}
private:
QWaitCondition *m_notifier;
};
} // namespace lmms
#endif // LMMS_LOCKLESS_RING_BUFFER_H
| 2,629
|
C++
|
.h
| 79
| 31.278481
| 83
| 0.753943
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,331
|
Pitch.h
|
LMMS_lmms/include/Pitch.h
|
/*
* Pitch.h - declaration of some constants and types concerning instrument pitch
*
* Copyright (c) 2014 Tobias Doerffel <tobydox/at/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 LMMS_PITCH_H
#define LMMS_PITCH_H
#include <cstdint>
namespace lmms
{
using pitch_t = int16_t;
constexpr pitch_t CentsPerSemitone = 100;
constexpr pitch_t MinPitchDefault = -CentsPerSemitone;
constexpr pitch_t MaxPitchDefault = CentsPerSemitone;
constexpr pitch_t DefaultPitch = 0;
} // namespace lmms
#endif // LMMS_PITCH_H
| 1,295
|
C++
|
.h
| 35
| 35.142857
| 80
| 0.769169
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,332
|
MidiSndio.h
|
LMMS_lmms/include/MidiSndio.h
|
/*
* MidiSndio.h - base-class that implements sndio midi support
*
* Copyright (c) 2010-2016 jackmsr@openbsd.net
* Copyright (c) 2016-2017 David Carlier <devnexen@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 LMMS_MIDI_SNDIO_H
#define LMMS_MIDI_SNDIO_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_SNDIO
#include <QThread>
#include "MidiClient.h"
struct mio_hdl;
namespace lmms
{
class MidiSndio : public QThread, public MidiClientRaw
{
Q_OBJECT
public:
MidiSndio();
~MidiSndio() override;
static QString probeDevice();
inline static QString name()
{
return QT_TRANSLATE_NOOP("MidiSetupWidget", "sndio MIDI");
}
inline static QString configSection()
{
return "MidiSndio";
}
protected:
void sendByte(const unsigned char c) override;
void run() override;
private:
mio_hdl *m_hdl;
volatile bool m_quit;
} ;
} // namespace lmms
#endif // LMMS_HAVE_SNDIO
#endif // LMMS_MIDI_SNDIO_H
| 1,683
|
C++
|
.h
| 58
| 26.965517
| 70
| 0.758255
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,333
|
ValueBuffer.h
|
LMMS_lmms/include/ValueBuffer.h
|
/*
* ValueBuffer.h - a container class for passing buffers of model values around
*
* Copyright (c) 2014 Vesa Kivim√§ki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/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 LMMS_VALUE_BUFFER_H
#define LMMS_VALUE_BUFFER_H
#include <vector>
#include "lmms_export.h"
namespace lmms
{
class LMMS_EXPORT ValueBuffer : public std::vector<float>
{
public:
ValueBuffer() = default;
ValueBuffer(int length);
void fill(float value);
float value(int offset ) const;
const float * values() const;
float * values();
int length() const;
void interpolate(float start, float end);
};
} // namespace lmms
#endif // LMMS_VALUE_BUFFER_H
| 1,505
|
C++
|
.h
| 44
| 32.159091
| 79
| 0.753804
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,334
|
TrackContainer.h
|
LMMS_lmms/include/TrackContainer.h
|
/*
* TrackContainer.h - base-class for all track-containers like Song-Editor,
* Pattern Editor...
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/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 LMMS_TRACK_CONTAINER_H
#define LMMS_TRACK_CONTAINER_H
#include <QReadWriteLock>
#include "Track.h"
#include "JournallingObject.h"
namespace lmms
{
class AutomationClip;
class InstrumentTrack;
namespace gui
{
class TrackContainerView;
}
class LMMS_EXPORT TrackContainer : public Model, public JournallingObject
{
Q_OBJECT
public:
using TrackList = std::vector<Track*>;
enum class Type
{
Pattern,
Song
} ;
TrackContainer();
~TrackContainer() override;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
int countTracks( Track::Type _tt = Track::Type::Count ) const;
void addTrack( Track * _track );
void removeTrack( Track * _track );
virtual void updateAfterTrackAdd();
void clearAllTracks();
const TrackList & tracks() const
{
return m_tracks;
}
bool isEmpty() const;
static const QString classNodeName()
{
return "trackcontainer";
}
inline void setType( Type newType )
{
m_TrackContainerType = newType;
}
inline Type type() const
{
return m_TrackContainerType;
}
virtual AutomatedValueMap automatedValuesAt(TimePos time, int clipNum = -1) const;
signals:
void trackAdded( lmms::Track * _track );
protected:
static AutomatedValueMap automatedValuesFromTracks(const TrackList &tracks, TimePos timeStart, int clipNum = -1);
mutable QReadWriteLock m_tracksMutex;
private:
TrackList m_tracks;
Type m_TrackContainerType;
friend class gui::TrackContainerView;
friend class Track;
} ;
} // namespace lmms
#endif // LMMS_TRACK_CONTAINER_H
| 2,594
|
C++
|
.h
| 87
| 27.62069
| 114
| 0.76385
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,335
|
MidiSetupWidget.h
|
LMMS_lmms/include/MidiSetupWidget.h
|
/*
* MidiSetupWidget - class for configuring midi sources in the settings window
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_GUI_MIDI_SETUP_WIDGET_H
#define LMMS_GUI_MIDI_SETUP_WIDGET_H
#include <QGroupBox>
class QLineEdit;
namespace lmms::gui
{
class MidiSetupWidget : public QGroupBox
{
Q_OBJECT
MidiSetupWidget( const QString & caption, const QString & configSection,
const QString & devName, QWidget * parent );
public:
// create a widget with editors for all of @MidiClientType's fields
template <typename MidiClientType> static MidiSetupWidget* create( QWidget * parent )
{
QString configSection = MidiClientType::configSection();
QString dev = MidiClientType::probeDevice();
return new MidiSetupWidget(MidiClientType::name(), configSection, dev, parent);
}
void saveSettings();
void show();
private:
QString m_configSection;
QLineEdit *m_device;
};
} // namespace lmms::gui
#endif // LMMS_GUI_MIDI_SETUP_WIDGET_H
| 1,795
|
C++
|
.h
| 50
| 33.86
| 86
| 0.768609
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
20,336
|
PatternStore.h
|
LMMS_lmms/include/PatternStore.h
|
/*
* PatternStore.h - model-component of Pattern Editor
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_PATTERN_STORE_H
#define LMMS_PATTERN_STORE_H
#include "TrackContainer.h"
#include "ComboBoxModel.h"
namespace lmms
{
namespace gui
{
class PatternEditorWindow;
}
/*
* PatternStore is the backend of Pattern Editor:
*
* +----------------------------------+
* | PatternStore (TrackContainer) |
* | |
* | +------------------------------+ |
* | | Track 1 [Clip A] [Clip B] | |
* | +------------------------------+ |
* | |
* | +------------------------------+ |
* | | Track 2 [Clip C] [Clip D] | |
* | +------------------------------+ |
* +----------------------------------+
*
* There is only one PatternStore which holds all patterns, and it's very similar to the Song Editor.
* Think of it as a table - tracks are rows, bars are columns and clips are cells.
* With this logic a "pattern" is a column, i.e. all clips on the same bar.
* In the Pattern Editor you can select which pattern (column) you want to see, using the combo box at the top.
* In the illustration above, Clip A and Clip C start on bar 1, thus they are "Pattern 1".
*
* Do not confuse tracks and clips in the PatternStore with PatternTracks and PatternClips.
* - PatternTracks are used in the Song Editor. Each one reference a "pattern" in the PatternStore.
* - PatternClips are stored inside PatternTracks. They are just empty placeholders.
*/
class LMMS_EXPORT PatternStore : public TrackContainer
{
Q_OBJECT
mapPropertyFromModel(int, currentPattern, setCurrentPattern, m_patternComboBoxModel);
public:
PatternStore();
~PatternStore() override = default;
virtual bool play(TimePos start, const fpp_t frames, const f_cnt_t frameBase, int clipNum = -1);
void updateAfterTrackAdd() override;
inline QString nodeName() const override
{
return "patternstore";
}
bar_t lengthOfPattern(int pattern) const;
inline bar_t lengthOfCurrentPattern()
{
return lengthOfPattern(currentPattern());
}
int numOfPatterns() const;
void removePattern(int pattern);
void swapPattern(int p1, int p2);
void updatePatternTrack(Clip* clip);
void fixIncorrectPositions();
void createClipsForPattern(int pattern);
AutomatedValueMap automatedValuesAt(TimePos time, int clipNum) const override;
public slots:
void play();
void stop();
void updateComboBox();
void currentPatternChanged();
private:
ComboBoxModel m_patternComboBoxModel;
// Where the pattern selection combo box is
friend class gui::PatternEditorWindow;
} ;
} // namespace lmms
#endif // LMMS_PATTERN_STORE_H
| 3,506
|
C++
|
.h
| 95
| 34.863158
| 111
| 0.694395
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,337
|
LfoController.h
|
LMMS_lmms/include/LfoController.h
|
/*
* LfoController.h - A LFO-based controller and dialog
*
* Copyright (c) 2008 Paul Giblock <drfaygo/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 LMMS_LFO_CONTROLLER_H
#define LMMS_LFO_CONTROLLER_H
#include <QWidget>
#include "Model.h"
#include "AutomatableModel.h"
#include "Controller.h"
#include "ControllerDialog.h"
#include "TempoSyncKnobModel.h"
#include "Oscillator.h"
namespace lmms
{
namespace gui
{
class automatableButtonGroup;
class LedCheckBox;
class PixmapButton;
class Knob;
class TempoSyncKnob;
class LfoControllerDialog;
}
class LfoController : public Controller
{
Q_OBJECT
public:
LfoController( Model * _parent );
~LfoController() override;
void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
void loadSettings( const QDomElement & _this ) override;
QString nodeName() const override;
public slots:
gui::ControllerDialog * createDialog( QWidget * _parent ) override;
protected:
// The internal per-controller value updating function
void updateValueBuffer() override;
FloatModel m_baseModel;
TempoSyncKnobModel m_speedModel;
FloatModel m_amountModel;
FloatModel m_phaseModel;
IntModel m_waveModel;
IntModel m_multiplierModel;
float m_duration;
float m_phaseOffset;
float m_currentPhase;
sample_t (*m_sampleFunction)( const float );
private:
float m_heldSample;
std::shared_ptr<const SampleBuffer> m_userDefSampleBuffer = SampleBuffer::emptyBuffer();
protected slots:
void updatePhase();
void updateSampleFunction();
void updateDuration();
friend class gui::LfoControllerDialog;
} ;
namespace gui
{
class LfoControllerDialog : public ControllerDialog
{
Q_OBJECT
public:
LfoControllerDialog( Controller * _controller, QWidget * _parent );
~LfoControllerDialog() override;
protected:
void contextMenuEvent( QContextMenuEvent * _me ) override;
void modelChanged() override;
LfoController * m_lfo;
Knob * m_baseKnob;
TempoSyncKnob * m_speedKnob;
Knob * m_amountKnob;
Knob * m_phaseKnob;
PixmapButton * m_userLfoBtn;
automatableButtonGroup * m_waveBtnGrp;
automatableButtonGroup * m_multiplierBtnGrp;
private:
PixmapButton * m_userWaveBtn;
private slots:
void askUserDefWave();
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_LFO_CONTROLLER_H
| 3,039
|
C++
|
.h
| 103
| 27.533981
| 89
| 0.787513
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,338
|
Model.h
|
LMMS_lmms/include/Model.h
|
/*
* Model.h - declaration of Model base class
*
* Copyright (c) 2007-2014 Tobias Doerffel <tobydox/at/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 LMMS_MODEL_H
#define LMMS_MODEL_H
#include <QString>
#include <QObject>
#include "lmms_export.h"
namespace lmms
{
class LMMS_EXPORT Model : public QObject
{
Q_OBJECT
public:
Model(Model* parent, QString displayName = QString(),
bool defaultConstructed = false);
~Model() override = default;
bool isDefaultConstructed() const;
Model* parentModel() const;
virtual QString displayName() const;
virtual void setDisplayName(const QString& displayName);
virtual QString fullDisplayName() const;
private:
QString m_displayName;
bool m_defaultConstructed;
signals:
// emitted if actual data of the model (e.g. values) have changed
void dataChanged();
// emitted in case new data was not set as it's been equal to old data
void dataUnchanged();
// emitted if properties of the model (e.g. ranges) have changed
void propertiesChanged();
} ;
} // namespace lmms
#endif // LMMS_MODEL_H
| 1,846
|
C++
|
.h
| 55
| 31.418182
| 77
| 0.762147
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,339
|
ThreadableJob.h
|
LMMS_lmms/include/ThreadableJob.h
|
/*
* ThreadableJob.h - declaration of class ThreadableJob
*
* Copyright (c) 2009-2014 Tobias Doerffel <tobydox/at/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 LMMS_THREADABLE_JOB_H
#define LMMS_THREADABLE_JOB_H
#include "lmms_basics.h"
#include <atomic>
namespace lmms
{
class ThreadableJob
{
public:
enum class ProcessingState : int
{
Unstarted,
Queued,
InProgress,
Done
};
ThreadableJob() :
m_state(ProcessingState::Unstarted)
{
}
inline ProcessingState state() const
{
return m_state.load();
}
inline void reset()
{
m_state = ProcessingState::Unstarted;
}
inline void queue()
{
m_state = ProcessingState::Queued;
}
inline void done()
{
m_state = ProcessingState::Done;
}
void process()
{
auto expected = ProcessingState::Queued;
if (m_state.compare_exchange_strong(expected, ProcessingState::InProgress))
{
doProcessing();
m_state = ProcessingState::Done;
}
}
virtual bool requiresProcessing() const = 0;
protected:
virtual void doProcessing() = 0;
std::atomic<ProcessingState> m_state;
} ;
} // namespace lmms
#endif // LMMS_THREADABLE_JOB_H
| 1,904
|
C++
|
.h
| 75
| 23.093333
| 77
| 0.748066
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,340
|
AutomationNode.h
|
LMMS_lmms/include/AutomationNode.h
|
/*
* AutomationNode.h - Declaration of class AutomationNode, which contains
* all information about an automation node
*
* Copyright (c) 2020 Ian Caio <iancaio_dev/at/hotmail.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 LMMS_AUTOMATION_NODE_H
#define LMMS_AUTOMATION_NODE_H
namespace lmms
{
class AutomationClip;
// Note: We use the default copy-assignment on the AutomationClip constructor. It's
// fine for now as we don't have dynamic allocated members, but if any are added we should
// have an user-defined one to perform a deep-copy.
class AutomationNode
{
public:
AutomationNode(); // Dummy constructor for the QMap
AutomationNode(AutomationClip* clip, float value, int pos);
AutomationNode(AutomationClip* clip, float inValue, float outValue, int pos);
AutomationNode& operator+=(float f)
{
m_inValue += f;
m_outValue += f;
return *this;
}
AutomationNode& operator-=(float f)
{
m_inValue -= f;
m_outValue -= f;
return *this;
}
AutomationNode& operator*=(float f)
{
m_inValue *= f;
m_outValue *= f;
return *this;
}
AutomationNode& operator/=(float f)
{
m_inValue /= f;
m_outValue /= f;
return *this;
}
inline const float getInValue() const
{
return m_inValue;
}
void setInValue(float value);
inline const float getOutValue() const
{
return m_outValue;
}
void setOutValue(float value);
void resetOutValue();
/**
* @brief Gets the offset between inValue and outValue
* @return Float representing the offset between inValue and outValue
*/
inline const float getValueOffset() const
{
return m_outValue - m_inValue;
}
/**
* @brief Gets the tangent of the left side of the node
* @return Float with the tangent from the inValue side
*/
inline const float getInTangent() const
{
return m_inTangent;
}
/**
* @brief Sets the tangent of the left side of the node
* @param Float with the tangent for the inValue side
*/
inline void setInTangent(float tangent)
{
m_inTangent = tangent;
}
/**
* @brief Gets the tangent of the right side of the node
* @return Float with the tangent from the outValue side
*/
inline const float getOutTangent() const
{
return m_outTangent;
}
/**
* @brief Sets the tangent of the right side of the node
* @param Float with the tangent for the outValue side
*/
inline void setOutTangent(float tangent)
{
m_outTangent = tangent;
}
/**
* @brief Checks if the tangents from the node are locked
*/
inline const bool lockedTangents() const
{
return m_lockedTangents;
}
/**
* @brief Locks or Unlocks the tangents from this node
*/
inline void setLockedTangents(bool b)
{
m_lockedTangents = b;
}
/**
* @brief Sets the clip this node belongs to
* @param AutomationClip* clip that m_clip will be
* set to
*/
inline void setClip(AutomationClip* clip)
{
m_clip = clip;
}
private:
// Clip that this node belongs to
AutomationClip* m_clip;
// Time position of this node (matches the timeMap key)
int m_pos;
// Values of this node
float m_inValue;
float m_outValue;
// Slope at each point for calculating spline
// We might have discrete jumps between curves, so we possibly have
// two different tangents for each side of the curve. If inValue and
// outValue are equal, inTangent and outTangent are equal too.
float m_inTangent;
float m_outTangent;
// If the tangents were edited manually, this will be true. That way
// the tangents from this node will not be recalculated. It's set back
// to false if the tangents are reset.
bool m_lockedTangents;
};
} // namespace lmms
#endif // LMMS_AUTOMATION_NODE_H
| 4,394
|
C++
|
.h
| 157
| 25.656051
| 90
| 0.73588
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,341
|
EffectControls.h
|
LMMS_lmms/include/EffectControls.h
|
/*
* EffectControls.h - model for effect-controls
*
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/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 LMMS_EFFECT_CONTROLS_H
#define LMMS_EFFECT_CONTROLS_H
#include "Model.h"
#include "JournallingObject.h"
#include "Effect.h"
namespace lmms
{
namespace gui
{
class EffectControlDialog;
} // namespace gui
class EffectControls : public JournallingObject, public Model
{
public:
EffectControls( Effect * _eff ) :
JournallingObject(),
Model( _eff ),
m_effect( _eff ),
m_viewVisible( false )
{
}
~EffectControls() override = default;
virtual int controlCount() = 0;
virtual gui::EffectControlDialog * createView() = 0;
void setViewVisible( bool _visible )
{
m_viewVisible = _visible;
}
bool isViewVisible() const
{
return m_viewVisible;
}
Effect * effect()
{
return m_effect;
}
private:
Effect * m_effect;
bool m_viewVisible;
} ;
} // namespace lmms
#endif // LMMS_EFFECT_CONTROLS_H
| 1,762
|
C++
|
.h
| 65
| 24.984615
| 77
| 0.748956
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,342
|
VstSyncController.h
|
LMMS_lmms/include/VstSyncController.h
|
/*
* VstSyncController.h - type declarations needed for VST to lmms host sync
*
* Copyright (c) 2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2013 Mike Choi <rdavidian71/at/gmail/dot/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 LMMS_VST_SYNC_CONTROLLER_H
#define LMMS_VST_SYNC_CONTROLLER_H
#include <QObject>
#include "SharedMemory.h"
#include "VstSyncData.h"
namespace lmms
{
class VstSyncController : public QObject
{
Q_OBJECT
public:
VstSyncController();
void setAbsolutePosition(double ticks);
void setPlaybackState(bool enabled);
void setTempo(int newTempo);
void setTimeSignature(int num, int denom);
void startCycle(int startTick, int endTick);
void stopCycle();
void setPlaybackJumped(bool jumped);
void update();
const std::string& sharedMemoryKey() const noexcept { return m_syncData.key(); }
private slots:
void updateSampleRate();
private:
SharedMemory<VstSyncData> m_syncData;
};
} // namespace lmms
#endif // LMMS_VST_SYNC_CONTROLLER_H
| 1,768
|
C++
|
.h
| 52
| 32.057692
| 81
| 0.772754
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,343
|
Engine.h
|
LMMS_lmms/include/Engine.h
|
/*
* Engine.h - engine-system of LMMS
*
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/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 LMMS_ENGINE_H
#define LMMS_ENGINE_H
#include <QString>
#include <QObject>
#include "lmmsconfig.h"
#include "lmms_export.h"
#include "lmms_basics.h"
namespace lmms
{
class AudioEngine;
class Mixer;
class PatternStore;
class ProjectJournal;
class Song;
class Ladspa2LMMS;
namespace gui
{
class GuiApplication;
}
class LMMS_EXPORT Engine : public QObject
{
Q_OBJECT
public:
static void init( bool renderOnly );
static void destroy();
// core
static AudioEngine *audioEngine()
{
return s_audioEngine;
}
static Mixer * mixer()
{
return s_mixer;
}
static Song * getSong()
{
return s_song;
}
static PatternStore * patternStore()
{
return s_patternStore;
}
static ProjectJournal * projectJournal()
{
return s_projectJournal;
}
#ifdef LMMS_HAVE_LV2
static class Lv2Manager * getLv2Manager()
{
return s_lv2Manager;
}
#endif
static Ladspa2LMMS * getLADSPAManager()
{
return s_ladspaManager;
}
static float framesPerTick()
{
return s_framesPerTick;
}
static float framesPerTick(sample_rate_t sample_rate);
static void updateFramesPerTick();
static inline Engine * inst()
{
if( s_instanceOfMe == nullptr )
{
s_instanceOfMe = new Engine();
}
return s_instanceOfMe;
}
static void setDndPluginKey(void* newKey);
static void* pickDndPluginKey();
signals:
void initProgress(const QString &msg);
private:
// small helper function which sets the pointer to NULL before actually deleting
// the object it refers to
template<class T>
static inline void deleteHelper(T** ptr)
{
T* tmp = *ptr;
*ptr = nullptr;
delete tmp;
}
static float s_framesPerTick;
// core
static AudioEngine *s_audioEngine;
static Mixer * s_mixer;
static Song * s_song;
static PatternStore * s_patternStore;
static ProjectJournal * s_projectJournal;
#ifdef LMMS_HAVE_LV2
static class Lv2Manager* s_lv2Manager;
#endif
static Ladspa2LMMS* s_ladspaManager;
static void* s_dndPluginKey;
// even though most methods are static, an instance is needed for Qt slots/signals
static Engine* s_instanceOfMe;
friend class gui::GuiApplication;
};
} // namespace lmms
#endif // LMMS_ENGINE_H
| 3,068
|
C++
|
.h
| 125
| 22.416
| 83
| 0.762019
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,344
|
FontHelper.h
|
LMMS_lmms/include/FontHelper.h
|
/*
* FontHelper.h - Header function to help with fonts
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/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 LMMS_FONT_HELPER_H
#define LMMS_FONT_HELPER_H
#include <QApplication>
#include <QFont>
constexpr int DEFAULT_FONT_SIZE = 12;
constexpr int SMALL_FONT_SIZE = 10;
constexpr int LARGE_FONT_SIZE = 14;
namespace lmms::gui
{
// Convenience method to set the font size in pixels
inline QFont adjustedToPixelSize(QFont font, int size)
{
font.setPixelSize(size);
return font;
}
} // namespace lmms::gui
#endif // LMMS_FONT_HELPER_H
| 1,371
|
C++
|
.h
| 40
| 32.5
| 77
| 0.762085
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,345
|
lmms_basics.h
|
LMMS_lmms/include/lmms_basics.h
|
/*
* lmms_basics.h - typedefs for common types that are used in the whole app
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/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 LMMS_TYPES_H
#define LMMS_TYPES_H
#include <cstddef>
#include "lmmsconfig.h"
#include <cstdint>
namespace lmms
{
using bar_t = int32_t;
using tick_t = int32_t;
using volume_t = uint8_t;
using panning_t = int8_t;
using sample_t = float; // standard sample-type
using int_sample_t = int16_t; // 16-bit-int-sample
using sample_rate_t = uint32_t; // sample-rate
using fpp_t = size_t; // frames per period (0-16384)
using f_cnt_t = size_t; // standard frame-count
using ch_cnt_t = uint8_t; // channel-count (0-DEFAULT_CHANNELS)
using bpm_t = uint16_t; // tempo (MIN_BPM to MAX_BPM)
using bitrate_t = uint16_t; // bitrate in kbps
using mix_ch_t = uint16_t; // Mixer-channel (0 to MAX_CHANNEL)
using jo_id_t = uint32_t; // (unique) ID of a journalling object
constexpr ch_cnt_t DEFAULT_CHANNELS = 2;
constexpr char LADSPA_PATH_SEPERATOR =
#ifdef LMMS_BUILD_WIN32
';';
#else
':';
#endif
#define LMMS_STRINGIFY(s) LMMS_STR(s)
#define LMMS_STR(PN) #PN
// Abstract away GUI CTRL key (linux/windows) vs ⌘ (apple)
constexpr const char* UI_CTRL_KEY =
#ifdef LMMS_BUILD_APPLE
"⌘";
#else
"Ctrl";
#endif
} // namespace lmms
#endif // LMMS_TYPES_H
| 2,129
|
C++
|
.h
| 62
| 32.580645
| 77
| 0.732125
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,346
|
SampleClip.h
|
LMMS_lmms/include/SampleClip.h
|
/*
* SampleClip.h
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/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 LMMS_SAMPLE_CLIP_H
#define LMMS_SAMPLE_CLIP_H
#include <memory>
#include "Clip.h"
#include "Sample.h"
namespace lmms
{
class SampleBuffer;
namespace gui
{
class SampleClipView;
} // namespace gui
class SampleClip : public Clip
{
Q_OBJECT
mapPropertyFromModel(bool,isRecord,setRecord,m_recordModel);
public:
SampleClip(Track* track, Sample sample, bool isPlaying);
SampleClip(Track* track);
SampleClip( const SampleClip& orig );
~SampleClip() override;
SampleClip& operator=( const SampleClip& that ) = delete;
void changeLength( const TimePos & _length ) override;
void changeLengthToSampleLength();
const QString& sampleFile() const;
bool hasSampleFileLoaded(const QString & filename) const;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return "sampleclip";
}
Sample& sample()
{
return m_sample;
}
TimePos sampleLength() const;
void setSampleStartFrame( f_cnt_t startFrame );
void setSamplePlayLength( f_cnt_t length );
gui::ClipView * createView( gui::TrackView * _tv ) override;
bool isPlaying() const;
void setIsPlaying(bool isPlaying);
void setSampleBuffer(std::shared_ptr<const SampleBuffer> sb);
public slots:
void setSampleFile(const QString& sf);
void updateLength();
void toggleRecord();
void playbackPositionChanged();
void updateTrackClips();
private:
Sample m_sample;
BoolModel m_recordModel;
bool m_isPlaying;
friend class gui::SampleClipView;
signals:
void sampleChanged();
void wasReversed();
} ;
} // namespace lmms
#endif // LMMS_SAMPLE_CLIP_H
| 2,559
|
C++
|
.h
| 83
| 28.771084
| 77
| 0.770706
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,347
|
DeprecationHelper.h
|
LMMS_lmms/include/DeprecationHelper.h
|
/*
* DeprecationHelper.h - This file contains the declarations of helper functions
* which helps centralize the #ifdefs preprocessors regarding deprecation based on Qt versions.
* The functions are defined differently based on the callers' Qt versions.
*
* Copyright (c) 2020 Tien Dat Nguyen <ntd.bk.k56/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 LMMS_DEPRECATIONHELPER_H
#define LMMS_DEPRECATIONHELPER_H
#include <QFontMetrics>
#include <QWheelEvent>
namespace lmms
{
/**
* @brief horizontalAdvance is a backwards-compatible adapter for
* QFontMetrics::horizontalAdvance and width functions.
* @param metrics
* @param text
* @return text's horizontal advance based on metrics.
*/
inline int horizontalAdvance(const QFontMetrics& metrics, const QString& text)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
return metrics.horizontalAdvance(text);
#else
return metrics.width(text);
#endif
}
/**
* @brief position is a backwards-compatible adapter for
* QWheelEvent::position and pos functions.
* @param wheelEvent
* @return the position of wheelEvent
*/
inline QPoint position(QWheelEvent *wheelEvent)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
return wheelEvent->position().toPoint();
#else
return wheelEvent->pos();
#endif
}
} // namespace lmms
#endif // LMMS_DEPRECATIONHELPER_H
| 2,089
|
C++
|
.h
| 62
| 31.951613
| 95
| 0.769802
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,348
|
LfoGraph.h
|
LMMS_lmms/include/LfoGraph.h
|
/*
* LfoGraph.h - Displays LFO graphs
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2024- Michael Gregorius
*
* 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 LMMS_GUI_LFO_GRAPH_H
#define LMMS_GUI_LFO_GRAPH_H
#include <QWidget>
#include "ModelView.h"
#include "embed.h"
namespace lmms
{
class EnvelopeAndLfoParameters;
namespace gui
{
class LfoGraph : public QWidget, public ModelView
{
public:
LfoGraph(QWidget* parent);
protected:
void mousePressEvent(QMouseEvent* me) override;
void paintEvent(QPaintEvent* pe) override;
private:
void drawInfoText(const EnvelopeAndLfoParameters&);
void toggleAmountModel();
private:
QPixmap m_lfoGraph = embed::getIconPixmap("lfo_graph");
float m_randomGraph {0.};
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_LFO_GRAPH_H
| 1,604
|
C++
|
.h
| 51
| 29.588235
| 77
| 0.766732
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,349
|
base64.h
|
LMMS_lmms/include/base64.h
|
/*
* base64.h - namespace base64 with methods for encoding/decoding binary data
* to/from base64
*
* Copyright (c) 2006-2009 Tobias Doerffel <tobydox/at/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 LMMS_BASE64_H
#define LMMS_BASE64_H
#include <QByteArray>
#include <QString>
#include <QVariant>
namespace lmms::base64
{
inline void encode( const char * _data, const int _size,
QString & _dst )
{
_dst = QByteArray( _data, _size ).toBase64();
}
template<class T>
inline void decode( const QString & _b64, T * * _data, int * _size )
{
QByteArray data = QByteArray::fromBase64( _b64.toUtf8() );
*_size = data.size();
*_data = new T[*_size / sizeof(T)];
memcpy( *_data, data.constData(), *_size );
}
// for compatibility-code only
QVariant decode( const QString & _b64,
QVariant::Type _force_type = QVariant::Invalid );
} // namespace lmms::base64
#endif // LMMS_BASE64_H
| 1,700
|
C++
|
.h
| 49
| 32.469388
| 77
| 0.717153
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,350
|
shared_object.h
|
LMMS_lmms/include/shared_object.h
|
/*
* shared_object.h - class sharedObject for use among other objects
*
* Copyright (c) 2006-2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/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 LMMS_SHARED_OBJECT_H
#define LMMS_SHARED_OBJECT_H
#include <atomic>
namespace lmms
{
class sharedObject
{
public:
sharedObject() :
m_referenceCount(1)
{
}
virtual ~sharedObject() = default;
template<class T>
static T* ref( T* object )
{
// Incrementing an atomic reference count can be relaxed since no action
// is ever taken as a result of increasing the count.
// Other loads and stores can be reordered around this without consequence.
object->m_referenceCount.fetch_add(1, std::memory_order_relaxed);
return object;
}
template<class T>
static void unref( T* object )
{
// When decrementing an atomic reference count, we need to provide
// two ordering guarantees:
// 1. All reads and writes to the referenced object occur before
// the count reaches zero.
// 2. Deletion occurs after the count reaches zero.
//
// To accomplish this, each decrement must be store-released,
// and the final thread (which is deleting the referenced data)
// must load-acquire those stores.
// The simplest way to do this to give the decrement acquire-release
// semantics.
//
// See https://www.boost.org/doc/libs/1_67_0/doc/html/atomic/usage_examples.html
// for further discussion, along with a slightly more complicated
// (but possibly more performant on weakly-ordered hardware like ARM)
// approach.
const bool deleteObject =
object->m_referenceCount.fetch_sub(1, std::memory_order_acq_rel) == 1;
if ( deleteObject )
{
object->deleteLater();
}
}
private:
std::atomic_int m_referenceCount;
} ;
} // namespace lmms
#endif // LMMS_SHARED_OBJECT_H
| 2,658
|
C++
|
.h
| 77
| 32.142857
| 82
| 0.745037
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,351
|
GroupBox.h
|
LMMS_lmms/include/GroupBox.h
|
/*
* GroupBox.h - LMMS-groupbox
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/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 LMMS_GUI_GROUP_BOX_H
#define LMMS_GUI_GROUP_BOX_H
#include <QWidget>
#include "AutomatableModelView.h"
#include "PixmapButton.h"
class QPixmap;
namespace lmms::gui
{
class GroupBox : public QWidget, public BoolModelView
{
Q_OBJECT
public:
GroupBox( const QString & _caption, QWidget * _parent = nullptr );
~GroupBox() override;
void modelChanged() override;
PixmapButton * ledButton()
{
return m_led;
}
/**
* @brief Returns whether the LED button is shown or not
*
* @return true LED button is shown
* @return false LED button is hidden
*/
bool ledButtonShown() const;
/**
* @brief Sets if the LED check box is shown or not
*
* @param value Set to true to show the LED check box or to false to hide it.
*/
void setLedButtonShown(bool value);
int titleBarHeight() const
{
return m_titleBarHeight;
}
protected:
void mousePressEvent( QMouseEvent * _me ) override;
void paintEvent( QPaintEvent * _pe ) override;
private:
void updatePixmap();
PixmapButton * m_led;
QString m_caption;
const int m_titleBarHeight;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_GROUP_BOX_H
| 2,048
|
C++
|
.h
| 70
| 27.014286
| 78
| 0.745529
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,352
|
TempoSyncKnobModel.h
|
LMMS_lmms/include/TempoSyncKnobModel.h
|
/*
* TempoSyncKnobModel.h - adds bpm to ms conversion for knob class
*
* Copyright (c) 2005-2008 Danny McRae <khjklujn/at/yahoo.com>
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/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 LMMS_TEMPO_SYNC_KNOB_MODEL_H
#define LMMS_TEMPO_SYNC_KNOB_MODEL_H
#include "MeterModel.h"
class QAction;
namespace lmms
{
namespace gui
{
class TempoSyncKnob;
} // namespace gui
class LMMS_EXPORT TempoSyncKnobModel : public FloatModel
{
Q_OBJECT
MODEL_IS_VISITABLE
public:
enum class SyncMode
{
None,
DoubleWholeNote,
WholeNote,
HalfNote,
QuarterNote,
EighthNote,
SixteenthNote,
ThirtysecondNote,
Custom
} ;
TempoSyncKnobModel( const float _val, const float _min,
const float _max, const float _step,
const float _scale, Model * _parent,
const QString & _display_name = QString() );
~TempoSyncKnobModel() override = default;
void saveSettings( QDomDocument & _doc, QDomElement & _this, const QString& name ) override;
void loadSettings( const QDomElement & _this, const QString& name ) override;
SyncMode syncMode() const
{
return m_tempoSyncMode;
}
void setSyncMode( SyncMode _new_mode );
float scale() const
{
return m_scale;
}
void setScale( float _new_scale );
MeterModel & getCustomMeterModel() { return m_custom; }
MeterModel const & getCustomMeterModel() const { return m_custom; }
signals:
void syncModeChanged( lmms::TempoSyncKnobModel::SyncMode _new_mode );
void scaleChanged( float _new_scale );
public slots:
inline void disableSync()
{
setTempoSync( SyncMode::None );
}
void setTempoSync( SyncMode _note_type );
void setTempoSync( QAction * _item );
protected slots:
void calculateTempoSyncTime( lmms::bpm_t _bpm );
void updateCustom();
private:
SyncMode m_tempoSyncMode;
SyncMode m_tempoLastSyncMode;
float m_scale;
MeterModel m_custom;
friend class gui::TempoSyncKnob;
} ;
} // namespace lmms
#endif // LMMS_TEMPO_SYNC_KNOB_MODEL_H
| 2,756
|
C++
|
.h
| 92
| 27.641304
| 93
| 0.759013
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,353
|
ArrayVector.h
|
LMMS_lmms/include/ArrayVector.h
|
/*
* ArrayVector.h
*
* Copyright (c) 2023 Dominic Clark
*
* 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 LMMS_ARRAY_VECTOR_H
#define LMMS_ARRAY_VECTOR_H
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <iterator>
#include <memory>
#include <new>
#include <stdexcept>
#include <utility>
#include <type_traits>
namespace lmms {
namespace detail {
template<typename T, typename = void>
constexpr bool is_input_iterator_v = false;
template<typename T>
constexpr bool is_input_iterator_v<T, std::void_t<typename std::iterator_traits<T>::iterator_category>> =
std::is_convertible_v<typename std::iterator_traits<T>::iterator_category, std::input_iterator_tag>;
} // namespace detail
/**
* A container that stores up to a maximum of `N` elements of type `T` directly
* within itself, rather than separately on the heap. Useful when a dynamically
* resizeable container is needed for use in real-time code. Can be thought of
* as a hybrid between `std::array` and `std::vector`. The interface follows
* that of `std::vector` - see standard C++ documentation.
*/
template<typename T, std::size_t N>
class ArrayVector
{
public:
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using value_type = T;
using reference = T&;
using const_reference = const T&;
using pointer = T*;
using const_pointer = const T*;
using iterator = pointer;
using const_iterator = const_pointer;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
ArrayVector() = default;
ArrayVector(const ArrayVector& other) noexcept(std::is_nothrow_copy_constructible_v<T>) :
m_size{other.m_size}
{
std::uninitialized_copy(other.begin(), other.end(), begin());
}
ArrayVector(ArrayVector&& other) noexcept(std::is_nothrow_move_constructible_v<T>) :
m_size{other.m_size}
{
std::uninitialized_move(other.begin(), other.end(), begin());
other.clear();
}
ArrayVector(size_type count, const T& value) noexcept(std::is_nothrow_copy_constructible_v<T>) :
m_size{count}
{
assert(count <= N);
std::uninitialized_fill_n(begin(), count, value);
}
explicit ArrayVector(size_type count) noexcept(std::is_nothrow_default_constructible_v<T>) :
m_size{count}
{
assert(count <= N);
std::uninitialized_value_construct_n(begin(), count);
}
template<typename It, std::enable_if_t<detail::is_input_iterator_v<It>, int> = 0>
ArrayVector(It first, It last)
{
// Can't check the size first as the iterator may not be multipass
const auto end = std::uninitialized_copy(first, last, begin());
m_size = end - begin();
assert(m_size <= N);
}
ArrayVector(std::initializer_list<T> il) noexcept(std::is_nothrow_copy_constructible_v<T>) :
m_size{il.size()}
{
assert(il.size() <= N);
std::uninitialized_copy(il.begin(), il.end(), begin());
}
~ArrayVector() { std::destroy(begin(), end()); }
ArrayVector& operator=(const ArrayVector& other)
noexcept(std::is_nothrow_copy_assignable_v<T> && std::is_nothrow_copy_constructible_v<T>)
{
if (this != &other) {
const auto toAssign = std::min(other.size(), size());
const auto assignedFromEnd = other.begin() + toAssign;
const auto assignedToEnd = std::copy(other.begin(), other.begin() + toAssign, begin());
std::destroy(assignedToEnd, end());
std::uninitialized_copy(assignedFromEnd, other.end(), end());
m_size = other.size();
}
return *this;
}
ArrayVector& operator=(ArrayVector&& other)
noexcept(std::is_nothrow_move_assignable_v<T> && std::is_nothrow_move_constructible_v<T>)
{
if (this != &other) {
const auto toAssign = std::min(other.size(), size());
const auto assignedFromEnd = other.begin() + toAssign;
const auto assignedToEnd = std::move(other.begin(), other.begin() + toAssign, begin());
std::destroy(assignedToEnd, end());
std::uninitialized_move(assignedFromEnd, other.end(), end());
m_size = other.size();
other.clear();
}
return *this;
}
ArrayVector& operator=(std::initializer_list<T> il)
noexcept(std::is_nothrow_copy_assignable_v<T> && std::is_nothrow_copy_constructible_v<T>)
{
assert(il.size() <= N);
const auto toAssign = std::min(il.size(), size());
const auto assignedFromEnd = il.begin() + toAssign;
const auto assignedToEnd = std::copy(il.begin(), assignedFromEnd, begin());
std::destroy(assignedToEnd, end());
std::uninitialized_copy(assignedFromEnd, il.end(), end());
m_size = il.size();
return *this;
}
void assign(size_type count, const T& value)
noexcept(std::is_nothrow_copy_assignable_v<T> && std::is_nothrow_copy_constructible_v<T>)
{
assert(count <= N);
const auto temp = value;
const auto toAssign = std::min(count, size());
const auto toConstruct = count - toAssign;
const auto assignedToEnd = std::fill_n(begin(), toAssign, temp);
std::destroy(assignedToEnd, end());
std::uninitialized_fill_n(assignedToEnd, toConstruct, temp);
m_size = count;
}
template<typename It, std::enable_if_t<detail::is_input_iterator_v<It>, int> = 0>
void assign(It first, It last)
{
// Can't check the size first as the iterator may not be multipass
auto pos = begin();
for (; first != last && pos != end(); ++pos, ++first) {
*pos = *first;
}
std::destroy(pos, end());
pos = std::uninitialized_copy(first, last, pos);
m_size = pos - begin();
assert(m_size <= N);
}
reference at(size_type index)
{
if (index >= m_size) { throw std::out_of_range{"index out of range"}; }
return data()[index];
}
const_reference at(size_type index) const
{
if (index >= m_size) { throw std::out_of_range{"index out of range"}; }
return data()[index];
}
reference operator[](size_type index) noexcept
{
assert(index < m_size);
return data()[index];
}
const_reference operator[](size_type index) const noexcept
{
assert(index < m_size);
return data()[index];
}
reference front() noexcept { return operator[](0); }
const_reference front() const noexcept { return operator[](0); }
reference back() noexcept { return operator[](m_size - 1); }
const_reference back() const noexcept { return operator[](m_size - 1); }
pointer data() noexcept { return *std::launder(reinterpret_cast<T(*)[N]>(m_data)); }
const_pointer data() const noexcept { return *std::launder(reinterpret_cast<const T(*)[N]>(m_data)); }
iterator begin() noexcept { return data(); }
const_iterator begin() const noexcept { return data(); }
const_iterator cbegin() const noexcept { return data(); }
iterator end() noexcept { return data() + m_size; }
const_iterator end() const noexcept { return data() + m_size; }
const_iterator cend() const noexcept { return data() + m_size; }
reverse_iterator rbegin() noexcept { return std::reverse_iterator{end()}; }
const_reverse_iterator rbegin() const noexcept { return std::reverse_iterator{end()}; }
const_reverse_iterator crbegin() const noexcept { return std::reverse_iterator{cend()}; }
reverse_iterator rend() noexcept { return std::reverse_iterator{begin()}; }
const_reverse_iterator rend() const noexcept { return std::reverse_iterator{begin()}; }
const_reverse_iterator crend() const noexcept { return std::reverse_iterator{cbegin()}; }
bool empty() const noexcept { return m_size == 0; }
bool full() const noexcept { return m_size == N; }
size_type size() const noexcept { return m_size; }
size_type max_size() const noexcept { return N; }
size_type capacity() const noexcept { return N; }
void clear() noexcept
{
std::destroy(begin(), end());
m_size = 0;
}
iterator insert(const_iterator pos, const T& value) { return emplace(pos, value); }
iterator insert(const_iterator pos, T&& value) { return emplace(pos, std::move(value)); }
iterator insert(const_iterator pos, size_type count, const T& value)
{
assert(m_size + count <= N);
assert(cbegin() <= pos && pos <= cend());
const auto mutPos = begin() + (pos - cbegin());
const auto newEnd = std::uninitialized_fill_n(end(), count, value);
std::rotate(mutPos, end(), newEnd);
m_size += count;
return mutPos;
}
template<typename It, std::enable_if_t<detail::is_input_iterator_v<It>, int> = 0>
iterator insert(const_iterator pos, It first, It last)
{
// Can't check the size first as the iterator may not be multipass
assert(cbegin() <= pos && pos <= cend());
const auto mutPos = begin() + (pos - cbegin());
const auto newEnd = std::uninitialized_copy(first, last, end());
std::rotate(mutPos, end(), newEnd);
m_size = newEnd - begin();
assert(m_size <= N);
return mutPos;
}
iterator insert(const_iterator pos, std::initializer_list<T> il) { return insert(pos, il.begin(), il.end()); }
template<typename... Args>
iterator emplace(const_iterator pos, Args&&... args)
{
assert(cbegin() <= pos && pos <= cend());
const auto mutPos = begin() + (pos - cbegin());
emplace_back(std::forward<Args>(args)...);
std::rotate(mutPos, end() - 1, end());
return mutPos;
}
iterator erase(const_iterator pos) { return erase(pos, pos + 1); }
iterator erase(const_iterator first, const_iterator last)
{
assert(cbegin() <= first && first <= last && last <= cend());
const auto mutFirst = begin() + (first - cbegin());
const auto mutLast = begin() + (last - cbegin());
const auto newEnd = std::move(mutLast, end(), mutFirst);
std::destroy(newEnd, end());
m_size = newEnd - begin();
return mutFirst;
}
void push_back(const T& value) { emplace_back(value); }
void push_back(T&& value) { emplace_back(std::move(value)); }
template<typename... Args>
reference emplace_back(Args&&... args)
{
assert(!full());
// TODO C++20: Use std::construct_at
const auto result = new(static_cast<void*>(end())) T(std::forward<Args>(args)...);
++m_size;
return *result;
}
void pop_back()
{
assert(!empty());
--m_size;
std::destroy_at(end());
}
void resize(size_type size)
{
if (size > N) { throw std::length_error{"size exceeds maximum size"}; }
if (size < m_size) {
std::destroy(begin() + size, end());
} else {
std::uninitialized_value_construct(end(), begin() + size);
}
m_size = size;
}
void resize(size_type size, const value_type& value)
{
if (size > N) { throw std::length_error{"size exceeds maximum size"}; }
if (size < m_size) {
std::destroy(begin() + size, end());
} else {
std::uninitialized_fill(end(), begin() + size, value);
}
m_size = size;
}
void swap(ArrayVector& other)
noexcept(std::is_nothrow_swappable_v<T> && std::is_nothrow_move_constructible_v<T>)
{
using std::swap;
swap(*this, other);
}
friend void swap(ArrayVector& a, ArrayVector& b)
noexcept(std::is_nothrow_swappable_v<T> && std::is_nothrow_move_constructible_v<T>)
{
const auto toSwap = std::min(a.size(), b.size());
const auto aSwapEnd = a.begin() + toSwap;
const auto bSwapEnd = b.begin() + toSwap;
std::swap_ranges(a.begin(), aSwapEnd, b.begin());
std::uninitialized_move(aSwapEnd, a.end(), bSwapEnd);
std::uninitialized_move(bSwapEnd, b.end(), aSwapEnd);
std::destroy(aSwapEnd, a.end());
std::destroy(bSwapEnd, b.end());
std::swap(a.m_size, b.m_size);
}
// TODO C++20: Replace with operator<=>
friend bool operator<(const ArrayVector& l, const ArrayVector& r)
{
return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
}
friend bool operator<=(const ArrayVector& l, const ArrayVector& r) { return !(r < l); }
friend bool operator>(const ArrayVector& l, const ArrayVector& r) { return r < l; }
friend bool operator>=(const ArrayVector& l, const ArrayVector& r) { return !(l < r); }
friend bool operator==(const ArrayVector& l, const ArrayVector& r)
{
return std::equal(l.begin(), l.end(), r.begin(), r.end());
}
// TODO C++20: Remove
friend bool operator!=(const ArrayVector& l, const ArrayVector& r) { return !(l == r); }
private:
alignas(T) std::byte m_data[std::max(N * sizeof(T), std::size_t{1})]; // Intentionally a raw array
size_type m_size = 0;
};
} // namespace lmms
#endif // LMMS_ARRAY_VECTOR_H
| 12,757
|
C++
|
.h
| 336
| 35.425595
| 111
| 0.692457
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,354
|
SampleWaveform.h
|
LMMS_lmms/include/SampleWaveform.h
|
/*
* SampleWaveform.h
*
* Copyright (c) 2023 saker <sakertooth@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 LMMS_GUI_SAMPLE_WAVEFORM_H
#define LMMS_GUI_SAMPLE_WAVEFORM_H
#include <QPainter>
#include "Sample.h"
#include "lmms_export.h"
namespace lmms::gui {
class LMMS_EXPORT SampleWaveform
{
public:
struct Parameters
{
const SampleFrame* buffer;
size_t size;
float amplification;
bool reversed;
};
static void visualize(Parameters parameters, QPainter& painter, const QRect& rect);
};
} // namespace lmms::gui
#endif // LMMS_GUI_SAMPLE_WAVEFORM_H
| 1,337
|
C++
|
.h
| 43
| 29.162791
| 84
| 0.759317
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,355
|
MicrotunerConfig.h
|
LMMS_lmms/include/MicrotunerConfig.h
|
/*
* MicrotunerConfig.h - configuration widget for scales and keymaps
*
* 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 LMMS_GUI_MICROTUNER_CONFIG_H
#define LMMS_GUI_MICROTUNER_CONFIG_H
#include <QWidget>
#include "AutomatableModel.h"
#include "ComboBoxModel.h"
#include "SerializingObject.h"
class QLineEdit;
class QPlainTextEdit;
namespace lmms::gui
{
class LMMS_EXPORT MicrotunerConfig : public QWidget, public SerializingObject
{
Q_OBJECT
public:
MicrotunerConfig();
void saveSettings(QDomDocument &document, QDomElement &element) override;
void loadSettings(const QDomElement &element) override;
inline QString nodeName() const override
{
return "MicrotunerConfig";
}
QSize sizeHint() const override {return QSize(300, 400);}
public slots:
void updateScaleList(int index);
void updateKeymapList(int index);
void updateScaleForm();
void updateKeymapForm();
protected:
void closeEvent(QCloseEvent *ce) override;
private slots:
bool loadScaleFromFile();
bool loadKeymapFromFile();
bool saveScaleToFile();
bool saveKeymapToFile();
private:
bool validateScaleForm();
bool validateKeymapForm();
bool applyScale();
bool applyKeymap();
ComboBoxModel m_scaleComboModel; //!< ID of scale currently selected for editing
ComboBoxModel m_keymapComboModel; //!< ID of keymap currently selected for editing
QLineEdit *m_scaleNameEdit; //!< edit field for the scale name or description
QLineEdit *m_keymapNameEdit; //!< edit field for the keymap name or description
QPlainTextEdit *m_scaleTextEdit; //!< text editor field for interval definitions
QPlainTextEdit *m_keymapTextEdit; //!< text editor field for key mappings
IntModel m_firstKeyModel; //!< model for spinbox of currently edited first key
IntModel m_lastKeyModel; //!< model for spinbox of currently edited last key
IntModel m_middleKeyModel; //!< model for spinbox of currently edited middle key
IntModel m_baseKeyModel; //!< model for spinbox of currently edited base key
FloatModel m_baseFreqModel; //!< model for spinbox of currently edited base note frequency
};
} // namespace lmms::gui
#endif // LMMS_GUI_MICROTUNER_CONFIG_H
| 3,072
|
C++
|
.h
| 76
| 38.394737
| 103
| 0.753867
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,356
|
Metronome.h
|
LMMS_lmms/include/Metronome.h
|
/*
* Metronome.h
*
* Copyright (c) 2024 saker
*
* 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 LMMS_METRONOME_H
#define LMMS_METRONOME_H
#include <cstddef>
namespace lmms {
class Metronome
{
public:
bool active() const { return m_active; }
void setActive(bool active) { m_active = active; }
void processTick(int currentTick, int ticksPerBar, int beatsPerBar, size_t bufferOffset);
private:
bool m_active = false;
};
} // namespace lmms
#endif // LMMS_METRONOME_H
| 1,228
|
C++
|
.h
| 38
| 30.5
| 90
| 0.753586
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
20,357
|
AudioEngine.h
|
LMMS_lmms/include/AudioEngine.h
|
/*
* AudioEngine.h - device-independent audio engine for LMMS
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/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 LMMS_AUDIO_ENGINE_H
#define LMMS_AUDIO_ENGINE_H
#include <mutex>
#include <QThread>
#include <samplerate.h>
#include <memory>
#include <vector>
#include "AudioDevice.h"
#include "lmms_basics.h"
#include "SampleFrame.h"
#include "LocklessList.h"
#include "FifoBuffer.h"
#include "AudioEngineProfiler.h"
#include "PlayHandle.h"
namespace lmms
{
class AudioDevice;
class MidiClient;
class AudioPort;
class AudioEngineWorkerThread;
constexpr fpp_t MINIMUM_BUFFER_SIZE = 32;
constexpr fpp_t DEFAULT_BUFFER_SIZE = 256;
constexpr fpp_t MAXIMUM_BUFFER_SIZE = 4096;
constexpr int BYTES_PER_SAMPLE = sizeof(sample_t);
constexpr int BYTES_PER_INT_SAMPLE = sizeof(int_sample_t);
constexpr int BYTES_PER_FRAME = sizeof(SampleFrame);
constexpr float OUTPUT_SAMPLE_MULTIPLIER = 32767.0f;
class LMMS_EXPORT AudioEngine : public QObject
{
Q_OBJECT
public:
/**
* @brief RAII helper for requestChangesInModel.
* Used by AudioEngine::requestChangesGuard.
*/
class RequestChangesGuard {
friend class AudioEngine;
private:
RequestChangesGuard(AudioEngine* audioEngine)
: m_audioEngine{audioEngine}
{
m_audioEngine->requestChangeInModel();
}
public:
RequestChangesGuard()
: m_audioEngine{nullptr}
{
}
RequestChangesGuard(RequestChangesGuard&& other)
: RequestChangesGuard()
{
std::swap(other.m_audioEngine, m_audioEngine);
}
// Disallow copy.
RequestChangesGuard(const RequestChangesGuard&) = delete;
RequestChangesGuard& operator=(const RequestChangesGuard&) = delete;
~RequestChangesGuard() {
if (m_audioEngine) {
m_audioEngine->doneChangeInModel();
}
}
private:
AudioEngine* m_audioEngine;
};
struct qualitySettings
{
enum class Interpolation
{
Linear,
SincFastest,
SincMedium,
SincBest
} ;
Interpolation interpolation;
qualitySettings(Interpolation i) :
interpolation(i)
{
}
int libsrcInterpolation() const
{
switch( interpolation )
{
case Interpolation::Linear:
return SRC_ZERO_ORDER_HOLD;
case Interpolation::SincFastest:
return SRC_SINC_FASTEST;
case Interpolation::SincMedium:
return SRC_SINC_MEDIUM_QUALITY;
case Interpolation::SincBest:
return SRC_SINC_BEST_QUALITY;
}
return SRC_LINEAR;
}
} ;
void initDevices();
void clear();
void clearNewPlayHandles();
// audio-device-stuff
bool renderOnly() const { return m_renderOnly; }
// Returns the current audio device's name. This is not necessarily
// the user's preferred audio device, in case you were thinking that.
inline const QString & audioDevName() const
{
return m_audioDevName;
}
inline bool audioDevStartFailed() const
{
return m_audioDevStartFailed;
}
//! Set new audio device. Old device will be deleted,
//! unless it's stored using storeAudioDevice
void setAudioDevice( AudioDevice * _dev,
const struct qualitySettings & _qs,
bool _needs_fifo,
bool startNow );
void storeAudioDevice();
void restoreAudioDevice();
inline AudioDevice * audioDev()
{
return m_audioDev;
}
// audio-port-stuff
inline void addAudioPort(AudioPort * port)
{
requestChangeInModel();
m_audioPorts.push_back(port);
doneChangeInModel();
}
void removeAudioPort(AudioPort * port);
// MIDI-client-stuff
inline const QString & midiClientName() const
{
return m_midiClientName;
}
inline MidiClient * midiClient()
{
return m_midiClient;
}
// play-handle stuff
bool addPlayHandle( PlayHandle* handle );
void removePlayHandle( PlayHandle* handle );
inline PlayHandleList& playHandles()
{
return m_playHandles;
}
void removePlayHandlesOfTypes(Track * track, PlayHandle::Types types);
// methods providing information for other classes
inline fpp_t framesPerPeriod() const
{
return m_framesPerPeriod;
}
AudioEngineProfiler& profiler()
{
return m_profiler;
}
int cpuLoad() const
{
return m_profiler.cpuLoad();
}
int detailLoad(const AudioEngineProfiler::DetailType type) const
{
return m_profiler.detailLoad(type);
}
const qualitySettings & currentQualitySettings() const
{
return m_qualitySettings;
}
sample_rate_t baseSampleRate() const { return m_baseSampleRate; }
sample_rate_t outputSampleRate() const
{
return m_audioDev != nullptr ? m_audioDev->sampleRate() : m_baseSampleRate;
}
sample_rate_t inputSampleRate() const
{
return m_audioDev != nullptr ? m_audioDev->sampleRate() : m_baseSampleRate;
}
inline float masterGain() const
{
return m_masterGain;
}
inline void setMasterGain(const float mo)
{
m_masterGain = mo;
}
static inline sample_t clip(const sample_t s)
{
if (s > 1.0f)
{
return 1.0f;
}
else if (s < -1.0f)
{
return -1.0f;
}
return s;
}
bool criticalXRuns() const;
inline bool hasFifoWriter() const
{
return m_fifoWriter != nullptr;
}
void pushInputFrames( SampleFrame* _ab, const f_cnt_t _frames );
inline const SampleFrame* inputBuffer()
{
return m_inputBuffer[ m_inputBufferRead ];
}
inline f_cnt_t inputBufferFrames() const
{
return m_inputBufferFrames[ m_inputBufferRead ];
}
inline const SampleFrame* nextBuffer()
{
return hasFifoWriter() ? m_fifo->read() : renderNextBuffer();
}
void changeQuality(const struct qualitySettings & qs);
//! Block until a change in model can be done (i.e. wait for audio thread)
void requestChangeInModel();
void doneChangeInModel();
RequestChangesGuard requestChangesGuard()
{
return RequestChangesGuard{this};
}
static bool isAudioDevNameValid(QString name);
static bool isMidiDevNameValid(QString name);
signals:
void qualitySettingsChanged();
void sampleRateChanged();
void nextAudioBuffer(const lmms::SampleFrame* buffer);
private:
using Fifo = FifoBuffer<SampleFrame*>;
class fifoWriter : public QThread
{
public:
fifoWriter( AudioEngine * audioEngine, Fifo * fifo );
void finish();
private:
AudioEngine * m_audioEngine;
Fifo * m_fifo;
volatile bool m_writing;
void run() override;
void write(SampleFrame* buffer);
} ;
AudioEngine( bool renderOnly );
~AudioEngine() override;
void startProcessing(bool needsFifo = true);
void stopProcessing();
AudioDevice * tryAudioDevices();
MidiClient * tryMidiClients();
void renderStageNoteSetup();
void renderStageInstruments();
void renderStageEffects();
void renderStageMix();
const SampleFrame* renderNextBuffer();
void swapBuffers();
void clearInternal();
bool m_renderOnly;
std::vector<AudioPort *> m_audioPorts;
fpp_t m_framesPerPeriod;
SampleFrame* m_inputBuffer[2];
f_cnt_t m_inputBufferFrames[2];
f_cnt_t m_inputBufferSize[2];
sample_rate_t m_baseSampleRate;
int m_inputBufferRead;
int m_inputBufferWrite;
std::unique_ptr<SampleFrame[]> m_outputBufferRead;
std::unique_ptr<SampleFrame[]> m_outputBufferWrite;
// worker thread stuff
std::vector<AudioEngineWorkerThread *> m_workers;
int m_numWorkers;
// playhandle stuff
PlayHandleList m_playHandles;
// place where new playhandles are added temporarily
LocklessList<PlayHandle *> m_newPlayHandles;
ConstPlayHandleList m_playHandlesToRemove;
struct qualitySettings m_qualitySettings;
float m_masterGain;
// audio device stuff
void doSetAudioDevice( AudioDevice *_dev );
AudioDevice * m_audioDev;
AudioDevice * m_oldAudioDev;
QString m_audioDevName;
bool m_audioDevStartFailed;
// MIDI device stuff
MidiClient * m_midiClient;
QString m_midiClientName;
// FIFO stuff
Fifo * m_fifo;
fifoWriter * m_fifoWriter;
AudioEngineProfiler m_profiler;
bool m_clearSignal;
std::recursive_mutex m_changeMutex;
friend class Engine;
friend class AudioEngineWorkerThread;
friend class ProjectRenderer;
} ;
} // namespace lmms
#endif // LMMS_AUDIO_ENGINE_H
| 8,662
|
C++
|
.h
| 320
| 24.403125
| 77
| 0.76372
|
LMMS/lmms
| 7,989
| 994
| 1,122
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.