Merge branch 'master' into feature/recording-stage-one

This commit is contained in:
Hyunjin Song
2022-03-26 11:45:01 +09:00
committed by GitHub
468 changed files with 4014 additions and 3625 deletions

View File

@@ -25,7 +25,7 @@
#ifndef AUDIO_DEVICE_H
#define AUDIO_DEVICE_H
#include <QtCore/QMutex>
#include <QMutex>
#include <samplerate.h>
#include "lmms_basics.h"

View File

@@ -25,16 +25,15 @@
#ifndef AUDIO_ENGINE_H
#define AUDIO_ENGINE_H
#include <QtCore/QMutex>
#include <QtCore/QThread>
#include <QtCore/QVector>
#include <QtCore/QWaitCondition>
#include <QMutex>
#include <QThread>
#include <QVector>
#include <QWaitCondition>
#include <samplerate.h>
#include "lmms_basics.h"
#include "LocklessList.h"
#include "Note.h"
#include "FifoBuffer.h"
#include "AudioEngineProfiler.h"
#include "PlayHandle.h"

View File

@@ -25,7 +25,7 @@
#ifndef AUDIO_ENGINE_WORKER_THREAD_H
#define AUDIO_ENGINE_WORKER_THREAD_H
#include <QtCore/QThread>
#include <QThread>
#include <atomic>

View File

@@ -26,7 +26,7 @@
#ifndef AUDIO_FILE_DEVICE_H
#define AUDIO_FILE_DEVICE_H
#include <QtCore/QFile>
#include <QFile>
#include "AudioDevice.h"
#include "OutputSettings.h"

View File

@@ -35,9 +35,7 @@
#endif
#include <atomic>
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QVector>
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"

View File

@@ -26,9 +26,8 @@
#define AUDIO_PORT_H
#include <memory>
#include <QtCore/QString>
#include <QtCore/QMutex>
#include <QtCore/QMutexLocker>
#include <QString>
#include <QMutex>
#include "MemoryManager.h"
#include "PlayHandle.h"

View File

@@ -25,7 +25,7 @@
#ifndef AUDIO_PORTAUDIO_H
#define AUDIO_PORTAUDIO_H
#include <QtCore/QObject>
#include <QObject>
#include "lmmsconfig.h"
#include "ComboBoxModel.h"
@@ -48,7 +48,6 @@ public:
#include <portaudio.h>
#include <QtCore/QSemaphore>
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"

View File

@@ -26,8 +26,8 @@
#ifndef AUDIO_SAMPLE_RECORDER_H
#define AUDIO_SAMPLE_RECORDER_H
#include <QtCore/QList>
#include <QtCore/QPair>
#include <QList>
#include <QPair>
#include "AudioDevice.h"

View File

@@ -30,7 +30,6 @@
#ifdef LMMS_HAVE_SDL
#ifdef LMMS_HAVE_SDL2
#include <SDL2/SDL.h>
#include <SDL2/SDL_audio.h>
#else
#include <SDL/SDL.h>

View File

@@ -25,7 +25,7 @@
#ifndef AUDIO_SOUNDIO_H
#define AUDIO_SOUNDIO_H
#include <QtCore/QObject>
#include <QObject>
#include "lmmsconfig.h"
#include "ComboBoxModel.h"

View File

@@ -25,8 +25,8 @@
#ifndef AUTOMATABLE_MODEL_H
#define AUTOMATABLE_MODEL_H
#include <QtCore/QMap>
#include <QtCore/QMutex>
#include <QMap>
#include <QMutex>
#include "JournallingObject.h"
#include "Model.h"

View File

@@ -27,8 +27,8 @@
#ifndef AUTOMATION_CLIP_H
#define AUTOMATION_CLIP_H
#include <QtCore/QMap>
#include <QtCore/QPointer>
#include <QMap>
#include <QPointer>
#include "AutomationNode.h"
#include "Clip.h"
@@ -149,7 +149,7 @@ public:
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
static const QString classNodeName() { return "automationpattern"; }
static const QString classNodeName() { return "automationclip"; }
QString nodeName() const override { return classNodeName(); }
ClipView * createView( TrackView * _tv ) override;

View File

@@ -27,11 +27,10 @@
#include <QStaticText>
#include "AutomationClip.h"
#include "Song.h"
#include "SongEditor.h"
#include "ClipView.h"
class AutomationClip;
class AutomationClipView : public ClipView
{

View File

@@ -26,7 +26,6 @@
#ifndef AUTOMATION_EDITOR_H
#define AUTOMATION_EDITOR_H
#include <QVector>
#include <QWidget>
#include "Editor.h"
@@ -36,13 +35,13 @@
#include "TimePos.h"
#include "AutomationClip.h"
#include "ComboBoxModel.h"
#include "Knob.h"
class QPainter;
class QPixmap;
class QScrollBar;
class ComboBox;
class Knob;
class NotePlayHandle;
class TimeLineWidget;
@@ -218,7 +217,7 @@ private:
void drawCross(QPainter & p );
void drawAutomationPoint( QPainter & p, timeMap::iterator it );
bool inBBEditor();
bool inPatternEditor();
QColor m_barLineColor;
QColor m_beatLineColor;

View File

@@ -26,9 +26,10 @@
#ifndef AUTOMATION_TRACK_VIEW_H
#define AUTOMATION_TRACK_VIEW_H
#include "AutomationTrack.h"
#include "TrackView.h"
class AutomationTrack;
class AutomationTrackView : public TrackView
{

View File

@@ -1,82 +0,0 @@
/*
* BBTrackContainer.h - model-component of BB-Editor
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef BB_TRACK_CONTAINER_H
#define BB_TRACK_CONTAINER_H
#include "TrackContainer.h"
#include "ComboBoxModel.h"
class LMMS_EXPORT BBTrackContainer : public TrackContainer
{
Q_OBJECT
mapPropertyFromModel(int,currentBB,setCurrentBB,m_bbComboBoxModel);
public:
BBTrackContainer();
virtual ~BBTrackContainer();
virtual bool play(TimePos start, const fpp_t frames, const f_cnt_t frameBase, int clipNum = -1);
void updateAfterTrackAdd() override;
inline QString nodeName() const override
{
return "bbtrackcontainer";
}
bar_t lengthOfBB(int bb) const;
inline bar_t lengthOfCurrentBB()
{
return lengthOfBB(currentBB());
}
int numOfBBs() const;
void removeBB(int bb);
void swapBB(int bb1, int bb2);
void updateBBTrack(Clip * clip);
void fixIncorrectPositions();
void createClipsForBB(int bb);
AutomatedValueMap automatedValuesAt(TimePos time, int clipNum) const override;
public slots:
void play();
void stop();
void updateComboBox();
void currentBBChanged();
private:
ComboBoxModel m_bbComboBoxModel;
friend class BBEditor;
} ;
#endif

View File

@@ -36,7 +36,7 @@
#define __USE_XOPEN
#endif
#include <math.h>
#include <cmath>
#include "lmms_basics.h"
#include "lmms_constants.h"

View File

@@ -27,7 +27,7 @@
#ifndef CPULOAD_WIDGET_H
#define CPULOAD_WIDGET_H
#include <QtCore/QTimer>
#include <QTimer>
#include <QPixmap>
#include <QWidget>

View File

@@ -28,7 +28,6 @@
#include <QColor>
#include "AutomatableModel.h"
#include "lmms_basics.h"
class Track;

View File

@@ -26,7 +26,7 @@
#define TRACK_CONTENT_OBJECT_VIEW_H
#include <QtCore/QVector>
#include <QVector>
#include "ModelView.h"
#include "Rubberband.h"
@@ -53,7 +53,7 @@ class ClipView : public selectableObject, public ModelView
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
Q_PROPERTY( QColor textBackgroundColor READ textBackgroundColor WRITE setTextBackgroundColor )
Q_PROPERTY( QColor textShadowColor READ textShadowColor WRITE setTextShadowColor )
Q_PROPERTY( QColor BBClipBackground READ BBClipBackground WRITE setBBClipBackground )
Q_PROPERTY( QColor patternClipBackground READ patternClipBackground WRITE setPatternClipBackground )
Q_PROPERTY( bool gradient READ gradient WRITE setGradient )
// We have to use a QSize here because using QPoint isn't supported.
// width -> x, height -> y
@@ -61,6 +61,8 @@ class ClipView : public selectableObject, public ModelView
Q_PROPERTY( QSize mouseHotspotKnife MEMBER m_mouseHotspotKnife )
public:
const static int BORDER_WIDTH = 2;
ClipView( Clip * clip, TrackView * tv );
virtual ~ClipView();
@@ -83,7 +85,7 @@ public:
QColor textColor() const;
QColor textBackgroundColor() const;
QColor textShadowColor() const;
QColor BBClipBackground() const;
QColor patternClipBackground() const;
bool gradient() const;
void setMutedColor( const QColor & c );
void setMutedBackgroundColor( const QColor & c );
@@ -91,7 +93,7 @@ public:
void setTextColor( const QColor & c );
void setTextBackgroundColor( const QColor & c );
void setTextShadowColor( const QColor & c );
void setBBClipBackground( const QColor & c );
void setPatternClipBackground(const QColor& c);
void setGradient( const bool & b );
// access needsUpdate member variable
@@ -211,7 +213,7 @@ private:
QColor m_textColor;
QColor m_textBackgroundColor;
QColor m_textShadowColor;
QColor m_BBClipBackground;
QColor m_patternClipBackground;
bool m_gradient;
QSize m_mouseHotspotHand; // QSize must be used because QPoint
QSize m_mouseHotspotKnife; // isn't supported by property system

View File

@@ -25,7 +25,7 @@
#ifndef CLIPBOARD_H
#define CLIPBOARD_H
#include <QtCore/QMap>
#include <QMap>
#include <QDomElement>
class QMimeData;

View File

@@ -25,7 +25,6 @@
#ifndef COMBOBOX_MODEL_H
#define COMBOBOX_MODEL_H
#include <cassert>
#include <memory>
#include <utility>
#include <vector>

View File

@@ -28,11 +28,11 @@
#include "lmmsconfig.h"
#include <QtCore/QMap>
#include <QtCore/QPair>
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtCore/QObject>
#include <QMap>
#include <QPair>
#include <QStringList>
#include <QVector>
#include <QObject>
#include "lmms_export.h"

View File

@@ -30,8 +30,8 @@
#ifndef CONTROLLER_CONNECTION_H
#define CONTROLLER_CONNECTION_H
#include <QtCore/QObject>
#include <QtCore/QVector>
#include <QObject>
#include <QVector>
#include "Controller.h"
#include "JournallingObject.h"

View File

@@ -26,7 +26,6 @@
#define CONTROLS_H
#include "Model.h"
// headers only required for covariance
#include "AutomatableModel.h"

View File

@@ -32,8 +32,8 @@
#include "lmms_export.h"
#include "MemoryManager.h"
#include "ProjectVersion.h"
class ProjectVersion;
class QTextStream;
class LMMS_EXPORT DataFile : public QDomDocument
@@ -123,6 +123,7 @@ private:
void upgrade_extendedNoteRange();
void upgrade_defaultTripleOscillatorHQ();
void upgrade_mixerRename();
void upgrade_bbTcoRename();
// List of all upgrade methods
static const std::vector<UpgradeMethod> UPGRADE_METHODS;

View File

@@ -25,10 +25,14 @@
#ifndef DUMMY_EFFECT_H
#define DUMMY_EFFECT_H
#include <QDomElement>
#include "Effect.h"
#include "EffectControls.h"
#include "EffectControlDialog.h"
class Knob;
class DummyEffectControlDialog : public EffectControlDialog
{

View File

@@ -30,7 +30,7 @@
#include "InstrumentView.h"
#include "Engine.h"
#include <string.h>
#include <cstring>
#include "AudioEngine.h"

View File

@@ -29,7 +29,6 @@
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include "EffectChain.h"
#include "Effect.h"

View File

@@ -26,8 +26,8 @@
#ifndef ENGINE_H
#define ENGINE_H
#include <QtCore/QString>
#include <QtCore/QObject>
#include <QString>
#include <QObject>
#include "lmmsconfig.h"
@@ -35,8 +35,8 @@
#include "lmms_basics.h"
class AudioEngine;
class BBTrackContainer;
class Mixer;
class PatternStore;
class ProjectJournal;
class Song;
class Ladspa2LMMS;
@@ -77,9 +77,9 @@ public:
return s_song;
}
static BBTrackContainer * getBBTrackContainer()
static PatternStore * patternStore()
{
return s_bbTrackContainer;
return s_patternStore;
}
static ProjectJournal * projectJournal()
@@ -143,7 +143,7 @@ private:
static AudioEngine *s_audioEngine;
static Mixer * s_mixer;
static Song * s_song;
static BBTrackContainer * s_bbTrackContainer;
static PatternStore * s_patternStore;
static ProjectJournal * s_projectJournal;
#ifdef LMMS_HAVE_LV2

View File

@@ -25,7 +25,7 @@
#ifndef ENVELOPE_AND_LFO_PARAMETERS_H
#define ENVELOPE_AND_LFO_PARAMETERS_H
#include <QtCore/QVector>
#include <QVector>
#include "JournallingObject.h"
#include "AutomatableModel.h"

View File

@@ -26,7 +26,7 @@
#ifndef EXPORT_FILTER_H
#define EXPORT_FILTER_H
#include <QtCore/QFile>
#include <QFile>
#include "TrackContainer.h"
#include "Plugin.h"
@@ -40,7 +40,7 @@ public:
virtual bool tryExport(const TrackContainer::TrackList &tracks,
const TrackContainer::TrackList &tracksBB,
const TrackContainer::TrackList &patternTracks,
int tempo, int masterPitch, const QString &filename ) = 0;
protected:

View File

@@ -25,7 +25,7 @@
#ifndef FIFO_BUFFER_H
#define FIFO_BUFFER_H
#include <QtCore/QSemaphore>
#include <QSemaphore>
template<typename T>

View File

@@ -27,8 +27,8 @@
#define FILE_BROWSER_H
#include <QCheckBox>
#include <QtCore/QDir>
#include <QtCore/QMutex>
#include <QDir>
#include <QMutex>
#include <QTreeWidget>

View File

@@ -25,7 +25,7 @@
#ifndef GUIAPPLICATION_H
#define GUIAPPLICATION_H
#include <QtCore/QObject>
#include <QObject>
#include "lmms_export.h"
#include "lmmsconfig.h"
@@ -33,11 +33,11 @@
class QLabel;
class AutomationEditorWindow;
class BBEditor;
class ControllerRackView;
class MixerView;
class MainWindow;
class MicrotunerConfig;
class PatternEditorWindow;
class PianoRollWindow;
class ProjectNotes;
class SongEditorWindow;
@@ -57,7 +57,7 @@ public:
MainWindow* mainWindow() { return m_mainWindow; }
MixerView* mixerView() { return m_mixerView; }
SongEditorWindow* songEditor() { return m_songEditor; }
BBEditor* getBBEditor() { return m_bbEditor; }
PatternEditorWindow* patternEditor() { return m_patternEditor; }
PianoRollWindow* pianoRoll() { return m_pianoRoll; }
ProjectNotes* getProjectNotes() { return m_projectNotes; }
MicrotunerConfig* getMicrotunerConfig() { return m_microtunerConfig; }
@@ -77,7 +77,7 @@ private:
MixerView* m_mixerView;
SongEditorWindow* m_songEditor;
AutomationEditorWindow* m_automationEditor;
BBEditor* m_bbEditor;
PatternEditorWindow* m_patternEditor;
PianoRollWindow* m_pianoRoll;
ProjectNotes* m_projectNotes;
MicrotunerConfig* m_microtunerConfig;

View File

@@ -26,7 +26,7 @@
#ifndef IMPORT_FILTER_H
#define IMPORT_FILTER_H
#include <QtCore/QFile>
#include <QFile>
#include "Plugin.h"

View File

@@ -35,10 +35,8 @@
#include "MidiPort.h"
#include "NotePlayHandle.h"
#include "Piano.h"
#include "Pitch.h"
#include "Plugin.h"
#include "Track.h"
#include "TrackView.h"
class Instrument;

View File

@@ -28,11 +28,11 @@
#include "TrackView.h"
#include "InstrumentTrack.h"
#include "MidiCCRackView.h"
class InstrumentTrackWindow;
class Knob;
class MidiCCRackView;
class TrackContainerView;
class TrackLabelButton;

View File

@@ -25,7 +25,7 @@
#ifndef JOURNALLING_OBJECT_H
#define JOURNALLING_OBJECT_H
#include <QtCore/QStack>
#include <QStack>
#include "lmms_basics.h"
#include "SerializingObject.h"

View File

@@ -29,7 +29,6 @@
#include <QObject>
#include <QString>
#include "Note.h"
#include "SerializingObject.h"
class Keymap : public QObject, public SerializingObject

View File

@@ -29,7 +29,7 @@
#include <memory>
#include <QPixmap>
#include <QWidget>
#include <QtCore/QPoint>
#include <QPoint>
#include <QTextDocument>
#include "AutomatableModelView.h"

View File

@@ -30,10 +30,10 @@
#include <ladspa.h>
#include <QtCore/QMap>
#include <QtCore/QPair>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QMap>
#include <QPair>
#include <QString>
#include <QStringList>
#include "lmms_export.h"

View File

@@ -26,7 +26,7 @@
#ifndef LCD_WIDGET_H
#define LCD_WIDGET_H
#include <QtCore/QMap>
#include <QMap>
#include <QWidget>
#include "lmms_export.h"

View File

@@ -27,7 +27,6 @@
#include "PixmapButton.h"
#include <QLayout>
class LeftRightNav : public QWidget
{

View File

@@ -28,7 +28,6 @@
#include <cstddef>
#include <memory>
#include <vector>
#include <QWidget>

View File

@@ -27,8 +27,6 @@
#include <cstddef>
#include <memory>
#include <vector>
#include "Model.h"

View File

@@ -26,7 +26,7 @@
#define LOCKLESS_ALLOCATOR_H
#include <atomic>
#include <stddef.h>
#include <cstddef>
class LocklessAllocator
{

View File

@@ -30,6 +30,7 @@
#ifdef LMMS_HAVE_LV2
#include <lilv/lilv.h>
#include <memory>
#include "DataFile.h"
#include "LinkedModelGroups.h"

View File

@@ -29,7 +29,6 @@
#ifdef LMMS_HAVE_LV2
#include <lv2.h>
#include <map>
#include <vector>
#include "Lv2Manager.h"

View File

@@ -31,18 +31,17 @@
#include <lilv/lilv.h>
#include <memory>
#include <QObject>
#include "Lv2Basics.h"
#include "Lv2Features.h"
#include "Lv2Options.h"
#include "LinkedModelGroups.h"
#include "MidiEvent.h"
#include "Plugin.h"
#include "PluginIssue.h"
#include "../src/3rdparty/ringbuffer/include/ringbuffer/ringbuffer.h"
#include "TimePos.h"
class PluginIssue;
// forward declare port structs/enums
namespace Lv2Ports
{

View File

@@ -29,7 +29,6 @@
#ifdef LMMS_HAVE_LV2
#include <QtGlobal>
#include <cstdint>
//! Cached URIDs for fast access (for use in real-time code)

View File

@@ -30,8 +30,6 @@
#ifdef LMMS_HAVE_LV2
#include <QString>
#include <QVector>
#include "LinkedModelGroupViews.h"
#include "lmms_export.h"

View File

@@ -25,13 +25,12 @@
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#include <QtCore/QBasicTimer>
#include <QtCore/QTimer>
#include <QtCore/QList>
#include <QBasicTimer>
#include <QTimer>
#include <QList>
#include <QMainWindow>
#include "ConfigManager.h"
#include "SubWindow.h"
class QAction;
class QDomElement;
@@ -40,6 +39,7 @@ class QMdiArea;
class ConfigManager;
class PluginView;
class SubWindow;
class ToolButton;
@@ -149,7 +149,7 @@ public slots:
void aboutLMMS();
void help();
void toggleAutomationEditorWin();
void toggleBBEditorWin( bool forceShow = false );
void togglePatternEditorWin(bool forceShow = false);
void toggleSongEditorWin();
void toggleProjectNotesWin();
void toggleMicrotunerWin();

View File

@@ -28,8 +28,6 @@
#include "AutomatableModel.h"
#include "ComboBoxModel.h"
#include "JournallingObject.h"
#include "lmms_constants.h"
#include "Note.h"
class LMMS_EXPORT Microtuner : public Model, public JournallingObject
{

View File

@@ -25,17 +25,16 @@
#ifndef MICROTUNER_CONFIG_H
#define MICROTUNER_CONFIG_H
#include <QCloseEvent>
#include <QLineEdit>
#include <QMainWindow>
#include <QPlainTextEdit>
#include <QWidget>
#include "AutomatableModel.h"
#include "ComboBoxModel.h"
#include "LcdFloatSpinBox.h"
#include "LcdSpinBox.h"
#include "SerializingObject.h"
class QLineEdit;
class QPlainTextEdit;
class LMMS_EXPORT MicrotunerConfig : public QWidget, public SerializingObject
{
Q_OBJECT

View File

@@ -31,7 +31,8 @@
#include <alsa/asoundlib.h>
#include <QtCore/QThread>
#include <QMap>
#include <QThread>
#include "MidiClient.h"

View File

@@ -30,9 +30,10 @@
#ifdef LMMS_HAVE_ALSA
#include <alsa/asoundlib.h>
#include <QtCore/QMutex>
#include <QtCore/QThread>
#include <QtCore/QTimer>
#include <QMap>
#include <QMutex>
#include <QThread>
#include <QTimer>
#include "MidiClient.h"

View File

@@ -3,12 +3,12 @@
#include <QWidget>
#include "GroupBox.h"
#include "Knob.h"
#include "Midi.h"
#include "SerializingObject.h"
class GroupBox;
class InstrumentTrack;
class Knob;
class MidiCCRackView : public QWidget, public SerializingObject
{

View File

@@ -25,16 +25,16 @@
#ifndef MIDI_CLIENT_H
#define MIDI_CLIENT_H
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QStringList>
#include <QVector>
#include "MidiEvent.h"
#include "MidiEventProcessor.h"
#include "TabWidget.h"
class MidiPort;
class QObject;
class TimePos;
// base-class for all MIDI-clients

View File

@@ -26,11 +26,9 @@
#ifndef MIDI_CLIP_H
#define MIDI_CLIP_H
#include <QStaticText>
#include "Clip.h"
#include "Note.h"
#include "MidiClipView.h"
#include "ClipView.h"
class InstrumentTrack;
@@ -91,8 +89,7 @@ public:
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
//TODO: rename to "midiClip"
return "pattern";
return "midiclip";
}
inline InstrumentTrack * instrumentTrack() const
@@ -108,16 +105,16 @@ public:
using Model::dataChanged;
protected:
void updateBBTrack();
protected slots:
public slots:
void addSteps();
void cloneSteps();
void removeSteps();
void clear();
protected:
void updatePatternTrack();
protected slots:
void changeTimeSignature();
@@ -140,7 +137,6 @@ private:
MidiClip * adjacentMidiClipByOffset(int offset) const;
friend class MidiClipView;
friend class BBTrackContainerView;
signals:

View File

@@ -25,7 +25,8 @@
#ifndef MIDI_CLIP_VIEW_H
#define MIDI_CLIP_VIEW_H
#include "MidiClip.h"
#include <QStaticText>
#include "ClipView.h"
class MidiClip;
@@ -93,7 +94,7 @@ private:
QStaticText m_staticTextName;
bool m_legacySEBB;
bool m_legacySEPattern;
} ;

View File

@@ -35,15 +35,13 @@
#include "weak_libjack.h"
#endif
#include <QtCore/QThread>
#include <QMutex>
#include <QtCore/QFile>
#include <QThread>
#include "MidiClient.h"
#include "AudioJack.h"
constexpr size_t JACK_MIDI_BUFFER_MAX = 64; /* events */
class AudioJack;
class QLineEdit;
class MidiJack : public QThread, public MidiClientRaw

View File

@@ -29,8 +29,8 @@
#ifdef LMMS_HAVE_OSS
#include <QtCore/QThread>
#include <QtCore/QFile>
#include <QThread>
#include <QFile>
#include "MidiClient.h"

View File

@@ -26,9 +26,9 @@
#ifndef MIDI_PORT_H
#define MIDI_PORT_H
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QString>
#include <QList>
#include <QMap>
#include "Midi.h"
#include "TimePos.h"

View File

@@ -25,7 +25,6 @@
#ifndef MIDISETUPWIDGET_H
#define MIDISETUPWIDGET_H
#include <QLabel>
#include "TabWidget.h"

View File

@@ -30,10 +30,8 @@
#ifdef LMMS_HAVE_SNDIO
#include <QtCore/QThread>
#include <QtCore/QFile>
#include <QThread>
#include <sndio.h>
#include "MidiClient.h"

View File

@@ -26,18 +26,15 @@
#ifndef MIXER_LINE_H
#define MIXER_LINE_H
#include <QColorDialog>
#include <QGraphicsView>
#include <QLineEdit>
#include <QWidget>
#include "ColorChooser.h"
#include "Knob.h"
#include "LcdWidget.h"
#include "SendButtonIndicator.h"
class QGraphicsView;
class QLineEdit;
class Knob;
class LcdWidget;
class MixerView;
class SendButtonIndicator;

View File

@@ -25,8 +25,8 @@
#ifndef MODEL_H
#define MODEL_H
#include <QtCore/QString>
#include <QtCore/QObject>
#include <QString>
#include <QObject>
#include "lmms_export.h"

View File

@@ -25,7 +25,7 @@
#ifndef MODEL_VIEW_H
#define MODEL_VIEW_H
#include <QtCore/QPointer>
#include <QPointer>
#include "Model.h"

View File

@@ -27,8 +27,8 @@
#define NSTATE_BUTTON_H
#include <QPixmap>
#include <QtCore/QVector>
#include <QtCore/QPair>
#include <QVector>
#include <QPair>
#include "ToolButton.h"

View File

@@ -26,7 +26,7 @@
#ifndef NOTE_H
#define NOTE_H
#include <QtCore/QVector>
#include <QVector>
#include "volume.h"
#include "panning.h"

View File

@@ -231,16 +231,16 @@ public:
/*! Returns whether given NotePlayHandle instance is equal to *this */
bool operator==( const NotePlayHandle & _nph ) const;
/*! Returns whether NotePlayHandle belongs to BB track and BB track is muted */
bool isBbTrackMuted()
/*! Returns whether NotePlayHandle belongs to pattern track and pattern track is muted */
bool isPatternTrackMuted()
{
return m_bbTrack && m_bbTrack->isMuted();
return m_patternTrack && m_patternTrack->isMuted();
}
/*! Sets attached BB track */
void setBBTrack( Track* t )
/*! Sets attached pattern track */
void setPatternTrack(Track* t)
{
m_bbTrack = t;
m_patternTrack = t;
}
/*! Process note detuning automation */
@@ -311,7 +311,7 @@ private:
NotePlayHandle * m_parent; // parent note
bool m_hadChildren;
bool m_muted; // indicates whether note is muted
Track* m_bbTrack; // related BB track
Track* m_patternTrack; // related pattern track
// tempo reaction
bpm_t m_origTempo; // original tempo

View File

@@ -28,11 +28,7 @@
#include <cassert>
#include <fftw3.h>
#include <math.h>
#ifdef LMMS_HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <cstdlib>
#include "Engine.h"
#include "lmms_constants.h"

View File

@@ -1,5 +1,5 @@
/*
* BBClip.h
* PatternClip.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -23,33 +23,36 @@
*/
#ifndef BB_CLIP_H
#define BB_CLIP_H
#ifndef PATTERN_CLIP_H
#define PATTERN_CLIP_H
#include "ClipView.h"
#include "Clip.h"
class BBClip : public Clip
/*! \brief Dummy clip for PatternTracks
*
* Only used in the Song (Editor). See PatternStore.h for more info.
*/
class PatternClip : public Clip
{
public:
BBClip( Track * _track );
virtual ~BBClip() = default;
PatternClip(Track* track);
virtual ~PatternClip() = default;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return( "bbtco" );
return "patternclip";
}
int bbTrackIndex();
int patternIndex();
ClipView * createView( TrackView * _tv ) override;
private:
friend class BBClipView;
friend class PatternClipView;
} ;
#endif
#endif

View File

@@ -1,5 +1,5 @@
/*
* BBClipView.h
* PatternClipView.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -23,27 +23,30 @@
*/
#ifndef BB_CLIP_VIEW_H
#define BB_CLIP_VIEW_H
#ifndef PATTERN_CLIP_VIEW_H
#define PATTERN_CLIP_VIEW_H
#include "BBClip.h"
#include <QStaticText>
#include "ClipView.h"
class BBClipView : public ClipView
class PatternClip;
class PatternClipView : public ClipView
{
Q_OBJECT
public:
BBClipView( Clip * _clip, TrackView * _tv );
virtual ~BBClipView() = default;
PatternClipView(Clip* clip, TrackView* tv);
virtual ~PatternClipView() = default;
public slots:
void update() override;
protected slots:
void openInBBEditor();
void openInPatternEditor();
void resetName();
void changeName();
@@ -55,7 +58,7 @@ protected:
private:
BBClip * m_bbClip;
PatternClip* m_patternClip;
QPixmap m_paintPixmap;
QStaticText m_staticTextName;
@@ -63,4 +66,4 @@ private:
#endif
#endif

View File

@@ -1,5 +1,5 @@
/*
* BBEditor.h - view-component of BB-Editor
* PatternEditor.h - basic main-window for editing patterns
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -23,60 +23,30 @@
*/
#ifndef BB_EDITOR_H
#define BB_EDITOR_H
#ifndef PATTERN_EDITOR_H
#define PATTERN_EDITOR_H
#include "Editor.h"
#include "TrackContainerView.h"
class BBTrackContainer;
class PatternStore;
class ComboBox;
class BBTrackContainerView;
class BBEditor : public Editor
class PatternEditor : public TrackContainerView
{
Q_OBJECT
public:
BBEditor( BBTrackContainer * _tc );
~BBEditor();
QSize sizeHint() const override;
const BBTrackContainerView* trackContainerView() const {
return m_trackContainerView;
}
BBTrackContainerView* trackContainerView() {
return m_trackContainerView;
}
void removeBBView( int bb );
public slots:
void play() override;
void stop() override;
private:
BBTrackContainerView* m_trackContainerView;
ComboBox * m_bbComboBox;
} ;
class BBTrackContainerView : public TrackContainerView
{
Q_OBJECT
public:
BBTrackContainerView(BBTrackContainer* tc);
PatternEditor(PatternStore* ps);
bool fixedClips() const override
{
return true;
}
void removeBBView(int bb);
void removeViewsForPattern(int pattern);
void saveSettings(QDomDocument& doc, QDomElement& element) override;
void loadSettings(const QDomElement& element) override;
@@ -94,9 +64,30 @@ protected slots:
void updatePosition();
private:
BBTrackContainer * m_bbtc;
PatternStore* m_ps;
void makeSteps( bool clone );
};
class PatternEditorWindow : public Editor
{
Q_OBJECT
public:
PatternEditorWindow(PatternStore* ps);
~PatternEditorWindow();
QSize sizeHint() const override;
PatternEditor* m_editor;
public slots:
void play() override;
void stop() override;
private:
ComboBox* m_patternComboBox;
};
#endif

108
include/PatternStore.h Normal file
View File

@@ -0,0 +1,108 @@
/*
* PatternStore.h - model-component of Pattern Editor
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef PATTERN_STORE_H
#define PATTERN_STORE_H
#include "TrackContainer.h"
#include "ComboBoxModel.h"
/*
* PatternStore is the backend of Pattern Editor:
*
* +----------------------------------+
* | PatternStore (TrackContainer) |
* | |
* | +------------------------------+ |
* | | Track 1 [Clip A] [Clip B] | |
* | +------------------------------+ |
* | |
* | +------------------------------+ |
* | | Track 2 [Clip C] [Clip D] | |
* | +------------------------------+ |
* +----------------------------------+
*
* There is only one PatternStore which holds all patterns, and it's very similar to the Song Editor.
* Think of it as a table - tracks are rows, bars are columns and clips are cells.
* With this logic a "pattern" is a column, i.e. all clips on the same bar.
* In the Pattern Editor you can select which pattern (column) you want to see, using the combo box at the top.
* In the illustration above, Clip A and Clip C start on bar 1, thus they are "Pattern 1".
*
* Do not confuse tracks and clips in the PatternStore with PatternTracks and PatternClips.
* - PatternTracks are used in the Song Editor. Each one reference a "pattern" in the PatternStore.
* - PatternClips are stored inside PatternTracks. They are just empty placeholders.
*/
class LMMS_EXPORT PatternStore : public TrackContainer
{
Q_OBJECT
mapPropertyFromModel(int, currentPattern, setCurrentPattern, m_patternComboBoxModel);
public:
PatternStore();
virtual ~PatternStore();
virtual bool play(TimePos start, const fpp_t frames, const f_cnt_t frameBase, int clipNum = -1);
void updateAfterTrackAdd() override;
inline QString nodeName() const override
{
return "patternstore";
}
bar_t lengthOfPattern(int pattern) const;
inline bar_t lengthOfCurrentPattern()
{
return lengthOfPattern(currentPattern());
}
int numOfPatterns() const;
void removePattern(int pattern);
void swapPattern(int p1, int p2);
void updatePatternTrack(Clip* clip);
void fixIncorrectPositions();
void createClipsForPattern(int pattern);
AutomatedValueMap automatedValuesAt(TimePos time, int clipNum) const override;
public slots:
void play();
void stop();
void updateComboBox();
void currentPatternChanged();
private:
ComboBoxModel m_patternComboBoxModel;
// Where the pattern selection combo box is
friend class PatternEditorWindow;
} ;
#endif

View File

@@ -1,6 +1,5 @@
/*
* BBTrack.h - class BBTrack, a wrapper for using bbEditor
* (which is a singleton-class) as track
* PatternTrack.h - a track representing a pattern in the PatternStore
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -24,25 +23,25 @@
*/
#ifndef BB_TRACK_H
#define BB_TRACK_H
#ifndef PATTERN_TRACK_H
#define PATTERN_TRACK_H
#include <QtCore/QMap>
#include <QMap>
#include "BBClipView.h"
#include "Track.h"
class TrackLabelButton;
class TrackContainer;
class LMMS_EXPORT BBTrack : public Track
/*! Track type used in the Song (Editor) to reference a pattern in the PatternStore */
class LMMS_EXPORT PatternTrack : public Track
{
Q_OBJECT
public:
BBTrack( TrackContainer* tc );
virtual ~BBTrack();
PatternTrack(TrackContainer* tc);
virtual ~PatternTrack();
virtual bool play( const TimePos & _start, const fpp_t _frames,
const f_cnt_t _frame_base, int _clip_num = -1 ) override;
@@ -53,10 +52,10 @@ public:
QDomElement & _parent ) override;
void loadTrackSpecificSettings( const QDomElement & _this ) override;
static BBTrack * findBBTrack( int _bb_num );
static void swapBBTracks( Track * _track1, Track * _track2 );
static PatternTrack* findPatternTrack(int pattern_num);
static void swapPatternTracks(Track* track1, Track* track2);
int index()
int patternIndex()
{
return s_infoMap[this];
}
@@ -77,17 +76,17 @@ public:
protected:
inline QString nodeName() const override
{
return( "bbtrack" );
return "patterntrack";
}
private:
QList<Track *> m_disabledTracks;
typedef QMap<BBTrack *, int> infoMap;
typedef QMap<PatternTrack*, int> infoMap;
static infoMap s_infoMap;
friend class BBTrackView;
friend class PatternTrackView;
} ;

View File

@@ -1,5 +1,5 @@
/*
* BBTrackView.h
* PatternTrackView.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -23,27 +23,28 @@
*/
#ifndef BB_TRACK_VIEW_H
#define BB_TRACK_VIEW_H
#ifndef PATTERN_TRACK_VIEW_H
#define PATTERN_TRACK_VIEW_H
#include <QtCore/QObject>
#include "BBTrack.h"
#include "TrackView.h"
class PatternTrack;
class TrackLabelButton;
class BBTrackView : public TrackView
class PatternTrackView : public TrackView
{
Q_OBJECT
public:
BBTrackView( BBTrack* bbt, TrackContainerView* tcv );
virtual ~BBTrackView();
PatternTrackView(PatternTrack* pt, TrackContainerView* tcv);
virtual ~PatternTrackView();
bool close() override;
const BBTrack * getBBTrack() const
const PatternTrack* getPatternTrack() const
{
return( m_bbTrack );
return (m_patternTrack);
}
@@ -52,10 +53,10 @@ public slots:
private:
BBTrack * m_bbTrack;
PatternTrack* m_patternTrack;
TrackLabelButton * m_trackLabel;
} ;
#endif
#endif

View File

@@ -25,7 +25,6 @@
#ifndef PEAK_CONTROLLER_H
#define PEAK_CONTROLLER_H
#include "Model.h"
#include "Controller.h"
#include "ControllerDialog.h"

View File

@@ -26,7 +26,7 @@
#define PERFLOG_H
#include <ctime>
#include <QtCore/QString>
#include <QString>
/// \brief CPU time point
///

View File

@@ -29,7 +29,6 @@
#include <QVector>
#include <QWidget>
#include <QInputDialog>
#include "Editor.h"
#include "ComboBoxModel.h"
@@ -37,13 +36,12 @@
#include "Note.h"
#include "lmms_basics.h"
#include "Song.h"
#include "ToolTip.h"
#include "StepRecorder.h"
#include "StepRecorderWidget.h"
#include "PositionLine.h"
class QPainter;
class QPixmap;
class QPushButton;
class QScrollBar;
class QString;
class QMenu;
@@ -52,6 +50,8 @@ class QToolButton;
class ComboBox;
class NotePlayHandle;
class MidiClip;
class PositionLine;
class TextFloat;
class TimeLineWidget;
class PianoRoll : public QWidget

View File

@@ -25,12 +25,11 @@
#ifndef PLAY_HANDLE_H
#define PLAY_HANDLE_H
#include <QtCore/QList>
#include <QtCore/QMutex>
#include <QList>
#include <QMutex>
#include "lmms_export.h"
#include "MemoryManager.h"
#include "ThreadableJob.h"
#include "lmms_basics.h"

View File

@@ -25,9 +25,8 @@
#ifndef PLUGIN_H
#define PLUGIN_H
#include <QtCore/QStringList>
#include <QtCore/QMap>
#include <QtXml/QDomDocument>
#include <QStringList>
#include <QMap>
#include "JournallingObject.h"
#include "Model.h"

View File

@@ -25,7 +25,6 @@
#ifndef PLUGIN_BROWSER_H
#define PLUGIN_BROWSER_H
#include <QtCore/QTimer>
#include <QPixmap>
#include "SideBarWidget.h"

View File

@@ -28,11 +28,10 @@
#include <memory>
#include <string>
#include <QtCore/QFileInfo>
#include <QtCore/QHash>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QVector>
#include <QFileInfo>
#include <QList>
#include <QString>
#include <QVector>
#include "lmms_export.h"
#include "Plugin.h"

View File

@@ -25,8 +25,8 @@
#ifndef PROJECT_JOURNAL_H
#define PROJECT_JOURNAL_H
#include <QtCore/QHash>
#include <QtCore/QStack>
#include <QHash>
#include <QStack>
#include "lmms_basics.h"
#include "DataFile.h"

View File

@@ -27,7 +27,6 @@
#define PROJECT_NOTES_H
#include <QMainWindow>
#include <QCloseEvent>
#include "SerializingObject.h"

View File

@@ -27,8 +27,8 @@
#ifndef PROJECT_VERSION_H
#define PROJECT_VERSION_H
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QString>
#include <QStringList>
#include <limits>

File diff suppressed because it is too large Load Diff

743
include/RemotePluginBase.h Normal file
View File

@@ -0,0 +1,743 @@
/*
* RemotePluginBase.h - base class providing RPC like mechanisms
*
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef REMOTE_PLUGIN_BASE_H
#define REMOTE_PLUGIN_BASE_H
#include "MidiEvent.h"
#include "VstSyncData.h"
#include <atomic>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cassert>
#if !(defined(LMMS_HAVE_SYS_IPC_H) && defined(LMMS_HAVE_SEMAPHORE_H))
#define SYNC_WITH_SHM_FIFO
#define USE_QT_SEMAPHORES
#ifdef LMMS_HAVE_PROCESS_H
#include <process.h>
#endif
#include <QtGlobal>
#include <QSystemSemaphore>
#endif
#ifdef LMMS_HAVE_SYS_SHM_H
#include <sys/shm.h>
#ifdef LMMS_HAVE_UNISTD_H
#include <unistd.h>
#endif
#else
#define USE_QT_SHMEM
#include <QtGlobal>
#include <QSharedMemory>
#if !defined(LMMS_HAVE_SYS_TYPES_H) || defined(LMMS_BUILD_WIN32)
typedef int32_t key_t;
#endif
#endif
#ifdef LMMS_HAVE_LOCALE_H
#include <clocale>
#endif
#ifdef LMMS_HAVE_PTHREAD_H
#include <pthread.h>
#endif
#ifdef BUILD_REMOTE_PLUGIN_CLIENT
#undef LMMS_EXPORT
#define LMMS_EXPORT
#ifndef SYNC_WITH_SHM_FIFO
#include <sys/socket.h>
#include <sys/un.h>
#endif
#else
#include "lmms_export.h"
#include <QMutex>
#include <QProcess>
#include <QThread>
#include <QString>
#ifndef SYNC_WITH_SHM_FIFO
#include <poll.h>
#include <unistd.h>
#endif
#endif
#ifdef SYNC_WITH_SHM_FIFO
// sometimes we need to exchange bigger messages (e.g. for VST parameter dumps)
// so set a usable value here
const int SHM_FIFO_SIZE = 512*1024;
// implements a FIFO inside a shared memory segment
class shmFifo
{
// need this union to handle different sizes of sem_t on 32 bit
// and 64 bit platforms
union sem32_t
{
int semKey;
char fill[32];
} ;
struct shmData
{
sem32_t dataSem; // semaphore for locking this
// FIFO management data
sem32_t messageSem; // semaphore for incoming messages
volatile int32_t startPtr; // current start of FIFO in memory
volatile int32_t endPtr; // current end of FIFO in memory
char data[SHM_FIFO_SIZE]; // actual data
} ;
public:
// constructor for master-side
shmFifo() :
m_invalid( false ),
m_master( true ),
m_shmKey( 0 ),
#ifdef USE_QT_SHMEM
m_shmObj(),
#else
m_shmID( -1 ),
#endif
m_data( nullptr ),
m_dataSem( QString() ),
m_messageSem( QString() ),
m_lockDepth( 0 )
{
#ifdef USE_QT_SHMEM
do
{
m_shmObj.setKey( QString( "%1" ).arg( ++m_shmKey ) );
m_shmObj.create( sizeof( shmData ) );
} while( m_shmObj.error() != QSharedMemory::NoError );
m_data = (shmData *) m_shmObj.data();
#else
while( ( m_shmID = shmget( ++m_shmKey, sizeof( shmData ),
IPC_CREAT | IPC_EXCL | 0600 ) ) == -1 )
{
}
m_data = (shmData *) shmat( m_shmID, 0, 0 );
#endif
assert( m_data != nullptr );
m_data->startPtr = m_data->endPtr = 0;
static int k = 0;
m_data->dataSem.semKey = ( getpid()<<10 ) + ++k;
m_data->messageSem.semKey = ( getpid()<<10 ) + ++k;
m_dataSem.setKey( QString::number( m_data->dataSem.semKey ),
1, QSystemSemaphore::Create );
m_messageSem.setKey( QString::number(
m_data->messageSem.semKey ),
0, QSystemSemaphore::Create );
}
// constructor for remote-/client-side - use _shm_key for making up
// the connection to master
shmFifo( key_t _shm_key ) :
m_invalid( false ),
m_master( false ),
m_shmKey( 0 ),
#ifdef USE_QT_SHMEM
m_shmObj( QString::number( _shm_key ) ),
#else
m_shmID( shmget( _shm_key, 0, 0 ) ),
#endif
m_data( nullptr ),
m_dataSem( QString() ),
m_messageSem( QString() ),
m_lockDepth( 0 )
{
#ifdef USE_QT_SHMEM
if( m_shmObj.attach() )
{
m_data = (shmData *) m_shmObj.data();
}
#else
if( m_shmID != -1 )
{
m_data = (shmData *) shmat( m_shmID, 0, 0 );
}
#endif
assert( m_data != nullptr );
m_dataSem.setKey( QString::number( m_data->dataSem.semKey ) );
m_messageSem.setKey( QString::number(
m_data->messageSem.semKey ) );
}
~shmFifo()
{
// master?
if( m_master )
{
#ifndef USE_QT_SHMEM
shmctl( m_shmID, IPC_RMID, nullptr );
#endif
}
#ifndef USE_QT_SHMEM
shmdt( m_data );
#endif
}
inline bool isInvalid() const
{
return m_invalid;
}
void invalidate()
{
m_invalid = true;
}
// do we act as master (i.e. not as remote-process?)
inline bool isMaster() const
{
return m_master;
}
// recursive lock
inline void lock()
{
if( !isInvalid() && m_lockDepth.fetch_add( 1 ) == 0 )
{
m_dataSem.acquire();
}
}
// recursive unlock
inline void unlock()
{
if( m_lockDepth.fetch_sub( 1 ) <= 1 )
{
m_dataSem.release();
}
}
// wait until message-semaphore is available
inline void waitForMessage()
{
if( !isInvalid() )
{
m_messageSem.acquire();
}
}
// increase message-semaphore
inline void messageSent()
{
m_messageSem.release();
}
inline int32_t readInt()
{
int32_t i;
read( &i, sizeof( i ) );
return i;
}
inline void writeInt( const int32_t & _i )
{
write( &_i, sizeof( _i ) );
}
inline std::string readString()
{
const int len = readInt();
if( len )
{
char * sc = new char[len + 1];
read( sc, len );
sc[len] = 0;
std::string s( sc );
delete[] sc;
return s;
}
return std::string();
}
inline void writeString( const std::string & _s )
{
const int len = _s.size();
writeInt( len );
write( _s.c_str(), len );
}
inline bool messagesLeft()
{
if( isInvalid() )
{
return false;
}
lock();
const bool empty = ( m_data->startPtr == m_data->endPtr );
unlock();
return !empty;
}
inline int shmKey() const
{
return m_shmKey;
}
private:
static inline void fastMemCpy( void * _dest, const void * _src,
const int _len )
{
// calling memcpy() for just an integer is obsolete overhead
if( _len == 4 )
{
*( (int32_t *) _dest ) = *( (int32_t *) _src );
}
else
{
memcpy( _dest, _src, _len );
}
}
void read( void * _buf, int _len )
{
if( isInvalid() )
{
memset( _buf, 0, _len );
return;
}
lock();
while( isInvalid() == false &&
_len > m_data->endPtr - m_data->startPtr )
{
unlock();
#ifndef LMMS_BUILD_WIN32
usleep( 5 );
#endif
lock();
}
fastMemCpy( _buf, m_data->data + m_data->startPtr, _len );
m_data->startPtr += _len;
// nothing left?
if( m_data->startPtr == m_data->endPtr )
{
// then reset to 0
m_data->startPtr = m_data->endPtr = 0;
}
unlock();
}
void write( const void * _buf, int _len )
{
if( isInvalid() || _len > SHM_FIFO_SIZE )
{
return;
}
lock();
while( _len > SHM_FIFO_SIZE - m_data->endPtr )
{
// if no space is left, try to move data to front
if( m_data->startPtr > 0 )
{
memmove( m_data->data,
m_data->data + m_data->startPtr,
m_data->endPtr - m_data->startPtr );
m_data->endPtr = m_data->endPtr -
m_data->startPtr;
m_data->startPtr = 0;
}
unlock();
#ifndef LMMS_BUILD_WIN32
usleep( 5 );
#endif
lock();
}
fastMemCpy( m_data->data + m_data->endPtr, _buf, _len );
m_data->endPtr += _len;
unlock();
}
volatile bool m_invalid;
bool m_master;
key_t m_shmKey;
#ifdef USE_QT_SHMEM
QSharedMemory m_shmObj;
#else
int m_shmID;
#endif
shmData * m_data;
QSystemSemaphore m_dataSem;
QSystemSemaphore m_messageSem;
std::atomic_int m_lockDepth;
} ;
#endif
enum RemoteMessageIDs
{
IdUndefined,
IdHostInfoGotten,
IdInitDone,
IdQuit,
IdSampleRateInformation,
IdBufferSizeInformation,
IdInformationUpdated,
IdMidiEvent,
IdStartProcessing,
IdProcessingDone,
IdChangeSharedMemoryKey,
IdChangeInputCount,
IdChangeOutputCount,
IdChangeInputOutputCount,
IdShowUI,
IdHideUI,
IdToggleUI,
IdIsUIVisible,
IdSaveSettingsToString,
IdSaveSettingsToFile,
IdLoadSettingsFromString,
IdLoadSettingsFromFile,
IdSavePresetFile,
IdLoadPresetFile,
IdDebugMessage,
IdIdle,
IdUserBase = 64
} ;
class LMMS_EXPORT RemotePluginBase
{
public:
struct message
{
message() :
id( IdUndefined ),
data()
{
}
message( const message & _m ) :
id( _m.id ),
data( _m.data )
{
}
message( int _id ) :
id( _id ),
data()
{
}
inline message & addString( const std::string & _s )
{
data.push_back( _s );
return *this;
}
message & addInt( int _i )
{
char buf[32];
sprintf( buf, "%d", _i );
data.push_back( std::string( buf ) );
return *this;
}
message & addFloat( float _f )
{
char buf[32];
sprintf( buf, "%f", _f );
data.push_back( std::string( buf ) );
return *this;
}
inline std::string getString( int _p = 0 ) const
{
return data[_p];
}
#ifndef BUILD_REMOTE_PLUGIN_CLIENT
inline QString getQString( int _p = 0 ) const
{
return QString::fromStdString( getString( _p ) );
}
#endif
inline int getInt( int _p = 0 ) const
{
return atoi( data[_p].c_str() );
}
inline float getFloat( int _p ) const
{
return (float) atof( data[_p].c_str() );
}
inline bool operator==( const message & _m ) const
{
return( id == _m.id );
}
int id;
private:
std::vector<std::string> data;
friend class RemotePluginBase;
} ;
#ifdef SYNC_WITH_SHM_FIFO
RemotePluginBase( shmFifo * _in, shmFifo * _out );
#else
RemotePluginBase();
#endif
virtual ~RemotePluginBase();
#ifdef SYNC_WITH_SHM_FIFO
void reset( shmFifo *in, shmFifo *out )
{
delete m_in;
delete m_out;
m_in = in;
m_out = out;
}
#endif
int sendMessage( const message & _m );
message receiveMessage();
inline bool isInvalid() const
{
#ifdef SYNC_WITH_SHM_FIFO
return m_in->isInvalid() || m_out->isInvalid();
#else
return m_invalid;
#endif
}
message waitForMessage( const message & _m,
bool _busy_waiting = false );
inline message fetchAndProcessNextMessage()
{
message m = receiveMessage();
processMessage( m );
return m;
}
#ifndef SYNC_WITH_SHM_FIFO
inline int32_t readInt()
{
int32_t i;
read( &i, sizeof( i ) );
return i;
}
inline void writeInt( const int32_t & _i )
{
write( &_i, sizeof( _i ) );
}
inline std::string readString()
{
const int len = readInt();
if( len )
{
char * sc = new char[len + 1];
read( sc, len );
sc[len] = 0;
std::string s( sc );
delete[] sc;
return s;
}
return std::string();
}
inline void writeString( const std::string & _s )
{
const int len = _s.size();
writeInt( len );
write( _s.c_str(), len );
}
#endif
#ifndef BUILD_REMOTE_PLUGIN_CLIENT
inline bool messagesLeft()
{
#ifdef SYNC_WITH_SHM_FIFO
return m_in->messagesLeft();
#else
struct pollfd pollin;
pollin.fd = m_socket;
pollin.events = POLLIN;
if ( poll( &pollin, 1, 0 ) == -1 )
{
qWarning( "Unexpected poll error." );
}
return pollin.revents & POLLIN;
#endif
}
inline void fetchAndProcessAllMessages()
{
while( messagesLeft() )
{
fetchAndProcessNextMessage();
}
}
static bool isMainThreadWaiting()
{
return waitDepthCounter() > 0;
}
#endif
virtual bool processMessage( const message & _m ) = 0;
protected:
#ifdef SYNC_WITH_SHM_FIFO
inline const shmFifo * in() const
{
return m_in;
}
inline const shmFifo * out() const
{
return m_out;
}
#endif
inline void invalidate()
{
#ifdef SYNC_WITH_SHM_FIFO
m_in->invalidate();
m_out->invalidate();
m_in->messageSent();
#else
m_invalid = true;
#endif
}
#ifndef SYNC_WITH_SHM_FIFO
int m_socket;
#endif
private:
#ifndef BUILD_REMOTE_PLUGIN_CLIENT
static int & waitDepthCounter()
{
static int waitDepth = 0;
return waitDepth;
}
#endif
#ifdef SYNC_WITH_SHM_FIFO
shmFifo * m_in;
shmFifo * m_out;
#else
void read( void * _buf, int _len )
{
if( isInvalid() )
{
memset( _buf, 0, _len );
return;
}
char * buf = (char *) _buf;
int remaining = _len;
while ( remaining )
{
ssize_t nread = ::read( m_socket, buf, remaining );
switch ( nread )
{
case -1:
fprintf( stderr,
"Error while reading.\n" );
case 0:
invalidate();
memset( _buf, 0, _len );
return;
}
buf += nread;
remaining -= nread;
}
}
void write( const void * _buf, int _len )
{
if( isInvalid() )
{
return;
}
const char * buf = (const char *) _buf;
int remaining = _len;
while ( remaining )
{
ssize_t nwritten = ::write( m_socket, buf, remaining );
switch ( nwritten )
{
case -1:
fprintf( stderr,
"Error while writing.\n" );
case 0:
invalidate();
return;
}
buf += nwritten;
remaining -= nwritten;
}
}
bool m_invalid;
pthread_mutex_t m_receiveMutex;
pthread_mutex_t m_sendMutex;
#endif
} ;
#endif // REMOTE_PLUGIN_BASE_H

View File

@@ -0,0 +1,388 @@
/*
* 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 REMOTE_PLUGIN_CLIENT_H
#define REMOTE_PLUGIN_CLIENT_H
#include "RemotePluginBase.h"
class RemotePluginClient : public RemotePluginBase
{
public:
#ifdef SYNC_WITH_SHM_FIFO
RemotePluginClient( key_t _shm_in, key_t _shm_out );
#else
RemotePluginClient( const char * socketPath );
#endif
virtual ~RemotePluginClient();
#ifdef USE_QT_SHMEM
VstSyncData * getQtVSTshm();
#endif
virtual bool processMessage( const message & _m );
virtual void process( const sampleFrame * _in_buf,
sampleFrame * _out_buf ) = 0;
virtual void processMidiEvent( const MidiEvent&, const f_cnt_t /* _offset */ )
{
}
inline float * sharedMemory()
{
return m_shm;
}
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( key_t _key, int _size );
void doProcessing();
#ifdef USE_QT_SHMEM
QSharedMemory m_shmObj;
QSharedMemory m_shmQtID;
#endif
VstSyncData * m_vstSyncData;
float * m_shm;
int m_inputCount;
int m_outputCount;
sample_rate_t m_sampleRate;
fpp_t m_bufferSize;
} ;
#ifdef SYNC_WITH_SHM_FIFO
RemotePluginClient::RemotePluginClient( key_t _shm_in, key_t _shm_out ) :
RemotePluginBase( new shmFifo( _shm_in ), new shmFifo( _shm_out ) ),
#else
RemotePluginClient::RemotePluginClient( const char * socketPath ) :
RemotePluginBase(),
#endif
#ifdef USE_QT_SHMEM
m_shmObj(),
m_shmQtID( "/usr/bin/lmms" ),
#endif
m_vstSyncData( nullptr ),
m_shm( nullptr ),
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
#ifdef USE_QT_SHMEM
if( m_shmQtID.attach( QSharedMemory::ReadOnly ) )
{
m_vstSyncData = (VstSyncData *) m_shmQtID.data();
m_bufferSize = m_vstSyncData->m_bufferSize;
m_sampleRate = m_vstSyncData->m_sampleRate;
sendMessage( IdHostInfoGotten );
return;
}
#else
key_t key;
int m_shmID;
if( ( key = ftok( VST_SNC_SHM_KEY_FILE, 'R' ) ) == -1 )
{
perror( "RemotePluginClient::ftok" );
}
else
{ // connect to shared memory segment
if( ( m_shmID = shmget( key, 0, 0 ) ) == -1 )
{
perror( "RemotePluginClient::shmget" );
}
else
{ // attach segment
m_vstSyncData = (VstSyncData *)shmat(m_shmID, 0, 0);
if( m_vstSyncData == (VstSyncData *)( -1 ) )
{
perror( "RemotePluginClient::shmat" );
}
else
{
m_bufferSize = m_vstSyncData->m_bufferSize;
m_sampleRate = m_vstSyncData->m_sampleRate;
sendMessage( IdHostInfoGotten );
// detach segment
if( shmdt(m_vstSyncData) == -1 )
{
perror("RemotePluginClient::shmdt");
}
return;
}
}
}
#endif
// if attaching shared memory fails
sendMessage( IdSampleRateInformation );
sendMessage( IdBufferSizeInformation );
if( waitForMessage( IdBufferSizeInformation ).id
!= IdBufferSizeInformation )
{
fprintf( stderr, "Could not get buffer size information\n" );
}
sendMessage( IdHostInfoGotten );
}
RemotePluginClient::~RemotePluginClient()
{
#ifdef USE_QT_SHMEM
m_shmQtID.detach();
#endif
sendMessage( IdQuit );
#ifndef USE_QT_SHMEM
shmdt( m_shm );
#endif
#ifndef SYNC_WITH_SHM_FIFO
if ( close( m_socket ) == -1)
{
fprintf( stderr, "Error freeing resources.\n" );
}
#endif
}
#ifdef USE_QT_SHMEM
VstSyncData * RemotePluginClient::getQtVSTshm()
{
return m_vstSyncData;
}
#endif
bool RemotePluginClient::processMessage( const message & _m )
{
message reply_message( _m.id );
bool reply = false;
switch( _m.id )
{
case IdUndefined:
return false;
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.getInt( 0 ), _m.getInt( 1 ) );
break;
case IdInitDone:
break;
default:
{
char buf[64];
sprintf( buf, "undefined message: %d\n", (int) _m.id );
debugMessage( buf );
break;
}
}
if( reply )
{
sendMessage( reply_message );
}
return true;
}
void RemotePluginClient::setShmKey( key_t _key, int _size )
{
#ifdef USE_QT_SHMEM
m_shmObj.setKey( QString::number( _key ) );
if( m_shmObj.attach() || m_shmObj.error() == QSharedMemory::NoError )
{
m_shm = (float *) m_shmObj.data();
}
else
{
char buf[64];
sprintf( buf, "failed getting shared memory: %d\n", m_shmObj.error() );
debugMessage( buf );
}
#else
if( m_shm != nullptr )
{
shmdt( m_shm );
m_shm = nullptr;
}
// only called for detaching SHM?
if( _key == 0 )
{
return;
}
int shm_id = shmget( _key, _size, 0 );
if( shm_id == -1 )
{
debugMessage( "failed getting shared memory\n" );
}
else
{
m_shm = (float *) shmat( shm_id, 0, 0 );
}
#endif
}
void RemotePluginClient::doProcessing()
{
if( m_shm != nullptr )
{
process( (sampleFrame *)( m_inputCount > 0 ? m_shm : nullptr ),
(sampleFrame *)( m_shm +
( m_inputCount*m_bufferSize ) ) );
}
else
{
debugMessage( "doProcessing(): have no shared memory!\n" );
}
}
#endif // REMOTE_PLUGIN_CLIENT_H

View File

@@ -27,9 +27,9 @@
#ifndef RINGBUFFER_H
#define RINGBUFFER_H
#include <cmath>
#include <QObject>
#include "lmms_basics.h"
#include "lmms_math.h"
#include "MemoryManager.h"
/** \brief A basic LMMS ring buffer for single-thread use. For thread and realtime safe alternative see LocklessRingBuffer.

View File

@@ -28,7 +28,7 @@
#define RUBBERBAND_H
#include <QRubberBand>
#include <QtCore/QVector>
#include <QVector>
class selectableObject : public QWidget
@@ -45,9 +45,10 @@ public:
{
}
inline void setSelected( bool _selected )
inline void setSelected(bool selected)
{
m_selected = _selected;
if (m_selected == selected) { return; }
m_selected = selected;
update();
}

View File

@@ -27,8 +27,8 @@
#define SAMPLE_BUFFER_H
#include <memory>
#include <QtCore/QReadWriteLock>
#include <QtCore/QObject>
#include <QReadWriteLock>
#include <QObject>
#include <samplerate.h>

View File

@@ -25,10 +25,10 @@
#ifndef SAMPLE_CLIP_H
#define SAMPLE_CLIP_H
#include "SampleBuffer.h"
#include "SampleTrack.h"
#include "Clip.h"
class SampleBuffer;
class SampleClip : public Clip
{
@@ -48,7 +48,7 @@ public:
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return "sampletco";
return "sampleclip";
}
SampleBuffer* sampleBuffer()
@@ -89,4 +89,4 @@ signals:
#endif
#endif

View File

@@ -25,11 +25,10 @@
#ifndef SAMPLE_CLIP_VIEW_H
#define SAMPLE_CLIP_VIEW_H
#include "SampleClipView.h"
#include "SampleClip.h"
#include "ClipView.h"
class SampleClip;
class SampleClipView : public ClipView
{
Q_OBJECT
@@ -62,4 +61,4 @@ private:
#endif
#endif

View File

@@ -30,7 +30,7 @@
#include "AutomatableModel.h"
#include "PlayHandle.h"
class BBTrack;
class PatternTrack;
class SampleClip;
class Track;
class AudioPort;
@@ -65,9 +65,9 @@ public:
m_doneMayReturnTrue = _enable;
}
void setBBTrack( BBTrack * _bb_track )
void setPatternTrack(PatternTrack* pt)
{
m_bbTrack = _bb_track;
m_patternTrack = pt;
}
void setVolumeModel( FloatModel * _model )
@@ -89,7 +89,7 @@ private:
FloatModel * m_volumeModel;
Track * m_track;
BBTrack * m_bbTrack;
PatternTrack* m_patternTrack;
} ;

View File

@@ -26,13 +26,13 @@
#ifndef SAMPLE_RECORD_HANDLE_H
#define SAMPLE_RECORD_HANDLE_H
#include <QtCore/QList>
#include <QtCore/QPair>
#include <QList>
#include <QPair>
#include "PlayHandle.h"
#include "TimePos.h"
class BBTrack;
class PatternTrack;
class SampleBuffer;
class SampleClip;
class Track;
@@ -63,7 +63,7 @@ private:
TimePos m_minLength;
Track * m_track;
BBTrack * m_bbTrack;
PatternTrack* m_patternTrack;
SampleClip * m_clip;
// The offset from the start of m_track that the record has

View File

@@ -25,13 +25,8 @@
#ifndef SAMPLE_TRACK_H
#define SAMPLE_TRACK_H
#include <QLayout>
#include "AudioPort.h"
#include "FadeButton.h"
#include "Mixer.h"
#include "SampleClip.h"
#include "SampleTrackView.h"
#include "Track.h"

Some files were not shown because too many files have changed in this diff Show More