diff --git a/CMakeLists.txt b/CMakeLists.txt index f45f994cf..0bbabeecd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,8 +128,6 @@ ENDIF() SET(CMAKE_CXX_STANDARD_REQUIRED ON) -CHECK_INCLUDE_FILES(stdint.h LMMS_HAVE_STDINT_H) -CHECK_INCLUDE_FILES(stdlib.h LMMS_HAVE_STDLIB_H) CHECK_INCLUDE_FILES(pthread.h LMMS_HAVE_PTHREAD_H) CHECK_INCLUDE_FILES(semaphore.h LMMS_HAVE_SEMAPHORE_H) CHECK_INCLUDE_FILES(unistd.h LMMS_HAVE_UNISTD_H) diff --git a/README.md b/README.md index 7b0254a61..7090a6a15 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Features --------- * Song-Editor for composing songs -* A Beat+Bassline-Editor for creating beats and basslines +* Pattern-Editor for creating beats and patterns * An easy-to-use Piano-Roll for editing patterns and melodies * A Mixer with unlimited mixer channels and arbitrary number of effects * Many powerful instrument and effect-plugins out of the box diff --git a/data/projects/templates/CR8000.mpt b/data/projects/templates/CR8000.mpt index f3f0f62b2..7d7314b65 100644 --- a/data/projects/templates/CR8000.mpt +++ b/data/projects/templates/CR8000.mpt @@ -20,7 +20,7 @@ - + diff --git a/data/projects/templates/TR808.mpt b/data/projects/templates/TR808.mpt index 69c313bd1..08ad876ca 100644 --- a/data/projects/templates/TR808.mpt +++ b/data/projects/templates/TR808.mpt @@ -20,7 +20,7 @@ - + diff --git a/data/projects/templates/default.mpt b/data/projects/templates/default.mpt index 70e6d0aeb..299aaff2d 100644 --- a/data/projects/templates/default.mpt +++ b/data/projects/templates/default.mpt @@ -25,7 +25,7 @@ - + diff --git a/data/themes/classic/add_bb_track.png b/data/themes/classic/add_pattern_track.png similarity index 100% rename from data/themes/classic/add_bb_track.png rename to data/themes/classic/add_pattern_track.png diff --git a/data/themes/classic/clone_bb_track_clip.png b/data/themes/classic/clone_pattern_track_clip.png similarity index 100% rename from data/themes/classic/clone_bb_track_clip.png rename to data/themes/classic/clone_pattern_track_clip.png diff --git a/data/themes/classic/bb_track.png b/data/themes/classic/pattern_track.png similarity index 100% rename from data/themes/classic/bb_track.png rename to data/themes/classic/pattern_track.png diff --git a/data/themes/classic/bb_track_btn.png b/data/themes/classic/pattern_track_btn.png similarity index 100% rename from data/themes/classic/bb_track_btn.png rename to data/themes/classic/pattern_track_btn.png diff --git a/data/themes/classic/style.css b/data/themes/classic/style.css index fc2c28e5f..4e38d2afe 100644 --- a/data/themes/classic/style.css +++ b/data/themes/classic/style.css @@ -333,7 +333,7 @@ QScrollBar::right-arrow:horizontal:disabled { background-image: url(resources:sb QScrollBar::up-arrow:vertical:disabled { background-image: url(resources:sbarrow_up_d.png);} QScrollBar::down-arrow:vertical:disabled { background-image: url(resources:sbarrow_down_d.png);} -/* background for song editor and bb-editor */ +/* background for song editor and pattern editor */ TrackContainerView QFrame{ background-color: #49515b; @@ -670,7 +670,7 @@ ClipView { qproperty-mutedColor: rgb( 128, 128, 128 ); qproperty-mutedBackgroundColor: rgb( 80, 80, 80 ); qproperty-selectedColor: rgb( 0, 125, 255 ); - qproperty-BBClipBackground: rgb( 80, 80, 80 ); + qproperty-patternClipBackground: rgb( 80, 80, 80 ); qproperty-textColor: rgb( 255, 255, 255 ); qproperty-textBackgroundColor: rgba(0, 0, 0, 75); qproperty-textShadowColor: rgb( 0, 0, 0 ); @@ -705,9 +705,9 @@ AutomationClipView { color: rgb( 204, 215, 255 ); } -/* bb-clip */ -BBClipView { - background-color: rgb( 128, 182, 175 ); /* default colour for bb-tracks */ +/* pattern clip */ +PatternClipView { + background-color: rgb( 128, 182, 175 ); /* default colour for pattern tracks */ } /* Subwindows in MDI-Area */ diff --git a/data/themes/default/add_bb_track.png b/data/themes/default/add_pattern_track.png similarity index 100% rename from data/themes/default/add_bb_track.png rename to data/themes/default/add_pattern_track.png diff --git a/data/themes/default/clone_bb_track_clip.png b/data/themes/default/clone_pattern_track_clip.png similarity index 100% rename from data/themes/default/clone_bb_track_clip.png rename to data/themes/default/clone_pattern_track_clip.png diff --git a/data/themes/default/bb_track.png b/data/themes/default/pattern_track.png similarity index 100% rename from data/themes/default/bb_track.png rename to data/themes/default/pattern_track.png diff --git a/data/themes/default/bb_track_btn.png b/data/themes/default/pattern_track_btn.png similarity index 100% rename from data/themes/default/bb_track_btn.png rename to data/themes/default/pattern_track_btn.png diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 87be1242f..743ab01bf 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -369,7 +369,7 @@ QScrollBar::down-arrow:vertical:disabled { background-image: url(resources:sbarr EffectRackView QScrollBar::up-arrow:vertical:disabled { background-image: url(resources:sbarrow_up.png);} EffectRackView QScrollBar::down-arrow:vertical:disabled { background-image: url(resources:sbarrow_down.png);} -/* background for song editor and bb-editor */ +/* background for song editor and pattern editor */ TrackContainerView QFrame { background-color: #262b30; @@ -716,7 +716,7 @@ ClipView { qproperty-mutedColor: rgba(255,255,255,100); qproperty-mutedBackgroundColor: #373d48; qproperty-selectedColor: #006B65; - qproperty-BBClipBackground: #373d48; + qproperty-patternClipBackground: #373d48; qproperty-textColor: #fff; qproperty-textBackgroundColor: rgba(0, 0, 0, 75); qproperty-textShadowColor: rgba(0,0,0,200); @@ -751,9 +751,9 @@ AutomationClipView { color: rgba(255,255,255,90); } -/* bb-clip */ -BBClipView { - background-color: #20BDB2; /* default colour for bb-tracks */ +/* pattern clip */ +PatternClipView { + background-color: #20BDB2; /* default colour for pattern tracks */ } /* Subwindows in MDI-Area */ diff --git a/include/AudioDevice.h b/include/AudioDevice.h index d635efa09..627ba470c 100644 --- a/include/AudioDevice.h +++ b/include/AudioDevice.h @@ -25,7 +25,7 @@ #ifndef AUDIO_DEVICE_H #define AUDIO_DEVICE_H -#include +#include #include #include "lmms_basics.h" diff --git a/include/AudioEngine.h b/include/AudioEngine.h index 51cc05171..9cf010426 100644 --- a/include/AudioEngine.h +++ b/include/AudioEngine.h @@ -25,16 +25,15 @@ #ifndef AUDIO_ENGINE_H #define AUDIO_ENGINE_H -#include -#include -#include -#include +#include +#include +#include +#include #include #include "lmms_basics.h" #include "LocklessList.h" -#include "Note.h" #include "FifoBuffer.h" #include "AudioEngineProfiler.h" #include "PlayHandle.h" diff --git a/include/AudioEngineWorkerThread.h b/include/AudioEngineWorkerThread.h index 546a963b3..f86d41c9a 100644 --- a/include/AudioEngineWorkerThread.h +++ b/include/AudioEngineWorkerThread.h @@ -25,7 +25,7 @@ #ifndef AUDIO_ENGINE_WORKER_THREAD_H #define AUDIO_ENGINE_WORKER_THREAD_H -#include +#include #include diff --git a/include/AudioFileDevice.h b/include/AudioFileDevice.h index cdcd407e1..c21a55c4c 100644 --- a/include/AudioFileDevice.h +++ b/include/AudioFileDevice.h @@ -26,7 +26,7 @@ #ifndef AUDIO_FILE_DEVICE_H #define AUDIO_FILE_DEVICE_H -#include +#include #include "AudioDevice.h" #include "OutputSettings.h" diff --git a/include/AudioJack.h b/include/AudioJack.h index ca65b0f96..e74ac4782 100644 --- a/include/AudioJack.h +++ b/include/AudioJack.h @@ -35,9 +35,7 @@ #endif #include -#include -#include -#include +#include #include "AudioDevice.h" #include "AudioDeviceSetupWidget.h" diff --git a/include/AudioPort.h b/include/AudioPort.h index 6c926f948..0f6c931d9 100644 --- a/include/AudioPort.h +++ b/include/AudioPort.h @@ -26,9 +26,8 @@ #define AUDIO_PORT_H #include -#include -#include -#include +#include +#include #include "MemoryManager.h" #include "PlayHandle.h" diff --git a/include/AudioPortAudio.h b/include/AudioPortAudio.h index 763703c33..2d78af1c4 100644 --- a/include/AudioPortAudio.h +++ b/include/AudioPortAudio.h @@ -25,7 +25,7 @@ #ifndef AUDIO_PORTAUDIO_H #define AUDIO_PORTAUDIO_H -#include +#include #include "lmmsconfig.h" #include "ComboBoxModel.h" @@ -48,7 +48,6 @@ public: #include -#include #include "AudioDevice.h" #include "AudioDeviceSetupWidget.h" diff --git a/include/AudioSampleRecorder.h b/include/AudioSampleRecorder.h index 76cb7e1a4..f5d5985c1 100644 --- a/include/AudioSampleRecorder.h +++ b/include/AudioSampleRecorder.h @@ -26,8 +26,8 @@ #ifndef AUDIO_SAMPLE_RECORDER_H #define AUDIO_SAMPLE_RECORDER_H -#include -#include +#include +#include #include "AudioDevice.h" diff --git a/include/AudioSdl.h b/include/AudioSdl.h index 1e6c03358..307973013 100644 --- a/include/AudioSdl.h +++ b/include/AudioSdl.h @@ -30,7 +30,6 @@ #ifdef LMMS_HAVE_SDL #ifdef LMMS_HAVE_SDL2 -#include #include #else #include diff --git a/include/AudioSoundIo.h b/include/AudioSoundIo.h index 171022032..082c4bfdb 100644 --- a/include/AudioSoundIo.h +++ b/include/AudioSoundIo.h @@ -25,10 +25,8 @@ #ifndef AUDIO_SOUNDIO_H #define AUDIO_SOUNDIO_H -#include #include "lmmsconfig.h" -#include "ComboBoxModel.h" #ifdef LMMS_HAVE_SOUNDIO diff --git a/include/AutomatableModel.h b/include/AutomatableModel.h index 88faeb4be..2f4b31467 100644 --- a/include/AutomatableModel.h +++ b/include/AutomatableModel.h @@ -25,8 +25,8 @@ #ifndef AUTOMATABLE_MODEL_H #define AUTOMATABLE_MODEL_H -#include -#include +#include +#include #include "JournallingObject.h" #include "Model.h" diff --git a/include/AutomationClip.h b/include/AutomationClip.h index f29a0ae02..22af90ed1 100644 --- a/include/AutomationClip.h +++ b/include/AutomationClip.h @@ -27,8 +27,8 @@ #ifndef AUTOMATION_CLIP_H #define AUTOMATION_CLIP_H -#include -#include +#include +#include #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; diff --git a/include/AutomationClipView.h b/include/AutomationClipView.h index 61e028899..641a58699 100644 --- a/include/AutomationClipView.h +++ b/include/AutomationClipView.h @@ -27,11 +27,10 @@ #include -#include "AutomationClip.h" -#include "Song.h" -#include "SongEditor.h" #include "ClipView.h" +class AutomationClip; + class AutomationClipView : public ClipView { diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 4be2756aa..c655ffcdf 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -26,7 +26,6 @@ #ifndef AUTOMATION_EDITOR_H #define AUTOMATION_EDITOR_H -#include #include #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; diff --git a/include/AutomationTrackView.h b/include/AutomationTrackView.h index 148c05b6f..5ed993213 100644 --- a/include/AutomationTrackView.h +++ b/include/AutomationTrackView.h @@ -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 { diff --git a/include/BBTrackContainer.h b/include/BBTrackContainer.h deleted file mode 100644 index dac67a39d..000000000 --- a/include/BBTrackContainer.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * BBTrackContainer.h - model-component of BB-Editor - * - * Copyright (c) 2004-2014 Tobias Doerffel - * - * 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 diff --git a/include/BasicFilters.h b/include/BasicFilters.h index 180a5c8af..07cdda06b 100644 --- a/include/BasicFilters.h +++ b/include/BasicFilters.h @@ -36,7 +36,7 @@ #define __USE_XOPEN #endif -#include +#include #include "lmms_basics.h" #include "lmms_constants.h" diff --git a/include/CPULoadWidget.h b/include/CPULoadWidget.h index 2bc41283b..a5da11663 100644 --- a/include/CPULoadWidget.h +++ b/include/CPULoadWidget.h @@ -27,7 +27,7 @@ #ifndef CPULOAD_WIDGET_H #define CPULOAD_WIDGET_H -#include +#include #include #include diff --git a/include/Clip.h b/include/Clip.h index 836e7cc9c..7b42fc91b 100644 --- a/include/Clip.h +++ b/include/Clip.h @@ -28,7 +28,6 @@ #include #include "AutomatableModel.h" -#include "lmms_basics.h" class Track; diff --git a/include/ClipView.h b/include/ClipView.h index d9fb520c8..b3fd20920 100644 --- a/include/ClipView.h +++ b/include/ClipView.h @@ -26,7 +26,7 @@ #define TRACK_CONTENT_OBJECT_VIEW_H -#include +#include #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 diff --git a/include/Clipboard.h b/include/Clipboard.h index f78e14321..168134e9d 100644 --- a/include/Clipboard.h +++ b/include/Clipboard.h @@ -25,7 +25,7 @@ #ifndef CLIPBOARD_H #define CLIPBOARD_H -#include +#include #include class QMimeData; diff --git a/include/ComboBoxModel.h b/include/ComboBoxModel.h index 09ad1238a..a3c2a082b 100644 --- a/include/ComboBoxModel.h +++ b/include/ComboBoxModel.h @@ -25,7 +25,6 @@ #ifndef COMBOBOX_MODEL_H #define COMBOBOX_MODEL_H -#include #include #include #include diff --git a/include/ConfigManager.h b/include/ConfigManager.h index 8630ef236..e9b2783ab 100644 --- a/include/ConfigManager.h +++ b/include/ConfigManager.h @@ -28,11 +28,11 @@ #include "lmmsconfig.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "lmms_export.h" diff --git a/include/ControllerConnection.h b/include/ControllerConnection.h index 4c5673c8d..68fd2dc89 100644 --- a/include/ControllerConnection.h +++ b/include/ControllerConnection.h @@ -30,8 +30,8 @@ #ifndef CONTROLLER_CONNECTION_H #define CONTROLLER_CONNECTION_H -#include -#include +#include +#include #include "Controller.h" #include "JournallingObject.h" diff --git a/include/Controls.h b/include/Controls.h index 236abbc11..414258368 100644 --- a/include/Controls.h +++ b/include/Controls.h @@ -26,7 +26,6 @@ #define CONTROLS_H -#include "Model.h" // headers only required for covariance #include "AutomatableModel.h" diff --git a/include/DataFile.h b/include/DataFile.h index 4050b1772..0600e85d4 100644 --- a/include/DataFile.h +++ b/include/DataFile.h @@ -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 UPGRADE_METHODS; diff --git a/include/DummyEffect.h b/include/DummyEffect.h index 92bfd5bdd..6bb8c873e 100644 --- a/include/DummyEffect.h +++ b/include/DummyEffect.h @@ -25,10 +25,14 @@ #ifndef DUMMY_EFFECT_H #define DUMMY_EFFECT_H +#include + #include "Effect.h" #include "EffectControls.h" #include "EffectControlDialog.h" +class Knob; + class DummyEffectControlDialog : public EffectControlDialog { diff --git a/include/DummyInstrument.h b/include/DummyInstrument.h index bbc112f96..ebfcfbefe 100644 --- a/include/DummyInstrument.h +++ b/include/DummyInstrument.h @@ -30,7 +30,7 @@ #include "InstrumentView.h" #include "Engine.h" -#include +#include #include "AudioEngine.h" diff --git a/include/EffectSelectDialog.h b/include/EffectSelectDialog.h index 3e81653dd..19e0ca05f 100644 --- a/include/EffectSelectDialog.h +++ b/include/EffectSelectDialog.h @@ -29,7 +29,6 @@ #include #include -#include "EffectChain.h" #include "Effect.h" diff --git a/include/Engine.h b/include/Engine.h index f11d3b19a..531e24220 100644 --- a/include/Engine.h +++ b/include/Engine.h @@ -26,8 +26,8 @@ #ifndef ENGINE_H #define ENGINE_H -#include -#include +#include +#include #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 diff --git a/include/EnvelopeAndLfoParameters.h b/include/EnvelopeAndLfoParameters.h index 0f691adb0..42502800e 100644 --- a/include/EnvelopeAndLfoParameters.h +++ b/include/EnvelopeAndLfoParameters.h @@ -25,7 +25,7 @@ #ifndef ENVELOPE_AND_LFO_PARAMETERS_H #define ENVELOPE_AND_LFO_PARAMETERS_H -#include +#include #include "JournallingObject.h" #include "AutomatableModel.h" diff --git a/include/ExportFilter.h b/include/ExportFilter.h index dc33c2aa2..e60faef3a 100644 --- a/include/ExportFilter.h +++ b/include/ExportFilter.h @@ -26,7 +26,7 @@ #ifndef EXPORT_FILTER_H #define EXPORT_FILTER_H -#include +#include #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: diff --git a/include/FifoBuffer.h b/include/FifoBuffer.h index e41d5caac..5bbf8b702 100644 --- a/include/FifoBuffer.h +++ b/include/FifoBuffer.h @@ -25,7 +25,7 @@ #ifndef FIFO_BUFFER_H #define FIFO_BUFFER_H -#include +#include template diff --git a/include/FileBrowser.h b/include/FileBrowser.h index 2e26199fc..d99c619e9 100644 --- a/include/FileBrowser.h +++ b/include/FileBrowser.h @@ -27,8 +27,8 @@ #define FILE_BROWSER_H #include -#include -#include +#include +#include #include diff --git a/include/GuiApplication.h b/include/GuiApplication.h index 5aad783ac..562358eeb 100644 --- a/include/GuiApplication.h +++ b/include/GuiApplication.h @@ -25,7 +25,7 @@ #ifndef GUIAPPLICATION_H #define GUIAPPLICATION_H -#include +#include #include "lmms_export.h" #include "lmmsconfig.h" @@ -33,12 +33,12 @@ class QLabel; class AutomationEditorWindow; -class BBEditor; class ControllerRackView; class GrooveView; class MixerView; class MainWindow; class MicrotunerConfig; +class PatternEditorWindow; class PianoRollWindow; class ProjectNotes; class SongEditorWindow; @@ -59,7 +59,7 @@ public: GrooveView* grooveView() { return m_grooveView; } 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; } @@ -80,7 +80,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; diff --git a/include/ImportFilter.h b/include/ImportFilter.h index ccefd3db2..ef58cce24 100644 --- a/include/ImportFilter.h +++ b/include/ImportFilter.h @@ -26,7 +26,7 @@ #ifndef IMPORT_FILTER_H #define IMPORT_FILTER_H -#include +#include #include "Plugin.h" diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index aa622fa86..c183a6f2d 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -36,10 +36,8 @@ #include "MidiPort.h" #include "NotePlayHandle.h" #include "Piano.h" -#include "Pitch.h" #include "Plugin.h" #include "Track.h" -#include "TrackView.h" class Instrument; diff --git a/include/InstrumentTrackView.h b/include/InstrumentTrackView.h index d5e82689d..d863d6c19 100644 --- a/include/InstrumentTrackView.h +++ b/include/InstrumentTrackView.h @@ -28,11 +28,11 @@ #include "TrackView.h" #include "InstrumentTrack.h" -#include "MidiCCRackView.h" class InstrumentTrackWindow; class Knob; +class MidiCCRackView; class TrackContainerView; class TrackLabelButton; diff --git a/include/JournallingObject.h b/include/JournallingObject.h index f4755994b..9e0322591 100644 --- a/include/JournallingObject.h +++ b/include/JournallingObject.h @@ -25,7 +25,7 @@ #ifndef JOURNALLING_OBJECT_H #define JOURNALLING_OBJECT_H -#include +#include #include "lmms_basics.h" #include "SerializingObject.h" diff --git a/include/Keymap.h b/include/Keymap.h index 692860343..08a27c473 100644 --- a/include/Keymap.h +++ b/include/Keymap.h @@ -29,7 +29,6 @@ #include #include -#include "Note.h" #include "SerializingObject.h" class Keymap : public QObject, public SerializingObject diff --git a/include/Knob.h b/include/Knob.h index 91aa6b478..f27328aa9 100644 --- a/include/Knob.h +++ b/include/Knob.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include "AutomatableModelView.h" diff --git a/include/LadspaManager.h b/include/LadspaManager.h index f9ac76eae..b345578d4 100644 --- a/include/LadspaManager.h +++ b/include/LadspaManager.h @@ -30,10 +30,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include "lmms_export.h" diff --git a/include/LcdWidget.h b/include/LcdWidget.h index 7dc2e2a28..a04e7ae91 100644 --- a/include/LcdWidget.h +++ b/include/LcdWidget.h @@ -26,7 +26,7 @@ #ifndef LCD_WIDGET_H #define LCD_WIDGET_H -#include +#include #include #include "lmms_export.h" diff --git a/include/LeftRightNav.h b/include/LeftRightNav.h index 935853054..4f3f4ecbb 100644 --- a/include/LeftRightNav.h +++ b/include/LeftRightNav.h @@ -27,7 +27,6 @@ #include "PixmapButton.h" -#include class LeftRightNav : public QWidget { diff --git a/include/LinkedModelGroupViews.h b/include/LinkedModelGroupViews.h index 46ba4c3ab..a70480d5c 100644 --- a/include/LinkedModelGroupViews.h +++ b/include/LinkedModelGroupViews.h @@ -28,7 +28,6 @@ #include #include -#include #include diff --git a/include/LinkedModelGroups.h b/include/LinkedModelGroups.h index 686f09cba..770518076 100644 --- a/include/LinkedModelGroups.h +++ b/include/LinkedModelGroups.h @@ -27,8 +27,6 @@ #include -#include -#include #include "Model.h" diff --git a/include/LocklessAllocator.h b/include/LocklessAllocator.h index e7e265680..d7977480e 100644 --- a/include/LocklessAllocator.h +++ b/include/LocklessAllocator.h @@ -26,7 +26,7 @@ #define LOCKLESS_ALLOCATOR_H #include -#include +#include class LocklessAllocator { diff --git a/include/Lv2ControlBase.h b/include/Lv2ControlBase.h index de90960dc..6b72bec5d 100644 --- a/include/Lv2ControlBase.h +++ b/include/Lv2ControlBase.h @@ -30,6 +30,7 @@ #ifdef LMMS_HAVE_LV2 #include +#include #include "DataFile.h" #include "LinkedModelGroups.h" diff --git a/include/Lv2Features.h b/include/Lv2Features.h index f036c6d1f..272bb3a4d 100644 --- a/include/Lv2Features.h +++ b/include/Lv2Features.h @@ -29,7 +29,6 @@ #ifdef LMMS_HAVE_LV2 -#include #include #include #include "Lv2Manager.h" diff --git a/include/Lv2Proc.h b/include/Lv2Proc.h index a80c10e3f..06185a9ac 100644 --- a/include/Lv2Proc.h +++ b/include/Lv2Proc.h @@ -31,18 +31,17 @@ #include #include -#include #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 { diff --git a/include/Lv2UridCache.h b/include/Lv2UridCache.h index 1921bdfd7..e50fd4bab 100644 --- a/include/Lv2UridCache.h +++ b/include/Lv2UridCache.h @@ -29,7 +29,6 @@ #ifdef LMMS_HAVE_LV2 -#include #include //! Cached URIDs for fast access (for use in real-time code) diff --git a/include/Lv2ViewBase.h b/include/Lv2ViewBase.h index 5ccbbb75b..6eafbde88 100644 --- a/include/Lv2ViewBase.h +++ b/include/Lv2ViewBase.h @@ -30,8 +30,6 @@ #ifdef LMMS_HAVE_LV2 -#include -#include #include "LinkedModelGroupViews.h" #include "lmms_export.h" diff --git a/include/MainWindow.h b/include/MainWindow.h index a23c3516a..dab2483e4 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -25,13 +25,12 @@ #ifndef MAIN_WINDOW_H #define MAIN_WINDOW_H -#include -#include -#include +#include +#include +#include #include #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(); diff --git a/include/Microtuner.h b/include/Microtuner.h index 93998369c..9ac732817 100644 --- a/include/Microtuner.h +++ b/include/Microtuner.h @@ -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 { diff --git a/include/MicrotunerConfig.h b/include/MicrotunerConfig.h index 00783af4b..58752026c 100644 --- a/include/MicrotunerConfig.h +++ b/include/MicrotunerConfig.h @@ -25,17 +25,16 @@ #ifndef MICROTUNER_CONFIG_H #define MICROTUNER_CONFIG_H -#include -#include -#include -#include + +#include #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 diff --git a/include/MidiAlsaRaw.h b/include/MidiAlsaRaw.h index 69f9366f1..60bf1e685 100644 --- a/include/MidiAlsaRaw.h +++ b/include/MidiAlsaRaw.h @@ -31,7 +31,8 @@ #include -#include +#include +#include #include "MidiClient.h" diff --git a/include/MidiAlsaSeq.h b/include/MidiAlsaSeq.h index 5db5357d8..bbb3f7242 100644 --- a/include/MidiAlsaSeq.h +++ b/include/MidiAlsaSeq.h @@ -30,9 +30,10 @@ #ifdef LMMS_HAVE_ALSA #include -#include -#include -#include +#include +#include +#include +#include #include "MidiClient.h" diff --git a/include/MidiCCRackView.h b/include/MidiCCRackView.h index 9d015e4e8..982e06048 100644 --- a/include/MidiCCRackView.h +++ b/include/MidiCCRackView.h @@ -3,12 +3,12 @@ #include -#include "GroupBox.h" -#include "Knob.h" #include "Midi.h" #include "SerializingObject.h" +class GroupBox; class InstrumentTrack; +class Knob; class MidiCCRackView : public QWidget, public SerializingObject { diff --git a/include/MidiClient.h b/include/MidiClient.h index ff441e24f..384a664ce 100644 --- a/include/MidiClient.h +++ b/include/MidiClient.h @@ -25,16 +25,16 @@ #ifndef MIDI_CLIENT_H #define MIDI_CLIENT_H -#include -#include +#include +#include #include "MidiEvent.h" -#include "MidiEventProcessor.h" -#include "TabWidget.h" class MidiPort; +class QObject; +class TimePos; // base-class for all MIDI-clients diff --git a/include/MidiClip.h b/include/MidiClip.h index b39e366f5..036f2771c 100644 --- a/include/MidiClip.h +++ b/include/MidiClip.h @@ -26,11 +26,9 @@ #ifndef MIDI_CLIP_H #define MIDI_CLIP_H -#include +#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: diff --git a/include/MidiClipView.h b/include/MidiClipView.h index 179486bf0..82e552a8c 100644 --- a/include/MidiClipView.h +++ b/include/MidiClipView.h @@ -25,7 +25,8 @@ #ifndef MIDI_CLIP_VIEW_H #define MIDI_CLIP_VIEW_H -#include "MidiClip.h" +#include + #include "ClipView.h" class MidiClip; @@ -93,7 +94,7 @@ private: QStaticText m_staticTextName; - bool m_legacySEBB; + bool m_legacySEPattern; } ; diff --git a/include/MidiJack.h b/include/MidiJack.h index 66525c3a9..f12f9cebf 100644 --- a/include/MidiJack.h +++ b/include/MidiJack.h @@ -35,15 +35,13 @@ #include "weak_libjack.h" #endif -#include -#include -#include +#include #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 diff --git a/include/MidiOss.h b/include/MidiOss.h index 7e1f179ef..68b970bc5 100644 --- a/include/MidiOss.h +++ b/include/MidiOss.h @@ -29,8 +29,8 @@ #ifdef LMMS_HAVE_OSS -#include -#include +#include +#include #include "MidiClient.h" diff --git a/include/MidiPort.h b/include/MidiPort.h index d5797a3e6..b057f5d6c 100644 --- a/include/MidiPort.h +++ b/include/MidiPort.h @@ -26,9 +26,9 @@ #ifndef MIDI_PORT_H #define MIDI_PORT_H -#include -#include -#include +#include +#include +#include #include "Midi.h" #include "TimePos.h" diff --git a/include/MidiSetupWidget.h b/include/MidiSetupWidget.h index d740c0290..fcaa29408 100644 --- a/include/MidiSetupWidget.h +++ b/include/MidiSetupWidget.h @@ -25,7 +25,6 @@ #ifndef MIDISETUPWIDGET_H #define MIDISETUPWIDGET_H -#include #include "TabWidget.h" diff --git a/include/MidiSndio.h b/include/MidiSndio.h index 14ecfa0e9..2042a16ad 100644 --- a/include/MidiSndio.h +++ b/include/MidiSndio.h @@ -30,10 +30,8 @@ #ifdef LMMS_HAVE_SNDIO -#include -#include +#include -#include #include "MidiClient.h" diff --git a/include/MixerLine.h b/include/MixerLine.h index 47c3ccf5e..4f7f7242f 100644 --- a/include/MixerLine.h +++ b/include/MixerLine.h @@ -26,18 +26,15 @@ #ifndef MIXER_LINE_H #define MIXER_LINE_H -#include -#include -#include #include -#include "ColorChooser.h" -#include "Knob.h" -#include "LcdWidget.h" -#include "SendButtonIndicator.h" +class QGraphicsView; +class QLineEdit; +class Knob; +class LcdWidget; class MixerView; class SendButtonIndicator; diff --git a/include/Model.h b/include/Model.h index b40c21029..623d3a9f9 100644 --- a/include/Model.h +++ b/include/Model.h @@ -25,8 +25,8 @@ #ifndef MODEL_H #define MODEL_H -#include -#include +#include +#include #include "lmms_export.h" diff --git a/include/ModelView.h b/include/ModelView.h index 04229ed0d..7aad9ce7f 100644 --- a/include/ModelView.h +++ b/include/ModelView.h @@ -25,7 +25,7 @@ #ifndef MODEL_VIEW_H #define MODEL_VIEW_H -#include +#include #include "Model.h" diff --git a/include/NStateButton.h b/include/NStateButton.h index 95d36c253..10cb151ae 100644 --- a/include/NStateButton.h +++ b/include/NStateButton.h @@ -27,8 +27,8 @@ #define NSTATE_BUTTON_H #include -#include -#include +#include +#include #include "ToolButton.h" diff --git a/include/Note.h b/include/Note.h index 219884471..31ba6995e 100644 --- a/include/Note.h +++ b/include/Note.h @@ -26,7 +26,7 @@ #ifndef NOTE_H #define NOTE_H -#include +#include #include "volume.h" #include "panning.h" diff --git a/include/NotePlayHandle.h b/include/NotePlayHandle.h index 1ba07b33f..778acd46e 100644 --- a/include/NotePlayHandle.h +++ b/include/NotePlayHandle.h @@ -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 diff --git a/include/Oscillator.h b/include/Oscillator.h index 4b1db9787..da9bea4eb 100644 --- a/include/Oscillator.h +++ b/include/Oscillator.h @@ -28,11 +28,7 @@ #include #include -#include - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif +#include #include "Engine.h" #include "lmms_constants.h" diff --git a/include/BBClip.h b/include/PatternClip.h similarity index 75% rename from include/BBClip.h rename to include/PatternClip.h index f073fca49..a6543267b 100644 --- a/include/BBClip.h +++ b/include/PatternClip.h @@ -1,5 +1,5 @@ /* - * BBClip.h + * PatternClip.h * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -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 \ No newline at end of file +#endif diff --git a/include/BBClipView.h b/include/PatternClipView.h similarity index 80% rename from include/BBClipView.h rename to include/PatternClipView.h index a779ca680..9cda17688 100644 --- a/include/BBClipView.h +++ b/include/PatternClipView.h @@ -1,5 +1,5 @@ /* - * BBClipView.h + * PatternClipView.h * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -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 +#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 \ No newline at end of file +#endif diff --git a/include/BBEditor.h b/include/PatternEditor.h similarity index 70% rename from include/BBEditor.h rename to include/PatternEditor.h index e13097e59..03861c1b0 100644 --- a/include/BBEditor.h +++ b/include/PatternEditor.h @@ -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 * @@ -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 diff --git a/include/PatternStore.h b/include/PatternStore.h new file mode 100644 index 000000000..e11328c16 --- /dev/null +++ b/include/PatternStore.h @@ -0,0 +1,108 @@ +/* + * PatternStore.h - model-component of Pattern Editor + * + * Copyright (c) 2004-2014 Tobias Doerffel + * + * 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 diff --git a/include/BBTrack.h b/include/PatternTrack.h similarity index 76% rename from include/BBTrack.h rename to include/PatternTrack.h index c07c8a90e..c594b4cf5 100644 --- a/include/BBTrack.h +++ b/include/PatternTrack.h @@ -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 * @@ -24,25 +23,25 @@ */ -#ifndef BB_TRACK_H -#define BB_TRACK_H +#ifndef PATTERN_TRACK_H +#define PATTERN_TRACK_H -#include +#include -#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 m_disabledTracks; - typedef QMap infoMap; + typedef QMap infoMap; static infoMap s_infoMap; - friend class BBTrackView; + friend class PatternTrackView; } ; diff --git a/include/BBTrackView.h b/include/PatternTrackView.h similarity index 74% rename from include/BBTrackView.h rename to include/PatternTrackView.h index 86c10cd30..ecc209f04 100644 --- a/include/BBTrackView.h +++ b/include/PatternTrackView.h @@ -1,5 +1,5 @@ /* - * BBTrackView.h + * PatternTrackView.h * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -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 -#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 \ No newline at end of file +#endif diff --git a/include/PeakController.h b/include/PeakController.h index df3902ab2..341d4f47a 100644 --- a/include/PeakController.h +++ b/include/PeakController.h @@ -25,7 +25,6 @@ #ifndef PEAK_CONTROLLER_H #define PEAK_CONTROLLER_H -#include "Model.h" #include "Controller.h" #include "ControllerDialog.h" diff --git a/include/PerfLog.h b/include/PerfLog.h index f9790113d..5d1efc14c 100644 --- a/include/PerfLog.h +++ b/include/PerfLog.h @@ -26,7 +26,7 @@ #define PERFLOG_H #include -#include +#include /// \brief CPU time point /// diff --git a/include/PianoRoll.h b/include/PianoRoll.h index a288b9adc..f00e8a79c 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -29,7 +29,6 @@ #include #include -#include #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 diff --git a/include/PlayHandle.h b/include/PlayHandle.h index 1ddd632d1..6de358acd 100644 --- a/include/PlayHandle.h +++ b/include/PlayHandle.h @@ -25,12 +25,11 @@ #ifndef PLAY_HANDLE_H #define PLAY_HANDLE_H -#include -#include +#include +#include #include "lmms_export.h" -#include "MemoryManager.h" #include "ThreadableJob.h" #include "lmms_basics.h" diff --git a/include/Plugin.h b/include/Plugin.h index fb7e592bd..fb9ebd567 100644 --- a/include/Plugin.h +++ b/include/Plugin.h @@ -25,9 +25,8 @@ #ifndef PLUGIN_H #define PLUGIN_H -#include -#include -#include +#include +#include #include "JournallingObject.h" #include "Model.h" diff --git a/include/PluginBrowser.h b/include/PluginBrowser.h index fa13f2469..67467edbb 100644 --- a/include/PluginBrowser.h +++ b/include/PluginBrowser.h @@ -25,7 +25,6 @@ #ifndef PLUGIN_BROWSER_H #define PLUGIN_BROWSER_H -#include #include #include "SideBarWidget.h" diff --git a/include/PluginFactory.h b/include/PluginFactory.h index a1f84f8d1..80627f351 100644 --- a/include/PluginFactory.h +++ b/include/PluginFactory.h @@ -28,11 +28,10 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include "lmms_export.h" #include "Plugin.h" diff --git a/include/ProjectJournal.h b/include/ProjectJournal.h index d19d02d7e..f8b9e642b 100644 --- a/include/ProjectJournal.h +++ b/include/ProjectJournal.h @@ -25,8 +25,8 @@ #ifndef PROJECT_JOURNAL_H #define PROJECT_JOURNAL_H -#include -#include +#include +#include #include "lmms_basics.h" #include "DataFile.h" diff --git a/include/ProjectNotes.h b/include/ProjectNotes.h index fc97a8844..03add4b04 100644 --- a/include/ProjectNotes.h +++ b/include/ProjectNotes.h @@ -27,7 +27,6 @@ #define PROJECT_NOTES_H #include -#include #include "SerializingObject.h" diff --git a/include/ProjectVersion.h b/include/ProjectVersion.h index 94ee9c6ba..d72704ba3 100644 --- a/include/ProjectVersion.h +++ b/include/ProjectVersion.h @@ -27,8 +27,8 @@ #ifndef PROJECT_VERSION_H #define PROJECT_VERSION_H -#include -#include +#include +#include #include diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index fd3ef5e09..693853955 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -36,7 +36,6 @@ #include #include - #if !(defined(LMMS_HAVE_SYS_IPC_H) && defined(LMMS_HAVE_SEMAPHORE_H)) #define SYNC_WITH_SHM_FIFO #define USE_QT_SEMAPHORES @@ -45,8 +44,8 @@ #include #endif -#include -#include +#include +#include #endif @@ -59,8 +58,8 @@ #else #define USE_QT_SHMEM -#include -#include +#include +#include #if !defined(LMMS_HAVE_SYS_TYPES_H) || defined(LMMS_BUILD_WIN32) typedef int32_t key_t; @@ -69,7 +68,7 @@ typedef int32_t key_t; #ifdef LMMS_HAVE_LOCALE_H -#include +#include #endif #ifdef LMMS_HAVE_PTHREAD_H @@ -89,10 +88,10 @@ typedef int32_t key_t; #else #include "lmms_export.h" -#include -#include -#include -#include +#include +#include +#include +#include #ifndef SYNC_WITH_SHM_FIFO #include @@ -440,6 +439,7 @@ enum RemoteMessageIDs IdSavePresetFile, IdLoadPresetFile, IdDebugMessage, + IdIdle, IdUserBase = 64 } ; @@ -1000,7 +1000,6 @@ private: sample_rate_t m_sampleRate; fpp_t m_bufferSize; - } ; #endif @@ -1012,7 +1011,7 @@ private: #ifdef COMPILE_REMOTE_PLUGIN_BASE #ifndef BUILD_REMOTE_PLUGIN_CLIENT -#include +#include #endif diff --git a/include/RingBuffer.h b/include/RingBuffer.h index c7e91bd33..46539c0ea 100644 --- a/include/RingBuffer.h +++ b/include/RingBuffer.h @@ -27,9 +27,9 @@ #ifndef RINGBUFFER_H #define RINGBUFFER_H +#include #include #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. diff --git a/include/Rubberband.h b/include/Rubberband.h index eeb3c7e5b..21e699d85 100644 --- a/include/Rubberband.h +++ b/include/Rubberband.h @@ -28,7 +28,7 @@ #define RUBBERBAND_H #include -#include +#include 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(); } diff --git a/include/SampleBuffer.h b/include/SampleBuffer.h index d1e594b2c..991d9d140 100644 --- a/include/SampleBuffer.h +++ b/include/SampleBuffer.h @@ -27,8 +27,8 @@ #define SAMPLE_BUFFER_H #include -#include -#include +#include +#include #include diff --git a/include/SampleClip.h b/include/SampleClip.h index fd98b45db..7c4f9cf60 100644 --- a/include/SampleClip.h +++ b/include/SampleClip.h @@ -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 \ No newline at end of file +#endif diff --git a/include/SampleClipView.h b/include/SampleClipView.h index 045e2822d..c18e6ab5a 100644 --- a/include/SampleClipView.h +++ b/include/SampleClipView.h @@ -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 \ No newline at end of file +#endif diff --git a/include/SamplePlayHandle.h b/include/SamplePlayHandle.h index 367a9a25a..04360a26e 100644 --- a/include/SamplePlayHandle.h +++ b/include/SamplePlayHandle.h @@ -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; } ; diff --git a/include/SampleRecordHandle.h b/include/SampleRecordHandle.h index 3921b1976..f5ebb2201 100644 --- a/include/SampleRecordHandle.h +++ b/include/SampleRecordHandle.h @@ -26,13 +26,13 @@ #ifndef SAMPLE_RECORD_HANDLE_H #define SAMPLE_RECORD_HANDLE_H -#include -#include +#include +#include #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; } ; diff --git a/include/SampleTrack.h b/include/SampleTrack.h index 54ba92953..5ca5741b8 100644 --- a/include/SampleTrack.h +++ b/include/SampleTrack.h @@ -25,13 +25,8 @@ #ifndef SAMPLE_TRACK_H #define SAMPLE_TRACK_H -#include #include "AudioPort.h" -#include "FadeButton.h" -#include "Mixer.h" -#include "SampleClip.h" -#include "SampleTrackView.h" #include "Track.h" diff --git a/include/SampleTrackView.h b/include/SampleTrackView.h index 13127308c..7d3e550c2 100644 --- a/include/SampleTrackView.h +++ b/include/SampleTrackView.h @@ -25,7 +25,6 @@ #ifndef SAMPLE_TRACK_VIEW_H #define SAMPLE_TRACK_VIEW_H -#include "SampleTrack.h" #include "TrackView.h" diff --git a/include/SampleTrackWindow.h b/include/SampleTrackWindow.h index c5b3648db..85c175564 100644 --- a/include/SampleTrackWindow.h +++ b/include/SampleTrackWindow.h @@ -26,12 +26,19 @@ #ifndef SAMPLE_TRACK_WINDOW_H #define SAMPLE_TRACK_WINDOW_H -#include "MixerLineLcdSpinBox.h" -#include -#include "EffectRackView.h" +#include + +#include "ModelView.h" #include "SampleTrack.h" +#include "SerializingObject.h" + +class EffectRackView; +class Knob; +class MixerLineLcdSpinBox; +class QLineEdit; +class SampleTrackView; class SampleTrackWindow : public QWidget, public ModelView, public SerializingObjectHook @@ -89,4 +96,4 @@ private: -#endif \ No newline at end of file +#endif diff --git a/include/Scale.h b/include/Scale.h index 5d3715022..a9321fe40 100644 --- a/include/Scale.h +++ b/include/Scale.h @@ -25,7 +25,6 @@ #ifndef SCALE_H #define SCALE_H -#include #include #include #include diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index e8181f45d..33d8cac64 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -1,13 +1,10 @@ #ifndef SENDBUTTONINDICATOR_H #define SENDBUTTONINDICATOR_H -#include #include -#include -#include "MixerLine.h" -#include "MixerView.h" +class FloatModel; class MixerLine; class MixerView; diff --git a/include/SerializingObject.h b/include/SerializingObject.h index fbcda9187..aba8c7b0f 100644 --- a/include/SerializingObject.h +++ b/include/SerializingObject.h @@ -25,7 +25,7 @@ #ifndef SERIALIZING_OBJECT_H #define SERIALIZING_OBJECT_H -#include +#include #include "lmms_export.h" diff --git a/include/SetupDialog.h b/include/SetupDialog.h index 760d86fbc..c0581dffd 100644 --- a/include/SetupDialog.h +++ b/include/SetupDialog.h @@ -27,7 +27,7 @@ #define SETUP_DIALOG_H #include -#include +#include #include "AudioDevice.h" #include "AudioDeviceSetupWidget.h" diff --git a/include/SideBar.h b/include/SideBar.h index aab126ae3..7ed52efc3 100644 --- a/include/SideBar.h +++ b/include/SideBar.h @@ -25,7 +25,7 @@ #ifndef SIDE_BAR_H #define SIDE_BAR_H -#include +#include #include #include diff --git a/include/SideBarWidget.h b/include/SideBarWidget.h index 9972daa7c..95c6ab9ed 100644 --- a/include/SideBarWidget.h +++ b/include/SideBarWidget.h @@ -28,7 +28,8 @@ #include #include #include -#include + +class QPushButton; class SideBarWidget : public QWidget diff --git a/include/Song.h b/include/Song.h index d8c315f65..88a491873 100644 --- a/include/Song.h +++ b/include/Song.h @@ -26,26 +26,23 @@ #define SONG_H #include -#include -#include -#include #include #include #include "TrackContainer.h" #include "AudioEngine.h" #include "Controller.h" -#include "Keymap.h" #include "lmms_constants.h" #include "MeterModel.h" -#include "Scale.h" #include "VstSyncController.h" #include "Groove.h" class AutomationTrack; +class Keymap; class MidiClip; +class Scale; class TimeLineWidget; class Groove; @@ -67,7 +64,7 @@ public: { Mode_None, Mode_PlaySong, - Mode_PlayBB, + Mode_PlayPattern, Mode_PlayMidiClip, Mode_PlayAutomationClip, Mode_Count @@ -371,7 +368,7 @@ public slots: void playSong(); void record(); void playAndRecord(); - void playBB(); + void playPattern(); void playMidiClip( const MidiClip * midiClipToPlay, bool loop = true ); void togglePause(); void stop(); @@ -385,7 +382,7 @@ public slots: void clearProject(); - void addBBTrack(); + void addPatternTrack(); private slots: diff --git a/include/SongEditor.h b/include/SongEditor.h index 41b732ddd..db52f7352 100644 --- a/include/SongEditor.h +++ b/include/SongEditor.h @@ -27,22 +27,20 @@ #ifndef SONG_EDITOR_H #define SONG_EDITOR_H -#include -#include -#include "ActionGroup.h" #include "Editor.h" #include "TrackContainerView.h" -#include "PositionLine.h" class QLabel; class QScrollBar; +class ActionGroup; class AutomatableSlider; class ComboBox; class ComboBoxModel; class LcdSpinBox; class MeterDialog; +class PositionLine; class Song; class TextFloat; class TimeLineWidget; @@ -198,7 +196,7 @@ signals: void resized(); private: - QAction* m_addBBTrackAction; + QAction* m_addPatternTrackAction; QAction* m_addSampleTrackAction; QAction* m_addAutomationTrackAction; QAction* m_setProportionalSnapAction; diff --git a/include/StepRecorder.h b/include/StepRecorder.h index 99b008bd1..864faef4b 100644 --- a/include/StepRecorder.h +++ b/include/StepRecorder.h @@ -21,16 +21,17 @@ #ifndef STEP_RECORDER_H #define STEP_RECORDER_H +#include #include #include #include -#include #include "Note.h" -#include "lmms_basics.h" -#include "MidiClip.h" +class MidiClip; class PianoRoll; +class QKeyEvent; +class QMouseEvent; class StepRecorderWidget; class StepRecorder : public QObject diff --git a/include/StepRecorderWidget.h b/include/StepRecorderWidget.h index dfaeaed0a..512ab5b35 100644 --- a/include/StepRecorderWidget.h +++ b/include/StepRecorderWidget.h @@ -22,12 +22,11 @@ #ifndef STEP_RECOREDER_WIDGET_H #define STEP_RECOREDER_WIDGET_H -#include "lmms_basics.h" -#include "Note.h" #include #include -#include + +#include "TimePos.h" class StepRecorderWidget : public QWidget { diff --git a/include/SubWindow.h b/include/SubWindow.h index e2b1a9a37..113db636a 100644 --- a/include/SubWindow.h +++ b/include/SubWindow.h @@ -26,16 +26,15 @@ #ifndef SUBWINDOW_H #define SUBWINDOW_H -#include -#include #include -#include -#include #include #include "lmms_export.h" +class QGraphicsDropShadowEffect; +class QLabel; class QMoveEvent; +class QPushButton; class QResizeEvent; class QWidget; diff --git a/include/TabBar.h b/include/TabBar.h index 48b429bd5..46226618b 100644 --- a/include/TabBar.h +++ b/include/TabBar.h @@ -26,8 +26,8 @@ #ifndef TAB_BAR_H #define TAB_BAR_H -#include -#include +#include +#include #include #include "lmms_export.h" diff --git a/include/TabWidget.h b/include/TabWidget.h index 4442ef643..d4a3ec3c9 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -27,7 +27,7 @@ #define TAB_WIDGET_H #include -#include +#include const int TEXT_TAB_HEIGHT = 14; const int GRAPHIC_TAB_HEIGHT = 17; diff --git a/include/TempoSyncKnob.h b/include/TempoSyncKnob.h index 12851f6e5..3e9fc9738 100644 --- a/include/TempoSyncKnob.h +++ b/include/TempoSyncKnob.h @@ -27,7 +27,7 @@ #define TEMPO_SYNC_KNOB_H #include -#include +#include #include "Knob.h" #include "TempoSyncKnobModel.h" diff --git a/include/TimePos.h b/include/TimePos.h index 675416c42..8b758d9b4 100644 --- a/include/TimePos.h +++ b/include/TimePos.h @@ -27,7 +27,6 @@ #ifndef TIME_POS_H #define TIME_POS_H -#include #include "lmms_export.h" #include "lmms_basics.h" diff --git a/include/ToolButton.h b/include/ToolButton.h index 196ec48f0..2f64d45b8 100644 --- a/include/ToolButton.h +++ b/include/ToolButton.h @@ -27,7 +27,6 @@ #define TOOL_BUTTON_H #include -#include class ToolButton : public QToolButton diff --git a/include/Track.h b/include/Track.h index 9c68808b8..d00ac3783 100644 --- a/include/Track.h +++ b/include/Track.h @@ -26,7 +26,7 @@ #define TRACK_H -#include +#include #include #include "AutomatableModel.h" @@ -65,7 +65,7 @@ public: enum TrackTypes { InstrumentTrack, - BBTrack, + PatternTrack, SampleTrack, EventTrack, VideoTrack, @@ -127,7 +127,7 @@ public: const TimePos & end ); void swapPositionOfClips( int clipNum1, int clipNum2 ); - void createClipsForBB( int bb ); + void createClipsForPattern(int pattern); void insertBar( const TimePos & pos ); diff --git a/include/TrackContainer.h b/include/TrackContainer.h index 67cd90f85..18139a0da 100644 --- a/include/TrackContainer.h +++ b/include/TrackContainer.h @@ -1,6 +1,6 @@ /* * TrackContainer.h - base-class for all track-containers like Song-Editor, - * BB-Editor... + * Pattern Editor... * * Copyright (c) 2004-2009 Tobias Doerffel * @@ -26,7 +26,7 @@ #ifndef TRACK_CONTAINER_H #define TRACK_CONTAINER_H -#include +#include #include "Track.h" #include "JournallingObject.h" @@ -44,7 +44,7 @@ public: typedef QVector TrackList; enum TrackContainerTypes { - BBContainer, + PatternContainer, SongContainer } ; diff --git a/include/TrackContainerView.h b/include/TrackContainerView.h index f6ad177b9..00267bfe8 100644 --- a/include/TrackContainerView.h +++ b/include/TrackContainerView.h @@ -26,7 +26,7 @@ #ifndef TRACK_CONTAINER_VIEW_H #define TRACK_CONTAINER_VIEW_H -#include +#include #include #include #include @@ -34,13 +34,15 @@ #include "JournallingObject.h" #include "ModelView.h" #include "Rubberband.h" -#include "TrackView.h" +#include "TimePos.h" class QVBoxLayout; class InstrumentTrack; +class Track; class TrackContainer; +class TrackView; class TrackContainerView : public QWidget, public ModelView, diff --git a/include/TrackLabelButton.h b/include/TrackLabelButton.h index 7d9726feb..a46f418e9 100644 --- a/include/TrackLabelButton.h +++ b/include/TrackLabelButton.h @@ -27,7 +27,6 @@ #define TRACK_LABEL_BUTTON_H #include -#include class TrackView; diff --git a/include/TrackView.h b/include/TrackView.h index eff541308..4467ecbdb 100644 --- a/include/TrackView.h +++ b/include/TrackView.h @@ -50,8 +50,6 @@ const int TRACK_OP_WIDTH = 78; const int DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT = 96; const int TRACK_OP_WIDTH_COMPACT = 62; -const int CLIP_BORDER_WIDTH = 2; - class TrackView : public QWidget, public ModelView, public JournallingObject { diff --git a/include/VstSyncController.h b/include/VstSyncController.h index 33f2ee036..7ed0e4999 100644 --- a/include/VstSyncController.h +++ b/include/VstSyncController.h @@ -26,8 +26,8 @@ #ifndef VST_SYNC_CONTROLLER_H #define VST_SYNC_CONTROLLER_H -#include -#include +#include +#include #include "VstSyncData.h" diff --git a/include/aeffectx.h b/include/aeffectx.h index 615972701..7cdfcfe7d 100644 --- a/include/aeffectx.h +++ b/include/aeffectx.h @@ -30,7 +30,11 @@ #include // Calling convention +#ifdef _WIN32 #define VST_CALL_CONV __cdecl +#else +#define VST_CALL_CONV +#endif template constexpr int32_t CCONST(T a, T b, T c, T d) diff --git a/include/base64.h b/include/base64.h index 688a12ef8..a0557fe0d 100644 --- a/include/base64.h +++ b/include/base64.h @@ -26,9 +26,9 @@ #ifndef _BASE64_H #define _BASE64_H -#include -#include -#include +#include +#include +#include namespace base64 diff --git a/include/embed.h b/include/embed.h index aa224580e..ea3e3417e 100644 --- a/include/embed.h +++ b/include/embed.h @@ -26,7 +26,7 @@ #define EMBED_H #include -#include +#include #include "lmms_export.h" #include "lmms_basics.h" diff --git a/include/endian_handling.h b/include/endian_handling.h index 06e9d8244..09953a0ac 100644 --- a/include/endian_handling.h +++ b/include/endian_handling.h @@ -25,7 +25,7 @@ #ifndef ENDIAN_HANDLING_H #define ENDIAN_HANDLING_H -#include +#include #include "lmms_basics.h" diff --git a/include/interpolation.h b/include/interpolation.h index c2bc8421d..cb324cd76 100644 --- a/include/interpolation.h +++ b/include/interpolation.h @@ -30,7 +30,7 @@ #define __USE_XOPEN #endif -#include +#include #include "lmms_constants.h" #include "lmms_math.h" diff --git a/include/lmms_basics.h b/include/lmms_basics.h index 46b88eae1..cda591c0d 100644 --- a/include/lmms_basics.h +++ b/include/lmms_basics.h @@ -31,10 +31,8 @@ #include "lmmsconfig.h" -#ifdef LMMS_HAVE_STDINT_H #include #include -#endif typedef int32_t bar_t; diff --git a/include/lmms_math.h b/include/lmms_math.h index a64bbd3d4..aa043170c 100644 --- a/include/lmms_math.h +++ b/include/lmms_math.h @@ -29,7 +29,7 @@ #include #include "lmms_constants.h" #include "lmmsconfig.h" -#include +#include #include diff --git a/plugins/Amplifier/Amplifier.h b/plugins/Amplifier/Amplifier.h index a5e85aa8b..843c25bdb 100644 --- a/plugins/Amplifier/Amplifier.h +++ b/plugins/Amplifier/Amplifier.h @@ -29,7 +29,6 @@ #include "Effect.h" #include "AmplifierControls.h" -#include "ValueBuffer.h" class AmplifierEffect : public Effect { diff --git a/plugins/Amplifier/AmplifierControlDialog.cpp b/plugins/Amplifier/AmplifierControlDialog.cpp index 53ab6a576..ad2846edb 100644 --- a/plugins/Amplifier/AmplifierControlDialog.cpp +++ b/plugins/Amplifier/AmplifierControlDialog.cpp @@ -23,11 +23,11 @@ * */ -#include #include "AmplifierControlDialog.h" #include "AmplifierControls.h" #include "embed.h" +#include "Knob.h" diff --git a/plugins/Amplifier/AmplifierControls.cpp b/plugins/Amplifier/AmplifierControls.cpp index 43b7545a3..70876be11 100644 --- a/plugins/Amplifier/AmplifierControls.cpp +++ b/plugins/Amplifier/AmplifierControls.cpp @@ -28,8 +28,6 @@ #include "AmplifierControls.h" #include "Amplifier.h" -#include "Engine.h" -#include "Song.h" AmplifierControls::AmplifierControls( AmplifierEffect* effect ) : diff --git a/plugins/Amplifier/AmplifierControls.h b/plugins/Amplifier/AmplifierControls.h index 3cf0321c5..f0f950fd1 100644 --- a/plugins/Amplifier/AmplifierControls.h +++ b/plugins/Amplifier/AmplifierControls.h @@ -28,7 +28,6 @@ #include "EffectControls.h" #include "AmplifierControlDialog.h" -#include "Knob.h" class AmplifierEffect; diff --git a/plugins/BassBooster/BassBoosterControlDialog.cpp b/plugins/BassBooster/BassBoosterControlDialog.cpp index 248860989..f7513e13e 100644 --- a/plugins/BassBooster/BassBoosterControlDialog.cpp +++ b/plugins/BassBooster/BassBoosterControlDialog.cpp @@ -22,11 +22,14 @@ * */ -#include + +#include +#include #include "BassBoosterControlDialog.h" #include "BassBoosterControls.h" #include "embed.h" +#include "Knob.h" diff --git a/plugins/BassBooster/BassBoosterControls.h b/plugins/BassBooster/BassBoosterControls.h index 133c1456c..e7b61348a 100644 --- a/plugins/BassBooster/BassBoosterControls.h +++ b/plugins/BassBooster/BassBoosterControls.h @@ -27,7 +27,6 @@ #include "EffectControls.h" #include "BassBoosterControlDialog.h" -#include "Knob.h" class BassBoosterEffect; diff --git a/plugins/Bitcrush/Bitcrush.h b/plugins/Bitcrush/Bitcrush.h index c80ff3bc7..f309021e1 100644 --- a/plugins/Bitcrush/Bitcrush.h +++ b/plugins/Bitcrush/Bitcrush.h @@ -29,8 +29,6 @@ #include "Effect.h" #include "BitcrushControls.h" -#include "ValueBuffer.h" -#include "lmms_math.h" #include "BasicFilters.h" class BitcrushEffect : public Effect diff --git a/plugins/Bitcrush/BitcrushControlDialog.cpp b/plugins/Bitcrush/BitcrushControlDialog.cpp index 083a7bedb..9c793fde5 100755 --- a/plugins/Bitcrush/BitcrushControlDialog.cpp +++ b/plugins/Bitcrush/BitcrushControlDialog.cpp @@ -24,12 +24,11 @@ */ -#include #include +#include "embed.h" #include "BitcrushControlDialog.h" #include "BitcrushControls.h" -#include "embed.h" #include "ToolTip.h" #include "LedCheckbox.h" #include "Knob.h" diff --git a/plugins/Bitcrush/BitcrushControls.cpp b/plugins/Bitcrush/BitcrushControls.cpp index f572b83eb..19886aa75 100644 --- a/plugins/Bitcrush/BitcrushControls.cpp +++ b/plugins/Bitcrush/BitcrushControls.cpp @@ -28,7 +28,6 @@ #include "BitcrushControls.h" #include "Bitcrush.h" -#include "lmms_math.h" BitcrushControls::BitcrushControls( BitcrushEffect * eff ) : diff --git a/plugins/Compressor/Compressor.h b/plugins/Compressor/Compressor.h index be9cd0662..374f3f8b6 100755 --- a/plugins/Compressor/Compressor.h +++ b/plugins/Compressor/Compressor.h @@ -29,8 +29,6 @@ #include "CompressorControls.h" #include "Effect.h" -#include "ValueBuffer.h" -#include "RmsHelper.h" constexpr float COMP_LOG = -2.2; diff --git a/plugins/Compressor/CompressorControlDialog.cpp b/plugins/Compressor/CompressorControlDialog.cpp index 2e8ea835a..2511e3915 100755 --- a/plugins/Compressor/CompressorControlDialog.cpp +++ b/plugins/Compressor/CompressorControlDialog.cpp @@ -27,14 +27,17 @@ #include "CompressorControls.h" #include -#include #include +#include +#include "AutomatableButton.h" #include "embed.h" +#include "../Eq/EqFader.h" #include "GuiApplication.h" -#include "gui_templates.h" #include "interpolation.h" +#include "Knob.h" #include "MainWindow.h" +#include "PixmapButton.h" #include "ToolTip.h" CompressorControlDialog::CompressorControlDialog(CompressorControls* controls) : diff --git a/plugins/Compressor/CompressorControlDialog.h b/plugins/Compressor/CompressorControlDialog.h index 7eb19c5b9..f20a1d220 100755 --- a/plugins/Compressor/CompressorControlDialog.h +++ b/plugins/Compressor/CompressorControlDialog.h @@ -26,17 +26,10 @@ #define COMPRESSOR_CONTROL_DIALOG_H #include -#include -#include +#include #include -#include -#include "../Eq/EqFader.h" #include "EffectControlDialog.h" -#include "GuiApplication.h" -#include "Knob.h" -#include "MainWindow.h" -#include "PixmapButton.h" constexpr int COMP_MILLI_PER_PIXEL = 6; @@ -58,7 +51,12 @@ constexpr float COMP_NOISE_FLOOR = 0.000001;// -120 dbFs +class automatableButtonGroup; class CompressorControls; +class EqFader; +class Knob; +class PixmapButton; +class QLabel; class CompressorControlDialog : public EffectControlDialog { diff --git a/plugins/Compressor/CompressorControls.cpp b/plugins/Compressor/CompressorControls.cpp index 772fb5261..01d44c245 100755 --- a/plugins/Compressor/CompressorControls.cpp +++ b/plugins/Compressor/CompressorControls.cpp @@ -28,8 +28,6 @@ #include -#include "Engine.h" -#include "Song.h" CompressorControls::CompressorControls(CompressorEffect* effect) : diff --git a/plugins/Compressor/CompressorControls.h b/plugins/Compressor/CompressorControls.h index 775a3be89..233b89ddf 100755 --- a/plugins/Compressor/CompressorControls.h +++ b/plugins/Compressor/CompressorControls.h @@ -28,7 +28,6 @@ #include "CompressorControlDialog.h" #include "EffectControls.h" -#include "Knob.h" class CompressorEffect; diff --git a/plugins/CrossoverEQ/CrossoverEQ.h b/plugins/CrossoverEQ/CrossoverEQ.h index 36d619c3b..d1f76c1e6 100644 --- a/plugins/CrossoverEQ/CrossoverEQ.h +++ b/plugins/CrossoverEQ/CrossoverEQ.h @@ -29,8 +29,6 @@ #include "Effect.h" #include "CrossoverEQControls.h" -#include "ValueBuffer.h" -#include "lmms_math.h" #include "BasicFilters.h" class CrossoverEQEffect : public Effect diff --git a/plugins/CrossoverEQ/CrossoverEQControlDialog.cpp b/plugins/CrossoverEQ/CrossoverEQControlDialog.cpp index eec318a93..5ef7423ed 100644 --- a/plugins/CrossoverEQ/CrossoverEQControlDialog.cpp +++ b/plugins/CrossoverEQ/CrossoverEQControlDialog.cpp @@ -24,8 +24,6 @@ * */ -#include -#include #include "CrossoverEQControlDialog.h" #include "CrossoverEQControls.h" diff --git a/plugins/Delay/DelayControls.cpp b/plugins/Delay/DelayControls.cpp index 35e8f869e..d4b3220a9 100644 --- a/plugins/Delay/DelayControls.cpp +++ b/plugins/Delay/DelayControls.cpp @@ -22,12 +22,11 @@ * */ -#include +#include #include "DelayControls.h" #include "DelayEffect.h" #include "Engine.h" -#include "Song.h" DelayControls::DelayControls( DelayEffect* effect ): EffectControls( effect ), diff --git a/plugins/Delay/DelayControls.h b/plugins/Delay/DelayControls.h index 8c9b2eb1a..c912a453e 100644 --- a/plugins/Delay/DelayControls.h +++ b/plugins/Delay/DelayControls.h @@ -26,7 +26,6 @@ #define DELAYCONTROLS_H #include "EffectControls.h" -#include "Knob.h" #include "DelayControlsDialog.h" diff --git a/plugins/Delay/DelayControlsDialog.cpp b/plugins/Delay/DelayControlsDialog.cpp index efc8a7169..db59b3f39 100755 --- a/plugins/Delay/DelayControlsDialog.cpp +++ b/plugins/Delay/DelayControlsDialog.cpp @@ -22,6 +22,7 @@ * */ +#include "AutomatableModel.h" #include "DelayControlsDialog.h" #include "DelayControls.h" #include "embed.h" diff --git a/plugins/Delay/DelayControlsDialog.h b/plugins/Delay/DelayControlsDialog.h index 9bd50b4a7..4b2c0af41 100644 --- a/plugins/Delay/DelayControlsDialog.h +++ b/plugins/Delay/DelayControlsDialog.h @@ -26,9 +26,9 @@ #define DELAYCONTROLSDIALOG_H #include "EffectControlDialog.h" -#include "AutomatableModel.h" class DelayControls; +class FloatModel; class DelayControlsDialog : public EffectControlDialog { diff --git a/plugins/Delay/DelayEffect.cpp b/plugins/Delay/DelayEffect.cpp index fc12cb820..1377498b0 100644 --- a/plugins/Delay/DelayEffect.cpp +++ b/plugins/Delay/DelayEffect.cpp @@ -25,8 +25,10 @@ #include "DelayEffect.h" #include "Engine.h" #include "embed.h" -#include "interpolation.h" +#include "Lfo.h" +#include "lmms_math.h" #include "plugin_export.h" +#include "StereoDelay.h" extern "C" { diff --git a/plugins/Delay/DelayEffect.h b/plugins/Delay/DelayEffect.h index 3c89b567a..c409458ed 100644 --- a/plugins/Delay/DelayEffect.h +++ b/plugins/Delay/DelayEffect.h @@ -27,9 +27,9 @@ #include "Effect.h" #include "DelayControls.h" -#include "Lfo.h" -#include "StereoDelay.h" -#include "ValueBuffer.h" + +class Lfo; +class StereoDelay; class DelayEffect : public Effect { diff --git a/plugins/Delay/Lfo.cpp b/plugins/Delay/Lfo.cpp index c12452038..0360263ef 100644 --- a/plugins/Delay/Lfo.cpp +++ b/plugins/Delay/Lfo.cpp @@ -23,7 +23,8 @@ */ #include "Lfo.h" -#include "lmms_math.h" + +#include diff --git a/plugins/Delay/Lfo.h b/plugins/Delay/Lfo.h index 02d9ed25e..10b7e2fc0 100644 --- a/plugins/Delay/Lfo.h +++ b/plugins/Delay/Lfo.h @@ -25,7 +25,8 @@ #ifndef LFO_H #define LFO_H -#include "lmms_math.h" +#include "lmms_constants.h" + class Lfo { diff --git a/plugins/Delay/StereoDelay.cpp b/plugins/Delay/StereoDelay.cpp index f240b9354..bdbd63404 100644 --- a/plugins/Delay/StereoDelay.cpp +++ b/plugins/Delay/StereoDelay.cpp @@ -23,10 +23,7 @@ */ #include "StereoDelay.h" -#include #include "lmms_basics.h" -#include "interpolation.h" -#include "lmms_math.h" StereoDelay::StereoDelay( int maxTime, int sampleRate ) diff --git a/plugins/DualFilter/DualFilterControlDialog.cpp b/plugins/DualFilter/DualFilterControlDialog.cpp index 0c7732bc6..653af3e7b 100755 --- a/plugins/DualFilter/DualFilterControlDialog.cpp +++ b/plugins/DualFilter/DualFilterControlDialog.cpp @@ -23,11 +23,10 @@ * */ -#include #include "DualFilterControlDialog.h" #include "DualFilterControls.h" -#include "embed.h" +#include "Knob.h" #include "LedCheckbox.h" #include "ComboBox.h" #include "ToolTip.h" diff --git a/plugins/DualFilter/DualFilterControls.cpp b/plugins/DualFilter/DualFilterControls.cpp index 575a62152..7d54c7c78 100644 --- a/plugins/DualFilter/DualFilterControls.cpp +++ b/plugins/DualFilter/DualFilterControls.cpp @@ -31,7 +31,6 @@ #include "DualFilter.h" #include "embed.h" #include "Engine.h" -#include "Song.h" DualFilterControls::DualFilterControls( DualFilterEffect* effect ) : EffectControls( effect ), diff --git a/plugins/DualFilter/DualFilterControls.h b/plugins/DualFilter/DualFilterControls.h index 4392b8896..9713f657a 100644 --- a/plugins/DualFilter/DualFilterControls.h +++ b/plugins/DualFilter/DualFilterControls.h @@ -28,7 +28,6 @@ #include "EffectControls.h" #include "DualFilterControlDialog.h" -#include "Knob.h" #include "ComboBoxModel.h" class DualFilterEffect; diff --git a/plugins/Eq/EqControls.cpp b/plugins/Eq/EqControls.cpp index 9c6ecbf76..f33a64675 100644 --- a/plugins/Eq/EqControls.cpp +++ b/plugins/Eq/EqControls.cpp @@ -24,7 +24,7 @@ #include "EqControls.h" -#include +#include #include "EqControlsDialog.h" #include "EqEffect.h" diff --git a/plugins/Eq/EqControlsDialog.cpp b/plugins/Eq/EqControlsDialog.cpp index 89ec7a595..fae7e8718 100644 --- a/plugins/Eq/EqControlsDialog.cpp +++ b/plugins/Eq/EqControlsDialog.cpp @@ -25,15 +25,11 @@ #include "EqControlsDialog.h" -#include -#include #include #include "AutomatableButton.h" #include "embed.h" -#include "Engine.h" #include "Knob.h" -#include "Fader.h" #include "LedCheckbox.h" #include "PixmapButton.h" @@ -201,13 +197,13 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) : lpBtnGrp->addButton( lp12Button ); lpBtnGrp->addButton( lp24Button ); lpBtnGrp->addButton( lp48Button ); - lpBtnGrp->setModel( &m_controls->m_lpTypeModel, false); + lpBtnGrp->setModel(&m_controls->m_lpTypeModel); automatableButtonGroup *hpBtnGrp = new automatableButtonGroup( this, tr( "HP group" ) ); hpBtnGrp->addButton( hp12Button ); hpBtnGrp->addButton( hp24Button ); hpBtnGrp->addButton( hp48Button ); - hpBtnGrp->setModel( &m_controls->m_hpTypeModel,false); + hpBtnGrp->setModel(&m_controls->m_hpTypeModel); } diff --git a/plugins/Eq/EqControlsDialog.h b/plugins/Eq/EqControlsDialog.h index b28d38687..b79354355 100644 --- a/plugins/Eq/EqControlsDialog.h +++ b/plugins/Eq/EqControlsDialog.h @@ -25,8 +25,6 @@ #ifndef EQCONTROLSDIALOG_H #define EQCONTROLSDIALOG_H -#include -#include #include "EffectControlDialog.h" diff --git a/plugins/Eq/EqCurve.cpp b/plugins/Eq/EqCurve.cpp index b066871fa..be664b774 100644 --- a/plugins/Eq/EqCurve.cpp +++ b/plugins/Eq/EqCurve.cpp @@ -23,9 +23,15 @@ */ #include "EqCurve.h" -#include "Effect.h" +#include +#include +#include + +#include "AudioEngine.h" #include "embed.h" -#include "lmms_math.h" +#include "Engine.h" +#include "lmms_constants.h" + EqHandle::EqHandle( int num, int x, int y ): m_numb( num ), diff --git a/plugins/Eq/EqCurve.h b/plugins/Eq/EqCurve.h index 58dfa2ac9..6bc3f8871 100644 --- a/plugins/Eq/EqCurve.h +++ b/plugins/Eq/EqCurve.h @@ -25,11 +25,8 @@ #ifndef EQCURVE_H #define EQCURVE_H -#include -#include -#include -#include "lmms_math.h" -#include "AutomatableModelView.h" +#include + enum{ diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index f871596ec..3b46143e6 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -25,8 +25,6 @@ #include "EqEffect.h" #include "Engine.h" -#include "EqFader.h" -#include "interpolation.h" #include "lmms_math.h" #include "embed.h" diff --git a/plugins/Eq/EqEffect.h b/plugins/Eq/EqEffect.h index 614e92146..b94ddef26 100644 --- a/plugins/Eq/EqEffect.h +++ b/plugins/Eq/EqEffect.h @@ -24,11 +24,9 @@ #ifndef EQEFFECT_H #define EQEFFECT_H -#include "BasicFilters.h" #include "Effect.h" #include "EqControls.h" #include "EqFilter.h" -#include "lmms_math.h" diff --git a/plugins/Eq/EqParameterWidget.cpp b/plugins/Eq/EqParameterWidget.cpp index be2174a2b..a919f2773 100644 --- a/plugins/Eq/EqParameterWidget.cpp +++ b/plugins/Eq/EqParameterWidget.cpp @@ -25,13 +25,18 @@ #include "EqParameterWidget.h" +#include #include #include -#include +#include +#include #include -#include "EqControls.h" -#include "lmms_math.h" +#include "AutomatableModel.h" +#include "EqCurve.h" +#include "EqParameterWidget.h" +#include "lmms_constants.h" + EqParameterWidget::EqParameterWidget( QWidget *parent, EqControls * controls ) : diff --git a/plugins/Eq/EqParameterWidget.h b/plugins/Eq/EqParameterWidget.h index 231256bf0..28d01efbe 100644 --- a/plugins/Eq/EqParameterWidget.h +++ b/plugins/Eq/EqParameterWidget.h @@ -29,11 +29,12 @@ #include -#include "EffectControls.h" -#include "EqCurve.h" -#include "TextFloat.h" +class BoolModel; class EqControls; +class EqCurve; +class EqHandle; +class FloatModel; class EqBand { diff --git a/plugins/Eq/EqSpectrumView.cpp b/plugins/Eq/EqSpectrumView.cpp index 27c320dfb..e65a12ea9 100644 --- a/plugins/Eq/EqSpectrumView.cpp +++ b/plugins/Eq/EqSpectrumView.cpp @@ -22,11 +22,16 @@ #include "EqSpectrumView.h" +#include +#include +#include + #include "AudioEngine.h" #include "Engine.h" #include "EqCurve.h" #include "GuiApplication.h" #include "MainWindow.h" +#include "lmms_constants.h" EqAnalyser::EqAnalyser() : m_framesFilledUp ( 0 ), diff --git a/plugins/Eq/EqSpectrumView.h b/plugins/Eq/EqSpectrumView.h index 84feeff13..40a24868d 100644 --- a/plugins/Eq/EqSpectrumView.h +++ b/plugins/Eq/EqSpectrumView.h @@ -23,13 +23,11 @@ #ifndef EQSPECTRUMVIEW_H #define EQSPECTRUMVIEW_H -#include #include #include #include "fft_helpers.h" #include "lmms_basics.h" -#include "lmms_math.h" const int MAX_BANDS = 2048; diff --git a/plugins/Flanger/FlangerControls.cpp b/plugins/Flanger/FlangerControls.cpp index 81e9268c7..1b4007b38 100644 --- a/plugins/Flanger/FlangerControls.cpp +++ b/plugins/Flanger/FlangerControls.cpp @@ -22,7 +22,7 @@ * */ -#include +#include #include "FlangerControls.h" #include "FlangerEffect.h" diff --git a/plugins/Flanger/FlangerControls.h b/plugins/Flanger/FlangerControls.h index 8397a69fa..54ef38a1c 100644 --- a/plugins/Flanger/FlangerControls.h +++ b/plugins/Flanger/FlangerControls.h @@ -26,7 +26,6 @@ #define FLANGERCONTROLS_H #include "EffectControls.h" -#include "Knob.h" #include "FlangerControlsDialog.h" diff --git a/plugins/Flanger/FlangerControlsDialog.cpp b/plugins/Flanger/FlangerControlsDialog.cpp index 8b7fdcf10..b3b49e661 100644 --- a/plugins/Flanger/FlangerControlsDialog.cpp +++ b/plugins/Flanger/FlangerControlsDialog.cpp @@ -23,8 +23,9 @@ */ #include "FlangerControlsDialog.h" -#include "FlangerControls.h" + #include "embed.h" +#include "FlangerControls.h" #include "LedCheckbox.h" #include "TempoSyncKnob.h" diff --git a/plugins/Flanger/FlangerEffect.h b/plugins/Flanger/FlangerEffect.h index a70e87827..630513ade 100644 --- a/plugins/Flanger/FlangerEffect.h +++ b/plugins/Flanger/FlangerEffect.h @@ -28,9 +28,13 @@ #include "Effect.h" #include "FlangerControls.h" -#include "QuadratureLfo.h" #include "MonoDelay.h" #include "Noise.h" +#include "QuadratureLfo.h" + +class MonoDelay; +class Noise; +class QuadratureLfo; class FlangerEffect : public Effect diff --git a/plugins/Flanger/MonoDelay.cpp b/plugins/Flanger/MonoDelay.cpp index fc63d57d1..d43e5b99d 100644 --- a/plugins/Flanger/MonoDelay.cpp +++ b/plugins/Flanger/MonoDelay.cpp @@ -23,8 +23,6 @@ */ #include "MonoDelay.h" -#include "interpolation.h" -#include "lmms_math.h" #include "string.h" MonoDelay::MonoDelay( int maxTime , int sampleRate ) diff --git a/plugins/FreeBoy/FreeBoy.cpp b/plugins/FreeBoy/FreeBoy.cpp index f426f5387..976860f6c 100644 --- a/plugins/FreeBoy/FreeBoy.cpp +++ b/plugins/FreeBoy/FreeBoy.cpp @@ -25,11 +25,9 @@ #include -#include #include #include "FreeBoy.h" #include "Gb_Apu_Buffer.h" -#include "Multi_Buffer.h" #include "base64.h" #include "InstrumentTrack.h" #include "Knob.h" diff --git a/plugins/FreeBoy/FreeBoy.h b/plugins/FreeBoy/FreeBoy.h index 9ceb27966..a6bef0af2 100644 --- a/plugins/FreeBoy/FreeBoy.h +++ b/plugins/FreeBoy/FreeBoy.h @@ -26,14 +26,14 @@ #ifndef FREEBOY_H #define FREEBOY_H -#include +#include "AutomatableModel.h" +#include "Blip_Buffer.h" #include "Instrument.h" #include "InstrumentView.h" -#include "Knob.h" #include "Graph.h" -#include "Gb_Apu.h" class FreeBoyInstrumentView; +class Knob; class NotePlayHandle; class PixmapButton; diff --git a/plugins/HydrogenImport/HydrogenImport.cpp b/plugins/HydrogenImport/HydrogenImport.cpp index 906c94f0b..7e13d2351 100644 --- a/plugins/HydrogenImport/HydrogenImport.cpp +++ b/plugins/HydrogenImport/HydrogenImport.cpp @@ -1,10 +1,4 @@ #include -#include -#include -#include -#include -#include -#include #include "LocalFileMng.h" #include "HydrogenImport.h" @@ -14,10 +8,8 @@ #include "InstrumentTrack.h" #include "Note.h" #include "MidiClip.h" +#include "PatternStore.h" #include "Track.h" -#include "BBTrack.h" -#include "BBTrackContainer.h" -#include "Instrument.h" #include "plugin_export.h" @@ -223,7 +215,9 @@ bool HydrogenImport::readSong() if ( nLayer == 0 ) { - drum_track[sId] = ( InstrumentTrack * ) Track::create( Track::InstrumentTrack,Engine::getBBTrackContainer() ); + drum_track[sId] = static_cast( + Track::create(Track::InstrumentTrack, Engine::patternStore()) + ); drum_track[sId]->volumeModel()->setValue( fVolume * 100 ); drum_track[sId]->panningModel()->setValue( ( fPan_R - fPan_L ) * 100 ); ins = drum_track[sId]->loadInstrument( "audiofileprocessor" ); @@ -247,7 +241,7 @@ bool HydrogenImport::readSong() } QDomNode patterns = songNode.firstChildElement( "patternList" ); int pattern_count = 0; - int nbb = Engine::getBBTrackContainer()->numOfBBs(); + int existing_patterns = Engine::patternStore()->numOfPatterns(); QDomNode patternNode = patterns.firstChildElement( "pattern" ); int pn = 1; while ( !patternNode.isNull() ) @@ -255,7 +249,7 @@ bool HydrogenImport::readSong() if ( pn > 0 ) { pattern_count++; - s->addBBTrack(); + s->addPatternTrack(); pn = 0; } QString sName; // name @@ -278,7 +272,7 @@ bool HydrogenImport::readSong() QString nNoteOff = LocalFileMng::readXmlString( noteNode, "note_off", "false", false, false ); QString instrId = LocalFileMng::readXmlString( noteNode, "instrument", 0,false, false ); - int i = pattern_count - 1 + nbb; + int i = pattern_count - 1 + existing_patterns; pattern_id[sName] = pattern_count - 1; MidiClip*p = dynamic_cast( drum_track[instrId]->getClip( i ) ); Note n; @@ -315,7 +309,7 @@ bool HydrogenImport::readSong() patternId = ( QDomNode ) patternId.nextSiblingElement( "patternID" ); int i = pattern_id[patId]+song_num_tracks; - Track *t = ( BBTrack * ) s->tracks().at( i ); + Track* t = s->tracks().at(i); t->createClip(pos); if ( pattern_length[patId] > best_length ) diff --git a/plugins/HydrogenImport/HydrogenImport.h b/plugins/HydrogenImport/HydrogenImport.h index 9818a1366..d19d1e8dd 100644 --- a/plugins/HydrogenImport/HydrogenImport.h +++ b/plugins/HydrogenImport/HydrogenImport.h @@ -2,8 +2,6 @@ #define _HYDROGEN_IMPORT_H #include -#include -#include #include "ImportFilter.h" diff --git a/plugins/HydrogenImport/local_file_mgr.cpp b/plugins/HydrogenImport/local_file_mgr.cpp index 78560fef9..3ca6572a9 100644 --- a/plugins/HydrogenImport/local_file_mgr.cpp +++ b/plugins/HydrogenImport/local_file_mgr.cpp @@ -1,16 +1,11 @@ -#include -#include #include -#include +#include -#include -#include -#include #include +#include #include #include -#include #include "LocalFileMng.h" diff --git a/plugins/LadspaEffect/LadspaControlDialog.cpp b/plugins/LadspaEffect/LadspaControlDialog.cpp index 0034dfd6d..134bf1cc1 100644 --- a/plugins/LadspaEffect/LadspaControlDialog.cpp +++ b/plugins/LadspaEffect/LadspaControlDialog.cpp @@ -26,10 +26,13 @@ #include +#include #include -#include +#include -#include "LadspaEffect.h" +#include "LadspaBase.h" +#include "LadspaControl.h" +#include "LadspaControls.h" #include "LadspaControlDialog.h" #include "LadspaControlView.h" #include "LedCheckbox.h" diff --git a/plugins/LadspaEffect/LadspaControls.cpp b/plugins/LadspaEffect/LadspaControls.cpp index 028394d30..9399fce03 100644 --- a/plugins/LadspaEffect/LadspaControls.cpp +++ b/plugins/LadspaEffect/LadspaControls.cpp @@ -24,6 +24,8 @@ #include +#include "LadspaBase.h" +#include "LadspaControl.h" #include "LadspaEffect.h" diff --git a/plugins/LadspaEffect/LadspaControls.h b/plugins/LadspaEffect/LadspaControls.h index 013b914d4..0a157009c 100644 --- a/plugins/LadspaEffect/LadspaControls.h +++ b/plugins/LadspaEffect/LadspaControls.h @@ -26,10 +26,10 @@ #define LADSPA_CONTROLS_H #include "EffectControls.h" -#include "LadspaControl.h" #include "LadspaControlDialog.h" +class LadspaControl; typedef QVector control_list_t; class LadspaEffect; diff --git a/plugins/LadspaEffect/LadspaEffect.cpp b/plugins/LadspaEffect/LadspaEffect.cpp index 3989a8b85..b2e119af7 100644 --- a/plugins/LadspaEffect/LadspaEffect.cpp +++ b/plugins/LadspaEffect/LadspaEffect.cpp @@ -24,20 +24,18 @@ */ -#include +#include #include #include "LadspaEffect.h" #include "DataFile.h" #include "AudioDevice.h" #include "AudioEngine.h" -#include "ConfigManager.h" #include "Ladspa2LMMS.h" +#include "LadspaBase.h" #include "LadspaControl.h" #include "LadspaSubPluginFeatures.h" -#include "EffectChain.h" #include "AutomationClip.h" -#include "ControllerConnection.h" #include "MemoryManager.h" #include "ValueBuffer.h" #include "Song.h" diff --git a/plugins/LadspaEffect/LadspaEffect.h b/plugins/LadspaEffect/LadspaEffect.h index e9f8eef7b..a46099f93 100644 --- a/plugins/LadspaEffect/LadspaEffect.h +++ b/plugins/LadspaEffect/LadspaEffect.h @@ -29,10 +29,12 @@ #include #include "Effect.h" -#include "LadspaBase.h" +#include "ladspa.h" #include "LadspaControls.h" +#include "LadspaManager.h" +typedef struct PortDescription port_desc_t; typedef QVector multi_proc_t; class LadspaEffect : public Effect diff --git a/plugins/LadspaEffect/swh/ladspa b/plugins/LadspaEffect/swh/ladspa index 0c94d096a..d99a0db52 160000 --- a/plugins/LadspaEffect/swh/ladspa +++ b/plugins/LadspaEffect/swh/ladspa @@ -1 +1 @@ -Subproject commit 0c94d096a2202c83dcb89b5b66bd6047cb0e98c7 +Subproject commit d99a0db521d13a87bdaa418c674ca8858e484452 diff --git a/plugins/Lv2Effect/Lv2Effect.cpp b/plugins/Lv2Effect/Lv2Effect.cpp index ddec187bb..3d6a114d1 100644 --- a/plugins/Lv2Effect/Lv2Effect.cpp +++ b/plugins/Lv2Effect/Lv2Effect.cpp @@ -24,8 +24,6 @@ #include "Lv2Effect.h" -#include -#include #include "Lv2SubPluginFeatures.h" diff --git a/plugins/Lv2Effect/Lv2FxControlDialog.cpp b/plugins/Lv2Effect/Lv2FxControlDialog.cpp index 9a77171d6..267923561 100644 --- a/plugins/Lv2Effect/Lv2FxControlDialog.cpp +++ b/plugins/Lv2Effect/Lv2FxControlDialog.cpp @@ -24,11 +24,8 @@ #include "Lv2FxControlDialog.h" -#include #include -#include -#include "Lv2Effect.h" #include "Lv2FxControls.h" diff --git a/plugins/Lv2Effect/Lv2FxControls.cpp b/plugins/Lv2Effect/Lv2FxControls.cpp index 56469d3cc..99d4162d8 100644 --- a/plugins/Lv2Effect/Lv2FxControls.cpp +++ b/plugins/Lv2Effect/Lv2FxControls.cpp @@ -29,7 +29,6 @@ #include "Engine.h" #include "Lv2Effect.h" #include "Lv2FxControlDialog.h" -#include "Lv2Proc.h" diff --git a/plugins/MidiExport/MidiExport.cpp b/plugins/MidiExport/MidiExport.cpp index cee588db9..a150b424a 100644 --- a/plugins/MidiExport/MidiExport.cpp +++ b/plugins/MidiExport/MidiExport.cpp @@ -24,20 +24,14 @@ */ -#include -#include -#include -#include -#include #include "MidiExport.h" -#include "lmms_math.h" #include "TrackContainer.h" -#include "BBTrack.h" #include "DataFile.h" #include "InstrumentTrack.h" #include "LocaleHelper.h" +#include "PatternTrack.h" #include "plugin_export.h" @@ -76,7 +70,7 @@ MidiExport::~MidiExport() bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, - const TrackContainer::TrackList &tracks_BB, + const TrackContainer::TrackList &patternStoreTracks, int tempo, int masterPitch, const QString &filename) { QFile f(filename); @@ -84,7 +78,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, QDataStream midiout(&f); InstrumentTrack* instTrack; - BBTrack* bbTrack; + PatternTrack* patternTrack; QDomElement element; @@ -93,7 +87,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, uint32_t size; for (const Track* track : tracks) if (track->type() == Track::InstrumentTrack) nTracks++; - for (const Track* track : tracks_BB) if (track->type() == Track::InstrumentTrack) nTracks++; + for (const Track* track : patternStoreTracks) if (track->type() == Track::InstrumentTrack) nTracks++; // midi header MidiFile::MIDIHeader header(nTracks); @@ -138,29 +132,29 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, base_volume = LocaleHelper::toDouble(it.attribute("volume", "100"))/100.0; } - if (n.nodeName() == "pattern") //TODO: rename to "midiClip" + if (n.nodeName() == "midiclip") { base_time = n.toElement().attribute("pos", "0").toInt(); writeMidiClip(midiClip, n, base_pitch, base_volume, base_time); } } - ProcessBBNotes(midiClip, INT_MAX); + processPatternNotes(midiClip, INT_MAX); writeMidiClipToTrack(mtrack, midiClip); size = mtrack.writeToBuffer(buffer); midiout.writeRawData((char *)buffer, size); } - if (track->type() == Track::BBTrack) + if (track->type() == Track::PatternTrack) { - bbTrack = dynamic_cast(track); - element = bbTrack->saveState(dataFile, dataFile.content()); + patternTrack = dynamic_cast(track); + element = patternTrack->saveState(dataFile, dataFile.content()); std::vector> plist; for (QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (n.nodeName() == "bbclip") + if (n.nodeName() == "patternclip") { QDomElement it = n.toElement(); int pos = it.attribute("pos", "0").toInt(); @@ -174,13 +168,15 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, } } // for each track - // midi tracks in BB tracks - for (Track* track : tracks_BB) + // for each instrument in the pattern editor + for (Track* track : patternStoreTracks) { DataFile dataFile(DataFile::SongProject); MTrack mtrack; + // begin at the first pattern track (first pattern) auto itr = plists.begin(); + std::vector> st; if (track->type() != Track::InstrumentTrack) continue; @@ -195,6 +191,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, int base_pitch = 0; double base_volume = 1.0; + // for each pattern in the pattern editor for (QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling()) { if (n.nodeName() == "instrumenttrack") @@ -208,28 +205,31 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, base_volume = LocaleHelper::toDouble(it.attribute("volume", "100")) / 100.0; } - if (n.nodeName() == "pattern") //TODO: rename to "midiClip" + if (n.nodeName() == "midiclip") { std::vector> &plist = *itr; MidiNoteVector nv, midiClip; writeMidiClip(midiClip, n, base_pitch, base_volume, 0); - // workaround for nested BBClips + + // FIXME better variable names and comments int pos = 0; int len = n.toElement().attribute("steps", "1").toInt() * 12; + + // for each pattern clip of the current pattern track (in song editor) for (auto it = plist.begin(); it != plist.end(); ++it) { while (!st.empty() && st.back().second <= it->first) { - writeBBClip(midiClip, nv, len, st.back().first, pos, st.back().second); + writePatternClip(midiClip, nv, len, st.back().first, pos, st.back().second); pos = st.back().second; st.pop_back(); } if (!st.empty() && st.back().second <= it->second) { - writeBBClip(midiClip, nv, len, st.back().first, pos, it->first); + writePatternClip(midiClip, nv, len, st.back().first, pos, it->first); pos = it->first; while (!st.empty() && st.back().second <= it->second) { @@ -243,13 +243,15 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, while (!st.empty()) { - writeBBClip(midiClip, nv, len, st.back().first, pos, st.back().second); + writePatternClip(midiClip, nv, len, st.back().first, pos, st.back().second); pos = st.back().second; st.pop_back(); } - ProcessBBNotes(nv, pos); + processPatternNotes(nv, pos); writeMidiClipToTrack(mtrack, nv); + + // next pattern track ++itr; } } @@ -263,7 +265,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks, -void MidiExport::writeMidiClip(MidiNoteVector &midiClip, QDomNode n, +void MidiExport::writeMidiClip(MidiNoteVector &midiClip, const QDomNode& n, int base_pitch, double base_volume, int base_time) { // TODO interpret steps="12" muted="0" type="1" name="Piano1" len="2592" @@ -294,7 +296,7 @@ void MidiExport::writeMidiClipToTrack(MTrack &mtrack, MidiNoteVector &nv) -void MidiExport::writeBBClip(MidiNoteVector &src, MidiNoteVector &dst, +void MidiExport::writePatternClip(MidiNoteVector& src, MidiNoteVector& dst, int len, int base, int start, int end) { if (start >= end) { return; } @@ -318,7 +320,7 @@ void MidiExport::writeBBClip(MidiNoteVector &src, MidiNoteVector &dst, -void MidiExport::ProcessBBNotes(MidiNoteVector &nv, int cutPos) +void MidiExport::processPatternNotes(MidiNoteVector& nv, int cutPos) { std::sort(nv.begin(), nv.end()); int cur = INT_MAX, next = INT_MAX; diff --git a/plugins/MidiExport/MidiExport.h b/plugins/MidiExport/MidiExport.h index 2520b97bf..fd73442b5 100644 --- a/plugins/MidiExport/MidiExport.h +++ b/plugins/MidiExport/MidiExport.h @@ -31,6 +31,8 @@ #include "ExportFilter.h" #include "MidiFile.hpp" +class QDomNode; + const int BUFFER_SIZE = 50*1024; typedef MidiFile::MIDITrack MTrack; @@ -66,16 +68,16 @@ public: } virtual bool tryExport(const TrackContainer::TrackList &tracks, - const TrackContainer::TrackList &tracks_BB, + const TrackContainer::TrackList &patternTracks, int tempo, int masterPitch, const QString &filename); private: - void writeMidiClip(MidiNoteVector &midiClip, QDomNode n, + void writeMidiClip(MidiNoteVector &midiClip, const QDomNode& n, int base_pitch, double base_volume, int base_time); void writeMidiClipToTrack(MTrack &mtrack, MidiNoteVector &nv); - void writeBBClip(MidiNoteVector &src, MidiNoteVector &dst, + void writePatternClip(MidiNoteVector &src, MidiNoteVector &dst, int len, int base, int start, int end); - void ProcessBBNotes(MidiNoteVector &nv, int cutPos); + void processPatternNotes(MidiNoteVector &nv, int cutPos); void error(); diff --git a/plugins/MidiImport/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp index f63332c0b..a57a425a2 100644 --- a/plugins/MidiImport/MidiImport.cpp +++ b/plugins/MidiImport/MidiImport.cpp @@ -23,7 +23,6 @@ */ -#include #include #include #include @@ -47,7 +46,6 @@ #include "debug.h" #include "Song.h" -#include "embed.h" #include "plugin_export.h" #include "portsmf/allegro.h" diff --git a/plugins/MultitapEcho/MultitapEcho.h b/plugins/MultitapEcho/MultitapEcho.h index 0735fada0..539ae9475 100644 --- a/plugins/MultitapEcho/MultitapEcho.h +++ b/plugins/MultitapEcho/MultitapEcho.h @@ -28,9 +28,7 @@ #include "Effect.h" #include "MultitapEchoControls.h" -#include "ValueBuffer.h" #include "RingBuffer.h" -#include "lmms_math.h" #include "BasicFilters.h" class MultitapEchoEffect : public Effect diff --git a/plugins/MultitapEcho/MultitapEchoControlDialog.cpp b/plugins/MultitapEcho/MultitapEchoControlDialog.cpp index 20018ddc5..5894c24d7 100644 --- a/plugins/MultitapEcho/MultitapEchoControlDialog.cpp +++ b/plugins/MultitapEcho/MultitapEchoControlDialog.cpp @@ -23,13 +23,11 @@ * */ -#include #include "MultitapEchoControlDialog.h" #include "MultitapEchoControls.h" #include "embed.h" #include "Graph.h" -#include "PixmapButton.h" #include "ToolTip.h" #include "LedCheckbox.h" #include "Knob.h" diff --git a/plugins/MultitapEcho/MultitapEchoControls.h b/plugins/MultitapEcho/MultitapEchoControls.h index cbecb1b3d..4696f46d9 100644 --- a/plugins/MultitapEcho/MultitapEchoControls.h +++ b/plugins/MultitapEcho/MultitapEchoControls.h @@ -28,7 +28,6 @@ #include "EffectControls.h" #include "MultitapEchoControlDialog.h" -#include "Knob.h" #include "Graph.h" diff --git a/plugins/OpulenZ/OpulenZ.cpp b/plugins/OpulenZ/OpulenZ.cpp index fa3a6bbdd..b09d2c60b 100644 --- a/plugins/OpulenZ/OpulenZ.cpp +++ b/plugins/OpulenZ/OpulenZ.cpp @@ -40,12 +40,11 @@ #include "InstrumentPlayHandle.h" #include "InstrumentTrack.h" -#include #include #include #include -#include -#include +#include +#include #include "opl.h" #include "temuopl.h" @@ -55,7 +54,6 @@ #include "debug.h" #include "Knob.h" -#include "LcdSpinBox.h" #include "PixmapButton.h" #include "ToolTip.h" diff --git a/plugins/OpulenZ/OpulenZ.h b/plugins/OpulenZ/OpulenZ.h index 1776df93f..7b4868b4f 100644 --- a/plugins/OpulenZ/OpulenZ.h +++ b/plugins/OpulenZ/OpulenZ.h @@ -25,13 +25,18 @@ #ifndef OPULENZ_H #define OPULENZ_H +#include + +#include "AutomatableModel.h" #include "Instrument.h" #include "InstrumentView.h" -#include "opl.h" -#include "LcdSpinBox.h" -#include "Knob.h" -#include "PixmapButton.h" +class automatableButtonGroup; +class Copl; +class Knob; +class LcdSpinBox; +class PixmapButton; + // This one is a flag, MIDI notes take 7 low bits #define OPL2_VOICE_FREE 128 diff --git a/plugins/ReverbSC/ReverbSC.cpp b/plugins/ReverbSC/ReverbSC.cpp index da42e65dc..2d56d7f48 100644 --- a/plugins/ReverbSC/ReverbSC.cpp +++ b/plugins/ReverbSC/ReverbSC.cpp @@ -20,7 +20,7 @@ * */ -#include +#include #include "ReverbSC.h" #include "embed.h" diff --git a/plugins/ReverbSC/ReverbSC.h b/plugins/ReverbSC/ReverbSC.h index 0e697c197..3a7a81e8d 100644 --- a/plugins/ReverbSC/ReverbSC.h +++ b/plugins/ReverbSC/ReverbSC.h @@ -28,7 +28,6 @@ #include "Effect.h" #include "ReverbSCControls.h" -#include "ValueBuffer.h" extern "C" { #include "base.h" diff --git a/plugins/ReverbSC/ReverbSCControlDialog.cpp b/plugins/ReverbSC/ReverbSCControlDialog.cpp index 9c9f3f44a..9c5ae7eab 100644 --- a/plugins/ReverbSC/ReverbSCControlDialog.cpp +++ b/plugins/ReverbSC/ReverbSCControlDialog.cpp @@ -22,11 +22,12 @@ * */ -#include #include "ReverbSCControlDialog.h" -#include "ReverbSCControls.h" + #include "embed.h" +#include "Knob.h" +#include "ReverbSCControls.h" ReverbSCControlDialog::ReverbSCControlDialog( ReverbSCControls* controls ) : EffectControlDialog( controls ) diff --git a/plugins/ReverbSC/ReverbSCControls.cpp b/plugins/ReverbSC/ReverbSCControls.cpp index 165e784f6..11c99f665 100644 --- a/plugins/ReverbSC/ReverbSCControls.cpp +++ b/plugins/ReverbSC/ReverbSCControls.cpp @@ -28,7 +28,6 @@ #include "ReverbSCControls.h" #include "ReverbSC.h" #include "Engine.h" -#include "Song.h" ReverbSCControls::ReverbSCControls( ReverbSCEffect* effect ) : EffectControls( effect ), diff --git a/plugins/ReverbSC/ReverbSCControls.h b/plugins/ReverbSC/ReverbSCControls.h index 36cc16a7e..78423ae8d 100644 --- a/plugins/ReverbSC/ReverbSCControls.h +++ b/plugins/ReverbSC/ReverbSCControls.h @@ -27,7 +27,6 @@ #include "EffectControls.h" #include "ReverbSCControlDialog.h" -#include "Knob.h" class ReverbSCEffect; diff --git a/plugins/Sid/SidInstrument.cpp b/plugins/Sid/SidInstrument.cpp index 236b00589..f7156ba4d 100644 --- a/plugins/Sid/SidInstrument.cpp +++ b/plugins/Sid/SidInstrument.cpp @@ -24,7 +24,6 @@ */ -#include #include #include diff --git a/plugins/Sid/SidInstrument.h b/plugins/Sid/SidInstrument.h index c0998f026..85fe6d482 100644 --- a/plugins/Sid/SidInstrument.h +++ b/plugins/Sid/SidInstrument.h @@ -27,12 +27,12 @@ #ifndef _SID_H #define _SID_H -#include +#include "AutomatableModel.h" #include "Instrument.h" #include "InstrumentView.h" -#include "Knob.h" +class Knob; class SidInstrumentView; class NotePlayHandle; class automatableButtonGroup; diff --git a/plugins/SpectrumAnalyzer/Analyzer.h b/plugins/SpectrumAnalyzer/Analyzer.h index 304777c9a..57a11d30a 100644 --- a/plugins/SpectrumAnalyzer/Analyzer.h +++ b/plugins/SpectrumAnalyzer/Analyzer.h @@ -27,7 +27,6 @@ #ifndef ANALYZER_H #define ANALYZER_H -#include #include "DataprocLauncher.h" #include "Effect.h" diff --git a/plugins/SpectrumAnalyzer/SaControls.cpp b/plugins/SpectrumAnalyzer/SaControls.cpp index 6be298e27..45490f6b3 100644 --- a/plugins/SpectrumAnalyzer/SaControls.cpp +++ b/plugins/SpectrumAnalyzer/SaControls.cpp @@ -24,7 +24,7 @@ #include "SaControls.h" -#include +#include #include "Analyzer.h" #include "SaControlsDialog.h" diff --git a/plugins/SpectrumAnalyzer/SaControls.h b/plugins/SpectrumAnalyzer/SaControls.h index ee8a9e001..d75156f74 100644 --- a/plugins/SpectrumAnalyzer/SaControls.h +++ b/plugins/SpectrumAnalyzer/SaControls.h @@ -27,7 +27,6 @@ #include "ComboBoxModel.h" #include "EffectControls.h" -#include "lmms_constants.h" //#define SA_DEBUG 1 // define SA_DEBUG to enable performance measurements diff --git a/plugins/SpectrumAnalyzer/SaControlsDialog.cpp b/plugins/SpectrumAnalyzer/SaControlsDialog.cpp index ddd1489e8..ddd822bb1 100644 --- a/plugins/SpectrumAnalyzer/SaControlsDialog.cpp +++ b/plugins/SpectrumAnalyzer/SaControlsDialog.cpp @@ -32,13 +32,13 @@ #include "ComboBox.h" #include "ComboBoxModel.h" -#include "embed.h" -#include "Engine.h" #include "Knob.h" #include "LedCheckbox.h" #include "PixmapButton.h" #include "SaControls.h" #include "SaProcessor.h" +#include "SaSpectrumView.h" +#include "SaWaterfallView.h" // The entire GUI layout is built here. diff --git a/plugins/SpectrumAnalyzer/SaControlsDialog.h b/plugins/SpectrumAnalyzer/SaControlsDialog.h index e5a35f186..8cbb0ecaa 100644 --- a/plugins/SpectrumAnalyzer/SaControlsDialog.h +++ b/plugins/SpectrumAnalyzer/SaControlsDialog.h @@ -26,10 +26,12 @@ #define SACONTROLSDIALOG_H #include "EffectControlDialog.h" -#include "SaControls.h" -#include "SaSpectrumView.h" -#include "SaProcessor.h" -#include "SaWaterfallView.h" +#include "fft_helpers.h" + +class SaControls; +class SaProcessor; +class SaSpectrumView; +class SaWaterfallView; //! Top-level widget holding the configuration GUI and spectrum displays diff --git a/plugins/SpectrumAnalyzer/SaProcessor.cpp b/plugins/SpectrumAnalyzer/SaProcessor.cpp index 7a86731cf..843067988 100644 --- a/plugins/SpectrumAnalyzer/SaProcessor.cpp +++ b/plugins/SpectrumAnalyzer/SaProcessor.cpp @@ -36,8 +36,10 @@ #endif #include -#include "lmms_math.h" +#include "fft_helpers.h" +#include "lmms_constants.h" #include "LocklessRingBuffer.h" +#include "SaControls.h" SaProcessor::SaProcessor(const SaControls *controls) : diff --git a/plugins/SpectrumAnalyzer/SaProcessor.h b/plugins/SpectrumAnalyzer/SaProcessor.h index 0c396b3c0..b331a9c09 100644 --- a/plugins/SpectrumAnalyzer/SaProcessor.h +++ b/plugins/SpectrumAnalyzer/SaProcessor.h @@ -28,16 +28,21 @@ #define SAPROCESSOR_H #include -#include +#include #include +#include #include -#include "fft_helpers.h" -#include "SaControls.h" +#include "lmms_basics.h" + template class LocklessRingBuffer; +class SaControls; + + + //! Receives audio data, runs FFT analysis and stores the result. class SaProcessor { diff --git a/plugins/SpectrumAnalyzer/SaSpectrumView.cpp b/plugins/SpectrumAnalyzer/SaSpectrumView.cpp index cf584431d..1feee5cef 100644 --- a/plugins/SpectrumAnalyzer/SaSpectrumView.cpp +++ b/plugins/SpectrumAnalyzer/SaSpectrumView.cpp @@ -33,8 +33,10 @@ #include #include +#include "fft_helpers.h" #include "GuiApplication.h" #include "MainWindow.h" +#include "SaControls.h" #include "SaProcessor.h" #ifdef SA_DEBUG diff --git a/plugins/SpectrumAnalyzer/SaSpectrumView.h b/plugins/SpectrumAnalyzer/SaSpectrumView.h index 0894cd383..70606cc34 100644 --- a/plugins/SpectrumAnalyzer/SaSpectrumView.h +++ b/plugins/SpectrumAnalyzer/SaSpectrumView.h @@ -27,7 +27,6 @@ #ifndef SASPECTRUMVIEW_H #define SASPECTRUMVIEW_H -#include "SaControls.h" #include #include @@ -37,6 +36,7 @@ class QMouseEvent; class QPainter; +class SaControls; class SaProcessor; //! Widget that displays a spectrum curve and frequency / amplitude grid diff --git a/plugins/SpectrumAnalyzer/SaWaterfallView.cpp b/plugins/SpectrumAnalyzer/SaWaterfallView.cpp index 510ba835b..36fcbf3bc 100644 --- a/plugins/SpectrumAnalyzer/SaWaterfallView.cpp +++ b/plugins/SpectrumAnalyzer/SaWaterfallView.cpp @@ -31,12 +31,12 @@ #include #include #include -#include #include #include "EffectControlDialog.h" #include "GuiApplication.h" #include "MainWindow.h" +#include "SaControls.h" #include "SaProcessor.h" diff --git a/plugins/SpectrumAnalyzer/SaWaterfallView.h b/plugins/SpectrumAnalyzer/SaWaterfallView.h index bd91d6d16..b2f815203 100644 --- a/plugins/SpectrumAnalyzer/SaWaterfallView.h +++ b/plugins/SpectrumAnalyzer/SaWaterfallView.h @@ -26,13 +26,13 @@ #include #include #include -#include #include -#include "SaControls.h" -#include "SaProcessor.h" +class EffectControlDialog; class QMouseEvent; +class SaControls; +class SaProcessor; // Widget that displays a spectrum waterfall (spectrogram) and time labels. class SaWaterfallView : public QWidget diff --git a/plugins/Vectorscope/VecControls.cpp b/plugins/Vectorscope/VecControls.cpp index 0e7a2d061..ede9c77b2 100644 --- a/plugins/Vectorscope/VecControls.cpp +++ b/plugins/Vectorscope/VecControls.cpp @@ -24,7 +24,7 @@ #include "VecControls.h" -#include +#include #include "VecControlsDialog.h" #include "Vectorscope.h" diff --git a/plugins/Vectorscope/VecControlsDialog.cpp b/plugins/Vectorscope/VecControlsDialog.cpp index 9916d7756..bf6764c9b 100644 --- a/plugins/Vectorscope/VecControlsDialog.cpp +++ b/plugins/Vectorscope/VecControlsDialog.cpp @@ -24,13 +24,11 @@ #include "VecControlsDialog.h" -#include -#include -#include -#include -#include -#include "embed.h" +#include +#include + +#include "Knob.h" #include "LedCheckbox.h" #include "VecControls.h" #include "Vectorscope.h" diff --git a/plugins/Vectorscope/VectorView.cpp b/plugins/Vectorscope/VectorView.cpp index f6db921cc..93a384891 100644 --- a/plugins/Vectorscope/VectorView.cpp +++ b/plugins/Vectorscope/VectorView.cpp @@ -31,6 +31,7 @@ #include "ColorChooser.h" #include "GuiApplication.h" #include "MainWindow.h" +#include "VecControls.h" VectorView::VectorView(VecControls *controls, LocklessRingBuffer *inputBuffer, unsigned short displaySize, QWidget *parent) : diff --git a/plugins/Vectorscope/VectorView.h b/plugins/Vectorscope/VectorView.h index 066e306a0..8e88847ab 100644 --- a/plugins/Vectorscope/VectorView.h +++ b/plugins/Vectorscope/VectorView.h @@ -23,14 +23,11 @@ #ifndef VECTORVIEW_H #define VECTORVIEW_H -#include -#include #include -#include "Knob.h" -#include "LedCheckbox.h" #include "LocklessRingBuffer.h" -#include "VecControls.h" + +class VecControls; //#define VEC_DEBUG diff --git a/plugins/VstEffect/VstEffect.cpp b/plugins/VstEffect/VstEffect.cpp index d3d722990..df5b18eb9 100644 --- a/plugins/VstEffect/VstEffect.cpp +++ b/plugins/VstEffect/VstEffect.cpp @@ -22,13 +22,13 @@ * */ -#include #include "VstEffect.h" #include "GuiApplication.h" #include "Song.h" #include "TextFloat.h" +#include "VstPlugin.h" #include "VstSubPluginFeatures.h" #include "embed.h" diff --git a/plugins/VstEffect/VstEffect.h b/plugins/VstEffect/VstEffect.h index 95834e862..6b6d72259 100644 --- a/plugins/VstEffect/VstEffect.h +++ b/plugins/VstEffect/VstEffect.h @@ -25,11 +25,10 @@ #ifndef _VST_EFFECT_H #define _VST_EFFECT_H -#include -#include +#include +#include #include "Effect.h" -#include "VstEffectControlDialog.h" #include "VstEffectControls.h" class VstPlugin; @@ -49,11 +48,6 @@ public: return &m_vstControls; } - virtual inline QString publicName() const - { - return m_plugin->name(); - } - private: void openPlugin( const QString & _plugin ); diff --git a/plugins/VstEffect/VstEffectControlDialog.cpp b/plugins/VstEffect/VstEffectControlDialog.cpp index f160367d0..a675ea1f5 100644 --- a/plugins/VstEffect/VstEffectControlDialog.cpp +++ b/plugins/VstEffect/VstEffectControlDialog.cpp @@ -23,20 +23,17 @@ */ #include -#include #include #include #include "VstEffectControlDialog.h" #include "VstEffect.h" +#include "VstPlugin.h" -#include "ConfigManager.h" #include "PixmapButton.h" #include "embed.h" #include "ToolTip.h" -#include -#include #include "gui_templates.h" #include #include diff --git a/plugins/VstEffect/VstEffectControlDialog.h b/plugins/VstEffect/VstEffectControlDialog.h index 930f514c9..dad68ae04 100644 --- a/plugins/VstEffect/VstEffectControlDialog.h +++ b/plugins/VstEffect/VstEffectControlDialog.h @@ -26,16 +26,14 @@ #define _VST_EFFECT_CONTROL_DIALOG_H #include "EffectControlDialog.h" -#include "VstPlugin.h" -#include -#include -#include #include class VstEffectControls; +class VstPlugin; class PixmapButton; +class QLabel; class QPixmap; class QPushButton; class PixmapButton; diff --git a/plugins/VstEffect/VstEffectControls.cpp b/plugins/VstEffect/VstEffectControls.cpp index 68181e2a0..bbfff5f64 100644 --- a/plugins/VstEffect/VstEffectControls.cpp +++ b/plugins/VstEffect/VstEffectControls.cpp @@ -22,15 +22,24 @@ * */ +#include #include +#include +#include +#include +#include +#include "embed.h" +#include "CustomTextKnob.h" #include "VstEffectControls.h" +#include "VstEffectControlDialog.h" #include "VstEffect.h" +#include "VstPlugin.h" #include "LocaleHelper.h" #include "MainWindow.h" #include "GuiApplication.h" -#include +#include "SubWindow.h" #include diff --git a/plugins/VstEffect/VstEffectControls.h b/plugins/VstEffect/VstEffectControls.h index cb98d0f43..2592f1291 100644 --- a/plugins/VstEffect/VstEffectControls.h +++ b/plugins/VstEffect/VstEffectControls.h @@ -26,20 +26,17 @@ #define _VST_EFFECT_CONTROLS_H #include "EffectControls.h" -#include "VstEffectControlDialog.h" -#include -#include "embed.h" -#include -#include -#include -#include "CustomTextKnob.h" -#include -#include #include +class CustomTextKnob; +class QGridLayout; +class QPaintEvent; +class QPushButton; +class QMdiSubWindow; +class QScrollArea; class VstEffect; diff --git a/plugins/VstEffect/VstSubPluginFeatures.h b/plugins/VstEffect/VstSubPluginFeatures.h index 00629d66d..1c6d9cc2a 100644 --- a/plugins/VstEffect/VstSubPluginFeatures.h +++ b/plugins/VstEffect/VstSubPluginFeatures.h @@ -27,7 +27,9 @@ #ifndef _VST_SUBPLUGIN_FEATURES_H #define _VST_SUBPLUGIN_FEATURES_H + #include "Effect.h" +#include "Plugin.h" class VstSubPluginFeatures : public Plugin::Descriptor::SubPluginFeatures diff --git a/plugins/Xpressive/ExprSynth.cpp b/plugins/Xpressive/ExprSynth.cpp index 7d1cf13b6..ceb79138e 100644 --- a/plugins/Xpressive/ExprSynth.cpp +++ b/plugins/Xpressive/ExprSynth.cpp @@ -27,11 +27,9 @@ #include #include -#include -#include +#include #include -#include "Xpressive.h" #include "interpolation.h" #include "lmms_math.h" diff --git a/plugins/Xpressive/ExprSynth.h b/plugins/Xpressive/ExprSynth.h index bb25fd036..1246058ca 100644 --- a/plugins/Xpressive/ExprSynth.h +++ b/plugins/Xpressive/ExprSynth.h @@ -30,11 +30,15 @@ #include #include "AutomatableModel.h" #include "Graph.h" -#include "Instrument.h" #include "MemoryManager.h" - +class automatableButtonGroup; class ExprFrontData; +class Knob; +class LedCheckBox; +class NotePlayHandle; +class PixmapButton; + class ExprFront { diff --git a/plugins/Xpressive/Xpressive.cpp b/plugins/Xpressive/Xpressive.cpp index 51b00de87..99bd7fa52 100644 --- a/plugins/Xpressive/Xpressive.cpp +++ b/plugins/Xpressive/Xpressive.cpp @@ -25,6 +25,7 @@ #include "Xpressive.h" #include +#include #include "AudioEngine.h" #include "Engine.h" @@ -35,10 +36,8 @@ #include "LedCheckbox.h" #include "MainWindow.h" #include "NotePlayHandle.h" -#include "Oscillator.h" #include "PixmapButton.h" #include "Song.h" -#include "SubWindow.h" #include "ToolTip.h" #include "base64.h" diff --git a/plugins/Xpressive/Xpressive.h b/plugins/Xpressive/Xpressive.h index 5abee2691..651660cfe 100644 --- a/plugins/Xpressive/Xpressive.h +++ b/plugins/Xpressive/Xpressive.h @@ -26,14 +26,12 @@ #ifndef XPRESSIVE_H #define XPRESSIVE_H -#include + +#include #include "Graph.h" #include "Instrument.h" #include "InstrumentView.h" -#include "Knob.h" -#include "LedCheckbox.h" -#include "PixmapButton.h" #include "ExprSynth.h" @@ -50,6 +48,7 @@ const int NUM_EXPRS = 5; class ExprFront; class SubWindow; +class QPlainTextEdit; diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 65d2cd669..e7cf2495d 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -25,22 +25,21 @@ #include "audio_file_processor.h" #include -#include -#include #include #include #include #include "AudioEngine.h" +#include "ComboBox.h" #include "ConfigManager.h" #include "DataFile.h" #include "Engine.h" #include "gui_templates.h" #include "InstrumentTrack.h" -#include "interpolation.h" #include "NotePlayHandle.h" #include "PathUtil.h" +#include "PixmapButton.h" #include "Song.h" #include "StringPairDrag.h" #include "ToolTip.h" diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h index 0df7eeaf1..c16c3f977 100644 --- a/plugins/audio_file_processor/audio_file_processor.h +++ b/plugins/audio_file_processor/audio_file_processor.h @@ -29,13 +29,15 @@ #include +#include "ComboBoxModel.h" #include "Instrument.h" #include "InstrumentView.h" #include "SampleBuffer.h" #include "Knob.h" -#include "PixmapButton.h" -#include "AutomatableButton.h" -#include "ComboBox.h" + +class automatableButtonGroup; +class ComboBox; +class PixmapButton; class audioFileProcessor : public Instrument diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index a79276f30..11d9c852a 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -34,7 +34,6 @@ #include "Knob.h" #include "LedCheckbox.h" #include "NotePlayHandle.h" -#include "Oscillator.h" #include "PixmapButton.h" #include "ToolTip.h" #include "Song.h" diff --git a/plugins/bit_invader/bit_invader.h b/plugins/bit_invader/bit_invader.h index ae9c92cb2..bb9d16ad4 100644 --- a/plugins/bit_invader/bit_invader.h +++ b/plugins/bit_invader/bit_invader.h @@ -27,16 +27,17 @@ #ifndef BIT_INVADER_H #define BIT_INVADER_H +#include "AutomatableModel.h" #include "Instrument.h" #include "InstrumentView.h" #include "Graph.h" -#include "Knob.h" -#include "PixmapButton.h" -#include "LedCheckbox.h" #include "MemoryManager.h" class oscillator; class bitInvaderView; +class Knob; +class LedCheckBox; +class PixmapButton; class bSynth { diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp index 01cbb8454..1f23977e8 100644 --- a/plugins/carlabase/carla.cpp +++ b/plugins/carlabase/carla.cpp @@ -26,22 +26,23 @@ #include "AudioEngine.h" #include "Engine.h" -#include "Song.h" #include "GuiApplication.h" #include "InstrumentPlayHandle.h" #include "InstrumentTrack.h" +#include "Knob.h" #include "MidiEventToByteSeq.h" #include "MainWindow.h" -#include "Song.h" #include "gui_templates.h" +#include "Song.h" #include #include +#include #include -#include #include +#include +#include #include -#include #include #include #include @@ -49,6 +50,7 @@ #include #include #include +#include #include #include diff --git a/plugins/carlabase/carla.h b/plugins/carlabase/carla.h index 6de8e3379..da36147a3 100644 --- a/plugins/carlabase/carla.h +++ b/plugins/carlabase/carla.h @@ -31,12 +31,8 @@ // qt #include -#include -#include -#include -#include -#include -#include +#include +#include // carla/source/includes #include "carlabase_export.h" @@ -54,16 +50,22 @@ #endif // lmms/include/ -#include "EffectControls.h" +#include "AutomatableModel.h" #include "Instrument.h" #include "InstrumentView.h" -#include "Knob.h" #include "SubWindow.h" class QPushButton; class QComboBox; +class QCompleter; +class QGridLayout; +class QHBoxLayout; +class QLineEdit; +class QStringListModel; +class QScrollArea; class CarlaParamsView; +class Knob; class CarlaParamFloatModel : public FloatModel { diff --git a/plugins/dynamics_processor/dynamics_processor.cpp b/plugins/dynamics_processor/dynamics_processor.cpp index 0dae64504..c1918e86c 100644 --- a/plugins/dynamics_processor/dynamics_processor.cpp +++ b/plugins/dynamics_processor/dynamics_processor.cpp @@ -27,6 +27,7 @@ #include "dynamics_processor.h" #include "lmms_math.h" #include "interpolation.h" +#include "RmsHelper.h" #include "embed.h" #include "plugin_export.h" diff --git a/plugins/dynamics_processor/dynamics_processor.h b/plugins/dynamics_processor/dynamics_processor.h index 3edf98cfc..695af679b 100644 --- a/plugins/dynamics_processor/dynamics_processor.h +++ b/plugins/dynamics_processor/dynamics_processor.h @@ -29,7 +29,8 @@ #include "Effect.h" #include "dynamics_processor_controls.h" -#include "RmsHelper.h" + +class RmsHelper; class dynProcEffect : public Effect diff --git a/plugins/dynamics_processor/dynamics_processor_control_dialog.cpp b/plugins/dynamics_processor/dynamics_processor_control_dialog.cpp index 00d92f944..989555d79 100644 --- a/plugins/dynamics_processor/dynamics_processor_control_dialog.cpp +++ b/plugins/dynamics_processor/dynamics_processor_control_dialog.cpp @@ -24,15 +24,14 @@ */ -#include #include "dynamics_processor_control_dialog.h" #include "dynamics_processor_controls.h" #include "embed.h" #include "Graph.h" +#include "Knob.h" #include "PixmapButton.h" #include "ToolTip.h" -#include "LedCheckbox.h" dynProcControlDialog::dynProcControlDialog( diff --git a/plugins/dynamics_processor/dynamics_processor_controls.h b/plugins/dynamics_processor/dynamics_processor_controls.h index 8682531d1..df292d690 100644 --- a/plugins/dynamics_processor/dynamics_processor_controls.h +++ b/plugins/dynamics_processor/dynamics_processor_controls.h @@ -28,7 +28,6 @@ #include "EffectControls.h" #include "dynamics_processor_control_dialog.h" -#include "Knob.h" #include "Graph.h" class dynProcEffect; diff --git a/plugins/kicker/kicker.cpp b/plugins/kicker/kicker.cpp index 1867f6f3b..22c4f5550 100644 --- a/plugins/kicker/kicker.cpp +++ b/plugins/kicker/kicker.cpp @@ -24,16 +24,18 @@ */ -#include -#include + +#include #include "kicker.h" #include "AudioEngine.h" #include "Engine.h" #include "InstrumentTrack.h" #include "Knob.h" +#include "LedCheckbox.h" #include "NotePlayHandle.h" #include "KickerOsc.h" +#include "TempoSyncKnob.h" #include "embed.h" #include "plugin_export.h" diff --git a/plugins/kicker/kicker.h b/plugins/kicker/kicker.h index 22b2b854f..348b84e75 100644 --- a/plugins/kicker/kicker.h +++ b/plugins/kicker/kicker.h @@ -27,12 +27,14 @@ #ifndef KICKER_H #define KICKER_H -#include +#include "AutomatableModel.h" #include "Instrument.h" #include "InstrumentView.h" -#include "Knob.h" -#include "LedCheckbox.h" -#include "TempoSyncKnob.h" +#include "TempoSyncKnobModel.h" + +class Knob; +class LedCheckBox; + #define KICKER_PRESET_VERSION 1 diff --git a/plugins/ladspa_browser/ladspa_port_dialog.cpp b/plugins/ladspa_browser/ladspa_port_dialog.cpp index f1301f744..5eb3a3947 100644 --- a/plugins/ladspa_browser/ladspa_port_dialog.cpp +++ b/plugins/ladspa_browser/ladspa_port_dialog.cpp @@ -25,8 +25,8 @@ #include "ladspa_port_dialog.h" -#include #include +#include #include "AudioEngine.h" #include "embed.h" diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 2385073b2..f06b83b13 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -30,7 +30,7 @@ // Need to include this first to ensure we get M_PI in MinGW with C++11 #define _USE_MATH_DEFINES -#include +#include #include "lb302.h" #include "AutomatableButton.h" @@ -38,6 +38,7 @@ #include "InstrumentPlayHandle.h" #include "InstrumentTrack.h" #include "Knob.h" +#include "LedCheckbox.h" #include "NotePlayHandle.h" #include "Oscillator.h" #include "PixmapButton.h" @@ -64,10 +65,6 @@ #define LB_DEBUG -#ifdef LB_DEBUG -#include -#endif - // // Old config // diff --git a/plugins/lb302/lb302.h b/plugins/lb302/lb302.h index 557d958d4..62b357377 100644 --- a/plugins/lb302/lb302.h +++ b/plugins/lb302/lb302.h @@ -35,14 +35,15 @@ #include "DspEffectLibrary.h" #include "Instrument.h" #include "InstrumentView.h" -#include "LedCheckbox.h" -#include "Knob.h" #include "NotePlayHandle.h" #include static const int NUM_FILTERS = 2; +class automatableButtonGroup; +class Knob; class lb302SynthView; +class LedCheckBox; class NotePlayHandle; class lb302FilterKnobState diff --git a/plugins/monstro/Monstro.cpp b/plugins/monstro/Monstro.cpp index 39f5fa66e..90ce43c8c 100644 --- a/plugins/monstro/Monstro.cpp +++ b/plugins/monstro/Monstro.cpp @@ -26,11 +26,12 @@ #include #include "Monstro.h" + +#include "ComboBox.h" #include "Engine.h" #include "InstrumentTrack.h" #include "gui_templates.h" #include "ToolTip.h" -#include "Song.h" #include "lmms_math.h" #include "interpolation.h" diff --git a/plugins/monstro/Monstro.h b/plugins/monstro/Monstro.h index c8acde3f0..c535fc92c 100644 --- a/plugins/monstro/Monstro.h +++ b/plugins/monstro/Monstro.h @@ -28,18 +28,18 @@ #include +#include "ComboBoxModel.h" #include "Instrument.h" #include "InstrumentView.h" #include "AutomatableModel.h" -#include "AutomatableButton.h" #include "TempoSyncKnob.h" -#include "NotePlayHandle.h" #include "PixmapButton.h" -#include "ComboBox.h" #include "Oscillator.h" #include "lmms_math.h" #include "BandLimitedWave.h" +class ComboBox; + // // UI Macros // diff --git a/plugins/nes/Nes.cpp b/plugins/nes/Nes.cpp index 637fbfcd3..fb18a8fe0 100644 --- a/plugins/nes/Nes.cpp +++ b/plugins/nes/Nes.cpp @@ -25,14 +25,14 @@ #include #include "Nes.h" + #include "AudioEngine.h" #include "Engine.h" #include "InstrumentTrack.h" -#include "ToolTip.h" -#include "Song.h" -#include "lmms_math.h" #include "interpolation.h" +#include "Knob.h" #include "Oscillator.h" +#include "ToolTip.h" #include "embed.h" #include "plugin_export.h" diff --git a/plugins/nes/Nes.h b/plugins/nes/Nes.h index 1646bae31..9d4ca5357 100644 --- a/plugins/nes/Nes.h +++ b/plugins/nes/Nes.h @@ -30,9 +30,6 @@ #include "Instrument.h" #include "InstrumentView.h" #include "AutomatableModel.h" -#include "AutomatableButton.h" -#include "TempoSyncKnob.h" -#include "NotePlayHandle.h" #include "PixmapButton.h" #include "MemoryManager.h" @@ -79,6 +76,7 @@ const float NES_MIXING_ALL = 1.0 / ( NES_MIXING_12 + NES_MIXING_34 ); // constan const int MIN_WLEN = 4; +class Knob; class NesInstrument; class NesObject diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index 1dbc06b85..44cf98fe1 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -27,7 +27,6 @@ #include -#include #include "Engine.h" @@ -37,7 +36,6 @@ #include "NotePlayHandle.h" #include "Oscillator.h" #include "PixmapButton.h" -#include "ToolTip.h" #include "embed.h" diff --git a/plugins/organic/organic.h b/plugins/organic/organic.h index c0bc29f16..519a86548 100644 --- a/plugins/organic/organic.h +++ b/plugins/organic/organic.h @@ -30,13 +30,13 @@ #include "Instrument.h" #include "InstrumentView.h" -#include "Oscillator.h" #include "AutomatableModel.h" class QPixmap; class Knob; class NotePlayHandle; +class Oscillator; class PixmapButton; const int NUM_OSCILLATORS = 8; diff --git a/plugins/peak_controller_effect/peak_controller_effect.cpp b/plugins/peak_controller_effect/peak_controller_effect.cpp index 6db4fba5c..419411f64 100644 --- a/plugins/peak_controller_effect/peak_controller_effect.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect.cpp @@ -24,7 +24,6 @@ */ -#include "Controller.h" #include "Song.h" #include "PresetPreviewPlayHandle.h" #include "PeakController.h" diff --git a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp index 88538b813..6650a8d99 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp @@ -25,8 +25,9 @@ -#include -#include + +#include +#include #include "peak_controller_effect_control_dialog.h" #include "peak_controller_effect_controls.h" diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp index ff87d0d99..e77597b2c 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp @@ -26,7 +26,6 @@ #include -#include "PeakController.h" #include "peak_controller_effect_controls.h" #include "peak_controller_effect.h" #include "Song.h" diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.h b/plugins/peak_controller_effect/peak_controller_effect_controls.h index fe90eddca..0b1154db7 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_controls.h +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.h @@ -28,7 +28,6 @@ #include "EffectControls.h" #include "peak_controller_effect_control_dialog.h" -#include "Knob.h" class PeakControllerEffect; diff --git a/plugins/sf2_player/patches_dialog.cpp b/plugins/sf2_player/patches_dialog.cpp index 9586e7408..1cfcc868c 100644 --- a/plugins/sf2_player/patches_dialog.cpp +++ b/plugins/sf2_player/patches_dialog.cpp @@ -25,8 +25,12 @@ #include "patches_dialog.h" +#include #include //#include +#include + +#include "fluidsynthshims.h" // Custom list-view item (as for numerical sort purposes...) diff --git a/plugins/sf2_player/patches_dialog.h b/plugins/sf2_player/patches_dialog.h index 76387e830..d2d1d94fe 100644 --- a/plugins/sf2_player/patches_dialog.h +++ b/plugins/sf2_player/patches_dialog.h @@ -26,12 +26,13 @@ #ifndef _PATCHES_DIALOG_H #define _PATCHES_DIALOG_H +#include + #include "ui_patches_dialog.h" #include "LcdSpinBox.h" -#include "fluidsynthshims.h" -#include -#include +class QLabel; + //---------------------------------------------------------------------------- // qsynthPresetForm -- UI wrapper form. diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 2f42fc230..b180e66b6 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -25,23 +25,23 @@ #include "sf2_player.h" +#include #include -#include +#include #include -#include #include "AudioEngine.h" #include "ConfigManager.h" #include "FileDialog.h" -#include "ConfigManager.h" #include "Engine.h" #include "InstrumentTrack.h" #include "InstrumentPlayHandle.h" #include "Knob.h" #include "NotePlayHandle.h" #include "PathUtil.h" -#include "SampleBuffer.h" +#include "PixmapButton.h" #include "Song.h" +#include "fluidsynthshims.h" #include "patches_dialog.h" #include "ToolTip.h" diff --git a/plugins/sf2_player/sf2_player.h b/plugins/sf2_player/sf2_player.h index afd7bfecd..853839b9f 100644 --- a/plugins/sf2_player/sf2_player.h +++ b/plugins/sf2_player/sf2_player.h @@ -27,21 +27,20 @@ #ifndef SF2_PLAYER_H #define SF2_PLAYER_H +#include #include #include #include "Instrument.h" -#include "PixmapButton.h" #include "InstrumentView.h" -#include "Knob.h" #include "LcdSpinBox.h" -#include "LedCheckbox.h" -#include "fluidsynthshims.h" #include "MemoryManager.h" class sf2InstrumentView; class sf2Font; +class Knob; class NotePlayHandle; +class PixmapButton; class patchesDialog; class QLabel; diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index bfdd22b55..c96daccb5 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -24,7 +24,7 @@ */ #include -#include +#include #define rnd(n) (rand()%(n+1)) @@ -44,11 +44,9 @@ float frnd(float range) #include "Engine.h" #include "InstrumentTrack.h" #include "Knob.h" -#include "lmms_constants.h" #include "NotePlayHandle.h" #include "PixmapButton.h" #include "ToolTip.h" -#include "Song.h" #include "MidiEvent.h" #include "embed.h" diff --git a/plugins/sfxr/sfxr.h b/plugins/sfxr/sfxr.h index 20ae54c96..d7b599c40 100644 --- a/plugins/sfxr/sfxr.h +++ b/plugins/sfxr/sfxr.h @@ -28,12 +28,9 @@ #ifndef SFXR_H #define SFXR_H +#include "AutomatableModel.h" #include "Instrument.h" #include "InstrumentView.h" -#include "Knob.h" -#include "Graph.h" -#include "PixmapButton.h" -#include "LedCheckbox.h" #include "MemoryManager.h" @@ -64,6 +61,9 @@ const int KNOB_BLOCK_SIZE_Y = 40; +class automatableButtonGroup; +class Knob; +class PixmapButton; class sfxrInstrument; diff --git a/plugins/stereo_enhancer/stereo_enhancer.h b/plugins/stereo_enhancer/stereo_enhancer.h index c13af958e..b5fb406ed 100644 --- a/plugins/stereo_enhancer/stereo_enhancer.h +++ b/plugins/stereo_enhancer/stereo_enhancer.h @@ -28,7 +28,6 @@ #include "Effect.h" #include "DspEffectLibrary.h" -#include "Engine.h" #include "stereoenhancer_controls.h" class stereoEnhancerEffect : public Effect diff --git a/plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp b/plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp index 47523f05f..52f471c5c 100644 --- a/plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp +++ b/plugins/stereo_enhancer/stereoenhancer_control_dialog.cpp @@ -24,9 +24,12 @@ -#include #include "stereoenhancer_control_dialog.h" + +#include + +#include "Knob.h" #include "stereoenhancer_controls.h" diff --git a/plugins/stereo_enhancer/stereoenhancer_controls.h b/plugins/stereo_enhancer/stereoenhancer_controls.h index 458d6e860..ad4da3e90 100644 --- a/plugins/stereo_enhancer/stereoenhancer_controls.h +++ b/plugins/stereo_enhancer/stereoenhancer_controls.h @@ -27,7 +27,6 @@ #include "EffectControls.h" #include "stereoenhancer_control_dialog.h" -#include "Knob.h" class stereoEnhancerEffect; diff --git a/plugins/stereo_matrix/stereomatrix_control_dialog.cpp b/plugins/stereo_matrix/stereomatrix_control_dialog.cpp index 79a366048..d82f06e04 100644 --- a/plugins/stereo_matrix/stereomatrix_control_dialog.cpp +++ b/plugins/stereo_matrix/stereomatrix_control_dialog.cpp @@ -24,12 +24,12 @@ -#include -#include #include "stereomatrix_control_dialog.h" -#include "stereomatrix_controls.h" + #include "embed.h" +#include "Knob.h" +#include "stereomatrix_controls.h" diff --git a/plugins/stereo_matrix/stereomatrix_controls.h b/plugins/stereo_matrix/stereomatrix_controls.h index 4f886cae7..211e1da1d 100644 --- a/plugins/stereo_matrix/stereomatrix_controls.h +++ b/plugins/stereo_matrix/stereomatrix_controls.h @@ -27,7 +27,6 @@ #include "EffectControls.h" #include "stereomatrix_control_dialog.h" -#include "Knob.h" class stereoMatrixEffect; diff --git a/plugins/stk/mallets/mallets.cpp b/plugins/stk/mallets/mallets.cpp index a175b385d..1b5aef420 100644 --- a/plugins/stk/mallets/mallets.cpp +++ b/plugins/stk/mallets/mallets.cpp @@ -27,6 +27,7 @@ #include "mallets.h" #include +#include #include #include "BandedWG.h" diff --git a/plugins/triple_oscillator/TripleOscillator.cpp b/plugins/triple_oscillator/TripleOscillator.cpp index a39da6cb5..29f5fbce5 100644 --- a/plugins/triple_oscillator/TripleOscillator.cpp +++ b/plugins/triple_oscillator/TripleOscillator.cpp @@ -23,9 +23,8 @@ */ -#include -#include -#include + +#include #include "TripleOscillator.h" #include "AudioEngine.h" @@ -35,6 +34,7 @@ #include "InstrumentTrack.h" #include "Knob.h" #include "NotePlayHandle.h" +#include "Oscillator.h" #include "PixmapButton.h" #include "SampleBuffer.h" #include "ToolTip.h" diff --git a/plugins/triple_oscillator/TripleOscillator.h b/plugins/triple_oscillator/TripleOscillator.h index 6c8487463..944834417 100644 --- a/plugins/triple_oscillator/TripleOscillator.h +++ b/plugins/triple_oscillator/TripleOscillator.h @@ -28,13 +28,13 @@ #include "Instrument.h" #include "InstrumentView.h" -#include "Oscillator.h" #include "AutomatableModel.h" class automatableButtonGroup; class Knob; class NotePlayHandle; +class Oscillator; class PixmapButton; class SampleBuffer; diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 97af8bc43..8c25e19bb 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -22,7 +22,7 @@ * */ -#include +#include #include "VstPlugin.h" @@ -31,18 +31,18 @@ #include #include -#include +#include #include #include +#include #include #include #include -#include #include "AudioEngine.h" -#include "BufferManager.h" #include "ConfigManager.h" +#include "CustomTextKnob.h" #include "Engine.h" #include "FileDialog.h" #include "GuiApplication.h" @@ -53,9 +53,9 @@ #include "MainWindow.h" #include "PathUtil.h" #include "PixmapButton.h" -#include "SampleBuffer.h" #include "Song.h" #include "StringPairDrag.h" +#include "SubWindow.h" #include "TextFloat.h" #include "ToolTip.h" #include "Clipboard.h" @@ -78,7 +78,11 @@ Plugin::Descriptor Q_DECL_EXPORT vestige_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), +#ifdef LMMS_BUILD_LINUX + "dll,so", +#else "dll", +#endif nullptr, } ; @@ -682,6 +686,9 @@ void VestigeInstrumentView::openPlugin() QStringList types; types << tr( "DLL-files (*.dll)" ) << tr( "EXE-files (*.exe)" ) +#ifdef LMMS_BUILD_LINUX + << tr( "SO-files (*.so)" ) +#endif ; ofd.setNameFilters( types ); diff --git a/plugins/vestige/vestige.h b/plugins/vestige/vestige.h index 60c75cd9d..9f2e6b02d 100644 --- a/plugins/vestige/vestige.h +++ b/plugins/vestige/vestige.h @@ -27,20 +27,20 @@ #define _VESTIGE_H +#include #include -#include -#include #include "Instrument.h" #include "InstrumentView.h" -#include "CustomTextKnob.h" -#include "SubWindow.h" -#include "AutomatableModel.h" class QPixmap; class QPushButton; +class QScrollArea; +class CustomTextKnob; +class FloatModel; +class QGridLayout; class PixmapButton; class VstPlugin; diff --git a/plugins/vibed/nine_button_selector.cpp b/plugins/vibed/nine_button_selector.cpp index 222f232ee..1016613f7 100644 --- a/plugins/vibed/nine_button_selector.cpp +++ b/plugins/vibed/nine_button_selector.cpp @@ -27,7 +27,7 @@ #include "nine_button_selector.h" #include "CaptionMenu.h" -#include "embed.h" +#include "PixmapButton.h" nineButtonSelector::nineButtonSelector( QPixmap _button0_on, diff --git a/plugins/vibed/nine_button_selector.h b/plugins/vibed/nine_button_selector.h index dd68a8261..7897e1f52 100644 --- a/plugins/vibed/nine_button_selector.h +++ b/plugins/vibed/nine_button_selector.h @@ -25,7 +25,14 @@ #ifndef _NINE_BUTTON_SELECTOR_H #define _NINE_BUTTON_SELECTOR_H -#include "PixmapButton.h" + +#include + +#include "AutomatableModelView.h" + +class Knob; +class PixmapButton; +class graphModel; class nineButtonSelector: public QWidget , public IntModelView diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 8e582158f..5f6b5ff95 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -22,18 +22,21 @@ * */ -#include -#include + +#include #include "vibed.h" #include "AudioEngine.h" #include "Engine.h" +#include "Graph.h" #include "InstrumentTrack.h" +#include "Knob.h" +#include "LedCheckbox.h" #include "NotePlayHandle.h" +#include "PixmapButton.h" #include "ToolTip.h" #include "base64.h" #include "CaptionMenu.h" -#include "Oscillator.h" #include "string_container.h" #include "volume.h" #include "Song.h" diff --git a/plugins/vibed/vibed.h b/plugins/vibed/vibed.h index b1c33f4b7..e3dfd7601 100644 --- a/plugins/vibed/vibed.h +++ b/plugins/vibed/vibed.h @@ -26,14 +26,12 @@ #include "Instrument.h" #include "InstrumentView.h" -#include "Graph.h" -#include "Knob.h" -#include "PixmapButton.h" -#include "LedCheckbox.h" #include "nine_button_selector.h" -class vibedView; +class Graph; +class LedCheckBox; class NotePlayHandle; +class vibedView; class vibed : public Instrument { diff --git a/plugins/vibed/vibrating_string.cpp b/plugins/vibed/vibrating_string.cpp index aee2d2527..77c9fda87 100644 --- a/plugins/vibed/vibrating_string.cpp +++ b/plugins/vibed/vibrating_string.cpp @@ -21,7 +21,7 @@ * Boston, MA 02110-1301 USA. * */ -#include +#include #include "vibrating_string.h" #include "interpolation.h" diff --git a/plugins/vibed/vibrating_string.h b/plugins/vibed/vibrating_string.h index 3739d19a9..1bb8720ea 100644 --- a/plugins/vibed/vibrating_string.h +++ b/plugins/vibed/vibrating_string.h @@ -24,7 +24,6 @@ #ifndef _VIBRATING_STRING_H #define _VIBRATING_STRING_H -#include #include #include "lmms_basics.h" diff --git a/plugins/vst_base/CMakeLists.txt b/plugins/vst_base/CMakeLists.txt index 873ed5f8e..68bdb9939 100644 --- a/plugins/vst_base/CMakeLists.txt +++ b/plugins/vst_base/CMakeLists.txt @@ -8,6 +8,10 @@ INCLUDE(ExternalProject) # These variables are not meant to be used normally, except packaging SET(REMOTE_VST_PLUGIN_FILEPATH_32 "32/RemoteVstPlugin32" CACHE STRING "Relative file path to RemoteVstPlugin32") SET(REMOTE_VST_PLUGIN_FILEPATH_64 "RemoteVstPlugin64" CACHE STRING "Relative file path to RemoteVstPlugin64") +IF(LMMS_BUILD_LINUX) + SET(NATIVE_LINUX_REMOTE_VST_PLUGIN_FILEPATH_64 "NativeLinuxRemoteVstPlugin64" + CACHE STRING "Relative file path to NativeLinuxRemoteVstPlugin64") +ENDIF() ADD_SUBDIRECTORY(vstbase) @@ -48,3 +52,7 @@ ENDIF() IF(WANT_VST_64) INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin64.cmake") ENDIF() + +IF(LMMS_BUILD_LINUX) + INCLUDE("${CMAKE_CURRENT_LIST_DIR}/NativeLinuxRemoteVstPlugin64.cmake") +ENDIF() diff --git a/plugins/vst_base/NativeLinuxRemoteVstPlugin64.cmake b/plugins/vst_base/NativeLinuxRemoteVstPlugin64.cmake new file mode 100644 index 000000000..dc5823604 --- /dev/null +++ b/plugins/vst_base/NativeLinuxRemoteVstPlugin64.cmake @@ -0,0 +1,11 @@ +IF(LMMS_BUILD_LINUX) + ExternalProject_Add(NativeLinuxRemoteVstPlugin64 + "${EXTERNALPROJECT_ARGS}" + CMAKE_ARGS + "${EXTERNALPROJECT_CMAKE_ARGS}" + "-DCMAKE_CXX_FLAGS=-m64 -DNATIVE_LINUX_VST" + "-DCMAKE_C_FLAGS=-DNATIVE_LINUX_VST" + ) + INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../NativeLinuxRemoteVstPlugin64" DESTINATION "${PLUGIN_DIR}") +ENDIF() + diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index c949147eb..a1ce1f07c 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -10,6 +10,9 @@ * Copyright (c) 2004 Torben Hohn * Copyright (c) 2002 Kjetil S. Matheussen * + * X11 code partly taken from https://github.com/ekenberg/vstminihost: + * Copyright (c) 2012 Johan Ekenberg + * * 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 @@ -52,12 +55,39 @@ #include #endif +#ifndef NATIVE_LINUX_VST #include +#endif #endif +#ifndef NATIVE_LINUX_VST #define USE_WS_PREFIX #include +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// https://stackoverflow.com/questions/22476110/c-compiling-error-including-x11-x-h-x11-xlib-h +#undef Bool +#undef CursorShape +#undef Expose +#undef KeyPress +#undef KeyRelease +#undef FocusIn +#undef FocusOut +#undef FontChange +#undef None +#undef Status +#undef Unsorted +#endif #ifdef USE_MINGW_THREADS_REPLACEMENT # include @@ -102,8 +132,8 @@ struct ERect #endif #ifndef USE_QT_SHMEM -#include -#include +#include +#include #include #include #include @@ -122,10 +152,14 @@ class RemoteVstPlugin; RemoteVstPlugin * __plugin = nullptr; +#ifndef NATIVE_LINUX_VST HWND __MessageHwnd = nullptr; DWORD __processingThreadId = 0; +#else +pthread_t __processingThreadId = 0; +#endif - +#ifdef _WIN32 //Returns the last Win32 error, in string format. Returns an empty string if there is no error. std::string GetErrorAsString(DWORD errorMessageID) { @@ -144,7 +178,7 @@ std::string GetErrorAsString(DWORD errorMessageID) return message; } - +#endif class RemoteVstPlugin : public RemotePluginClient { @@ -318,7 +352,13 @@ public: } inline void queueMessage( const message & m ) { +#ifdef NATIVE_LINUX_VST + pthread_mutex_lock(&message_mutex); +#endif m_messageList.push( m ); +#ifdef NATIVE_LINUX_VST + pthread_mutex_unlock(&message_mutex); +#endif } inline bool shouldGiveIdle() const @@ -333,13 +373,28 @@ public: void idle(); void processUIThreadMessages(); +#ifdef NATIVE_LINUX_VST + void sendX11Idle(); +#endif +#ifndef NATIVE_LINUX_VST static DWORD WINAPI processingThread( LPVOID _param ); +#else + static void * processingThread( void * _param ); +#endif + static bool setupMessageWindow(); + +#ifndef NATIVE_LINUX_VST static DWORD WINAPI guiEventLoop(); +#else + void guiEventLoop(); +#endif + +#ifndef NATIVE_LINUX_VST static LRESULT CALLBACK wndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); - +#endif private: enum GuiThreadMessages @@ -389,10 +444,21 @@ private: std::string m_shortName; +#ifndef NATIVE_LINUX_VST HINSTANCE m_libInst; +#else + void* m_libInst = nullptr; +#endif AEffect * m_plugin; - HWND m_window; +#ifndef NATIVE_LINUX_VST + HWND m_window = nullptr; +#else + Window m_window = 0; + Display* m_display = nullptr; + Atom m_wmDeleteMessage; + bool m_x11WindowVisible = false; +#endif intptr_t m_windowID; int m_windowWidth; int m_windowHeight; @@ -402,6 +468,10 @@ private: bool m_processing; +#ifdef NATIVE_LINUX_VST + pthread_mutex_t message_mutex = PTHREAD_MUTEX_INITIALIZER; + bool m_shouldQuit = false; +#endif std::queue m_messageList; bool m_shouldGiveIdle; @@ -446,7 +516,6 @@ RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) : #endif m_libInst( nullptr ), m_plugin( nullptr ), - m_window( nullptr ), m_windowID( 0 ), m_windowWidth( 0 ), m_windowHeight( 0 ), @@ -551,7 +620,11 @@ RemoteVstPlugin::~RemoteVstPlugin() if( m_libInst != nullptr ) { +#ifndef NATIVE_LINUX_VST FreeLibrary( m_libInst ); +#else + dlclose(m_libInst); +#endif m_libInst = nullptr; } @@ -577,7 +650,11 @@ bool RemoteVstPlugin::processMessage( const message & _m ) return true; case IdToggleUI: +#ifndef NATIVE_LINUX_VST if( m_window && IsWindowVisible( m_window ) ) +#else + if (m_window && m_x11WindowVisible) +#endif { hideEditor(); } @@ -585,10 +662,15 @@ bool RemoteVstPlugin::processMessage( const message & _m ) { showEditor(); } + return true; case IdIsUIVisible: +#ifndef NATIVE_LINUX_VST bool visible = m_window && IsWindowVisible( m_window ); +#else + bool visible = m_window && m_x11WindowVisible; +#endif sendMessage( message( IdIsUIVisible ) .addInt( visible ? 1 : 0 ) ); return true; @@ -596,8 +678,10 @@ bool RemoteVstPlugin::processMessage( const message & _m ) } else if (EMBED && _m.id == IdShowUI) { +#ifndef NATIVE_LINUX_VST ShowWindow( m_window, SW_SHOWNORMAL ); UpdateWindow( m_window ); +#endif return true; } @@ -687,6 +771,21 @@ bool RemoteVstPlugin::processMessage( const message & _m ) break; } + case IdIdle: + { +#ifdef NATIVE_LINUX_VST + idle(); +#endif + break; + } + +#ifdef NATIVE_LINUX_VST + case IdQuit: + { + m_shouldQuit = true; + break; + } +#endif default: return RemotePluginClient::processMessage( _m ); } @@ -728,8 +827,8 @@ void RemoteVstPlugin::init( const std::string & _plugin_file ) sendMessage( message( IdVstPluginEditorGeometry ). addInt( m_windowWidth ). addInt( m_windowHeight ) ); - sendMessage( message( IdVstPluginName ).addString( pluginName() ) ); + debugMessage( std::string("plugin name: ") + pluginName() + "\n" ); sendMessage( message( IdVstPluginVersion ).addInt( pluginVersion() ) ); sendMessage( message( IdVstPluginVendorString ). addString( pluginVendorString() ) ); @@ -740,6 +839,7 @@ void RemoteVstPlugin::init( const std::string & _plugin_file ) sendMessage( IdInitDone ); + debugMessage( "initialization done\n" ); m_initialized = true; } @@ -765,7 +865,7 @@ void RemoteVstPlugin::initEditor() return; } - +#ifndef NATIVE_LINUX_VST HMODULE hInst = GetModuleHandle( nullptr ); if( hInst == nullptr ) { @@ -812,6 +912,46 @@ void RemoteVstPlugin::initEditor() // 64-bit versions of Windows use 32-bit handles for interoperability m_windowID = (intptr_t) m_window; #endif + +#else + XEvent e; + Atom prop_atom, val_atom; + + if (m_display == nullptr) + { + m_display = XOpenDisplay(nullptr); + } + m_window = XCreateSimpleWindow(m_display, DefaultRootWindow(m_display), 0, 0, 400, 400, 0, 0, 0); + + m_wmDeleteMessage = XInternAtom(m_display, "WM_DELETE_WINDOW", false); + XSetWMProtocols(m_display, m_window, &m_wmDeleteMessage, 1); + + // make tool window + prop_atom = XInternAtom(m_display, "_NET_WM_WINDOW_TYPE", False); + val_atom = XInternAtom(m_display, "_NET_WM_WINDOW_TYPE_DIALOG", False); + XChangeProperty(m_display, m_window, prop_atom, XA_ATOM, 32, PropModeReplace, (unsigned char *)&val_atom, 1); + + // change name + XStoreName(m_display, m_window, pluginName()); + + ERect * er; + pluginDispatch(effEditGetRect, 0, 0, &er); + + m_windowWidth = er->right - er->left; + m_windowHeight = er->bottom - er->top; + XResizeWindow(m_display, m_window, m_windowWidth, m_windowHeight); + + XMapWindow(m_display, m_window); + XFlush(m_display); + + pluginDispatch(effEditOpen, 0, (intptr_t) m_display, (void*) m_window); + + XSelectInput(m_display, m_window, SubstructureNotifyMask | ButtonPressMask | ButtonReleaseMask + | ButtonMotionMask | ExposureMask | KeyPressMask); + + pluginDispatch(effEditTop); + m_x11WindowVisible = true; +#endif } @@ -820,7 +960,16 @@ void RemoteVstPlugin::initEditor() void RemoteVstPlugin::showEditor() { if( !EMBED && !HEADLESS && m_window ) { +#ifndef NATIVE_LINUX_VST ShowWindow( m_window, SW_SHOWNORMAL ); +#else + if (!m_x11WindowVisible) + { + XMapWindow(m_display, m_window); + XFlush(m_display); + m_x11WindowVisible = true; + } +#endif } } @@ -830,7 +979,16 @@ void RemoteVstPlugin::showEditor() { void RemoteVstPlugin::hideEditor() { if( !EMBED && !HEADLESS && m_window ) { +#ifndef NATIVE_LINUX_VST ShowWindow( m_window, SW_HIDE ); +#else + if (m_x11WindowVisible) + { + XUnmapWindow(m_display, m_window); + XFlush(m_display); + m_x11WindowVisible = false; + } +#endif } } @@ -839,15 +997,24 @@ void RemoteVstPlugin::hideEditor() { void RemoteVstPlugin::destroyEditor() { - if( m_window == nullptr ) + if( !m_window ) { return; } pluginDispatch( effEditClose ); +#ifndef NATIVE_LINUX_VST // Destroying the window takes some time in Wine 1.8.5 DestroyWindow( m_window ); m_window = nullptr; +#else + if (m_display) + { + XCloseDisplay(m_display); + } + m_display = nullptr; + m_window = 0; +#endif } @@ -855,15 +1022,24 @@ void RemoteVstPlugin::destroyEditor() bool RemoteVstPlugin::load( const std::string & _plugin_file ) { +#ifndef NATIVE_LINUX_VST if( ( m_libInst = LoadLibraryW( toWString(_plugin_file).c_str() ) ) == nullptr ) { DWORD error = GetLastError(); debugMessage( "LoadLibrary failed: " + GetErrorAsString(error) ); return false; } +#else + m_libInst = dlopen(_plugin_file.c_str(), RTLD_LAZY); + if ( m_libInst == nullptr) { + debugMessage( std::string("LoadLibrary failed: ") + dlerror() ); + return false; + } +#endif typedef AEffect * ( VST_CALL_CONV * mainEntryPointer ) ( audioMasterCallback ); +#ifndef NATIVE_LINUX_VST mainEntryPointer mainEntry = (mainEntryPointer) GetProcAddress( m_libInst, "VSTPluginMain" ); if( mainEntry == nullptr ) @@ -876,6 +1052,14 @@ bool RemoteVstPlugin::load( const std::string & _plugin_file ) mainEntry = (mainEntryPointer) GetProcAddress( m_libInst, "main" ); } +#else + mainEntryPointer mainEntry = (mainEntryPointer) dlsym(m_libInst, "VSTPluginMain"); + if( mainEntry == nullptr ) + mainEntry = (mainEntryPointer) dlsym(m_libInst, "VstPluginMain"); + if( mainEntry == nullptr ) + mainEntry = (mainEntryPointer) dlsym(m_libInst, "main"); +#endif + if( mainEntry == nullptr ) { debugMessage( "could not find entry point\n" ); @@ -885,7 +1069,7 @@ bool RemoteVstPlugin::load( const std::string & _plugin_file ) m_plugin = mainEntry( hostCallback ); if( m_plugin == nullptr ) { - debugMessage( "mainEntry procedure returned NULL\n" ); + debugMessage( "mainEntry procedure returned nullptr\n" ); return false; } @@ -1550,7 +1734,11 @@ int RemoteVstPlugin::updateInOutCount() return 1; } +#ifndef NATIVE_LINUX_VST if( GetCurrentThreadId() == __processingThreadId ) +#else + if( pthread_equal(pthread_self(), __processingThreadId) ) +#endif { debugMessage( "Plugin requested I/O change from processing " "thread. Request denied; stability may suffer.\n" ); @@ -1643,7 +1831,11 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, SHOW_CALLBACK ("amc: audioMasterIdle\n" ); // call application idle routine (this will // call effEditIdle for all open editors too) +#ifndef NATIVE_LINUX_VST PostMessage( __MessageHwnd, WM_USER, GiveIdle, 0 ); +#else + __plugin->sendX11Idle(); +#endif return 0; case audioMasterPinConnected: @@ -1663,7 +1855,7 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, // items may require extensive conversions // Shared memory was initialised? - see song.cpp - //assert( __plugin->m_vstSyncData != NULL ); + //assert( __plugin->m_vstSyncData != nullptr ); memset( &_timeInfo, 0, sizeof( _timeInfo ) ); _timeInfo.samplePos = __plugin->m_currentSamplePos; @@ -1840,6 +2032,7 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, } __plugin->m_windowWidth = _index; __plugin->m_windowHeight = _value; +#ifndef NATIVE_LINUX_VST HWND window = __plugin->m_window; DWORD dwStyle = GetWindowLongPtr( window, GWL_STYLE ); RECT windowSize = { 0, 0, (int) _index, (int) _value }; @@ -1849,6 +2042,10 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, windowSize.bottom - windowSize.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER ); +#else + XResizeWindow(__plugin->m_display, __plugin->m_window, (int) _index, (int) _value); + XFlush(__plugin->m_display); +#endif __plugin->sendMessage( message( IdVstPluginEditorGeometry ). addInt( __plugin->m_windowWidth ). @@ -1963,7 +2160,11 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, case audioMasterUpdateDisplay: SHOW_CALLBACK( "amc: audioMasterUpdateDisplay\n" ); // something has changed, update 'multi-fx' display +#ifndef NATIVE_LINUX_VST PostMessage( __MessageHwnd, WM_USER, GiveIdle, 0 ); +#else + __plugin->sendX11Idle(); +#endif return 0; #if kVstVersion > 2 @@ -2017,35 +2218,87 @@ void RemoteVstPlugin::idle() void RemoteVstPlugin::processUIThreadMessages() { setProcessing( true ); - while( m_messageList.size() ) +#ifdef NATIVE_LINUX_VST + pthread_mutex_lock(&message_mutex); +#endif + + size_t size = m_messageList.size(); + +#ifdef NATIVE_LINUX_VST + pthread_mutex_unlock(&message_mutex); +#endif + + while( size ) { - processMessage( m_messageList.front() ); + +#ifdef NATIVE_LINUX_VST + pthread_mutex_lock(&message_mutex); +#endif + + message m = m_messageList.front(); + +#ifdef NATIVE_LINUX_VST + pthread_mutex_unlock(&message_mutex); +#endif + + processMessage( m ); + +#ifdef NATIVE_LINUX_VST + pthread_mutex_lock(&message_mutex); +#endif + m_messageList.pop(); +#ifdef NATIVE_LINUX_VST + pthread_mutex_unlock(&message_mutex); +#endif if( shouldGiveIdle() ) { pluginDispatch( effEditIdle ); setShouldGiveIdle( false ); } +#ifdef NATIVE_LINUX_VST + pthread_mutex_lock(&message_mutex); +#endif + + size = m_messageList.size(); +#ifdef NATIVE_LINUX_VST + pthread_mutex_unlock(&message_mutex); +#endif } + setProcessing( false ); } - - - -DWORD WINAPI RemoteVstPlugin::processingThread( LPVOID _param ) +#ifdef NATIVE_LINUX_VST +void RemoteVstPlugin::sendX11Idle() { + queueMessage(message( IdIdle )); +} +#endif + + +#ifndef NATIVE_LINUX_VST +DWORD WINAPI RemoteVstPlugin::processingThread( LPVOID _param ) +#else +void * RemoteVstPlugin::processingThread(void * _param) +#endif +{ +#ifndef NATIVE_LINUX_VST __processingThreadId = GetCurrentThreadId(); +#else + __processingThreadId = pthread_self(); +#endif RemoteVstPlugin * _this = static_cast( _param ); RemotePluginClient::message m; while( ( m = _this->receiveMessage() ).id != IdQuit ) - { + { + if( m.id == IdStartProcessing || m.id == IdMidiEvent || m.id == IdVstSetParameter - || m.id == IdVstSetTempo ) + || m.id == IdVstSetTempo) { _this->processMessage( m ); } @@ -2056,24 +2309,36 @@ DWORD WINAPI RemoteVstPlugin::processingThread( LPVOID _param ) } else { +#ifndef NATIVE_LINUX_VST PostMessage( __MessageHwnd, WM_USER, ProcessPluginMessage, (LPARAM) new message( m ) ); +#else + _this->queueMessage( m ); +#endif } } // notify GUI thread about shutdown +#ifndef NATIVE_LINUX_VST PostMessage( __MessageHwnd, WM_USER, ClosePlugin, 0 ); return 0; +#else + if (m.id == IdQuit) + { + _this->queueMessage( m ); + } + + return nullptr; +#endif } - - bool RemoteVstPlugin::setupMessageWindow() { +#ifndef NATIVE_LINUX_VST HMODULE hInst = GetModuleHandle( nullptr ); if( hInst == nullptr ) { @@ -2087,13 +2352,14 @@ bool RemoteVstPlugin::setupMessageWindow() hInst, nullptr ); // install GUI update timer SetTimer( __MessageHwnd, 1000, 50, nullptr ); +#endif return true; } - +#ifndef NATIVE_LINUX_VST DWORD WINAPI RemoteVstPlugin::guiEventLoop() { MSG msg; @@ -2105,10 +2371,51 @@ DWORD WINAPI RemoteVstPlugin::guiEventLoop() return 0; } +#else +void RemoteVstPlugin::guiEventLoop() +{ + struct timespec tim, tim2; + tim.tv_sec = 0; + tim.tv_nsec = 5000000; + + XEvent e; + while(true) + { + //if (XQLength(m_display) > 0) + if (m_display && XPending(m_display) > 0) + { + XNextEvent(m_display, &e); + + if (e.type == ClientMessage && e.xclient.data.l[0] == m_wmDeleteMessage) + { + hideEditor(); + } + } + + // needed by ZynAddSubFX UI + if (__plugin->isInitialized()) + { + __plugin->idle(); + } + + if(__plugin->isInitialized() && !__plugin->isProcessing() ) + { + __plugin->processUIThreadMessages(); + } + + nanosleep(&tim, &tim2); + + if (m_shouldQuit) + { + __plugin->hideEditor(); + break; + } + } +} +#endif - - +#ifndef NATIVE_LINUX_VST LRESULT CALLBACK RemoteVstPlugin::wndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { @@ -2154,8 +2461,7 @@ LRESULT CALLBACK RemoteVstPlugin::wndProc( HWND hwnd, UINT uMsg, return DefWindowProc( hwnd, uMsg, wParam, lParam ); } - - +#endif int main( int _argc, char * * _argv ) @@ -2169,8 +2475,11 @@ int main( int _argc, char * * _argv ) fprintf( stderr, "not enough arguments\n" ); return -1; } - +#ifndef NATIVE_LINUX_VST OleInitialize(nullptr); +#else + XInitThreads(); +#endif #ifdef LMMS_BUILD_LINUX #ifdef LMMS_HAVE_SCHED_H // try to set realtime-priority @@ -2188,6 +2497,7 @@ int main( int _argc, char * * _argv ) } #endif +#ifndef NATIVE_LINUX_VST HMODULE hInst = GetModuleHandle( nullptr ); if( hInst == nullptr ) { @@ -2211,6 +2521,7 @@ int main( int _argc, char * * _argv ) return -1; } +#endif { #ifdef SYNC_WITH_SHM_FIFO int embedMethodIndex = 3; @@ -2251,6 +2562,13 @@ int main( int _argc, char * * _argv ) } } +#ifdef NATIVE_LINUX_VST + if (EMBED) + { + cerr << "Native linux VST works only without embedding." << endl; + } +#endif + // constructor automatically will process messages until it receives // a IdVstLoadPlugin message and processes it #ifdef SYNC_WITH_SHM_FIFO @@ -2265,21 +2583,30 @@ int main( int _argc, char * * _argv ) { return -1; } +#ifndef NATIVE_LINUX_VST if( CreateThread( nullptr, 0, RemoteVstPlugin::processingThread, __plugin, 0, nullptr ) == nullptr ) +#else + int err = 0; + err = pthread_create(&__processingThreadId, nullptr, &RemoteVstPlugin::processingThread, __plugin); + if (err != 0) +#endif { __plugin->debugMessage( "could not create " "processingThread\n" ); return -1; } - RemoteVstPlugin::guiEventLoop(); + + __plugin->guiEventLoop(); +#ifdef NATIVE_LINUX_VST + pthread_join(__processingThreadId, nullptr); +#endif } - delete __plugin; - +#ifndef NATIVE_LINUX_VST OleUninitialize(); +#endif return 0; - } diff --git a/plugins/vst_base/RemoteVstPlugin/CMakeLists.txt b/plugins/vst_base/RemoteVstPlugin/CMakeLists.txt index f916c694c..f54fbf02e 100644 --- a/plugins/vst_base/RemoteVstPlugin/CMakeLists.txt +++ b/plugins/vst_base/RemoteVstPlugin/CMakeLists.txt @@ -10,10 +10,6 @@ CHECK_CXX_DEFINE(IS_WIN "_WIN32") CHECK_CXX_DEFINE(IS_WIN64 "_WIN64") CHECK_CXX_DEFINE(IS_MINGW "__MINGW32__") -if(NOT IS_WIN) - message(FATAL_ERROR "Toolchain used does not target windows.") -ENDIF() - if(IS_WIN64 OR CMAKE_SIZEOF_VOID_P EQUAL 8) set(BITNESS 64) else() @@ -26,12 +22,20 @@ FOREACH( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") ENDFOREACH() +if(NOT IS_WIN) +set(EXE_NAME NativeLinuxRemoteVstPlugin${BITNESS}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/") +else() set(EXE_NAME RemoteVstPlugin${BITNESS}) +endif() add_executable(${EXE_NAME} WIN32 ../RemoteVstPlugin.cpp ) - -target_link_libraries(${EXE_NAME} ole32) +if(IS_WIN) + target_link_libraries(${EXE_NAME} ole32) +else() + target_link_libraries(${EXE_NAME} pthread dl X11) +ENDIF() target_include_directories(${EXE_NAME} PRIVATE diff --git a/plugins/vst_base/VstPlugin.cpp b/plugins/vst_base/VstPlugin.cpp index 2b14fc936..61d734675 100644 --- a/plugins/vst_base/VstPlugin.cpp +++ b/plugins/vst_base/VstPlugin.cpp @@ -26,15 +26,13 @@ #include "communication.h" -#include -#include +#include +#include #include +#include #include #include #include -#include -#include -#include #ifdef LMMS_BUILD_LINUX # include @@ -43,7 +41,6 @@ #include -#include #ifdef LMMS_BUILD_WIN32 # include @@ -116,6 +113,10 @@ private: } +enum class ExecutableType +{ + Unknown, Win32, Win64, Linux64, +}; VstPlugin::VstPlugin( const QString & _plugin ) : m_plugin( PathUtil::toAbsolute(_plugin) ), @@ -128,23 +129,49 @@ VstPlugin::VstPlugin( const QString & _plugin ) : { setSplittedChannels( true ); - PE::MachineType machineType; - try { - PE::FileInfo peInfo(m_plugin); - machineType = peInfo.machineType(); - } catch (std::runtime_error& e) { - qCritical() << "Error while determining PE file's machine type: " << e.what(); - machineType = PE::MachineType::unknown; + auto pluginType = ExecutableType::Unknown; +#ifdef LMMS_BUILD_LINUX + QFileInfo fi(m_plugin); + if (fi.suffix() == "so") + { + pluginType = ExecutableType::Linux64; + } + else +#endif + { + try { + PE::FileInfo peInfo(m_plugin); + switch (peInfo.machineType()) + { + case PE::MachineType::amd64: + pluginType = ExecutableType::Win64; + break; + case PE::MachineType::i386: + pluginType = ExecutableType::Win32; + break; + default: + qWarning() << "Unknown PE machine type" + << QString::number(static_cast(peInfo.machineType()), 16); + break; + } + } catch (std::runtime_error& e) { + qCritical() << "Error while determining PE file's machine type: " << e.what(); + } } - switch(machineType) + switch(pluginType) { - case PE::MachineType::amd64: + case ExecutableType::Win64: tryLoad( REMOTE_VST_PLUGIN_FILEPATH_64 ); // Default: RemoteVstPlugin64 break; - case PE::MachineType::i386: + case ExecutableType::Win32: tryLoad( REMOTE_VST_PLUGIN_FILEPATH_32 ); // Default: 32/RemoteVstPlugin32 break; +#ifdef LMMS_BUILD_LINUX + case ExecutableType::Linux64: + tryLoad( NATIVE_LINUX_REMOTE_VST_PLUGIN_FILEPATH_64 ); // Default: NativeLinuxRemoteVstPlugin32 + break; +#endif default: m_failed = true; return; diff --git a/plugins/vst_base/VstPlugin.h b/plugins/vst_base/VstPlugin.h index e05031256..2317cf3ad 100644 --- a/plugins/vst_base/VstPlugin.h +++ b/plugins/vst_base/VstPlugin.h @@ -26,11 +26,10 @@ #define _VST_PLUGIN_H #include -#include #include +#include #include #include -#include #include "JournallingObject.h" #include "RemotePlugin.h" diff --git a/plugins/vst_base/vst_base.cpp b/plugins/vst_base/vst_base.cpp index 2d7333dd3..67217390a 100644 --- a/plugins/vst_base/vst_base.cpp +++ b/plugins/vst_base/vst_base.cpp @@ -25,7 +25,6 @@ #include "Plugin.h" -#include "embed.h" #include "vstbase_export.h" extern "C" diff --git a/plugins/vst_base/vstbase/CMakeLists.txt b/plugins/vst_base/vstbase/CMakeLists.txt index bd5f98b56..4e8cbd97c 100644 --- a/plugins/vst_base/vstbase/CMakeLists.txt +++ b/plugins/vst_base/vstbase/CMakeLists.txt @@ -1,5 +1,8 @@ ADD_DEFINITIONS(-DREMOTE_VST_PLUGIN_FILEPATH_32="${REMOTE_VST_PLUGIN_FILEPATH_32}") ADD_DEFINITIONS(-DREMOTE_VST_PLUGIN_FILEPATH_64="${REMOTE_VST_PLUGIN_FILEPATH_64}") +IF(LMMS_BUILD_LINUX) + ADD_DEFINITIONS(-DNATIVE_LINUX_REMOTE_VST_PLUGIN_FILEPATH_64="${NATIVE_LINUX_REMOTE_VST_PLUGIN_FILEPATH_64}") +ENDIF() BUILD_PLUGIN(vstbase ../vst_base.cpp ../VstPlugin.cpp ../VstPlugin.h ../communication.h diff --git a/plugins/watsyn/Watsyn.cpp b/plugins/watsyn/Watsyn.cpp index d8b6f80f4..01b74e52c 100644 --- a/plugins/watsyn/Watsyn.cpp +++ b/plugins/watsyn/Watsyn.cpp @@ -29,6 +29,7 @@ #include "AudioEngine.h" #include "Engine.h" #include "InstrumentTrack.h" +#include "PixmapButton.h" #include "ToolTip.h" #include "Song.h" #include "lmms_math.h" diff --git a/plugins/watsyn/Watsyn.h b/plugins/watsyn/Watsyn.h index 079e532e4..b957faef7 100644 --- a/plugins/watsyn/Watsyn.h +++ b/plugins/watsyn/Watsyn.h @@ -30,10 +30,7 @@ #include "InstrumentView.h" #include "Graph.h" #include "AutomatableModel.h" -#include "AutomatableButton.h" #include "TempoSyncKnob.h" -#include "NotePlayHandle.h" -#include "PixmapButton.h" #include #include "MemoryManager.h" @@ -77,6 +74,8 @@ const int B1_OSC = 2; const int B2_OSC = 3; const int NUM_OSCS = 4; +class automatableButtonGroup; +class PixmapButton; class WatsynInstrument; class WatsynObject diff --git a/plugins/waveshaper/waveshaper_control_dialog.cpp b/plugins/waveshaper/waveshaper_control_dialog.cpp index ffa75d513..8238b08ab 100644 --- a/plugins/waveshaper/waveshaper_control_dialog.cpp +++ b/plugins/waveshaper/waveshaper_control_dialog.cpp @@ -24,12 +24,12 @@ */ -#include #include "waveshaper_control_dialog.h" #include "waveshaper_controls.h" #include "embed.h" #include "Graph.h" +#include "Knob.h" #include "PixmapButton.h" #include "ToolTip.h" #include "LedCheckbox.h" diff --git a/plugins/waveshaper/waveshaper_controls.h b/plugins/waveshaper/waveshaper_controls.h index 550dcc752..bba4d8d85 100644 --- a/plugins/waveshaper/waveshaper_controls.h +++ b/plugins/waveshaper/waveshaper_controls.h @@ -28,7 +28,6 @@ #include "EffectControls.h" #include "waveshaper_control_dialog.h" -#include "Knob.h" #include "Graph.h" class waveShaperEffect; diff --git a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp index b6a036ed2..ed32339eb 100644 --- a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp @@ -30,10 +30,11 @@ #include "LocalZynAddSubFx.h" +#include "MidiEvent.h" + #include "zynaddsubfx/src/Nio/NulEngine.h" #include "zynaddsubfx/src/Misc/Master.h" #include "zynaddsubfx/src/Misc/Part.h" -#include "zynaddsubfx/src/Misc/Dump.h" SYNTH_T* synth = nullptr; diff --git a/plugins/zynaddsubfx/LocalZynAddSubFx.h b/plugins/zynaddsubfx/LocalZynAddSubFx.h index 7068d0b12..397fbbe82 100644 --- a/plugins/zynaddsubfx/LocalZynAddSubFx.h +++ b/plugins/zynaddsubfx/LocalZynAddSubFx.h @@ -25,10 +25,10 @@ #ifndef LOCAL_ZYNADDSUBFX_H #define LOCAL_ZYNADDSUBFX_H -#include "MidiEvent.h" #include "Note.h" class Master; +class MidiEvent; class NulEngine; class LocalZynAddSubFx diff --git a/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp b/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp index a31544217..d57ee40d7 100644 --- a/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp @@ -29,7 +29,6 @@ #include -#include #undef CursorShape // is, by mistake, not undefed in FL #define BUILD_REMOTE_PLUGIN_CLIENT diff --git a/plugins/zynaddsubfx/ZynAddSubFx.cpp b/plugins/zynaddsubfx/ZynAddSubFx.cpp index eaa4c6182..d706c5ec6 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/ZynAddSubFx.cpp @@ -46,7 +46,6 @@ #include "RemoteZynAddSubFx.h" #include "LocalZynAddSubFx.h" #include "AudioEngine.h" -#include "ControllerConnection.h" #include "Clipboard.h" #include "embed.h" diff --git a/src/3rdparty/ringbuffer b/src/3rdparty/ringbuffer index ea00e1fc2..1c46ef34a 160000 --- a/src/3rdparty/ringbuffer +++ b/src/3rdparty/ringbuffer @@ -1 +1 @@ -Subproject commit ea00e1fc2b821a0e06d78e8cc13ac06e6b4f72f5 +Subproject commit 1c46ef34a28d4637b43fb6d5ebb31d38c05f4bd8 diff --git a/src/core/AudioEngine.cpp b/src/core/AudioEngine.cpp index 722cd3792..eae7c6f20 100644 --- a/src/core/AudioEngine.cpp +++ b/src/core/AudioEngine.cpp @@ -465,7 +465,7 @@ void AudioEngine::handleMetronome() bool metronomeSupported = currentPlayMode == Song::Mode_PlayMidiClip || currentPlayMode == Song::Mode_PlaySong - || currentPlayMode == Song::Mode_PlayBB; + || currentPlayMode == Song::Mode_PlayPattern; if (!metronomeSupported || !m_metronomeActive || song->isExporting()) { diff --git a/src/core/AudioEngineWorkerThread.cpp b/src/core/AudioEngineWorkerThread.cpp index c119f04a4..3d45cbccb 100644 --- a/src/core/AudioEngineWorkerThread.cpp +++ b/src/core/AudioEngineWorkerThread.cpp @@ -30,6 +30,7 @@ #include "denormals.h" #include "AudioEngine.h" +#include "MemoryManager.h" #include "ThreadableJob.h" #if __SSE__ diff --git a/src/core/AutomationClip.cpp b/src/core/AutomationClip.cpp index f132fec40..300944416 100644 --- a/src/core/AutomationClip.cpp +++ b/src/core/AutomationClip.cpp @@ -29,8 +29,9 @@ #include "AutomationNode.h" #include "AutomationClipView.h" #include "AutomationTrack.h" -#include "BBTrackContainer.h" #include "LocaleHelper.h" +#include "Note.h" +#include "PatternStore.h" #include "ProjectJournal.h" #include "Song.h" @@ -57,7 +58,7 @@ AutomationClip::AutomationClip( AutomationTrack * _auto_track ) : { switch( getTrack()->trackContainer()->type() ) { - case TrackContainer::BBContainer: + case TrackContainer::PatternContainer: setAutoResize( true ); break; @@ -96,7 +97,7 @@ AutomationClip::AutomationClip( const AutomationClip & _clip_to_copy ) : if (!getTrack()){ return; } switch( getTrack()->trackContainer()->type() ) { - case TrackContainer::BBContainer: + case TrackContainer::PatternContainer: setAutoResize( true ); break; @@ -884,7 +885,7 @@ bool AutomationClip::isAutomated( const AutomatableModel * _m ) { TrackContainer::TrackList l; l += Engine::getSong()->tracks(); - l += Engine::getBBTrackContainer()->tracks(); + l += Engine::patternStore()->tracks(); l += Engine::getSong()->globalAutomationTrack(); for( TrackContainer::TrackList::ConstIterator it = l.begin(); it != l.end(); ++it ) @@ -922,7 +923,7 @@ QVector AutomationClip::clipsForModel( const AutomatableModel QVector clips; TrackContainer::TrackList l; l += Engine::getSong()->tracks(); - l += Engine::getBBTrackContainer()->tracks(); + l += Engine::patternStore()->tracks(); l += Engine::getSong()->globalAutomationTrack(); // go through all tracks... @@ -994,7 +995,7 @@ AutomationClip * AutomationClip::globalAutomationClip( void AutomationClip::resolveAllIDs() { TrackContainer::TrackList l = Engine::getSong()->tracks() + - Engine::getBBTrackContainer()->tracks(); + Engine::patternStore()->tracks(); l += Engine::getSong()->globalAutomationTrack(); for( TrackContainer::TrackList::iterator it = l.begin(); it != l.end(); ++it ) diff --git a/src/core/BBTrackContainer.cpp b/src/core/BBTrackContainer.cpp deleted file mode 100644 index 152f34a25..000000000 --- a/src/core/BBTrackContainer.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/* - * BBTrackContainer.cpp - model-component of BB-Editor - * - * Copyright (c) 2004-2014 Tobias Doerffel - * - * 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. - * - */ - - -#include "BBTrackContainer.h" -#include "BBTrack.h" -#include "Engine.h" -#include "Song.h" - - - -BBTrackContainer::BBTrackContainer() : - TrackContainer(), - m_bbComboBoxModel(this) -{ - connect(&m_bbComboBoxModel, SIGNAL(dataChanged()), - this, SLOT(currentBBChanged())); - // we *always* want to receive updates even in case BB actually did - // not change upon setCurrentBB()-call - connect(&m_bbComboBoxModel, SIGNAL(dataUnchanged()), - this, SLOT(currentBBChanged())); - setType(BBContainer); -} - - - - -BBTrackContainer::~BBTrackContainer() -{ -} - - - - -bool BBTrackContainer::play(TimePos start, fpp_t frames, f_cnt_t offset, int clipNum) -{ - bool notePlayed = false; - - if (lengthOfBB(clipNum) <= 0) - { - return false; - } - - start = start % (lengthOfBB(clipNum) * TimePos::ticksPerBar()); - - TrackList tl = tracks(); - for (Track * t : tl) - { - if (t->play(start, frames, offset, clipNum)) - { - notePlayed = true; - } - } - - return notePlayed; -} - - - - -void BBTrackContainer::updateAfterTrackAdd() -{ - if (numOfBBs() == 0 && !Engine::getSong()->isLoadingProject()) - { - Engine::getSong()->addBBTrack(); - } -} - - - - -bar_t BBTrackContainer::lengthOfBB(int bb) const -{ - TimePos maxLength = TimePos::ticksPerBar(); - - const TrackList & tl = tracks(); - for (Track * t : tl) - { - // Don't create Clips here if they don't exist - if (bb < t->numOfClips()) - { - maxLength = qMax(maxLength, t->getClip(bb)->length()); - } - } - - return maxLength.nextFullBar(); -} - - - - -int BBTrackContainer::numOfBBs() const -{ - return Engine::getSong()->countTracks(Track::BBTrack); -} - - - - -void BBTrackContainer::removeBB(int bb) -{ - TrackList tl = tracks(); - for (Track * t : tl) - { - delete t->getClip(bb); - t->removeBar(bb * DefaultTicksPerBar); - } - if (bb <= currentBB()) - { - setCurrentBB(qMax(currentBB() - 1, 0)); - } -} - - - - -void BBTrackContainer::swapBB(int bb1, int bb2) -{ - TrackList tl = tracks(); - for (Track * t : tl) - { - t->swapPositionOfClips(bb1, bb2); - } - updateComboBox(); -} - - - - -void BBTrackContainer::updateBBTrack(Clip * clip) -{ - BBTrack * t = BBTrack::findBBTrack(clip->startPosition() / DefaultTicksPerBar); - if (t != nullptr) - { - t->dataChanged(); - } -} - - - - -void BBTrackContainer::fixIncorrectPositions() -{ - TrackList tl = tracks(); - for (Track * t : tl) - { - for (int i = 0; i < numOfBBs(); ++i) - { - t->getClip(i)->movePosition(TimePos(i, 0)); - } - } -} - - - - -void BBTrackContainer::play() -{ - if (Engine::getSong()->playMode() != Song::Mode_PlayBB) - { - Engine::getSong()->playBB(); - } - else - { - Engine::getSong()->togglePause(); - } -} - - - - -void BBTrackContainer::stop() -{ - Engine::getSong()->stop(); -} - - - - -void BBTrackContainer::updateComboBox() -{ - const int curBB = currentBB(); - - m_bbComboBoxModel.clear(); - - for (int i = 0; i < numOfBBs(); ++i) - { - BBTrack * bbt = BBTrack::findBBTrack(i); - m_bbComboBoxModel.addItem(bbt->name()); - } - setCurrentBB(curBB); -} - - - - -void BBTrackContainer::currentBBChanged() -{ - // now update all track-labels (the current one has to become white, the others gray) - TrackList tl = Engine::getSong()->tracks(); - for (Track * t : tl) - { - if (t->type() == Track::BBTrack) - { - t->dataChanged(); - } - } -} - - - - -void BBTrackContainer::createClipsForBB(int bb) -{ - TrackList tl = tracks(); - for (Track * t : tl) - { - t->createClipsForBB(bb); - } -} - -AutomatedValueMap BBTrackContainer::automatedValuesAt(TimePos time, int clipNum) const -{ - Q_ASSERT(clipNum >= 0); - Q_ASSERT(time.getTicks() >= 0); - - auto lengthBars = lengthOfBB(clipNum); - auto lengthTicks = lengthBars * TimePos::ticksPerBar(); - if (time > lengthTicks) - { - time = lengthTicks; - } - - return TrackContainer::automatedValuesAt(time + (TimePos::ticksPerBar() * clipNum), clipNum); -} - diff --git a/src/core/BufferManager.cpp b/src/core/BufferManager.cpp index eb8764074..248434cf9 100644 --- a/src/core/BufferManager.cpp +++ b/src/core/BufferManager.cpp @@ -26,7 +26,8 @@ #include "BufferManager.h" -#include "Engine.h" +#include + #include "MemoryManager.h" static fpp_t framesPerPeriod; diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 572657f71..d8b7e9784 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -9,8 +9,6 @@ set(LMMS_SRCS core/AutomationNode.cpp core/BandLimitedWave.cpp core/base64.cpp - core/BBClip.cpp - core/BBTrackContainer.cpp core/BufferManager.cpp core/Clipboard.cpp core/ComboBoxModel.cpp @@ -57,6 +55,8 @@ set(LMMS_SRCS core/NotePlayHandle.cpp core/Oscillator.cpp core/PathUtil.cpp + core/PatternClip.cpp + core/PatternStore.cpp core/PeakController.cpp core/PerfLog.cpp core/Piano.cpp diff --git a/src/core/Clipboard.cpp b/src/core/Clipboard.cpp index 7da493c55..c30b657bb 100644 --- a/src/core/Clipboard.cpp +++ b/src/core/Clipboard.cpp @@ -27,7 +27,6 @@ #include #include "Clipboard.h" -#include "JournallingObject.h" namespace Clipboard diff --git a/src/core/ComboBoxModel.cpp b/src/core/ComboBoxModel.cpp index 5694ec5d3..19d4f576f 100644 --- a/src/core/ComboBoxModel.cpp +++ b/src/core/ComboBoxModel.cpp @@ -23,7 +23,8 @@ */ #include "ComboBoxModel.h" -#include "embed.h" + +#include using std::unique_ptr; using std::move; diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index 3ac561ae4..5444ea834 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "ConfigManager.h" #include "MainWindow.h" diff --git a/src/core/Controller.cpp b/src/core/Controller.cpp index 3b1db245b..5cb3218a9 100644 --- a/src/core/Controller.cpp +++ b/src/core/Controller.cpp @@ -25,11 +25,9 @@ */ #include -#include #include -#include "Song.h" #include "AudioEngine.h" #include "ControllerConnection.h" #include "ControllerDialog.h" diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index 156763926..8248be8f3 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -26,7 +26,7 @@ #include "DataFile.h" -#include +#include #include #include @@ -45,6 +45,7 @@ #include "ProjectVersion.h" #include "SongEditor.h" #include "TextFloat.h" +#include "Track.h" #include "PathUtil.h" #include "lmmsversion.h" @@ -54,7 +55,7 @@ static void findIds(const QDomElement& elem, QList& idList); // QMap with the DOM elements that access file resources const DataFile::ResourcesMap DataFile::ELEMENTS_WITH_RESOURCES = { -{ "sampletco", {"src"} }, +{ "sampleclip", {"src"} }, { "audiofileprocessor", {"src"} }, }; @@ -71,7 +72,7 @@ const std::vector DataFile::UPGRADE_METHODS = { &DataFile::upgrade_1_3_0 , &DataFile::upgrade_noHiddenClipNames, &DataFile::upgrade_automationNodes , &DataFile::upgrade_extendedNoteRange, &DataFile::upgrade_defaultTripleOscillatorHQ, - &DataFile::upgrade_mixerRename + &DataFile::upgrade_mixerRename , &DataFile::upgrade_bbTcoRename, }; // Vector of all versions that have upgrade routines. @@ -95,7 +96,7 @@ DataFile::typeDescStruct { DataFile::ClipboardData, "clipboard-data" }, { DataFile::JournalData, "journaldata" }, { DataFile::EffectSettings, "effectsettings" }, - { DataFile::MidiClip, "pattern" } + { DataFile::MidiClip, "midiclip" } } ; @@ -212,6 +213,9 @@ bool DataFile::validate( QString extension ) ( extension == "xiz" && ! getPluginFactory()->pluginSupportingExtension(extension).isNull()) || extension == "sf2" || extension == "sf3" || extension == "pat" || extension == "mid" || extension == "dll" +#ifdef LMMS_BUILD_LINUX + || extension == "so" +#endif #ifdef LMMS_HAVE_LV2 || extension == "lv2" #endif @@ -1790,6 +1794,40 @@ void DataFile::upgrade_mixerRename() } +// Rename BB to pattern and TCO to clip +void DataFile::upgrade_bbTcoRename() +{ + std::vector> names { + {"automationpattern", "automationclip"}, + {"bbtco", "patternclip"}, + {"pattern", "midiclip"}, + {"sampletco", "sampleclip"}, + {"bbtrack", "patterntrack"}, + {"bbtrackcontainer", "patternstore"}, + }; + // Replace names of XML tags + for (auto name : names) + { + QDomNodeList elements = elementsByTagName(name.first); + for (int i = 0; !elements.item(i).isNull(); ++i) + { + elements.item(i).toElement().setTagName(name.second); + } + } + // Replace "Beat/Bassline" with "Pattern" in track names + QDomNodeList elements = elementsByTagName("track"); + for (int i = 0; !elements.item(i).isNull(); ++i) + { + auto e = elements.item(i).toElement(); + static_assert(Track::PatternTrack == 1, "Must be type=1 for backwards compatibility"); + if (e.attribute("type").toInt() == Track::PatternTrack) + { + e.setAttribute("name", e.attribute("name").replace("Beat/Bassline", "Pattern")); + } + } +} + + void DataFile::upgrade() { // Runs all necessary upgrade methods diff --git a/src/core/EffectChain.cpp b/src/core/EffectChain.cpp index 2f5deaec4..7b9b3b2db 100644 --- a/src/core/EffectChain.cpp +++ b/src/core/EffectChain.cpp @@ -30,7 +30,6 @@ #include "Effect.h" #include "DummyEffect.h" #include "MixHelpers.h" -#include "Song.h" EffectChain::EffectChain( Model * _parent ) : diff --git a/src/core/Engine.cpp b/src/core/Engine.cpp index 4d5d303b3..a46590188 100644 --- a/src/core/Engine.cpp +++ b/src/core/Engine.cpp @@ -25,11 +25,11 @@ #include "Engine.h" #include "AudioEngine.h" -#include "BBTrackContainer.h" #include "ConfigManager.h" #include "Mixer.h" #include "Ladspa2LMMS.h" #include "Lv2Manager.h" +#include "PatternStore.h" #include "Plugin.h" #include "PresetPreviewPlayHandle.h" #include "ProjectJournal.h" @@ -40,7 +40,7 @@ float LmmsCore::s_framesPerTick; AudioEngine* LmmsCore::s_audioEngine = nullptr; Mixer * LmmsCore::s_mixer = nullptr; -BBTrackContainer * LmmsCore::s_bbTrackContainer = nullptr; +PatternStore * LmmsCore::s_patternStore = nullptr; Song * LmmsCore::s_song = nullptr; ProjectJournal * LmmsCore::s_projectJournal = nullptr; #ifdef LMMS_HAVE_LV2 @@ -67,7 +67,7 @@ void LmmsCore::init( bool renderOnly ) s_audioEngine = new AudioEngine( renderOnly ); s_song = new Song; s_mixer = new Mixer; - s_bbTrackContainer = new BBTrackContainer; + s_patternStore = new PatternStore; #ifdef LMMS_HAVE_LV2 s_lv2Manager = new Lv2Manager; @@ -98,7 +98,7 @@ void LmmsCore::destroy() s_song->clearProject(); - deleteHelper( &s_bbTrackContainer ); + deleteHelper( &s_patternStore ); deleteHelper( &s_mixer ); deleteHelper( &s_audioEngine ); diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index 59141f5e4..e3ab82c0e 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -22,7 +22,7 @@ * */ -#include +#include #include #include "InstrumentSoundShaping.h" diff --git a/src/core/Keymap.cpp b/src/core/Keymap.cpp index 325a6d6b6..a50abfaf2 100644 --- a/src/core/Keymap.cpp +++ b/src/core/Keymap.cpp @@ -26,6 +26,8 @@ #include +#include "Note.h" + Keymap::Keymap() : m_description(tr("empty")), diff --git a/src/core/LadspaControl.cpp b/src/core/LadspaControl.cpp index 4dbcb77fc..4d3faeda7 100644 --- a/src/core/LadspaControl.cpp +++ b/src/core/LadspaControl.cpp @@ -25,6 +25,8 @@ #include +#include + #include "LadspaControl.h" #include "LadspaBase.h" diff --git a/src/core/LadspaManager.cpp b/src/core/LadspaManager.cpp index a7bccd3d4..e821a8163 100644 --- a/src/core/LadspaManager.cpp +++ b/src/core/LadspaManager.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include "ConfigManager.h" #include "LadspaManager.h" diff --git a/src/core/LfoController.cpp b/src/core/LfoController.cpp index c58551510..947fd5e22 100644 --- a/src/core/LfoController.cpp +++ b/src/core/LfoController.cpp @@ -24,7 +24,6 @@ */ #include -#include #include "LfoController.h" diff --git a/src/core/LocklessAllocator.cpp b/src/core/LocklessAllocator.cpp index 9fab5f5ca..07aaa0c14 100644 --- a/src/core/LocklessAllocator.cpp +++ b/src/core/LocklessAllocator.cpp @@ -25,7 +25,7 @@ #include "LocklessAllocator.h" #include -#include +#include #include "lmmsconfig.h" diff --git a/src/core/MemoryHelper.cpp b/src/core/MemoryHelper.cpp index eaf10825b..8ac2700f3 100644 --- a/src/core/MemoryHelper.cpp +++ b/src/core/MemoryHelper.cpp @@ -21,7 +21,7 @@ * */ -#include +#include #include "lmms_basics.h" #include "MemoryHelper.h" diff --git a/src/core/MemoryManager.cpp b/src/core/MemoryManager.cpp index 0f1c93466..01fdfd5d6 100644 --- a/src/core/MemoryManager.cpp +++ b/src/core/MemoryManager.cpp @@ -25,7 +25,7 @@ #include "MemoryManager.h" -#include +#include #include "rpmalloc.h" /// Global static object handling rpmalloc intializing and finalizing diff --git a/src/core/Microtuner.cpp b/src/core/Microtuner.cpp index cbd4f16d3..b384cf390 100644 --- a/src/core/Microtuner.cpp +++ b/src/core/Microtuner.cpp @@ -27,9 +27,9 @@ #include #include -#include "ConfigManager.h" #include "Engine.h" #include "Keymap.h" +#include "Note.h" #include "Scale.h" #include "Song.h" diff --git a/src/core/MixHelpers.cpp b/src/core/MixHelpers.cpp index d78f6f879..70506a93a 100644 --- a/src/core/MixHelpers.cpp +++ b/src/core/MixHelpers.cpp @@ -24,12 +24,12 @@ #include "MixHelpers.h" -#include -#include "lmms_math.h" +#include +#include + #include "ValueBuffer.h" -#include static bool s_NaNHandler; diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index 2a2448274..bf72c42a4 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -32,8 +32,8 @@ #include "Song.h" #include "InstrumentTrack.h" +#include "PatternStore.h" #include "SampleTrack.h" -#include "BBTrackContainer.h" #include "TrackContainer.h" // For TrackContainer::TrackList typedef MixerRoute::MixerRoute( MixerChannel * from, MixerChannel * to, float amount ) : @@ -288,7 +288,7 @@ void Mixer::deleteChannel( int index ) // go through every instrument and adjust for the channel index change TrackContainer::TrackList tracks; tracks += Engine::getSong()->tracks(); - tracks += Engine::getBBTrackContainer()->tracks(); + tracks += Engine::patternStore()->tracks(); for( Track* t : tracks ) { @@ -386,9 +386,9 @@ void Mixer::moveChannelLeft( int index ) // go through every instrument and adjust for the channel index change TrackContainer::TrackList songTrackList = Engine::getSong()->tracks(); - TrackContainer::TrackList bbTrackList = Engine::getBBTrackContainer()->tracks(); + TrackContainer::TrackList patternTrackList = Engine::patternStore()->tracks(); - TrackContainer::TrackList trackLists[] = {songTrackList, bbTrackList}; + TrackContainer::TrackList trackLists[] = {songTrackList, patternTrackList}; for(int tl=0; tl<2; ++tl) { TrackContainer::TrackList trackList = trackLists[tl]; diff --git a/src/core/Note.cpp b/src/core/Note.cpp index f43a8b971..cba02ee9e 100644 --- a/src/core/Note.cpp +++ b/src/core/Note.cpp @@ -25,7 +25,7 @@ #include -#include +#include #include "Note.h" #include "DetuningHelper.h" diff --git a/src/core/NotePlayHandle.cpp b/src/core/NotePlayHandle.cpp index 45b9013af..2a4cf8f12 100644 --- a/src/core/NotePlayHandle.cpp +++ b/src/core/NotePlayHandle.cpp @@ -25,7 +25,6 @@ #include "NotePlayHandle.h" -#include "lmms_constants.h" #include "AudioEngine.h" #include "BasicFilters.h" #include "DetuningHelper.h" @@ -68,7 +67,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack, m_parent( parent ), m_hadChildren( false ), m_muted( false ), - m_bbTrack( nullptr ), + m_patternTrack( nullptr ), m_origTempo( Engine::getSong()->getTempo() ), m_origBaseNote( instrumentTrack->baseNote() ), m_frequency( 0 ), @@ -92,7 +91,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack, parent->m_subNotes.push_back( this ); parent->m_hadChildren = true; - m_bbTrack = parent->m_bbTrack; + m_patternTrack = parent->m_patternTrack; parent->setUsesBuffer( false ); } @@ -358,7 +357,7 @@ fpp_t NotePlayHandle::framesLeftForCurrentPeriod() const bool NotePlayHandle::isFromTrack( const Track * _track ) const { - return m_instrumentTrack == _track || m_bbTrack == _track; + return m_instrumentTrack == _track || m_patternTrack == _track; } diff --git a/src/core/PathUtil.cpp b/src/core/PathUtil.cpp index 03f16bc89..24d9c8992 100644 --- a/src/core/PathUtil.cpp +++ b/src/core/PathUtil.cpp @@ -1,6 +1,5 @@ #include "PathUtil.h" -#include #include #include diff --git a/src/core/BBClip.cpp b/src/core/PatternClip.cpp similarity index 76% rename from src/core/BBClip.cpp rename to src/core/PatternClip.cpp index 8e19cb50f..d88ef5224 100644 --- a/src/core/BBClip.cpp +++ b/src/core/PatternClip.cpp @@ -1,5 +1,5 @@ /* - * BBClip.cpp - implementation of class bbClip + * PatternClip.cpp - implementation of class PatternClip * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -22,19 +22,20 @@ * */ - #include "BBClip.h" +#include "PatternClip.h" - #include - - #include "BBTrack.h" - #include "BBTrackContainer.h" - #include "Engine.h" +#include +#include "Engine.h" +#include "PatternClipView.h" +#include "PatternStore.h" +#include "PatternTrack.h" -BBClip::BBClip( Track * _track ) : - Clip( _track ) + +PatternClip::PatternClip(Track* track) : + Clip(track) { - bar_t t = Engine::getBBTrackContainer()->lengthOfBB( bbTrackIndex() ); + bar_t t = Engine::patternStore()->lengthOfPattern(patternIndex()); if( t > 0 ) { saveJournallingState( false ); @@ -44,7 +45,7 @@ BBClip::BBClip( Track * _track ) : setAutoResize( false ); } -void BBClip::saveSettings( QDomDocument & doc, QDomElement & element ) +void PatternClip::saveSettings(QDomDocument& doc, QDomElement& element) { element.setAttribute( "name", name() ); if( element.parentNode().nodeName() == "clipboard" ) @@ -66,7 +67,7 @@ void BBClip::saveSettings( QDomDocument & doc, QDomElement & element ) -void BBClip::loadSettings( const QDomElement & element ) +void PatternClip::loadSettings(const QDomElement& element) { setName( element.attribute( "name" ) ); if( element.attribute( "pos" ).toInt() >= 0 ) @@ -101,14 +102,14 @@ void BBClip::loadSettings( const QDomElement & element ) -int BBClip::bbTrackIndex() +int PatternClip::patternIndex() { - return dynamic_cast( getTrack() )->index(); + return dynamic_cast(getTrack())->patternIndex(); } -ClipView * BBClip::createView( TrackView * _tv ) +ClipView* PatternClip::createView(TrackView* tv) { - return new BBClipView( this, _tv ); -} \ No newline at end of file + return new PatternClipView(this, tv); +} diff --git a/src/core/PatternStore.cpp b/src/core/PatternStore.cpp new file mode 100644 index 000000000..c16726777 --- /dev/null +++ b/src/core/PatternStore.cpp @@ -0,0 +1,259 @@ +/* + * PatternStore.cpp - model-component of Pattern Editor + * + * Copyright (c) 2004-2014 Tobias Doerffel + * + * 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. + * + */ + + +#include "PatternStore.h" + +#include "Clip.h" +#include "Engine.h" +#include "PatternTrack.h" +#include "Song.h" + + + +PatternStore::PatternStore() : + TrackContainer(), + m_patternComboBoxModel(this) +{ + connect(&m_patternComboBoxModel, SIGNAL(dataChanged()), + this, SLOT(currentPatternChanged())); + // we *always* want to receive updates even in case pattern actually did + // not change upon setCurrentPattern()-call + connect(&m_patternComboBoxModel, SIGNAL(dataUnchanged()), + this, SLOT(currentPatternChanged())); + setType(PatternContainer); +} + + + + +PatternStore::~PatternStore() +{ +} + + + + +bool PatternStore::play(TimePos start, fpp_t frames, f_cnt_t offset, int clipNum) +{ + bool notePlayed = false; + + if (lengthOfPattern(clipNum) <= 0) + { + return false; + } + + start = start % (lengthOfPattern(clipNum) * TimePos::ticksPerBar()); + + TrackList tl = tracks(); + for (Track * t : tl) + { + if (t->play(start, frames, offset, clipNum)) + { + notePlayed = true; + } + } + + return notePlayed; +} + + + + +void PatternStore::updateAfterTrackAdd() +{ + if (numOfPatterns() == 0 && !Engine::getSong()->isLoadingProject()) + { + Engine::getSong()->addPatternTrack(); + } +} + + + + +bar_t PatternStore::lengthOfPattern(int pattern) const +{ + TimePos maxLength = TimePos::ticksPerBar(); + + const TrackList & tl = tracks(); + for (Track * t : tl) + { + // Don't create Clips here if they don't exist + if (pattern < t->numOfClips()) + { + maxLength = qMax(maxLength, t->getClip(pattern)->length()); + } + } + + return maxLength.nextFullBar(); +} + + + + +int PatternStore::numOfPatterns() const +{ + return Engine::getSong()->countTracks(Track::PatternTrack); +} + + + + +void PatternStore::removePattern(int pattern) +{ + TrackList tl = tracks(); + for (Track * t : tl) + { + delete t->getClip(pattern); + t->removeBar(pattern * DefaultTicksPerBar); + } + if (pattern <= currentPattern()) + { + setCurrentPattern(qMax(currentPattern() - 1, 0)); + } +} + + + + +void PatternStore::swapPattern(int pattern1, int pattern2) +{ + TrackList tl = tracks(); + for (Track * t : tl) + { + t->swapPositionOfClips(pattern1, pattern2); + } + updateComboBox(); +} + + + + +void PatternStore::updatePatternTrack(Clip* clip) +{ + PatternTrack * t = PatternTrack::findPatternTrack(clip->startPosition() / DefaultTicksPerBar); + if (t != nullptr) + { + t->dataChanged(); + } +} + + + + +void PatternStore::fixIncorrectPositions() +{ + TrackList tl = tracks(); + for (Track * t : tl) + { + for (int i = 0; i < numOfPatterns(); ++i) + { + t->getClip(i)->movePosition(TimePos(i, 0)); + } + } +} + + + + +void PatternStore::play() +{ + if (Engine::getSong()->playMode() != Song::Mode_PlayPattern) + { + Engine::getSong()->playPattern(); + } + else + { + Engine::getSong()->togglePause(); + } +} + + + + +void PatternStore::stop() +{ + Engine::getSong()->stop(); +} + + + + +void PatternStore::updateComboBox() +{ + const int curPattern = currentPattern(); + + m_patternComboBoxModel.clear(); + + for (int i = 0; i < numOfPatterns(); ++i) + { + PatternTrack* pt = PatternTrack::findPatternTrack(i); + m_patternComboBoxModel.addItem(pt->name()); + } + setCurrentPattern(curPattern); +} + + + + +void PatternStore::currentPatternChanged() +{ + // now update all track-labels (the current one has to become white, the others gray) + TrackList tl = Engine::getSong()->tracks(); + for (Track * t : tl) + { + if (t->type() == Track::PatternTrack) + { + t->dataChanged(); + } + } +} + + + + +void PatternStore::createClipsForPattern(int pattern) +{ + TrackList tl = tracks(); + for (Track * t : tl) + { + t->createClipsForPattern(pattern); + } +} + +AutomatedValueMap PatternStore::automatedValuesAt(TimePos time, int clipNum) const +{ + Q_ASSERT(clipNum >= 0); + Q_ASSERT(time.getTicks() >= 0); + + auto lengthBars = lengthOfPattern(clipNum); + auto lengthTicks = lengthBars * TimePos::ticksPerBar(); + if (time > lengthTicks) + { + time = lengthTicks; + } + + return TrackContainer::automatedValuesAt(time + (TimePos::ticksPerBar() * clipNum), clipNum); +} + diff --git a/src/core/PlayHandle.cpp b/src/core/PlayHandle.cpp index 37149583f..1c5f90ef0 100644 --- a/src/core/PlayHandle.cpp +++ b/src/core/PlayHandle.cpp @@ -27,10 +27,8 @@ #include "BufferManager.h" #include "Engine.h" -#include -#include +#include -#include PlayHandle::PlayHandle(const Type type, f_cnt_t offset) : m_type(type), diff --git a/src/core/Plugin.cpp b/src/core/Plugin.cpp index 753f5dfbd..7772bffde 100644 --- a/src/core/Plugin.cpp +++ b/src/core/Plugin.cpp @@ -25,9 +25,8 @@ #include "Plugin.h" #include -#include -#include -#include +#include +#include #include #include "embed.h" diff --git a/src/core/PluginFactory.cpp b/src/core/PluginFactory.cpp index 05d0628a3..879af542c 100644 --- a/src/core/PluginFactory.cpp +++ b/src/core/PluginFactory.cpp @@ -24,16 +24,15 @@ #include "PluginFactory.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include "lmmsconfig.h" #include "ConfigManager.h" #include "Plugin.h" -#include "embed.h" #ifdef LMMS_BUILD_WIN32 QStringList nameFilters("*.dll"); diff --git a/src/core/ProjectRenderer.cpp b/src/core/ProjectRenderer.cpp index 05d50ca9b..323fdd6c9 100644 --- a/src/core/ProjectRenderer.cpp +++ b/src/core/ProjectRenderer.cpp @@ -34,10 +34,6 @@ #include "AudioFileMP3.h" #include "AudioFileFlac.h" -#ifdef LMMS_HAVE_SCHED_H -#include "sched.h" -#endif - const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] = { diff --git a/src/core/RemotePlugin.cpp b/src/core/RemotePlugin.cpp index 520ae4379..652bfaf13 100644 --- a/src/core/RemotePlugin.cpp +++ b/src/core/RemotePlugin.cpp @@ -37,7 +37,7 @@ #include #ifndef SYNC_WITH_SHM_FIFO -#include +#include #include #include #endif diff --git a/src/core/RenderManager.cpp b/src/core/RenderManager.cpp index 4d64f3a14..a0de888f4 100644 --- a/src/core/RenderManager.cpp +++ b/src/core/RenderManager.cpp @@ -22,13 +22,12 @@ * */ -#include #include #include "RenderManager.h" + +#include "PatternStore.h" #include "Song.h" -#include "BBTrackContainer.h" -#include "BBTrack.h" RenderManager::RenderManager( @@ -110,7 +109,7 @@ void RenderManager::renderTracks() } } - const TrackContainer::TrackList t2 = Engine::getBBTrackContainer()->tracks(); + const TrackContainer::TrackList t2 = Engine::patternStore()->tracks(); for( auto it = t2.begin(); it != t2.end(); ++it ) { Track* tk = (*it); diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index 949a4667b..e09dd5198 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -27,7 +27,6 @@ #include -#include #include #include #include @@ -57,7 +56,7 @@ #include "endian_handling.h" #include "Engine.h" #include "GuiApplication.h" -#include "lmms_constants.h" +#include "Note.h" #include "PathUtil.h" #include "FileDialog.h" diff --git a/src/core/SampleClip.cpp b/src/core/SampleClip.cpp index d848c6b57..46bb6e6b7 100644 --- a/src/core/SampleClip.cpp +++ b/src/core/SampleClip.cpp @@ -26,7 +26,9 @@ #include +#include "SampleBuffer.h" #include "SampleClipView.h" +#include "SampleTrack.h" #include "TimeLineWidget.h" SampleClip::SampleClip( Track * _track ) : @@ -67,7 +69,7 @@ SampleClip::SampleClip( Track * _track ) : switch( getTrack()->trackContainer()->type() ) { - case TrackContainer::BBContainer: + case TrackContainer::PatternContainer: setAutoResize( true ); break; @@ -317,4 +319,4 @@ void SampleClip::loadSettings( const QDomElement & _this ) ClipView * SampleClip::createView( TrackView * _tv ) { return new SampleClipView( this, _tv ); -} \ No newline at end of file +} diff --git a/src/core/SamplePlayHandle.cpp b/src/core/SamplePlayHandle.cpp index a904e3d34..bcfd2ea58 100644 --- a/src/core/SamplePlayHandle.cpp +++ b/src/core/SamplePlayHandle.cpp @@ -25,11 +25,11 @@ #include "SamplePlayHandle.h" #include "AudioEngine.h" #include "AudioPort.h" -#include "BBTrack.h" #include "Engine.h" -#include "InstrumentTrack.h" -#include "lmms_constants.h" +#include "Note.h" +#include "PatternTrack.h" #include "SampleClip.h" +#include "SampleTrack.h" @@ -42,7 +42,7 @@ SamplePlayHandle::SamplePlayHandle( SampleBuffer* sampleBuffer , bool ownAudioPo m_defaultVolumeModel( DefaultVolume, MinVolume, MaxVolume, 1 ), m_volumeModel( &m_defaultVolumeModel ), m_track( nullptr ), - m_bbTrack( nullptr ) + m_patternTrack( nullptr ) { if (ownAudioPort) { @@ -106,7 +106,7 @@ void SamplePlayHandle::play( sampleFrame * buffer ) } if( !( m_track && m_track->isMuted() ) - && !( m_bbTrack && m_bbTrack->isMuted() ) ) + && !(m_patternTrack && m_patternTrack->isMuted())) { /* stereoVolumeVector v = { { m_volumeModel->value() / DefaultVolume, @@ -135,7 +135,7 @@ bool SamplePlayHandle::isFinished() const bool SamplePlayHandle::isFromTrack( const Track * _track ) const { - return m_track == _track || m_bbTrack == _track; + return m_track == _track || m_patternTrack == _track; } diff --git a/src/core/SampleRecordHandle.cpp b/src/core/SampleRecordHandle.cpp index ba1d0b016..cc0ce1635 100644 --- a/src/core/SampleRecordHandle.cpp +++ b/src/core/SampleRecordHandle.cpp @@ -25,11 +25,10 @@ #include "SampleRecordHandle.h" #include "AudioEngine.h" -#include "BBTrack.h" #include "Engine.h" -#include "InstrumentTrack.h" +#include "PatternTrack.h" #include "SampleBuffer.h" -#include "SampleTrack.h" +#include "SampleClip.h" #include "debug.h" @@ -38,7 +37,7 @@ SampleRecordHandle::SampleRecordHandle( SampleClip* clip ) : m_framesRecorded( 0 ), m_minLength( clip->length() ), m_track( clip->getTrack() ), - m_bbTrack( nullptr ), + m_patternTrack( nullptr ), m_clip( clip ) { } @@ -94,7 +93,7 @@ bool SampleRecordHandle::isFinished() const bool SampleRecordHandle::isFromTrack( const Track * _track ) const { - return( m_track == _track || m_bbTrack == _track ); + return (m_track == _track || m_patternTrack == _track); } diff --git a/src/core/Scale.cpp b/src/core/Scale.cpp index c71d86075..394377e28 100644 --- a/src/core/Scale.cpp +++ b/src/core/Scale.cpp @@ -24,6 +24,7 @@ #include "Scale.h" +#include #include diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 8593c3026..3bb1911f8 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -27,22 +27,16 @@ #include #include #include -#include #include #include #include -#include #include "AutomationTrack.h" #include "AutomationEditor.h" -#include "BBEditor.h" -#include "BBTrack.h" -#include "BBTrackContainer.h" #include "ConfigManager.h" #include "ControllerRackView.h" #include "ControllerConnection.h" -#include "embed.h" #include "EnvelopeAndLfoParameters.h" #include "Mixer.h" #include "MixerView.h" @@ -51,11 +45,16 @@ #include "GuiApplication.h" #include "ExportFilter.h" #include "InstrumentTrack.h" +#include "Keymap.h" #include "NotePlayHandle.h" #include "MidiClip.h" +#include "PatternEditor.h" +#include "PatternStore.h" +#include "PatternTrack.h" #include "PianoRoll.h" #include "ProjectJournal.h" #include "ProjectNotes.h" +#include "Scale.h" #include "SongEditor.h" #include "TimeLineWidget.h" #include "PeakController.h" @@ -223,11 +222,11 @@ void Song::processNextBuffer() trackList = tracks(); break; - case Mode_PlayBB: - if (Engine::getBBTrackContainer()->numOfBBs() > 0) + case Mode_PlayPattern: + if (Engine::patternStore()->numOfPatterns() > 0) { - clipNum = Engine::getBBTrackContainer()->currentBB(); - trackList.push_back(BBTrack::findBBTrack(clipNum)); + clipNum = Engine::patternStore()->currentPattern(); + trackList.push_back(PatternTrack::findPatternTrack(clipNum)); } break; @@ -292,11 +291,11 @@ void Song::processNextBuffer() frameOffsetInTick -= elapsedTicks * framesPerTick; getPlayPos().setCurrentFrame(frameOffsetInTick); - // If we are playing a BB track, or a MIDI clip with no loop enabled, + // If we are playing a pattern track, or a MIDI clip with no loop enabled, // loop back to the beginning when we reach the end - if (m_playMode == Mode_PlayBB) + if (m_playMode == Mode_PlayPattern) { - enforceLoop(TimePos{0}, TimePos{Engine::getBBTrackContainer()->lengthOfCurrentBB(), 0}); + enforceLoop(TimePos{0}, TimePos{Engine::patternStore()->lengthOfCurrentPattern(), 0}); } else if (m_playMode == Mode_PlayMidiClip && m_loopMidiClip && !loopEnabled) { @@ -372,14 +371,13 @@ void Song::processAutomations(const TrackList &tracklist, TimePos timeStart, fpp { case Mode_PlaySong: break; - case Mode_PlayBB: + case Mode_PlayPattern: { Q_ASSERT(tracklist.size() == 1); - Q_ASSERT(tracklist.at(0)->type() == Track::BBTrack); - auto bbTrack = dynamic_cast(tracklist.at(0)); - auto bbContainer = Engine::getBBTrackContainer(); - container = bbContainer; - clipNum = bbTrack->index(); + Q_ASSERT(tracklist.at(0)->type() == Track::PatternTrack); + auto patternTrack = dynamic_cast(tracklist.at(0)); + container = Engine::patternStore(); + clipNum = patternTrack->patternIndex(); } break; default: @@ -522,14 +520,14 @@ void Song::playAndRecord() -void Song::playBB() +void Song::playPattern() { if( isStopped() == false ) { stop(); } - m_playMode = Mode_PlayBB; + m_playMode = Mode_PlayPattern; m_playing = true; m_paused = false; @@ -804,10 +802,10 @@ void Song::removeBar() -void Song::addBBTrack() +void Song::addPatternTrack() { - Track * t = Track::create( Track::BBTrack, this ); - Engine::getBBTrackContainer()->setCurrentBB( dynamic_cast( t )->index() ); + Track * t = Track::create(Track::PatternTrack, this); + Engine::patternStore()->setCurrentPattern(dynamic_cast(t)->patternIndex()); } @@ -868,9 +866,9 @@ void Song::clearProject() Engine::audioEngine()->requestChangeInModel(); - if( getGUI() != nullptr && getGUI()->getBBEditor() ) + if( getGUI() != nullptr && getGUI()->patternEditor() ) { - getGUI()->getBBEditor()->trackContainerView()->clearAllTracks(); + getGUI()->patternEditor()->m_editor->clearAllTracks(); } if( getGUI() != nullptr && getGUI()->songEditor() ) { @@ -881,7 +879,7 @@ void Song::clearProject() getGUI()->mixerView()->clear(); } QCoreApplication::sendPostedEvents(); - Engine::getBBTrackContainer()->clearAllTracks(); + Engine::patternStore()->clearAllTracks(); clearAllTracks(); Engine::mixer()->clear(); @@ -964,12 +962,11 @@ void Song::createNewProject() t = Track::create( Track::InstrumentTrack, this ); dynamic_cast( t )->loadInstrument( "tripleoscillator" ); - t = Track::create( Track::InstrumentTrack, - Engine::getBBTrackContainer() ); + t = Track::create(Track::InstrumentTrack, Engine::patternStore()); dynamic_cast( t )->loadInstrument( "kicker" ); Track::create( Track::SampleTrack, this ); - Track::create( Track::BBTrack, this ); + Track::create( Track::PatternTrack, this ); Track::create( Track::AutomationTrack, this ); m_tempoModel.setInitValue( DefaultTempo ); @@ -981,7 +978,7 @@ void Song::createNewProject() m_loadingProject = false; - Engine::getBBTrackContainer()->updateAfterTrackAdd(); + Engine::patternStore()->updateAfterTrackAdd(); Engine::projectJournal()->setJournalling( true ); @@ -1126,9 +1123,9 @@ void Song::loadProject( const QString & fileName ) if( nd.isElement() && nd.nodeName() == "track" ) { ++m_nLoadingTrack; - if( nd.toElement().attribute("type").toInt() == Track::BBTrack ) + if (nd.toElement().attribute("type").toInt() == Track::PatternTrack) { - n += nd.toElement().elementsByTagName("bbtrack").at(0) + n += nd.toElement().elementsByTagName("patterntrack").at(0) .toElement().firstChildElement().childNodes().count(); } nd=nd.nextSibling(); @@ -1183,9 +1180,8 @@ void Song::loadProject( const QString & fileName ) node = node.nextSibling(); } - // quirk for fixing projects with broken positions of Clips inside - // BB-tracks - Engine::getBBTrackContainer()->fixIncorrectPositions(); + // quirk for fixing projects with broken positions of Clips inside pattern tracks + Engine::patternStore()->fixIncorrectPositions(); // Connect controller links to their controllers // now that everything is loaded @@ -1420,12 +1416,12 @@ void Song::exportProjectMidi(QString const & exportFileName) const { // instantiate midi export plugin TrackContainer::TrackList const & tracks = this->tracks(); - TrackContainer::TrackList const & tracks_BB = Engine::getBBTrackContainer()->tracks(); + TrackContainer::TrackList const & patternStoreTracks = Engine::patternStore()->tracks(); ExportFilter *exf = dynamic_cast (Plugin::instantiate("midiexport", nullptr, nullptr)); if (exf) { - exf->tryExport(tracks, tracks_BB, getTempo(), m_masterPitchModel.value(), exportFileName); + exf->tryExport(tracks, patternStoreTracks, getTempo(), m_masterPitchModel.value(), exportFileName); } else { diff --git a/src/core/StepRecorder.cpp b/src/core/StepRecorder.cpp index 96b93320f..29675d5b2 100644 --- a/src/core/StepRecorder.cpp +++ b/src/core/StepRecorder.cpp @@ -19,12 +19,14 @@ */ #include "StepRecorder.h" + +#include + +#include "MidiClip.h" #include "StepRecorderWidget.h" #include "PianoRoll.h" -#include -#include using std::min; using std::max; diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 800662256..d3418ea33 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -29,15 +29,16 @@ #include "Track.h" +#include #include #include "AutomationClip.h" #include "AutomationTrack.h" -#include "BBTrack.h" -#include "BBTrackContainer.h" #include "ConfigManager.h" #include "Engine.h" #include "InstrumentTrack.h" +#include "PatternStore.h" +#include "PatternTrack.h" #include "SampleTrack.h" #include "Song.h" @@ -47,7 +48,7 @@ * The track object is the whole track, linking its contents, its * automation, name, type, and so forth. * - * \param type The type of track (Song Editor or Beat+Bassline Editor) + * \param type The type of track (Song Editor or Pattern Editor) * \param tc The track Container object to encapsulate in this track. * * \todo check the definitions of all the properties - are they OK? @@ -73,13 +74,7 @@ Track::Track( TrackTypes type, TrackContainer * tc ) : /*! \brief Destroy this track * - * If the track container is a Beat+Bassline container, step through - * its list of tracks and remove us. - * - * Then delete the Clip's contents, remove this track from - * the track container. - * - * Finally step through this track's automation and forget all of them. + * Delete the clips and remove this track from the track container. */ Track::~Track() { @@ -112,7 +107,7 @@ Track * Track::create( TrackTypes tt, TrackContainer * tc ) switch( tt ) { case InstrumentTrack: t = new ::InstrumentTrack( tc ); break; - case BBTrack: t = new ::BBTrack( tc ); break; + case PatternTrack: t = new ::PatternTrack( tc ); break; case SampleTrack: t = new ::SampleTrack( tc ); break; // case EVENT_TRACK: // case VIDEO_TRACK: @@ -122,10 +117,9 @@ Track * Track::create( TrackTypes tt, TrackContainer * tc ) default: break; } - if( tc == Engine::getBBTrackContainer() && t ) + if (tc == Engine::patternStore() && t) { - t->createClipsForBB( Engine::getBBTrackContainer()->numOfBBs() - - 1 ); + t->createClipsForPattern(Engine::patternStore()->numOfPatterns() - 1); } tc->updateAfterTrackAdd(); @@ -168,8 +162,9 @@ Track * Track::create( const QDomElement & element, TrackContainer * tc ) */ Track* Track::clone() { + // Save track to temporary XML and load it to create a new identical track QDomDocument doc; - QDomElement parent = doc.createElement("clone"); + QDomElement parent = doc.createElement("clonedtrack"); saveState(doc, parent); Track* t = create(parent.firstChild().toElement(), m_trackContainer); @@ -217,8 +212,7 @@ void Track::saveSettings( QDomDocument & doc, QDomElement & element ) } QDomElement tsDe = doc.createElement( nodeName() ); - // let actual track (InstrumentTrack, bbTrack, sampleTrack etc.) save - // its settings + // let actual track (InstrumentTrack, PatternTrack, SampleTrack etc.) save its settings element.appendChild( tsDe ); saveTrackSpecificSettings( doc, tsDe ); @@ -491,9 +485,9 @@ void Track::swapPositionOfClips( int clipNum1, int clipNum2 ) -void Track::createClipsForBB( int bb ) +void Track::createClipsForPattern(int pattern) { - while( numOfClips() < bb + 1 ) + while( numOfClips() < pattern + 1 ) { TimePos position = TimePos( numOfClips(), 0 ); Clip * clip = createClip( position ); diff --git a/src/core/TrackContainer.cpp b/src/core/TrackContainer.cpp index 881e76d9f..6c52b41af 100644 --- a/src/core/TrackContainer.cpp +++ b/src/core/TrackContainer.cpp @@ -1,6 +1,6 @@ /* * TrackContainer.cpp - implementation of base class for all trackcontainers - * like Song-Editor, BB-Editor... + * like Song-Editor, Pattern Editor... * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -24,18 +24,17 @@ */ -#include +#include #include #include #include #include "AutomationClip.h" -#include "AutomationTrack.h" -#include "BBTrack.h" -#include "BBTrackContainer.h" #include "embed.h" #include "TrackContainer.h" -#include "InstrumentTrack.h" +#include "PatternClip.h" +#include "PatternStore.h" +#include "PatternTrack.h" #include "Song.h" #include "GuiApplication.h" @@ -268,7 +267,7 @@ AutomatedValueMap TrackContainer::automatedValuesFromTracks(const TrackList &tra { case Track::AutomationTrack: case Track::HiddenAutomationTrack: - case Track::BBTrack: + case Track::PatternTrack: if (clipNum < 0) { track->getClipsInRange(clips, 0, time); } else { @@ -306,19 +305,19 @@ AutomatedValueMap TrackContainer::automatedValuesFromTracks(const TrackList &tra valueMap[model] = value; } } - else if (auto* bb = dynamic_cast(clip)) + else if (auto* pattern = dynamic_cast(clip)) { - auto bbIndex = dynamic_cast(bb->getTrack())->index(); - auto bbContainer = Engine::getBBTrackContainer(); + auto patIndex = dynamic_cast(pattern->getTrack())->patternIndex(); + auto patStore = Engine::patternStore(); - TimePos bbTime = time - clip->startPosition(); - bbTime = std::min(bbTime, clip->length()); - bbTime = bbTime % (bbContainer->lengthOfBB(bbIndex) * TimePos::ticksPerBar()); + TimePos patTime = time - clip->startPosition(); + patTime = std::min(patTime, clip->length()); + patTime = patTime % (patStore->lengthOfPattern(patIndex) * TimePos::ticksPerBar()); - auto bbValues = bbContainer->automatedValuesAt(bbTime, bbIndex); - for (auto it=bbValues.begin(); it != bbValues.end(); it++) + auto patValues = patStore->automatedValuesAt(patTime, patIndex); + for (auto it=patValues.begin(); it != patValues.end(); it++) { - // override old values, bb track with the highest index takes precedence + // override old values, pattern track with the highest index takes precedence valueMap[it.key()] = it.value(); } } diff --git a/src/core/VstSyncController.cpp b/src/core/VstSyncController.cpp index 9caa92e09..c905b5561 100644 --- a/src/core/VstSyncController.cpp +++ b/src/core/VstSyncController.cpp @@ -23,18 +23,16 @@ * */ +#include "VstSyncController.h" + #include #include "AudioEngine.h" #include "ConfigManager.h" #include "Engine.h" -#include "VstSyncController.h" #include "RemotePlugin.h" #ifndef USE_QT_SHMEM -#include -#include -#include #include #include #include diff --git a/src/core/audio/AudioAlsa.cpp b/src/core/audio/AudioAlsa.cpp index 83c64f46c..1cea301b9 100644 --- a/src/core/audio/AudioAlsa.cpp +++ b/src/core/audio/AudioAlsa.cpp @@ -22,8 +22,6 @@ * */ -#include -#include #include "AudioAlsa.h" @@ -33,7 +31,6 @@ #include "AudioEngine.h" #include "ConfigManager.h" #include "Engine.h" -#include "gui_templates.h" AudioAlsa::AudioAlsa( bool & _success_ful, AudioEngine* _audioEngine ) : diff --git a/src/core/audio/AudioFileMP3.cpp b/src/core/audio/AudioFileMP3.cpp index 0a0045a9c..088cd6eda 100644 --- a/src/core/audio/AudioFileMP3.cpp +++ b/src/core/audio/AudioFileMP3.cpp @@ -27,7 +27,6 @@ #ifdef LMMS_HAVE_MP3LAME -#include "AudioEngine.h" #include diff --git a/src/core/audio/AudioFileWave.cpp b/src/core/audio/AudioFileWave.cpp index 94b84c0da..1fce2fe48 100644 --- a/src/core/audio/AudioFileWave.cpp +++ b/src/core/audio/AudioFileWave.cpp @@ -27,8 +27,6 @@ #include "endian_handling.h" #include "AudioEngine.h" -#include -#include AudioFileWave::AudioFileWave( OutputSettings const & outputSettings, diff --git a/src/core/audio/AudioJack.cpp b/src/core/audio/AudioJack.cpp index aac1cda8e..6bc039a50 100644 --- a/src/core/audio/AudioJack.cpp +++ b/src/core/audio/AudioJack.cpp @@ -35,7 +35,6 @@ #include "gui_templates.h" #include "ConfigManager.h" #include "LcdSpinBox.h" -#include "AudioPort.h" #include "MainWindow.h" #include "AudioEngine.h" #include "MidiJack.h" diff --git a/src/core/audio/AudioPortAudio.cpp b/src/core/audio/AudioPortAudio.cpp index 2bd2874c7..1bc137dac 100644 --- a/src/core/audio/AudioPortAudio.cpp +++ b/src/core/audio/AudioPortAudio.cpp @@ -43,7 +43,6 @@ void AudioPortAudioSetupUtil::updateChannels() #ifdef LMMS_HAVE_PORTAUDIO #include -#include #include "Engine.h" #include "ConfigManager.h" diff --git a/src/core/audio/AudioSdl.cpp b/src/core/audio/AudioSdl.cpp index 50991642c..d62678b49 100644 --- a/src/core/audio/AudioSdl.cpp +++ b/src/core/audio/AudioSdl.cpp @@ -28,9 +28,9 @@ #include #include +#include #include "AudioEngine.h" -#include "Engine.h" #include "ConfigManager.h" #include "gui_templates.h" diff --git a/src/core/audio/AudioSndio.cpp b/src/core/audio/AudioSndio.cpp index 4bd978744..114e01460 100644 --- a/src/core/audio/AudioSndio.cpp +++ b/src/core/audio/AudioSndio.cpp @@ -27,7 +27,7 @@ #ifdef LMMS_HAVE_SNDIO -#include +#include #include #include @@ -37,13 +37,6 @@ #include "Engine.h" #include "gui_templates.h" -#ifdef LMMS_HAVE_UNISTD_H -#include -#endif -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - #include "ConfigManager.h" diff --git a/src/core/lv2/Lv2ControlBase.cpp b/src/core/lv2/Lv2ControlBase.cpp index 98fe7b13b..3c8ccbf8a 100644 --- a/src/core/lv2/Lv2ControlBase.cpp +++ b/src/core/lv2/Lv2ControlBase.cpp @@ -27,6 +27,7 @@ #ifdef LMMS_HAVE_LV2 #include +#include #include #include "Engine.h" diff --git a/src/core/lv2/Lv2Manager.cpp b/src/core/lv2/Lv2Manager.cpp index 25fab7002..09870a90b 100644 --- a/src/core/lv2/Lv2Manager.cpp +++ b/src/core/lv2/Lv2Manager.cpp @@ -30,18 +30,13 @@ #include #include #include -#include #include #include #include -#include -#include #include -#include "ConfigManager.h" #include "Engine.h" #include "Plugin.h" -#include "PluginFactory.h" #include "Lv2ControlBase.h" #include "Lv2Options.h" #include "PluginIssue.h" diff --git a/src/core/lv2/Lv2Proc.cpp b/src/core/lv2/Lv2Proc.cpp index 3ea734f91..59f84befe 100644 --- a/src/core/lv2/Lv2Proc.cpp +++ b/src/core/lv2/Lv2Proc.cpp @@ -41,6 +41,7 @@ #include "Lv2Manager.h" #include "Lv2Ports.h" #include "Lv2Evbuf.h" +#include "MidiEvent.h" #include "MidiEventToByteSeq.h" diff --git a/src/core/lv2/Lv2SubPluginFeatures.cpp b/src/core/lv2/Lv2SubPluginFeatures.cpp index 3f86c5324..8fb908cb1 100644 --- a/src/core/lv2/Lv2SubPluginFeatures.cpp +++ b/src/core/lv2/Lv2SubPluginFeatures.cpp @@ -28,7 +28,6 @@ #ifdef LMMS_HAVE_LV2 -#include #include #include diff --git a/src/core/main.cpp b/src/core/main.cpp index 9912d2348..953995b67 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -55,7 +55,7 @@ #include #endif -#include +#include #include "MainApplication.h" #include "ConfigManager.h" @@ -71,7 +71,6 @@ #include "ProjectRenderer.h" #include "RenderManager.h" #include "Song.h" -#include "SetupDialog.h" #ifdef LMMS_DEBUG_FPE #include // For feenableexcept diff --git a/src/core/midi/MidiAlsaRaw.cpp b/src/core/midi/MidiAlsaRaw.cpp index a4fcae19e..883d31e96 100644 --- a/src/core/midi/MidiAlsaRaw.cpp +++ b/src/core/midi/MidiAlsaRaw.cpp @@ -24,7 +24,6 @@ #include "MidiAlsaRaw.h" #include "ConfigManager.h" -#include "gui_templates.h" #ifdef LMMS_HAVE_ALSA diff --git a/src/core/midi/MidiAlsaSeq.cpp b/src/core/midi/MidiAlsaSeq.cpp index c47dcf6cf..b04964843 100644 --- a/src/core/midi/MidiAlsaSeq.cpp +++ b/src/core/midi/MidiAlsaSeq.cpp @@ -25,10 +25,8 @@ #include "MidiAlsaSeq.h" #include "ConfigManager.h" #include "Engine.h" -#include "gui_templates.h" #include "Song.h" #include "MidiPort.h" -#include "Note.h" #ifdef LMMS_HAVE_ALSA diff --git a/src/core/midi/MidiClient.cpp b/src/core/midi/MidiClient.cpp index 06de8c4b0..109e01fd6 100644 --- a/src/core/midi/MidiClient.cpp +++ b/src/core/midi/MidiClient.cpp @@ -25,7 +25,6 @@ #include "MidiClient.h" #include "MidiPort.h" -#include "Note.h" MidiClient::MidiClient() diff --git a/src/core/midi/MidiController.cpp b/src/core/midi/MidiController.cpp index 051ab978a..91d0dd782 100644 --- a/src/core/midi/MidiController.cpp +++ b/src/core/midi/MidiController.cpp @@ -24,11 +24,8 @@ */ #include -#include -#include "Song.h" #include "AudioEngine.h" -#include "MidiClient.h" #include "MidiController.h" diff --git a/src/core/midi/MidiJack.cpp b/src/core/midi/MidiJack.cpp index c6e687343..fdf194889 100644 --- a/src/core/midi/MidiJack.cpp +++ b/src/core/midi/MidiJack.cpp @@ -26,12 +26,11 @@ #ifdef LMMS_HAVE_JACK -#include #include #include "AudioEngine.h" +#include "AudioJack.h" #include "ConfigManager.h" -#include "gui_templates.h" #include "GuiApplication.h" #include "Engine.h" #include "MainWindow.h" diff --git a/src/core/midi/MidiOss.cpp b/src/core/midi/MidiOss.cpp index 758b94453..faf6453a2 100644 --- a/src/core/midi/MidiOss.cpp +++ b/src/core/midi/MidiOss.cpp @@ -28,7 +28,6 @@ #ifdef LMMS_HAVE_OSS #include "ConfigManager.h" -#include "gui_templates.h" diff --git a/src/core/midi/MidiPort.cpp b/src/core/midi/MidiPort.cpp index 99790add6..40460f434 100644 --- a/src/core/midi/MidiPort.cpp +++ b/src/core/midi/MidiPort.cpp @@ -28,6 +28,7 @@ #include "MidiPort.h" #include "MidiClient.h" #include "MidiDummy.h" +#include "MidiEventProcessor.h" #include "Note.h" #include "Song.h" diff --git a/src/core/midi/MidiSndio.cpp b/src/core/midi/MidiSndio.cpp index 29fa4d84f..4acd2827e 100644 --- a/src/core/midi/MidiSndio.cpp +++ b/src/core/midi/MidiSndio.cpp @@ -27,17 +27,11 @@ #ifdef LMMS_HAVE_SNDIO -#include -#include - -#ifdef LMMS_HAVE_STDLIB_H -#include -#endif - +#include +#include #include #include "ConfigManager.h" -#include "gui_templates.h" MidiSndio::MidiSndio( void ) : diff --git a/src/core/midi/MidiWinMM.cpp b/src/core/midi/MidiWinMM.cpp index eb1a00c7f..80ebea964 100644 --- a/src/core/midi/MidiWinMM.cpp +++ b/src/core/midi/MidiWinMM.cpp @@ -23,7 +23,6 @@ */ #include "MidiWinMM.h" -#include "Note.h" #ifdef LMMS_BUILD_WIN32 diff --git a/src/gui/AutomatableModelView.cpp b/src/gui/AutomatableModelView.cpp index ba89d043c..082022d35 100644 --- a/src/gui/AutomatableModelView.cpp +++ b/src/gui/AutomatableModelView.cpp @@ -22,7 +22,6 @@ * */ -#include #include #include diff --git a/src/gui/AutomationClipView.cpp b/src/gui/AutomationClipView.cpp index 47fa2e046..16e7c0b86 100644 --- a/src/gui/AutomationClipView.cpp +++ b/src/gui/AutomationClipView.cpp @@ -23,6 +23,7 @@ */ #include "AutomationClipView.h" +#include #include #include #include @@ -31,12 +32,12 @@ #include "AutomationEditor.h" #include "embed.h" #include "GuiApplication.h" -#include "gui_templates.h" #include "ProjectJournal.h" #include "RenameDialog.h" #include "StringPairDrag.h" #include "TextFloat.h" #include "ToolTip.h" +#include "Track.h" #include "Engine.h" @@ -276,7 +277,7 @@ void AutomationClipView::paintEvent( QPaintEvent * ) // pixels per bar const float ppb = fixedClips() ? - ( parentWidget()->width() - 2 * CLIP_BORDER_WIDTH ) + ( parentWidget()->width() - 2 * BORDER_WIDTH ) / (float) m_clip->timeMapLength().getBar() : pixelsPerBar(); @@ -284,10 +285,10 @@ void AutomationClipView::paintEvent( QPaintEvent * ) const float max = m_clip->firstObject()->maxValue(); const float y_scale = max - min; - const float h = ( height() - 2 * CLIP_BORDER_WIDTH ) / y_scale; + const float h = ( height() - 2 * BORDER_WIDTH ) / y_scale; const float ppTick = ppb / TimePos::ticksPerBar(); - p.translate( 0.0f, max * height() / y_scale - CLIP_BORDER_WIDTH ); + p.translate( 0.0f, max * height() / y_scale - BORDER_WIDTH ); p.scale( 1.0f, -h ); QLinearGradient lin2grad( 0, min, 0, max ); @@ -307,8 +308,8 @@ void AutomationClipView::paintEvent( QPaintEvent * ) if( it+1 == m_clip->getTimeMap().end() ) { const float x1 = POS(it) * ppTick; - const float x2 = (float)( width() - CLIP_BORDER_WIDTH ); - if( x1 > ( width() - CLIP_BORDER_WIDTH ) ) break; + const float x2 = (float)( width() - BORDER_WIDTH ); + if( x1 > ( width() - BORDER_WIDTH ) ) break; // We are drawing the space after the last node, so we use the outValue if( gradient() ) { @@ -347,7 +348,7 @@ void AutomationClipView::paintEvent( QPaintEvent * ) for (int i = POS(it) + 1; i < POS(it + 1); i++) { x = i * ppTick; - if( x > ( width() - CLIP_BORDER_WIDTH ) ) break; + if( x > ( width() - BORDER_WIDTH ) ) break; float value = values[i - POS(it)]; path.lineTo( QPointF( x, value ) ); @@ -374,15 +375,15 @@ void AutomationClipView::paintEvent( QPaintEvent * ) const int lineSize = 3; p.setPen( c.darker( 300 ) ); - for (bar_t b = 1; b < width() - CLIP_BORDER_WIDTH; ++b) + for (bar_t b = 1; b < width() - BORDER_WIDTH; ++b) { - const int bx = CLIP_BORDER_WIDTH + static_cast(ppb * b) - 2; + const int bx = BORDER_WIDTH + static_cast(ppb * b) - 2; //top line - p.drawLine(bx, CLIP_BORDER_WIDTH, bx, CLIP_BORDER_WIDTH + lineSize); + p.drawLine(bx, BORDER_WIDTH, bx, BORDER_WIDTH + lineSize); //bottom line - p.drawLine(bx, rect().bottom() - (lineSize + CLIP_BORDER_WIDTH), bx, rect().bottom() - CLIP_BORDER_WIDTH); + p.drawLine(bx, rect().bottom() - (lineSize + BORDER_WIDTH), bx, rect().bottom() - BORDER_WIDTH); } // recording icon for when recording automation @@ -396,8 +397,8 @@ void AutomationClipView::paintEvent( QPaintEvent * ) // inner border p.setPen( c.lighter( current ? 160 : 130 ) ); - p.drawRect( 1, 1, rect().right() - CLIP_BORDER_WIDTH, - rect().bottom() - CLIP_BORDER_WIDTH ); + p.drawRect( 1, 1, rect().right() - BORDER_WIDTH, + rect().bottom() - BORDER_WIDTH ); // outer border p.setPen( current? c.lighter( 130 ) : c.darker( 300 ) ); @@ -406,7 +407,7 @@ void AutomationClipView::paintEvent( QPaintEvent * ) // draw the 'muted' pixmap only if the clip was manualy muted if( m_clip->isMuted() ) { - const int spacing = CLIP_BORDER_WIDTH; + const int spacing = BORDER_WIDTH; const int size = 14; p.drawPixmap( spacing, height() - ( size + spacing ), embed::getIconPixmap( "muted", size, size ) ); diff --git a/src/gui/AutomationTrackView.cpp b/src/gui/AutomationTrackView.cpp index 152d11401..ec44ba937 100644 --- a/src/gui/AutomationTrackView.cpp +++ b/src/gui/AutomationTrackView.cpp @@ -25,13 +25,14 @@ #include "AutomationTrackView.h" - #include "AutomationClip.h" - #include "embed.h" - #include "Engine.h" - #include "ProjectJournal.h" - #include "StringPairDrag.h" - #include "TrackContainerView.h" - #include "TrackLabelButton.h" +#include "AutomationClip.h" +#include "AutomationTrack.h" +#include "embed.h" +#include "Engine.h" +#include "ProjectJournal.h" +#include "StringPairDrag.h" +#include "TrackContainerView.h" +#include "TrackLabelButton.h" AutomationTrackView::AutomationTrackView( AutomationTrack * _at, TrackContainerView* tcv ) : @@ -85,4 +86,4 @@ void AutomationTrackView::dropEvent( QDropEvent * _de ) } update(); -} \ No newline at end of file +} diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 0aeb79d17..033bb63df 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -9,8 +9,6 @@ SET(LMMS_SRCS gui/AutomationTrackView.cpp gui/ControllerConnectionDialog.cpp gui/ControllerDialog.cpp - gui/BBClipView.cpp - gui/BBTrackView.cpp gui/EffectControlDialog.cpp gui/EffectSelectDialog.cpp gui/embed.cpp @@ -31,6 +29,8 @@ SET(LMMS_SRCS gui/MidiClipView.cpp gui/MidiSetupWidget.cpp gui/ModelView.cpp + gui/PatternClipView.cpp + gui/PatternTrackView.cpp gui/PeakControllerDialog.cpp gui/PianoView.cpp gui/PluginBrowser.cpp @@ -52,8 +52,8 @@ SET(LMMS_SRCS gui/dialogs/ColorChooser.cpp gui/editors/AutomationEditor.cpp - gui/editors/BBEditor.cpp gui/editors/Editor.cpp + gui/editors/PatternEditor.cpp gui/editors/PianoRoll.cpp gui/editors/SongEditor.cpp diff --git a/src/gui/ClipView.cpp b/src/gui/ClipView.cpp index e77ebd67d..1e154f155 100644 --- a/src/gui/ClipView.cpp +++ b/src/gui/ClipView.cpp @@ -41,8 +41,9 @@ #include "InstrumentTrack.h" #include "InstrumentTrackView.h" #include "MidiClip.h" +#include "MidiClipView.h" #include "Note.h" -#include "SampleTrack.h" +#include "SampleClip.h" #include "Song.h" #include "SongEditor.h" #include "StringPairDrag.h" @@ -91,7 +92,7 @@ ClipView::ClipView( Clip * clip, m_selectedColor( 0, 0, 0 ), m_textColor( 0, 0, 0 ), m_textShadowColor( 0, 0, 0 ), - m_BBClipBackground( 0, 0, 0 ), + m_patternClipBackground( 0, 0, 0 ), m_gradient( true ), m_mouseHotspotHand( 0, 0 ), m_mouseHotspotKnife( 0, 0 ), @@ -219,8 +220,8 @@ QColor ClipView::textBackgroundColor() const QColor ClipView::textShadowColor() const { return m_textShadowColor; } -QColor ClipView::BBClipBackground() const -{ return m_BBClipBackground; } +QColor ClipView::patternClipBackground() const +{ return m_patternClipBackground; } bool ClipView::gradient() const { return m_gradient; } @@ -246,8 +247,8 @@ void ClipView::setTextBackgroundColor( const QColor & c ) void ClipView::setTextShadowColor( const QColor & c ) { m_textShadowColor = QColor( c ); } -void ClipView::setBBClipBackground( const QColor & c ) -{ m_BBClipBackground = QColor( c ); } +void ClipView::setPatternClipBackground( const QColor & c ) +{ m_patternClipBackground = QColor( c ); } void ClipView::setGradient( const bool & b ) { m_gradient = b; } @@ -311,7 +312,7 @@ void ClipView::updateLength() setFixedWidth( static_cast( m_clip->length() * pixelsPerBar() / TimePos::ticksPerBar() ) + 1 /*+ - CLIP_BORDER_WIDTH * 2-1*/ ); + BORDER_WIDTH * 2-1*/ ); } m_trackView->trackContainerView()->update(); } @@ -583,8 +584,8 @@ void ClipView::paintTextLabel(QString const & text, QPainter & painter) labelFont.setHintingPreference( QFont::PreferFullHinting ); painter.setFont( labelFont ); - const int textTop = CLIP_BORDER_WIDTH + 1; - const int textLeft = CLIP_BORDER_WIDTH + 3; + const int textTop = BORDER_WIDTH + 1; + const int textLeft = BORDER_WIDTH + 3; QFontMetrics fontMetrics(labelFont); QString elidedClipName = fontMetrics.elidedText(text, Qt::ElideMiddle, width() - 2 * textLeft); diff --git a/src/gui/ControllerConnectionDialog.cpp b/src/gui/ControllerConnectionDialog.cpp index b72914716..216dd6066 100644 --- a/src/gui/ControllerConnectionDialog.cpp +++ b/src/gui/ControllerConnectionDialog.cpp @@ -23,10 +23,9 @@ * */ -#include +#include #include #include -#include #include #include "AudioEngine.h" @@ -40,9 +39,9 @@ #include "ComboBox.h" #include "GroupBox.h" #include "Song.h" +#include "TabWidget.h" #include "ToolButton.h" -#include "gui_templates.h" #include "embed.h" diff --git a/src/gui/EffectControlDialog.cpp b/src/gui/EffectControlDialog.cpp index 3439835d1..d7d5b4054 100644 --- a/src/gui/EffectControlDialog.cpp +++ b/src/gui/EffectControlDialog.cpp @@ -23,7 +23,6 @@ * */ -#include #include #include "EffectControlDialog.h" diff --git a/src/gui/EffectSelectDialog.cpp b/src/gui/EffectSelectDialog.cpp index 56e30d4b2..b4bd3af4a 100644 --- a/src/gui/EffectSelectDialog.cpp +++ b/src/gui/EffectSelectDialog.cpp @@ -26,8 +26,8 @@ #include "ui_EffectSelectDialog.h" -#include "gui_templates.h" #include "DummyEffect.h" +#include "EffectChain.h" #include "embed.h" #include "PluginFactory.h" diff --git a/src/gui/ExportProjectDialog.cpp b/src/gui/ExportProjectDialog.cpp index c3bf074e0..151d25237 100644 --- a/src/gui/ExportProjectDialog.cpp +++ b/src/gui/ExportProjectDialog.cpp @@ -23,9 +23,7 @@ */ #include -#include #include -#include #include "ExportProjectDialog.h" #include "Song.h" diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index 4a37aac91..383431ca1 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -24,6 +24,7 @@ */ +#include #include #include #include @@ -38,20 +39,20 @@ #include "FileBrowser.h" #include "AudioEngine.h" -#include "BBTrackContainer.h" #include "ConfigManager.h" #include "DataFile.h" #include "embed.h" #include "Engine.h" #include "GuiApplication.h" -#include "gui_templates.h" #include "ImportFilter.h" #include "Instrument.h" #include "InstrumentTrack.h" #include "InstrumentTrackWindow.h" #include "MainWindow.h" +#include "PatternStore.h" #include "PluginFactory.h" #include "PresetPreviewPlayHandle.h" +#include "SampleClip.h" #include "SamplePlayHandle.h" #include "SampleTrack.h" #include "Song.h" @@ -450,7 +451,7 @@ void FileBrowserTreeWidget::keyPressEvent(QKeyEvent * ke ) // When enter is pressed, add the selected item... if (insert) { - // ...to the song editor by default, or to the BB editor if ctrl is held + // ...to the song editor by default, or to the pattern editor if ctrl is held bool songEditor = !(ke->modifiers() & Qt::ControlModifier); // If shift is held, we send the item to a new sample track... bool sampleTrack = ke->modifiers() & Qt::ShiftModifier; @@ -521,9 +522,9 @@ void FileBrowserTreeWidget::contextMenuEvent(QContextMenuEvent * e ) contextMenu.addAction( songEditorHeader ); contextMenu.addActions( getContextActions(file, true) ); - QAction* bbEditorHeader = new QAction( tr("BB Editor"), nullptr ); - bbEditorHeader->setDisabled(true); - contextMenu.addAction( bbEditorHeader ); + QAction* patternEditorHeader = new QAction(tr("Pattern Editor"), nullptr); + patternEditorHeader->setDisabled(true); + contextMenu.addAction(patternEditorHeader); contextMenu.addActions( getContextActions(file, false) ); // We should only show the menu if it contains items @@ -815,8 +816,8 @@ void FileBrowserTreeWidget::activateListItem(QTreeWidgetItem * item, else if( f->handling() != FileItem::NotSupported ) { InstrumentTrack * it = dynamic_cast( - Track::create( Track::InstrumentTrack, - Engine::getBBTrackContainer() ) ); + Track::create(Track::InstrumentTrack, Engine::patternStore()) + ); handleFile( f, it ); } } @@ -841,7 +842,7 @@ void FileBrowserTreeWidget::openInNewInstrumentTrack(FileItem* item, bool songEd { // Get the correct TrackContainer. Ternary doesn't compile here TrackContainer* tc = Engine::getSong(); - if (!songEditor) { tc = Engine::getBBTrackContainer(); } + if (!songEditor) { tc = Engine::patternStore(); } openInNewInstrumentTrack(tc, item); } @@ -1247,7 +1248,11 @@ void FileItem::determineFileType( void ) m_type = MidiFile; m_handling = ImportAsProject; } - else if( ext == "dll" ) + else if( ext == "dll" +#ifdef LMMS_BUILD_LINUX + || ext == "so" +#endif + ) { m_type = VstPluginFile; m_handling = LoadByPlugin; diff --git a/src/gui/GuiApplication.cpp b/src/gui/GuiApplication.cpp index 90c9c95f7..0829bfd80 100644 --- a/src/gui/GuiApplication.cpp +++ b/src/gui/GuiApplication.cpp @@ -30,13 +30,12 @@ #include "LmmsPalette.h" #include "AutomationEditor.h" -#include "BBEditor.h" #include "ConfigManager.h" #include "ControllerRackView.h" #include "MixerView.h" -#include "InstrumentTrack.h" #include "MainWindow.h" #include "MicrotunerConfig.h" +#include "PatternEditor.h" #include "PianoRoll.h" #include "ProjectNotes.h" #include "SongEditor.h" @@ -44,6 +43,7 @@ #include #include #include +#include #include #include @@ -153,9 +153,9 @@ GuiApplication::GuiApplication() m_microtunerConfig = new MicrotunerConfig; connect(m_microtunerConfig, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*))); - displayInitProgress(tr("Preparing beat/bassline editor")); - m_bbEditor = new BBEditor(Engine::getBBTrackContainer()); - connect(m_bbEditor, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*))); + displayInitProgress(tr("Preparing pattern editor")); + m_patternEditor = new PatternEditorWindow(Engine::patternStore()); + connect(m_patternEditor, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*))); displayInitProgress(tr("Preparing piano roll")); m_pianoRoll = new PianoRollWindow(); @@ -207,9 +207,9 @@ void GuiApplication::childDestroyed(QObject *obj) { m_automationEditor = nullptr; } - else if (obj == m_bbEditor) + else if (obj == m_patternEditor) { - m_bbEditor = nullptr; + m_patternEditor = nullptr; } else if (obj == m_pianoRoll) { diff --git a/src/gui/InstrumentTrackView.cpp b/src/gui/InstrumentTrackView.cpp index f20182ebb..b58144956 100644 --- a/src/gui/InstrumentTrackView.cpp +++ b/src/gui/InstrumentTrackView.cpp @@ -33,10 +33,10 @@ #include "AudioEngine.h" #include "ConfigManager.h" -#include "ControllerConnectionDialog.h" #include "Engine.h" #include "FadeButton.h" -#include "MixerLineLcdSpinBox.h" +#include "Knob.h" +#include "MidiCCRackView.h" #include "Mixer.h" #include "MixerView.h" #include "GuiApplication.h" diff --git a/src/gui/InstrumentTrackWindow.cpp b/src/gui/InstrumentTrackWindow.cpp index eb6f7c410..0dd95c30a 100644 --- a/src/gui/InstrumentTrackWindow.cpp +++ b/src/gui/InstrumentTrackWindow.cpp @@ -28,8 +28,9 @@ #include #include #include -#include +#include #include +#include #include #include "ComboBox.h" @@ -40,8 +41,8 @@ #include "Engine.h" #include "FileBrowser.h" #include "FileDialog.h" +#include "GroupBox.h" #include "MixerLineLcdSpinBox.h" -#include "Mixer.h" #include "GuiApplication.h" #include "gui_templates.h" #include "Instrument.h" @@ -52,6 +53,7 @@ #include "InstrumentSoundShapingView.h" #include "InstrumentTrack.h" #include "InstrumentTrackView.h" +#include "Knob.h" #include "LcdSpinBox.h" #include "LedCheckbox.h" #include "LeftRightNav.h" @@ -61,6 +63,7 @@ #include "PluginView.h" #include "Song.h" #include "StringPairDrag.h" +#include "SubWindow.h" #include "TabWidget.h" #include "ToolTip.h" #include "TrackContainerView.h" @@ -650,7 +653,7 @@ void InstrumentTrackWindow::viewInstrumentInDirection(int d) newView->m_tlb->setChecked(true); newView->getInstrumentTrackWindow()->parentWidget()->move(curPos); - // scroll the SongEditor/BB-editor to make sure the new trackview label is visible + // scroll the SongEditor/PatternEditor to make sure the new trackview label is visible bringToFront->trackContainerView()->scrollToTrackView(bringToFront); // get the instrument window to refresh diff --git a/src/gui/InstrumentView.cpp b/src/gui/InstrumentView.cpp index 80594a04a..eaa49df10 100644 --- a/src/gui/InstrumentView.cpp +++ b/src/gui/InstrumentView.cpp @@ -28,7 +28,6 @@ #include "embed.h" #include "InstrumentTrack.h" #include "InstrumentTrackWindow.h" -#include "StringPairDrag.h" InstrumentView::InstrumentView( Instrument * _Instrument, QWidget * _parent ) : diff --git a/src/gui/LfoControllerDialog.cpp b/src/gui/LfoControllerDialog.cpp index 943894a71..564f85e54 100644 --- a/src/gui/LfoControllerDialog.cpp +++ b/src/gui/LfoControllerDialog.cpp @@ -23,16 +23,8 @@ * */ -#include -#include -#include -#include -#include "CaptionMenu.h" -#include "gui_templates.h" #include "embed.h" -#include "LedCheckbox.h" -#include "MainWindow.h" #include "ToolTip.h" @@ -244,6 +236,9 @@ void LfoControllerDialog::contextMenuEvent( QContextMenuEvent * ) /* QPointer contextMenu = new captionMenu( getEffect()->publicName() ); + // ^ if this ever gets activated again: + // a47a36c86e4473af862df58d2b59f6cb8620b9ee says that publicName + // should be replaced by Model::displayName contextMenu->addAction( embed::getIconPixmap( "arp_up_on" ), tr( "Move &up" ), this, SLOT( moveUp() ) ); diff --git a/src/gui/LmmsStyle.cpp b/src/gui/LmmsStyle.cpp index 5d1b29945..2882b9572 100644 --- a/src/gui/LmmsStyle.cpp +++ b/src/gui/LmmsStyle.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -115,7 +114,7 @@ void drawPath( QPainter *p, const QPainterPath &path, p->setOpacity(0.5); - // highlight (bb) + // highlight (pattern) if (dark) p->strokePath(path, QPen(borderCol.lighter(133), 2)); else diff --git a/src/gui/Lv2ViewBase.cpp b/src/gui/Lv2ViewBase.cpp index 5dedc5b13..1ae12beed 100644 --- a/src/gui/Lv2ViewBase.cpp +++ b/src/gui/Lv2ViewBase.cpp @@ -27,11 +27,11 @@ #ifdef LMMS_HAVE_LV2 #include -#include -#include #include #include +#include #include +#include #include "AudioEngine.h" #include "Controls.h" @@ -39,7 +39,6 @@ #include "GuiApplication.h" #include "embed.h" #include "gui_templates.h" -#include "LedCheckbox.h" #include "Lv2ControlBase.h" #include "Lv2Manager.h" #include "Lv2Proc.h" @@ -102,18 +101,22 @@ Lv2ViewProc::Lv2ViewProc(QWidget* parent, Lv2Proc* ctrlBase, int colNum) : ctrlBase->foreach_port( [this, &commentUri](const Lv2Ports::PortBase* port) { - SetupWidget setup; - setup.m_par = this; - setup.m_commentUri = commentUri.get(); - port->accept(setup); - - if (setup.m_control) + if(!lilv_port_has_property(port->m_plugin, port->m_port, + uri(LV2_PORT_PROPS__notOnGUI).get())) { - addControl(setup.m_control, - lilv_node_as_string(lilv_port_get_symbol( - port->m_plugin, port->m_port)), - port->name().toUtf8().data(), - false); + SetupWidget setup; + setup.m_par = this; + setup.m_commentUri = commentUri.get(); + port->accept(setup); + + if (setup.m_control) + { + addControl(setup.m_control, + lilv_node_as_string(lilv_port_get_symbol( + port->m_plugin, port->m_port)), + port->name().toUtf8().data(), + false); + } } }); } diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index f3ac68aae..40ff4c055 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -32,16 +32,12 @@ #include #include #include -#include #include #include #include -#include #include "AboutDialog.h" -#include "AudioDummy.h" #include "AutomationEditor.h" -#include "BBEditor.h" #include "ControllerRackView.h" #include "embed.h" #include "Engine.h" @@ -54,6 +50,7 @@ #include "InstrumentTrackView.h" #include "InstrumentTrackWindow.h" #include "MicrotunerConfig.h" +#include "PatternEditor.h" #include "PianoRoll.h" #include "PianoView.h" #include "PluginBrowser.h" @@ -67,6 +64,7 @@ #include "SetupDialog.h" #include "SideBar.h" #include "SongEditor.h" +#include "SubWindow.h" #include "TemplatesMenu.h" #include "TextFloat.h" #include "TimeLineWidget.h" @@ -500,13 +498,12 @@ void MainWindow::finalize() song_editor_window->setShortcut( Qt::CTRL + Qt::Key_1 ); - ToolButton * bb_editor_window = new ToolButton( - embed::getIconPixmap( "bb_track_btn" ), - tr( "Beat+Bassline Editor" ) + - " (Ctrl+2)", - this, SLOT( toggleBBEditorWin() ), - m_toolBar ); - bb_editor_window->setShortcut( Qt::CTRL + Qt::Key_2 ); + ToolButton* pattern_editor_window = new ToolButton( + embed::getIconPixmap("pattern_track_btn"), + tr("Pattern Editor") + " (Ctrl+2)", + this, SLOT(togglePatternEditorWin()), + m_toolBar); + pattern_editor_window->setShortcut(Qt::CTRL + Qt::Key_2); ToolButton * piano_roll_window = new ToolButton( @@ -558,7 +555,7 @@ void MainWindow::finalize() microtuner_window->setShortcut( Qt::CTRL + Qt::Key_8 ); m_toolBarLayout->addWidget( song_editor_window, 1, 1 ); - m_toolBarLayout->addWidget( bb_editor_window, 1, 2 ); + m_toolBarLayout->addWidget( pattern_editor_window, 1, 2 ); m_toolBarLayout->addWidget( piano_roll_window, 1, 3 ); m_toolBarLayout->addWidget( automation_editor_window, 1, 4 ); m_toolBarLayout->addWidget( mixer_window, 1, 5 ); @@ -589,7 +586,7 @@ void MainWindow::finalize() // Add editor subwindows for (QWidget* widget : std::list{ getGUI()->automationEditor(), - getGUI()->getBBEditor(), + getGUI()->patternEditor(), getGUI()->pianoRoll(), getGUI()->songEditor() }) @@ -601,8 +598,8 @@ void MainWindow::finalize() } getGUI()->automationEditor()->parentWidget()->hide(); - getGUI()->getBBEditor()->parentWidget()->move( 610, 5 ); - getGUI()->getBBEditor()->parentWidget()->hide(); + getGUI()->patternEditor()->parentWidget()->move(610, 5); + getGUI()->patternEditor()->parentWidget()->hide(); getGUI()->pianoRoll()->parentWidget()->move(5, 5); getGUI()->pianoRoll()->parentWidget()->hide(); getGUI()->songEditor()->parentWidget()->move(5, 5); @@ -1056,7 +1053,7 @@ void MainWindow::refocus() QList editors; editors << getGUI()->songEditor()->parentWidget() - << getGUI()->getBBEditor()->parentWidget() + << getGUI()->patternEditor()->parentWidget() << getGUI()->pianoRoll()->parentWidget() << getGUI()->automationEditor()->parentWidget(); @@ -1078,9 +1075,9 @@ void MainWindow::refocus() -void MainWindow::toggleBBEditorWin( bool forceShow ) +void MainWindow::togglePatternEditorWin( bool forceShow ) { - toggleWindow( getGUI()->getBBEditor(), forceShow ); + toggleWindow( getGUI()->patternEditor(), forceShow ); } @@ -1143,9 +1140,9 @@ void MainWindow::updateViewMenu() tr( "Song Editor" ) + "\tCtrl+1", this, SLOT( toggleSongEditorWin() ) ); - m_viewMenu->addAction(embed::getIconPixmap( "bb_track" ), - tr( "Beat+Bassline Editor" ) + "\tCtrl+2", - this, SLOT( toggleBBEditorWin() ) + m_viewMenu->addAction(embed::getIconPixmap("pattern_track"), + tr("Pattern Editor") + "\tCtrl+2", + this, SLOT(togglePatternEditorWin()) ); m_viewMenu->addAction(embed::getIconPixmap( "piano" ), tr( "Piano Roll" ) + "\tCtrl+3", @@ -1279,7 +1276,7 @@ void MainWindow::updatePlayPauseIcons() { getGUI()->songEditor()->setPauseIcon( false ); getGUI()->automationEditor()->setPauseIcon( false ); - getGUI()->getBBEditor()->setPauseIcon( false ); + getGUI()->patternEditor()->setPauseIcon( false ); getGUI()->pianoRoll()->setPauseIcon( false ); if( Engine::getSong()->isPlaying() ) @@ -1294,8 +1291,8 @@ void MainWindow::updatePlayPauseIcons() getGUI()->automationEditor()->setPauseIcon( true ); break; - case Song::Mode_PlayBB: - getGUI()->getBBEditor()->setPauseIcon( true ); + case Song::Mode_PlayPattern: + getGUI()->patternEditor()->setPauseIcon( true ); break; case Song::Mode_PlayMidiClip: diff --git a/src/gui/MidiCCRackView.cpp b/src/gui/MidiCCRackView.cpp index a77cceede..f7bf98e81 100644 --- a/src/gui/MidiCCRackView.cpp +++ b/src/gui/MidiCCRackView.cpp @@ -26,7 +26,6 @@ #include "MidiCCRackView.h" #include -#include #include #include #include @@ -37,7 +36,7 @@ #include "InstrumentTrack.h" #include "Knob.h" #include "MainWindow.h" -#include "Track.h" +#include "SubWindow.h" MidiCCRackView::MidiCCRackView(InstrumentTrack * track) : diff --git a/src/gui/MidiClipView.cpp b/src/gui/MidiClipView.cpp index 913c8df67..12ed7eea7 100644 --- a/src/gui/MidiClipView.cpp +++ b/src/gui/MidiClipView.cpp @@ -25,15 +25,18 @@ #include "MidiClipView.h" +#include #include #include +#include #include "ConfigManager.h" #include "DeprecationHelper.h" #include "GuiApplication.h" -#include "InstrumentTrack.h" +#include "MidiClip.h" #include "PianoRoll.h" #include "RenameDialog.h" +#include "ToolTip.h" MidiClipView::MidiClipView( MidiClip* clip, TrackView* parent ) : ClipView( clip, parent ), @@ -43,7 +46,8 @@ MidiClipView::MidiClipView( MidiClip* clip, TrackView* parent ) : m_noteBorderColor(255, 255, 255, 220), m_mutedNoteFillColor(100, 100, 100, 220), m_mutedNoteBorderColor(100, 100, 100, 220), - m_legacySEBB(ConfigManager::inst()->value("ui","legacysebb","0").toInt()) + // TODO if this option is ever added to the GUI, rename it to legacysepattern + m_legacySEPattern(ConfigManager::inst()->value("ui", "legacysebb", "0").toInt()) { connect( getGUI()->pianoRoll(), SIGNAL( currentMidiClipChanged() ), this, SLOT( update() ) ); @@ -182,18 +186,18 @@ void MidiClipView::constructContextMenu( QMenu * _cm ) void MidiClipView::mousePressEvent( QMouseEvent * _me ) { - bool displayBB = fixedClips() || (pixelsPerBar() >= 96 && m_legacySEBB); + bool displayPattern = fixedClips() || (pixelsPerBar() >= 96 && m_legacySEPattern); if( _me->button() == Qt::LeftButton && m_clip->m_clipType == MidiClip::BeatClip && - displayBB && _me->y() > height() - s_stepBtnOff->height() ) + displayPattern && _me->y() > height() - s_stepBtnOff->height() ) - // when mouse button is pressed in beat/bassline -mode + // when mouse button is pressed in pattern mode { // get the step number that was clicked on and // do calculations in floats to prevent rounding errors... - float tmp = ( ( float(_me->x()) - CLIP_BORDER_WIDTH ) * - float( m_clip -> m_steps ) ) / float(width() - CLIP_BORDER_WIDTH*2); + float tmp = ( ( float(_me->x()) - BORDER_WIDTH ) * + float( m_clip -> m_steps ) ) / float(width() - BORDER_WIDTH*2); int step = int( tmp ); @@ -228,7 +232,7 @@ void MidiClipView::mousePressEvent( QMouseEvent * _me ) } else - // if not in beat/bassline -mode, let parent class handle the event + // if not in pattern mode, let parent class handle the event { ClipView::mousePressEvent( _me ); @@ -259,8 +263,8 @@ void MidiClipView::wheelEvent(QWheelEvent * we) { // get the step number that was wheeled on and // do calculations in floats to prevent rounding errors... - float tmp = ((float(position(we).x()) - CLIP_BORDER_WIDTH) * - float(m_clip -> m_steps)) / float(width() - CLIP_BORDER_WIDTH*2); + float tmp = ((float(position(we).x()) - BORDER_WIDTH) * + float(m_clip -> m_steps)) / float(width() - BORDER_WIDTH*2); int step = int( tmp ); @@ -335,8 +339,8 @@ void MidiClipView::paintEvent( QPaintEvent * ) if( beatClip ) { - // Do not paint BBClips how we paint MidiClips - c = BBClipBackground(); + // Do not paint PatternClips how we paint MidiClips + c = patternClipBackground(); } else { @@ -367,7 +371,7 @@ void MidiClipView::paintEvent( QPaintEvent * ) // TODO Warning! This might cause problems if ClipView::paintTextLabel changes int textBoxHeight = 0; - const int textTop = CLIP_BORDER_WIDTH + 1; + const int textTop = BORDER_WIDTH + 1; if (drawTextBox) { QFont labelFont = this->font(); @@ -378,17 +382,17 @@ void MidiClipView::paintEvent( QPaintEvent * ) } // Compute pixels per bar - const int baseWidth = fixedClips() ? parentWidget()->width() - 2 * CLIP_BORDER_WIDTH - : width() - CLIP_BORDER_WIDTH; + const int baseWidth = fixedClips() ? parentWidget()->width() - 2 * BORDER_WIDTH + : width() - BORDER_WIDTH; const float pixelsPerBar = baseWidth / (float) m_clip->length().getBar(); // Length of one bar/beat in the [0,1] x [0,1] coordinate system const float barLength = 1. / m_clip->length().getBar(); const float tickLength = barLength / TimePos::ticksPerBar(); - const int x_base = CLIP_BORDER_WIDTH; + const int x_base = BORDER_WIDTH; - bool displayBB = fixedClips() || (pixelsPerBar >= 96 && m_legacySEBB); + bool displayPattern = fixedClips() || (pixelsPerBar >= 96 && m_legacySEPattern); // melody clip paint event NoteVector const & noteCollection = m_clip->m_notes; if( m_clip->m_clipType == MidiClip::MelodyClip && !noteCollection.empty() ) @@ -505,7 +509,7 @@ void MidiClipView::paintEvent( QPaintEvent * ) p.restore(); } // beat clip paint event - else if( beatClip && displayBB ) + else if (beatClip && displayPattern) { QPixmap stepon0; QPixmap stepon200; @@ -513,7 +517,7 @@ void MidiClipView::paintEvent( QPaintEvent * ) QPixmap stepoffl; const int steps = qMax( 1, m_clip->m_steps ); - const int w = width() - 2 * CLIP_BORDER_WIDTH; + const int w = width() - 2 * BORDER_WIDTH; // scale step graphics to fit the beat clip length stepon0 = s_stepBtnOn0->scaled( w / steps, @@ -538,7 +542,7 @@ void MidiClipView::paintEvent( QPaintEvent * ) Note * n = m_clip->noteAtStep( it ); // figure out x and y coordinates for step graphic - const int x = CLIP_BORDER_WIDTH + static_cast( it * w / steps ); + const int x = BORDER_WIDTH + static_cast( it * w / steps ); const int y = height() - s_stepBtnOff->height() - 1; if( n ) @@ -576,12 +580,12 @@ void MidiClipView::paintEvent( QPaintEvent * ) for( bar_t t = 1; t < m_clip->length().getBar(); ++t ) { p.drawLine( x_base + static_cast( pixelsPerBar * t ) - 1, - CLIP_BORDER_WIDTH, x_base + static_cast( - pixelsPerBar * t ) - 1, CLIP_BORDER_WIDTH + lineSize ); + BORDER_WIDTH, x_base + static_cast( + pixelsPerBar * t ) - 1, BORDER_WIDTH + lineSize ); p.drawLine( x_base + static_cast( pixelsPerBar * t ) - 1, - rect().bottom() - ( lineSize + CLIP_BORDER_WIDTH ), + rect().bottom() - ( lineSize + BORDER_WIDTH ), x_base + static_cast( pixelsPerBar * t ) - 1, - rect().bottom() - CLIP_BORDER_WIDTH ); + rect().bottom() - BORDER_WIDTH ); } // clip name @@ -594,8 +598,8 @@ void MidiClipView::paintEvent( QPaintEvent * ) { // inner border p.setPen( c.lighter( current ? 160 : 130 ) ); - p.drawRect( 1, 1, rect().right() - CLIP_BORDER_WIDTH, - rect().bottom() - CLIP_BORDER_WIDTH ); + p.drawRect( 1, 1, rect().right() - BORDER_WIDTH, + rect().bottom() - BORDER_WIDTH ); // outer border p.setPen( current ? c.lighter( 130 ) : c.darker( 300 ) ); @@ -605,7 +609,7 @@ void MidiClipView::paintEvent( QPaintEvent * ) // draw the 'muted' pixmap only if the clip was manually muted if( m_clip->isMuted() ) { - const int spacing = CLIP_BORDER_WIDTH; + const int spacing = BORDER_WIDTH; const int size = 14; p.drawPixmap( spacing, height() - ( size + spacing ), embed::getIconPixmap( "muted", size, size ) ); diff --git a/src/gui/MidiSetupWidget.cpp b/src/gui/MidiSetupWidget.cpp index 834207057..7298eb558 100644 --- a/src/gui/MidiSetupWidget.cpp +++ b/src/gui/MidiSetupWidget.cpp @@ -24,6 +24,7 @@ #include "MidiSetupWidget.h" +#include #include #include "ConfigManager.h" diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 2cae9ad6f..502461b7d 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -22,15 +22,8 @@ * */ -#include -#include -#include -#include #include -#include -#include -#include #include #include #include @@ -45,11 +38,12 @@ #include "GuiApplication.h" #include "MainWindow.h" #include "AudioEngine.h" -#include "gui_templates.h" #include "InstrumentTrack.h" +#include "PatternStore.h" #include "SampleTrack.h" +#include "SendButtonIndicator.h" #include "Song.h" -#include "BBTrackContainer.h" +#include "SubWindow.h" #include "TrackContainer.h" // For TrackContainer::TrackList typedef MixerView::MixerView() : @@ -238,10 +232,10 @@ void MixerView::refreshDisplay() // update the and max. channel number for every instrument void MixerView::updateMaxChannelSelector() { - TrackContainer::TrackList songTrackList = Engine::getSong()->tracks(); - TrackContainer::TrackList bbTrackList = Engine::getBBTrackContainer()->tracks(); + TrackContainer::TrackList songTracks = Engine::getSong()->tracks(); + TrackContainer::TrackList patternStoreTracks = Engine::patternStore()->tracks(); - TrackContainer::TrackList trackLists[] = {songTrackList, bbTrackList}; + TrackContainer::TrackList trackLists[] = {songTracks, patternStoreTracks}; for(int tl=0; tl<2; ++tl) { TrackContainer::TrackList trackList = trackLists[tl]; @@ -435,7 +429,7 @@ void MixerView::deleteUnusedChannels() { TrackContainer::TrackList tracks; tracks += Engine::getSong()->tracks(); - tracks += Engine::getBBTrackContainer()->tracks(); + tracks += Engine::patternStore()->tracks(); std::vector inUse(m_mixerChannelViews.size(), false); diff --git a/src/gui/BBClipView.cpp b/src/gui/PatternClipView.cpp similarity index 66% rename from src/gui/BBClipView.cpp rename to src/gui/PatternClipView.cpp index d0e832526..30d2096e7 100644 --- a/src/gui/BBClipView.cpp +++ b/src/gui/PatternClipView.cpp @@ -1,5 +1,5 @@ /* - * BBClipView.cpp + * PatternClipView.cpp * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -22,23 +22,23 @@ * */ -#include "BBClipView.h" +#include "PatternClipView.h" +#include #include #include -#include "BBEditor.h" -#include "BBTrackContainer.h" -#include "gui_templates.h" +#include "Engine.h" #include "GuiApplication.h" #include "MainWindow.h" +#include "PatternClip.h" +#include "PatternStore.h" #include "RenameDialog.h" -#include "Song.h" #include "ToolTip.h" -BBClipView::BBClipView( Clip * _clip, TrackView * _tv ) : +PatternClipView::PatternClipView(Clip* _clip, TrackView* _tv) : ClipView( _clip, _tv ), - m_bbClip( dynamic_cast( _clip ) ), + m_patternClip(dynamic_cast(_clip)), m_paintPixmap() { connect( _clip->getTrack(), SIGNAL( dataChanged() ), @@ -47,14 +47,14 @@ BBClipView::BBClipView( Clip * _clip, TrackView * _tv ) : setStyle( QApplication::style() ); } -void BBClipView::constructContextMenu( QMenu * _cm ) +void PatternClipView::constructContextMenu(QMenu* _cm) { - QAction * a = new QAction( embed::getIconPixmap( "bb_track" ), - tr( "Open in Beat+Bassline-Editor" ), + QAction* a = new QAction(embed::getIconPixmap("pattern_track"), + tr("Open in Pattern Editor"), _cm ); _cm->insertAction( _cm->actions()[0], a ); connect( a, SIGNAL( triggered( bool ) ), - this, SLOT( openInBBEditor() ) ); + this, SLOT( openInPatternEditor() ) ); _cm->insertSeparator( _cm->actions()[1] ); _cm->addSeparator(); _cm->addAction( embed::getIconPixmap( "reload" ), tr( "Reset name" ), @@ -67,15 +67,15 @@ void BBClipView::constructContextMenu( QMenu * _cm ) -void BBClipView::mouseDoubleClickEvent( QMouseEvent * ) +void PatternClipView::mouseDoubleClickEvent(QMouseEvent*) { - openInBBEditor(); + openInPatternEditor(); } -void BBClipView::paintEvent( QPaintEvent * ) +void PatternClipView::paintEvent(QPaintEvent*) { QPainter painter( this ); @@ -116,35 +116,35 @@ void BBClipView::paintEvent( QPaintEvent * ) const int lineSize = 3; p.setPen( c.darker( 200 ) ); - bar_t t = Engine::getBBTrackContainer()->lengthOfBB( m_bbClip->bbTrackIndex() ); - if( m_bbClip->length() > TimePos::ticksPerBar() && t > 0 ) + bar_t t = Engine::patternStore()->lengthOfPattern(m_patternClip->patternIndex()); + if (m_patternClip->length() > TimePos::ticksPerBar() && t > 0) { for( int x = static_cast( t * pixelsPerBar() ); x < width() - 2; x += static_cast( t * pixelsPerBar() ) ) { - p.drawLine( x, CLIP_BORDER_WIDTH, x, CLIP_BORDER_WIDTH + lineSize ); - p.drawLine( x, rect().bottom() - ( CLIP_BORDER_WIDTH + lineSize ), - x, rect().bottom() - CLIP_BORDER_WIDTH ); + p.drawLine( x, BORDER_WIDTH, x, BORDER_WIDTH + lineSize ); + p.drawLine( x, rect().bottom() - ( BORDER_WIDTH + lineSize ), + x, rect().bottom() - BORDER_WIDTH ); } } // clip name - paintTextLabel(m_bbClip->name(), p); + paintTextLabel(m_patternClip->name(), p); // inner border p.setPen( c.lighter( 130 ) ); - p.drawRect( 1, 1, rect().right() - CLIP_BORDER_WIDTH, - rect().bottom() - CLIP_BORDER_WIDTH ); + p.drawRect( 1, 1, rect().right() - BORDER_WIDTH, + rect().bottom() - BORDER_WIDTH ); // outer border p.setPen( c.darker( 300 ) ); p.drawRect( 0, 0, rect().right(), rect().bottom() ); // draw the 'muted' pixmap only if the clip was manualy muted - if( m_bbClip->isMuted() ) + if (m_patternClip->isMuted()) { - const int spacing = CLIP_BORDER_WIDTH; + const int spacing = BORDER_WIDTH; const int size = 14; p.drawPixmap( spacing, height() - ( size + spacing ), embed::getIconPixmap( "muted", size, size ) ); @@ -158,34 +158,34 @@ void BBClipView::paintEvent( QPaintEvent * ) -void BBClipView::openInBBEditor() +void PatternClipView::openInPatternEditor() { - Engine::getBBTrackContainer()->setCurrentBB( m_bbClip->bbTrackIndex() ); + Engine::patternStore()->setCurrentPattern(m_patternClip->patternIndex()); - getGUI()->mainWindow()->toggleBBEditorWin( true ); + getGUI()->mainWindow()->togglePatternEditorWin(true); } -void BBClipView::resetName() { m_bbClip->setName(""); } +void PatternClipView::resetName() { m_patternClip->setName(""); } -void BBClipView::changeName() +void PatternClipView::changeName() { - QString s = m_bbClip->name(); + QString s = m_patternClip->name(); RenameDialog rename_dlg( s ); rename_dlg.exec(); - m_bbClip->setName( s ); + m_patternClip->setName(s); } -void BBClipView::update() +void PatternClipView::update() { - ToolTip::add(this, m_bbClip->name()); + ToolTip::add(this, m_patternClip->name()); ClipView::update(); -} \ No newline at end of file +} diff --git a/src/gui/BBTrackView.cpp b/src/gui/PatternTrackView.cpp similarity index 57% rename from src/gui/BBTrackView.cpp rename to src/gui/PatternTrackView.cpp index 8bec7e8ef..7571cd1db 100644 --- a/src/gui/BBTrackView.cpp +++ b/src/gui/PatternTrackView.cpp @@ -1,5 +1,5 @@ /* - * BBTrackView.cpp + * PatternTrackView.cpp * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -22,55 +22,55 @@ * */ -#include "BBTrackView.h" +#include "PatternTrackView.h" -#include "BBEditor.h" -#include "BBTrackContainer.h" #include "Engine.h" #include "GuiApplication.h" +#include "PatternEditor.h" +#include "PatternStore.h" +#include "PatternTrack.h" #include "TrackLabelButton.h" -BBTrackView::BBTrackView( BBTrack * _bbt, TrackContainerView* tcv ) : - TrackView( _bbt, tcv ), - m_bbTrack( _bbt ) +PatternTrackView::PatternTrackView(PatternTrack* pt, TrackContainerView* tcv) : + TrackView(pt, tcv), + m_patternTrack(pt) { setFixedHeight( 32 ); - // drag'n'drop with bb-tracks only causes troubles (and makes no sense - // too), so disable it + // drag'n'drop with pattern tracks only causes troubles (and makes no sense too), so disable it setAcceptDrops( false ); m_trackLabel = new TrackLabelButton( this, getTrackSettingsWidget() ); - m_trackLabel->setIcon( embed::getIconPixmap( "bb_track" ) ); + m_trackLabel->setIcon( embed::getIconPixmap("pattern_track")); m_trackLabel->move( 3, 1 ); m_trackLabel->show(); connect( m_trackLabel, SIGNAL( clicked( bool ) ), this, SLOT( clickedTrackLabel() ) ); - setModel( _bbt ); + setModel(pt); } -BBTrackView::~BBTrackView() +PatternTrackView::~PatternTrackView() { - getGUI()->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] ); + getGUI()->patternEditor()->m_editor->removeViewsForPattern(PatternTrack::s_infoMap[m_patternTrack]); } -bool BBTrackView::close() +bool PatternTrackView::close() { - getGUI()->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] ); + getGUI()->patternEditor()->m_editor->removeViewsForPattern(PatternTrack::s_infoMap[m_patternTrack]); return TrackView::close(); } -void BBTrackView::clickedTrackLabel() +void PatternTrackView::clickedTrackLabel() { - Engine::getBBTrackContainer()->setCurrentBB( m_bbTrack->index() ); - getGUI()->getBBEditor()->parentWidget()->show(); - getGUI()->getBBEditor()->setFocus( Qt::ActiveWindowFocusReason ); -} \ No newline at end of file + Engine::patternStore()->setCurrentPattern(m_patternTrack->patternIndex()); + getGUI()->patternEditor()->parentWidget()->show(); + getGUI()->patternEditor()->setFocus(Qt::ActiveWindowFocusReason); +} diff --git a/src/gui/PeakControllerDialog.cpp b/src/gui/PeakControllerDialog.cpp index 48f0a93da..6f95f1a84 100644 --- a/src/gui/PeakControllerDialog.cpp +++ b/src/gui/PeakControllerDialog.cpp @@ -25,19 +25,13 @@ #include -#include -#include #include +#include -#include "CaptionMenu.h" -#include "gui_templates.h" #include "embed.h" -#include "MainWindow.h" #include "ToolTip.h" #include "PeakController.h" -#include "Knob.h" -#include "TempoSyncKnob.h" PeakControllerDialog::PeakControllerDialog( Controller * _model, QWidget * _parent ) : diff --git a/src/gui/PianoView.cpp b/src/gui/PianoView.cpp index 8771e0588..78962d938 100644 --- a/src/gui/PianoView.cpp +++ b/src/gui/PianoView.cpp @@ -44,6 +44,7 @@ #include #include +#include "AutomatableModelView.h" #include "PianoView.h" #include "Piano.h" #include "CaptionMenu.h" @@ -51,10 +52,8 @@ #include "Engine.h" #include "gui_templates.h" #include "InstrumentTrack.h" -#include "Knob.h" #include "Song.h" #include "StringPairDrag.h" -#include "MainWindow.h" /*! The scale of C Major - white keys only. diff --git a/src/gui/PluginBrowser.cpp b/src/gui/PluginBrowser.cpp index 0f8a07f78..649d6bb56 100644 --- a/src/gui/PluginBrowser.cpp +++ b/src/gui/PluginBrowser.cpp @@ -34,7 +34,6 @@ #include "embed.h" #include "Engine.h" -#include "gui_templates.h" #include "StringPairDrag.h" #include "PluginFactory.h" @@ -55,8 +54,8 @@ PluginBrowser::PluginBrowser( QWidget * _parent ) : auto hint = new QLabel( tr( "Drag an instrument " - "into either the Song-Editor, the " - "Beat+Bassline Editor or into an " + "into either the Song Editor, the " + "Pattern Editor or into an " "existing instrument track." ), m_view ); hint->setWordWrap( true ); diff --git a/src/gui/SampleClipView.cpp b/src/gui/SampleClipView.cpp index 04f3adf55..aff412120 100644 --- a/src/gui/SampleClipView.cpp +++ b/src/gui/SampleClipView.cpp @@ -24,12 +24,14 @@ #include "SampleClipView.h" +#include #include #include #include "embed.h" -#include "gui_templates.h" #include "PathUtil.h" +#include "SampleBuffer.h" +#include "SampleClip.h" #include "Song.h" #include "StringPairDrag.h" #include "ToolTip.h" @@ -245,9 +247,9 @@ void SampleClipView::paintEvent( QPaintEvent * pe ) p.setPen(p.pen().brush().color().darker(150)); } - const int spacing = CLIP_BORDER_WIDTH + 1; + const int spacing = BORDER_WIDTH + 1; const float ppb = fixedClips() ? - ( parentWidget()->width() - 2 * CLIP_BORDER_WIDTH ) + ( parentWidget()->width() - 2 * BORDER_WIDTH ) / (float) m_clip->length().getBar() : pixelsPerBar(); @@ -268,8 +270,8 @@ void SampleClipView::paintEvent( QPaintEvent * pe ) // inner border p.setPen( c.lighter( 135 ) ); - p.drawRect( 1, 1, rect().right() - CLIP_BORDER_WIDTH, - rect().bottom() - CLIP_BORDER_WIDTH ); + p.drawRect( 1, 1, rect().right() - BORDER_WIDTH, + rect().bottom() - BORDER_WIDTH ); // outer border p.setPen( c.darker( 200 ) ); @@ -278,7 +280,7 @@ void SampleClipView::paintEvent( QPaintEvent * pe ) // draw the 'muted' pixmap only if the clip was manualy muted if( m_clip->isMuted() ) { - const int spacing = CLIP_BORDER_WIDTH; + const int spacing = BORDER_WIDTH; const int size = 14; p.drawPixmap( spacing, height() - ( size + spacing ), embed::getIconPixmap( "muted", size, size ) ); @@ -349,4 +351,4 @@ bool SampleClipView::splitClip( const TimePos pos ) return true; } else { return false; } -} \ No newline at end of file +} diff --git a/src/gui/SampleTrackView.cpp b/src/gui/SampleTrackView.cpp index afa714518..a73724911 100644 --- a/src/gui/SampleTrackView.cpp +++ b/src/gui/SampleTrackView.cpp @@ -24,15 +24,18 @@ #include "SampleTrackView.h" +#include #include +#include "ConfigManager.h" #include "embed.h" #include "Engine.h" +#include "FadeButton.h" +#include "Mixer.h" #include "MixerView.h" -#include "gui_templates.h" #include "GuiApplication.h" #include "Knob.h" -#include "MainWindow.h" +#include "SampleClip.h" #include "SampleTrackWindow.h" #include "StringPairDrag.h" #include "TrackContainerView.h" @@ -228,4 +231,4 @@ void SampleTrackView::assignMixerLine(int channelIndex) model()->mixerChannelModel()->setValue(channelIndex); getGUI()->mixerView()->setCurrentMixerLine(channelIndex); -} \ No newline at end of file +} diff --git a/src/gui/SampleTrackWindow.cpp b/src/gui/SampleTrackWindow.cpp index 87273461f..0ef22a01d 100644 --- a/src/gui/SampleTrackWindow.cpp +++ b/src/gui/SampleTrackWindow.cpp @@ -25,14 +25,22 @@ #include "SampleTrackWindow.h" #include +#include +#include +#include #include +#include +#include "EffectRackView.h" #include "embed.h" #include "gui_templates.h" #include "GuiApplication.h" #include "Knob.h" #include "MainWindow.h" +#include "MixerLineLcdSpinBox.h" +#include "SampleTrackView.h" #include "Song.h" +#include "SubWindow.h" #include "TabWidget.h" #include "TrackLabelButton.h" @@ -262,4 +270,4 @@ void SampleTrackWindow::loadSettings(const QDomElement& element) { m_stv->m_tlb->setChecked(true); } -} \ No newline at end of file +} diff --git a/src/gui/SetupDialog.cpp b/src/gui/SetupDialog.cpp index 737fcfca2..50b92befa 100644 --- a/src/gui/SetupDialog.cpp +++ b/src/gui/SetupDialog.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include "AudioDeviceSetupWidget.h" diff --git a/src/gui/SubWindow.cpp b/src/gui/SubWindow.cpp index 5cbac4cd6..df3fe0047 100644 --- a/src/gui/SubWindow.cpp +++ b/src/gui/SubWindow.cpp @@ -28,10 +28,12 @@ #include "SubWindow.h" +#include +#include #include #include #include -#include +#include #include "embed.h" diff --git a/src/gui/TimeLineWidget.cpp b/src/gui/TimeLineWidget.cpp index cf7cbd826..e4a4ba711 100644 --- a/src/gui/TimeLineWidget.cpp +++ b/src/gui/TimeLineWidget.cpp @@ -25,8 +25,6 @@ #include #include -#include -#include #include #include #include @@ -37,7 +35,6 @@ #include "NStateButton.h" #include "GuiApplication.h" #include "TextFloat.h" -#include "SongEditor.h" QPixmap * TimeLineWidget::s_posMarkerPixmap = nullptr; diff --git a/src/gui/TrackContainerView.cpp b/src/gui/TrackContainerView.cpp index 7201427be..04034074e 100644 --- a/src/gui/TrackContainerView.cpp +++ b/src/gui/TrackContainerView.cpp @@ -24,25 +24,23 @@ #include "TrackContainerView.h" -#include -#include #include -#include #include #include #include "TrackContainer.h" #include "AudioEngine.h" -#include "BBTrack.h" #include "DataFile.h" #include "MainWindow.h" #include "FileBrowser.h" #include "ImportFilter.h" #include "Instrument.h" #include "InstrumentTrack.h" +#include "PatternTrack.h" #include "Song.h" #include "StringPairDrag.h" +#include "TrackView.h" #include "GuiApplication.h" #include "PluginFactory.h" @@ -165,7 +163,7 @@ void TrackContainerView::moveTrackView( TrackView * trackView, int indexTo ) int indexFrom = m_trackViews.indexOf( trackView ); if ( indexFrom == indexTo ) { return; } - BBTrack::swapBBTracks( trackView->getTrack(), + PatternTrack::swapPatternTracks( trackView->getTrack(), m_trackViews[indexTo]->getTrack() ); m_scrollLayout->removeWidget( trackView ); @@ -471,7 +469,7 @@ TrackContainerView::scrollArea::~scrollArea() void TrackContainerView::scrollArea::wheelEvent( QWheelEvent * _we ) { // always pass wheel-event to parent-widget (song-editor - // bb-editor etc.) because they might want to use it for zooming + // pattern-editor etc.) because they might want to use it for zooming // or scrolling left/right if a modifier-key is pressed, otherwise // they do not accept it and we pass it up to QScrollArea m_trackContainerView->wheelEvent( _we ); diff --git a/src/gui/TrackView.cpp b/src/gui/TrackView.cpp index ba5c17b7a..85c33e8c9 100644 --- a/src/gui/TrackView.cpp +++ b/src/gui/TrackView.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/src/gui/dialogs/FileDialog.cpp b/src/gui/dialogs/FileDialog.cpp index 848a7f52a..79f1ca5e0 100644 --- a/src/gui/dialogs/FileDialog.cpp +++ b/src/gui/dialogs/FileDialog.cpp @@ -24,8 +24,8 @@ #include #include -#include #include +#include #include "ConfigManager.h" #include "FileDialog.h" diff --git a/src/gui/dialogs/VersionedSaveDialog.cpp b/src/gui/dialogs/VersionedSaveDialog.cpp index b9b229b1c..b471d8766 100644 --- a/src/gui/dialogs/VersionedSaveDialog.cpp +++ b/src/gui/dialogs/VersionedSaveDialog.cpp @@ -23,13 +23,11 @@ */ -#include #include #include #include #include #include -#include #include "DeprecationHelper.h" #include "VersionedSaveDialog.h" diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index ce32d6b25..19de943f5 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -30,10 +30,9 @@ #include #include +#include #include #include -#include -#include #include #include #include @@ -46,7 +45,6 @@ #include "ActionGroup.h" #include "AutomationNode.h" -#include "BBTrackContainer.h" #include "ComboBox.h" #include "debug.h" #include "DeprecationHelper.h" @@ -54,10 +52,11 @@ #include "Engine.h" #include "GuiApplication.h" #include "gui_templates.h" +#include "Knob.h" #include "MainWindow.h" +#include "PatternStore.h" #include "PianoRoll.h" #include "ProjectJournal.h" -#include "SongEditor.h" #include "StringPairDrag.h" #include "TextFloat.h" #include "TimeLineWidget.h" @@ -1508,10 +1507,9 @@ float AutomationEditor::getLevel(int y ) -inline bool AutomationEditor::inBBEditor() +inline bool AutomationEditor::inPatternEditor() { - return( validClip() && - m_clip->getTrack()->trackContainer() == Engine::getBBTrackContainer() ); + return (validClip() && m_clip->getTrack()->trackContainer() == Engine::patternStore()); } @@ -1540,9 +1538,9 @@ void AutomationEditor::play() Engine::getSong()->playMidiClip( getGUI()->pianoRoll()->currentMidiClip() ); } } - else if( inBBEditor() ) + else if (inPatternEditor()) { - Engine::getBBTrackContainer()->play(); + Engine::patternStore()->play(); } else { @@ -1566,9 +1564,9 @@ void AutomationEditor::stop() { return; } - if( m_clip->getTrack() && inBBEditor() ) + if (m_clip->getTrack() && inPatternEditor()) { - Engine::getBBTrackContainer()->stop(); + Engine::patternStore()->stop(); } else { diff --git a/src/gui/editors/BBEditor.cpp b/src/gui/editors/BBEditor.cpp deleted file mode 100644 index 361917b5f..000000000 --- a/src/gui/editors/BBEditor.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/* - * BBEditor.cpp - basic main-window for editing of beats and basslines - * - * Copyright (c) 2004-2008 Tobias Doerffel - * - * 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. - * - */ - -#include "BBEditor.h" - -#include -#include -#include - -#include "ComboBox.h" -#include "BBTrack.h" -#include "BBTrackContainer.h" -#include "DataFile.h" -#include "embed.h" -#include "MainWindow.h" -#include "Song.h" -#include "StringPairDrag.h" - -#include "MidiClip.h" - - - -BBEditor::BBEditor( BBTrackContainer* tc ) : - Editor(false), - m_trackContainerView( new BBTrackContainerView(tc) ) -{ - setWindowIcon( embed::getIconPixmap( "bb_track_btn" ) ); - setWindowTitle( tr( "Beat+Bassline Editor" ) ); - setCentralWidget(m_trackContainerView); - - setAcceptDrops(true); - m_toolBar->setAcceptDrops(true); - connect(m_toolBar, SIGNAL(dragEntered(QDragEnterEvent*)), m_trackContainerView, SLOT(dragEnterEvent(QDragEnterEvent*))); - connect(m_toolBar, SIGNAL(dropped(QDropEvent*)), m_trackContainerView, SLOT(dropEvent(QDropEvent*))); - - // TODO: Use style sheet - if( ConfigManager::inst()->value( "ui", - "compacttrackbuttons" ).toInt() ) - { - setMinimumWidth( TRACK_OP_WIDTH_COMPACT + DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT - + 2 * CLIP_BORDER_WIDTH + 384 ); - } - else - { - setMinimumWidth( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH - + 2 * CLIP_BORDER_WIDTH + 384 ); - } - - - m_playAction->setToolTip(tr( "Play/pause current beat/bassline (Space)" )); - m_stopAction->setToolTip(tr( "Stop playback of current beat/bassline (Space)" )); - - - // Beat selector - DropToolBar *beatSelectionToolBar = addDropToolBarToTop(tr("Beat selector")); - - m_bbComboBox = new ComboBox( m_toolBar ); - m_bbComboBox->setFixedSize( 200, ComboBox::DEFAULT_HEIGHT ); - m_bbComboBox->setModel( &tc->m_bbComboBoxModel ); - - beatSelectionToolBar->addWidget( m_bbComboBox ); - - - // Track actions - DropToolBar *trackAndStepActionsToolBar = addDropToolBarToTop(tr("Track and step actions")); - - - trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_bb_track"), tr("Add beat/bassline"), - Engine::getSong(), SLOT(addBBTrack())); - trackAndStepActionsToolBar->addAction(embed::getIconPixmap("clone_bb_track_clip"), tr("Clone beat/bassline clip"), - m_trackContainerView, SLOT(cloneClip())); - trackAndStepActionsToolBar->addAction( - embed::getIconPixmap("add_sample_track"), - tr("Add sample-track"), m_trackContainerView, - SLOT(addSampleTrack())); - trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_automation"), tr("Add automation-track"), - m_trackContainerView, SLOT(addAutomationTrack())); - - QWidget* stretch = new QWidget(m_toolBar); - stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - trackAndStepActionsToolBar->addWidget(stretch); - - - // Step actions - trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_remove"), tr("Remove steps"), - m_trackContainerView, SLOT(removeSteps())); - trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_add"), tr("Add steps"), - m_trackContainerView, SLOT( addSteps())); - trackAndStepActionsToolBar->addAction( embed::getIconPixmap( "step_btn_duplicate" ), tr( "Clone Steps" ), - m_trackContainerView, SLOT( cloneSteps() ) ); - - connect( &tc->m_bbComboBoxModel, SIGNAL( dataChanged() ), - m_trackContainerView, SLOT( updatePosition() ) ); - - - QAction* viewNext = new QAction(this); - connect(viewNext, SIGNAL(triggered()), m_bbComboBox, SLOT(selectNext())); - viewNext->setShortcut(Qt::Key_Plus); - addAction(viewNext); - - QAction* viewPrevious = new QAction(this); - connect(viewPrevious, SIGNAL(triggered()), m_bbComboBox, SLOT(selectPrevious())); - viewPrevious->setShortcut(Qt::Key_Minus); - addAction(viewPrevious); -} - - -BBEditor::~BBEditor() -{ -} - - -QSize BBEditor::sizeHint() const -{ - return {minimumWidth()+10, 300}; -} - - -void BBEditor::removeBBView( int bb ) -{ - m_trackContainerView->removeBBView(bb); -} - - -void BBEditor::play() -{ - if( Engine::getSong()->playMode() != Song::Mode_PlayBB ) - { - Engine::getSong()->playBB(); - } - else - { - Engine::getSong()->togglePause(); - } -} - - -void BBEditor::stop() -{ - Engine::getSong()->stop(); -} - - - - -BBTrackContainerView::BBTrackContainerView(BBTrackContainer* tc) : - TrackContainerView(tc), - m_bbtc(tc) -{ - setModel( tc ); -} - - - - -void BBTrackContainerView::addSteps() -{ - makeSteps( false ); -} - -void BBTrackContainerView::cloneSteps() -{ - makeSteps( true ); -} - - - - -void BBTrackContainerView::removeSteps() -{ - TrackContainer::TrackList tl = model()->tracks(); - - for( TrackContainer::TrackList::iterator it = tl.begin(); - it != tl.end(); ++it ) - { - if( ( *it )->type() == Track::InstrumentTrack ) - { - MidiClip* p = static_cast( ( *it )->getClip( m_bbtc->currentBB() ) ); - p->removeSteps(); - } - } -} - - - - -void BBTrackContainerView::addSampleTrack() -{ - (void) Track::create( Track::SampleTrack, model() ); -} - - - - -void BBTrackContainerView::addAutomationTrack() -{ - (void) Track::create( Track::AutomationTrack, model() ); -} - - - - -void BBTrackContainerView::removeBBView(int bb) -{ - for( TrackView* view : trackViews() ) - { - view->getTrackContentWidget()->removeClipView( bb ); - } -} - - - -void BBTrackContainerView::saveSettings(QDomDocument& doc, QDomElement& element) -{ - MainWindow::saveWidgetState( parentWidget(), element ); -} - -void BBTrackContainerView::loadSettings(const QDomElement& element) -{ - MainWindow::restoreWidgetState(parentWidget(), element); -} - - - - -void BBTrackContainerView::dropEvent(QDropEvent* de) -{ - QString type = StringPairDrag::decodeKey( de ); - QString value = StringPairDrag::decodeValue( de ); - - if( type.left( 6 ) == "track_" ) - { - DataFile dataFile( value.toUtf8() ); - Track * t = Track::create( dataFile.content().firstChild().toElement(), model() ); - - // Ensure BB Clips exist - bool hasValidBBClips = false; - if (t->getClips().size() == m_bbtc->numOfBBs()) - { - hasValidBBClips = true; - for (int i = 0; i < t->getClips().size(); ++i) - { - if (t->getClips()[i]->startPosition() != TimePos(i, 0)) - { - hasValidBBClips = false; - break; - } - } - } - if (!hasValidBBClips) - { - t->deleteClips(); - t->createClipsForBB(m_bbtc->numOfBBs() - 1); - } - m_bbtc->updateAfterTrackAdd(); - - de->accept(); - } - else - { - TrackContainerView::dropEvent( de ); - } -} - - - - -void BBTrackContainerView::updatePosition() -{ - //realignTracks(); - emit positionChanged( m_currentPosition ); -} - - - - -void BBTrackContainerView::makeSteps( bool clone ) -{ - TrackContainer::TrackList tl = model()->tracks(); - - for( TrackContainer::TrackList::iterator it = tl.begin(); - it != tl.end(); ++it ) - { - if( ( *it )->type() == Track::InstrumentTrack ) - { - MidiClip* p = static_cast( ( *it )->getClip( m_bbtc->currentBB() ) ); - if( clone ) - { - p->cloneSteps(); - } else - { - p->addSteps(); - } - } - } -} - -// Creates a clone of the current BB track with the same clip, but no Clips in the song editor -// TODO: Avoid repeated code from cloneTrack and clearTrack in TrackOperationsWidget somehow -void BBTrackContainerView::cloneClip() -{ - // Get the current BBTrack id - BBTrackContainer *bbtc = static_cast(model()); - const int cur_bb = bbtc->currentBB(); - - BBTrack *bbt = BBTrack::findBBTrack(cur_bb); - - if( bbt ) - { - // Clone the track - Track *newTrack = bbt->clone(); - bbtc->setCurrentBB( static_cast( newTrack )->index() ); - - // Track still have the clips which is undesirable in this case, clear the track - newTrack->lock(); - newTrack->deleteClips(); - newTrack->unlock(); - } -} diff --git a/src/gui/editors/Editor.cpp b/src/gui/editors/Editor.cpp index dc86a1789..f9ab600bf 100644 --- a/src/gui/editors/Editor.cpp +++ b/src/gui/editors/Editor.cpp @@ -26,11 +26,9 @@ #include "Song.h" -#include "MainWindow.h" #include "embed.h" #include -#include #include #include diff --git a/src/gui/editors/PatternEditor.cpp b/src/gui/editors/PatternEditor.cpp new file mode 100644 index 000000000..818c454f6 --- /dev/null +++ b/src/gui/editors/PatternEditor.cpp @@ -0,0 +1,329 @@ +/* + * PatternEditor.cpp - basic main-window for editing patterns + * + * Copyright (c) 2004-2008 Tobias Doerffel + * + * 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. + * + */ + +#include "PatternEditor.h" + +#include + +#include "ClipView.h" +#include "ComboBox.h" +#include "DataFile.h" +#include "embed.h" +#include "MainWindow.h" +#include "PatternStore.h" +#include "PatternTrack.h" +#include "Song.h" +#include "StringPairDrag.h" +#include "TrackView.h" + +#include "MidiClip.h" + + + + +PatternEditor::PatternEditor(PatternStore* ps) : + TrackContainerView(ps), + m_ps(ps) +{ + setModel(ps); +} + + + + +void PatternEditor::addSteps() +{ + makeSteps( false ); +} + +void PatternEditor::cloneSteps() +{ + makeSteps( true ); +} + + + + +void PatternEditor::removeSteps() +{ + TrackContainer::TrackList tl = model()->tracks(); + + for( TrackContainer::TrackList::iterator it = tl.begin(); + it != tl.end(); ++it ) + { + if( ( *it )->type() == Track::InstrumentTrack ) + { + MidiClip* p = static_cast((*it)->getClip(m_ps->currentPattern())); + p->removeSteps(); + } + } +} + + + + +void PatternEditor::addSampleTrack() +{ + (void) Track::create( Track::SampleTrack, model() ); +} + + + + +void PatternEditor::addAutomationTrack() +{ + (void) Track::create( Track::AutomationTrack, model() ); +} + + + + +void PatternEditor::removeViewsForPattern(int pattern) +{ + for( TrackView* view : trackViews() ) + { + view->getTrackContentWidget()->removeClipView(pattern); + } +} + + + +void PatternEditor::saveSettings(QDomDocument& doc, QDomElement& element) +{ + MainWindow::saveWidgetState( parentWidget(), element ); +} + +void PatternEditor::loadSettings(const QDomElement& element) +{ + MainWindow::restoreWidgetState(parentWidget(), element); +} + + + + +void PatternEditor::dropEvent(QDropEvent* de) +{ + QString type = StringPairDrag::decodeKey( de ); + QString value = StringPairDrag::decodeValue( de ); + + if( type.left( 6 ) == "track_" ) + { + DataFile dataFile( value.toUtf8() ); + Track * t = Track::create( dataFile.content().firstChild().toElement(), model() ); + + // Ensure pattern clips exist + bool hasValidPatternClips = false; + if (t->getClips().size() == m_ps->numOfPatterns()) + { + hasValidPatternClips = true; + for (int i = 0; i < t->getClips().size(); ++i) + { + if (t->getClips()[i]->startPosition() != TimePos(i, 0)) + { + hasValidPatternClips = false; + break; + } + } + } + if (!hasValidPatternClips) + { + t->deleteClips(); + t->createClipsForPattern(m_ps->numOfPatterns() - 1); + } + m_ps->updateAfterTrackAdd(); + + de->accept(); + } + else + { + TrackContainerView::dropEvent( de ); + } +} + + + + +void PatternEditor::updatePosition() +{ + //realignTracks(); + emit positionChanged( m_currentPosition ); +} + + + + +void PatternEditor::makeSteps( bool clone ) +{ + TrackContainer::TrackList tl = model()->tracks(); + + for( TrackContainer::TrackList::iterator it = tl.begin(); + it != tl.end(); ++it ) + { + if( ( *it )->type() == Track::InstrumentTrack ) + { + MidiClip* p = static_cast((*it)->getClip(m_ps->currentPattern())); + if( clone ) + { + p->cloneSteps(); + } else + { + p->addSteps(); + } + } + } +} + +// Creates a clone of the current pattern track with the same content, but no clips in the song editor +// TODO: Avoid repeated code from cloneTrack and clearTrack in TrackOperationsWidget somehow +void PatternEditor::cloneClip() +{ + // Get the current PatternTrack id + PatternStore* ps = static_cast(model()); + const int currentPattern = ps->currentPattern(); + + PatternTrack* pt = PatternTrack::findPatternTrack(currentPattern); + + if (pt) + { + // Clone the track + Track* newTrack = pt->clone(); + ps->setCurrentPattern(static_cast(newTrack)->patternIndex()); + + // Track still have the clips which is undesirable in this case, clear the track + newTrack->lock(); + newTrack->deleteClips(); + newTrack->unlock(); + } +} + + + + +PatternEditorWindow::PatternEditorWindow(PatternStore* ps) : + Editor(false), + m_editor(new PatternEditor(ps)) +{ + setWindowIcon(embed::getIconPixmap("pattern_track_btn")); + setWindowTitle(tr("Pattern Editor")); + setCentralWidget(m_editor); + + setAcceptDrops(true); + m_toolBar->setAcceptDrops(true); + connect(m_toolBar, SIGNAL(dragEntered(QDragEnterEvent*)), m_editor, SLOT(dragEnterEvent(QDragEnterEvent*))); + connect(m_toolBar, SIGNAL(dropped(QDropEvent*)), m_editor, SLOT(dropEvent(QDropEvent*))); + + // TODO: Use style sheet + if (ConfigManager::inst()->value("ui", "compacttrackbuttons").toInt()) + { + setMinimumWidth(TRACK_OP_WIDTH_COMPACT + DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT + 2 * ClipView::BORDER_WIDTH + 384); + } + else + { + setMinimumWidth(TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH + 2 * ClipView::BORDER_WIDTH + 384); + } + + m_playAction->setToolTip(tr("Play/pause current pattern (Space)")); + m_stopAction->setToolTip(tr("Stop playback of current pattern (Space)")); + + + // Pattern selector + DropToolBar* patternSelectionToolBar = addDropToolBarToTop(tr("Pattern selector")); + + m_patternComboBox = new ComboBox(m_toolBar); + m_patternComboBox->setFixedSize(200, ComboBox::DEFAULT_HEIGHT); + m_patternComboBox->setModel(&ps->m_patternComboBoxModel); + + patternSelectionToolBar->addWidget(m_patternComboBox); + + + // Track actions + DropToolBar *trackAndStepActionsToolBar = addDropToolBarToTop(tr("Track and step actions")); + + + trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_pattern_track"), tr("New pattern"), + Engine::getSong(), SLOT(addPatternTrack())); + trackAndStepActionsToolBar->addAction(embed::getIconPixmap("clone_pattern_track_clip"), tr("Clone pattern"), + m_editor, SLOT(cloneClip())); + trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_sample_track"), tr("Add sample-track"), + m_editor, SLOT(addSampleTrack())); + trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_automation"), tr("Add automation-track"), + m_editor, SLOT(addAutomationTrack())); + + QWidget* stretch = new QWidget(m_toolBar); + stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + trackAndStepActionsToolBar->addWidget(stretch); + + + // Step actions + trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_remove"), tr("Remove steps"), + m_editor, SLOT(removeSteps())); + trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_add"), tr("Add steps"), + m_editor, SLOT(addSteps())); + trackAndStepActionsToolBar->addAction( embed::getIconPixmap("step_btn_duplicate"), tr("Clone Steps"), + m_editor, SLOT(cloneSteps())); + + connect(&ps->m_patternComboBoxModel, SIGNAL(dataChanged()), + m_editor, SLOT(updatePosition())); + + + QAction* viewNext = new QAction(this); + connect(viewNext, SIGNAL(triggered()), m_patternComboBox, SLOT(selectNext())); + viewNext->setShortcut(Qt::Key_Plus); + addAction(viewNext); + + QAction* viewPrevious = new QAction(this); + connect(viewPrevious, SIGNAL(triggered()), m_patternComboBox, SLOT(selectPrevious())); + viewPrevious->setShortcut(Qt::Key_Minus); + addAction(viewPrevious); +} + + +PatternEditorWindow::~PatternEditorWindow() +{ +} + + +QSize PatternEditorWindow::sizeHint() const +{ + return {minimumWidth() + 10, 300}; +} + + +void PatternEditorWindow::play() +{ + if (Engine::getSong()->playMode() != Song::Mode_PlayPattern) + { + Engine::getSong()->playPattern(); + } + else + { + Engine::getSong()->togglePause(); + } +} + + +void PatternEditorWindow::stop() +{ + Engine::getSong()->stop(); +} diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 2bd5ad10b..bafede415 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -26,31 +26,30 @@ #include "PianoRoll.h" +#include #include -#include +#include +#include #include #include -#include #include -#include #include #include #include +#include #include #include -#include #include #ifndef __USE_XOPEN #define __USE_XOPEN #endif -#include +#include #include #include "AutomationEditor.h" #include "ActionGroup.h" -#include "BBTrackContainer.h" #include "Clipboard.h" #include "ComboBox.h" #include "ConfigManager.h" @@ -64,7 +63,9 @@ #include "InstrumentTrack.h" #include "MainWindow.h" #include "MidiClip.h" +#include "PatternStore.h" #include "PianoView.h" +#include "PositionLine.h" #include "SongEditor.h" #include "StepRecorderWidget.h" #include "TextFloat.h" @@ -313,7 +314,7 @@ PianoRoll::PianoRoll() : this, SLOT( updatePositionAccompany( const TimePos & ) ) ); // TODO -/* connect( engine::getSong()->getPlayPos( Song::Mode_PlayBB ).m_timeLine, +/* connect( engine::getSong()->getPlayPos( Song::Mode_PlayPattern ).m_timeLine, SIGNAL( positionChanged( const TimePos & ) ), this, SLOT( updatePositionAccompany( const TimePos & ) ) );*/ @@ -844,6 +845,11 @@ void PianoRoll::setCurrentMidiClip( MidiClip* newMidiClip ) { if( hasValidMidiClip() ) { + m_midiClip->instrumentTrack()->pianoModel()->disconnect(this); + m_midiClip->instrumentTrack()->firstKeyModel()->disconnect(this); + m_midiClip->instrumentTrack()->lastKeyModel()->disconnect(this); + m_midiClip->instrumentTrack()->microtuner()->keymapModel()->disconnect(this); + m_midiClip->instrumentTrack()->microtuner()->keyRangeImportModel()->disconnect(this); m_midiClip->instrumentTrack()->disconnect( this ); m_midiClip->disconnect(this); } @@ -1852,7 +1858,7 @@ void PianoRoll::mousePressEvent(QMouseEvent * me ) m_minResizeLen = quantization(); for (Note *note : selectedNotes) { - //Notes from the BB editor can have a negative length, so + //Notes from the pattern editor can have a negative length, so //change their length to the displayed one before resizing if (note->oldLength() <= 0) { note->setOldLength(4); } //Let the note be sized down by quantized increments, stopping @@ -3943,10 +3949,9 @@ QList PianoRoll::getAllOctavesForKey( int keyToMirror ) const Song::PlayModes PianoRoll::desiredPlayModeForAccompany() const { - if( m_midiClip->getTrack()->trackContainer() == - Engine::getBBTrackContainer() ) + if (m_midiClip->getTrack()->trackContainer() == Engine::patternStore()) { - return Song::Mode_PlayBB; + return Song::Mode_PlayPattern; } return Song::Mode_PlaySong; } @@ -4014,7 +4019,7 @@ void PianoRoll::recordAccompany() } else { - Engine::getSong()->playBB(); + Engine::getSong()->playPattern(); } } @@ -4509,7 +4514,7 @@ void PianoRoll::updatePositionAccompany( const TimePos & t ) s->playMode() != Song::Mode_PlayMidiClip ) { TimePos pos = t; - if( s->playMode() != Song::Mode_PlayBB ) + if (s->playMode() != Song::Mode_PlayPattern) { pos -= m_midiClip->startPosition(); } @@ -4726,7 +4731,7 @@ PianoRollWindow::PianoRollWindow() : m_playAction->setToolTip(tr( "Play/pause current clip (Space)" ) ); m_recordAction->setToolTip(tr( "Record notes from MIDI-device/channel-piano" ) ); - m_recordAccompanyAction->setToolTip( tr( "Record notes from MIDI-device/channel-piano while playing song or BB track" ) ); + m_recordAccompanyAction->setToolTip( tr( "Record notes from MIDI-device/channel-piano while playing song or pattern track" ) ); m_toggleStepRecordingAction->setToolTip( tr( "Record notes from MIDI-device/channel-piano, one step at the time" ) ); m_stopAction->setToolTip( tr( "Stop playing of current clip (Space)" ) ); diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index 988386666..432d69b42 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -27,16 +27,15 @@ #include #include #include -#include #include -#include -#include #include #include +#include "ActionGroup.h" #include "AudioDevice.h" #include "AudioEngine.h" #include "AutomatableSlider.h" +#include "ClipView.h" #include "ComboBox.h" #include "ConfigManager.h" #include "CPULoadWidget.h" @@ -49,11 +48,13 @@ #include "MeterDialog.h" #include "Oscilloscope.h" #include "PianoRoll.h" +#include "PositionLine.h" +#include "SubWindow.h" #include "TextFloat.h" #include "TimeDisplayWidget.h" #include "TimeLineWidget.h" #include "ToolTip.h" -#include "Track.h" +#include "TrackView.h" const QVector SongEditor::m_zoomLevels = { 0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f, 8.0f, 16.0f }; @@ -932,15 +933,15 @@ SongEditorWindow::SongEditorWindow(Song* song) : // Set up buttons m_playAction->setToolTip(tr("Play song (Space)")); m_recordAction->setToolTip(tr("Record samples from Audio-device")); - m_recordAccompanyAction->setToolTip(tr( "Record samples from Audio-device while playing song or BB track")); + m_recordAccompanyAction->setToolTip(tr("Record samples from Audio-device while playing song or pattern track")); m_stopAction->setToolTip(tr( "Stop song (Space)" )); // Track actions DropToolBar *trackActionsToolBar = addDropToolBarToTop(tr("Track actions")); - m_addBBTrackAction = new QAction(embed::getIconPixmap("add_bb_track"), - tr("Add beat/bassline"), this); + m_addPatternTrackAction = new QAction(embed::getIconPixmap("add_pattern_track"), + tr("Add pattern-track"), this); m_addSampleTrackAction = new QAction(embed::getIconPixmap("add_sample_track"), tr("Add sample-track"), this); @@ -948,11 +949,11 @@ SongEditorWindow::SongEditorWindow(Song* song) : m_addAutomationTrackAction = new QAction(embed::getIconPixmap("add_automation"), tr("Add automation-track"), this); - connect(m_addBBTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addBBTrack())); + connect(m_addPatternTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addPatternTrack())); connect(m_addSampleTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addSampleTrack())); connect(m_addAutomationTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addAutomationTrack())); - trackActionsToolBar->addAction( m_addBBTrackAction ); + trackActionsToolBar->addAction( m_addPatternTrackAction ); trackActionsToolBar->addAction( m_addSampleTrackAction ); trackActionsToolBar->addAction( m_addAutomationTrackAction ); diff --git a/src/gui/widgets/AutomatableButton.cpp b/src/gui/widgets/AutomatableButton.cpp index 80df31913..80d127877 100644 --- a/src/gui/widgets/AutomatableButton.cpp +++ b/src/gui/widgets/AutomatableButton.cpp @@ -28,7 +28,6 @@ #include #include "CaptionMenu.h" -#include "MainWindow.h" #include "StringPairDrag.h" diff --git a/src/gui/widgets/AutomatableSlider.cpp b/src/gui/widgets/AutomatableSlider.cpp index cd162a057..f44732de1 100644 --- a/src/gui/widgets/AutomatableSlider.cpp +++ b/src/gui/widgets/AutomatableSlider.cpp @@ -28,7 +28,6 @@ #include #include "CaptionMenu.h" -#include "MainWindow.h" diff --git a/src/gui/widgets/CaptionMenu.cpp b/src/gui/widgets/CaptionMenu.cpp index d58879d4d..bfd743d0d 100644 --- a/src/gui/widgets/CaptionMenu.cpp +++ b/src/gui/widgets/CaptionMenu.cpp @@ -24,7 +24,6 @@ #include "CaptionMenu.h" -#include "embed.h" diff --git a/src/gui/widgets/ComboBox.cpp b/src/gui/widgets/ComboBox.cpp index 9f18bb7cd..181256b96 100644 --- a/src/gui/widgets/ComboBox.cpp +++ b/src/gui/widgets/ComboBox.cpp @@ -35,7 +35,6 @@ #include "CaptionMenu.h" #include "embed.h" #include "gui_templates.h" -#include "MainWindow.h" QPixmap * ComboBox::s_background = nullptr; diff --git a/src/gui/widgets/ControllerRackView.cpp b/src/gui/widgets/ControllerRackView.cpp index d6b7cc410..2b597e1c2 100644 --- a/src/gui/widgets/ControllerRackView.cpp +++ b/src/gui/widgets/ControllerRackView.cpp @@ -24,21 +24,19 @@ */ #include -#include -#include #include #include -#include #include +#include #include "Song.h" #include "embed.h" #include "GuiApplication.h" #include "MainWindow.h" -#include "GroupBox.h" #include "ControllerRackView.h" #include "ControllerView.h" #include "LfoController.h" +#include "SubWindow.h" ControllerRackView::ControllerRackView( ) : diff --git a/src/gui/widgets/ControllerView.cpp b/src/gui/widgets/ControllerView.cpp index a0cdf0893..a3b1a7934 100644 --- a/src/gui/widgets/ControllerView.cpp +++ b/src/gui/widgets/ControllerView.cpp @@ -26,22 +26,19 @@ #include #include +#include #include -#include -#include #include -#include +#include #include "ControllerView.h" #include "CaptionMenu.h" #include "ControllerDialog.h" -#include "gui_templates.h" #include "embed.h" #include "GuiApplication.h" -#include "LedCheckbox.h" #include "MainWindow.h" -#include "ToolTip.h" +#include "SubWindow.h" ControllerView::ControllerView( Controller * _model, QWidget * _parent ) : diff --git a/src/gui/widgets/EffectRackView.cpp b/src/gui/widgets/EffectRackView.cpp index def51123b..f6bac18e2 100644 --- a/src/gui/widgets/EffectRackView.cpp +++ b/src/gui/widgets/EffectRackView.cpp @@ -24,9 +24,9 @@ */ #include -#include #include #include +#include #include "EffectRackView.h" #include "EffectSelectDialog.h" diff --git a/src/gui/widgets/EffectView.cpp b/src/gui/widgets/EffectView.cpp index b99fdf349..ef6db867f 100644 --- a/src/gui/widgets/EffectView.cpp +++ b/src/gui/widgets/EffectView.cpp @@ -23,10 +23,7 @@ * */ -#include #include -#include -#include #include #include @@ -39,6 +36,7 @@ #include "Knob.h" #include "LedCheckbox.h" #include "MainWindow.h" +#include "SubWindow.h" #include "TempoSyncKnob.h" #include "ToolTip.h" diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index 17a97e898..f569aa550 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -55,7 +55,6 @@ #include "CaptionMenu.h" #include "ConfigManager.h" #include "TextFloat.h" -#include "MainWindow.h" TextFloat * Fader::s_textFloat = nullptr; diff --git a/src/gui/widgets/Graph.cpp b/src/gui/widgets/Graph.cpp index 350b07f03..71e8375ee 100644 --- a/src/gui/widgets/Graph.cpp +++ b/src/gui/widgets/Graph.cpp @@ -23,8 +23,6 @@ * */ -#include -#include #include #include "Graph.h" diff --git a/src/gui/widgets/InstrumentFunctionViews.cpp b/src/gui/widgets/InstrumentFunctionViews.cpp index feba2a332..c10b7d349 100644 --- a/src/gui/widgets/InstrumentFunctionViews.cpp +++ b/src/gui/widgets/InstrumentFunctionViews.cpp @@ -22,8 +22,9 @@ * */ +#include +#include #include -#include #include "InstrumentFunctions.h" #include "InstrumentFunctionViews.h" diff --git a/src/gui/widgets/InstrumentMidiIOView.cpp b/src/gui/widgets/InstrumentMidiIOView.cpp index 724f835f0..c85ee75be 100644 --- a/src/gui/widgets/InstrumentMidiIOView.cpp +++ b/src/gui/widgets/InstrumentMidiIOView.cpp @@ -22,10 +22,10 @@ * */ -#include #include +#include #include -#include +#include #include "InstrumentMidiIOView.h" #include "MidiPortMenu.h" @@ -36,8 +36,6 @@ #include "gui_templates.h" #include "LcdSpinBox.h" #include "MidiClient.h" -#include "InstrumentTrack.h" -#include "LedCheckbox.h" InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : diff --git a/src/gui/widgets/InstrumentMiscView.cpp b/src/gui/widgets/InstrumentMiscView.cpp index c1636daac..01ce6cb8a 100644 --- a/src/gui/widgets/InstrumentMiscView.cpp +++ b/src/gui/widgets/InstrumentMiscView.cpp @@ -25,8 +25,9 @@ #include "InstrumentMiscView.h" +#include #include -#include +#include #include "ComboBox.h" #include "GroupBox.h" diff --git a/src/gui/widgets/Knob.cpp b/src/gui/widgets/Knob.cpp index 0c98734d2..96ef6fec8 100644 --- a/src/gui/widgets/Knob.cpp +++ b/src/gui/widgets/Knob.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -46,7 +45,6 @@ #include "LocaleHelper.h" #include "MainWindow.h" #include "ProjectJournal.h" -#include "Song.h" #include "StringPairDrag.h" #include "TextFloat.h" diff --git a/src/gui/widgets/LadspaControlView.cpp b/src/gui/widgets/LadspaControlView.cpp index e04a52351..bed39cca7 100644 --- a/src/gui/widgets/LadspaControlView.cpp +++ b/src/gui/widgets/LadspaControlView.cpp @@ -23,7 +23,8 @@ * */ -#include + +#include #include "LadspaControl.h" #include "LadspaControlView.h" diff --git a/src/gui/widgets/LcdFloatSpinBox.cpp b/src/gui/widgets/LcdFloatSpinBox.cpp index a28d54b9b..22b4d5509 100644 --- a/src/gui/widgets/LcdFloatSpinBox.cpp +++ b/src/gui/widgets/LcdFloatSpinBox.cpp @@ -28,14 +28,13 @@ #include -#include #include #include #include #include #include #include -#include +#include #include #include "CaptionMenu.h" diff --git a/src/gui/widgets/LcdSpinBox.cpp b/src/gui/widgets/LcdSpinBox.cpp index 40b3717e8..ef0d08aae 100644 --- a/src/gui/widgets/LcdSpinBox.cpp +++ b/src/gui/widgets/LcdSpinBox.cpp @@ -24,17 +24,11 @@ */ #include -#include -#include #include -#include -#include #include #include "LcdSpinBox.h" #include "CaptionMenu.h" -#include "GuiApplication.h" -#include "MainWindow.h" diff --git a/src/gui/widgets/LcdWidget.cpp b/src/gui/widgets/LcdWidget.cpp index 1fefe3dd0..c947f7720 100644 --- a/src/gui/widgets/LcdWidget.cpp +++ b/src/gui/widgets/LcdWidget.cpp @@ -25,17 +25,13 @@ -#include -#include -#include +#include #include -#include #include "LcdWidget.h" #include "DeprecationHelper.h" #include "embed.h" #include "gui_templates.h" -#include "MainWindow.h" diff --git a/src/gui/widgets/LeftRightNav.cpp b/src/gui/widgets/LeftRightNav.cpp index 2502a0405..8d614fa3e 100644 --- a/src/gui/widgets/LeftRightNav.cpp +++ b/src/gui/widgets/LeftRightNav.cpp @@ -23,6 +23,8 @@ */ +#include + #include "LeftRightNav.h" #include "ToolTip.h" #include "embed.h" @@ -88,4 +90,4 @@ void LeftRightNav::setShortcuts(const QKeySequence &leftShortcut, const QKeySequ ToolTip::add(&m_leftBtn, tr("Previous (%1)").arg(leftShortcut.toString())); ToolTip::add(&m_rightBtn, tr("Next (%1)").arg(rightShortcut.toString())); -} \ No newline at end of file +} diff --git a/src/gui/widgets/LinkedModelGroupViews.cpp b/src/gui/widgets/LinkedModelGroupViews.cpp index b9e007ff9..8cac826eb 100644 --- a/src/gui/widgets/LinkedModelGroupViews.cpp +++ b/src/gui/widgets/LinkedModelGroupViews.cpp @@ -86,7 +86,6 @@ void LinkedModelGroupView::modelChanged(LinkedModelGroup *group) void LinkedModelGroupView::addControl(Control* ctrl, const std::string& id, const std::string &display, bool removable) { - int wdgNum = static_cast(m_widgets.size()); if (ctrl) { QWidget* box = new QWidget(this); @@ -116,7 +115,6 @@ void LinkedModelGroupView::addControl(Control* ctrl, const std::string& id, // take ownership of control and add it m_widgets.emplace(id, std::unique_ptr(ctrl)); - ++wdgNum; } if (isHidden()) { setHidden(false); } diff --git a/src/gui/widgets/MeterDialog.cpp b/src/gui/widgets/MeterDialog.cpp index b1e3ffad4..10153c632 100644 --- a/src/gui/widgets/MeterDialog.cpp +++ b/src/gui/widgets/MeterDialog.cpp @@ -24,9 +24,9 @@ */ -#include -#include +#include #include +#include #include "MeterDialog.h" #include "MeterModel.h" diff --git a/src/gui/widgets/MicrotunerConfig.cpp b/src/gui/widgets/MicrotunerConfig.cpp index 9646e2f3a..307369a19 100644 --- a/src/gui/widgets/MicrotunerConfig.cpp +++ b/src/gui/widgets/MicrotunerConfig.cpp @@ -27,7 +27,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -37,12 +39,16 @@ #include "Engine.h" #include "FileDialog.h" #include "GuiApplication.h" -#include "Knob.h" +#include "Keymap.h" +#include "LcdFloatSpinBox.h" #include "LcdSpinBox.h" #include "lmms_constants.h" #include "lmmsversion.h" #include "MainWindow.h" +#include "Note.h" +#include "Scale.h" #include "Song.h" +#include "SubWindow.h" MicrotunerConfig::MicrotunerConfig() : diff --git a/src/gui/widgets/MixerLine.cpp b/src/gui/widgets/MixerLine.cpp index 95e64a6b6..6c0cc5bc3 100644 --- a/src/gui/widgets/MixerLine.cpp +++ b/src/gui/widgets/MixerLine.cpp @@ -28,11 +28,20 @@ #include #include +#include +#include +#include #include "CaptionMenu.h" +#include "ColorChooser.h" +#include "embed.h" +#include "Knob.h" +#include "LcdWidget.h" #include "Mixer.h" +#include "MixerView.h" #include "gui_templates.h" #include "GuiApplication.h" +#include "SendButtonIndicator.h" #include "Song.h" bool MixerLine::eventFilter( QObject *dist, QEvent *event ) diff --git a/src/gui/widgets/PixmapButton.cpp b/src/gui/widgets/PixmapButton.cpp index f792fcac7..9bedfe1b5 100644 --- a/src/gui/widgets/PixmapButton.cpp +++ b/src/gui/widgets/PixmapButton.cpp @@ -28,7 +28,6 @@ #include #include "PixmapButton.h" -#include "MainWindow.h" #include "embed.h" diff --git a/src/gui/widgets/PositionLine.cpp b/src/gui/widgets/PositionLine.cpp index a18e9cb8b..c91a82abe 100644 --- a/src/gui/widgets/PositionLine.cpp +++ b/src/gui/widgets/PositionLine.cpp @@ -26,7 +26,6 @@ #include -#include "GuiApplication.h" #include "Song.h" diff --git a/src/gui/widgets/ProjectNotes.cpp b/src/gui/widgets/ProjectNotes.cpp index 6fac73208..428720ee9 100644 --- a/src/gui/widgets/ProjectNotes.cpp +++ b/src/gui/widgets/ProjectNotes.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/src/gui/widgets/SendButtonIndicator.cpp b/src/gui/widgets/SendButtonIndicator.cpp index 6f081669f..6772f6289 100644 --- a/src/gui/widgets/SendButtonIndicator.cpp +++ b/src/gui/widgets/SendButtonIndicator.cpp @@ -1,6 +1,9 @@ #include "SendButtonIndicator.h" +#include "embed.h" #include "Mixer.h" +#include "MixerLine.h" +#include "MixerView.h" QPixmap * SendButtonIndicator::s_qpmOff = nullptr; QPixmap * SendButtonIndicator::s_qpmOn = nullptr; diff --git a/src/gui/widgets/SideBarWidget.cpp b/src/gui/widgets/SideBarWidget.cpp index 41647a4fd..ab827f8d1 100644 --- a/src/gui/widgets/SideBarWidget.cpp +++ b/src/gui/widgets/SideBarWidget.cpp @@ -24,9 +24,9 @@ #include "SideBarWidget.h" -#include #include #include +#include #include "embed.h" diff --git a/src/gui/widgets/StepRecorderWidget.cpp b/src/gui/widgets/StepRecorderWidget.cpp index 65deb0d0a..679901b0e 100644 --- a/src/gui/widgets/StepRecorderWidget.cpp +++ b/src/gui/widgets/StepRecorderWidget.cpp @@ -20,6 +20,8 @@ * */ +#include + #include "StepRecorderWidget.h" #include "TextFloat.h" #include "embed.h" diff --git a/src/gui/widgets/TempoSyncKnob.cpp b/src/gui/widgets/TempoSyncKnob.cpp index a141c0003..bb4faea26 100644 --- a/src/gui/widgets/TempoSyncKnob.cpp +++ b/src/gui/widgets/TempoSyncKnob.cpp @@ -34,6 +34,7 @@ #include "MainWindow.h" #include "MeterDialog.h" #include "Song.h" +#include "SubWindow.h" diff --git a/src/gui/widgets/ToolTip.cpp b/src/gui/widgets/ToolTip.cpp index 81f963edb..95dde8344 100644 --- a/src/gui/widgets/ToolTip.cpp +++ b/src/gui/widgets/ToolTip.cpp @@ -23,7 +23,8 @@ */ -#include + +#include #include "ToolTip.h" #include "ConfigManager.h" diff --git a/src/gui/widgets/TrackContentWidget.cpp b/src/gui/widgets/TrackContentWidget.cpp index 2dd9c1f9b..36bbd4096 100644 --- a/src/gui/widgets/TrackContentWidget.cpp +++ b/src/gui/widgets/TrackContentWidget.cpp @@ -30,12 +30,12 @@ #include #include "AutomationClip.h" -#include "BBEditor.h" -#include "BBTrackContainer.h" #include "Clipboard.h" #include "DataFile.h" #include "Engine.h" #include "GuiApplication.h" +#include "PatternEditor.h" +#include "PatternStore.h" #include "Song.h" #include "SongEditor.h" #include "StringPairDrag.h" @@ -199,17 +199,16 @@ void TrackContentWidget::update() */ void TrackContentWidget::changePosition( const TimePos & newPos ) { - if( m_trackView->trackContainerView() == getGUI()->getBBEditor()->trackContainerView() ) + if (m_trackView->trackContainerView() == getGUI()->patternEditor()->m_editor) { - const int curBB = Engine::getBBTrackContainer()->currentBB(); + const int curPattern = Engine::patternStore()->currentPattern(); setUpdatesEnabled( false ); - // first show Clip for current BB... + // first show clip for current pattern... for( clipViewVector::iterator it = m_clipViews.begin(); it != m_clipViews.end(); ++it ) { - if( ( *it )->getClip()-> - startPosition().getBar() == curBB ) + if ((*it)->getClip()->startPosition().getBar() == curPattern) { ( *it )->move( 0, ( *it )->y() ); ( *it )->raise(); @@ -224,8 +223,7 @@ void TrackContentWidget::changePosition( const TimePos & newPos ) for( clipViewVector::iterator it = m_clipViews.begin(); it != m_clipViews.end(); ++it ) { - if( ( *it )->getClip()-> - startPosition().getBar() != curBB ) + if ((*it)->getClip()->startPosition().getBar() != curPattern) { ( *it )->hide(); } @@ -600,8 +598,8 @@ void TrackContentWidget::paintEvent( QPaintEvent * pe ) const TrackContainerView * tcv = m_trackView->trackContainerView(); int ppb = static_cast( tcv->pixelsPerBar() ); QPainter p( this ); - // Don't draw background on BB-Editor - if( m_trackView->trackContainerView() != getGUI()->getBBEditor()->trackContainerView() ) + // Don't draw background on Pattern Editor + if (m_trackView->trackContainerView() != getGUI()->patternEditor()->m_editor) { p.drawTiledPixmap( rect(), m_background, QPoint( tcv->currentPosition().getBar() * ppb, 0 ) ); diff --git a/src/gui/widgets/TrackLabelButton.cpp b/src/gui/widgets/TrackLabelButton.cpp index 361db740e..3388fe9fb 100644 --- a/src/gui/widgets/TrackLabelButton.cpp +++ b/src/gui/widgets/TrackLabelButton.cpp @@ -26,7 +26,6 @@ #include "TrackLabelButton.h" -#include #include #include "ConfigManager.h" @@ -37,6 +36,7 @@ #include "RenameDialog.h" #include "Song.h" #include "TrackRenameLineEdit.h" +#include "TrackView.h" diff --git a/src/gui/widgets/TrackOperationsWidget.cpp b/src/gui/widgets/TrackOperationsWidget.cpp index 8d192eafd..0b85dd9c5 100644 --- a/src/gui/widgets/TrackOperationsWidget.cpp +++ b/src/gui/widgets/TrackOperationsWidget.cpp @@ -131,7 +131,7 @@ TrackOperationsWidget::~TrackOperationsWidget() /*! \brief Respond to trackOperationsWidget mouse events * * If it's the left mouse button, and Ctrl is held down, and we're - * not a Beat+Bassline Editor track, then start a new drag event to + * not a Pattern Editor track, then start a new drag event to * copy this track. * * Otherwise, ignore all other events. @@ -142,7 +142,7 @@ void TrackOperationsWidget::mousePressEvent( QMouseEvent * me ) { if( me->button() == Qt::LeftButton && me->modifiers() & Qt::ControlModifier && - m_trackView->getTrack()->type() != Track::BBTrack ) + m_trackView->getTrack()->type() != Track::PatternTrack) { DataFile dataFile( DataFile::DragNDropData ); m_trackView->getTrack()->saveState( dataFile, dataFile.content() ); @@ -163,7 +163,7 @@ void TrackOperationsWidget::mousePressEvent( QMouseEvent * me ) /*! \brief Repaint the trackOperationsWidget * - * If we're not moving, and in the Beat+Bassline Editor, then turn + * If we're not moving, and in the Pattern Editor, then turn * automation on or off depending on its previous state and show * ourselves. * diff --git a/src/lmmsconfig.h.in b/src/lmmsconfig.h.in index d58c9705d..f76bae469 100644 --- a/src/lmmsconfig.h.in +++ b/src/lmmsconfig.h.in @@ -35,8 +35,6 @@ #cmakedefine LMMS_DEBUG_FPE -#cmakedefine LMMS_HAVE_STDINT_H -#cmakedefine LMMS_HAVE_STDLIB_H #cmakedefine LMMS_HAVE_PTHREAD_H #cmakedefine LMMS_HAVE_UNISTD_H #cmakedefine LMMS_HAVE_SYS_TYPES_H diff --git a/src/tracks/AutomationTrack.cpp b/src/tracks/AutomationTrack.cpp index dfdbb32ee..65d34b884 100644 --- a/src/tracks/AutomationTrack.cpp +++ b/src/tracks/AutomationTrack.cpp @@ -24,6 +24,8 @@ * */ +#include "AutomationTrack.h" + #include "AutomationTrackView.h" #include "AutomationClip.h" @@ -76,4 +78,4 @@ void AutomationTrack::loadTrackSpecificSettings( const QDomElement & _this ) { setMuted( false ); } -} \ No newline at end of file +} diff --git a/src/tracks/BBTrack.cpp b/src/tracks/BBTrack.cpp deleted file mode 100644 index 4c833f4c8..000000000 --- a/src/tracks/BBTrack.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - * BBTrack.cpp - implementation of class BBTrack - * - * Copyright (c) 2004-2014 Tobias Doerffel - * - * 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. - * - */ -#include "BBTrack.h" - -#include -#include -#include - -#include "BBTrackContainer.h" -#include "BBTrackView.h" -#include "Song.h" - - - -BBTrack::infoMap BBTrack::s_infoMap; - - -BBTrack::BBTrack( TrackContainer* tc ) : - Track( Track::BBTrack, tc ) -{ - int bbNum = s_infoMap.size(); - s_infoMap[this] = bbNum; - - setName( tr( "Beat/Bassline %1" ).arg( bbNum ) ); - Engine::getBBTrackContainer()->createClipsForBB( bbNum ); - Engine::getBBTrackContainer()->setCurrentBB( bbNum ); - Engine::getBBTrackContainer()->updateComboBox(); - - connect( this, SIGNAL( nameChanged() ), - Engine::getBBTrackContainer(), SLOT( updateComboBox() ) ); -} - - - - -BBTrack::~BBTrack() -{ - Engine::audioEngine()->removePlayHandlesOfTypes( this, - PlayHandle::TypeNotePlayHandle - | PlayHandle::TypeInstrumentPlayHandle - | PlayHandle::TypeSamplePlayHandle ); - - const int bb = s_infoMap[this]; - Engine::getBBTrackContainer()->removeBB( bb ); - for( infoMap::iterator it = s_infoMap.begin(); it != s_infoMap.end(); - ++it ) - { - if( it.value() > bb ) - { - --it.value(); - } - } - s_infoMap.remove( this ); - - // remove us from TC so bbTrackContainer::numOfBBs() returns a smaller - // value and thus combobox-updating in bbTrackContainer works well - trackContainer()->removeTrack( this ); - Engine::getBBTrackContainer()->updateComboBox(); -} - - - - -// play _frames frames of given Clip within starting with _start -bool BBTrack::play( const TimePos & _start, const fpp_t _frames, - const f_cnt_t _offset, int _clip_num ) -{ - if( isMuted() ) - { - return false; - } - - if( _clip_num >= 0 ) - { - return Engine::getBBTrackContainer()->play( _start, _frames, _offset, s_infoMap[this] ); - } - - clipVector clips; - getClipsInRange( clips, _start, _start + static_cast( _frames / Engine::framesPerTick() ) ); - - if( clips.size() == 0 ) - { - return false; - } - - TimePos lastPosition; - TimePos lastLen; - for( clipVector::iterator it = clips.begin(); it != clips.end(); ++it ) - { - if( !( *it )->isMuted() && - ( *it )->startPosition() >= lastPosition ) - { - lastPosition = ( *it )->startPosition(); - lastLen = ( *it )->length(); - } - } - - if( _start - lastPosition < lastLen ) - { - return Engine::getBBTrackContainer()->play( _start - lastPosition, _frames, _offset, s_infoMap[this] ); - } - return false; -} - - - - -TrackView * BBTrack::createView( TrackContainerView* tcv ) -{ - return new BBTrackView( this, tcv ); -} - - - - -Clip* BBTrack::createClip(const TimePos & pos) -{ - BBClip* bbclip = new BBClip(this); - bbclip->movePosition(pos); - return bbclip; -} - - - - -void BBTrack::saveTrackSpecificSettings( QDomDocument & _doc, - QDomElement & _this ) -{ -// _this.setAttribute( "icon", m_trackLabel->pixmapFile() ); -/* _this.setAttribute( "current", s_infoMap[this] == - engine::getBBEditor()->currentBB() );*/ - if( s_infoMap[this] == 0 && - _this.parentNode().parentNode().nodeName() != "clone" && - _this.parentNode().parentNode().nodeName() != "journaldata" ) - { - ( (JournallingObject *)( Engine::getBBTrackContainer() ) )-> - saveState( _doc, _this ); - } - if( _this.parentNode().parentNode().nodeName() == "clone" ) - { - _this.setAttribute( "clonebbt", s_infoMap[this] ); - } -} - - - - -void BBTrack::loadTrackSpecificSettings( const QDomElement & _this ) -{ -/* if( _this.attribute( "icon" ) != "" ) - { - m_trackLabel->setPixmapFile( _this.attribute( "icon" ) ); - }*/ - - if( _this.hasAttribute( "clonebbt" ) ) - { - const int src = _this.attribute( "clonebbt" ).toInt(); - const int dst = s_infoMap[this]; - TrackContainer::TrackList tl = - Engine::getBBTrackContainer()->tracks(); - // copy Clips of all tracks from source BB (at bar "src") to destination - // Clips (which are created if they do not exist yet) - for( TrackContainer::TrackList::iterator it = tl.begin(); - it != tl.end(); ++it ) - { - Clip::copyStateTo( ( *it )->getClip( src ), - ( *it )->getClip( dst ) ); - } - setName( tr( "Clone of %1" ).arg( - _this.parentNode().toElement().attribute( "name" ) ) ); - } - else - { - QDomNode node = _this.namedItem( - TrackContainer::classNodeName() ); - if( node.isElement() ) - { - ( (JournallingObject *)Engine::getBBTrackContainer() )-> - restoreState( node.toElement() ); - } - } -/* doesn't work yet because BBTrack-ctor also sets current bb so if - bb-tracks are created after this function is called, this doesn't - help at all.... - if( _this.attribute( "current" ).toInt() ) - { - engine::getBBEditor()->setCurrentBB( s_infoMap[this] ); - }*/ -} - - - - -// return pointer to BBTrack specified by _bb_num -BBTrack * BBTrack::findBBTrack( int _bb_num ) -{ - for( infoMap::iterator it = s_infoMap.begin(); it != s_infoMap.end(); - ++it ) - { - if( it.value() == _bb_num ) - { - return it.key(); - } - } - return nullptr; -} - - - - -void BBTrack::swapBBTracks( Track * _track1, Track * _track2 ) -{ - BBTrack * t1 = dynamic_cast( _track1 ); - BBTrack * t2 = dynamic_cast( _track2 ); - if( t1 != nullptr && t2 != nullptr ) - { - qSwap( s_infoMap[t1], s_infoMap[t2] ); - Engine::getBBTrackContainer()->swapBB( s_infoMap[t1], - s_infoMap[t2] ); - Engine::getBBTrackContainer()->setCurrentBB( s_infoMap[t1] ); - } -} \ No newline at end of file diff --git a/src/tracks/CMakeLists.txt b/src/tracks/CMakeLists.txt index a9fd83e90..75704b007 100644 --- a/src/tracks/CMakeLists.txt +++ b/src/tracks/CMakeLists.txt @@ -1,9 +1,9 @@ set(LMMS_SRCS ${LMMS_SRCS} tracks/AutomationTrack.cpp - tracks/BBTrack.cpp tracks/InstrumentTrack.cpp tracks/MidiClip.cpp + tracks/PatternTrack.cpp tracks/SampleTrack.cpp PARENT_SCOPE diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 9ed9dbe07..33f1a927e 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -25,16 +25,19 @@ #include "AudioEngine.h" #include "AutomationClip.h" -#include "BBTrack.h" #include "ConfigManager.h" #include "ControllerConnection.h" #include "DataFile.h" #include "Mixer.h" #include "InstrumentTrackView.h" #include "Instrument.h" +#include "Keymap.h" #include "MidiClient.h" #include "MidiClip.h" #include "MixHelpers.h" +#include "PatternStore.h" +#include "PatternTrack.h" +#include "Pitch.h" #include "Song.h" @@ -223,7 +226,7 @@ void InstrumentTrack::processAudioBuffer( sampleFrame* buf, const fpp_t frames, { // we must not play the sound if this InstrumentTrack is muted... if( isMuted() || ( Engine::getSong()->playMode() != Song::Mode_PlayMidiClip && - n && n->isBbTrackMuted() ) || ! m_instrument ) + n && n->isPatternTrackMuted() ) || ! m_instrument ) { return; } @@ -696,14 +699,14 @@ bool InstrumentTrack::play( const TimePos & _start, const fpp_t _frames, const float frames_per_tick = Engine::framesPerTick(); clipVector clips; - ::BBTrack * bb_track = nullptr; + ::PatternTrack * pattern_track = nullptr; if( _clip_num >= 0 ) { Clip * clip = getClip( _clip_num ); clips.push_back( clip ); - if (trackContainer() == (TrackContainer*)Engine::getBBTrackContainer()) + if (trackContainer() == Engine::patternStore()) { - bb_track = BBTrack::findBBTrack( _clip_num ); + pattern_track = PatternTrack::findPatternTrack(_clip_num); } } else @@ -787,7 +790,7 @@ bool InstrumentTrack::play( const TimePos & _start, const fpp_t _frames, cur_note->length().frames( frames_per_tick ); NotePlayHandle* notePlayHandle = NotePlayHandleManager::acquire( this, groove_offset, note_frames, *cur_note ); - notePlayHandle->setBBTrack( bb_track ); + notePlayHandle->setPatternTrack(pattern_track); // are we playing global song? if( _clip_num < 0 ) { diff --git a/src/tracks/MidiClip.cpp b/src/tracks/MidiClip.cpp index 307e62198..7a5fb657d 100644 --- a/src/tracks/MidiClip.cpp +++ b/src/tracks/MidiClip.cpp @@ -25,12 +25,14 @@ #include "MidiClip.h" -#include "BBTrackContainer.h" +#include + #include "GuiApplication.h" #include "InstrumentTrack.h" +#include "MidiClipView.h" +#include "PatternStore.h" #include "PianoRoll.h" -#include QPixmap * MidiClipView::s_stepBtnOn0 = nullptr; @@ -46,8 +48,7 @@ MidiClip::MidiClip( InstrumentTrack * _instrument_track ) : m_clipType( BeatClip ), m_steps( TimePos::stepsPerBar() ) { - if( _instrument_track->trackContainer() - == Engine::getBBTrackContainer() ) + if (_instrument_track->trackContainer() == Engine::patternStore()) { resizeToFirstTrack(); } @@ -72,7 +73,7 @@ MidiClip::MidiClip( const MidiClip& other ) : init(); switch( getTrack()->trackContainer()->type() ) { - case TrackContainer::BBContainer: + case TrackContainer::PatternContainer: setAutoResize( true ); break; @@ -103,7 +104,7 @@ MidiClip::~MidiClip() void MidiClip::resizeToFirstTrack() { - // Resize this track to be the same as existing tracks in the BB + // Resize this track to be the same as existing tracks in the pattern const TrackContainer::TrackList & tracks = m_instrumentTrack->trackContainer()->tracks(); for(unsigned int trackID = 0; trackID < tracks.size(); ++trackID) @@ -144,7 +145,7 @@ void MidiClip::updateLength() if( m_clipType == BeatClip ) { changeLength( beatClipLength() ); - updateBBTrack(); + updatePatternTrack(); return; } @@ -161,7 +162,7 @@ void MidiClip::updateLength() } changeLength( TimePos( max_length ).nextFullBar() * TimePos::ticksPerBar() ); - updateBBTrack(); + updatePatternTrack(); } @@ -558,11 +559,11 @@ ClipView * MidiClip::createView( TrackView * _tv ) -void MidiClip::updateBBTrack() +void MidiClip::updatePatternTrack() { - if( getTrack()->trackContainer() == Engine::getBBTrackContainer() ) + if (getTrack()->trackContainer() == Engine::patternStore()) { - Engine::getBBTrackContainer()->updateBBTrack( this ); + Engine::patternStore()->updatePatternTrack(this); } if( getGUI() != nullptr diff --git a/src/tracks/PatternTrack.cpp b/src/tracks/PatternTrack.cpp new file mode 100644 index 000000000..243c9d3af --- /dev/null +++ b/src/tracks/PatternTrack.cpp @@ -0,0 +1,242 @@ +/* + * PatternTrack.cpp - a track representing a pattern in the PatternStore + * + * Copyright (c) 2004-2014 Tobias Doerffel + * + * 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. + * + */ +#include "PatternTrack.h" + +#include + +#include "AudioEngine.h" +#include "Engine.h" +#include "PatternClip.h" +#include "PatternStore.h" +#include "PatternTrackView.h" +#include "PlayHandle.h" + + + +PatternTrack::infoMap PatternTrack::s_infoMap; + + +PatternTrack::PatternTrack(TrackContainer* tc) : + Track(Track::PatternTrack, tc) +{ + int patternNum = s_infoMap.size(); + s_infoMap[this] = patternNum; + + setName(tr("Pattern %1").arg(patternNum)); + Engine::patternStore()->createClipsForPattern(patternNum); + Engine::patternStore()->setCurrentPattern(patternNum); + Engine::patternStore()->updateComboBox(); + + connect( this, SIGNAL( nameChanged() ), + Engine::patternStore(), SLOT(updateComboBox())); +} + + + + +PatternTrack::~PatternTrack() +{ + Engine::audioEngine()->removePlayHandlesOfTypes( this, + PlayHandle::TypeNotePlayHandle + | PlayHandle::TypeInstrumentPlayHandle + | PlayHandle::TypeSamplePlayHandle ); + + const int pattern = s_infoMap[this]; + Engine::patternStore()->removePattern(pattern); + for( infoMap::iterator it = s_infoMap.begin(); it != s_infoMap.end(); + ++it ) + { + if (it.value() > pattern) + { + --it.value(); + } + } + s_infoMap.remove( this ); + + // remove us from the Song and update the pattern selection combobox to reflect the change + trackContainer()->removeTrack( this ); + Engine::patternStore()->updateComboBox(); +} + + + + +// play _frames frames of given Clip within starting with _start +bool PatternTrack::play( const TimePos & _start, const fpp_t _frames, + const f_cnt_t _offset, int _clip_num ) +{ + if( isMuted() ) + { + return false; + } + + if( _clip_num >= 0 ) + { + return Engine::patternStore()->play(_start, _frames, _offset, s_infoMap[this]); + } + + clipVector clips; + getClipsInRange( clips, _start, _start + static_cast( _frames / Engine::framesPerTick() ) ); + + if( clips.size() == 0 ) + { + return false; + } + + TimePos lastPosition; + TimePos lastLen; + for( clipVector::iterator it = clips.begin(); it != clips.end(); ++it ) + { + if( !( *it )->isMuted() && + ( *it )->startPosition() >= lastPosition ) + { + lastPosition = ( *it )->startPosition(); + lastLen = ( *it )->length(); + } + } + + if( _start - lastPosition < lastLen ) + { + return Engine::patternStore()->play(_start - lastPosition, _frames, _offset, s_infoMap[this]); + } + return false; +} + + + + +TrackView* PatternTrack::createView(TrackContainerView* tcv) +{ + return new PatternTrackView(this, tcv); +} + + + + +Clip* PatternTrack::createClip(const TimePos & pos) +{ + PatternClip* pc = new PatternClip(this); + pc->movePosition(pos); + return pc; +} + + + + +void PatternTrack::saveTrackSpecificSettings(QDomDocument& doc, QDomElement& _this) +{ +// _this.setAttribute( "icon", m_trackLabel->pixmapFile() ); +/* _this.setAttribute( "current", s_infoMap[this] == + engine::getPatternEditor()->currentPattern() );*/ + if( s_infoMap[this] == 0 && + _this.parentNode().parentNode().nodeName() != "clonedtrack" && + _this.parentNode().parentNode().nodeName() != "journaldata" ) + { + Engine::patternStore()->saveState(doc, _this); + } + // If we are creating drag-n-drop data for Track::clone() only save pattern ID, not pattern content + if (_this.parentNode().parentNode().nodeName() == "clonedtrack") + { + _this.setAttribute("sourcepattern", s_infoMap[this]); + } +} + + + + +void PatternTrack::loadTrackSpecificSettings(const QDomElement& _this) +{ +/* if( _this.attribute( "icon" ) != "" ) + { + m_trackLabel->setPixmapFile( _this.attribute( "icon" ) ); + }*/ + + // If data was created by Track::clone(), do not add any tracks to the pattern(-editor) + // instead create a new copy of the clip on each track + if (_this.hasAttribute("sourcepattern")) + { + const int src = _this.attribute("sourcepattern").toInt(); + const int dst = s_infoMap[this]; + TrackContainer::TrackList tl = + Engine::patternStore()->tracks(); + // copy clips of all tracks from source pattern (at bar "src") to destination + // clips (which are created if they do not exist yet) + for( TrackContainer::TrackList::iterator it = tl.begin(); + it != tl.end(); ++it ) + { + Clip::copyStateTo( ( *it )->getClip( src ), + ( *it )->getClip( dst ) ); + } + setName( tr( "Clone of %1" ).arg( + _this.parentNode().toElement().attribute( "name" ) ) ); + } + else + { + QDomNode node = _this.namedItem( + TrackContainer::classNodeName() ); + if( node.isElement() ) + { + Engine::patternStore()->restoreState(node.toElement()); + } + } +/* doesn't work yet because PatternTrack-ctor also sets current pattern so if + pattern tracks are created after this function is called, this doesn't + help at all.... + if( _this.attribute( "current" ).toInt() ) + { + engine::getPatternEditor()->setCurrentPattern( s_infoMap[this] ); + }*/ +} + + + + +// return pointer to PatternTrack specified by pattern_num +PatternTrack* PatternTrack::findPatternTrack(int pattern_num) +{ + for( infoMap::iterator it = s_infoMap.begin(); it != s_infoMap.end(); + ++it ) + { + if (it.value() == pattern_num) + { + return it.key(); + } + } + return nullptr; +} + + + + +void PatternTrack::swapPatternTracks(Track* track1, Track* track2) +{ + PatternTrack* t1 = dynamic_cast(track1); + PatternTrack* t2 = dynamic_cast(track2); + if( t1 != nullptr && t2 != nullptr ) + { + qSwap( s_infoMap[t1], s_infoMap[t2] ); + Engine::patternStore()->swapPattern(s_infoMap[t1], s_infoMap[t2]); + Engine::patternStore()->setCurrentPattern(s_infoMap[t1]); + } +} diff --git a/src/tracks/SampleTrack.cpp b/src/tracks/SampleTrack.cpp index 22f9c18a0..b1fd4c406 100644 --- a/src/tracks/SampleTrack.cpp +++ b/src/tracks/SampleTrack.cpp @@ -27,10 +27,17 @@ #include -#include "BBTrack.h" +#include "EffectChain.h" +#include "Mixer.h" +#include "panning_constants.h" +#include "PatternStore.h" +#include "PatternTrack.h" +#include "SampleClip.h" #include "SamplePlayHandle.h" #include "SampleRecordHandle.h" +#include "SampleTrackView.h" #include "Song.h" +#include "volume.h" @@ -67,7 +74,7 @@ bool SampleTrack::play( const TimePos & _start, const fpp_t _frames, bool played_a_note = false; // will be return variable clipVector clips; - ::BBTrack * bb_track = nullptr; + ::PatternTrack * pattern_track = nullptr; if( _clip_num >= 0 ) { if (_start > getClip(_clip_num)->length()) @@ -79,9 +86,9 @@ bool SampleTrack::play( const TimePos & _start, const fpp_t _frames, return false; } clips.push_back( getClip( _clip_num ) ); - if (trackContainer() == (TrackContainer*)Engine::getBBTrackContainer()) + if (trackContainer() == Engine::patternStore()) { - bb_track = BBTrack::findBBTrack( _clip_num ); + pattern_track = PatternTrack::findPatternTrack(_clip_num); setPlaying(true); } } @@ -143,7 +150,7 @@ bool SampleTrack::play( const TimePos & _start, const fpp_t _frames, { SamplePlayHandle* smpHandle = new SamplePlayHandle( st ); smpHandle->setVolumeModel( &m_volumeModel ); - smpHandle->setBBTrack( bb_track ); + smpHandle->setPatternTrack(pattern_track); handle = smpHandle; } handle->setOffset( _offset ); @@ -241,4 +248,4 @@ void SampleTrack::setPlayingClips( bool isPlaying ) void SampleTrack::updateMixerChannel() { m_audioPort.setNextMixerChannel( m_mixerChannelModel.value() ); -} \ No newline at end of file +} diff --git a/tests/QTestSuite.h b/tests/QTestSuite.h index 05ae1fb66..e0bd164ed 100644 --- a/tests/QTestSuite.h +++ b/tests/QTestSuite.h @@ -1,7 +1,7 @@ #ifndef QTESTSUITE_H #define QTESTSUITE_H -#include +#include #include #include diff --git a/tests/main.cpp b/tests/main.cpp index 7b07778fc..b2c21b79a 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,6 +1,6 @@ #include "QTestSuite.h" -#include +#include #include diff --git a/tests/src/tracks/AutomationTrackTest.cpp b/tests/src/tracks/AutomationTrackTest.cpp index 4df159604..5adafbb0f 100644 --- a/tests/src/tracks/AutomationTrackTest.cpp +++ b/tests/src/tracks/AutomationTrackTest.cpp @@ -28,11 +28,12 @@ #include "AutomationClip.h" #include "AutomationTrack.h" -#include "BBTrack.h" -#include "BBTrackContainer.h" #include "DetuningHelper.h" #include "InstrumentTrack.h" #include "MidiClip.h" +#include "PatternClip.h" +#include "PatternTrack.h" +#include "PatternStore.h" #include "TrackContainer.h" #include "Engine.h" @@ -157,12 +158,12 @@ private slots: QCOMPARE(clip->valueAt(TimePos(4, 0)), 1.0f); } - void testBBTrack() + void testPatternTrack() { auto song = Engine::getSong(); - auto bbContainer = Engine::getBBTrackContainer(); - BBTrack bbTrack(song); - Track* automationTrack = Track::create(Track::AutomationTrack, bbContainer); + auto patternStore = Engine::patternStore(); + PatternTrack patternTrack(song); + Track* automationTrack = Track::create(Track::AutomationTrack, patternStore); QVERIFY(automationTrack->numOfClips()); AutomationClip* c1 = dynamic_cast(automationTrack->getClip(0)); @@ -175,17 +176,17 @@ private slots: c1->putValue(10, 1.0, false); c1->addObject(&model); - QCOMPARE(bbContainer->automatedValuesAt( 0, bbTrack.index())[&model], 0.0f); - QCOMPARE(bbContainer->automatedValuesAt( 5, bbTrack.index())[&model], 0.5f); - QCOMPARE(bbContainer->automatedValuesAt(10, bbTrack.index())[&model], 1.0f); - QCOMPARE(bbContainer->automatedValuesAt(50, bbTrack.index())[&model], 1.0f); + QCOMPARE(patternStore->automatedValuesAt( 0, patternTrack.patternIndex())[&model], 0.0f); + QCOMPARE(patternStore->automatedValuesAt( 5, patternTrack.patternIndex())[&model], 0.5f); + QCOMPARE(patternStore->automatedValuesAt(10, patternTrack.patternIndex())[&model], 1.0f); + QCOMPARE(patternStore->automatedValuesAt(50, patternTrack.patternIndex())[&model], 1.0f); - BBTrack bbTrack2(song); + PatternTrack patternTrack2(song); - QCOMPARE(bbContainer->automatedValuesAt(5, bbTrack.index())[&model], 0.5f); - QVERIFY(! bbContainer->automatedValuesAt(5, bbTrack2.index()).size()); + QCOMPARE(patternStore->automatedValuesAt(5, patternTrack.patternIndex())[&model], 0.5f); + QVERIFY(! patternStore->automatedValuesAt(5, patternTrack2.patternIndex()).size()); - BBClip clip(&bbTrack); + PatternClip clip(&patternTrack); clip.changeLength(TimePos::ticksPerBar() * 2); clip.movePosition(0);