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,358
|
MainWindow.h
|
LMMS_lmms/include/MainWindow.h
|
/*
* MainWindow.h - declaration of class MainWindow, the main window of 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_GUI_MAIN_WINDOW_H
#define LMMS_GUI_MAIN_WINDOW_H
#include <QBasicTimer>
#include <QTimer>
#include <QList>
#include <QMainWindow>
#include "ConfigManager.h"
class QAction;
class QDomElement;
class QGridLayout;
class QMdiArea;
namespace lmms
{
class ConfigManager;
namespace gui
{
class PluginView;
class SubWindow;
class ToolButton;
class GuiApplication;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
QMdiArea* workspace()
{
return m_workspace;
}
QWidget* toolBar()
{
return m_toolBar;
}
int addWidgetToToolBar( QWidget * _w, int _row = -1, int _col = -1 );
void addSpacingToToolBar( int _size );
// wrap the widget with a window decoration and add it to the workspace
LMMS_EXPORT SubWindow* addWindowedWidget(QWidget *w, Qt::WindowFlags windowFlags = QFlag(0));
void refocus();
///
/// \brief Asks whether changes made to the project are to be saved.
///
/// Opens a dialog giving the user the choice to (a) confirm his choice
/// (such as opening a new file), (b) save the current project before
/// proceeding or (c) cancel the process.
///
/// Every function that replaces the current file (e.g. creates new file,
/// opens another file...) must call this before and may only proceed if
/// this function returns true.
///
/// \param stopPlayback whether playback should be stopped upon prompting. If set to false, the caller should ensure that Engine::getSong()->stop() is called before unloading/loading a song.
///
/// \return true if the user allows the software to proceed, false if they
/// cancel the action.
///
bool mayChangeProject(bool stopPlayback);
// Auto save timer intervals. The slider in SetupDialog.cpp wants
// minutes and the rest milliseconds.
static const int DEFAULT_SAVE_INTERVAL_MINUTES = 2;
static const int DEFAULT_AUTO_SAVE_INTERVAL = DEFAULT_SAVE_INTERVAL_MINUTES * 60 * 1000;
static const int m_autoSaveShortTime = 10 * 1000; // 10s short loop
void autoSaveTimerReset( int msec = ConfigManager::inst()->
value( "ui", "saveinterval" ).toInt()
* 60 * 1000 )
{
if( msec < m_autoSaveShortTime ) // No 'saveinterval' in .lmmsrc.xml
{
msec = DEFAULT_AUTO_SAVE_INTERVAL;
}
m_autoSaveTimer.start( msec );
}
int getAutoSaveTimerInterval()
{
return m_autoSaveTimer.interval();
}
enum class SessionState
{
Normal,
Recover
};
void setSession( SessionState session )
{
m_session = session;
}
SessionState getSession()
{
return m_session;
}
void sessionCleanup();
void clearKeyModifiers();
// TODO Remove this function, since m_shift can get stuck down.
// [[deprecated]]
bool isShiftPressed()
{
return m_keyMods.m_shift;
}
static void saveWidgetState( QWidget * _w, QDomElement & _de );
static void restoreWidgetState( QWidget * _w, const QDomElement & _de );
bool eventFilter(QObject* watched, QEvent* event) override;
public slots:
void resetWindowTitle();
void emptySlot();
void createNewProject();
void openProject();
bool saveProject();
bool saveProjectAs();
bool saveProjectAsNewVersion();
void saveProjectAsDefaultTemplate();
void showSettingsDialog();
void aboutLMMS();
void help();
void toggleAutomationEditorWin();
void togglePatternEditorWin(bool forceShow = false);
void toggleSongEditorWin();
void toggleProjectNotesWin();
void toggleMicrotunerWin();
void toggleMixerWin();
void togglePianoRollWin();
void toggleControllerRack();
void toggleFullscreen();
void updatePlayPauseIcons();
void updateUndoRedoButtons();
void undo();
void redo();
void autoSave();
private slots:
void onExportProjectMidi();
protected:
void closeEvent( QCloseEvent * _ce ) override;
void focusOutEvent( QFocusEvent * _fe ) override;
void keyPressEvent( QKeyEvent * _ke ) override;
void keyReleaseEvent( QKeyEvent * _ke ) override;
void timerEvent( QTimerEvent * _ev ) override;
private:
MainWindow();
MainWindow( const MainWindow & );
~MainWindow() override;
void finalize();
void toggleWindow( QWidget *window, bool forceShow = false );
void exportProject(bool multiExport = false);
void handleSaveResult(QString const & filename, bool songSavedSuccessfully);
bool guiSaveProject();
bool guiSaveProjectAs( const QString & filename );
QMdiArea * m_workspace;
QWidget * m_toolBar;
QGridLayout * m_toolBarLayout;
struct keyModifiers
{
keyModifiers() :
m_ctrl( false ),
m_shift( false ),
m_alt( false )
{
}
bool m_ctrl;
bool m_shift;
bool m_alt;
} m_keyMods;
QMenu * m_toolsMenu;
QAction * m_undoAction;
QAction * m_redoAction;
QList<PluginView *> m_tools;
QBasicTimer m_updateTimer;
QTimer m_autoSaveTimer;
int m_autoSaveInterval;
friend class GuiApplication;
QMenu * m_viewMenu;
ToolButton * m_metronomeToggle;
SessionState m_session;
bool maximized;
private slots:
void browseHelp();
void showTool( QAction * _idx );
void updateViewMenu();
void updateConfig( QAction * _who );
void onToggleMetronome();
void onExportProject();
void onExportProjectTracks();
void onImportProject();
void onSongModified();
void onProjectFileNameChanged();
signals:
void periodicUpdate();
void initProgress(const QString &msg);
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_MAIN_WINDOW_H
| 6,226
|
C++
|
.h
| 209
| 27.507177
| 192
| 0.75365
|
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,359
|
PatternClip.h
|
LMMS_lmms/include/PatternClip.h
|
/*
* PatternClip.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_PATTERN_CLIP_H
#define LMMS_PATTERN_CLIP_H
#include "Clip.h"
namespace lmms
{
/*! \brief Dummy clip for PatternTracks
*
* Only used in the Song (Editor). See PatternStore.h for more info.
*/
class PatternClip : public Clip
{
public:
PatternClip(Track* track);
~PatternClip() override = default;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return "patternclip";
}
int patternIndex();
gui::ClipView * createView( gui::TrackView * _tv ) override;
private:
friend class PatternClipView;
} ;
} // namespace lmms
#endif // LMMS_PATTERN_CLIP_H
| 1,601
|
C++
|
.h
| 50
| 30.08
| 77
| 0.753247
|
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,360
|
RowTableView.h
|
LMMS_lmms/include/RowTableView.h
|
/*
* RowTableView.h - table with rows that act like single cells
*
* Copyright (c) 2016 Javier Serrano Polo <javier@jasp.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_ROW_TABLE_VIEW_H
#define LMMS_GUI_ROW_TABLE_VIEW_H
#include <QTableView>
namespace lmms::gui
{
class RowDelegate;
class RowTableView : public QTableView
{
Q_OBJECT
public:
RowTableView( QWidget * parent = 0 );
~RowTableView() override;
void setModel( QAbstractItemModel * model ) override;
protected:
void keyPressEvent( QKeyEvent * event ) override;
private:
RowDelegate * m_rowDelegate;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_ROW_TABLE_VIEW_H
| 1,416
|
C++
|
.h
| 43
| 30.906977
| 70
| 0.759764
|
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,361
|
ProjectVersion.h
|
LMMS_lmms/include/ProjectVersion.h
|
/*
* ProjectVersion.h - version compared in import upgrades
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2015 Tres Finocchiaro <tres.finocchiaro/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_PROJECT_VERSION_H
#define LMMS_PROJECT_VERSION_H
#include <QString>
#include <QStringList>
#include <limits>
namespace lmms
{
/*! \brief Version number parsing and comparison
*
* Parses and compares version information. i.e. "1.0.3" < "1.0.10"
*/
class ProjectVersion
{
public:
enum class CompareType : int { None = 0, Major=1, Minor=2, Release=3, Stage=4, Build=5, All = std::numeric_limits<int>::max() };
ProjectVersion(QString version, CompareType c = CompareType::All);
ProjectVersion(const char * version, CompareType c = CompareType::All);
const QString& getVersion() const { return m_version; }
int getMajor() const { return m_major; }
int getMinor() const { return m_minor; }
int getPatch() const { return m_patch; }
const QStringList& getLabels() const { return m_labels; }
CompareType getCompareType() const { return m_compareType; }
ProjectVersion setCompareType(CompareType compareType) { m_compareType = compareType; return * this; }
static int compare(const ProjectVersion& a, const ProjectVersion& b, CompareType c);
static int compare(ProjectVersion v1, ProjectVersion v2);
private:
QString m_version;
int m_major = 0;
int m_minor = 0;
int m_patch = 0;
QStringList m_labels;
CompareType m_compareType;
} ;
/*
* ProjectVersion v. ProjectVersion
*/
inline bool operator<(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) < 0; }
inline bool operator>(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) > 0; }
inline bool operator<=(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) <= 0; }
inline bool operator>=(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) >= 0; }
inline bool operator==(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) == 0; }
inline bool operator!=(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) != 0; }
} // namespace lmms
#endif // LMMS_PROJECT_VERSION_H
| 3,126
|
C++
|
.h
| 69
| 43.42029
| 129
| 0.748849
|
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,362
|
TrackOperationsWidget.h
|
LMMS_lmms/include/TrackOperationsWidget.h
|
/*
* TrackOperationsWidget.h - declaration of TrackOperationsWidget 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_TRACK_OPERATIONS_WIDGET_H
#define LMMS_GUI_TRACK_OPERATIONS_WIDGET_H
#include <QWidget>
class QPushButton;
namespace lmms::gui
{
class PixmapButton;
class TrackGrip;
class TrackView;
class TrackOperationsWidget : public QWidget
{
Q_OBJECT
public:
TrackOperationsWidget( TrackView * parent );
~TrackOperationsWidget() override = default;
TrackGrip* getTrackGrip() const { return m_trackGrip; }
protected:
void mousePressEvent( QMouseEvent * me ) override;
void paintEvent( QPaintEvent * pe ) override;
bool confirmRemoval();
private slots:
void cloneTrack();
void removeTrack();
void updateMenu();
void selectTrackColor();
void randomizeTrackColor();
void resetTrackColor();
void resetClipColors();
void toggleRecording(bool on);
void recordingOn();
void recordingOff();
void clearTrack();
private:
TrackView * m_trackView;
TrackGrip* m_trackGrip;
QPushButton * m_trackOps;
PixmapButton * m_muteBtn;
PixmapButton * m_soloBtn;
friend class TrackView;
signals:
void trackRemovalScheduled( lmms::gui::TrackView * t );
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_TRACK_OPERATIONS_WIDGET_H
| 2,099
|
C++
|
.h
| 67
| 29.343284
| 77
| 0.77695
|
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,363
|
Lv2UridCache.h
|
LMMS_lmms/include/Lv2UridCache.h
|
/*
* Lv2UridCache.h - Lv2UridCache definition
*
* Copyright (c) 2020-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef LMMS_LV2_URID_CACHE_H
#define LMMS_LV2_URID_CACHE_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_LV2
#include <cstdint>
namespace lmms
{
//! Cached URIDs for fast access (for use in real-time code)
class Lv2UridCache
{
public:
enum class Id //!< ID for m_uridCache array
{
// keep it alphabetically (except "size" at the end)
atom_Float,
atom_Int,
bufsz_minBlockLength,
bufsz_maxBlockLength,
bufsz_nominalBlockLength,
bufsz_sequenceSize,
midi_MidiEvent,
param_sampleRate,
// exception to alphabetic ordering - keep at the end:
size
};
template<typename T>
struct IdForType;
//! Return URID for a cache ID
uint32_t operator[](Id id) const;
Lv2UridCache(class UridMap& mapper);
private:
uint32_t m_cache[static_cast<int>(Id::size)];
};
template<> struct Lv2UridCache::IdForType<float> { static constexpr auto value = Id::atom_Float; };
template<> struct Lv2UridCache::IdForType<std::int32_t> { static constexpr auto value = Id::atom_Int; };
} // namespace lmms
#endif // LMMS_HAVE_LV2
#endif // LMMS_LV2_URID_CACHE_H
| 1,992
|
C++
|
.h
| 61
| 30.508197
| 104
| 0.750784
|
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,364
|
LmmsSemaphore.h
|
LMMS_lmms/include/LmmsSemaphore.h
|
/*
* Semaphore.h - Semaphore declaration
*
* Copyright (c) 2022-2022 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.
*
*/
/*
* This code has been copied and adapted from https://github.com/drobilla/jalv
* File src/zix/sem.h
*/
#ifndef LMMS_SEMAPHORE_H
#define LMMS_SEMAPHORE_H
#include "lmmsconfig.h"
#ifdef LMMS_BUILD_APPLE
# include <mach/mach.h>
#elif defined(LMMS_BUILD_WIN32)
# include <windows.h>
#else
# include <semaphore.h>
#endif
#include <system_error>
namespace lmms {
/**
A counting semaphore.
This is an integer that is always positive, and has two main operations:
increment (post) and decrement (wait). If a decrement can not be performed
(i.e. the value is 0) the caller will be blocked until another thread posts
and the operation can succeed.
Semaphores can be created with any starting value, but typically this will
be 0 so the semaphore can be used as a simple signal where each post
corresponds to one wait.
Semaphores are very efficient (much moreso than a mutex/cond pair). In
particular, at least on Linux, post is async-signal-safe, which means it
does not block and will not be interrupted. If you need to signal from
a realtime thread, this is the most appropriate primitive to use.
@note Likely outdated with C++20's std::counting_semaphore
(though we have to check that this will be RT conforming on all platforms)
*/
class Semaphore
{
public:
Semaphore(unsigned initial);
Semaphore(const Semaphore&) = delete;
Semaphore& operator=(const Semaphore&) = delete;
Semaphore(Semaphore&&) = delete;
Semaphore& operator=(Semaphore&&) = delete;
~Semaphore();
void post();
void wait();
bool tryWait();
private:
#ifdef LMMS_BUILD_APPLE
semaphore_t m_sem;
#elif defined(LMMS_BUILD_WIN32)
HANDLE m_sem;
#else
sem_t m_sem;
#endif
};
} // namespace lmms
#endif // LMMS_SEMAPHORE_H
| 2,680
|
C++
|
.h
| 78
| 32.153846
| 80
| 0.75145
|
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,365
|
Lv2Manager.h
|
LMMS_lmms/include/Lv2Manager.h
|
/*
* Lv2Manager.h - Implementation of Lv2Manager class
*
* 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_LV2_MANAGER_H
#define LMMS_LV2_MANAGER_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_LV2
#include <map>
#include <set>
#include <string_view>
#include <lilv/lilv.h>
#include "Lv2Basics.h"
#include "Lv2UridCache.h"
#include "Lv2UridMap.h"
#include "Plugin.h"
namespace lmms
{
/*
all Lv2 classes in relation (use our "4 spaces per tab rule" to view):
explanation:
"x = {y z}" means class "x" consists of classes "y" and "z"
(and probably other classes not mentioned)
"x = {y*}" means class "x" references/uses class "y"
core:
Lv2Proc = {LilvInstance}
Lv2ControlBase = {Lv2Proc, Lv2Proc... (2 for mono, 1 for stereo)}
Lv2Manager = {LilvPlugin*, LilvPlugin* ...}
(creates Lv2ControlBase, Lv2ControlBase...)
Lv2FxControls = {Lv2ControlBase}
Lv2Effect = {Effect + Lv2FxControls}
(takes Lv2SubPluginFeatures in ctor)
Lv2Instrument = {Instrument + Lv2ControlBase}
(takes Lv2SubPluginFeatures in ctor)
gui:
Lv2ViewProc = {Lv2Proc*}
Lv2ViewBase = {Lv2ViewProc, Lv2ViewProc...
(2 for mono, 1 for stereo)}
Lv2FxControlDialog = {EffectControlDialog + Lv2ViewBase}
Lv2InsView = {InstrumentView + Lv2ViewBase}
Lv2SubPluginFeatures:
Lv2SubPluginFeatures = {Lv2Manager*}
Lv2Effect::Descriptor = {Lv2SubPluginFeatures}
Lv2Instrument::Descriptor = {Lv2SubPluginFeatures}
*/
//! Class to keep track of all LV2 plugins
class Lv2Manager
{
public:
void initPlugins();
Lv2Manager();
~Lv2Manager();
AutoLilvNode uri(const char* uriStr);
//! Class representing info for one plugin
struct Lv2Info
{
public:
//! use only for std::map internals
Lv2Info() : m_plugin(nullptr) {}
//! ctor used inside Lv2Manager
Lv2Info(const LilvPlugin* plug, Plugin::Type type, bool valid) :
m_plugin(plug), m_type(type), m_valid(valid) {}
Lv2Info(Lv2Info&& other) = default;
Lv2Info& operator=(Lv2Info&& other) = default;
const LilvPlugin* plugin() const { return m_plugin; }
Plugin::Type type() const { return m_type; }
bool isValid() const { return m_valid; }
private:
const LilvPlugin* m_plugin;
Plugin::Type m_type;
bool m_valid = false;
};
//! Return descriptor with URI @p uri or nullptr if none exists
const LilvPlugin *getPlugin(const std::string &uri);
//! Return descriptor with URI @p uri or nullptr if none exists
const LilvPlugin *getPlugin(const QString& uri);
using Lv2InfoMap = std::map<std::string, Lv2Info>;
using Iterator = Lv2InfoMap::iterator;
Iterator begin() { return m_lv2InfoMap.begin(); }
Iterator end() { return m_lv2InfoMap.end(); }
UridMap& uridMap() { return m_uridMap; }
const Lv2UridCache& uridCache() const { return m_uridCache; }
const std::set<std::string_view>& supportedFeatureURIs() const
{
return m_supportedFeatureURIs;
}
bool isFeatureSupported(const char* featName) const;
AutoLilvNodes findNodes(const LilvNode *subject,
const LilvNode *predicate, const LilvNode *object);
static bool pluginIsUnstable(const char* pluginUri)
{
return unstablePlugins.find(pluginUri) != unstablePlugins.end();
}
static bool pluginIsOnlyUsefulWithUi(const char* pluginUri)
{
return pluginsOnlyUsefulWithUi.find(pluginUri) != pluginsOnlyUsefulWithUi.end();
}
static bool pluginIsUnstableWithBuffersizeLessEqual32(const char* pluginUri)
{
return unstablePluginsBuffersizeLessEqual32.find(pluginUri) !=
unstablePluginsBuffersizeLessEqual32.end();
}
//! Whether the user generally wants a UI (and we generally support that)
//! Since we do not generally support UI right now, this will always return false...
static bool wantUi();
private:
// general data
bool m_debug; //!< if set, debug output will be printed
LilvWorld* m_world;
Lv2InfoMap m_lv2InfoMap;
std::set<std::string_view> m_supportedFeatureURIs;
// feature data that are common for all Lv2Proc
UridMap m_uridMap;
// URID cache for fast URID access
Lv2UridCache m_uridCache;
// static
static const std::set<std::string_view> unstablePlugins;
static const std::set<std::string_view> pluginsOnlyUsefulWithUi;
static const std::set<std::string_view> unstablePluginsBuffersizeLessEqual32;
// functions
bool isSubclassOf(const LilvPluginClass *clvss, const char *uriStr);
};
} // namespace lmms
#endif // LMMS_HAVE_LV2
#endif // LMMS_LV2_MANAGER_H
| 5,233
|
C++
|
.h
| 144
| 33.833333
| 85
| 0.750297
|
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,366
|
BandLimitedWave.h
|
LMMS_lmms/include/BandLimitedWave.h
|
/*
* BandLimitedWave.h - helper functions for band-limited
* waveform generation
*
* Copyright (c) 2014 Vesa Kivim√§ki <contact/dot/diizy/at/nbl/dot/fi>
*
* 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_BANDLIMITEDWAVE_H
#define LMMS_BANDLIMITEDWAVE_H
class QDataStream;
class QString;
#include "lmms_export.h"
#include "interpolation.h"
#include "lmms_basics.h"
#include "lmms_math.h"
#include "Engine.h"
#include "AudioEngine.h"
namespace lmms
{
constexpr int MAXLEN = 11;
constexpr int MIPMAPSIZE = 2 << ( MAXLEN + 1 );
constexpr int MIPMAPSIZE3 = 3 << ( MAXLEN + 1 );
constexpr int MAXTBL = 23;
constexpr int MINTLEN = 2 << 0;
constexpr int MAXTLEN = 3 << MAXLEN;
// table for table sizes
const int TLENS[MAXTBL+1] = { 2 << 0, 3 << 0, 2 << 1, 3 << 1,
2 << 2, 3 << 2, 2 << 3, 3 << 3,
2 << 4, 3 << 4, 2 << 5, 3 << 5,
2 << 6, 3 << 6, 2 << 7, 3 << 7,
2 << 8, 3 << 8, 2 << 9, 3 << 9,
2 << 10, 3 << 10, 2 << 11, 3 << 11 };
struct WaveMipMap
{
public:
inline sample_t sampleAt(int table, int ph)
{
if (table % 2 == 0) { return m_data[TLENS[table] + ph]; }
else
{
return m_data3[TLENS[table] + ph];
}
}
inline void setSampleAt(int table, int ph, sample_t sample)
{
if (table % 2 == 0) { m_data[TLENS[table] + ph] = sample; }
else
{
m_data3[TLENS[table] + ph] = sample;
}
}
private:
sample_t m_data[MIPMAPSIZE];
sample_t m_data3[MIPMAPSIZE3];
};
QDataStream& operator<< ( QDataStream &out, WaveMipMap &waveMipMap );
QDataStream& operator>> ( QDataStream &in, WaveMipMap &waveMipMap );
class LMMS_EXPORT BandLimitedWave
{
public:
enum class Waveform
{
BLSaw,
BLSquare,
BLTriangle,
BLMoog,
Count
};
constexpr static auto NumWaveforms = static_cast<std::size_t>(Waveform::Count);
BandLimitedWave() = default;
virtual ~BandLimitedWave() = default;
/*! \brief This method converts frequency to wavelength. The oscillate function takes wavelength as argument so
* use this to convert your note frequency to wavelength before using it.
*/
static inline float freqToLen( float f )
{
return freqToLen( f, Engine::audioEngine()->outputSampleRate() );
}
/*! \brief This method converts frequency to wavelength, but you can use any custom sample rate with it.
*/
static inline float freqToLen( float f, sample_rate_t sr )
{
return static_cast<float>( sr ) / f;
}
/*! \brief This method converts phase delta to wavelength. It assumes a phase scale of 0 to 1. */
static inline float pdToLen( float pd )
{
return 1.0f / pd;
}
/*! \brief This method provides interpolated samples of bandlimited waveforms.
* \param _ph The phase of the sample.
* \param _wavelen The wavelength (length of one cycle, ie. the inverse of frequency) of the wanted oscillation, measured in sample frames
* \param _wave The wanted waveform. Options currently are saw, triangle, square and moog saw.
*/
static inline sample_t oscillate( float _ph, float _wavelen, Waveform _wave )
{
// get the next higher tlen
int t = 0;
while( t < MAXTBL && _wavelen >= TLENS[t+1] ) { t++; }
int tlen = TLENS[t];
const float ph = fraction( _ph );
const float lookupf = ph * static_cast<float>( tlen );
int lookup = static_cast<int>( lookupf );
const float ip = fraction( lookupf );
const sample_t s1 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, lookup );
const sample_t s2 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, ( lookup + 1 ) % tlen );
const int lm = lookup == 0 ? tlen - 1 : lookup - 1;
const sample_t s0 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, lm );
const sample_t s3 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, ( lookup + 2 ) % tlen );
const sample_t sr = optimal4pInterpolate( s0, s1, s2, s3, ip );
return sr;
/*
lookup = lookup << 1;
tlen = tlen << 1;
t += 1;
const sample_t s3 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, lookup );
const sample_t s4 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, ( lookup + 1 ) % tlen );
const sample_t s34 = linearInterpolate( s3, s4, ip );
const float ip2 = ( ( tlen - _wavelen ) / tlen - 0.5 ) * 2.0;
return linearInterpolate( s12, s34, ip2 );
*/
};
static void generateWaves();
static bool s_wavesGenerated;
static std::array<WaveMipMap, NumWaveforms> s_waveforms;
static QString s_wavetableDir;
};
} // namespace lmms
#endif // LMMS_BANDLIMITEDWAVE_H
| 5,227
|
C++
|
.h
| 146
| 33.315068
| 140
| 0.68542
|
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,367
|
PlayHandle.h
|
LMMS_lmms/include/PlayHandle.h
|
/*
* PlayHandle.h - base class PlayHandle - core of rendering engine
*
* 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_PLAY_HANDLE_H
#define LMMS_PLAY_HANDLE_H
#include <QList>
#include <QMutex>
#include "lmms_export.h"
#include "Flags.h"
#include "ThreadableJob.h"
#include "lmms_basics.h"
class QThread;
namespace lmms
{
class Track;
class AudioPort;
class SampleFrame;
class LMMS_EXPORT PlayHandle : public ThreadableJob
{
public:
enum class Type
{
NotePlayHandle = 0x01,
InstrumentPlayHandle = 0x02,
SamplePlayHandle = 0x04,
PresetPreviewHandle = 0x08
} ;
using Types = Flags<Type>;
constexpr static std::size_t MaxNumber = 1024;
PlayHandle( const Type type, f_cnt_t offset = 0 );
PlayHandle & operator = ( PlayHandle & p )
{
m_type = p.m_type;
m_offset = p.m_offset;
m_affinity = p.m_affinity;
m_usesBuffer = p.m_usesBuffer;
m_audioPort = p.m_audioPort;
return *this;
}
virtual ~PlayHandle();
virtual bool affinityMatters() const
{
return false;
}
const QThread* affinity() const
{
return m_affinity;
}
Type type() const
{
return m_type;
}
// required for ThreadableJob
void doProcessing() override;
bool requiresProcessing() const override
{
return !isFinished();
}
void lock()
{
m_processingLock.lock();
}
void unlock()
{
m_processingLock.unlock();
}
bool tryLock()
{
return m_processingLock.tryLock();
}
virtual void play( SampleFrame* buffer ) = 0;
virtual bool isFinished() const = 0;
// returns the frameoffset at the start of the playhandle,
// ie. how many empty frames should be inserted at the start of the first period
f_cnt_t offset() const
{
return m_offset;
}
void setOffset( f_cnt_t _offset )
{
m_offset = _offset;
}
virtual bool isFromTrack( const Track * _track ) const = 0;
bool usesBuffer() const
{
return m_usesBuffer;
}
void setUsesBuffer( const bool b )
{
m_usesBuffer = b;
}
AudioPort * audioPort()
{
return m_audioPort;
}
void setAudioPort( AudioPort * port )
{
m_audioPort = port;
}
void releaseBuffer();
SampleFrame* buffer();
private:
Type m_type;
f_cnt_t m_offset;
QThread* m_affinity;
QMutex m_processingLock;
SampleFrame* m_playHandleBuffer;
bool m_bufferReleased;
bool m_usesBuffer;
AudioPort * m_audioPort;
} ;
using PlayHandleList = QList<PlayHandle*>;
using ConstPlayHandleList = QList<const PlayHandle*>;
LMMS_DECLARE_OPERATORS_FOR_FLAGS(PlayHandle::Type)
} // namespace lmms
#endif // LMMS_PLAY_HANDLE_H
| 3,334
|
C++
|
.h
| 136
| 22.25
| 81
| 0.741772
|
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,368
|
MidiController.h
|
LMMS_lmms/include/MidiController.h
|
/*
* MidiController.h - A controller to receive MIDI control-changes
*
* 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_MIDI_CONTROLLER_H
#define LMMS_MIDI_CONTROLLER_H
#include <QWidget>
#include "AutomatableModel.h"
#include "Controller.h"
#include "MidiEventProcessor.h"
#include "MidiPort.h"
namespace lmms
{
class MidiPort;
namespace gui
{
class ControllerConnectionDialog;
}
class MidiController : public Controller, public MidiEventProcessor
{
Q_OBJECT
public:
static constexpr int NONE = -1;
MidiController( Model * _parent );
~MidiController() override = default;
void processInEvent( const MidiEvent & _me,
const TimePos & _time, f_cnt_t offset = 0 ) override;
void processOutEvent( const MidiEvent& _me,
const TimePos & _time, f_cnt_t offset = 0 ) override
{
// No output yet
}
void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
void loadSettings( const QDomElement & _this ) override;
QString nodeName() const override;
// Used by controllerConnectionDialog to copy
void subscribeReadablePorts( const MidiPort::Map & _map );
public slots:
gui::ControllerDialog* createDialog( QWidget * _parent ) override;
void updateName();
protected:
// The internal per-controller get-value function
void updateValueBuffer() override;
MidiPort m_midiPort;
float m_lastValue;
float m_previousValue;
friend class gui::ControllerConnectionDialog;
friend class AutoDetectMidiController;
} ;
} // namespace lmms
#endif // LMMS_MIDI_CONTROLLER_H
| 2,338
|
C++
|
.h
| 70
| 31.214286
| 72
| 0.768956
|
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,369
|
ToolPluginView.h
|
LMMS_lmms/include/ToolPluginView.h
|
/*
* ToolPluginView.h - declaration of class ToolPluginView
*
* Copyright (c) 2006-2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* 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_GUI_TOOL_PLUGIN_VIEW_H
#define LMMS_GUI_TOOL_PLUGIN_VIEW_H
#include "PluginView.h"
namespace lmms
{
class ToolPlugin;
namespace gui
{
class LMMS_EXPORT ToolPluginView : public PluginView
{
public:
ToolPluginView( ToolPlugin * _toolPlugin );
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_TOOL_PLUGIN_VIEW_H
| 1,365
|
C++
|
.h
| 40
| 32.225
| 80
| 0.764661
|
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,370
|
ControllerRackView.h
|
LMMS_lmms/include/ControllerRackView.h
|
/*
* ControllerRackView.h - view for song's controllers
*
* Copyright (c) 2008-2009 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_RACK_VIEW_H
#define LMMS_GUI_CONTROLLER_RACK_VIEW_H
#include <QWidget>
#include <QCloseEvent>
#include "SerializingObject.h"
#include "lmms_basics.h"
class QPushButton;
class QScrollArea;
class QVBoxLayout;
namespace lmms
{
class Controller;
namespace gui
{
class ControllerView;
class ControllerRackView : public QWidget, public SerializingObject
{
Q_OBJECT
public:
ControllerRackView();
~ControllerRackView() override = default;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return "ControllerRackView";
}
public slots:
void deleteController(ControllerView* view);
void moveUp(ControllerView* view);
void moveDown(ControllerView* view);
void addController(Controller* controller);
void removeController(Controller* controller);
protected:
void closeEvent( QCloseEvent * _ce ) override;
private slots:
void addController();
private:
QVector<ControllerView *> m_controllerViews;
QScrollArea * m_scrollArea;
QVBoxLayout * m_scrollAreaLayout;
QPushButton * m_addButton;
// Stores the index of where to insert the next ControllerView.
// Needed so that the StretchItem always stays at the last position.
int m_nextIndex;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_CONTROLLER_RACK_VIEW_H
| 2,325
|
C++
|
.h
| 72
| 30.305556
| 74
| 0.782765
|
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,371
|
Lv2Features.h
|
LMMS_lmms/include/Lv2Features.h
|
/*
* Lv2Features.h - Lv2Features class
*
* Copyright (c) 2020-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef LMMS_LV2_FEATURES_H
#define LMMS_LV2_FEATURES_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_LV2
#include <map>
#include <string_view>
#include <vector>
#include "Lv2Manager.h"
namespace lmms
{
/**
Feature container
References all available features for a plugin and maps them to their URIs.
The public member functions should be called in descending order:
1. initCommon: map plugin-common features
2. operator[]: map plugin-specific features
3. createFeatureVectors: create the feature vectors required for
lilv_plugin_instantiate
4. access the latter
*/
class Lv2Features
{
public:
//! Return if a feature is supported by LMMS
static bool isFeatureSupported(const char *featName);
Lv2Features();
//! Register only plugin-common features
void initCommon();
//! Return reference to feature data with given URI featName
void*& operator[](const char* featName);
//! Fill m_features and m_featurePointers with all features
void createFeatureVectors();
//! Return LV2_Feature pointer vector, suited for lilv_plugin_instantiate
const LV2_Feature* const* featurePointers() const
{
return m_featurePointers.data();
}
//! Clear everything
void clear();
private:
//! feature storage
std::vector<LV2_Feature> m_features;
//! pointers to m_features, required for lilv_plugin_instantiate
std::vector<const LV2_Feature*> m_featurePointers;
//! features + data, ordered by URI
std::map<std::string_view, void*> m_featureByUri;
};
} // namespace lmms
#endif // LMMS_HAVE_LV2
#endif // LMMS_LV2_FEATURES_H
| 2,462
|
C++
|
.h
| 73
| 31.753425
| 80
| 0.76602
|
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,372
|
TemplatesMenu.h
|
LMMS_lmms/include/TemplatesMenu.h
|
/*
* TemplatesMenu.h
*
* Copyright (c) 2004-2022 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_TEMPLATES_MENU_H
#define LMMS_GUI_TEMPLATES_MENU_H
#include <QDir>
#include <QMenu>
namespace lmms::gui
{
class TemplatesMenu : public QMenu
{
Q_OBJECT
public:
TemplatesMenu(QWidget *parent = nullptr);
~TemplatesMenu() override = default;
private slots:
static void createNewProjectFromTemplate(QAction * _action);
void fillTemplatesMenu();
void addTemplatesFromDir( const QDir& dir );
};
} // namespace lmms::gui
#endif // LMMS_GUI_TEMPLATES_MENU_H
| 1,381
|
C++
|
.h
| 42
| 30.952381
| 77
| 0.764307
|
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,373
|
Controls.h
|
LMMS_lmms/include/Controls.h
|
/*
* Controls.h - labeled control widgets
*
* 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.
*
*/
#ifndef LMMS_GUI_CONTROLS_H
#define LMMS_GUI_CONTROLS_H
// headers only required for covariance
#include "AutomatableModel.h"
#include "ComboBoxModel.h"
class QString;
class QWidget;
class QLabel;
namespace lmms
{
class AutomatableModel;
namespace gui
{
class AutomatableModelView;
class Knob;
class ComboBox;
class LedCheckBox;
/**
These classes provide
- a control with a text label
- a type safe way to set a model
(justification: setting the wrong typed model to a widget will cause
hard-to-find runtime errors)
*/
class Control
{
public:
virtual QWidget* topWidget() = 0;
virtual void setText(const QString& text) = 0;
virtual void setModel(AutomatableModel* model) = 0;
virtual AutomatableModel* model() = 0;
virtual AutomatableModelView* modelView() = 0;
virtual ~Control() = default;
};
class KnobControl : public Control
{
Knob* m_knob;
public:
void setText(const QString& text) override;
QWidget* topWidget() override;
void setModel(AutomatableModel* model) override;
FloatModel* model() override;
AutomatableModelView* modelView() override;
KnobControl(QWidget* parent = nullptr);
~KnobControl() override = default;
};
class ComboControl : public Control
{
QWidget* m_widget;
ComboBox* m_combo;
QLabel* m_label;
public:
void setText(const QString& text) override;
QWidget* topWidget() override { return m_widget; }
void setModel(AutomatableModel* model) override;
ComboBoxModel* model() override;
AutomatableModelView* modelView() override;
ComboControl(QWidget* parent = nullptr);
~ComboControl() override = default;
};
class LcdControl : public Control
{
class LcdSpinBox* m_lcd;
public:
void setText(const QString& text) override;
QWidget* topWidget() override;
void setModel(AutomatableModel* model) override;
IntModel* model() override;
AutomatableModelView* modelView() override;
LcdControl(int numDigits, QWidget* parent = nullptr);
~LcdControl() override = default;
};
class CheckControl : public Control
{
QWidget* m_widget;
LedCheckBox* m_checkBox;
QLabel* m_label;
public:
void setText(const QString& text) override;
QWidget* topWidget() override;
void setModel(AutomatableModel* model) override;
BoolModel* model() override;
AutomatableModelView* modelView() override;
CheckControl(QWidget* parent = nullptr);
~CheckControl() override = default;
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_CONTROLS_H
| 3,338
|
C++
|
.h
| 112
| 27.857143
| 72
| 0.773739
|
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,374
|
interpolation.h
|
LMMS_lmms/include/interpolation.h
|
/*
* interpolation.h - fast implementations of several interpolation-algorithms
*
* Copyright (c) 2004-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_INTERPOLATION_H
#define LMMS_INTERPOLATION_H
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
#include <cmath>
#include "lmms_constants.h"
#include "lmms_math.h"
namespace lmms
{
inline float hermiteInterpolate( float x0, float x1, float x2, float x3,
float frac_pos )
{
const float frsq = frac_pos*frac_pos;
const float frsq2 = 2*frsq;
return( ( (x2-x0) *0.5f ) * ( frac_pos * (frsq+1) -frsq2 ) +
( frsq2*frac_pos - 3*frsq ) * ( x1-x2 ) +
frsq2 * (frac_pos-1) * ( ( x3-x1 ) * 0.25f ) + x1 );
/*
const float frsq = frac_pos*frac_pos;
//const float frsq2 = 2*frsq;
frac_pos *= 0.5;
const float frcu = frsq*frac_pos;
return (
(frcu - frsq + frac_pos) * ((x2 - x0)) +
(4*frcu - 3*frsq) * (x1 - x2)
//frsq*(2*frac_pos-3) * (x1 - x2)
+ (frcu - 0.5*frsq)*((x3 - x1))
+ x1
);
*/
}
inline float cubicInterpolate( float v0, float v1, float v2, float v3, float x )
{
float frsq = x * x;
float frcu = frsq * v0;
float t1 = v1 * 3.f + v3;
return v1 + (0.5f * frcu + x) * (v2 - frcu * (1.0f / 6.0f) -
(t1 * (1.0f / 6.0f) - v0) * (1.0f / 3.0f)) + frsq * x * (t1 *
(1.0f / 6.0f) - 0.5f * v2) + frsq * (0.5f * v2 - v1);
}
inline float cosinusInterpolate( float v0, float v1, float x )
{
const float f = ( 1.0f - cosf( x * F_PI ) ) * 0.5f;
return f * (v1 - v0) + v0;
}
inline float linearInterpolate( float v0, float v1, float x )
{
return x * (v1 - v0) + v0;
}
inline float optimalInterpolate( float v0, float v1, float x )
{
const float z = x - 0.5f;
const float even = v1 + v0;
const float odd = v1 - v0;
const float c0 = even * 0.50037842517188658;
const float c1 = odd * 1.00621089801788210;
const float c2 = even * -0.004541102062639801;
const float c3 = odd * -1.57015627178718420;
return ((c3 * z + c2) * z + c1) * z + c0;
}
inline float optimal4pInterpolate( float v0, float v1, float v2, float v3, float x )
{
const float z = x - 0.5f;
const float even1 = v2 + v1;
const float odd1 = v2 - v1;
const float even2 = v3 + v0;
const float odd2 = v3 - v0;
const float c0 = even1 * 0.45868970870461956 + even2 * 0.04131401926395584;
const float c1 = odd1 * 0.48068024766578432 + odd2 * 0.17577925564495955;
const float c2 = even1 * -0.246185007019907091 + even2 * 0.24614027139700284;
const float c3 = odd1 * -0.36030925263849456 + odd2 * 0.10174985775982505;
return ((c3 * z + c2) * z + c1) * z + c0;
}
inline float lagrangeInterpolate( float v0, float v1, float v2, float v3, float x )
{
const float c0 = v1;
const float c1 = v2 - v0 * ( 1.0f / 3.0f ) - v1 * 0.5f - v3 * ( 1.0f / 6.0f );
const float c2 = 0.5f * (v0 + v2) - v1;
const float c3 = ( 1.0f/6.0f ) * ( v3 - v0 ) + 0.5f * ( v1 - v2 );
return ((c3 * x + c2) * x + c1) * x + c0;
}
} // namespace lmms
#endif // LMMS_INTERPOLATION_H
| 3,787
|
C++
|
.h
| 107
| 32.859813
| 84
| 0.657568
|
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,375
|
SideBarWidget.h
|
LMMS_lmms/include/SideBarWidget.h
|
/*
* SideBarWidget.h - base-class for all side-bar-widgets
*
* 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_SIDE_BAR_WIDGET_H
#define LMMS_GUI_SIDE_BAR_WIDGET_H
#include <QPixmap>
#include <QVBoxLayout>
#include <QWidget>
class QPushButton;
namespace lmms::gui
{
class SideBarWidget : public QWidget
{
Q_OBJECT
public:
SideBarWidget( const QString & _title, const QPixmap & _icon,
QWidget * _parent );
~SideBarWidget() override = default;
inline const QPixmap & icon() const
{
return m_icon;
}
inline const QString & title() const
{
return m_title;
}
signals:
void closeButtonClicked();
protected:
void paintEvent( QPaintEvent * _pe ) override;
void resizeEvent( QResizeEvent * _re ) override;
void contextMenuEvent( QContextMenuEvent * ) override
{
}
QWidget * contentParent()
{
return m_contents;
}
void addContentWidget( QWidget * _w )
{
m_layout->addWidget( _w );
}
void addContentLayout( QLayout * _l )
{
m_layout->addLayout( _l );
}
private:
QWidget * m_contents;
QVBoxLayout * m_layout;
QString m_title;
QPixmap m_icon;
QPushButton * m_closeBtn;
const QSize m_buttonSize;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_SIDE_BAR_WIDGET_H
| 2,053
|
C++
|
.h
| 76
| 24.881579
| 77
| 0.743367
|
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,376
|
ProjectNotes.h
|
LMMS_lmms/include/ProjectNotes.h
|
/*
* ProjectNotes.h - header for project-notes-editor
*
* Copyright (c) 2005-2007 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_PROJECT_NOTES_H
#define LMMS_GUI_PROJECT_NOTES_H
#include <QMainWindow>
#include "SerializingObject.h"
class QAction;
class QComboBox;
class QTextCharFormat;
class QTextEdit;
namespace lmms::gui
{
class LMMS_EXPORT ProjectNotes : public QMainWindow, public SerializingObject
{
Q_OBJECT
public:
ProjectNotes();
~ProjectNotes() override = default;
void clear();
void setText( const QString & _text );
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return "projectnotes";
}
protected:
void closeEvent( QCloseEvent * _ce ) override;
void setupActions();
private slots:
void textBold();
void textUnderline();
void textItalic();
void textFamily( const QString & _f );
void textSize( const QString & _p );
void textColor();
void textAlign( QAction * _a );
void formatChanged( const QTextCharFormat & _f );
void alignmentChanged( int _a );
private:
QTextEdit * m_edit;
QAction * m_actionTextBold,
* m_actionTextUnderline,
* m_actionTextItalic,
* m_actionTextColor,
* m_actionAlignLeft,
* m_actionAlignCenter,
* m_actionAlignRight,
* m_actionAlignJustify;
QComboBox * m_comboFont;
QComboBox * m_comboSize;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_PROJECT_NOTES_H
| 2,297
|
C++
|
.h
| 75
| 28.506667
| 77
| 0.758746
|
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,377
|
LcdSpinBox.h
|
LMMS_lmms/include/LcdSpinBox.h
|
/*
* LcdSpinBox.h - class LcdSpinBox, an improved QLCDNumber
*
* 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_LCD_SPINBOX_H
#define LMMS_GUI_LCD_SPINBOX_H
#include "LcdWidget.h"
#include "AutomatableModelView.h"
namespace lmms::gui
{
class LMMS_EXPORT LcdSpinBox : public LcdWidget, public IntModelView
{
Q_OBJECT
public:
LcdSpinBox( int numDigits, QWidget* parent, const QString& name = QString() );
LcdSpinBox( int numDigits, const QString& style, QWidget* parent, const QString& name = QString() );
~LcdSpinBox() override = default;
void modelChanged() override
{
ModelView::modelChanged();
update();
}
/*! Sets an offset which is always added to value of model so we can
display values in a user-friendly way if they internally start at 0 */
void setDisplayOffset( int offset )
{
m_displayOffset = offset;
}
/*! \brief Returns internal offset for displaying values */
int displayOffset() const
{
return m_displayOffset;
}
public slots:
virtual void update();
protected:
void contextMenuEvent( QContextMenuEvent * _me ) override;
void mousePressEvent( QMouseEvent * _me ) override;
void mouseMoveEvent( QMouseEvent * _me ) override;
void mouseReleaseEvent( QMouseEvent * _me ) override;
void wheelEvent( QWheelEvent * _we ) override;
void mouseDoubleClickEvent( QMouseEvent * _me ) override;
private:
float m_remainder; //!< floating offset of spinbox in [-0.5, 0.5]
bool m_mouseMoving;
QPoint m_lastMousePos; //!< mouse position in last mouseMoveEvent
int m_displayOffset;
void enterValue();
signals:
void manualChange();
} ;
using LcdSpinBoxModel = IntModel;
} // namespace lmms::gui
#endif // LMMS_GUI_LCD_SPINBOX_H
| 2,526
|
C++
|
.h
| 73
| 32.479452
| 101
| 0.758422
|
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,378
|
FileSearch.h
|
LMMS_lmms/include/FileSearch.h
|
/*
* FileSearch.h - File system search task
*
* 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_FILE_SEARCH_H
#define LMMS_FILE_SEARCH_H
#include <QDir>
#include <QObject>
#include <atomic>
namespace lmms {
//! A Qt object that encapsulates the operation of searching the file system.
class FileSearch : public QObject
{
Q_OBJECT
public:
//! Number of milliseconds the search waits before signaling a matching result.
static constexpr int MillisecondsBetweenResults = 1;
//! Create a `FileSearch` object that uses the specified string filter `filter` and extension filters in
//! `extensions` to search within the given `paths`.
//! `excludedPaths`, `dirFilters`, and `sortFlags` can optionally be specified to exclude certain directories, filter
//! out certain types of entries, and sort the matches.
FileSearch(const QString& filter, const QStringList& paths, const QStringList& extensions,
const QStringList& excludedPaths = {}, QDir::Filters dirFilters = QDir::Filters{},
QDir::SortFlags sortFlags = QDir::SortFlags{});
//! Execute the search, emitting the `foundResult` signal when matches are found.
void operator()();
//! Cancel the search.
void cancel();
signals:
//! Emitted when a result is found when searching the file system.
void foundMatch(FileSearch* search, const QString& match);
//! Emitted when the search completes.
void searchCompleted(FileSearch* search);
private:
static auto isPathExcluded(const QString& path) -> bool;
QString m_filter;
QStringList m_paths;
QStringList m_extensions;
QStringList m_excludedPaths;
QDir::Filters m_dirFilters;
QDir::SortFlags m_sortFlags;
std::atomic<bool> m_cancel = false;
};
} // namespace lmms
#endif // LMMS_FILE_SEARCH_H
| 2,509
|
C++
|
.h
| 64
| 37.28125
| 118
| 0.764368
|
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,379
|
LmmsPalette.h
|
LMMS_lmms/include/LmmsPalette.h
|
/*
* LmmsPalette.h - dummy class for fetching palette qproperties from CSS
*
*
* Copyright (c) 2007-2014 Vesa Kivim√§ki <contact/dot/diizy/at/nbl/dot/fi>
*
* 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_PALETTE_H
#define LMMS_GUI_LMMS_PALETTE_H
#include <QWidget>
#include "lmms_export.h"
namespace lmms::gui
{
class LMMS_EXPORT LmmsPalette : public QWidget
{
Q_OBJECT
Q_PROPERTY( QColor background READ background WRITE setBackground )
Q_PROPERTY( QColor windowText READ windowText WRITE setWindowText )
Q_PROPERTY( QColor base READ base WRITE setBase )
Q_PROPERTY( QColor text READ text WRITE setText )
Q_PROPERTY( QColor button READ button WRITE setButton )
Q_PROPERTY( QColor shadow READ shadow WRITE setShadow )
Q_PROPERTY( QColor buttonText READ buttonText WRITE setButtonText )
Q_PROPERTY( QColor brightText READ brightText WRITE setBrightText )
Q_PROPERTY( QColor highlight READ highlight WRITE setHighlight )
Q_PROPERTY( QColor highlightedText READ highlightedText WRITE setHighlightedText )
public:
LmmsPalette( QWidget * parent, QStyle * stylearg );
~LmmsPalette() override = default;
#define ACCESSMET( read, write ) \
QColor read () const; \
void write ( const QColor & c ); \
ACCESSMET( background, setBackground )
ACCESSMET( windowText, setWindowText )
ACCESSMET( base, setBase )
ACCESSMET( text, setText )
ACCESSMET( button, setButton )
ACCESSMET( shadow, setShadow )
ACCESSMET( buttonText, setButtonText )
ACCESSMET( brightText, setBrightText )
ACCESSMET( highlight, setHighlight )
ACCESSMET( highlightedText, setHighlightedText )
#undef ACCESSMET
QPalette palette() const;
private:
QColor m_background;
QColor m_windowText;
QColor m_base;
QColor m_text;
QColor m_button;
QColor m_shadow;
QColor m_buttonText;
QColor m_brightText;
QColor m_highlight;
QColor m_highlightedText;
};
} // namespace lmms::gui
#endif // LMMS_GUI_LMMS_PALETTE_H
| 2,696
|
C++
|
.h
| 75
| 33.733333
| 83
| 0.773216
|
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,380
|
AudioFileDevice.h
|
LMMS_lmms/include/AudioFileDevice.h
|
/*
* AudioFileDevice.h - base-class for audio-device-classes which write
* their output into a file
*
* 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_DEVICE_H
#define LMMS_AUDIO_FILE_DEVICE_H
#include <QFile>
#include "AudioDevice.h"
#include "OutputSettings.h"
namespace lmms
{
class AudioFileDevice : public AudioDevice
{
public:
AudioFileDevice(OutputSettings const & outputSettings,
const ch_cnt_t _channels, const QString & _file,
AudioEngine* audioEngine );
~AudioFileDevice() override;
QString outputFile() const
{
return m_outputFile.fileName();
}
OutputSettings const & getOutputSettings() const { return m_outputSettings; }
protected:
int writeData( const void* data, int len );
inline bool outputFileOpened() const
{
return m_outputFile.isOpen();
}
inline int outputFileHandle() const
{
return m_outputFile.handle();
}
private:
QFile m_outputFile;
OutputSettings m_outputSettings;
} ;
using AudioFileDeviceInstantiaton
= AudioFileDevice* (*)(const QString&, const OutputSettings&, const ch_cnt_t, AudioEngine*, bool&);
} // namespace lmms
#endif // LMMS_AUDIO_FILE_DEVICE_H
| 1,999
|
C++
|
.h
| 61
| 30.688525
| 100
| 0.75871
|
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,381
|
debug.h
|
LMMS_lmms/include/debug.h
|
/*
* debug.h - header file to be included for debugging purposes
*
* 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_DEBUG_H
#define LMMS_DEBUG_H
#include "lmmsconfig.h"
// Define standard macro NDEBUG when building without debug flag to make sure asserts become no-ops.
#ifndef LMMS_DEBUG
#ifndef NDEBUG
#define NDEBUG
#endif
#endif // LMMS_DEBUG
#include <cassert>
#include <cstdio>
#endif // LMMS_DEBUG_H
| 1,252
|
C++
|
.h
| 35
| 33.942857
| 100
| 0.76218
|
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,382
|
Effect.h
|
LMMS_lmms/include/Effect.h
|
/*
* Effect.h - base class for effects
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* 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_EFFECT_H
#define LMMS_EFFECT_H
#include "Plugin.h"
#include "Engine.h"
#include "AudioEngine.h"
#include "AutomatableModel.h"
#include "TempoSyncKnobModel.h"
namespace lmms
{
class EffectChain;
class EffectControls;
namespace gui
{
class EffectView;
} // namespace gui
class LMMS_EXPORT Effect : public Plugin
{
Q_OBJECT
public:
Effect( const Plugin::Descriptor * _desc,
Model * _parent,
const Descriptor::SubPluginFeatures::Key * _key );
~Effect() override;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return "effect";
}
//! Returns true if audio was processed and should continue being processed
bool processAudioBuffer(SampleFrame* buf, const fpp_t frames);
inline ch_cnt_t processorCount() const
{
return m_processors;
}
inline void setProcessorCount( ch_cnt_t _processors )
{
m_processors = _processors;
}
inline bool isOkay() const
{
return m_okay;
}
inline void setOkay( bool _state )
{
m_okay = _state;
}
inline bool isRunning() const
{
return m_running;
}
inline void startRunning()
{
m_bufferCount = 0;
m_running = true;
}
inline void stopRunning()
{
m_running = false;
}
inline bool isEnabled() const
{
return m_enabledModel.value();
}
inline f_cnt_t timeout() const
{
const float samples = Engine::audioEngine()->outputSampleRate() * m_autoQuitModel.value() / 1000.0f;
return 1 + ( static_cast<int>( samples ) / Engine::audioEngine()->framesPerPeriod() );
}
inline float wetLevel() const
{
return m_wetDryModel.value();
}
inline float dryLevel() const
{
return 1.0f - m_wetDryModel.value();
}
inline float gate() const
{
const float level = m_gateModel.value();
return level*level * m_processors;
}
inline f_cnt_t bufferCount() const
{
return m_bufferCount;
}
inline void resetBufferCount()
{
m_bufferCount = 0;
}
inline void incrementBufferCount()
{
++m_bufferCount;
}
inline bool dontRun() const
{
return m_noRun;
}
inline void setDontRun( bool _state )
{
m_noRun = _state;
}
inline TempoSyncKnobModel* autoQuitModel()
{
return &m_autoQuitModel;
}
EffectChain * effectChain() const
{
return m_parent;
}
virtual EffectControls * controls() = 0;
static Effect * instantiate( const QString & _plugin_name,
Model * _parent,
Descriptor::SubPluginFeatures::Key * _key );
protected:
enum class ProcessStatus
{
//! Unconditionally continue processing
Continue,
//! Calculate the RMS out sum and call `checkGate` to determine whether to stop processing
ContinueIfNotQuiet,
//! Do not continue processing
Sleep
};
/**
* The main audio processing method that runs when plugin is not asleep
*/
virtual ProcessStatus processImpl(SampleFrame* buf, const fpp_t frames) = 0;
/**
* Optional method that runs when plugin is sleeping (not enabled,
* not running, not in the Okay state, or in the Don't Run state)
*/
virtual void processBypassedImpl() {}
gui::PluginView* instantiateView( QWidget * ) override;
// some effects might not be capable of higher sample-rates so they can
// sample it down before processing and back after processing
inline void sampleDown( const SampleFrame* _src_buf,
SampleFrame* _dst_buf,
sample_rate_t _dst_sr )
{
resample( 0, _src_buf,
Engine::audioEngine()->outputSampleRate(),
_dst_buf, _dst_sr,
Engine::audioEngine()->framesPerPeriod() );
}
inline void sampleBack( const SampleFrame* _src_buf,
SampleFrame* _dst_buf,
sample_rate_t _src_sr )
{
resample( 1, _src_buf, _src_sr, _dst_buf,
Engine::audioEngine()->outputSampleRate(),
Engine::audioEngine()->framesPerPeriod() * _src_sr /
Engine::audioEngine()->outputSampleRate() );
}
void reinitSRC();
virtual void onEnabledChanged() {}
private:
/**
If the setting "Keep effects running even without input" is disabled,
after "decay" ms of a signal below "gate", the effect is turned off
and won't be processed again until it receives new audio input
*/
void checkGate(double outSum);
EffectChain * m_parent;
void resample( int _i, const SampleFrame* _src_buf,
sample_rate_t _src_sr,
SampleFrame* _dst_buf, sample_rate_t _dst_sr,
const f_cnt_t _frames );
ch_cnt_t m_processors;
bool m_okay;
bool m_noRun;
bool m_running;
f_cnt_t m_bufferCount;
BoolModel m_enabledModel;
FloatModel m_wetDryModel;
FloatModel m_gateModel;
TempoSyncKnobModel m_autoQuitModel;
bool m_autoQuitDisabled;
SRC_DATA m_srcData[2];
SRC_STATE * m_srcState[2];
friend class gui::EffectView;
friend class EffectChain;
} ;
using EffectKey = Effect::Descriptor::SubPluginFeatures::Key;
using EffectKeyList = Effect::Descriptor::SubPluginFeatures::KeyList;
} // namespace lmms
#endif // LMMS_EFFECT_H
| 5,906
|
C++
|
.h
| 211
| 25.312796
| 102
| 0.734955
|
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,383
|
RenderManager.h
|
LMMS_lmms/include/RenderManager.h
|
/*
* RenderManager.h - Provides a uniform interface for rendering the project or
* individual tracks for the CLI and GUI.
*
* Copyright (c) 2015 Ryan Roden-Corrent <ryan/at/rcorre.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_RENDER_MANAGER_H
#define LMMS_RENDER_MANAGER_H
#include <memory>
#include "ProjectRenderer.h"
#include "OutputSettings.h"
namespace lmms
{
class RenderManager : public QObject
{
Q_OBJECT
public:
RenderManager(
const AudioEngine::qualitySettings & qualitySettings,
const OutputSettings & outputSettings,
ProjectRenderer::ExportFileFormat fmt,
QString outputPath);
~RenderManager() override;
/// Export all unmuted tracks into a single file
void renderProject();
/// Export all unmuted tracks into individual file
void renderTracks();
void abortProcessing();
signals:
void progressChanged( int );
void finished();
private slots:
void renderNextTrack();
void updateConsoleProgress();
private:
QString pathForTrack( const Track *track, int num );
void restoreMutedState();
void render( QString outputPath );
const AudioEngine::qualitySettings m_qualitySettings;
const AudioEngine::qualitySettings m_oldQualitySettings;
const OutputSettings m_outputSettings;
ProjectRenderer::ExportFileFormat m_format;
QString m_outputPath;
std::unique_ptr<ProjectRenderer> m_activeRenderer;
std::vector<Track*> m_tracksToRender;
std::vector<Track*> m_unmuted;
} ;
} // namespace lmms
#endif // LMMS_RENDER_MANAGER_H
| 2,262
|
C++
|
.h
| 67
| 31.641791
| 78
| 0.775989
|
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,384
|
EffectSelectDialog.h
|
LMMS_lmms/include/EffectSelectDialog.h
|
/*
* EffectSelectDialog.h - dialog to choose effect plugin
*
* Copyright (c) 2006-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2023 Lost Robot <r94231/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_EFFECT_SELECT_DIALOG_H
#define LMMS_GUI_EFFECT_SELECT_DIALOG_H
#include "Effect.h"
#include <QDialog>
#include <QHeaderView>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QPushButton>
#include <QRegularExpression>
#include <QScrollArea>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QTableView>
namespace lmms::gui
{
class DualColumnFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
DualColumnFilterProxyModel(QObject* parent = nullptr) : QSortFilterProxyModel(parent)
{
}
void setEffectTypeFilter(const QString& filter)
{
m_effectTypeFilter = filter;
invalidateFilter();
}
protected:
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override
{
QModelIndex nameIndex = sourceModel()->index(source_row, 0, source_parent);
QModelIndex typeIndex = sourceModel()->index(source_row, 1, source_parent);
QString name = sourceModel()->data(nameIndex, Qt::DisplayRole).toString();
QString type = sourceModel()->data(typeIndex, Qt::DisplayRole).toString();
// TODO: cleanup once we drop Qt5 support
#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0))
QRegularExpression nameRegularExpression(filterRegularExpression());
nameRegularExpression.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
bool nameFilterPassed = nameRegularExpression.match(name).capturedStart() != -1;
#else
QRegExp nameRegularExpression(filterRegExp());
nameRegularExpression.setCaseSensitivity(Qt::CaseInsensitive);
bool nameFilterPassed = nameRegularExpression.indexIn(name) != -1;
#endif
bool typeFilterPassed = type.contains(m_effectTypeFilter, Qt::CaseInsensitive);
return nameFilterPassed && typeFilterPassed;
}
private:
QString m_effectTypeFilter;
};
class EffectSelectDialog : public QDialog
{
Q_OBJECT
public:
EffectSelectDialog(QWidget* parent);
Effect* instantiateSelectedPlugin(EffectChain* parent);
protected slots:
void acceptSelection();
void rowChanged(const QModelIndex&, const QModelIndex&);
void updateSelection();
bool eventFilter(QObject* obj, QEvent* event) override;
private:
EffectKeyList m_effectKeys;
EffectKey m_currentSelection;
QStandardItemModel m_sourceModel;
DualColumnFilterProxyModel m_model;
QWidget* m_descriptionWidget;
QTableView* m_pluginList;
QScrollArea* m_scrollArea;
QLineEdit* m_filterEdit;
};
} // namespace lmms::gui
#endif
| 3,409
|
C++
|
.h
| 97
| 33.041237
| 87
| 0.793366
|
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,385
|
AudioEngineWorkerThread.h
|
LMMS_lmms/include/AudioEngineWorkerThread.h
|
/*
* AudioEngineWorkerThread.h - declaration of class AudioEngineWorkerThread
*
* 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_AUDIO_ENGINE_WORKER_THREAD_H
#define LMMS_AUDIO_ENGINE_WORKER_THREAD_H
#include <QThread>
#include <atomic>
class QWaitCondition;
namespace lmms
{
class AudioEngine;
class ThreadableJob;
class AudioEngineWorkerThread : public QThread
{
Q_OBJECT
public:
// internal representation of the job queue - all functions are thread-safe
class JobQueue
{
public:
enum class OperationMode
{
Static, // no jobs added while processing queue
Dynamic // jobs can be added while processing queue
} ;
static constexpr size_t JOB_QUEUE_SIZE = 8192;
JobQueue() :
m_items(),
m_writeIndex( 0 ),
m_itemsDone( 0 ),
m_opMode( OperationMode::Static )
{
std::fill(m_items, m_items + JOB_QUEUE_SIZE, nullptr);
}
void reset( OperationMode _opMode );
void addJob( ThreadableJob * _job );
void run();
void wait();
private:
std::atomic<ThreadableJob*> m_items[JOB_QUEUE_SIZE];
std::atomic_size_t m_writeIndex;
std::atomic_size_t m_itemsDone;
OperationMode m_opMode;
} ;
AudioEngineWorkerThread( AudioEngine* audioEngine );
~AudioEngineWorkerThread() override;
virtual void quit();
static void resetJobQueue( JobQueue::OperationMode _opMode =
JobQueue::OperationMode::Static )
{
globalJobQueue.reset( _opMode );
}
static void addJob( ThreadableJob * _job )
{
globalJobQueue.addJob( _job );
}
// a convenient helper function allowing to pass a container with pointers
// to ThreadableJob objects
template<typename T>
static void fillJobQueue( const T & _vec,
JobQueue::OperationMode _opMode = JobQueue::OperationMode::Static )
{
resetJobQueue( _opMode );
for (const auto& job : _vec)
{
addJob(job);
}
}
static void startAndWaitForJobs();
private:
void run() override;
static JobQueue globalJobQueue;
static QWaitCondition * queueReadyWaitCond;
static QList<AudioEngineWorkerThread *> workerThreads;
volatile bool m_quit;
} ;
} // namespace lmms
#endif // LMMS_AUDIO_ENGINE_WORKER_THREAD_H
| 2,964
|
C++
|
.h
| 98
| 27.591837
| 77
| 0.750352
|
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,386
|
CustomTextKnob.h
|
LMMS_lmms/include/CustomTextKnob.h
|
/*
* CustomTextKnob.h
*
* Copyright (c) 2020 Ibuki Sugiyama <main/at/fuwa.dev>
*
* 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_CUSTOM_TEXT_KNOB_H
#define LMMS_GUI_CUSTOM_TEXT_KNOB_H
#include "Knob.h"
namespace lmms::gui
{
class LMMS_EXPORT CustomTextKnob : public Knob
{
protected:
inline void setHintText( const QString & _txt_before, const QString & _txt_after ) {} // inaccessible
public:
CustomTextKnob( KnobType _knob_num, QWidget * _parent = nullptr, const QString & _name = QString(), const QString & _value_text = QString() );
CustomTextKnob( QWidget * _parent = nullptr, const QString & _name = QString(), const QString & _value_text = QString() ); //!< default ctor
CustomTextKnob( const Knob& other ) = delete;
inline void setValueText(const QString & _value_text)
{
m_value_text = _value_text;
}
private:
QString displayValue() const override;
protected:
QString m_value_text;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_CUSTOM_TEXT_KNOB_H
| 1,746
|
C++
|
.h
| 47
| 35.170213
| 143
| 0.741993
|
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,387
|
ToolPlugin.h
|
LMMS_lmms/include/ToolPlugin.h
|
/*
* ToolPlugin.h - declaration of class ToolPlugin, a standard interface for all
* tool plugins
*
* Copyright (c) 2006-2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* 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_TOOL_PLUGIN_H
#define LMMS_TOOL_PLUGIN_H
#include "Plugin.h"
namespace lmms
{
class LMMS_EXPORT ToolPlugin : public Plugin
{
public:
ToolPlugin( const Descriptor * _descriptor, Model * _parent );
~ToolPlugin() override = default;
// instantiate tool-plugin with given name or return NULL
// on failure
static ToolPlugin * instantiate( const QString & _plugin_name,
Model * _parent );
} ;
} // namespace lmms
#endif // LMMS_TOOL_PLUGIN_H
| 1,546
|
C++
|
.h
| 42
| 34.619048
| 80
| 0.744139
|
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,388
|
LcdWidget.h
|
LMMS_lmms/include/LcdWidget.h
|
/*
* LcdWidget.h - a widget for displaying numbers in LCD style
*
* 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_GUI_LCD_WIDGET_H
#define LMMS_GUI_LCD_WIDGET_H
#include <QMap>
#include <QWidget>
#include "lmms_export.h"
namespace lmms::gui
{
class LMMS_EXPORT LcdWidget : public QWidget
{
Q_OBJECT
// theming qproperties
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
Q_PROPERTY( QColor textShadowColor READ textShadowColor WRITE setTextShadowColor )
public:
explicit LcdWidget(QWidget* parent, const QString& name = QString(), bool leadingZero = false);
LcdWidget(int numDigits, QWidget* parent, const QString& name = QString(), bool leadingZero = false);
LcdWidget(int numDigits, const QString& style, QWidget* parent, const QString& name = QString(),
bool leadingZero = false);
void setValue(int value);
void setValue(float value);
void setLabel(const QString& label);
void addTextForValue( int value, const QString& text )
{
m_textForValue[value] = text;
update();
}
Q_PROPERTY( int numDigits READ numDigits WRITE setNumDigits )
inline int numDigits() const { return m_numDigits; }
inline void setNumDigits( int n ) { m_numDigits = n; updateSize(); }
QColor textColor() const;
void setTextColor( const QColor & c );
QColor textShadowColor() const;
void setTextShadowColor( const QColor & c );
int cellHeight() const { return m_cellHeight; }
void setSeamless(bool left, bool right)
{
m_seamlessLeft = left;
m_seamlessRight = right;
updateSize();
}
public slots:
virtual void setMarginWidth( int width );
protected:
void paintEvent( QPaintEvent * pe ) override;
virtual void updateSize();
private:
static const int charsPerPixmap = 12;
QMap<int, QString> m_textForValue;
QString m_display;
QString m_label;
QPixmap m_lcdPixmap;
QColor m_textColor;
QColor m_textShadowColor;
int m_cellWidth;
int m_cellHeight;
int m_numDigits;
int m_marginWidth;
bool m_seamlessLeft;
bool m_seamlessRight;
bool m_leadingZero;
void initUi( const QString& name, const QString &style ); //!< to be called by ctors
};
} // namespace lmms::gui
#endif // LMMS_GUI_LCD_WIDGET_H
| 2,997
|
C++
|
.h
| 87
| 32.172414
| 102
| 0.761739
|
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,389
|
TabButton.h
|
LMMS_lmms/include/TabButton.h
|
/*
* TabButton.h - declaration of class TabButton
*
* Copyright (c) 2005-2007 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_BUTTON_H
#define LMMS_GUI_TAB_BUTTON_H
#include <QPushButton>
namespace lmms::gui
{
class TabButton : public QPushButton
{
Q_OBJECT
public:
TabButton( const QString & _text, int _id, QWidget * _parent ) :
QPushButton( _text, _parent ),
m_id( _id )
{
setCheckable( true );
connect( this, SIGNAL( clicked() ), this,
SLOT( slotClicked() ) );
}
~TabButton() override = default;
signals:
void clicked( int );
protected slots:
void slotClicked()
{
emit clicked( m_id );
}
private:
int m_id;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_TAB_BUTTON_H
| 1,535
|
C++
|
.h
| 53
| 26.754717
| 77
| 0.731241
|
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,390
|
LinkedModelGroups.h
|
LMMS_lmms/include/LinkedModelGroups.h
|
/*
* LinkedModelGroups.h - base classes for groups of linked models
*
* 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.
*
*/
#ifndef LMMS_LINKED_MODEL_GROUPS_H
#define LMMS_LINKED_MODEL_GROUPS_H
#include <cstddef>
#include "Model.h"
class QDomDocument;
class QDomElement;
namespace lmms
{
/**
@file LinkedModelGroups.h
See Lv2ControlBase.h and Lv2Proc.h for example usage
*/
/**
Base class for a group of linked models
See the LinkedModelGroup class for explanations
Features:
* Models are stored by their QObject::objectName
* Models are linked automatically
*/
class LinkedModelGroup : public Model
{
Q_OBJECT
public:
/*
Initialization
*/
//! @param parent model of the LinkedModelGroups class
LinkedModelGroup(Model* parent) : Model(parent) {}
/*
Linking (initially only)
*/
void linkControls(LinkedModelGroup *other);
/*
Models
*/
struct ModelInfo
{
QString m_name;
class AutomatableModel* m_model;
ModelInfo() { /* hopefully no one will use this */ } // TODO: remove?
ModelInfo(const QString& name, AutomatableModel* model)
: m_name(name), m_model(model) {}
};
// TODO: refactor those 2
template<class Functor>
void foreach_model(const Functor& ftor)
{
for (auto itr = m_models.begin(); itr != m_models.end(); ++itr)
{
ftor(itr->first, itr->second);
}
}
template<class Functor>
void foreach_model(const Functor& ftor) const
{
for (auto itr = m_models.cbegin(); itr != m_models.cend(); ++itr)
{
ftor(itr->first, itr->second);
}
}
std::size_t modelNum() const { return m_models.size(); }
bool containsModel(const QString& name) const;
void removeControl(AutomatableModel *);
/*
Load/Save
*/
void saveValues(class QDomDocument& doc, class QDomElement& that);
void loadValues(const class QDomElement& that);
signals:
// NOTE: when separating core from UI, this will need to be removed
// (who would kno if the client is Qt, i.e. it may not have slots at all)
// In this case you'd e.g. send the UI something like
// "/added <model meta info>"
void modelAdded(lmms::AutomatableModel* added);
void modelRemoved(lmms::AutomatableModel* removed);
public:
AutomatableModel* getModel(const std::string& s)
{
auto itr = m_models.find(s);
return (itr == m_models.end()) ? nullptr : itr->second.m_model;
}
//! Register a further model
void addModel(class AutomatableModel* model, const QString& name);
//! Unregister a model, return true if a model was erased
bool eraseModel(const QString& name);
//! Remove all models
void clearModels();
private:
//! models for the controls
//! @note The AutomatableModels behind the ModelInfo are not owned,
//! but referenced after `addModel` is being called.
std::map<std::string, ModelInfo> m_models;
};
/**
Container for a group of linked models
Each group contains the same models and model types. The models are
numbered, and equal numbered models are associated and always linked.
A typical application are two mono plugins making a stereo plugin.
@note Though this class can contain multiple model groups, a corresponding
view ("LinkedModelGroupViews") will only display one group, as they all have
the same values
@note Though called "container", this class does not contain, but only
know the single groups. The inheriting classes are responsible for storage.
*/
class LinkedModelGroups
{
public:
virtual ~LinkedModelGroups() = default;
void linkAllModels();
/*
Load/Save
*/
void saveSettings(class QDomDocument& doc, class QDomElement& that);
void loadSettings(const class QDomElement& that);
/*
General
*/
//! Derived classes must return the group with index @p idx,
//! or nullptr if @p is out of range
virtual LinkedModelGroup* getGroup(std::size_t idx) = 0;
//! @see getGroup
virtual const LinkedModelGroup* getGroup(std::size_t idx) const = 0;
};
} // namespace lmms
#endif // LMMS_LINKED_MODEL_GROUPS_H
| 4,720
|
C++
|
.h
| 148
| 29.695946
| 77
| 0.7462
|
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,391
|
AudioPort.h
|
LMMS_lmms/include/AudioPort.h
|
/*
* AudioPort.h - base-class for objects providing sound at a port
*
* 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_AUDIO_PORT_H
#define LMMS_AUDIO_PORT_H
#include <memory>
#include <QString>
#include <QMutex>
#include "PlayHandle.h"
namespace lmms
{
class EffectChain;
class FloatModel;
class BoolModel;
class AudioPort : public ThreadableJob
{
public:
AudioPort( const QString & _name, bool _has_effect_chain = true,
FloatModel * volumeModel = nullptr, FloatModel * panningModel = nullptr,
BoolModel * mutedModel = nullptr );
virtual ~AudioPort();
inline SampleFrame* buffer()
{
return m_portBuffer;
}
inline void lockBuffer()
{
m_portBufferLock.lock();
}
inline void unlockBuffer()
{
m_portBufferLock.unlock();
}
// indicate whether JACK & Co should provide output-buffer at ext. port
inline bool extOutputEnabled() const
{
return m_extOutputEnabled;
}
void setExtOutputEnabled( bool _enabled );
// next mixer-channel after this audio-port
// (-1 = none 0 = master)
inline mix_ch_t nextMixerChannel() const
{
return m_nextMixerChannel;
}
inline EffectChain * effects()
{
return m_effects.get();
}
void setNextMixerChannel( const mix_ch_t _chnl )
{
m_nextMixerChannel = _chnl;
}
const QString & name() const
{
return m_name;
}
void setName( const QString & _new_name );
bool processEffects();
// ThreadableJob stuff
void doProcessing() override;
bool requiresProcessing() const override
{
return true;
}
void addPlayHandle( PlayHandle * handle );
void removePlayHandle( PlayHandle * handle );
private:
volatile bool m_bufferUsage;
SampleFrame* m_portBuffer;
QMutex m_portBufferLock;
bool m_extOutputEnabled;
mix_ch_t m_nextMixerChannel;
QString m_name;
std::unique_ptr<EffectChain> m_effects;
PlayHandleList m_playHandles;
QMutex m_playHandleLock;
FloatModel * m_volumeModel;
FloatModel * m_panningModel;
BoolModel * m_mutedModel;
friend class AudioEngine;
friend class AudioEngineWorkerThread;
} ;
} // namespace lmms
#endif // LMMS_AUDIO_PORT_H
| 2,900
|
C++
|
.h
| 105
| 25.371429
| 77
| 0.760232
|
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,392
|
MidiCCRackView.h
|
LMMS_lmms/include/MidiCCRackView.h
|
/*
* MidiCCRackView.h - declaration of the MIDI CC rack widget
*
* 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_GUI_MIDI_CC_RACK_VIEW_H
#define LMMS_GUI_MIDI_CC_RACK_VIEW_H
#include <QWidget>
#include "Midi.h"
#include "SerializingObject.h"
namespace lmms
{
class InstrumentTrack;
namespace gui
{
class Knob;
class GroupBox;
class MidiCCRackView : public QWidget, public SerializingObject
{
Q_OBJECT
public:
MidiCCRackView(InstrumentTrack * track);
~MidiCCRackView() override;
void saveSettings(QDomDocument & doc, QDomElement & parent) override;
void loadSettings(const QDomElement &) override;
inline QString nodeName() const override
{
return "MidiCCRackView";
}
private slots:
void renameWindow();
private:
InstrumentTrack *m_track;
GroupBox *m_midiCCGroupBox; // MIDI CC GroupBox (used to enable disable MIDI CC)
Knob *m_controllerKnob[MidiControllerCount]; // Holds the knob widgets for each controller
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_MIDI_CC_RACK_VIEW_H
| 1,845
|
C++
|
.h
| 57
| 30.403509
| 91
| 0.772188
|
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,393
|
ProjectRenderer.h
|
LMMS_lmms/include/ProjectRenderer.h
|
/*
* ProjectRenderer.h - ProjectRenderer class for easily rendering projects
*
* 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_PROJECT_RENDERER_H
#define LMMS_PROJECT_RENDERER_H
#include "AudioFileDevice.h"
#include "lmmsconfig.h"
#include "AudioEngine.h"
#include "OutputSettings.h"
#include "lmms_export.h"
namespace lmms
{
class LMMS_EXPORT ProjectRenderer : public QThread
{
Q_OBJECT
public:
enum class ExportFileFormat : int
{
Wave,
Flac,
Ogg,
MP3,
Count
} ;
constexpr static auto NumFileFormats = static_cast<std::size_t>(ExportFileFormat::Count);
struct FileEncodeDevice
{
bool isAvailable() const { return m_getDevInst != nullptr; }
ExportFileFormat m_fileFormat;
const char * m_description;
const char * m_extension;
AudioFileDeviceInstantiaton m_getDevInst;
} ;
ProjectRenderer( const AudioEngine::qualitySettings & _qs,
const OutputSettings & _os,
ExportFileFormat _file_format,
const QString & _out_file );
~ProjectRenderer() override = default;
bool isReady() const
{
return m_fileDev != nullptr;
}
static ExportFileFormat getFileFormatFromExtension(
const QString & _ext );
static QString getFileExtensionFromFormat( ExportFileFormat fmt );
static const std::array<FileEncodeDevice, 5> fileEncodeDevices;
public slots:
void startProcessing();
void abortProcessing();
void updateConsoleProgress();
signals:
void progressChanged( int );
private:
void run() override;
AudioFileDevice * m_fileDev;
AudioEngine::qualitySettings m_qualitySettings;
volatile int m_progress;
volatile bool m_abort;
} ;
} // namespace lmms
#endif // LMMS_PROJECT_RENDERER_H
| 2,493
|
C++
|
.h
| 81
| 28.37037
| 90
| 0.770327
|
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,394
|
EffectRackView.h
|
LMMS_lmms/include/EffectRackView.h
|
/*
* EffectRackView.h - view for effectChain-model
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn@netscape.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_GUI_EFFECT_RACK_VIEW_H
#define LMMS_GUI_EFFECT_RACK_VIEW_H
#include <QWidget>
#include "EffectChain.h"
#include "ModelView.h"
#include "lmms_basics.h"
class QScrollArea;
class QVBoxLayout;
namespace lmms::gui
{
class EffectView;
class GroupBox;
class EffectRackView : public QWidget, public ModelView
{
Q_OBJECT
public:
EffectRackView( EffectChain* model, QWidget* parent = nullptr );
~EffectRackView() override;
static constexpr int DEFAULT_WIDTH = 245;
public slots:
void clearViews();
void moveUp(EffectView* view);
void moveDown(EffectView* view);
void deletePlugin(EffectView* view);
private slots:
virtual void update();
void addEffect();
private:
void modelChanged() override;
QSize sizeHint() const override;
QSize minimumSizeHint() const override { return sizeHint(); }
inline EffectChain* fxChain()
{
return castModel<EffectChain>();
}
inline const EffectChain* fxChain() const
{
return castModel<EffectChain>();
}
QVector<EffectView *> m_effectViews;
GroupBox* m_effectsGroupBox;
QScrollArea* m_scrollArea;
int m_lastY;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_EFFECT_RACK_VIEW_H
| 2,150
|
C++
|
.h
| 70
| 28.685714
| 77
| 0.768707
|
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,395
|
FifoBuffer.h
|
LMMS_lmms/include/FifoBuffer.h
|
/*
* FifoBuffer.h - FIFO fixed-size buffer
*
* Copyright (c) 2007 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_FIFO_BUFFER_H
#define LMMS_FIFO_BUFFER_H
#include <QSemaphore>
namespace lmms
{
template<typename T>
class FifoBuffer
{
public:
FifoBuffer(int size) :
m_readSem(size),
m_writeSem(size),
m_readIndex(0),
m_writeIndex(0),
m_size(size)
{
m_buffer = new T[size];
m_readSem.acquire(size);
}
~FifoBuffer()
{
delete[] m_buffer;
m_readSem.release(m_size);
}
void write(T element)
{
m_writeSem.acquire();
m_buffer[m_writeIndex++] = element;
m_writeIndex %= m_size;
m_readSem.release();
}
T read()
{
m_readSem.acquire();
T element = m_buffer[m_readIndex++];
m_readIndex %= m_size;
m_writeSem.release();
return element;
}
void waitUntilRead()
{
m_writeSem.acquire(m_size);
m_writeSem.release(m_size);
}
bool available()
{
return m_readSem.available();
}
private:
QSemaphore m_readSem;
QSemaphore m_writeSem;
int m_readIndex;
int m_writeIndex;
int m_size;
T * m_buffer;
} ;
} // namespace lmms
#endif // LMMS_FIFO_BUFFER_H
| 1,922
|
C++
|
.h
| 81
| 21.444444
| 75
| 0.726575
|
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,396
|
InlineAutomation.h
|
LMMS_lmms/include/InlineAutomation.h
|
/*
* InlineAutomation.h - class for automating something "inline"
*
* 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_INLINE_AUTOMATION_H
#define LMMS_INLINE_AUTOMATION_H
#include "AutomationNode.h"
#include "AutomationClip.h"
#include "shared_object.h"
namespace lmms
{
class InlineAutomation : public FloatModel, public sharedObject
{
public:
InlineAutomation() :
FloatModel(),
sharedObject(),
m_autoClip( nullptr )
{
}
~InlineAutomation() override
{
if( m_autoClip )
{
delete m_autoClip;
}
}
virtual float defaultValue() const = 0;
bool hasAutomation() const
{
if( m_autoClip != nullptr && m_autoClip->getTimeMap().isEmpty() == false )
{
// Prevent saving inline automation if there's just one node at the beginning of
// the clip, which has a InValue equal to the value of model (which is going
// to be saved anyways) and no offset between the InValue and OutValue
AutomationClip::timeMap::const_iterator firstNode =
m_autoClip->getTimeMap().begin();
if (isAtInitValue()
&& m_autoClip->getTimeMap().size() == 1
&& POS(firstNode) == 0
&& INVAL(firstNode) == value()
&& OFFSET(firstNode) == 0)
{
return false;
}
return true;
}
return false;
}
AutomationClip * automationClip()
{
if( m_autoClip == nullptr )
{
m_autoClip = new AutomationClip( nullptr );
m_autoClip->addObject( this );
}
return m_autoClip;
}
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
private:
AutomationClip * m_autoClip;
} ;
} // namespace lmms
#endif // LMMS_INLINE_AUTOMATION_H
| 2,494
|
C++
|
.h
| 84
| 27.011905
| 83
| 0.726589
|
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,397
|
InstrumentSoundShaping.h
|
LMMS_lmms/include/InstrumentSoundShaping.h
|
/*
* InstrumentSoundShaping.h - declaration of class InstrumentSoundShaping
*
* 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_INSTRUMENT_SOUND_SHAPING_H
#define LMMS_INSTRUMENT_SOUND_SHAPING_H
#include "ComboBoxModel.h"
namespace lmms
{
class InstrumentTrack;
class EnvelopeAndLfoParameters;
class NotePlayHandle;
class SampleFrame;
namespace gui
{
class InstrumentSoundShapingView;
}
class InstrumentSoundShaping : public Model, public JournallingObject
{
Q_OBJECT
public:
InstrumentSoundShaping( InstrumentTrack * _instrument_track );
~InstrumentSoundShaping() override = default;
void processAudioBuffer( SampleFrame* _ab, const fpp_t _frames,
NotePlayHandle * _n );
enum class Target
{
Volume,
Cut,
Resonance,
Count
} ;
constexpr static auto NumTargets = static_cast<std::size_t>(Target::Count);
f_cnt_t envFrames( const bool _only_vol = false ) const;
f_cnt_t releaseFrames() const;
float volumeLevel( NotePlayHandle * _n, const f_cnt_t _frame );
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return "eldata";
}
private:
EnvelopeAndLfoParameters * m_envLfoParameters[NumTargets];
InstrumentTrack * m_instrumentTrack;
BoolModel m_filterEnabledModel;
ComboBoxModel m_filterModel;
FloatModel m_filterCutModel;
FloatModel m_filterResModel;
static const char *const targetNames[NumTargets][3];
friend class gui::InstrumentSoundShapingView;
} ;
} // namespace lmms
#endif // LMMS_INSTRUMENT_SOUND_SHAPING_H
| 2,438
|
C++
|
.h
| 73
| 31.205479
| 77
| 0.782572
|
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,398
|
DummyInstrument.h
|
LMMS_lmms/include/DummyInstrument.h
|
/*
* DummyInstrument.h - instrument used as fallback if an instrument couldn't
* be loaded
*
* 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_DUMMY_INSTRUMENT_H
#define LMMS_DUMMY_INSTRUMENT_H
#include "Instrument.h"
#include "InstrumentView.h"
#include "Engine.h"
#include <cstring>
#include "AudioEngine.h"
namespace lmms
{
class DummyInstrument : public Instrument
{
public:
DummyInstrument( InstrumentTrack * _instrument_track ) :
Instrument( _instrument_track, nullptr )
{
}
~DummyInstrument() override = default;
void playNote( NotePlayHandle*, SampleFrame* buffer ) override
{
zeroSampleFrames(buffer, Engine::audioEngine()->framesPerPeriod());
}
void saveSettings( QDomDocument &, QDomElement & ) override
{
}
void loadSettings( const QDomElement & ) override
{
}
QString nodeName() const override
{
return "dummyinstrument";
}
gui::PluginView * instantiateView( QWidget * _parent ) override
{
return new gui::InstrumentViewFixedSize( this, _parent );
}
} ;
} // namespace lmms
#endif // LMMS_DUMMY_INSTRUMENT_H
| 1,923
|
C++
|
.h
| 62
| 28.935484
| 77
| 0.752169
|
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,399
|
TabWidget.h
|
LMMS_lmms/include/TabWidget.h
|
/*
* TabWidget.h - LMMS-tabwidget
*
* 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_TAB_WIDGET_H
#define LMMS_GUI_TAB_WIDGET_H
#include <QWidget>
#include <QMap>
namespace lmms::gui
{
const int TEXT_TAB_HEIGHT = 14;
const int GRAPHIC_TAB_HEIGHT = 17;
class TabWidget : public QWidget
{
Q_OBJECT
public:
//! @param resizable If true, the widget resizes to fit the size of all tabs
//! If false, all child widget will be cut down to the TabWidget's size
TabWidget(const QString& caption, QWidget* parent,
bool usePixmap = false, bool resizable = false);
~TabWidget() override = default;
void addTab(QWidget* w, const QString& name, const char* pixmap = nullptr, int idx = -1);
void setActiveTab(int idx);
int findTabAtPos(const QPoint* pos);
inline int activeTab() const
{
return(m_activeTab);
}
// Themeability
Q_PROPERTY(QColor tabText READ tabText WRITE setTabText)
Q_PROPERTY(QColor tabTitleText READ tabTitleText WRITE setTabTitleText)
Q_PROPERTY(QColor tabSelected READ tabSelected WRITE setTabSelected)
Q_PROPERTY(QColor tabTextSelected READ tabTextSelected WRITE setTabTextSelected)
Q_PROPERTY(QColor tabBackground READ tabBackground WRITE setTabBackground)
Q_PROPERTY(QColor tabBorder READ tabBorder WRITE setTabBorder)
QColor tabText() const;
void setTabText(const QColor & c);
QColor tabTitleText() const;
void setTabTitleText(const QColor & c);
QColor tabSelected() const;
void setTabSelected(const QColor & c);
QColor tabTextSelected() const;
void setTabTextSelected(const QColor & c);
QColor tabBackground() const;
void setTabBackground(const QColor & c);
QColor tabBorder() const;
void setTabBorder(const QColor & c);
protected:
bool event(QEvent* event) override;
void mousePressEvent(QMouseEvent* me) override;
void paintEvent(QPaintEvent* pe) override;
void resizeEvent(QResizeEvent* re) override;
void wheelEvent(QWheelEvent* we) override;
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
private:
struct widgetDesc
{
QWidget* w; // ptr to widget
const char* pixmap; // artwork for the widget
QString name; // name for widget
int nwidth; // width of name when painting (only valid for text tab)
} ;
using widgetStack = QMap<int, widgetDesc>;
widgetStack m_widgets;
bool m_resizable;
int m_activeTab;
QString m_caption; // Tab caption, used as the tooltip text on icon tabs
quint8 m_tabbarHeight; // The height of the tab bar
quint8 m_tabheight; // The height of the tabs
bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs.
QColor m_tabText; // The color of the tabs' text.
QColor m_tabTitleText; // The color of the TabWidget's title text.
QColor m_tabSelected; // The highlighting color for the selected tab.
QColor m_tabTextSelected;// The text color for the selected tab.
QColor m_tabBackground; // The TabWidget's background color.
QColor m_tabBorder; // The TabWidget's borders color.
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_TAB_WIDGET_H
| 3,916
|
C++
|
.h
| 99
| 37.454545
| 96
| 0.759347
|
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,400
|
AudioResampler.h
|
LMMS_lmms/include/AudioResampler.h
|
/*
* AudioResampler.h - wrapper around libsamplerate
*
* 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_AUDIO_RESAMPLER_H
#define LMMS_AUDIO_RESAMPLER_H
#include <samplerate.h>
#include "lmms_export.h"
namespace lmms {
class LMMS_EXPORT AudioResampler
{
public:
struct ProcessResult
{
int error;
long inputFramesUsed;
long outputFramesGenerated;
};
AudioResampler(int interpolationMode, int channels);
AudioResampler(const AudioResampler&) = delete;
AudioResampler(AudioResampler&&) = delete;
~AudioResampler();
AudioResampler& operator=(const AudioResampler&) = delete;
AudioResampler& operator=(AudioResampler&&) = delete;
auto resample(const float* in, long inputFrames, float* out, long outputFrames, double ratio) -> ProcessResult;
auto interpolationMode() const -> int { return m_interpolationMode; }
auto channels() const -> int { return m_channels; }
void setRatio(double ratio);
private:
int m_interpolationMode = -1;
int m_channels = 0;
int m_error = 0;
SRC_STATE* m_state = nullptr;
};
} // namespace lmms
#endif // LMMS_AUDIO_RESAMPLER_H
| 1,894
|
C++
|
.h
| 55
| 32.436364
| 112
| 0.763259
|
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,401
|
AudioFileMP3.h
|
LMMS_lmms/include/AudioFileMP3.h
|
/*
* AudioFileMP3.h - Audio-device which encodes a wave stream into
* an MP3 file. This is used for song export.
*
* Copyright (c) 2017 to present Michael Gregorius <michael.gregorius.git/at/arcor[dot]de>
*
* 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_MP3_H
#define LMMS_AUDIO_FILE_MP3_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_MP3LAME
#include "AudioFileDevice.h"
#include "lame/lame.h"
namespace lmms
{
class AudioFileMP3 : public AudioFileDevice
{
public:
AudioFileMP3( OutputSettings const & outputSettings,
const ch_cnt_t _channels,
bool & successful,
const QString & _file,
AudioEngine* audioEngine );
~AudioFileMP3() override;
static AudioFileDevice * getInst( const QString & outputFilename,
OutputSettings const & outputSettings,
const ch_cnt_t channels,
AudioEngine* audioEngine,
bool & successful )
{
return new AudioFileMP3( outputSettings, channels, successful,
outputFilename, audioEngine );
}
protected:
void writeBuffer(const SampleFrame* /* _buf*/, const fpp_t /*_frames*/) override;
private:
void flushRemainingBuffers();
bool initEncoder();
void tearDownEncoder();
private:
lame_t m_lame;
};
} // namespace lmms
#endif // LMMS_HAVE_MP3LAME
#endif // LMMS_AUDIO_FILE_MP3_H
| 2,056
|
C++
|
.h
| 62
| 30.629032
| 90
| 0.74596
|
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,402
|
ThreadPool.h
|
LMMS_lmms/include/ThreadPool.h
|
/*
* ThreadPool.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_THREAD_POOL_H
#define LMMS_THREAD_POOL_H
#include <atomic>
#include <queue>
#include <tuple>
#include <type_traits>
#include <vector>
#include <condition_variable>
#include <future>
#include <mutex>
#include <thread>
namespace lmms {
//! A thread pool that can be used for asynchronous processing.
class ThreadPool
{
public:
//! Destroys the `ThreadPool` object.
//! This blocks until all workers have finished executing.
~ThreadPool();
//! Enqueue function `fn` with arguments `args` to be ran asynchronously.
template <typename Fn, typename... Args>
auto enqueue(Fn&& fn, Args&&... args) -> std::future<std::invoke_result_t<Fn, Args...>>
{
using ReturnType = std::invoke_result_t<Fn, Args...>;
auto promise = std::make_shared<std::promise<ReturnType>>();
auto task = [promise, fn = std::forward<Fn>(fn), args = std::make_tuple(std::forward<Args>(args)...)]
{
if constexpr (!std::is_same_v<ReturnType, void>)
{
promise->set_value(std::apply(fn, args));
return;
}
std::apply(fn, args);
promise->set_value();
};
{
const auto lock = std::unique_lock{m_runMutex};
m_queue.push(std::move(task));
}
m_runCond.notify_one();
return promise->get_future();
}
//! Return the number of worker threads used.
auto numWorkers() const -> size_t;
//! Return the global `ThreadPool` instance.
static auto instance() -> ThreadPool&;
private:
ThreadPool(size_t numWorkers);
void run();
std::vector<std::thread> m_workers;
std::queue<std::function<void()>> m_queue;
std::atomic<bool> m_done = false;
std::condition_variable m_runCond;
std::mutex m_runMutex;
inline static size_t s_numWorkers = std::thread::hardware_concurrency();
};
} // namespace lmms
#endif // LMMS_THREAD_POOL_H
| 2,600
|
C++
|
.h
| 81
| 29.839506
| 104
| 0.71799
|
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,404
|
PluginIssue.h
|
LMMS_lmms/include/PluginIssue.h
|
/*
* PluginIssue.h - PluginIssue class
*
* Copyright (c) 2019 Johannes Lorenz <j.git$$$lorenz-ho.me, $$$=@>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef LMMS_PLUGIN_ISSUE_H
#define LMMS_PLUGIN_ISSUE_H
#include <QDebug>
#include <string>
namespace lmms
{
//! Types of issues that can cause LMMS to not load a plugin
//! LMMS Plugins should use this to indicate errors
enum class PluginIssueType
{
// port flow & type
UnknownPortFlow,
UnknownPortType,
// channel count
TooManyInputChannels,
TooManyOutputChannels,
TooManyMidiInputChannels,
TooManyMidiOutputChannels,
NoOutputChannel,
// port metadata
PortHasNoDef,
PortHasNoMin,
PortHasNoMax,
MinGreaterMax,
DefaultValueNotInRange,
LogScaleMinMissing,
LogScaleMaxMissing,
LogScaleMinMaxDifferentSigns,
// features
FeatureNotSupported, //!< plugin requires functionality LMMS can't offer
// misc
BadPortType, //!< port type not supported
Blocked,
NoIssue
};
//! Issue type bundled with informational string
class PluginIssue
{
static const char* msgFor(const PluginIssueType& it);
PluginIssueType m_issueType;
std::string m_info;
public:
PluginIssue(PluginIssueType it, std::string msg = std::string())
: m_issueType(it), m_info(msg)
{
}
PluginIssueType type() const { return m_issueType; }
bool operator==(const PluginIssue& other) const;
bool operator<(const PluginIssue& other) const;
friend QDebug operator<<(QDebug stream, const PluginIssue& iss);
};
QDebug operator<<(QDebug stream, const PluginIssue& iss);
} // namespace lmms
#endif // LMMS_PLUGIN_ISSUE_H
| 2,317
|
C++
|
.h
| 77
| 28.207792
| 73
| 0.773991
|
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,405
|
PixmapButton.h
|
LMMS_lmms/include/PixmapButton.h
|
/*
* PixmapButton.h - declaration of class pixmapButton
*
* 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_PIXMAP_BUTTON_H
#define LMMS_GUI_PIXMAP_BUTTON_H
#include <QPixmap>
#include "AutomatableButton.h"
namespace lmms::gui
{
class LMMS_EXPORT PixmapButton : public AutomatableButton
{
Q_OBJECT
public:
PixmapButton( QWidget * _parent,
const QString & _name = QString() );
~PixmapButton() override = default;
void setActiveGraphic( const QPixmap & _pm );
void setInactiveGraphic( const QPixmap & _pm, bool _update = true );
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
signals:
void doubleClicked();
protected:
void paintEvent( QPaintEvent * _pe ) override;
void mousePressEvent( QMouseEvent * _me ) override;
void mouseReleaseEvent( QMouseEvent * _me ) override;
void mouseDoubleClickEvent( QMouseEvent * _me ) override;
private:
bool isActive() const;
private:
QPixmap m_activePixmap;
QPixmap m_inactivePixmap;
bool m_pressed;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_PIXMAP_BUTTON_H
| 1,903
|
C++
|
.h
| 56
| 31.910714
| 77
| 0.763388
|
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,406
|
Lv2Evbuf.h
|
LMMS_lmms/include/Lv2Evbuf.h
|
/*
* Lv2Evbuf.h - Lv2 event buffer definitions
*
* Copyright (c) 2019-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
/*
* The original code was written by David Robillard <http://drobilla.net>
* Original version: 6f22ee0 from https://github.com/drobilla/jalv.git
* Minor changes have been done, but no functional changes.
* Considering this as an "external library", the identifiers do not need to
* match the LMMS coding conventions.
*/
#ifndef LMMS_LV2_EVBUF_H
#define LMMS_LV2_EVBUF_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_LV2
#include <cstdint>
namespace lmms
{
/**
An abstract/opaque LV2 event buffer.
*/
using LV2_Evbuf = struct LV2_Evbuf_Impl;
/**
An iterator over an LV2_Evbuf.
*/
struct LV2_Evbuf_Iterator
{
LV2_Evbuf* evbuf;
uint32_t offset;
};
/**
Allocate a new, empty event buffer.
URIDs for atom:Chunk and atom:Sequence must be passed for LV2_EVBUF_ATOM.
*/
LV2_Evbuf*
lv2_evbuf_new(uint32_t capacity, uint32_t atom_Chunk, uint32_t atom_Sequence);
/**
Free an event buffer allocated with lv2_evbuf_new.
*/
void
lv2_evbuf_free(LV2_Evbuf* evbuf);
/**
Clear and initialize an existing event buffer.
The contents of buf are ignored entirely and overwritten, except capacity
which is unmodified.
If input is false and this is an atom buffer, the buffer will be prepared
for writing by the plugin. This MUST be called before every run cycle.
*/
void
lv2_evbuf_reset(LV2_Evbuf* evbuf, bool input);
/**
Return the total padded size of the events stored in the buffer.
*/
uint32_t
lv2_evbuf_get_size(LV2_Evbuf* evbuf);
/**
Return the actual buffer implementation.
The format of the buffer returned depends on the buffer type.
*/
void*
lv2_evbuf_get_buffer(LV2_Evbuf* evbuf);
/**
Return an iterator to the start of `evbuf`.
*/
LV2_Evbuf_Iterator
lv2_evbuf_begin(LV2_Evbuf* evbuf);
/**
Return an iterator to the end of `evbuf`.
*/
LV2_Evbuf_Iterator
lv2_evbuf_end(LV2_Evbuf* evbuf);
/**
Check if `iter` is valid.
@return True if `iter` is valid, otherwise false (past end of buffer)
*/
bool
lv2_evbuf_is_valid(LV2_Evbuf_Iterator iter);
/**
Advance `iter` forward one event.
`iter` must be valid.
@return True if `iter` is valid, otherwise false (reached end of buffer)
*/
LV2_Evbuf_Iterator
lv2_evbuf_next(LV2_Evbuf_Iterator iter);
/**
Dereference an event iterator (i.e. get the event currently pointed to).
`iter` must be valid.
`type` Set to the type of the event.
`size` Set to the size of the event.
`data` Set to the contents of the event.
@return True on success.
*/
bool
lv2_evbuf_get( LV2_Evbuf_Iterator iter,
uint32_t* frames,
uint32_t* type,
uint32_t* size,
uint8_t** data);
/**
Write an event at `iter`.
The event (if any) pointed to by `iter` will be overwritten, and `iter`
incremented to point to the following event (i.e. several calls to this
function can be done in sequence without twiddling iter in-between).
@return True if event was written, otherwise false (buffer is full).
*/
bool
lv2_evbuf_write( LV2_Evbuf_Iterator* iter,
uint32_t frames,
uint32_t type,
uint32_t size,
const uint8_t* data);
} // namespace lmms
#endif // LMMS_HAVE_LV2
#endif // LMMS_LV2_EVBUF_H
| 4,067
|
C++
|
.h
| 133
| 28.195489
| 80
| 0.736506
|
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,407
|
Midi.h
|
LMMS_lmms/include/Midi.h
|
/*
* Midi.h - constants, structs etc. concerning MIDI
*
* 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_H
#define LMMS_MIDI_H
#include "lmms_basics.h"
namespace lmms
{
enum MidiEventTypes
{
// messages
MidiNoteOff = 0x80,
MidiNoteOn = 0x90,
MidiKeyPressure = 0xA0,
MidiControlChange = 0xB0,
MidiProgramChange = 0xC0,
MidiChannelPressure = 0xD0,
MidiPitchBend = 0xE0,
// system exclusive
MidiSysEx= 0xF0,
// system common - never in midi files
MidiTimeCode= 0xF1,
MidiSongPosition = 0xF2,
MidiSongSelect = 0xF3,
MidiTuneRequest = 0xF6,
MidiEOX= 0xF7,
// system real-time - never in midi files
MidiSync = 0xF8,
MidiTick = 0xF9,
MidiStart = 0xFA,
MidiContinue = 0xFB,
MidiStop = 0xFC,
MidiActiveSensing = 0xFE,
MidiSystemReset = 0xFF,
// meta event - for midi files only
MidiMetaEvent = 0xFF
} ;
enum MidiMetaEventTypes
{
MidiMetaInvalid = 0x00,
MidiCopyright = 0x02,
MidiTrackName = 0x03,
MidiInstName = 0x04,
MidiLyric = 0x05,
MidiMarker = 0x06,
MidiCuePoint = 0x07,
MidiPortNumber = 0x21,
MidiEOT = 0x2f,
MidiSetTempo = 0x51,
MidiSMPTEOffset = 0x54,
MidiTimeSignature = 0x58,
MidiKeySignature = 0x59,
MidiSequencerEvent = 0x7f,
MidiMetaCustom = 0x80,
MidiNotePanning
} ;
using MidiMetaEventType = MidiMetaEventTypes;
enum MidiStandardControllers
{
MidiControllerBankSelect = 0,
MidiControllerModulationWheel = 1,
MidiControllerBreathController = 2,
MidiControllerFootController = 4,
MidiControllerPortamentoTime = 5,
MidiControllerDataEntry = 6,
MidiControllerMainVolume = 7,
MidiControllerBalance = 8,
MidiControllerPan = 10,
MidiControllerEffectControl1 = 12,
MidiControllerEffectControl2 = 13,
MidiControllerSustain = 64,
MidiControllerPortamento = 65,
MidiControllerSostenuto = 66,
MidiControllerSoftPedal = 67,
MidiControllerLegatoFootswitch = 68,
MidiControllerRegisteredParameterNumberLSB = 100,
MidiControllerRegisteredParameterNumberMSB = 101,
// Channel Mode Messages are controllers too...
MidiControllerAllSoundOff = 120,
MidiControllerResetAllControllers = 121,
MidiControllerLocalControl = 122,
MidiControllerAllNotesOff = 123,
MidiControllerOmniOn = 124,
MidiControllerOmniOff = 125,
MidiControllerMonoOn = 126,
MidiControllerPolyOn = 127,
};
enum MidiControllerRegisteredParameterNumbers
{
MidiPitchBendSensitivityRPN = 0x0000,
MidiChannelFineTuningRPN = 0x0001,
MidiChannelCoarseTuningRPN = 0x0002,
MidiTuningProgramChangeRPN = 0x0003,
MidiTuningBankSelectRPN = 0x0004,
MidiModulationDepthRangeRPN = 0x0005,
MidiNullFunctionNumberRPN = 0x7F7F
};
const int MidiChannelCount = 16;
const int MidiControllerCount = 128;
const int MidiProgramCount = 128;
const int MidiMaxVelocity = 127;
const int MidiDefaultVelocity = MidiMaxVelocity / 2;
const int MidiMaxControllerValue = 127;
const int MidiMaxKey = 127;
const int MidiMaxPanning = 127;
const int MidiMinPanning = -128;
const int MidiMinPitchBend = 0;
const int MidiMaxPitchBend = 16383;
} // namespace lmms
#endif // LMMS_MIDI_H
| 3,832
|
C++
|
.h
| 130
| 27.6
| 77
| 0.798426
|
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,408
|
SharedMemory.h
|
LMMS_lmms/include/SharedMemory.h
|
/*
* SharedMemory.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_SHARED_MEMORY_H
#define LMMS_SHARED_MEMORY_H
#include <memory>
#include <string>
#include <type_traits>
namespace lmms
{
namespace detail
{
class SharedMemoryImpl;
class SharedMemoryData
{
public:
SharedMemoryData() noexcept;
SharedMemoryData(std::string&& key, bool readOnly);
SharedMemoryData(std::string&& key, std::size_t size, bool readOnly);
~SharedMemoryData();
SharedMemoryData(SharedMemoryData&& other) noexcept;
SharedMemoryData& operator=(SharedMemoryData&& other) noexcept
{
auto temp = std::move(other);
swap(*this, temp);
return *this;
}
friend void swap(SharedMemoryData& a, SharedMemoryData& b) noexcept
{
using std::swap;
swap(a.m_key, b.m_key);
swap(a.m_impl, b.m_impl);
swap(a.m_ptr, b.m_ptr);
}
const std::string& key() const noexcept { return m_key; }
void* get() const noexcept { return m_ptr; }
private:
std::string m_key;
std::unique_ptr<SharedMemoryImpl> m_impl;
void* m_ptr = nullptr;
};
} // namespace detail
template<typename T>
class SharedMemory
{
// This is stricter than necessary, but keeps things easy for now
static_assert(std::is_trivial_v<T>, "objects held in shared memory must be trivial");
public:
SharedMemory() = default;
SharedMemory(SharedMemory&&) = default;
SharedMemory& operator=(SharedMemory&&) = default;
void attach(std::string key)
{
m_data = detail::SharedMemoryData{std::move(key), std::is_const_v<T>};
}
void create(std::string key)
{
m_data = detail::SharedMemoryData{std::move(key), sizeof(T), std::is_const_v<T>};
}
void detach() noexcept
{
m_data = detail::SharedMemoryData{};
}
const std::string& key() const noexcept { return m_data.key(); }
T* get() const noexcept { return static_cast<T*>(m_data.get()); }
T* operator->() const noexcept { return get(); }
T& operator*() const noexcept { return *get(); }
explicit operator bool() const noexcept { return get() != nullptr; }
private:
detail::SharedMemoryData m_data;
};
template<typename T>
class SharedMemory<T[]>
{
// This is stricter than necessary, but keeps things easy for now
static_assert(std::is_trivial_v<T>, "objects held in shared memory must be trivial");
public:
SharedMemory() = default;
SharedMemory(SharedMemory&&) = default;
SharedMemory& operator=(SharedMemory&&) = default;
void attach(std::string key)
{
m_data = detail::SharedMemoryData{std::move(key), std::is_const_v<T>};
}
void create(std::string key, std::size_t size)
{
m_data = detail::SharedMemoryData{std::move(key), size * sizeof(T), std::is_const_v<T>};
}
void detach() noexcept
{
m_data = detail::SharedMemoryData{};
}
const std::string& key() const noexcept { return m_data.key(); }
T* get() const noexcept { return static_cast<T*>(m_data.get()); }
T& operator[](std::size_t index) const noexcept { return get()[index]; }
explicit operator bool() const noexcept { return get() != nullptr; }
private:
detail::SharedMemoryData m_data;
};
} // namespace lmms
#endif // LMMS_SHARED_MEMORY_H
| 3,887
|
C++
|
.h
| 121
| 30.016529
| 90
| 0.728782
|
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,409
|
AudioSndio.h
|
LMMS_lmms/include/AudioSndio.h
|
/*
* AudioSndio.h - base-class that implements sndio audio 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_AUDIO_SNDIO_H
#define LMMS_AUDIO_SNDIO_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_SNDIO
#include <QThread>
#include <sndio.h>
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"
class QLineEdit;
namespace lmms
{
namespace gui
{
class LcdSpinBox;
}
class AudioSndio : public QThread, public AudioDevice
{
Q_OBJECT
public:
AudioSndio( bool & _success_ful, AudioEngine * _audioEngine );
~AudioSndio() override;
inline static QString name()
{
return QT_TRANSLATE_NOOP( "AudioDeviceSetupWidget", "sndio" );
}
class setupWidget : public gui::AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
~setupWidget() override = default;
void saveSettings() override;
private:
QLineEdit * m_device;
gui::LcdSpinBox * m_channels;
} ;
private:
void startProcessing() override;
void stopProcessing() override;
void run() override;
struct sio_hdl *m_hdl;
struct sio_par m_par;
bool m_convertEndian;
} ;
} // namespace lmms
#endif // LMMS_HAVE_SNDIO
#endif // LMMS_AUDIO_SNDIO_H
| 2,020
|
C++
|
.h
| 70
| 26.814286
| 70
| 0.759461
|
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,410
|
SampleBuffer.h
|
LMMS_lmms/include/SampleBuffer.h
|
/*
* SampleBuffer.h - container-class SampleBuffer
*
* 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_BUFFER_H
#define LMMS_SAMPLE_BUFFER_H
#include <QByteArray>
#include <QString>
#include <memory>
#include <optional>
#include <samplerate.h>
#include <vector>
#include "AudioEngine.h"
#include "Engine.h"
#include "lmms_basics.h"
#include "lmms_export.h"
namespace lmms {
class LMMS_EXPORT SampleBuffer
{
public:
using value_type = SampleFrame;
using reference = SampleFrame&;
using const_reference = const SampleFrame&;
using iterator = std::vector<SampleFrame>::iterator;
using const_iterator = std::vector<SampleFrame>::const_iterator;
using difference_type = std::vector<SampleFrame>::difference_type;
using size_type = std::vector<SampleFrame>::size_type;
using reverse_iterator = std::vector<SampleFrame>::reverse_iterator;
using const_reverse_iterator = std::vector<SampleFrame>::const_reverse_iterator;
SampleBuffer() = default;
explicit SampleBuffer(const QString& audioFile);
SampleBuffer(const QString& base64, int sampleRate);
SampleBuffer(std::vector<SampleFrame> data, int sampleRate);
SampleBuffer(
const SampleFrame* data, size_t numFrames, int sampleRate = Engine::audioEngine()->outputSampleRate());
friend void swap(SampleBuffer& first, SampleBuffer& second) noexcept;
auto toBase64() const -> QString;
auto audioFile() const -> const QString& { return m_audioFile; }
auto sampleRate() const -> sample_rate_t { return m_sampleRate; }
auto begin() -> iterator { return m_data.begin(); }
auto end() -> iterator { return m_data.end(); }
auto begin() const -> const_iterator { return m_data.begin(); }
auto end() const -> const_iterator { return m_data.end(); }
auto cbegin() const -> const_iterator { return m_data.cbegin(); }
auto cend() const -> const_iterator { return m_data.cend(); }
auto rbegin() -> reverse_iterator { return m_data.rbegin(); }
auto rend() -> reverse_iterator { return m_data.rend(); }
auto rbegin() const -> const_reverse_iterator { return m_data.rbegin(); }
auto rend() const -> const_reverse_iterator { return m_data.rend(); }
auto crbegin() const -> const_reverse_iterator { return m_data.crbegin(); }
auto crend() const -> const_reverse_iterator { return m_data.crend(); }
auto data() const -> const SampleFrame* { return m_data.data(); }
auto size() const -> size_type { return m_data.size(); }
auto empty() const -> bool { return m_data.empty(); }
static auto emptyBuffer() -> std::shared_ptr<const SampleBuffer>;
private:
std::vector<SampleFrame> m_data;
QString m_audioFile;
sample_rate_t m_sampleRate = Engine::audioEngine()->outputSampleRate();
};
} // namespace lmms
#endif // LMMS_SAMPLE_BUFFER_H
| 3,552
|
C++
|
.h
| 81
| 41.876543
| 105
| 0.741384
|
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,411
|
TrackContainerView.h
|
LMMS_lmms/include/TrackContainerView.h
|
/*
* TrackContainerView.h - view-component for TrackContainer
*
* 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_TRACK_CONTAINER_VIEW_H
#define LMMS_GUI_TRACK_CONTAINER_VIEW_H
#include <QVector>
#include <QScrollArea>
#include <QWidget>
#include <QThread>
#include "JournallingObject.h"
#include "ModelView.h"
#include "Rubberband.h"
#include "TimePos.h"
class QVBoxLayout;
namespace lmms
{
class InstrumentTrack;
class Track;
class TrackContainer;
class InstrumentLoaderThread : public QThread
{
Q_OBJECT
public:
InstrumentLoaderThread( QObject *parent = 0, InstrumentTrack *it = 0,
QString name = "" );
void run() override;
private:
InstrumentTrack *m_it;
QString m_name;
QThread *m_containerThread;
};
namespace gui
{
class TrackView;
class TrackContainerView : public QWidget, public ModelView,
public JournallingObject,
public SerializingObjectHook
{
Q_OBJECT
public:
TrackContainerView( TrackContainer* tc );
~TrackContainerView() override;
void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
void loadSettings( const QDomElement & _this ) override;
QScrollArea * contentWidget()
{
return m_scrollArea;
}
inline const TimePos & currentPosition() const
{
return m_currentPosition;
}
virtual bool fixedClips() const
{
return false;
}
inline float pixelsPerBar() const
{
return m_ppb;
}
void setPixelsPerBar( int ppb );
const TrackView * trackViewAt( const int _y ) const;
virtual bool allowRubberband() const;
virtual bool knifeMode() const;
inline bool rubberBandActive() const
{
return m_rubberBand->isEnabled() && m_rubberBand->isVisible();
}
inline QVector<selectableObject *> selectedObjects()
{
return m_rubberBand->selectedObjects();
}
TrackContainer* model()
{
return m_tc;
}
const TrackContainer* model() const
{
return m_tc;
}
const QList<TrackView *> & trackViews() const
{
return( m_trackViews );
}
void moveTrackView( TrackView * trackView, int indexTo );
void moveTrackViewUp( TrackView * trackView );
void moveTrackViewDown( TrackView * trackView );
void scrollToTrackView( TrackView * _tv );
// -- for usage by trackView only ---------------
TrackView * addTrackView( TrackView * _tv );
void removeTrackView( TrackView * _tv );
// -------------------------------------------------------
void clearAllTracks();
QString nodeName() const override
{
return "trackcontainerview";
}
unsigned int totalHeightOfTracks() const;
RubberBand *rubberBand() const;
public slots:
void realignTracks();
lmms::gui::TrackView * createTrackView( lmms::Track * _t );
void deleteTrackView( lmms::gui::TrackView * _tv );
void dropEvent( QDropEvent * _de ) override;
void dragEnterEvent( QDragEnterEvent * _dee ) override;
///
/// \brief stopRubberBand
/// Removes the rubber band from display when finished with.
void stopRubberBand();
protected:
static const int DEFAULT_PIXELS_PER_BAR = 128;
TimePos m_currentPosition;
private:
class scrollArea : public QScrollArea
{
public:
scrollArea( TrackContainerView* parent );
~scrollArea() override = default;
protected:
void wheelEvent( QWheelEvent * _we ) override;
private:
TrackContainerView* m_trackContainerView;
} ;
friend class TrackContainerView::scrollArea;
TrackContainer* m_tc;
using trackViewList = QList<TrackView*>;
trackViewList m_trackViews;
scrollArea * m_scrollArea;
QVBoxLayout * m_scrollLayout;
float m_ppb;
RubberBand * m_rubberBand;
signals:
void positionChanged( const lmms::TimePos & _pos );
void tracksRealigned();
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_TRACK_CONTAINER_VIEW_H
| 4,509
|
C++
|
.h
| 158
| 26.265823
| 77
| 0.751629
|
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,412
|
RemotePluginClient.h
|
LMMS_lmms/include/RemotePluginClient.h
|
/*
* RemotePluginClient.h
*
* 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_CLIENT_H
#define LMMS_REMOTE_PLUGIN_CLIENT_H
#include "RemotePluginBase.h"
#include <stdexcept>
#ifndef LMMS_BUILD_WIN32
# include <condition_variable>
# include <mutex>
# include <thread>
# include <signal.h>
# include <unistd.h>
#endif
#include "SharedMemory.h"
#include "VstSyncData.h"
namespace lmms
{
class SampleFrame;
class RemotePluginClient : public RemotePluginBase
{
public:
#ifdef SYNC_WITH_SHM_FIFO
RemotePluginClient( const std::string& _shm_in, const std::string& _shm_out );
#else
RemotePluginClient( const char * socketPath );
#endif
~RemotePluginClient() override;
const VstSyncData* getVstSyncData();
bool processMessage( const message & _m ) override;
virtual void process( const SampleFrame* _in_buf,
SampleFrame* _out_buf ) = 0;
virtual void processMidiEvent( const MidiEvent&, const f_cnt_t /* _offset */ )
{
}
virtual void updateSampleRate()
{
}
virtual void updateBufferSize()
{
}
inline sample_rate_t sampleRate() const
{
return m_sampleRate;
}
inline fpp_t bufferSize() const
{
return m_bufferSize;
}
void setInputCount( int _i )
{
m_inputCount = _i;
sendMessage( message( IdChangeInputCount ).addInt( _i ) );
}
void setOutputCount( int _i )
{
m_outputCount = _i;
sendMessage( message( IdChangeOutputCount ).addInt( _i ) );
}
void setInputOutputCount( int i, int o )
{
m_inputCount = i;
m_outputCount = o;
sendMessage( message( IdChangeInputOutputCount )
.addInt( i )
.addInt( o ) );
}
virtual int inputCount() const
{
return m_inputCount;
}
virtual int outputCount() const
{
return m_outputCount;
}
void debugMessage( const std::string & _s )
{
sendMessage( message( IdDebugMessage ).addString( _s ) );
}
private:
void setShmKey(const std::string& key);
void doProcessing();
SharedMemory<float[]> m_audioBuffer;
SharedMemory<const VstSyncData> m_vstSyncData;
int m_inputCount;
int m_outputCount;
sample_rate_t m_sampleRate;
fpp_t m_bufferSize;
} ;
#ifndef LMMS_BUILD_WIN32
class PollParentThread
{
public:
PollParentThread() :
m_stop{false},
m_thread{
[this]
{
using namespace std::literals::chrono_literals;
auto lock = std::unique_lock{m_mutex};
while (!m_cv.wait_for(lock, 500ms, [this] { return m_stop; }))
{
if (getppid() == 1)
{
kill(getpid(), SIGHUP);
break;
}
}
}
}
{ }
~PollParentThread()
{
{
const auto lock = std::unique_lock{m_mutex};
m_stop = true;
}
m_cv.notify_all();
m_thread.join();
}
private:
bool m_stop;
std::mutex m_mutex;
std::condition_variable m_cv;
std::thread m_thread;
};
#endif // LMMS_BUILD_WIN32
#ifdef SYNC_WITH_SHM_FIFO
RemotePluginClient::RemotePluginClient( const std::string& _shm_in, const std::string& _shm_out ) :
RemotePluginBase( new shmFifo( _shm_in ), new shmFifo( _shm_out ) ),
#else
RemotePluginClient::RemotePluginClient( const char * socketPath ) :
RemotePluginBase(),
#endif
m_inputCount( 0 ),
m_outputCount( 0 ),
m_sampleRate( 44100 ),
m_bufferSize( 0 )
{
#ifndef SYNC_WITH_SHM_FIFO
struct sockaddr_un sa;
sa.sun_family = AF_LOCAL;
size_t length = strlen( socketPath );
if ( length >= sizeof sa.sun_path )
{
length = sizeof sa.sun_path - 1;
fprintf( stderr, "Socket path too long.\n" );
}
memcpy( sa.sun_path, socketPath, length );
sa.sun_path[length] = '\0';
m_socket = socket( PF_LOCAL, SOCK_STREAM, 0 );
if ( m_socket == -1 )
{
fprintf( stderr, "Could not connect to local server.\n" );
}
if ( ::connect( m_socket, (struct sockaddr *) &sa, sizeof sa ) == -1 )
{
fprintf( stderr, "Could not connect to local server.\n" );
}
#endif
}
RemotePluginClient::~RemotePluginClient()
{
sendMessage( IdQuit );
#ifndef SYNC_WITH_SHM_FIFO
if ( close( m_socket ) == -1)
{
fprintf( stderr, "Error freeing resources.\n" );
}
#endif
}
const VstSyncData* RemotePluginClient::getVstSyncData()
{
return m_vstSyncData.get();
}
bool RemotePluginClient::processMessage( const message & _m )
{
message reply_message( _m.id );
bool reply = false;
switch( _m.id )
{
case IdUndefined:
return false;
case IdSyncKey:
try
{
m_vstSyncData.attach(_m.getString(0));
}
catch (const std::runtime_error& error)
{
debugMessage(std::string{"Failed to attach sync data: "} + error.what() + '\n');
std::exit(EXIT_FAILURE);
}
m_bufferSize = m_vstSyncData->m_bufferSize;
m_sampleRate = m_vstSyncData->m_sampleRate;
reply_message.id = IdHostInfoGotten;
reply = true;
break;
case IdSampleRateInformation:
m_sampleRate = _m.getInt();
updateSampleRate();
reply_message.id = IdInformationUpdated;
reply = true;
break;
case IdBufferSizeInformation:
// Should LMMS gain the ability to change buffer size
// without a restart, it must wait for this message to
// complete processing or else risk VST crashes
m_bufferSize = _m.getInt();
updateBufferSize();
break;
case IdQuit:
return false;
case IdMidiEvent:
processMidiEvent(
MidiEvent( static_cast<MidiEventTypes>(
_m.getInt( 0 ) ),
_m.getInt( 1 ),
_m.getInt( 2 ),
_m.getInt( 3 ) ),
_m.getInt( 4 ) );
break;
case IdStartProcessing:
doProcessing();
reply_message.id = IdProcessingDone;
reply = true;
break;
case IdChangeSharedMemoryKey:
setShmKey(_m.getString(0));
break;
case IdInitDone:
break;
default:
{
char buf[64];
std::snprintf(buf, 64, "undefined message: %d\n", _m.id);
debugMessage( buf );
break;
}
}
if( reply )
{
sendMessage( reply_message );
}
return true;
}
void RemotePluginClient::setShmKey(const std::string& key)
{
try
{
m_audioBuffer.attach(key);
}
catch (const std::runtime_error& error)
{
debugMessage(std::string{"failed getting shared memory: "} + error.what() + '\n');
}
}
void RemotePluginClient::doProcessing()
{
if (m_audioBuffer)
{
process( (SampleFrame*)( m_inputCount > 0 ? m_audioBuffer.get() : nullptr ),
(SampleFrame*)( m_audioBuffer.get() +
( m_inputCount*m_bufferSize ) ) );
}
else
{
debugMessage( "doProcessing(): have no shared memory!\n" );
}
}
} // namespace lmms
#endif // LMMS_REMOTE_PLUGIN_CLIENT_H
| 7,145
|
C++
|
.h
| 292
| 21.695205
| 99
| 0.703169
|
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,413
|
FloatModelEditorBase.h
|
LMMS_lmms/include/FloatModelEditorBase.h
|
/*
* FloatModelEditorBase.h - Base editor for float models
*
* Copyright (c) 2004-2008 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_FLOAT_MODEL_EDITOR_BASE_H
#define LMMS_GUI_FLOAT_MODEL_EDITOR_BASE_H
#include <QWidget>
#include <QPoint>
#include "AutomatableModelView.h"
namespace lmms::gui
{
class SimpleTextFloat;
class LMMS_EXPORT FloatModelEditorBase : public QWidget, public FloatModelView
{
Q_OBJECT
mapPropertyFromModel(bool, isVolumeKnob, setVolumeKnob, m_volumeKnob);
mapPropertyFromModel(float, volumeRatio, setVolumeRatio, m_volumeRatio);
void initUi(const QString & name); //!< to be called by ctors
public:
enum class DirectionOfManipulation
{
Vertical,
Horizontal
};
FloatModelEditorBase(DirectionOfManipulation directionOfManipulation = DirectionOfManipulation::Vertical, QWidget * _parent = nullptr, const QString & _name = QString()); //!< default ctor
FloatModelEditorBase(const FloatModelEditorBase& other) = delete;
// TODO: remove
inline void setHintText(const QString & txt_before, const QString & txt_after)
{
setDescription(txt_before);
setUnit(txt_after);
}
signals:
void sliderPressed();
void sliderReleased();
void sliderMoved(float value);
protected:
void contextMenuEvent(QContextMenuEvent * me) override;
void dragEnterEvent(QDragEnterEvent * dee) override;
void dropEvent(QDropEvent * de) override;
void focusOutEvent(QFocusEvent * fe) override;
void mousePressEvent(QMouseEvent * me) override;
void mouseReleaseEvent(QMouseEvent * me) override;
void mouseMoveEvent(QMouseEvent * me) override;
void mouseDoubleClickEvent(QMouseEvent * me) override;
void paintEvent(QPaintEvent * me) override;
void wheelEvent(QWheelEvent * me) override;
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
virtual float getValue(const QPoint & p);
private slots:
virtual void enterValue();
void friendlyUpdate();
void toggleScale();
private:
virtual QString displayValue() const;
void doConnections() override;
void showTextFloat(int msecBeforeDisplay, int msecDisplayTime);
void setPosition(const QPoint & p);
inline float pageSize() const
{
return (model()->maxValue() - model()->minValue()) / 100.0f;
}
static SimpleTextFloat * s_textFloat;
BoolModel m_volumeKnob;
FloatModel m_volumeRatio;
QPoint m_lastMousePos; //!< mouse position in last mouseMoveEvent
float m_leftOver;
bool m_buttonPressed;
DirectionOfManipulation m_directionOfManipulation;
};
} // namespace lmms::gui
#endif // LMMS_GUI_FLOAT_MODEL_EDITOR_BASE_H
| 3,413
|
C++
|
.h
| 93
| 34.548387
| 189
| 0.786452
|
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,414
|
DspEffectLibrary.h
|
LMMS_lmms/include/DspEffectLibrary.h
|
/*
* DspEffectLibrary.h - library with template-based inline-effects
*
* 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_DSPEFFECTLIBRARY_H
#define LMMS_DSPEFFECTLIBRARY_H
#include "lmms_math.h"
#include "lmms_constants.h"
#include "lmms_basics.h"
#include "SampleFrame.h"
namespace lmms::DspEffectLibrary
{
template<typename T>
class MonoBase
{
public:
using bypassType = class MonoBypass;
static void process( sample_t * * _buf, const f_cnt_t _frames )
{
for( f_cnt_t f = 0; f < _frames; ++f )
{
_buf[f][0] = T::nextSample( _buf[f][0] );
}
}
} ;
template<typename T>
class StereoBase
{
public:
using bypassType = class StereoBypass;
static void process( sample_t * * _buf, const f_cnt_t _frames )
{
for( f_cnt_t f = 0; f < _frames; ++f )
{
T::nextSample( _buf[f][0], _buf[f][1] );
}
}
} ;
template<class FXL, class FXR = FXL>
class MonoToStereoAdaptor : public StereoBase<MonoToStereoAdaptor<FXL, FXR> >
{
public:
MonoToStereoAdaptor( const FXL& monoFX ) :
m_leftFX( monoFX ),
m_rightFX( monoFX )
{
}
MonoToStereoAdaptor( const FXL& leftFX, const FXR& rightFX ) :
m_leftFX( leftFX ),
m_rightFX( rightFX )
{
}
void setGain(float gain)
{
leftFX().setGain(gain);
rightFX().setGain(gain);
}
void nextSample(SampleFrame & in)
{
nextSample(in.left(), in.right());
}
void nextSample( sample_t& inLeft, sample_t& inRight )
{
inLeft = m_leftFX.nextSample( inLeft );
inRight = m_rightFX.nextSample( inRight );
}
FXL& leftFX()
{
return( m_leftFX );
}
FXR& rightFX()
{
return( m_rightFX );
}
private:
FXL m_leftFX;
FXR m_rightFX;
} ;
template<class FX>
class StereoToMonoAdaptor : public MonoBase<StereoToMonoAdaptor<FX> >
{
public:
StereoToMonoAdaptor( const FX& fx ) :
m_FX( fx )
{
}
sample_t nextSample( sample_t in )
{
sample_t s[2] = { in, in };
m_FX.nextSample( s[0], s[1] );
return ( s[0] + s[1] ) / 2.0f;
}
private:
FX m_FX;
} ;
class MonoBypass : public MonoBase<MonoBypass>
{
public:
sample_t nextSample( sample_t in )
{
return in;
}
} ;
class StereoBypass : public StereoBase<StereoBypass>
{
public:
void nextSample( sample_t&, sample_t& )
{
}
} ;
/* convenient class to build up static FX chains, for example
using namespace DspEffectLib;
chain<MonoToStereoAdaptor<bassBoost<> >,
chain<StereoEnhancer<>,
MonoToStereoAdaptor<FoldbackDistortion<> > > >
fxchain( bassBoost<>( 60.0, 1.0, 4.0f ),
chain<StereoEnhancer<>,
MonoToStereoAdaptor<FoldbackDistortion<> > >(
StereoEnhancer<>( 1.0 ),
FoldbackDistortion<>( 1.0f, 1.0f ) ) );
// now you can do simple calls such as which will process a bass-boost-,
// stereo enhancer- and foldback distortion effect on your buffer
fx_chain.process( (sample_t * *) buf, frames );
*/
template<class FX0, class FX1 = typename FX0::bypassType>
class Chain : public FX0::bypassType
{
public:
using sample_t = typename FX0::sample_t;
Chain( const FX0& fx0, const FX1& fx1 = FX1() ) :
m_FX0( fx0 ),
m_FX1( fx1 )
{
}
void process( sample_t** buf, const f_cnt_t frames )
{
m_FX0.process( buf, frames );
m_FX1.process( buf, frames );
}
private:
FX0 m_FX0;
FX1 m_FX1;
} ;
template<typename sample_t>
inline sample_t saturate( sample_t x )
{
return std::min<sample_t>(std::max<sample_t>(-1.0f, x), 1.0f);
}
class FastBassBoost : public MonoBase<FastBassBoost>
{
public:
FastBassBoost( const sample_t _frequency,
const sample_t _gain,
const sample_t _ratio,
const FastBassBoost & _orig = FastBassBoost() ) :
m_frequency(std::max<sample_t>(_frequency, 10.0)),
m_gain1( 1.0 / ( m_frequency + 1.0 ) ),
m_gain2( _gain ),
m_ratio( _ratio ),
m_cap( _orig.m_cap )
{
}
inline sample_t nextSample( sample_t _in )
{
// TODO: somehow remove these horrible aliases...
m_cap = ( _in + m_cap*m_frequency ) * m_gain1;
return( ( _in + m_cap*m_ratio ) * m_gain2 );
}
void setFrequency( const sample_t _frequency )
{
m_frequency = _frequency;
m_gain1 = 1.0 / ( m_frequency + 1.0 );
}
void setGain( const sample_t _gain )
{
m_gain2 = _gain;
}
void setRatio( const sample_t _ratio )
{
m_ratio = _ratio;
}
private:
FastBassBoost() :
m_cap( 0.0 )
{
}
sample_t m_frequency;
sample_t m_gain1;
sample_t m_gain2;
sample_t m_ratio;
sample_t m_cap;
} ;
template<class T>
class DistortionBase : public MonoBase<T>
{
public:
DistortionBase( float threshold, float gain ) :
m_threshold( threshold ),
m_gain( gain )
{
}
void setThreshold( float threshold )
{
m_threshold = threshold;
}
void setGain( float gain )
{
m_gain = gain;
}
protected:
float m_threshold;
float m_gain;
};
class FoldbackDistortion : public DistortionBase<FoldbackDistortion>
{
public:
using DistortionBase<FoldbackDistortion>::DistortionBase;
sample_t nextSample( sample_t in )
{
if( in >= m_threshold || in < -m_threshold )
{
return ( fabsf( fabsf( fmodf( in - m_threshold, m_threshold*4 ) ) - m_threshold*2 ) - m_threshold ) * m_gain;
}
return in * m_gain;
}
} ;
class Distortion : public DistortionBase<Distortion>
{
public:
using DistortionBase<Distortion>::DistortionBase;
sample_t nextSample( sample_t in )
{
return m_gain * ( in * ( fabsf( in )+m_threshold ) / ( in*in +( m_threshold-1 )* fabsf( in ) + 1 ) );
}
} ;
class StereoEnhancer : public StereoBase<StereoEnhancer>
{
public:
StereoEnhancer( float wideCoeff ) :
m_wideCoeff( wideCoeff )
{
}
void setWideCoeff( float wideCoeff )
{
m_wideCoeff = wideCoeff;
}
float wideCoeff()
{
return m_wideCoeff;
}
void nextSample( sample_t& inLeft, sample_t& inRight )
{
const float toRad = F_PI / 180;
const sample_t tmp = inLeft;
inLeft += inRight * sinf( m_wideCoeff * ( .5 * toRad ) );
inRight -= tmp * sinf( m_wideCoeff * ( .5 * toRad ) );
}
private:
float m_wideCoeff;
} ;
} // namespace lmms::DspEffectLibrary
#endif // LMMS_DSPEFFECTLIBRARY_H
| 6,972
|
C++
|
.h
| 281
| 21.704626
| 113
| 0.671696
|
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,415
|
LcdFloatSpinBox.h
|
LMMS_lmms/include/LcdFloatSpinBox.h
|
/*
* LcdFloatSpinBox.h - class LcdFloatSpinBox (LcdSpinBox for floats)
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* 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_LCD_FLOATSPINBOX_H
#define LMMS_GUI_LCD_FLOATSPINBOX_H
#include <QString>
#include "LcdWidget.h"
#include "AutomatableModelView.h"
namespace lmms::gui
{
class LMMS_EXPORT LcdFloatSpinBox : public QWidget, public FloatModelView
{
Q_OBJECT
public:
LcdFloatSpinBox(int numWhole, int numFrac, const QString& name = QString(), QWidget* parent = nullptr);
LcdFloatSpinBox(int numWhole, int numFrac, const QString& style, const QString& name, QWidget* parent = nullptr);
void modelChanged() override
{
ModelView::modelChanged();
update();
}
void setLabel(const QString &label) { m_label = label; }
void setSeamless(bool left, bool right)
{
m_wholeDisplay.setSeamless(left, true);
m_fractionDisplay.setSeamless(true, right);
}
public slots:
virtual void update();
protected:
void contextMenuEvent(QContextMenuEvent *me) override;
void mousePressEvent(QMouseEvent *me) override;
void mouseMoveEvent(QMouseEvent *me) override;
void mouseReleaseEvent(QMouseEvent *me) override;
void wheelEvent(QWheelEvent *we) override;
void mouseDoubleClickEvent(QMouseEvent *me) override;
void paintEvent(QPaintEvent *pe) override;
private:
void layoutSetup(const QString &style = QString("19green"));
void enterValue();
float getStep() const;
LcdWidget m_wholeDisplay;
LcdWidget m_fractionDisplay;
bool m_mouseMoving;
bool m_intStep;
QPoint m_origMousePos;
int m_displayOffset;
QString m_label;
signals:
void manualChange();
};
using LcdFloatSpinBoxModel = FloatModel;
} // namespace lmms::gui
#endif // LMMS_GUI_LCD_FLOATSPINBOX_H
| 2,588
|
C++
|
.h
| 75
| 32.453333
| 114
| 0.778268
|
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,416
|
AudioPortAudio.h
|
LMMS_lmms/include/AudioPortAudio.h
|
/*
* AudioPortAudio.h - device-class that performs PCM-output via PortAudio
*
* Copyright (c) 2008 Csaba Hruska <csaba.hruska/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_AUDIO_PORTAUDIO_H
#define LMMS_AUDIO_PORTAUDIO_H
#include <QObject>
#include "lmmsconfig.h"
#include "ComboBoxModel.h"
#ifdef LMMS_HAVE_PORTAUDIO
# include <portaudio.h>
# include "AudioDevice.h"
# include "AudioDeviceSetupWidget.h"
# if defined paNeverDropInput || defined paNonInterleaved
# define PORTAUDIO_V19
# else
# define PORTAUDIO_V18
# endif
#endif
namespace lmms
{
class AudioPortAudioSetupUtil : public QObject
{
Q_OBJECT
public slots:
void updateBackends();
void updateDevices();
void updateChannels();
public:
ComboBoxModel m_backendModel;
ComboBoxModel m_deviceModel;
};
#ifdef LMMS_HAVE_PORTAUDIO
namespace gui
{
class ComboBox;
class LcdSpinBox;
}
class AudioPortAudio : public AudioDevice
{
public:
AudioPortAudio( bool & _success_ful, AudioEngine* audioEngine );
~AudioPortAudio() override;
inline static QString name()
{
return QT_TRANSLATE_NOOP( "AudioDeviceSetupWidget", "PortAudio" );
}
int process_callback(const float* _inputBuffer, float* _outputBuffer, f_cnt_t _framesPerBuffer);
class setupWidget : public gui::AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
~setupWidget() override;
void saveSettings() override;
void show() override;
private:
gui::ComboBox * m_backend;
gui::ComboBox * m_device;
AudioPortAudioSetupUtil m_setupUtil;
} ;
private:
void startProcessing() override;
void stopProcessing() override;
#ifdef PORTAUDIO_V19
static int _process_callback( const void *_inputBuffer, void * _outputBuffer,
unsigned long _framesPerBuffer,
const PaStreamCallbackTimeInfo * _timeInfo,
PaStreamCallbackFlags _statusFlags,
void *arg );
#else
#define paContinue 0
#define paComplete 1
#define Pa_GetDeviceCount Pa_CountDevices
#define Pa_GetDefaultInputDevice Pa_GetDefaultInputDeviceID
#define Pa_GetDefaultOutputDevice Pa_GetDefaultOutputDeviceID
#define Pa_IsStreamActive Pa_StreamActive
static int _process_callback( void * _inputBuffer, void * _outputBuffer,
unsigned long _framesPerBuffer, PaTimestamp _outTime, void * _arg );
using PaTime = double;
using PaDeviceIndex = PaDeviceID;
using PaStreamParameters = struct
{
PaDeviceIndex device;
int channelCount;
PaSampleFormat sampleFormat;
PaTime suggestedLatency;
void *hostApiSpecificStreamInfo;
} PaStreamParameters;
#endif // PORTAUDIO_V19
PaStream * m_paStream;
PaStreamParameters m_outputParameters;
PaStreamParameters m_inputParameters;
bool m_wasPAInitError;
SampleFrame* m_outBuf;
std::size_t m_outBufPos;
fpp_t m_outBufSize;
bool m_stopped;
} ;
#endif // LMMS_HAVE_PORTAUDIO
} // namespace lmms
#endif // LMMS_AUDIO_PORTAUDIO_H
| 3,620
|
C++
|
.h
| 120
| 28.066667
| 97
| 0.78462
|
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,417
|
InstrumentTrack.h
|
LMMS_lmms/include/InstrumentTrack.h
|
/*
* InstrumentTrack.h - declaration of class InstrumentTrack, a track which
* holds an instrument-plugin
*
* 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_INSTRUMENT_TRACK_H
#define LMMS_INSTRUMENT_TRACK_H
#include <limits>
#include "AudioPort.h"
#include "InstrumentFunctions.h"
#include "InstrumentSoundShaping.h"
#include "Microtuner.h"
#include "Midi.h"
#include "MidiEventProcessor.h"
#include "MidiPort.h"
#include "NotePlayHandle.h"
#include "Piano.h"
#include "Plugin.h"
#include "Track.h"
namespace lmms
{
class Instrument;
class DataFile;
namespace gui
{
class InstrumentTrackView;
class InstrumentTrackWindow;
class InstrumentTuningView;
class MidiCCRackView;
} // namespace gui
class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor
{
Q_OBJECT
mapPropertyFromModel(int,getVolume,setVolume,m_volumeModel);
public:
InstrumentTrack( TrackContainer* tc );
~InstrumentTrack() override;
// used by instrument
void processAudioBuffer( SampleFrame* _buf, const fpp_t _frames,
NotePlayHandle * _n );
MidiEvent applyMasterKey( const MidiEvent& event );
void processInEvent( const MidiEvent& event, const TimePos& time = TimePos(), f_cnt_t offset = 0 ) override;
void processOutEvent( const MidiEvent& event, const TimePos& time = TimePos(), f_cnt_t offset = 0 ) override;
// silence all running notes played by this track
void silenceAllNotes( bool removeIPH = false );
bool isSustainPedalPressed() const
{
return m_sustainPedalPressed;
}
f_cnt_t beatLen( NotePlayHandle * _n ) const;
// for capturing note-play-events -> need that for arpeggio,
// filter and so on
void playNote( NotePlayHandle * _n, SampleFrame* _working_buffer );
QString instrumentName() const;
const Instrument *instrument() const
{
return m_instrument;
}
Instrument *instrument()
{
return m_instrument;
}
void deleteNotePluginData( NotePlayHandle * _n );
// name-stuff
void setName( const QString & _new_name ) override;
// translate given key of a note-event to absolute key (i.e.
// add global master-pitch and base-note of this instrument track)
int masterKey( int _midi_key ) const;
// translate pitch to midi-pitch [0,16383]
int midiPitch() const
{
return static_cast<int>( ( ( m_pitchModel.value() + m_pitchModel.range()/2 ) * MidiMaxPitchBend ) / m_pitchModel.range() );
}
/*! \brief Returns current range for pitch bend in semitones */
int midiPitchRange() const
{
return m_pitchRangeModel.value();
}
// play everything in given frame-range - creates note-play-handles
bool play( const TimePos & _start, const fpp_t _frames,
const f_cnt_t _frame_base, int _clip_num = -1 ) override;
// create new view for me
gui::TrackView* createView( gui::TrackContainerView* tcv ) override;
// create new track-content-object = clip
Clip* createClip(const TimePos & pos) override;
// called by track
void saveTrackSpecificSettings(QDomDocument& doc, QDomElement& parent, bool presetMode) override;
void loadTrackSpecificSettings( const QDomElement & _this ) override;
using Track::setJournalling;
// load instrument whose name matches given one
Instrument * loadInstrument(const QString & _instrument_name,
const Plugin::Descriptor::SubPluginFeatures::Key* key = nullptr,
bool keyFromDnd = false);
AudioPort * audioPort()
{
return &m_audioPort;
}
MidiPort * midiPort()
{
return &m_midiPort;
}
const IntModel *baseNoteModel() const
{
return &m_baseNoteModel;
}
IntModel *baseNoteModel()
{
return &m_baseNoteModel;
}
IntModel *firstKeyModel()
{
return &m_firstKeyModel;
}
IntModel *lastKeyModel()
{
return &m_lastKeyModel;
}
bool keyRangeImport() const;
bool isKeyMapped(int key) const;
int firstKey() const;
int lastKey() const;
int baseNote() const;
float baseFreq() const;
Piano *pianoModel()
{
return &m_piano;
}
Microtuner *microtuner()
{
return &m_microtuner;
}
bool isArpeggioEnabled() const
{
return m_arpeggio.m_arpEnabledModel.value();
}
// simple helper for removing midiport-XML-node when loading presets
static void removeMidiPortNode( DataFile& dataFile );
FloatModel * pitchModel()
{
return &m_pitchModel;
}
FloatModel * volumeModel()
{
return &m_volumeModel;
}
FloatModel * panningModel()
{
return &m_panningModel;
}
IntModel* pitchRangeModel()
{
return &m_pitchRangeModel;
}
IntModel * mixerChannelModel()
{
return &m_mixerChannelModel;
}
BoolModel* useMasterPitchModel()
{
return &m_useMasterPitchModel;
}
void setPreviewMode( const bool );
bool isPreviewMode() const
{
return m_previewMode;
}
void replaceInstrument(DataFile dataFile);
void autoAssignMidiDevice( bool );
signals:
void instrumentChanged();
void midiNoteOn( const lmms::Note& );
void midiNoteOff( const lmms::Note& );
void newNote();
void endNote();
protected:
QString nodeName() const override
{
return "instrumenttrack";
}
// get the name of the instrument in the saved data
QString getSavedInstrumentName(const QDomElement & thisElement) const;
protected slots:
void updateBaseNote();
void updatePitch();
void updatePitchRange();
void updateMixerChannel();
private:
void processCCEvent(int controller);
MidiPort m_midiPort;
NotePlayHandle* m_notes[NumKeys];
NotePlayHandleList m_sustainedNotes;
int m_runningMidiNotes[NumKeys];
QMutex m_midiNotesMutex;
bool m_sustainPedalPressed;
bool m_silentBuffersProcessed;
bool m_previewMode;
IntModel m_baseNoteModel; //!< The "A4" or "440 Hz" key (default 69)
IntModel m_firstKeyModel; //!< First key the instrument reacts to
IntModel m_lastKeyModel; //!< Last key the instrument reacts to
bool m_hasAutoMidiDev;
static InstrumentTrack *s_autoAssignedTrack;
NotePlayHandleList m_processHandles;
FloatModel m_volumeModel;
FloatModel m_panningModel;
AudioPort m_audioPort;
FloatModel m_pitchModel;
IntModel m_pitchRangeModel;
IntModel m_mixerChannelModel;
BoolModel m_useMasterPitchModel;
Instrument * m_instrument;
InstrumentSoundShaping m_soundShaping;
InstrumentFunctionArpeggio m_arpeggio;
InstrumentFunctionNoteStacking m_noteStacking;
Piano m_piano;
Microtuner m_microtuner;
std::unique_ptr<BoolModel> m_midiCCEnable;
std::unique_ptr<FloatModel> m_midiCCModel[MidiControllerCount];
friend class gui::InstrumentTrackView;
friend class gui::InstrumentTrackWindow;
friend class NotePlayHandle;
friend class gui::InstrumentTuningView;
friend class gui::MidiCCRackView;
} ;
} // namespace lmms
#endif // LMMS_INSTRUMENT_TRACK_H
| 7,413
|
C++
|
.h
| 244
| 28.02459
| 125
| 0.77036
|
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,418
|
endian_handling.h
|
LMMS_lmms/include/endian_handling.h
|
/*
* endian_handling.h - handle endianess
*
* 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_ENDIAN_HANDLING_H
#define LMMS_ENDIAN_HANDLING_H
#include <QSysInfo>
#include "lmms_basics.h"
namespace lmms
{
inline bool isLittleEndian()
{
return( QSysInfo::ByteOrder == QSysInfo::LittleEndian );
}
inline int16_t swap16IfBE( int16_t i )
{
return( isLittleEndian() ? i : ( ( i & 0xFF ) << 8) | ( ( i >> 8 ) & 0xFF ) );
}
inline int32_t swap32IfBE( int32_t i )
{
return( isLittleEndian() ? i : ( ( i & 0xff000000 ) >> 24 ) |
( ( i & 0x00ff0000 ) >> 8 ) |
( ( i & 0x0000ff00 ) << 8 ) |
( ( i & 0x000000ff ) << 24 ) );
}
} // namespace lmms
#endif // LMMS_ENDIAN_HANDLING_H
| 1,538
|
C++
|
.h
| 46
| 31.26087
| 79
| 0.700947
|
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,419
|
MidiClient.h
|
LMMS_lmms/include/MidiClient.h
|
/*
* MidiClient.h - base-class for MIDI clients like ALSA-sequencer-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_CLIENT_H
#define LMMS_MIDI_CLIENT_H
#include <QStringList>
#include <vector>
#include "MidiEvent.h"
class QObject;
namespace lmms
{
class MidiPort;
class TimePos;
// base-class for all MIDI-clients
class MidiClient
{
public:
MidiClient() = default;
virtual ~MidiClient();
// to be implemented by sub-classes
virtual void processOutEvent( const MidiEvent & _me,
const TimePos & _time,
const MidiPort * _port ) = 0;
// inheriting classes can re-implement this for being able to update
// their internal port-structures etc.
virtual void applyPortMode( MidiPort * _port );
virtual void applyPortName( MidiPort * _port );
virtual void addPort( MidiPort * _port );
// re-implemented methods HAVE to call removePort() of base-class!!
virtual void removePort( MidiPort * _port );
// returns whether client works with raw-MIDI, only needs to be
// re-implemented by MidiClientRaw for returning true
virtual bool isRaw() const
{
return false;
}
// if not raw-client, return all readable/writable ports
virtual QStringList readablePorts() const
{
return QStringList();
}
virtual QStringList writablePorts() const
{
return QStringList();
}
// return name of port which specified MIDI event came from
virtual QString sourcePortName( const MidiEvent & ) const
{
return QString();
}
// (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 );
// qobject-derived classes can use this for make a slot being
// connected to signal of non-raw-MIDI-client if port-lists change
virtual void connectRPChanged( QObject *, const char * )
{
}
virtual void connectWPChanged( QObject *, const char * )
{
}
// tries to open either MIDI-driver from config-file or (if it fails)
// any other working
static MidiClient * openMidiClient();
protected:
std::vector<MidiPort *> m_midiPorts;
} ;
const uint32_t RAW_MIDI_PARSE_BUF_SIZE = 16;
class MidiClientRaw : public MidiClient
{
public:
MidiClientRaw() = default;
~MidiClientRaw() override = default;
// we are raw-clients for sure!
bool isRaw() const override
{
return true;
}
protected:
// generic raw-MIDI-parser which generates appropriate MIDI-events
void parseData( const unsigned char c );
// to be implemented by actual client-implementation
virtual void sendByte( const unsigned char c ) = 0;
private:
// this does MIDI-event-process
void processParsedEvent();
void processOutEvent( const MidiEvent& event, const TimePos& time, const MidiPort* port ) override;
// small helper function returning length of a certain event - this
// is necessary for parsing raw-MIDI-data
static int eventLength( const unsigned char event );
// data being used for parsing
struct midiParserData
{
uint8_t m_status; // identifies the type of event, that
// is currently received ('Noteon',
// 'Pitch Bend' etc).
uint8_t m_channel; // The channel of the event that is
// received (in case of a channel event)
uint32_t m_bytes; // How many bytes have been read for
// the current event?
uint32_t m_bytesTotal; // How many bytes does the current
// event type include?
uint32_t m_buffer[RAW_MIDI_PARSE_BUF_SIZE];
// buffer for incoming data
MidiEvent m_midiEvent; // midi-event
} m_midiParseData;
} ;
} // namespace lmms
#endif // LMMS_MIDI_CLIENT_H
| 4,523
|
C++
|
.h
| 133
| 31.390977
| 100
| 0.745342
|
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,420
|
SerializingObject.h
|
LMMS_lmms/include/SerializingObject.h
|
/*
* SerializingObject.h - declaration of class SerializingObject
*
* 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_SERIALIZING_OBJECT_H
#define LMMS_SERIALIZING_OBJECT_H
#include <QString>
#include "lmms_export.h"
class QDomDocument;
class QDomElement;
namespace lmms
{
class SerializingObjectHook;
class LMMS_EXPORT SerializingObject
{
public:
SerializingObject();
virtual ~SerializingObject();
virtual QDomElement saveState( QDomDocument & _doc, QDomElement & _parent );
virtual void restoreState( const QDomElement & _this );
// to be implemented by actual object
virtual QString nodeName() const = 0;
void setHook( SerializingObjectHook * _hook );
SerializingObjectHook* hook()
{
return m_hook;
}
protected:
// to be implemented by sub-objects
virtual void saveSettings( QDomDocument& doc, QDomElement& element ) = 0;
virtual void loadSettings( const QDomElement& element ) = 0;
private:
SerializingObjectHook * m_hook;
} ;
class SerializingObjectHook
{
public:
SerializingObjectHook() :
m_hookedIn( nullptr )
{
}
virtual ~SerializingObjectHook()
{
if( m_hookedIn != nullptr )
{
m_hookedIn->setHook( nullptr );
}
}
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this ) = 0;
virtual void loadSettings( const QDomElement & _this ) = 0;
private:
SerializingObject * m_hookedIn;
friend class SerializingObject;
} ;
} // namespace lmms
#endif // LMMS_SERIALIZING_OBJECT_H
| 2,293
|
C++
|
.h
| 75
| 28.4
| 77
| 0.766103
|
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,421
|
TimeDisplayWidget.h
|
LMMS_lmms/include/TimeDisplayWidget.h
|
/*
* TimeDisplayWidget.h - widget for displaying current playback time
*
* Copyright (c) 2014 Ruben Ibarra
* 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_GUI_TIME_DISPLAY_WIDGET_H
#define LMMS_GUI_TIME_DISPLAY_WIDGET_H
#include <QWidget>
#include <QHBoxLayout>
#include "LcdWidget.h"
namespace lmms::gui
{
class TimeDisplayWidget : public QWidget
{
Q_OBJECT
public:
TimeDisplayWidget();
~TimeDisplayWidget() override = default;
protected:
void mousePressEvent( QMouseEvent* mouseEvent ) override;
private slots:
void updateTime();
private:
enum class DisplayMode
{
MinutesSeconds,
BarsTicks
};
void setDisplayMode( DisplayMode displayMode );
DisplayMode m_displayMode;
QHBoxLayout m_spinBoxesLayout;
LcdWidget m_majorLCD;
LcdWidget m_minorLCD;
LcdWidget m_milliSecondsLCD;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_TIME_DISPLAY_WIDGET_H
| 1,713
|
C++
|
.h
| 56
| 28.571429
| 72
| 0.776965
|
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,423
|
SendButtonIndicator.h
|
LMMS_lmms/include/SendButtonIndicator.h
|
/*
* SendButtonIndicator.h
*
* Copyright (c) 2014-2022 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_SEND_BUTTON_INDICATOR_H
#define LMMS_GUI_SEND_BUTTON_INDICATOR_H
#include <QLabel>
#include "embed.h"
namespace lmms
{
class FloatModel;
namespace gui
{
class MixerChannelView;
class MixerView;
class SendButtonIndicator : public QLabel
{
public:
SendButtonIndicator(QWidget* parent, MixerChannelView* owner, MixerView* mv);
void mousePressEvent(QMouseEvent* e) override;
void updateLightStatus();
private:
MixerChannelView* m_parent;
MixerView* m_mv;
QPixmap m_qpmOff = embed::getIconPixmap("mixer_send_off", 29, 20);
QPixmap m_qpmOn = embed::getIconPixmap("mixer_send_on", 29, 20);
FloatModel* getSendModel();
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_SEND_BUTTON_INDICATOR_H
| 1,640
|
C++
|
.h
| 50
| 30.88
| 78
| 0.770013
|
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,424
|
FileBrowser.h
|
LMMS_lmms/include/FileBrowser.h
|
/*
* FileBrowser.h - include file for FileBrowser
*
* 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_FILE_BROWSER_H
#define LMMS_GUI_FILE_BROWSER_H
#include <QCheckBox>
#include <QDir>
#include <QMutex>
#include <QProgressBar>
#include <memory>
#include "FileSearch.h"
#include "embed.h"
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
#include <QRecursiveMutex>
#endif
#include <QTreeWidget>
#include "SideBarWidget.h"
#include "lmmsconfig.h"
class QLineEdit;
namespace lmms
{
class InstrumentTrack;
class PlayHandle;
class TrackContainer;
namespace gui
{
class FileItem;
class FileBrowserTreeWidget;
class FileBrowser : public SideBarWidget
{
Q_OBJECT
public:
/**
Create a file browser side bar widget
@param directories '*'-separated list of directories to search for.
If a directory of factory files should be in the list it
must be the last one (for the factory files delimiter to work)
@param filter Filter as used in QDir::match
@param recurse *to be documented*
*/
FileBrowser( const QString & directories, const QString & filter,
const QString & title, const QPixmap & pm,
QWidget * parent, bool dirs_as_items = false,
const QString& userDir = "",
const QString& factoryDir = "");
~FileBrowser() override = default;
static QStringList excludedPaths()
{
static auto s_excludedPaths = QStringList{
#ifdef LMMS_BUILD_LINUX
"/bin", "/boot", "/dev", "/etc", "/proc", "/run", "/sbin",
"/sys"
#endif
#ifdef LMMS_BUILD_WIN32
"C:\\Windows"
#endif
};
return s_excludedPaths;
}
static QDir::Filters dirFilters() { return QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden; }
static QDir::SortFlags sortFlags() { return QDir::LocaleAware | QDir::DirsFirst | QDir::Name | QDir::IgnoreCase; }
private slots:
void reloadTree();
void expandItems(const QList<QString>& expandedDirs, QTreeWidgetItem* item = nullptr);
void giveFocusToFilter();
private:
void keyPressEvent( QKeyEvent * ke ) override;
void addItems( const QString & path );
void saveDirectoriesStates();
void restoreDirectoriesStates();
void foundSearchMatch(FileSearch* search, const QString& match);
void searchCompleted(FileSearch* search);
void onSearch(const QString& filter);
void displaySearch(bool on);
void addContentCheckBox();
FileBrowserTreeWidget * m_fileBrowserTreeWidget;
FileBrowserTreeWidget * m_searchTreeWidget;
QLineEdit * m_filterEdit;
std::shared_ptr<FileSearch> m_currentSearch;
QProgressBar* m_searchIndicator = nullptr;
QString m_directories; //!< Directories to search, split with '*'
QString m_filter; //!< Filter as used in QDir::match()
bool m_dirsAsItems;
QCheckBox* m_showUserContent = nullptr;
QCheckBox* m_showFactoryContent = nullptr;
QCheckBox* m_showHiddenContent = nullptr;
QBoxLayout *filterWidgetLayout = nullptr;
QBoxLayout *hiddenWidgetLayout = nullptr;
QBoxLayout *outerLayout = nullptr;
QString m_userDir;
QString m_factoryDir;
QList<QString> m_savedExpandedDirs;
QString m_previousFilterValue;
} ;
class FileBrowserTreeWidget : public QTreeWidget
{
Q_OBJECT
public:
FileBrowserTreeWidget( QWidget * parent );
~FileBrowserTreeWidget() override = default;
//! This method returns a QList with paths (QString's) of all directories
//! that are expanded in the tree.
QList<QString> expandedDirs( QTreeWidgetItem * item = nullptr ) const;
protected:
void contextMenuEvent( QContextMenuEvent * e ) override;
void mousePressEvent( QMouseEvent * me ) override;
void mouseMoveEvent( QMouseEvent * me ) override;
void mouseReleaseEvent( QMouseEvent * me ) override;
void keyPressEvent( QKeyEvent * ke ) override;
void keyReleaseEvent( QKeyEvent * ke ) override;
void hideEvent( QHideEvent * he ) override;
void focusOutEvent( QFocusEvent * fe ) override;
private:
//! Start a preview of a file item
void previewFileItem(FileItem* file);
//! If a preview is playing, stop it.
void stopPreview();
void handleFile( FileItem * fi, InstrumentTrack * it );
void openInNewInstrumentTrack( TrackContainer* tc, FileItem* item );
bool m_mousePressed;
QPoint m_pressPos;
//! This should only be accessed or modified when m_pphMutex is held
PlayHandle* m_previewPlayHandle;
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QRecursiveMutex m_pphMutex;
#else
QMutex m_pphMutex;
#endif
QList<QAction*> getContextActions(FileItem* item, bool songEditor);
private slots:
void activateListItem( QTreeWidgetItem * item, int column );
void openInNewInstrumentTrack( lmms::gui::FileItem* item, bool songEditor );
bool openInNewSampleTrack( lmms::gui::FileItem* item );
void sendToActiveInstrumentTrack( lmms::gui::FileItem* item );
void updateDirectory( QTreeWidgetItem * item );
void openContainingFolder( lmms::gui::FileItem* item );
} ;
class Directory : public QTreeWidgetItem
{
public:
Directory(const QString& filename, const QString& path, const QString& filter, bool disableEntryPopulation = false);
void update();
inline QString fullName( QString path = QString() )
{
if( path.isEmpty() )
{
path = m_directories[0];
}
if( ! path.isEmpty() )
{
path += QDir::separator();
}
return( QDir::cleanPath( path + text( 0 ) ) +
QDir::separator() );
}
inline void addDirectory( const QString & dir )
{
m_directories.push_back( dir );
}
private:
bool addItems( const QString & path );
QPixmap m_folderPixmap = embed::getIconPixmap("folder");
QPixmap m_folderOpenedPixmap = embed::getIconPixmap("folder_opened");
QPixmap m_folderLockedPixmap = embed::getIconPixmap("folder_locked");
//! Directories that lead here
//! Initially, this is just set to the current path of a directory
//! If, however, you have e.g. 'TripleOscillator/xyz' in two of the
//! file browser's search directories 'a' and 'b', this will have two
//! entries 'a/TripleOscillator' and 'b/TripleOscillator'
//! and 'xyz' in the tree widget
QStringList m_directories;
//! Filter as used in QDir::match()
QString m_filter;
int m_dirCount;
bool m_disableEntryPopulation = false;
} ;
class FileItem : public QTreeWidgetItem
{
public:
enum class FileType
{
Project,
Preset,
Sample,
SoundFont,
Patch,
Midi,
VstPlugin,
Unknown
} ;
enum class FileHandling
{
NotSupported,
LoadAsProject,
LoadAsPreset,
LoadByPlugin,
ImportAsProject
} ;
FileItem( QTreeWidget * parent, const QString & name,
const QString & path );
FileItem( const QString & name, const QString & path );
QString fullName() const
{
return QFileInfo(m_path, text(0)).absoluteFilePath();
}
inline FileType type() const
{
return( m_type );
}
inline FileHandling handling() const
{
return( m_handling );
}
inline bool isTrack() const
{
return m_handling == FileHandling::LoadAsPreset || m_handling == FileHandling::LoadByPlugin;
}
QString extension();
static QString extension( const QString & file );
static QString defaultFilters();
private:
void initPixmaps();
void determineFileType();
QString m_path;
FileType m_type;
FileHandling m_handling;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_FILE_BROWSER_H
| 7,974
|
C++
|
.h
| 250
| 29.56
| 117
| 0.756668
|
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,425
|
ComboBox.h
|
LMMS_lmms/include/ComboBox.h
|
/*
* ComboBox.h - class ComboBox, a combo box view for models
*
* 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_GUI_COMBOBOX_H
#define LMMS_GUI_COMBOBOX_H
#include <QMenu>
#include <QWidget>
#include "ComboBoxModel.h"
#include "AutomatableModelView.h"
namespace lmms::gui
{
class LMMS_EXPORT ComboBox : public QWidget, public IntModelView
{
Q_OBJECT
public:
ComboBox( QWidget* parent = nullptr, const QString& name = QString() );
~ComboBox() override = default;
ComboBoxModel* model()
{
return castModel<ComboBoxModel>();
}
const ComboBoxModel* model() const
{
return castModel<ComboBoxModel>();
}
static constexpr int DEFAULT_HEIGHT = 22;
public slots:
void selectNext();
void selectPrevious();
protected:
void contextMenuEvent( QContextMenuEvent* event ) override;
void mousePressEvent( QMouseEvent* event ) override;
void paintEvent( QPaintEvent* event ) override;
void wheelEvent( QWheelEvent* event ) override;
private:
QPixmap m_background = embed::getIconPixmap("combobox_bg");
QPixmap m_arrow = embed::getIconPixmap("combobox_arrow");
QPixmap m_arrowSelected = embed::getIconPixmap("combobox_arrow_selected");
QMenu m_menu;
bool m_pressed;
private slots:
void setItem( QAction* item );
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_COMBOBOX_H
| 2,138
|
C++
|
.h
| 65
| 30.846154
| 77
| 0.764735
|
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,426
|
DataFile.h
|
LMMS_lmms/include/DataFile.h
|
/*
* DataFile.h - class for reading and writing LMMS data files
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2012-2013 Paul Giblock <p/at/pgiblock.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_DATA_FILE_H
#define LMMS_DATA_FILE_H
#include <map>
#include <QDomDocument>
#include <vector>
#include "lmms_export.h"
class QTextStream;
namespace lmms
{
class ProjectVersion;
class LMMS_EXPORT DataFile : public QDomDocument
{
using UpgradeMethod = void(DataFile::*)();
public:
enum class Type
{
Unknown,
SongProject,
SongProjectTemplate,
InstrumentTrackSettings,
DragNDropData,
ClipboardData,
JournalData,
EffectSettings,
MidiClip
} ;
DataFile( const QString& fileName );
DataFile( const QByteArray& data );
DataFile( Type type );
virtual ~DataFile() = default;
///
/// \brief validate
/// performs basic validation, compared to file extension.
///
bool validate( QString extension );
QString nameWithExtension( const QString& fn ) const;
void write( QTextStream& strm );
bool writeFile(const QString& fn, bool withResources = false);
bool copyResources(const QString& resourcesDir); //!< Copies resources to the resourcesDir and changes the DataFile to use local paths to them
bool hasLocalPlugins(QDomElement parent = QDomElement(), bool firstCall = true) const;
QDomElement& content()
{
return m_content;
}
QDomElement& head()
{
return m_head;
}
Type type() const
{
return m_type;
}
unsigned int legacyFileVersion();
private:
static Type type( const QString& typeName );
static QString typeName( Type type );
void cleanMetaNodes( QDomElement de );
void mapSrcAttributeInElementsWithResources(const QMap<QString, QString>& map);
// helper upgrade routines
void upgrade_0_2_1_20070501();
void upgrade_0_2_1_20070508();
void upgrade_0_3_0_rc2();
void upgrade_0_3_0();
void upgrade_0_4_0_20080104();
void upgrade_0_4_0_20080118();
void upgrade_0_4_0_20080129();
void upgrade_0_4_0_20080409();
void upgrade_0_4_0_20080607();
void upgrade_0_4_0_20080622();
void upgrade_0_4_0_beta1();
void upgrade_0_4_0_rc2();
void upgrade_1_0_99();
void upgrade_1_1_0();
void upgrade_1_1_91();
void upgrade_1_2_0_rc3();
void upgrade_1_3_0();
void upgrade_noHiddenClipNames();
void upgrade_automationNodes();
void upgrade_extendedNoteRange();
void upgrade_defaultTripleOscillatorHQ();
void upgrade_mixerRename();
void upgrade_bbTcoRename();
void upgrade_sampleAndHold();
void upgrade_midiCCIndexing();
void upgrade_loopsRename();
void upgrade_noteTypes();
void upgrade_fixCMTDelays();
void upgrade_fixBassLoopsTypo();
void findProblematicLadspaPlugins();
// List of all upgrade methods
static const std::vector<UpgradeMethod> UPGRADE_METHODS;
// List of ProjectVersions for the legacyFileVersion method
static const std::vector<ProjectVersion> UPGRADE_VERSIONS;
// Map with DOM elements that access resources (for making bundles)
using ResourcesMap = std::map<QString, std::vector<QString>>;
static const ResourcesMap ELEMENTS_WITH_RESOURCES;
void upgrade();
void loadData( const QByteArray & _data, const QString & _sourceFile );
QString m_fileName; //!< The origin file name or "" if this DataFile didn't originate from a file
QDomElement m_content;
QDomElement m_head;
Type m_type;
unsigned int m_fileVersion;
} ;
} // namespace lmms
#endif // LMMS_DATA_FILE_H
| 4,192
|
C++
|
.h
| 130
| 30.053846
| 143
| 0.761101
|
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,427
|
SampleLoader.h
|
LMMS_lmms/include/SampleLoader.h
|
/*
* SampleLoader.h - Load audio and waveform files
*
* 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_LOADER_H
#define LMMS_GUI_SAMPLE_LOADER_H
#include <QString>
#include <memory>
#include "SampleBuffer.h"
#include "lmms_export.h"
namespace lmms::gui {
class LMMS_EXPORT SampleLoader
{
public:
static QString openAudioFile(const QString& previousFile = "");
static QString openWaveformFile(const QString& previousFile = "");
static std::shared_ptr<const SampleBuffer> createBufferFromFile(const QString& filePath);
static std::shared_ptr<const SampleBuffer> createBufferFromBase64(
const QString& base64, int sampleRate = Engine::audioEngine()->outputSampleRate());
private:
static void displayError(const QString& message);
};
} // namespace lmms::gui
#endif // LMMS_GUI_SAMPLE_LOADER_H
| 1,624
|
C++
|
.h
| 43
| 35.976744
| 90
| 0.76967
|
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,428
|
fft_helpers.h
|
LMMS_lmms/include/fft_helpers.h
|
/*
* fft_helpers.h - some functions around FFT analysis
*
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2019 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_FFT_HELPERS_H
#define LMMS_FFT_HELPERS_H
#include "lmms_export.h"
#include <vector>
#include <fftw3.h>
namespace lmms
{
// NOTE: FFT_BUFFER_SIZE should be considered deprecated!
// It is used by Eq plugin and some older code here, but this should be a user
// switchable parameter, not a constant. Use a value from FFT_BLOCK_SIZES
constexpr auto FFT_BUFFER_SIZE = std::size_t{2048};
// Allowed FFT block sizes. Ranging from barely useful to barely acceptable
// because of performance and latency reasons.
const std::vector<unsigned int> FFT_BLOCK_SIZES = {256, 512, 1024, 2048, 4096, 8192, 16384};
// List of FFT window functions supported by precomputeWindow()
enum class FFTWindow
{
Rectangular = 0,
BlackmanHarris,
Hamming,
Hanning
};
/** Returns biggest value from abs_spectrum[spec_size] array.
*
* @return -1 on error, 0 on success
*/
float LMMS_EXPORT maximum(const float *abs_spectrum, unsigned int spec_size);
float LMMS_EXPORT maximum(const std::vector<float> &abs_spectrum);
/** Normalize the abs_spectrum array of absolute values to a 0..1 range
* based on supplied energy and stores it in the norm_spectrum array.
*
* @return -1 on error
*/
int LMMS_EXPORT normalize(const float *abs_spectrum, float *norm_spectrum, unsigned int bin_count, unsigned int block_size);
int LMMS_EXPORT normalize(const std::vector<float> &abs_spectrum, std::vector<float> &norm_spectrum, unsigned int block_size);
/** Check if the spectrum contains any non-zero value.
*
* @return 1 if spectrum contains any non-zero value
* @return 0 otherwise
*/
int LMMS_EXPORT notEmpty(const std::vector<float> &spectrum);
/** Precompute a window function for later real-time use.
* Set normalized to false if you do not want to apply amplitude correction.
*
* @return -1 on error
*/
int LMMS_EXPORT precomputeWindow(float *window, unsigned int length, FFTWindow type, bool normalized = true);
/** Compute absolute values of complex_buffer, save to absspec_buffer.
* Take care that - compl_len is not bigger than complex_buffer!
* - absspec buffer is big enough!
*
* @return 0 on success, else -1
*/
int LMMS_EXPORT absspec(const fftwf_complex *complex_buffer, float *absspec_buffer,
unsigned int compl_length);
/** Build fewer subbands from many absolute spectrum values.
* Take care that - compressedbands[] array num_new elements long
* - num_old > num_new
*
* @return 0 on success, else -1
*/
int LMMS_EXPORT compressbands(const float * _absspec_buffer, float * _compressedband,
int _num_old, int _num_new, int _bottom, int _top);
} // namespace lmms
#endif // LMMS_FFT_HELPERS_H
| 3,641
|
C++
|
.h
| 89
| 38.977528
| 126
| 0.752125
|
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,429
|
LadspaBase.h
|
LMMS_lmms/include/LadspaBase.h
|
/*
* LadspaBase.h - basic declarations concerning LADSPA
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* 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_LADSPA_BASE_H
#define LMMS_LADSPA_BASE_H
#include <QRegularExpression>
#include "LadspaManager.h"
#include "Plugin.h"
namespace lmms
{
class LadspaControl;
enum class BufferRate {
ChannelIn,
ChannelOut,
AudioRateInput,
AudioRateOutput,
ControlRateInput,
ControlRateOutput
};
enum class BufferDataType { Toggled, Enum, Integer, Floating, Time, None };
//! This struct is used to hold port descriptions internally
//! which where received from the ladspa plugin
struct port_desc_t
{
QString name;
ch_cnt_t proc;
uint16_t port_id;
uint16_t control_id;
BufferRate rate;
BufferDataType data_type;
float scale;
LADSPA_Data max;
LADSPA_Data min;
LADSPA_Data def;
LADSPA_Data value;
//! This is true iff ladspa suggests logscale
//! Note however that the model can still decide to use a linear scale
bool suggests_logscale;
LADSPA_Data* buffer;
LadspaControl* control;
};
inline Plugin::Descriptor::SubPluginFeatures::Key ladspaKeyToSubPluginKey(
const Plugin::Descriptor * _desc,
const QString & _name,
const ladspa_key_t & _key )
{
Plugin::Descriptor::SubPluginFeatures::Key::AttributeMap m;
QString file = _key.first;
m["file"] = file.remove(QRegularExpression("\\.so$")).remove(QRegularExpression("\\.dll$"));
m["plugin"] = _key.second;
return Plugin::Descriptor::SubPluginFeatures::Key( _desc, _name, m );
}
} // namespace lmms
#endif // LMMS_LADSPA_BASE_H
| 2,433
|
C++
|
.h
| 75
| 30.36
| 93
| 0.760768
|
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,430
|
SampleTrackWindow.h
|
LMMS_lmms/include/SampleTrackWindow.h
|
/*
* SampleTrackWindow.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_GUI_SAMPLE_TRACK_WINDOW_H
#define LMMS_GUI_SAMPLE_TRACK_WINDOW_H
#include <QWidget>
#include "ModelView.h"
#include "SampleTrack.h"
#include "SerializingObject.h"
class QLineEdit;
namespace lmms::gui
{
class EffectRackView;
class Knob;
class MixerChannelLcdSpinBox;
class SampleTrackView;
class SampleTrackWindow : public QWidget, public ModelView, public SerializingObjectHook
{
Q_OBJECT
public:
SampleTrackWindow(SampleTrackView * tv);
~SampleTrackWindow() override = default;
SampleTrack * model()
{
return castModel<SampleTrack>();
}
const SampleTrack * model() const
{
return castModel<SampleTrack>();
}
void setSampleTrackView(SampleTrackView * tv);
SampleTrackView *sampleTrackView()
{
return m_stv;
}
public slots:
void textChanged(const QString & new_name);
void toggleVisibility(bool on);
void updateName();
protected:
// capture close-events for toggling sample-track-button
void closeEvent(QCloseEvent * ce) override;
void saveSettings(QDomDocument & doc, QDomElement & element) override;
void loadSettings(const QDomElement & element) override;
private:
void modelChanged() override;
SampleTrack * m_track;
SampleTrackView * m_stv;
// widgets on the top of an sample-track-window
QLineEdit * m_nameLineEdit;
Knob * m_volumeKnob;
Knob * m_panningKnob;
MixerChannelLcdSpinBox * m_mixerChannelNumber;
EffectRackView * m_effectRack;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_SAMPLE_TRACK_WINDOW_H
| 2,386
|
C++
|
.h
| 77
| 28.922078
| 88
| 0.779335
|
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,431
|
embed.h
|
LMMS_lmms/include/embed.h
|
/*
* embed.h - misc. stuff for using embedded data (resources linked into binary)
*
* 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_EMBED_H
#define LMMS_EMBED_H
#include <string>
#include <string_view>
#include <QPixmap>
#include <QString>
#include "lmms_export.h"
#include "lmms_basics.h"
namespace lmms {
namespace embed {
/**
* Return an image for the icon pixmap cache.
*
* @param name Identifier for the pixmap. If it is not in the icon pixmap
* cache, it will be loaded from the artwork QDir search paths (exceptions are
* compiled-in XPMs, you need to provide @p xpm for loading them).
* @param xpm Must be XPM data if the source should be raw XPM data instead of
* a file
*/
auto LMMS_EXPORT getIconPixmap(std::string_view name,
int width = -1, int height = -1, const char* const* xpm = nullptr) -> QPixmap;
auto LMMS_EXPORT getText(std::string_view name) -> QString;
} // namespace embed
class PixmapLoader
{
public:
PixmapLoader() = default;
explicit PixmapLoader(std::string name, const char* const* xpm = nullptr) :
m_name{std::move(name)},
m_xpm{xpm}
{ }
virtual ~PixmapLoader() = default;
auto pixmap(int width = -1, int height = -1) const -> QPixmap
{
return embed::getIconPixmap(m_name, width, height, m_xpm);
}
auto pixmapName() const -> const std::string& { return m_name; }
private:
std::string m_name;
const char* const* m_xpm = nullptr;
};
#ifdef PLUGIN_NAME
class PluginPixmapLoader : public PixmapLoader
{
public:
PluginPixmapLoader() = default;
explicit PluginPixmapLoader(std::string name, const char* const* xpm = nullptr) :
PixmapLoader{LMMS_STRINGIFY(PLUGIN_NAME) "/" + name, xpm}
{ }
};
namespace PLUGIN_NAME {
inline auto getIconPixmap(std::string_view name,
int width = -1, int height = -1, const char* const* xpm = nullptr) -> QPixmap
{
return PluginPixmapLoader{std::string{name}, xpm}.pixmap(width, height);
}
} // namespace PLUGIN_NAME
#endif // PLUGIN_NAME
} // namespace lmms
#endif // LMMS_EMBED_H
| 2,836
|
C++
|
.h
| 83
| 32.240964
| 82
| 0.738095
|
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,432
|
SampleClipView.h
|
LMMS_lmms/include/SampleClipView.h
|
/*
* SampleClipView.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_GUI_SAMPLE_CLIP_VIEW_H
#define LMMS_GUI_SAMPLE_CLIP_VIEW_H
#include "ClipView.h"
namespace lmms
{
class SampleClip;
namespace gui
{
class SampleClipView : public ClipView
{
Q_OBJECT
public:
SampleClipView( SampleClip * _clip, TrackView * _tv );
~SampleClipView() override = default;
public slots:
void updateSample();
void reverseSample();
void setAutomationGhost();
protected:
void constructContextMenu(QMenu* cm) override;
void mousePressEvent( QMouseEvent * _me ) override;
void mouseReleaseEvent( QMouseEvent * _me ) override;
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;
void mouseDoubleClickEvent( QMouseEvent * ) override;
void paintEvent( QPaintEvent * ) override;
private:
SampleClip * m_clip;
QPixmap m_paintPixmap;
bool splitClip( const TimePos pos ) override;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_SAMPLE_CLIP_VIEW_H
| 1,854
|
C++
|
.h
| 57
| 30.54386
| 77
| 0.766723
|
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,433
|
AudioSoundIo.h
|
LMMS_lmms/include/AudioSoundIo.h
|
/*
* AudioSoundIo.h - device-class that performs PCM-output via libsoundio
*
* Copyright (c) 2015 Andrew Kelley <superjoe30@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_AUDIO_SOUNDIO_H
#define LMMS_AUDIO_SOUNDIO_H
#include <QObject>
#include "lmmsconfig.h"
#include "ComboBoxModel.h"
#ifdef LMMS_HAVE_SOUNDIO
#include <soundio/soundio.h>
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"
namespace lmms
{
namespace gui
{
class ComboBox;
class LcdSpinBox;
}
// Exists only to work around "Error: Meta object features not supported for nested classes"
class AudioSoundIoSetupUtil : public QObject
{
Q_OBJECT
public:
virtual ~AudioSoundIoSetupUtil() = default;
void *m_setupWidget;
public slots:
void updateDevices();
void reconnectSoundIo();
};
class AudioSoundIo : public AudioDevice
{
public:
AudioSoundIo( bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioSoundIo();
inline static QString name()
{
return QT_TRANSLATE_NOOP( "AudioDeviceSetupWidget", "soundio" );
}
class setupWidget : public gui::AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();
virtual void saveSettings();
void updateDevices();
void reconnectSoundIo();
private:
AudioSoundIoSetupUtil m_setupUtil;
gui::ComboBox * m_backend;
gui::ComboBox * m_device;
ComboBoxModel m_backendModel;
ComboBoxModel m_deviceModel;
SoundIo * m_soundio;
struct DeviceId {
QString id;
bool is_raw;
};
QList<DeviceId> m_deviceList;
int m_defaultOutIndex;
bool m_isFirst;
} ;
private:
virtual void startProcessing();
virtual void stopProcessing();
SoundIo *m_soundio;
SoundIoOutStream *m_outstream;
SampleFrame* m_outBuf;
int m_outBufSize;
fpp_t m_outBufFramesTotal;
fpp_t m_outBufFrameIndex;
bool m_stopped;
bool m_outstreamStarted;
int m_disconnectErr;
void onBackendDisconnect(int err);
void writeCallback(int frame_count_min, int frame_count_max);
void errorCallback(int err);
void underflowCallback();
static void staticWriteCallback(SoundIoOutStream *outstream, int frame_count_min, int frame_count_max) {
return ((AudioSoundIo *)outstream->userdata)->writeCallback(frame_count_min, frame_count_max);
}
static void staticErrorCallback(SoundIoOutStream *outstream, int err) {
return ((AudioSoundIo *)outstream->userdata)->errorCallback(err);
}
static void staticUnderflowCallback(SoundIoOutStream *outstream) {
return ((AudioSoundIo *)outstream->userdata)->underflowCallback();
}
static void staticOnBackendDisconnect(SoundIo *soundio, int err) {
return ((AudioSoundIo *)soundio->userdata)->onBackendDisconnect(err);
}
};
} // namespace lmms
#endif // LMMS_HAVE_SOUNDIO
#endif // LMMS_AUDIO_SOUNDIO_H
| 3,511
|
C++
|
.h
| 114
| 28.552632
| 105
| 0.775498
|
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,434
|
SampleRecordHandle.h
|
LMMS_lmms/include/SampleRecordHandle.h
|
/*
* SampleRecordHandle.h - play-handle for recording a sample
*
* Copyright (c) 2008 Csaba Hruska <csaba.hruska/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_SAMPLE_RECORD_HANDLE_H
#define LMMS_SAMPLE_RECORD_HANDLE_H
#include <QList>
#include <QPair>
#include <memory>
#include "PlayHandle.h"
#include "TimePos.h"
namespace lmms
{
class PatternTrack;
class SampleBuffer;
class SampleClip;
class Track;
class SampleRecordHandle : public PlayHandle
{
public:
SampleRecordHandle( SampleClip* clip );
~SampleRecordHandle() override;
void play( SampleFrame* _working_buffer ) override;
bool isFinished() const override;
bool isFromTrack( const Track * _track ) const override;
f_cnt_t framesRecorded() const;
std::shared_ptr<const SampleBuffer> createSampleBuffer();
private:
virtual void writeBuffer( const SampleFrame* _ab,
const f_cnt_t _frames );
using bufferList = QList<QPair<SampleFrame*, f_cnt_t>>;
bufferList m_buffers;
f_cnt_t m_framesRecorded;
TimePos m_minLength;
Track * m_track;
PatternTrack* m_patternTrack;
SampleClip * m_clip;
} ;
} // namespace lmms
#endif // LMMS_SAMPLE_RECORD_HANDLE_H
| 1,920
|
C++
|
.h
| 59
| 30.491525
| 70
| 0.767101
|
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,435
|
lmms_math.h
|
LMMS_lmms/include/lmms_math.h
|
/*
* lmms_math.h - defines math functions
*
* 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_MATH_H
#define LMMS_MATH_H
#include <QtGlobal>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstring>
#include "lmms_constants.h"
#include "lmmsconfig.h"
namespace lmms
{
inline bool approximatelyEqual(float x, float y)
{
return x == y ? true : std::abs(x - y) < F_EPSILON;
}
/*!
* @brief Returns the fractional part of a float, a value between -1.0f and 1.0f.
*
* fraction( 2.3) => 0.3
* fraction(-2.3) => -0.3
*
* Note that if the return value is used as a phase of an oscillator, that the oscillator must support
* negative phases.
*/
inline float fraction(const float x)
{
return x - std::trunc(x);
}
/*!
* @brief Returns the wrapped fractional part of a float, a value between 0.0f and 1.0f.
*
* absFraction( 2.3) => 0.3
* absFraction(-2.3) => 0.7
*
* Note that this not the same as the absolute value of the fraction (as the function name suggests).
* If the result is interpreted as a phase of an oscillator, it makes that negative phases are
* converted to positive phases.
*/
inline float absFraction(const float x)
{
return x - std::floor(x);
}
constexpr float FAST_RAND_RATIO = 1.0f / 32767;
inline int fast_rand()
{
static unsigned long next = 1;
next = next * 1103515245 + 12345;
return( (unsigned)( next / 65536 ) % 32768 );
}
inline float fastRandf(float range)
{
return fast_rand() * range * FAST_RAND_RATIO;
}
//! Round `value` to `where` depending on step size
template<class T>
static void roundAt(T& value, const T& where, const T& stepSize)
{
if (std::abs(value - where) < F_EPSILON * std::abs(stepSize))
{
value = where;
}
}
//! Source: http://martin.ankerl.com/2007/10/04/optimized-pow-approximation-for-java-and-c-c/
inline double fastPow(double a, double b)
{
double d;
std::int32_t x[2];
std::memcpy(x, &a, sizeof(x));
x[1] = static_cast<std::int32_t>(b * (x[1] - 1072632447) + 1072632447);
x[0] = 0;
std::memcpy(&d, x, sizeof(d));
return d;
}
//! returns 1.0f if val >= 0.0f, -1.0 else
inline float sign(float val)
{
return val >= 0.0f ? 1.0f : -1.0f;
}
//! if val >= 0.0f, returns sqrtf(val), else: -sqrtf(-val)
inline float sqrt_neg(float val)
{
return std::sqrt(std::abs(val)) * sign(val);
}
//! @brief Exponential function that deals with negative bases
inline float signedPowf(float v, float e)
{
return std::pow(std::abs(v), e) * sign(v);
}
//! @brief Scales @value from linear to logarithmic.
//! Value should be within [0,1]
inline float logToLinearScale(float min, float max, float value)
{
if( min < 0 )
{
const float mmax = std::max(std::abs(min), std::abs(max));
const float val = value * ( max - min ) + min;
float result = signedPowf( val / mmax, F_E ) * mmax;
return std::isnan( result ) ? 0 : result;
}
float result = powf( value, F_E ) * ( max - min ) + min;
return std::isnan( result ) ? 0 : result;
}
//! @brief Scales value from logarithmic to linear. Value should be in min-max range.
inline float linearToLogScale(float min, float max, float value)
{
static const float EXP = 1.0f / F_E;
const float valueLimited = std::clamp(value, min, max);
const float val = ( valueLimited - min ) / ( max - min );
if( min < 0 )
{
const float mmax = std::max(std::abs(min), std::abs(max));
float result = signedPowf( valueLimited / mmax, EXP ) * mmax;
return std::isnan( result ) ? 0 : result;
}
float result = powf( val, EXP ) * ( max - min ) + min;
return std::isnan( result ) ? 0 : result;
}
inline float fastPow10f(float x)
{
return std::exp(2.302585092994046f * x);
}
inline float fastLog10f(float x)
{
return std::log(x) * 0.4342944819032518f;
}
//! @brief Converts linear amplitude (>0-1.0) to dBFS scale.
//! @param amp Linear amplitude, where 1.0 = 0dBFS. ** Must be larger than zero! **
//! @return Amplitude in dBFS.
inline float ampToDbfs(float amp)
{
return fastLog10f(amp) * 20.0f;
}
//! @brief Converts dBFS-scale to linear amplitude with 0dBFS = 1.0
//! @param dbfs The dBFS value to convert. ** Must be a real number - not inf/nan! **
//! @return Linear amplitude
inline float dbfsToAmp(float dbfs)
{
return fastPow10f(dbfs * 0.05f);
}
//! @brief Converts linear amplitude (0-1.0) to dBFS scale. Handles zeroes as -inf.
//! @param amp Linear amplitude, where 1.0 = 0dBFS.
//! @return Amplitude in dBFS. -inf for 0 amplitude.
inline float safeAmpToDbfs(float amp)
{
return amp == 0.0f ? -INFINITY : ampToDbfs(amp);
}
//! @brief Converts dBFS-scale to linear amplitude with 0dBFS = 1.0. Handles infinity as zero.
//! @param dbfs The dBFS value to convert: all infinites are treated as -inf and result in 0
//! @return Linear amplitude
inline float safeDbfsToAmp(float dbfs)
{
return std::isinf(dbfs) ? 0.0f : dbfsToAmp(dbfs);
}
//! Returns the linear interpolation of the two values
template<class T, class F>
constexpr T lerp(T a, T b, F t)
{
return (1. - t) * a + t * b;
}
// @brief Calculate number of digits which LcdSpinBox would show for a given number
// @note Once we upgrade to C++20, we could probably use std::formatted_size
inline int numDigitsAsInt(float f)
{
// use rounding:
// LcdSpinBox sometimes uses std::round(), sometimes cast rounding
// we use rounding to be on the "safe side"
int asInt = static_cast<int>(std::round(f));
int digits = 1; // always at least 1
if(asInt < 0)
{
++digits;
asInt = -asInt;
}
// "asInt" is positive from now
int power = 1;
for (int i = 1; i < 10; ++i)
{
power *= 10;
if (asInt >= power) { ++digits; } // 2 digits for >=10, 3 for >=100
else { break; }
}
return digits;
}
template <typename T>
class LinearMap
{
public:
LinearMap(T x1, T y1, T x2, T y2)
{
T const dx = x2 - x1;
assert (dx != T(0));
m_a = (y2 - y1) / dx;
m_b = y1 - m_a * x1;
}
T map(T x) const
{
return m_a * x + m_b;
}
private:
T m_a;
T m_b;
};
} // namespace lmms
#endif // LMMS_MATH_H
| 6,795
|
C++
|
.h
| 228
| 27.97807
| 102
| 0.693746
|
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,436
|
Plugin.h
|
LMMS_lmms/include/Plugin.h
|
/*
* Plugin.h - class plugin, the base-class and generic interface for all plugins
*
* 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_PLUGIN_H
#define LMMS_PLUGIN_H
#include <QStringList>
#include <QMap>
#include "JournallingObject.h"
#include "Model.h"
class QWidget;
namespace lmms
{
class AutomatableModel;
class PixmapLoader;
namespace gui
{
class PluginView;
}
/**
Abstract representation of a plugin
Such a plugin can be an Instrument, Effect, Tool plugin etc.
Plugins have descriptors, containing meta info, which is used especially
by PluginFactory and friends.
There are also Plugin keys (class Key, confusingly under
SubPluginFeatures), which contain pointers to the plugin descriptor.
Some plugins have sub plugins, e.g. there is one CALF Plugin and for
each CALF effect, there is a CALF sub plugin. For those plugins, there
are keys for each sub plugin. These keys also link to the superior
Plugin::Descriptor. Additionally, they contain attributes that help the
superior Plugin saving them and recognizing them when loading.
In case of sub plugins, the Descriptor has SubPluginFeatures. Those
are a bit like values to the sub plugins' keys (in terms of a key-value-
map).
*/
class LMMS_EXPORT Plugin : public Model, public JournallingObject
{
Q_OBJECT
public:
enum class Type
{
Instrument, // instrument being used in channel-track
Effect, // effect-plugin for effect-board
ImportFilter, // filter for importing a file
ExportFilter, // filter for exporting a file
Tool, // additional tool (level-meter etc)
Library, // simple library holding a code-base for
// several other plugins (e.g. VST-support)
Other,
Undefined = 255
} ;
//! Descriptor holds information about a plugin - every external plugin
//! has to instantiate such a Descriptor in an extern "C"-section so that
//! the plugin-loader is able to access information about the plugin
struct Descriptor
{
const char * name;
const char * displayName;
const char * description;
const char * author;
int version;
Type type;
const PixmapLoader * logo;
const char * supportedFileTypes; //!< csv list of extensions
inline bool supportsFileType( const QString& extension ) const
{
return QString( supportedFileTypes ).split( QChar( ',' ) ).contains( extension );
}
/**
Access to non-key-data of a sub plugin
If you consider sub plugin keys as keys in a
key-value-map, this is the lookup for the corresponding
values. In order to have flexibility between different
plugin APIs, this is rather an array of fixed data,
but a bunch of virtual functions taking the key and
returning some values (or modifying objects of other
classes).
*/
class LMMS_EXPORT SubPluginFeatures
{
public:
/**
Key reference a Plugin::Descriptor, and,
if the plugin has sub plugins, also reference
its sub plugin (using the attributes).
When keys are saved, those attributes are
written to XML in order to find the right sub
plugin when realoading.
@note Any data that is not required to reference
the right Plugin or sub plugin should
not be here (but rather in
SubPluginFeatures, which are like values
in a key-value map).
*/
struct Key
{
using AttributeMap = QMap<QString, QString>;
inline Key( const Plugin::Descriptor * desc = nullptr,
const QString & name = QString(),
const AttributeMap & am = AttributeMap()
)
:
desc( desc ),
name( name ),
attributes( am )
{
}
Key( const QDomElement & key );
QDomElement saveXML( QDomDocument & doc ) const;
inline bool isValid() const
{
return desc != nullptr;
}
//! Key to subplugin: reference to parent descriptor
//! Key to plugin: reference to its descriptor
const Plugin::Descriptor* desc;
//! Descriptive name like "Calf Phaser".
//! Not required for key lookup and not saved
//! only used sometimes to temporary store descriptive names
//! @todo This is a bug, there should be a function
//! in SubPluginFeatures (to get the name) instead
QString name;
//! Attributes that make up the key and identify
//! the sub plugin. They are being loaded and saved
AttributeMap attributes;
// helper functions to retrieve data that is
// not part of the key, but mapped via desc->subPluginFeatures
QString additionalFileExtensions() const;
QString displayName() const;
QString description() const;
const PixmapLoader* logo() const;
} ;
using KeyList = QList<Key>;
SubPluginFeatures( Plugin::Type type ) :
m_type( type )
{
}
virtual ~SubPluginFeatures() = default;
virtual void fillDescriptionWidget( QWidget *, const Key * ) const
{
}
//! While PluginFactory only collects the plugins,
//! this function is used by widgets like EffectSelectDialog
//! to find all possible sub plugins
virtual void listSubPluginKeys( const Plugin::Descriptor *, KeyList & ) const
{
}
private:
// You can add values mapped by "Key" below
// The defaults are sane, i.e. redirect to sub plugin's
// supererior descriptor
virtual QString additionalFileExtensions(const Key&) const
{
return QString();
}
virtual QString displayName(const Key& k) const
{
return k.isValid() ? k.name : QString();
}
virtual QString description(const Key& k) const
{
return k.isValid() ? k.desc->description : QString();
}
virtual const PixmapLoader* logo(const Key& k) const
{
Q_ASSERT(k.desc);
return k.desc->logo;
}
protected:
const Plugin::Type m_type;
} ;
SubPluginFeatures * subPluginFeatures;
} ;
// typedef a list so we can easily work with list of plugin descriptors
using DescriptorList = QList<Descriptor*>;
//! Constructor of a plugin
//! @param key Sub plugins must pass a key here, optional otherwise.
//! See the key() function
Plugin(const Descriptor * descriptor, Model * parent,
const Descriptor::SubPluginFeatures::Key *key = nullptr);
~Plugin() override = default;
//! Return display-name out of sub plugin or descriptor
QString displayName() const override;
//! Return logo out of sub plugin or descriptor
const PixmapLoader *logo() const;
//! Return plugin type
inline Type type() const
{
return m_descriptor->type;
}
//! Return plugin Descriptor
inline const Descriptor * descriptor() const
{
return m_descriptor;
}
//! Return the key referencing this plugin. If the Plugin has no
//! sub plugin features, the key is pretty useless. If it has,
//! this key will also contain the sub plugin attributes, and will be
//! a key to those SubPluginFeatures.
inline const Descriptor::SubPluginFeatures::Key & key() const
{
return m_key;
}
//! Can be called if a file matching supportedFileTypes should be
//! loaded/processed with the help of this plugin
virtual void loadFile( const QString & file );
//! Called if external source needs to change something but we cannot
//! reference the class header. Should return null if not key not found.
virtual AutomatableModel* childModel( const QString & modelName );
//! Overload if the argument passed to the plugin is a subPluginKey
//! If you can not pass the key and are aware that it's stored in
//! Engine::pickDndPluginKey(), use this function, too
static Plugin * instantiateWithKey(const QString& pluginName, Model * parent,
const Descriptor::SubPluginFeatures::Key *key,
bool keyFromDnd = false);
//! Return an instance of a plugin whose name matches to given one
//! if specified plugin couldn't be loaded, it creates a dummy-plugin
//! @param data Anything the plugin expects. If this is a pointer to a sub plugin key,
//! use instantiateWithKey instead
static Plugin * instantiate(const QString& pluginName, Model * parent, void *data);
//! Create a view for the model
gui::PluginView * createView( QWidget * parent );
protected:
//! Create a view for the model
virtual gui::PluginView* instantiateView( QWidget * ) = 0;
void collectErrorForUI( QString errMsg );
private:
const Descriptor * m_descriptor;
Descriptor::SubPluginFeatures::Key m_key;
// pointer to instantiation-function in plugin
using InstantiationHook = Plugin* (*)(Model*, void*);
} ;
} // namespace lmms
#endif // LMMS_PLUGIN_H
| 9,218
|
C++
|
.h
| 253
| 33.106719
| 87
| 0.73397
|
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,437
|
AudioJack.h
|
LMMS_lmms/include/AudioJack.h
|
/*
* AudioJack.h - support for JACK-transport
*
* 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_AUDIO_JACK_H
#define LMMS_AUDIO_JACK_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_JACK
#ifndef LMMS_HAVE_WEAKJACK
#include <jack/jack.h>
#else
#include <weak_libjack.h>
#endif
#include <atomic>
#include <vector>
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"
class QLineEdit;
namespace lmms
{
class MidiJack;
namespace gui
{
class LcdSpinBox;
}
class AudioJack : public QObject, public AudioDevice
{
Q_OBJECT
public:
AudioJack(bool& successful, AudioEngine* audioEngine);
~AudioJack() override;
// this is to allow the jack midi connection to use the same jack client connection
// the jack callback is handled here, we call the midi client so that it can read
// it's midi data during the callback
AudioJack* addMidiClient(MidiJack* midiClient);
void removeMidiClient() { m_midiClient = nullptr; }
jack_client_t* jackClient() { return m_client; };
inline static QString name()
{
return QT_TRANSLATE_NOOP("AudioDeviceSetupWidget", "JACK (JACK Audio Connection Kit)");
}
class setupWidget : public gui::AudioDeviceSetupWidget
{
public:
setupWidget(QWidget* parent);
~setupWidget() override;
void saveSettings() override;
private:
QLineEdit* m_clientName;
gui::LcdSpinBox* m_channels;
};
private slots:
void restartAfterZombified();
private:
bool initJackClient();
void startProcessing() override;
void stopProcessing() override;
void registerPort(AudioPort* port) override;
void unregisterPort(AudioPort* port) override;
void renamePort(AudioPort* port) override;
int processCallback(jack_nframes_t nframes);
static int staticProcessCallback(jack_nframes_t nframes, void* udata);
static void shutdownCallback(void* _udata);
jack_client_t* m_client;
bool m_active;
std::atomic<bool> m_stopped;
std::atomic<MidiJack*> m_midiClient;
std::vector<jack_port_t*> m_outputPorts;
jack_default_audio_sample_t** m_tempOutBufs;
SampleFrame* m_outBuf;
f_cnt_t m_framesDoneInCurBuf;
f_cnt_t m_framesToDoInCurBuf;
#ifdef AUDIO_PORT_SUPPORT
struct StereoPort
{
jack_port_t* ports[2];
};
using JackPortMap = QMap<AudioPort*, StereoPort>;
JackPortMap m_portMap;
#endif
signals:
void zombified();
};
} // namespace lmms
#endif // LMMS_HAVE_JACK
#endif // LMMS_AUDIO_JACK_H
| 3,188
|
C++
|
.h
| 105
| 28.314286
| 89
| 0.772534
|
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,438
|
ProjectJournal.h
|
LMMS_lmms/include/ProjectJournal.h
|
/*
* ProjectJournal.h - declaration of class ProjectJournal
*
* Copyright (c) 2006-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_PROJECT_JOURNAL_H
#define LMMS_PROJECT_JOURNAL_H
#include <QHash>
#include <QStack>
#include "lmms_basics.h"
#include "DataFile.h"
namespace lmms
{
class JournallingObject;
//! @warning many parts of this class may be rewritten soon
class ProjectJournal
{
public:
static const int MAX_UNDO_STATES;
ProjectJournal();
virtual ~ProjectJournal() = default;
void undo();
void redo();
bool canUndo() const;
bool canRedo() const;
void addJournalCheckPoint( JournallingObject *jo );
bool isJournalling() const
{
return m_journalling;
}
void setJournalling( const bool _on )
{
m_journalling = _on;
}
// alloc new ID and register object _obj to it
jo_id_t allocID( JournallingObject * _obj );
// if there's already something known about ID _id, but it is currently
// unused (e.g. after jouralling object was deleted), register object
// _obj to this id
void reallocID( const jo_id_t _id, JournallingObject * _obj );
// make ID _id unused, but keep all global journalling information
// (order of journalling entries etc.) referring to _id - needed for
// restoring a journalling object later
void freeID( const jo_id_t _id )
{
reallocID( _id, nullptr );
}
//! hack, not used when saving a file
static jo_id_t idToSave( jo_id_t id );
//! hack, not used when loading a savefile
static jo_id_t idFromSave( jo_id_t id );
void clearJournal();
void stopAllJournalling();
JournallingObject * journallingObject( const jo_id_t _id )
{
if( m_joIDs.contains( _id ) )
{
return m_joIDs[_id];
}
return nullptr;
}
private:
using JoIdMap = QHash<jo_id_t, JournallingObject*>;
struct CheckPoint
{
CheckPoint( jo_id_t initID = 0, const DataFile& initData = DataFile( DataFile::Type::JournalData ) ) :
joID( initID ),
data( initData )
{
}
jo_id_t joID;
DataFile data;
} ;
using CheckPointStack = QStack<CheckPoint>;
JoIdMap m_joIDs;
CheckPointStack m_undoCheckPoints;
CheckPointStack m_redoCheckPoints;
bool m_journalling;
} ;
} // namespace lmms
#endif // LMMS_PROJECT_JOURNAL_H
| 3,008
|
C++
|
.h
| 99
| 28.080808
| 104
| 0.74123
|
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,439
|
fenv.h
|
LMMS_lmms/include/fenv.h
|
#pragma once
#include_next <fenv.h>
#if defined(__APPLE__) && defined(__MACH__)
// Public domain polyfill for feenableexcept on OS X
// http://www-personal.umich.edu/~williams/archive/computation/fe-handling-example.c
inline int feenableexcept(unsigned int excepts)
{
static fenv_t fenv;
unsigned int new_excepts = excepts & FE_ALL_EXCEPT;
// previous masks
unsigned int old_excepts;
if (fegetenv(&fenv)) {
return -1;
}
old_excepts = fenv.__control & FE_ALL_EXCEPT;
// unmask
fenv.__control &= ~new_excepts;
fenv.__mxcsr &= ~(new_excepts << 7);
return fesetenv(&fenv) ? -1 : old_excepts;
}
inline int fedisableexcept(unsigned int excepts)
{
static fenv_t fenv;
unsigned int new_excepts = excepts & FE_ALL_EXCEPT;
// all previous masks
unsigned int old_excepts;
if (fegetenv(&fenv)) {
return -1;
}
old_excepts = fenv.__control & FE_ALL_EXCEPT;
// mask
fenv.__control |= new_excepts;
fenv.__mxcsr |= new_excepts << 7;
return fesetenv(&fenv) ? -1 : old_excepts;
}
#endif // defined(__APPLE__) && defined(__MACH__)
| 1,131
|
C++
|
.h
| 36
| 27.194444
| 84
| 0.651893
|
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,440
|
BufferManager.h
|
LMMS_lmms/include/BufferManager.h
|
/*
* BufferManager.h - A buffer caching/memory management system
*
* 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_BUFFER_MANAGER_H
#define LMMS_BUFFER_MANAGER_H
#include "lmms_export.h"
#include "lmms_basics.h"
namespace lmms
{
class SampleFrame;
class LMMS_EXPORT BufferManager
{
public:
static void init( fpp_t fpp );
static SampleFrame* acquire();
static void release( SampleFrame* buf );
private:
static fpp_t s_framesPerPeriod;
};
} // namespace lmms
#endif // LMMS_BUFFER_MANAGER_H
| 1,412
|
C++
|
.h
| 42
| 31.761905
| 77
| 0.761205
|
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,441
|
AudioFileFlac.h
|
LMMS_lmms/include/AudioFileFlac.h
|
/*
* AudioFileFlac.h - Audio device which encodes a wave stream into a FLAC file.
*
* Copyright (c) 2017 to present Levin Oehlmann <irrenhaus3/at/gmail[dot]com> et al.
*
* 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_FLAC_H
#define LMMS_AUDIO_FILE_FLAC_H
#include "lmmsconfig.h"
#include "AudioFileDevice.h"
#include <sndfile.h>
namespace lmms
{
class AudioFileFlac : public AudioFileDevice
{
public:
AudioFileFlac(OutputSettings const& outputSettings,
ch_cnt_t const channels,
bool& successful,
QString const& file,
AudioEngine* audioEngine
);
~AudioFileFlac() override;
static AudioFileDevice* getInst(QString const& outputFilename,
OutputSettings const& outputSettings,
ch_cnt_t const channels,
AudioEngine* audioEngine,
bool& successful)
{
return new AudioFileFlac(
outputSettings,
channels,
successful,
outputFilename,
audioEngine
);
}
private:
SF_INFO m_sfinfo;
SNDFILE* m_sf;
void writeBuffer(const SampleFrame* _ab, fpp_t const frames) override;
bool startEncoding();
void finishEncoding();
};
} // namespace lmms
#endif // LMMS_AUDIO_FILE_FLAC_H
| 1,897
|
C++
|
.h
| 63
| 27.666667
| 84
| 0.761957
|
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,442
|
AudioPulseAudio.h
|
LMMS_lmms/include/AudioPulseAudio.h
|
/*
* AudioPulseAudio.h - device-class which implements PulseAudio-output
*
* 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_AUDIO_PULSEAUDIO_H
#define LMMS_AUDIO_PULSEAUDIO_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_PULSEAUDIO
#include <pulse/pulseaudio.h>
#include <QSemaphore>
#include <QThread>
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"
class QLineEdit;
namespace lmms
{
namespace gui
{
class LcdSpinBox;
}
class AudioPulseAudio : public QThread, public AudioDevice
{
Q_OBJECT
public:
AudioPulseAudio( bool & _success_ful, AudioEngine* audioEngine );
~AudioPulseAudio() override;
inline static QString name()
{
return QT_TRANSLATE_NOOP( "AudioDeviceSetupWidget", "PulseAudio" );
}
static QString probeDevice();
class setupWidget : public gui::AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
~setupWidget() override;
void saveSettings() override;
private:
QLineEdit * m_device;
gui::LcdSpinBox * m_channels;
} ;
void streamWriteCallback( pa_stream * s, size_t length );
void signalConnected( bool connected );
pa_stream * m_s;
pa_sample_spec m_sampleSpec;
private:
void startProcessing() override;
void stopProcessing() override;
void run() override;
volatile bool m_quit;
bool m_convertEndian;
bool m_connected;
QSemaphore m_connectedSemaphore;
} ;
} // namespace lmms
#endif // LMMS_HAVE_PULSEAUDIO
#endif // LMMS_AUDIO_PULSEAUDIO_H
| 2,278
|
C++
|
.h
| 76
| 27.828947
| 77
| 0.771639
|
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,443
|
AudioSampleRecorder.h
|
LMMS_lmms/include/AudioSampleRecorder.h
|
/*
* AudioSampleRecorder.h - device-class that implements recording
* audio-buffers into RAM
*
* 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_SAMPLE_RECORDER_H
#define LMMS_AUDIO_SAMPLE_RECORDER_H
#include <QList>
#include <QPair>
#include <memory>
#include "AudioDevice.h"
namespace lmms
{
class SampleBuffer;
class AudioSampleRecorder : public AudioDevice
{
public:
AudioSampleRecorder( const ch_cnt_t _channels, bool & _success_ful, AudioEngine* audioEngine );
~AudioSampleRecorder() override;
f_cnt_t framesRecorded() const;
std::shared_ptr<const SampleBuffer> createSampleBuffer();
private:
void writeBuffer(const SampleFrame* _ab, const fpp_t _frames) override;
using BufferList = QList<QPair<SampleFrame*, fpp_t>>;
BufferList m_buffers;
} ;
} // namespace lmms
#endif // LMMS_AUDIO_SAMPLE_RECORDER_H
| 1,698
|
C++
|
.h
| 47
| 34.212766
| 96
| 0.760073
|
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,444
|
Instrument.h
|
LMMS_lmms/include/Instrument.h
|
/*
* Instrument.h - declaration of class Instrument, which provides a
* standard interface for all instrument plugins
*
* 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_INSTRUMENT_H
#define LMMS_INSTRUMENT_H
#include <QString>
#include "Flags.h"
#include "lmms_export.h"
#include "lmms_basics.h"
#include "Plugin.h"
#include "TimePos.h"
#include <cmath>
namespace lmms
{
// forward-declarations
class InstrumentTrack;
class MidiEvent;
class NotePlayHandle;
class Track;
class SampleFrame;
class LMMS_EXPORT Instrument : public Plugin
{
public:
enum class Flag
{
NoFlags = 0x00,
IsSingleStreamed = 0x01, /*! Instrument provides a single audio stream for all notes */
IsMidiBased = 0x02, /*! Instrument is controlled by MIDI events rather than NotePlayHandles */
IsNotBendable = 0x04, /*! Instrument can't react to pitch bend changes */
};
using Flags = lmms::Flags<Flag>;
Instrument(InstrumentTrack * _instrument_track,
const Descriptor * _descriptor,
const Descriptor::SubPluginFeatures::Key * key = nullptr,
Flags flags = Flag::NoFlags);
~Instrument() override = default;
// --------------------------------------------------------------------
// functions that can/should be re-implemented:
// --------------------------------------------------------------------
virtual bool hasNoteInput() const { return true; }
// if the plugin doesn't play each note, it can create an instrument-
// play-handle and re-implement this method, so that it mixes its
// output buffer only once per audio engine period
virtual void play( SampleFrame* _working_buffer );
// to be implemented by actual plugin
virtual void playNote( NotePlayHandle * /* _note_to_play */,
SampleFrame* /* _working_buf */ )
{
}
// needed for deleting plugin-specific-data of a note - plugin has to
// cast void-ptr so that the plugin-data is deleted properly
// (call of dtor if it's a class etc.)
virtual void deleteNotePluginData( NotePlayHandle * _note_to_play );
// Get number of sample-frames that should be used when playing beat
// (note with unspecified length)
// Per default this function returns 0. In this case, channel is using
// the length of the longest envelope (if one active).
virtual f_cnt_t beatLen( NotePlayHandle * _n ) const;
// This method can be overridden by instruments that need a certain
// release time even if no envelope is active. It returns the time
// in milliseconds that these instruments would like to have for
// their release stage.
virtual float desiredReleaseTimeMs() const
{
return 0.f;
}
// Converts the desired release time in milliseconds to the corresponding
// number of frames depending on the sample rate.
f_cnt_t desiredReleaseFrames() const
{
const sample_rate_t sampleRate = getSampleRate();
return static_cast<f_cnt_t>(std::ceil(desiredReleaseTimeMs() * sampleRate / 1000.f));
}
sample_rate_t getSampleRate() const;
bool isSingleStreamed() const
{
return m_flags.testFlag(Instrument::Flag::IsSingleStreamed);
}
bool isMidiBased() const
{
return m_flags.testFlag(Instrument::Flag::IsMidiBased);
}
bool isBendable() const
{
return !m_flags.testFlag(Instrument::Flag::IsNotBendable);
}
// sub-classes can re-implement this for receiving all incoming
// MIDI-events
inline virtual bool handleMidiEvent( const MidiEvent&, const TimePos& = TimePos(), f_cnt_t offset = 0 )
{
return true;
}
QString fullDisplayName() const override;
// --------------------------------------------------------------------
// provided functions:
// --------------------------------------------------------------------
//! instantiate instrument-plugin with given name or return NULL
//! on failure
static Instrument * instantiate(const QString & _plugin_name,
InstrumentTrack * _instrument_track,
const Plugin::Descriptor::SubPluginFeatures::Key* key,
bool keyFromDnd = false);
virtual bool isFromTrack( const Track * _track ) const;
inline InstrumentTrack * instrumentTrack() const
{
return m_instrumentTrack;
}
protected:
// fade in to prevent clicks
void applyFadeIn(SampleFrame* buf, NotePlayHandle * n);
// instruments may use this to apply a soft fade out at the end of
// notes - method does this only if really less or equal
// desiredReleaseFrames() frames are left
void applyRelease( SampleFrame* buf, const NotePlayHandle * _n );
float computeReleaseTimeMsByFrameCount(f_cnt_t frames) const;
private:
InstrumentTrack * m_instrumentTrack;
Flags m_flags;
};
LMMS_DECLARE_OPERATORS_FOR_FLAGS(Instrument::Flag)
} // namespace lmms
#endif // LMMS_INSTRUMENT_H
| 5,475
|
C++
|
.h
| 143
| 36.006993
| 104
| 0.717202
|
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,445
|
PianoRoll.h
|
LMMS_lmms/include/PianoRoll.h
|
/*
* PianoRoll.h - declaration of class PianoRoll which is a window where you
* can set and edit notes in an easy way
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008 Andrew Kelley <superjoe30/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_PIANO_ROLL_H
#define LMMS_GUI_PIANO_ROLL_H
#include <QWidget>
#include <vector>
#include "Editor.h"
#include "ComboBoxModel.h"
#include "SerializingObject.h"
#include "Note.h"
#include "lmms_basics.h"
#include "Song.h"
#include "StepRecorder.h"
#include "StepRecorderWidget.h"
class QPainter;
class QPixmap;
class QPushButton;
class QScrollBar;
class QString;
class QMenu;
class QToolButton;
namespace lmms
{
class NotePlayHandle;
class MidiClip;
namespace gui
{
class ComboBox;
class PositionLine;
class SimpleTextFloat;
class TimeLineWidget;
class PianoRoll : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor barLineColor MEMBER m_barLineColor)
Q_PROPERTY(QColor beatLineColor MEMBER m_beatLineColor)
Q_PROPERTY(QColor lineColor MEMBER m_lineColor)
Q_PROPERTY(QColor noteModeColor MEMBER m_noteModeColor)
Q_PROPERTY(QColor noteColor MEMBER m_noteColor)
Q_PROPERTY(QColor stepNoteColor MEMBER m_stepNoteColor)
Q_PROPERTY(QColor ghostNoteColor MEMBER m_ghostNoteColor)
Q_PROPERTY(QColor noteTextColor MEMBER m_noteTextColor)
Q_PROPERTY(QColor ghostNoteTextColor MEMBER m_ghostNoteTextColor)
Q_PROPERTY(QColor barColor MEMBER m_barColor)
Q_PROPERTY(QColor selectedNoteColor MEMBER m_selectedNoteColor)
Q_PROPERTY(QColor textColor MEMBER m_textColor)
Q_PROPERTY(QColor textColorLight MEMBER m_textColorLight)
Q_PROPERTY(QColor textShadow MEMBER m_textShadow)
Q_PROPERTY(QColor markedSemitoneColor MEMBER m_markedSemitoneColor)
Q_PROPERTY(QColor knifeCutLine MEMBER m_knifeCutLineColor)
Q_PROPERTY(int noteOpacity MEMBER m_noteOpacity)
Q_PROPERTY(bool noteBorders MEMBER m_noteBorders)
Q_PROPERTY(int ghostNoteOpacity MEMBER m_ghostNoteOpacity)
Q_PROPERTY(bool ghostNoteBorders MEMBER m_ghostNoteBorders)
Q_PROPERTY(QColor backgroundShade MEMBER m_backgroundShade)
/* white key properties */
Q_PROPERTY(int whiteKeyWidth MEMBER m_whiteKeyWidth)
Q_PROPERTY(QColor whiteKeyInactiveTextColor MEMBER m_whiteKeyInactiveTextColor)
Q_PROPERTY(QColor whiteKeyInactiveTextShadow MEMBER m_whiteKeyInactiveTextShadow)
Q_PROPERTY(QBrush whiteKeyInactiveBackground MEMBER m_whiteKeyInactiveBackground)
Q_PROPERTY(QColor whiteKeyActiveTextColor MEMBER m_whiteKeyActiveTextColor)
Q_PROPERTY(QColor whiteKeyActiveTextShadow MEMBER m_whiteKeyActiveTextShadow)
Q_PROPERTY(QBrush whiteKeyActiveBackground MEMBER m_whiteKeyActiveBackground)
Q_PROPERTY(QBrush whiteKeyDisabledBackground MEMBER m_whiteKeyDisabledBackground)
/* black key properties */
Q_PROPERTY(int blackKeyWidth MEMBER m_blackKeyWidth)
Q_PROPERTY(QBrush blackKeyInactiveBackground MEMBER m_blackKeyInactiveBackground)
Q_PROPERTY(QBrush blackKeyActiveBackground MEMBER m_blackKeyActiveBackground)
Q_PROPERTY(QBrush blackKeyDisabledBackground MEMBER m_blackKeyDisabledBackground)
public:
enum class EditMode
{
Draw,
Erase,
Select,
Detuning,
Knife
};
/*! \brief Resets settings to default when e.g. creating a new project */
void reset();
// functions to display the hover-text labeling a note's volume/panning
void showTextFloat(const QString &text, const QPoint &pos, int timeout=-1);
void showVolTextFloat(volume_t vol, const QPoint &pos, int timeout=-1);
void showPanTextFloat(panning_t pan, const QPoint &pos, int timeout=-1);
void setCurrentMidiClip( MidiClip* newMidiClip );
void setGhostMidiClip( MidiClip* newMidiClip );
void loadGhostNotes( const QDomElement & de );
void loadMarkedSemiTones(const QDomElement & de);
inline void stopRecording()
{
m_recording = false;
}
inline bool isRecording() const
{
return m_recording;
}
inline bool isStepRecording() const
{
return m_stepRecorder.isRecording();
}
const MidiClip* currentMidiClip() const
{
return m_midiClip;
}
bool hasValidMidiClip() const
{
return m_midiClip != nullptr;
}
int trackOctaveSize() const;
Song::PlayMode desiredPlayModeForAccompany() const;
int quantization() const;
protected:
enum class QuantizeAction
{
Both,
Pos,
Length
};
enum class SemiToneMarkerAction
{
UnmarkAll,
MarkCurrentSemiTone,
MarkAllOctaveSemiTones,
MarkCurrentScale,
MarkCurrentChord,
CopyAllNotesOnKey
};
void keyPressEvent( QKeyEvent * ke ) override;
void keyReleaseEvent( QKeyEvent * ke ) override;
void leaveEvent( QEvent * e ) override;
void mousePressEvent( QMouseEvent * me ) override;
void mouseDoubleClickEvent( QMouseEvent * me ) override;
void mouseReleaseEvent( QMouseEvent * me ) override;
void mouseMoveEvent( QMouseEvent * me ) override;
void paintEvent( QPaintEvent * pe ) override;
void resizeEvent( QResizeEvent * re ) override;
void wheelEvent( QWheelEvent * we ) override;
void focusOutEvent( QFocusEvent * ) override;
void focusInEvent( QFocusEvent * ) override;
int getKey( int y ) const;
void drawNoteRect( QPainter & p, int x, int y,
int width, const Note * n, const QColor & noteCol, const QColor & noteTextColor,
const QColor & selCol, const int noteOpc, const bool borderless, bool drawNoteName );
void removeSelection();
void selectAll();
NoteVector getSelectedNotes() const;
void selectNotesOnKey();
// for entering values with dblclick in the vol/pan bars
void enterValue( NoteVector* nv );
void updateYScroll();
protected slots:
void play();
void record();
void recordAccompany();
bool toggleStepRecording();
void stop();
void startRecordNote( const lmms::Note & n );
void finishRecordNote( const lmms::Note & n );
void horScrolled( int new_pos );
void verScrolled( int new_pos );
void setEditMode(int mode);
void copySelectedNotes();
void cutSelectedNotes();
void pasteNotes();
bool deleteSelectedNotes();
void updatePosition(const lmms::TimePos & t );
void updatePositionAccompany(const lmms::TimePos & t );
void updatePositionStepRecording(const lmms::TimePos & t );
void zoomingChanged();
void zoomingYChanged();
void quantizeChanged();
void noteLengthChanged();
void keyChanged();
void quantizeNotes(QuantizeAction mode = QuantizeAction::Both);
void updateSemiToneMarkerMenu();
void changeNoteEditMode( int i );
void markSemiTone(SemiToneMarkerAction i, bool fromMenu = true);
void hideMidiClip( lmms::MidiClip* clip );
void selectRegionFromPixels( int xStart, int xEnd );
void clearGhostClip();
void glueNotes();
void fitNoteLengths(bool fill);
void constrainNoteLengths(bool constrainMax);
void changeSnapMode();
signals:
void currentMidiClipChanged();
void ghostClipSet(bool);
void semiToneMarkerMenuScaleSetEnabled(bool);
void semiToneMarkerMenuChordSetEnabled(bool);
private:
enum class Action
{
None,
MoveNote,
ResizeNote,
SelectNotes,
ChangeNoteProperty,
ResizeNoteEditArea,
Knife
};
enum class NoteEditMode
{
Volume,
Panning,
Count // make sure this one is always last
};
enum class KeyType
{
WhiteSmall,
WhiteBig,
Black
};
enum class GridMode
{
Nudge,
Snap
// Free
};
PositionLine * m_positionLine;
std::vector<QString> m_nemStr; // gui names of each edit mode
QMenu * m_noteEditMenu; // when you right click below the key area
QList<int> m_markedSemiTones;
QMenu * m_semiToneMarkerMenu; // when you right click on the key area
int m_pianoKeySelected;
PianoRoll();
PianoRoll( const PianoRoll & );
~PianoRoll() override = default;
void autoScroll(const TimePos & t );
TimePos newNoteLen() const;
void shiftPos(int amount);
void shiftPos(const NoteVector& notes, int amount);
void shiftSemiTone(int amount);
void shiftSemiTone(const NoteVector& notes, int amount);
bool isSelection() const;
int selectionCount() const;
void testPlayNote( Note * n );
void testPlayKey( int _key, int _vol, int _pan );
void pauseTestNotes(bool pause = true );
void playChordNotes(int key, int velocity=-1);
void pauseChordNotes(int key);
void setKnifeAction();
void cancelKnifeAction();
void updateScrollbars();
void updatePositionLineHeight();
QList<int> getAllOctavesForKey( int keyToMirror ) const;
int noteEditTop() const;
int keyAreaBottom() const;
int noteEditBottom() const;
int keyAreaTop() const;
int noteEditRight() const;
int noteEditLeft() const;
void dragNotes(int x, int y, bool alt, bool shift, bool ctrl);
static const int cm_scrollAmtHoriz = 10;
static const int cm_scrollAmtVert = 1;
QPixmap m_toolDraw = embed::getIconPixmap("edit_draw");
QPixmap m_toolErase = embed::getIconPixmap("edit_erase");
QPixmap m_toolSelect = embed::getIconPixmap("edit_select");
QPixmap m_toolMove = embed::getIconPixmap("edit_move");
QPixmap m_toolOpen = embed::getIconPixmap("automation");
QPixmap m_toolKnife = embed::getIconPixmap("edit_knife");
static std::array<KeyType, 12> prKeyOrder;
static SimpleTextFloat * s_textFloat;
ComboBoxModel m_zoomingModel;
ComboBoxModel m_zoomingYModel;
ComboBoxModel m_quantizeModel;
ComboBoxModel m_noteLenModel;
ComboBoxModel m_keyModel;
ComboBoxModel m_scaleModel;
ComboBoxModel m_chordModel;
ComboBoxModel m_snapModel;
static const std::vector<float> m_zoomLevels;
static const std::vector<float> m_zoomYLevels;
MidiClip* m_midiClip;
NoteVector m_ghostNotes;
inline const NoteVector & ghostNotes() const
{
return m_ghostNotes;
}
QScrollBar * m_leftRightScroll;
QScrollBar * m_topBottomScroll;
void adjustLeftRightScoll(int value);
TimePos m_currentPosition;
bool m_recording;
bool m_doAutoQuantization{false};
QList<Note> m_recordingNotes;
Note * m_currentNote;
Action m_action;
NoteEditMode m_noteEditMode;
GridMode m_gridMode;
int m_selectStartTick;
int m_selectedTick;
int m_selectStartKey;
int m_selectedKeys;
// boundary box around all selected notes when dragging
int m_moveBoundaryLeft;
int m_moveBoundaryTop;
int m_moveBoundaryRight;
int m_moveBoundaryBottom;
// remember where the scrolling started when dragging so that
// we can handle dragging while scrolling with arrow keys
int m_mouseDownKey;
int m_mouseDownTick;
// remember the last x and y of a mouse movement
int m_lastMouseX;
int m_lastMouseY;
// x,y of when the user starts a drag
int m_moveStartX;
int m_moveStartY;
int m_notesEditHeight;
int m_userSetNotesEditHeight;
int m_ppb; // pixels per bar
int m_totalKeysToScroll;
int m_pianoKeysVisible;
int m_keyLineHeight;
int m_whiteKeySmallHeight;
int m_whiteKeyBigHeight;
int m_blackKeyHeight;
// remember these values to use them
// for the next note that is set
TimePos m_lenOfNewNotes;
volume_t m_lastNoteVolume;
panning_t m_lastNotePanning;
//When resizing several notes, we want to calculate a common minimum length
TimePos m_minResizeLen;
int m_startKey; // first key when drawing
int m_lastKey;
EditMode m_editMode;
EditMode m_ctrlMode; // mode they were in before they hit ctrl
EditMode m_knifeMode; // mode they where in before entering knife mode
bool m_mouseDownRight; //true if right click is being held down
TimeLineWidget * m_timeLine;
bool m_scrollBack;
void copyToClipboard(const NoteVector & notes ) const;
void drawDetuningInfo( QPainter & _p, const Note * _n, int _x, int _y ) const;
bool mouseOverNote();
Note * noteUnderMouse();
// turn a selection rectangle into selected notes
void computeSelectedNotes( bool shift );
void clearSelectedNotes();
// did we start a mouseclick with shift pressed
bool m_startedWithShift;
// Variable that holds the position in ticks for the knife action
int m_knifeTickPos;
void updateKnifePos(QMouseEvent* me);
friend class PianoRollWindow;
StepRecorderWidget m_stepRecorderWidget;
StepRecorder m_stepRecorder;
// qproperty fields
QColor m_barLineColor;
QColor m_beatLineColor;
QColor m_lineColor;
QColor m_noteModeColor;
QColor m_noteColor;
QColor m_stepNoteColor;
QColor m_noteTextColor;
QColor m_ghostNoteColor;
QColor m_ghostNoteTextColor;
QColor m_barColor;
QColor m_selectedNoteColor;
QColor m_textColor;
QColor m_textColorLight;
QColor m_textShadow;
QColor m_markedSemitoneColor;
QColor m_knifeCutLineColor;
int m_noteOpacity;
int m_ghostNoteOpacity;
bool m_noteBorders;
bool m_ghostNoteBorders;
QColor m_backgroundShade;
/* white key properties */
int m_whiteKeyWidth;
QColor m_whiteKeyActiveTextColor;
QColor m_whiteKeyActiveTextShadow;
QBrush m_whiteKeyActiveBackground;
QColor m_whiteKeyInactiveTextColor;
QColor m_whiteKeyInactiveTextShadow;
QBrush m_whiteKeyInactiveBackground;
QBrush m_whiteKeyDisabledBackground;
/* black key properties */
int m_blackKeyWidth;
QBrush m_blackKeyActiveBackground;
QBrush m_blackKeyInactiveBackground;
QBrush m_blackKeyDisabledBackground;
signals:
void positionChanged( const lmms::TimePos & );
} ;
class PianoRollWindow : public Editor, SerializingObject
{
Q_OBJECT
public:
PianoRollWindow();
const MidiClip* currentMidiClip() const;
void setCurrentMidiClip( MidiClip* clip );
void setGhostMidiClip( MidiClip* clip );
int quantization() const;
void play() override;
void stop() override;
void record() override;
void recordAccompany() override;
void toggleStepRecording() override;
void stopRecording();
bool isRecording() const;
/*! \brief Resets settings to default when e.g. creating a new project */
void reset();
using SerializingObject::saveState;
using SerializingObject::restoreState;
void saveSettings(QDomDocument & doc, QDomElement & de ) override;
void loadSettings( const QDomElement & de ) override;
inline QString nodeName() const override
{
return "pianoroll";
}
QSize sizeHint() const override;
bool hasFocus() const;
signals:
void currentMidiClipChanged();
private slots:
void updateAfterMidiClipChange();
void ghostClipSet( bool state );
void exportMidiClip();
void importMidiClip();
private:
void clipRenamed();
void focusInEvent(QFocusEvent * event) override;
void stopStepRecording();
void updateStepRecordingIcon();
PianoRoll* m_editor;
QToolButton* m_fileToolsButton;
ComboBox * m_zoomingComboBox;
ComboBox * m_zoomingYComboBox;
ComboBox * m_quantizeComboBox;
ComboBox * m_noteLenComboBox;
ComboBox * m_keyComboBox;
ComboBox * m_scaleComboBox;
ComboBox * m_chordComboBox;
ComboBox* m_snapComboBox;
QPushButton * m_clearGhostButton;
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_PIANO_ROLL_H
| 15,249
|
C++
|
.h
| 464
| 30.614224
| 90
| 0.795622
|
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,446
|
RenameDialog.h
|
LMMS_lmms/include/RenameDialog.h
|
/*
* RenameDialog.h - declaration of class renameDialog, a simple dialog for
* changing the content of a string
*
* Copyright (c) 2004-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_RENAME_DIALOG_H
#define LMMS_GUI_RENAME_DIALOG_H
#include <QDialog>
class QLineEdit;
namespace lmms::gui
{
class RenameDialog : public QDialog
{
Q_OBJECT
public:
RenameDialog( QString & _string );
~RenameDialog() override = default;
protected:
void keyPressEvent( QKeyEvent * _ke ) override;
void resizeEvent(QResizeEvent * event) override;
protected slots:
void textChanged( const QString & _new_string );
private:
QString & m_stringToEdit;
QString m_originalString;
QLineEdit * m_stringLE;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_RENAME_DIALOG_H
| 1,604
|
C++
|
.h
| 48
| 31.4375
| 77
| 0.755354
|
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,447
|
ModelVisitor.h
|
LMMS_lmms/include/ModelVisitor.h
|
/*
* ModelVisitor.h - visitors for automatable models
*
* 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.
*
*/
#ifndef LMMS_MODEL_VISITOR_H
#define LMMS_MODEL_VISITOR_H
namespace lmms
{
class AutomatableModel;
class BoolModel;
class IntModel;
class FloatModel;
class ComboBoxModel;
class TempoSyncKnobModel;
class ModelVisitor
{
template<class ParentType = AutomatableModel, class ModelType>
void up(ModelType& m) { visit(static_cast<ParentType&>(m)); }
public:
virtual void visit(AutomatableModel& ) {}
virtual void visit(BoolModel& m);
virtual void visit(IntModel& m);
virtual void visit(FloatModel& m);
virtual void visit(ComboBoxModel& m);
virtual void visit(TempoSyncKnobModel& m);
virtual ~ModelVisitor() = default;
};
class ConstModelVisitor
{
template<class ParentType = AutomatableModel, class ModelType>
void up(const ModelType& m) {
visit(static_cast<const ParentType&>(m)); }
public:
virtual void visit(const AutomatableModel& ) {}
virtual void visit(const BoolModel& m);
virtual void visit(const IntModel& m);
virtual void visit(const FloatModel& m);
virtual void visit(const ComboBoxModel& m);
virtual void visit(const TempoSyncKnobModel& m);
virtual ~ConstModelVisitor() = default;
};
} // namespace lmms
#endif // LMMS_MODEL_VISITOR_H
| 2,094
|
C++
|
.h
| 62
| 31.951613
| 72
| 0.769649
|
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,448
|
ComboBoxModel.h
|
LMMS_lmms/include/ComboBoxModel.h
|
/*
* ComboBoxModel.h - declaration of class ComboBoxModel
*
* 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_COMBOBOX_MODEL_H
#define LMMS_COMBOBOX_MODEL_H
#include <memory>
#include <utility>
#include <vector>
#include "AutomatableModel.h"
#include "embed.h"
namespace lmms
{
class LMMS_EXPORT ComboBoxModel : public IntModel
{
Q_OBJECT
MODEL_IS_VISITABLE
public:
ComboBoxModel( Model* parent = nullptr,
const QString& displayName = QString(),
bool isDefaultConstructed = false ) :
IntModel( 0, 0, 0, parent, displayName, isDefaultConstructed )
{
}
void addItem( QString item, std::unique_ptr<PixmapLoader> loader = nullptr );
void replaceItem(std::size_t index, QString item, std::unique_ptr<PixmapLoader> loader = nullptr);
void clear();
int findText( const QString& txt ) const;
QString currentText() const
{
return ( size() > 0 && value() < size() ) ? m_items[value()].first : QString();
}
const PixmapLoader* currentData() const
{
return m_items[value()].second.get();
}
const QString & itemText( int i ) const
{
return m_items[std::clamp(i, minValue(), maxValue())].first;
}
const PixmapLoader* itemPixmap( int i ) const
{
return m_items[std::clamp(i, minValue(), maxValue())].second.get();
}
int size() const
{
return m_items.size();
}
private:
using Item = std::pair<QString, std::unique_ptr<PixmapLoader>>;
std::vector<Item> m_items;
} ;
} // namespace lmms
#endif // LMMS_COMBOBOX_MODEL_H
| 2,306
|
C++
|
.h
| 73
| 29.356164
| 99
| 0.734749
|
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,449
|
EffectControlDialog.h
|
LMMS_lmms/include/EffectControlDialog.h
|
/*
* EffectControlDialog.h - base-class for effect-dialogs for displaying and
* editing control port values
*
* 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_GUI_EFFECT_CONTROL_DIALOG_H
#define LMMS_GUI_EFFECT_CONTROL_DIALOG_H
#include <QWidget>
#include "ModelView.h"
namespace lmms
{
class EffectControls;
namespace gui
{
class LMMS_EXPORT EffectControlDialog : public QWidget, public ModelView
{
Q_OBJECT
public:
EffectControlDialog( EffectControls * _controls );
~EffectControlDialog() override = default;
virtual bool isResizable() const {return false;}
signals:
void closed();
protected:
void closeEvent( QCloseEvent * _ce ) override;
EffectControls * m_effectControls;
} ;
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_EFFECT_CONTROL_DIALOG_H
| 1,651
|
C++
|
.h
| 49
| 31.714286
| 77
| 0.760732
|
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,450
|
AudioDevice.h
|
LMMS_lmms/include/AudioDevice.h
|
/*
* AudioDevice.h - base-class for audio-devices, used by LMMS audio engine
*
* 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_DEVICE_H
#define LMMS_AUDIO_DEVICE_H
#include <QMutex>
#include <samplerate.h>
#include "lmms_basics.h"
class QThread;
namespace lmms
{
class AudioEngine;
class AudioPort;
class SampleFrame;
class AudioDevice
{
public:
AudioDevice( const ch_cnt_t _channels, AudioEngine* audioEngine );
virtual ~AudioDevice();
inline void lock()
{
m_devMutex.lock();
}
inline void unlock()
{
m_devMutex.unlock();
}
// if audio-driver supports ports, classes inherting AudioPort
// (e.g. channel-tracks) can register themselves for making
// audio-driver able to collect their individual output and provide
// them at a specific port - currently only supported by JACK
virtual void registerPort( AudioPort * _port );
virtual void unregisterPort( AudioPort * _port );
virtual void renamePort( AudioPort * _port );
inline bool supportsCapture() const
{
return m_supportsCapture;
}
inline sample_rate_t sampleRate() const
{
return m_sampleRate;
}
ch_cnt_t channels() const
{
return m_channels;
}
void processNextBuffer();
virtual void startProcessing()
{
m_inProcess = true;
}
virtual void stopProcessing();
protected:
// subclasses can re-implement this for being used in conjunction with
// processNextBuffer()
virtual void writeBuffer(const SampleFrame* /* _buf*/, const fpp_t /*_frames*/) {}
// called by according driver for fetching new sound-data
fpp_t getNextBuffer(SampleFrame* _ab);
// convert a given audio-buffer to a buffer in signed 16-bit samples
// returns num of bytes in outbuf
int convertToS16(const SampleFrame* _ab,
const fpp_t _frames,
int_sample_t * _output_buffer,
const bool _convert_endian = false );
// clear given signed-int-16-buffer
void clearS16Buffer( int_sample_t * _outbuf,
const fpp_t _frames );
inline void setSampleRate( const sample_rate_t _new_sr )
{
m_sampleRate = _new_sr;
}
AudioEngine* audioEngine()
{
return m_audioEngine;
}
static void stopProcessingThread( QThread * thread );
protected:
bool m_supportsCapture;
private:
sample_rate_t m_sampleRate;
ch_cnt_t m_channels;
AudioEngine* m_audioEngine;
bool m_inProcess;
QMutex m_devMutex;
SampleFrame* m_buffer;
};
} // namespace lmms
#endif // LMMS_AUDIO_DEVICE_H
| 3,237
|
C++
|
.h
| 108
| 27.574074
| 83
| 0.752424
|
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,451
|
EnvelopeGraph.h
|
LMMS_lmms/include/EnvelopeGraph.h
|
/*
* EnvelopeGraph.h - Displays envelope 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_ENVELOPE_GRAPH_H
#define LMMS_GUI_ENVELOPE_GRAPH_H
#include <QWidget>
#include "ModelView.h"
#include "embed.h"
namespace lmms
{
class EnvelopeAndLfoParameters;
namespace gui
{
class EnvelopeGraph : public QWidget, public ModelView
{
public:
enum class ScalingMode
{
Dynamic,
Absolute,
Relative
};
public:
EnvelopeGraph(QWidget* parent);
protected:
void modelChanged() override;
void mousePressEvent(QMouseEvent*) override;
void contextMenuEvent(QContextMenuEvent*) override;
void paintEvent(QPaintEvent*) override;
private:
void toggleAmountModel();
private:
QPixmap m_envGraph = embed::getIconPixmap("envelope_graph");
EnvelopeAndLfoParameters* m_params = nullptr;
ScalingMode m_scaling = ScalingMode::Dynamic;
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_ENVELOPE_GRAPH_H
| 1,812
|
C++
|
.h
| 60
| 28.233333
| 77
| 0.775793
|
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,452
|
TextFloat.h
|
LMMS_lmms/include/TextFloat.h
|
/*
* TextFloat.h - class textFloat, a floating text-label
*
* 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_TEXT_FLOAT_H
#define LMMS_GUI_TEXT_FLOAT_H
#include <QWidget>
#include "lmms_export.h"
class QLabel;
namespace lmms::gui
{
class LMMS_EXPORT TextFloat : public QWidget
{
Q_OBJECT
public:
TextFloat();
~TextFloat() override = default;
void setTitle(const QString & title);
void setText(const QString & text);
void setPixmap(const QPixmap & pixmap);
void setVisibilityTimeOut(int msecs);
static TextFloat * displayMessage(const QString & title,
const QString & msg,
const QPixmap & pixmap = QPixmap(),
int timeout = 2000,
QWidget * parent = nullptr);
void moveGlobal(QWidget * w, const QPoint & offset)
{
move(w->mapToGlobal(QPoint(0, 0)) + offset);
}
protected:
void mousePressEvent(QMouseEvent * me) override;
private:
TextFloat(const QString & title, const QString & text, const QPixmap & pixmap);
QLabel * m_pixmapLabel;
QLabel * m_titleLabel;
QLabel * m_textLabel;
};
} // namespace lmms::gui
#endif // LMMS_GUI_TEXT_FLOAT_H
| 1,940
|
C++
|
.h
| 59
| 30.457627
| 80
| 0.744898
|
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,453
|
LadspaManager.h
|
LMMS_lmms/include/LadspaManager.h
|
/*
* LadspaManager.h - declaration of class LadspaManager
* a class to manage loading and instantiation
* of ladspa plugins
*
* 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_MANAGER_H
#define LMMS_LADSPA_MANAGER_H
#include <ladspa.h>
#include <QMap>
#include <QPair>
#include <QString>
#include <QStringList>
#include "lmms_export.h"
#include "lmms_basics.h"
namespace lmms
{
const float NOHINT = -99342.2243f;
using ladspa_key_t = QPair<QString, QString>;
using sortable_plugin_t = QPair<QString, ladspa_key_t>;
using l_sortable_plugin_t = QList<sortable_plugin_t>;
using l_ladspa_key_t = QList<ladspa_key_t>;
/* LadspaManager provides a database of LADSPA plug-ins. Upon instantiation,
it loads all of the plug-ins found in the LADSPA_PATH environmental variable
and stores their access descriptors according in a dictionary keyed on
the filename the plug-in was loaded from and the label of the plug-in.
The can be retrieved by using ladspa_key_t. For example, to get the
"Phase Modulated Voice" plug-in from the cmt library, you would perform the
calls using:
ladspa_key_t key( "cmt.so", "phasemod" )
as the plug-in key. */
enum class LadspaPluginType
{
Source,
Transfer,
Valid,
Invalid,
Sink,
Other
};
struct LadspaManagerDescription
{
LADSPA_Descriptor_Function descriptorFunction;
uint32_t index;
LadspaPluginType type;
uint16_t inputChannels;
uint16_t outputChannels;
};
class LMMS_EXPORT LadspaManager
{
public:
LadspaManager();
virtual ~LadspaManager();
l_sortable_plugin_t getSortedPlugins();
LadspaManagerDescription * getDescription( const ladspa_key_t &
_plugin );
/* This identifier can be used as a unique, case-sensitive
identifier for the plugin type within the plugin file. Plugin
types should be identified by file and label rather than by index
or plugin name, which may be changed in new plugin
versions. Labels must not contain white-space characters. */
QString getLabel( const ladspa_key_t & _plugin );
/* Indicates that the plugin has a real-time dependency
(e.g. listens to a MIDI device) and so its output must not
be cached or subject to significant latency. */
bool hasRealTimeDependency( const ladspa_key_t & _plugin );
/* Indicates that the plugin may cease to work correctly if the
host elects to use the same data location for both input and output
(see connectPort). */
bool isInplaceBroken( const ladspa_key_t & _plugin );
/* Indicates that the plugin is capable of running not only in a
conventional host but also in a 'hard real-time' environment. */
bool isRealTimeCapable( const ladspa_key_t & _plugin );
/* Returns the name of the plug-in */
QString getName( const ladspa_key_t & _plugin );
/* Returns the the plug-in's author */
QString getMaker( const ladspa_key_t & _plugin );
/* Returns the copyright for the plug-in */
QString getCopyright( const ladspa_key_t & _plugin );
/* This indicates the number of ports (input AND output) present on
the plugin. */
uint32_t getPortCount( const ladspa_key_t & _plugin );
/* Indicates that the port is an input. */
bool isPortInput( const ladspa_key_t & _plugin, uint32_t _port );
/* Indicates that the port is an output. */
bool isPortOutput( const ladspa_key_t & _plugin, uint32_t _port );
/* Indicates that the port is an audio. */
bool isPortAudio( const ladspa_key_t & _plugin, uint32_t _port );
/* Indicates that the port is an control. */
bool isPortControl( const ladspa_key_t & _plugin, uint32_t _port );
/* Indicates that any bounds specified should be interpreted as
multiples of the sample rate. For instance, a frequency range from
0Hz to the Nyquist frequency (half the sample rate) could be requested
by this hint in conjunction with LowerBound = 0 and UpperBound = 0.5.
Hosts that support bounds at all must support this hint to retain
meaning. */
bool areHintsSampleRateDependent( const ladspa_key_t & _plugin,
uint32_t _port );
/* Returns the lower boundary value for the given port. If
no lower bound is provided by the plug-in, returns -999e-99. When
areHintsSampleRateDependent() is also true then this value should be
multiplied by the relevant sample rate. */
float getLowerBound( const ladspa_key_t & _plugin, uint32_t _port );
/* Returns the upper boundary value for the given port. If
no upper bound is provided by the plug-in, returns -999e-99. When
areHintsSampleRateDependent() is also true then this value should be
multiplied by the relevant sample rate. */
float getUpperBound( const ladspa_key_t & _plugin, uint32_t _port );
/* Indicates whether the given port should be considered 0 or 1
boolean switch. */
bool isPortToggled( const ladspa_key_t & _plugin, uint32_t _port );
/* Retrieves any default setting hints offered by the plug-in for
the given port. */
float getDefaultSetting( const ladspa_key_t & _plugin, uint32_t _port );
/* Indicates that it is likely that the user will find it more
intuitive to view values using a logarithmic scale. This is
particularly useful for frequencies and gains. */
bool isLogarithmic( const ladspa_key_t & _plugin, uint32_t _port );
/* Indicates that a user interface would probably wish to provide a
stepped control taking only integer values. Any bounds set should be
slightly wider than the actual integer range required to avoid floating
point rounding errors. For instance, the integer set {0,1,2,3} might
be described as [-0.1, 3.1]. */
bool isInteger( const ladspa_key_t & _plugin, uint32_t _port );
/* Indicates that a user interface would probably wish to provide a
stepped control taking only integer values. This is equal to isInteger,
but the number of values is usually small and may be better depicted
with a combo box. */
bool isEnum( const ladspa_key_t & _plugin, uint32_t _port );
/* Returns the name of the port. */
QString getPortName( const ladspa_key_t & _plugin, uint32_t _port );
/* This may be used by the plugin developer to pass any custom
implementation data into an instantiate call. It must not be used
or interpreted by the host. It is expected that most plugin
writers will not use this facility as LADSPA_Handle should be
used to hold instance data. */
const void * getImplementationData(
const ladspa_key_t & _plugin );
/* Returns a pointer to the plug-in's descriptor from which control
of the plug-in is accessible */
const LADSPA_Descriptor * getDescriptor(
const ladspa_key_t & _plugin );
/* The following methods are convenience functions for use during
development. A real instrument should use the getDescriptor()
method and implement the plug-in manipulations internally to avoid
the overhead associated with QMap lookups. */
/* Returns a handle to an instantiation of the given plug-in. */
LADSPA_Handle instantiate( const ladspa_key_t & _plugin,
uint32_t _sample_rate );
/* This method calls a function pointer that connects a port on an
instantiated plugin to a memory location at which a block of data
for the port will be read/written. The data location is expected
to be an array of LADSPA_Data for audio ports or a single
LADSPA_Data value for control ports. Memory issues will be
managed by the host. The plugin must read/write the data at these
locations every time run() or runAdding() is called and the data
present at the time of this connection call should not be
considered meaningful.
connectPort() may be called more than once for a plugin instance
to allow the host to change the buffers that the plugin is
reading or writing. These calls may be made before or after
activate() or deactivate() calls.
connectPort() must be called at least once for each port before
run() or runAdding() is called. */
bool connectPort( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
uint32_t _port,
LADSPA_Data * _data_location );
/* This method calls a function pointer that initialises a plugin
instance and activates it for use. This is separated from
instantiate() to aid real-time support and so that hosts can
reinitialise a plugin instance by calling deactivate() and then
activate(). In this case the plugin instance must reset all state
information dependent on the history of the plugin instance
except for any data locations provided by connectPort() and any
gain set by setRunAddingGain(). If there is nothing for
activate() to do then the plugin writer may provide a NULL rather
than an empty function.
When present, hosts must call this function once before run() (or
runAdding()) is called for the first time. This call should be
made as close to the run() call as possible and indicates to
real-time plugins that they are now live. Plugins should not rely
on a prompt call to run() after activate(). activate() may not be
called again unless deactivate() is called first. Note that
connectPort() may be called before or after a call to
activate(). */
bool activate( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
/* This method calls a function pointer that runs an instance of a
plugin for a block. Two parameters are required: the first is a
handle to the particular instance to be run and the second
indicates the block size (in samples) for which the plugin
instance may run.
Note that if an activate() function exists then it must be called
before run() or run_adding(). If deactivate() is called for a
plugin instance then the plugin instance may not be reused until
activate() has been called again. */
bool run( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
uint32_t _sample_count );
/* This method calls a function pointer that runs an instance of a
plugin for a block. This has identical behaviour to run() except
in the way data is output from the plugin. When run() is used,
values are written directly to the memory areas associated with
the output ports. However when runAdding() is called, values
must be added to the values already present in the memory
areas. Furthermore, output values written must be scaled by the
current gain set by setRunAddingGain() (see below) before
addition.
runAdding() is optional. When it is not provided by a plugin,
this function pointer must be set to NULL. When it is provided,
the function setRunAddingGain() must be provided also. */
bool runAdding( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
uint32_t _sample_count );
/* This method calls a function pointer that sets the output gain for
use when runAdding() is called (see above). If this function is
never called the gain is assumed to default to 1. Gain
information should be retained when activate() or deactivate()
are called.
This function should be provided by the plugin if and only if the
runAdding() function is provided. When it is absent this
function pointer must be set to NULL. */
bool setRunAddingGain( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
LADSPA_Data _gain );
/* This is the counterpart to activate() (see above). If there is
nothing for deactivate() to do then the plugin writer may provide
a NULL rather than an empty function.
Hosts must deactivate all activated units after they have been
run() (or run_adding()) for the last time. This call should be
made as close to the last run() call as possible and indicates to
real-time plugins that they are no longer live. Plugins should
not rely on prompt deactivation. Note that connect_port() may be
called before or after a call to deactivate().
Deactivation is not similar to pausing as the plugin instance
will be reinitialised when activate() is called to reuse it. */
bool deactivate( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
/* Once an instance of a plugin has been finished with it can be
deleted using the following function. The instance handle passed
ceases to be valid after this call.
If activate() was called for a plugin instance then a
corresponding call to deactivate() must be made before cleanup()
is called. */
bool cleanup( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
private:
void addPlugins( LADSPA_Descriptor_Function _descriptor_func,
const QString & _file );
uint16_t getPluginInputs( const LADSPA_Descriptor * _descriptor );
uint16_t getPluginOutputs( const LADSPA_Descriptor * _descriptor );
const LADSPA_PortDescriptor* getPortDescriptor( const ladspa_key_t& _plugin,
uint32_t _port );
const LADSPA_PortRangeHint* getPortRangeHint( const ladspa_key_t& _plugin,
uint32_t _port );
using LadspaManagerMapType = QMap<ladspa_key_t, LadspaManagerDescription*>;
LadspaManagerMapType m_ladspaManagerMap;
l_sortable_plugin_t m_sortedPlugins;
} ;
} // namespace lmms
#endif // LMMS_LADSPA_MANAGER_H
| 13,712
|
C++
|
.h
| 281
| 46.234875
| 77
| 0.76018
|
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,454
|
SubWindow.h
|
LMMS_lmms/include/SubWindow.h
|
/*
* SubWindow.h - Implementation of QMdiSubWindow that correctly tracks
* the geometry that windows should be restored to.
* Workaround for https://bugreports.qt.io/browse/QTBUG-256
*
* Copyright (c) 2015 Colin Wallace <wallace.colin.a@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_SUBWINDOW_H
#define LMMS_GUI_SUBWINDOW_H
#include <QMdiSubWindow>
#include <QString>
#include "lmms_export.h"
class QGraphicsDropShadowEffect;
class QLabel;
class QMoveEvent;
class QPushButton;
class QResizeEvent;
class QWidget;
namespace lmms::gui
{
/**
* @brief The SubWindow class
*
* Because of a bug in the QMdiSubWindow class to save the right position and size
* of a subwindow in a project and because of the inability
* for cusomizing the title bar appearance, lmms implements its own subwindow
* class.
*/
class LMMS_EXPORT SubWindow : public QMdiSubWindow
{
Q_OBJECT
Q_PROPERTY( QBrush activeColor READ activeColor WRITE setActiveColor )
Q_PROPERTY( QColor textShadowColor READ textShadowColor WRITE setTextShadowColor )
Q_PROPERTY( QColor borderColor READ borderColor WRITE setBorderColor )
public:
SubWindow( QWidget *parent = nullptr, Qt::WindowFlags windowFlags = QFlag(0) );
// same as QWidet::normalGeometry, but works properly under X11 (see https://bugreports.qt.io/browse/QTBUG-256)
QRect getTrueNormalGeometry() const;
QBrush activeColor() const;
QColor textShadowColor() const;
QColor borderColor() const;
void setActiveColor( const QBrush & b );
void setTextShadowColor( const QColor &c );
void setBorderColor( const QColor &c );
int titleBarHeight() const;
int frameWidth() const;
protected:
// hook the QWidget move/resize events to update the tracked geometry
void moveEvent( QMoveEvent * event ) override;
void resizeEvent( QResizeEvent * event ) override;
void paintEvent( QPaintEvent * pe ) override;
void changeEvent( QEvent * event ) override;
QPushButton* addTitleButton(const std::string& iconName, const QString& toolTip);
signals:
void focusLost();
private:
const QSize m_buttonSize;
const int m_titleBarHeight;
QPushButton * m_closeBtn;
QPushButton * m_maximizeBtn;
QPushButton * m_restoreBtn;
QBrush m_activeColor;
QColor m_textShadowColor;
QColor m_borderColor;
QPoint m_position;
QRect m_trackedNormalGeom;
QLabel * m_windowTitle;
QGraphicsDropShadowEffect * m_shadow;
bool m_hasFocus;
static void elideText( QLabel *label, QString text );
void adjustTitleBar();
private slots:
void focusChanged( QMdiSubWindow * subWindow );
};
} // namespace lmms::gui
#endif // LMMS_GUI_SUBWINDOW_H
| 3,360
|
C++
|
.h
| 94
| 33.808511
| 112
| 0.781096
|
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,455
|
panning.h
|
LMMS_lmms/include/panning.h
|
/*
* panning.h - declaration of some types, concerning the
* panning of a note
*
* 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_PANNING_H
#define LMMS_PANNING_H
#include "lmms_basics.h"
#include "panning_constants.h"
#include "Midi.h"
#include "volume.h"
#include <cmath>
namespace lmms
{
inline StereoVolumeVector panningToVolumeVector( panning_t _p,
float _scale = 1.0f )
{
StereoVolumeVector v = { { _scale, _scale } };
const float pf = _p / 100.0f;
v.vol[_p >= PanningCenter ? 0 : 1] *= 1.0f - std::abs(pf);
return v;
}
inline int panningToMidi( panning_t _p )
{
return MidiMinPanning + (int) (
( (float)( _p - PanningLeft ) ) /
( (float)( PanningRight - PanningLeft ) ) *
( (float)( MidiMaxPanning - MidiMinPanning ) ) );
}
} // namespace lmms
#endif // LMMS_PANNING_H
| 1,665
|
C++
|
.h
| 50
| 31.08
| 77
| 0.713217
|
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,456
|
PatternEditor.h
|
LMMS_lmms/include/PatternEditor.h
|
/*
* PatternEditor.h - basic main-window for editing patterns
*
* 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_EDITOR_H
#define LMMS_GUI_PATTERN_EDITOR_H
#include "Editor.h"
#include "TrackContainerView.h"
namespace lmms
{
class PatternStore;
namespace gui
{
class ComboBox;
class PatternEditor : public TrackContainerView
{
Q_OBJECT
public:
PatternEditor(PatternStore* ps);
bool fixedClips() const override
{
return true;
}
void removeViewsForPattern(int pattern);
void saveSettings(QDomDocument& doc, QDomElement& element) override;
void loadSettings(const QDomElement& element) override;
public slots:
void addSteps();
void cloneSteps();
void removeSteps();
void addSampleTrack();
void addAutomationTrack();
void cloneClip();
protected slots:
void dropEvent(QDropEvent * de ) override;
void updatePosition();
private:
PatternStore* m_ps;
void makeSteps( bool clone );
};
class PatternEditorWindow : public Editor
{
Q_OBJECT
public:
PatternEditorWindow(PatternStore* ps);
~PatternEditorWindow() = default;
QSize sizeHint() const override;
PatternEditor* m_editor;
public slots:
void play() override;
void stop() override;
private:
ComboBox* m_patternComboBox;
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_PATTERN_EDITOR_H
| 2,144
|
C++
|
.h
| 76
| 26.236842
| 77
| 0.778376
|
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,457
|
ExportProjectDialog.h
|
LMMS_lmms/include/ExportProjectDialog.h
|
/*
* ExportProjectDialog.h - declaration of class ExportProjectDialog which is
* responsible for exporting project
*
* Copyright (c) 2004-2012 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_EXPORT_PROJECT_DIALOG_H
#define LMMS_GUI_EXPORT_PROJECT_DIALOG_H
#include <QDialog>
#include <memory>
#include "ui_export_project.h"
#include "ProjectRenderer.h"
#include "RenderManager.h"
namespace lmms::gui
{
class ExportProjectDialog : public QDialog, public Ui::ExportProjectDialog
{
Q_OBJECT
public:
ExportProjectDialog( const QString & _file_name, QWidget * _parent, bool multi_export );
protected:
void reject() override;
void closeEvent( QCloseEvent * _ce ) override;
private slots:
void startBtnClicked();
void updateTitleBar( int );
void accept() override;
void startExport();
void onFileFormatChanged(int);
private:
QString m_fileName;
QString m_dirName;
QString m_fileExtension;
bool m_multiExport;
ProjectRenderer::ExportFileFormat m_ft;
std::unique_ptr<RenderManager> m_renderManager;
} ;
} // namespace lmms::gui
#endif // LMMS_GUI_EXPORT_PROJECT_DIALOG_H
| 1,936
|
C++
|
.h
| 57
| 32.035088
| 89
| 0.765558
|
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,458
|
PatternTrack.h
|
LMMS_lmms/include/PatternTrack.h
|
/*
* PatternTrack.h - a track representing a pattern in the PatternStore
*
* 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_TRACK_H
#define LMMS_PATTERN_TRACK_H
#include <QMap>
#include "Track.h"
namespace lmms
{
class TrackContainer;
namespace gui
{
class TrackLabelButton;
class PatternTrackView;
} // namespace gui
/*! Track type used in the Song (Editor) to reference a pattern in the PatternStore */
class LMMS_EXPORT PatternTrack : public Track
{
Q_OBJECT
public:
PatternTrack(TrackContainer* tc);
~PatternTrack() override;
bool play( const TimePos & _start, const fpp_t _frames,
const f_cnt_t _frame_base, int _clip_num = -1 ) override;
gui::TrackView * createView( gui::TrackContainerView* tcv ) override;
Clip* createClip(const TimePos & pos) override;
void saveTrackSpecificSettings(QDomDocument& doc, QDomElement& parent, bool presetMode) override;
void loadTrackSpecificSettings( const QDomElement & _this ) override;
static PatternTrack* findPatternTrack(int pattern_num);
static void swapPatternTracks(Track* track1, Track* track2);
int patternIndex()
{
return s_infoMap[this];
}
bool automationDisabled( Track * _track )
{
return( m_disabledTracks.contains( _track ) );
}
void disableAutomation( Track * _track )
{
m_disabledTracks.append( _track );
}
void enableAutomation( Track * _track )
{
m_disabledTracks.removeAll( _track );
}
protected:
inline QString nodeName() const override
{
return "patterntrack";
}
private:
QList<Track *> m_disabledTracks;
using infoMap = QMap<PatternTrack*, int>;
static infoMap s_infoMap;
friend class gui::PatternTrackView;
} ;
} // namespace lmms
#endif // LMMS_PATTERN_TRACK_H
| 2,545
|
C++
|
.h
| 79
| 30.050633
| 98
| 0.762392
|
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,459
|
InstrumentTuningView.h
|
LMMS_lmms/include/InstrumentTuningView.h
|
/*
* InstrumentTuningView.h - widget in instrument-track-window for setting up
* tuning and transposition options
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2020-2022 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_INSTRUMENT_TUNING_VIEW_H
#define LMMS_GUI_INSTRUMENT_TUNING_VIEW_H
#include <QWidget>
class QLabel;
namespace lmms
{
class InstrumentTrack;
namespace gui
{
class ComboBox;
class GroupBox;
class LedCheckBox;
class InstrumentTuningView : public QWidget
{
Q_OBJECT
public:
InstrumentTuningView(InstrumentTrack *it, QWidget *parent);
GroupBox *pitchGroupBox() {return m_pitchGroupBox;}
GroupBox *microtunerGroupBox() {return m_microtunerGroupBox;}
QLabel *microtunerNotSupportedLabel() {return m_microtunerNotSupportedLabel;}
ComboBox *scaleCombo() {return m_scaleCombo;}
ComboBox *keymapCombo() {return m_keymapCombo;}
LedCheckBox *rangeImportCheckbox() {return m_rangeImportCheckbox;}
private:
GroupBox *m_pitchGroupBox;
GroupBox *m_microtunerGroupBox;
QLabel *m_microtunerNotSupportedLabel;
ComboBox *m_scaleCombo;
ComboBox *m_keymapCombo;
LedCheckBox *m_rangeImportCheckbox;
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_INSTRUMENT_TUNING_VIEW_H
| 2,094
|
C++
|
.h
| 59
| 33.491525
| 78
| 0.77855
|
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.