From 7915537f30df0c635a7a38fd8e984836b781d726 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Sun, 8 Jun 2008 19:02:28 +0000 Subject: [PATCH] Very first implementation of peak controller git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1107 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 23 ++++ Makefile.am | 4 + configure.in | 1 + include/automatable_model.h | 1 + include/controller.h | 3 +- include/peak_controller.h | 109 +++++++++++++++ plugins/Makefile.am | 1 + plugins/peak_controller_effect/Makefile.am | 52 +++++++ plugins/peak_controller_effect/logo.png | Bin 0 -> 3225 bytes .../peak_controller_effect.cpp | 127 ++++++++++++++++++ .../peak_controller_effect.h | 67 +++++++++ .../peak_controller_effect_control_dialog.cpp | 66 +++++++++ .../peak_controller_effect_control_dialog.h | 53 ++++++++ .../peak_controller_effect_controls.cpp | 57 ++++++++ .../peak_controller_effect_controls.h | 75 +++++++++++ src/core/controller.cpp | 5 + src/core/peak_controller.cpp | 103 ++++++++++++++ src/gui/peak_controller_dialog.cpp | 114 ++++++++++++++++ 18 files changed, 860 insertions(+), 1 deletion(-) create mode 100644 include/peak_controller.h create mode 100644 plugins/peak_controller_effect/Makefile.am create mode 100644 plugins/peak_controller_effect/logo.png create mode 100644 plugins/peak_controller_effect/peak_controller_effect.cpp create mode 100644 plugins/peak_controller_effect/peak_controller_effect.h create mode 100644 plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp create mode 100644 plugins/peak_controller_effect/peak_controller_effect_control_dialog.h create mode 100644 plugins/peak_controller_effect/peak_controller_effect_controls.cpp create mode 100644 plugins/peak_controller_effect/peak_controller_effect_controls.h create mode 100644 src/core/peak_controller.cpp create mode 100644 src/gui/peak_controller_dialog.cpp diff --git a/ChangeLog b/ChangeLog index 2bb64be32..36218853b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,6 +39,29 @@ * plugins/bit_invader/bit_invader.cpp: change graph style mode when toggling interpolation + * plugins/peak_controller_effect: + * plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp: + * plugins/peak_controller_effect/peak_controller_effect.cpp: + * plugins/peak_controller_effect/logo.png: + * plugins/peak_controller_effect/peak_controller_effect_controls.cpp: + * plugins/peak_controller_effect/peak_controller_effect_control_dialog.h: + * plugins/peak_controller_effect/peak_controller_effect.h: + * plugins/peak_controller_effect/peak_controller_effect_controls.h: + * plugins/peak_controller_effect/Makefile.am: + * plugins/Makefile.am: + * include/peak_controller.h: + * include/controller.h: + * include/automatable_model.h: + * src/gui/peak_controller_dialog.cpp: + * src/core/peak_controller.cpp: + * src/core/controller.cpp: + * configure.in: + * Makefile.am: + - Very first implementation of peak-controller + - Create one by adding it in the effect-chain, then connecting a widget to + the controller + - There is no sample-exactness, smoothing, or anything like that yet + 2008-06-08 Tobias Doerffel * plugins/ladspa_effect/tap/tap_deesser.c: diff --git a/Makefile.am b/Makefile.am index d0870bbf1..f08310a92 100644 --- a/Makefile.am +++ b/Makefile.am @@ -133,6 +133,7 @@ lmms_MOC = \ ./name_label.moc \ ./nstate_button.moc \ ./pattern.moc \ + ./peak_controller.moc \ ./piano_roll.moc \ ./piano.moc \ ./pixmap_button.moc \ @@ -230,6 +231,7 @@ lmms_SOURCES = \ $(srcdir)/src/core/note.cpp \ $(srcdir)/src/core/note_play_handle.cpp \ $(srcdir)/src/core/oscillator.cpp \ + $(srcdir)/src/core/peak_controller.cpp \ $(srcdir)/src/core/piano.cpp \ $(srcdir)/src/core/plugin.cpp \ $(srcdir)/src/core/preset_preview_play_handle.cpp \ @@ -310,6 +312,7 @@ lmms_SOURCES = \ $(srcdir)/src/gui/widgets/midi_port_menu.cpp \ $(srcdir)/src/gui/widgets/name_label.cpp \ $(srcdir)/src/gui/widgets/nstate_button.cpp \ + $(srcdir)/src/gui/peak_controller_dialog.cpp \ $(srcdir)/src/gui/widgets/pixmap_button.cpp \ $(srcdir)/src/gui/widgets/project_notes.cpp \ $(srcdir)/src/gui/widgets/rubberband.cpp \ @@ -494,6 +497,7 @@ lmms_SOURCES = \ $(srcdir)/include/controller_dialog.h \ $(srcdir)/include/controller_connection_dialog.h \ $(srcdir)/include/lfo_controller.h \ + $(srcdir)/include/peak_controller.h \ $(THIRD_PARTY_CODE) lmms_includedir = $(pkgincludedir) diff --git a/configure.in b/configure.in index 15d7efed8..e38c7c7d0 100644 --- a/configure.in +++ b/configure.in @@ -726,6 +726,7 @@ AC_CONFIG_FILES([Makefile plugins/midi_import/Makefile plugins/organic/Makefile plugins/patman/Makefile + plugins/peak_controller_effect/Makefile plugins/sf2_player/Makefile plugins/singerbot/Makefile plugins/stk/Makefile diff --git a/include/automatable_model.h b/include/automatable_model.h index 88824f58b..5eb77625f 100644 --- a/include/automatable_model.h +++ b/include/automatable_model.h @@ -129,6 +129,7 @@ public: QObject::connect( m_controllerConnection, SIGNAL( valueChanged() ), this, SIGNAL( dataChanged() ) ); + emit dataChanged(); } } diff --git a/include/controller.h b/include/controller.h index 5e828080d..d4918410b 100644 --- a/include/controller.h +++ b/include/controller.h @@ -50,9 +50,10 @@ public: DummyController, LfoController, MidiController, + PeakController, /* XYController, - PeakController, + EquationController */ NumControllerTypes } ; diff --git a/include/peak_controller.h b/include/peak_controller.h new file mode 100644 index 000000000..e939c6ec9 --- /dev/null +++ b/include/peak_controller.h @@ -0,0 +1,109 @@ +/* + * lfo_controller.h - A LFO-based controller and dialog + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 _PEAK_CONTROLLER_H +#define _PEAK_CONTROLLER_H + +#include + +#include "mv_base.h" +#include "automatable_model.h" +#include "controller.h" +#include "controller_dialog.h" + +class automatableButtonGroup; +class knob; +class peakControllerEffect; + + + +class peakController : public controller +{ + Q_OBJECT +public: + peakController( model * _parent, + peakControllerEffect *_peak_effect = NULL ); + + + virtual ~peakController(); + + virtual QString publicName() const + { + return "Peak Controller"; + } + + virtual void saveSettings( QDomDocument & _doc, QDomElement & _this ); + virtual void loadSettings( const QDomElement & _this ); + virtual QString nodeName( void ) const; + +public slots: + virtual controllerDialog * createDialog( QWidget * _parent ); + +protected: + + // The internal per-controller get-value function + virtual float value( int _offset ); + + /* +slots: + void trigger(); + + */ + + peakControllerEffect * m_peakEffect; + +protected slots: + + friend class peakControllerDialog; +}; + + + +class peakControllerDialog : public controllerDialog +{ + Q_OBJECT +public: + peakControllerDialog( controller * _controller, QWidget * _parent ); + virtual ~peakControllerDialog(); + +public slots: + //void editControls( void ); + //void deletePlugin( void ); + //void displayHelp( void ); + //void closeEffects( void ); + + +signals: + + +protected: + virtual void contextMenuEvent( QContextMenuEvent * _me ); + virtual void paintEvent( QPaintEvent * _pe ); + virtual void modelChanged( void ); + + peakController * m_peakController; + +} ; + +#endif diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 8c22e2f01..3a1fa3871 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -27,6 +27,7 @@ SUBDIRS = \ midi_import \ organic \ patman \ + peak_controller_effect \ $(SF2PLAYER_DIR) \ $(SINGERBOT_DIR) \ stereo_enhancer \ diff --git a/plugins/peak_controller_effect/Makefile.am b/plugins/peak_controller_effect/Makefile.am new file mode 100644 index 000000000..9c71605d5 --- /dev/null +++ b/plugins/peak_controller_effect/Makefile.am @@ -0,0 +1,52 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + +PLUGIN_NAME = peakcontroller_effect + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/gui + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="$(PLUGIN_NAME)" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./peak_controller_effect_controls.moc + +if BUILD_WIN32 +DLL=$(PLUGIN_NAME).dll + +$(DLL): lib$(PLUGIN_NAME).la + $(CXX) *.o -L$(top_srcdir) -llmms-imp -shared -Wl,-no-undefined -o $@ $(QT_LDADD) && $(STRIP) $@ + +install-exec-hook: $(DLL) + cp $< $(pkglibdir) + rm $(pkglibdir)/lib$(PLUGIN_NAME).a $(pkglibdir)/lib$(PLUGIN_NAME).la +else +DLL= +endif + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h $(DLL) +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES= libpeakcontroller_effect.la + +libpeakcontroller_effect_la_SOURCES = peak_controller_effect.cpp \ + peak_controller_effect.h \ + peak_controller_effect_control_dialog.cpp \ + peak_controller_effect_control_dialog.h \ + peak_controller_effect_controls.cpp \ + peak_controller_effect_controls.h + +$(libpeakcontroller_effect_la_SOURCES): ./embedded_resources.h diff --git a/plugins/peak_controller_effect/logo.png b/plugins/peak_controller_effect/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..89e9f3680118931dd86f065a8f6bc0b4c631a585 GIT binary patch literal 3225 zcmV;K3}*9*P)`#WFm#_KhbhiGA@U*^o_ z?)UBYo!>dX?|kR%N`_(3mE2^y!khFt%vlIo2DuiJ53xXoA?=VokVZ)2as;qQmgTQk zRaM=vc=6&zGiJEI(qbI$Du=q8bYDa-!T4lNbqv-;`L=^Wjh{! z{PDzr0|$(OfdS*wS|X7!+S=NTZQHgPH{X17r=lo7!t?I`l?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jD6)IuRrFWo~xCo0DQ~~${2vMxIAv}p+J3=e8Y@NN4{(W-?_lCh#VCFAPQS3 z31`GHV_dxVl({NXbUM|n4cz%?-($P>HNVl_b?z@a8}_}`b0O4oTb*s8)$2s`atMx! z`7oZC;xZ?`D&|V0#1QXWCDhz6ZHvG2>~{TS<0FIXCI}_N^89&+-#8V8<7C_3kldrh zH23UcdA2LtDoI%mSPp`+Q?fB2D8Y+J8cFd41$(0O+P3hA>wX%4vbjTRibg^~6e9yk zH8ynQjMlWfQ9m=&Ym^rF6~8ST6mpt#L9Cch;rX!n;ZAQf2kSb z3lV=M89|Dup80A~N(10ac|!PhdY)8qUA3)x=|bmK^QxS)d^rxctVo8Q)QsSu8fiNn z?bv%b)^fNdajLabYfUAJwlU}#1#ah@8A@60HIBJU7rL&VUg{`-ajZ;8HLe;x-SNT3 zW6_p<|Bf9!(w1!L4;dXPW+YM{#`__m6o^lpK1ym~M+&VqCF%X#=a5q1j1hMxQ*&8U z&r9Q+?rKUQ@l0w5a9o3-iQgN>QWTLg#`FDn>bG&Rm%C + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 "controller.h" +#include "song.h" +#include "peak_controller.h" +#include "peak_controller_effect.h" + + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +extern "C" +{ + +plugin::descriptor PLUGIN_EXPORT peakcontroller_effect_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Peak Controller", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Plugin for controlling knobs with sound peaks" ), + "Paul Giblock ", + 0x0100, + plugin::Effect, + new pluginPixmapLoader( "logo" ), + NULL +} ; + +} + + + +peakControllerEffect::peakControllerEffect( + model * _parent, + const descriptor::subPluginFeatures::key * _key ) : + effect( &peakcontroller_effect_plugin_descriptor, _parent, _key ), + m_peakControls( this ) +{ + engine::getSong()->addController( new peakController( engine::getSong(), this ) ); +} + + + + +peakControllerEffect::~peakControllerEffect() +{ +} + + + +bool peakControllerEffect::processAudioBuffer( sampleFrame * _buf, + const fpp_t _frames ) +{ + peakControllerEffectControls & c = m_peakControls; + + // This appears to be used for determining whether or not to continue processing + // audio with this effect + if( !isEnabled() || !isRunning() ) + { + return( FALSE ); + } + + + // RMS: + float sum = 0; + if( c.m_muteModel.value() ) + { + for( int i = 0; i < _frames; ++i ) + { + sum += (_buf[i][0]+_buf[i][0]) * (_buf[i][1]+_buf[i][1]); + _buf[i][0] = _buf[i][1] = 0.0f; + } + } + else + { + for( int i = 0; i < _frames; ++i ) + { + sum += (_buf[i][0]+_buf[i][0]) * (_buf[i][1]+_buf[i][1]); + } + } + + m_lastSample = c.m_baseModel.value() + c.m_amountModel.value() * sqrtf( 0.5f * sum / _frames ); + + //checkGate( out_sum / _frames ); + + return( isRunning() ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * PLUGIN_EXPORT lmms_plugin_main( model * _parent, void * _data ) +{ + return( new peakControllerEffect( _parent, + static_cast( + _data ) ) ); +} + +} + diff --git a/plugins/peak_controller_effect/peak_controller_effect.h b/plugins/peak_controller_effect/peak_controller_effect.h new file mode 100644 index 000000000..ebdc6feaf --- /dev/null +++ b/plugins/peak_controller_effect/peak_controller_effect.h @@ -0,0 +1,67 @@ +/* + * stereo_matrix.h - stereo-matrix-effect-plugin + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 _PEAK_CONTROLLER_EFFECT_H +#define _PEAK_CONTROLLER_EFFECT_H + +#include + +#include "effect.h" +#include "effect_lib.h" +#include "engine.h" +#include "main_window.h" +#include "peak_controller_effect_controls.h" + +class peakControllerEffect : public effect +{ +public: + peakControllerEffect( model * parent, + const descriptor::subPluginFeatures::key * _key ); + virtual ~peakControllerEffect(); + virtual bool processAudioBuffer( sampleFrame * _buf, + const fpp_t _frames ); + + virtual effectControls * getControls( void ) + { + return &m_peakControls; + } + + float lastSample( void ) + { + return m_lastSample; + } + + +private: + peakControllerEffectControls m_peakControls; + + friend class peakControllerEffectControls; + + float m_lastSample; +} ; + + + +#endif diff --git a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp new file mode 100644 index 000000000..14205d2e8 --- /dev/null +++ b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp @@ -0,0 +1,66 @@ +/* + * stereomatrix_control_dialog.cpp - control dialog for stereoMatrix-effect + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 +#include + +#include "peak_controller_effect_control_dialog.h" +#include "peak_controller_effect_controls.h" +#include "knob.h" +#include "tempo_sync_knob.h" +#include "led_checkbox.h" + +peakControllerEffectControlDialog::peakControllerEffectControlDialog( + peakControllerEffectControls * _controls ) : + effectControlDialog( _controls ) +{ + + setFixedSize( 120, 90 ); + + const int knobY = 10; + m_baseKnob = new knob( knobBright_26, this ); + m_baseKnob->setLabel( tr( "BASE" ) ); + m_baseKnob->move( 10, knobY ); + m_baseKnob->setModel( &_controls->m_baseModel ); + m_baseKnob->setHintText( tr( "Base amount:" ) + " ", "" ); + + m_amountKnob = new knob( knobBright_26, this ); + m_amountKnob->setLabel( tr( "AMT" ) ); + m_amountKnob->move( 45, knobY ); + m_amountKnob->setModel( &_controls->m_amountModel ); + m_amountKnob->setHintText( tr( "Modulation amount:" ) + " ", "" ); + + m_decayKnob = new tempoSyncKnob( knobBright_26, this ); + m_decayKnob->setLabel( tr( "DECAY" ) ); + m_decayKnob->move( 80, knobY ); + m_decayKnob->setModel( &_controls->m_decayModel ); + m_decayKnob->setHintText( tr( "Release decay (not implemented):" ) + " ", "" ); + + m_muteLed = new ledCheckBox( "Mute", this ); + m_muteLed->move( 10, 60); + m_muteLed->setModel( &_controls->m_muteModel ); +} + diff --git a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h new file mode 100644 index 000000000..a1c56db51 --- /dev/null +++ b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h @@ -0,0 +1,53 @@ +/* + * stereomatrix_control_dialog.h - control dialog for stereoMatrix-effect + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 _PEAK_CONTROLLER_EFFECT_CONTROL_DIALOG_H +#define _PEAK_CONTROLLER_EFFECT_CONTROL_DIALOG_H + +#include "effect_control_dialog.h" + +class peakControllerEffectControls; +class knob; +class tempoSyncKnob; +class ledCheckBox; + + +class peakControllerEffectControlDialog : public effectControlDialog +{ +public: + peakControllerEffectControlDialog( peakControllerEffectControls * _controls ); + virtual ~peakControllerEffectControlDialog() + { + } + +protected: + knob * m_baseKnob; + knob * m_amountKnob; + tempoSyncKnob * m_decayKnob; + ledCheckBox * m_muteLed; + +}; + + +#endif diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp new file mode 100644 index 000000000..af04a8781 --- /dev/null +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp @@ -0,0 +1,57 @@ +/* + * stereomatrix_controls.cpp - controls for stereoMatrix-effect + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 "peak_controller_effect_controls.h" +#include "peak_controller_effect.h" + + +peakControllerEffectControls:: +peakControllerEffectControls( peakControllerEffect * _eff ) : + effectControls( _eff ), + m_effect( _eff ), + m_baseModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Base value" ) ), + m_amountModel( 1.0, -1.0, 1.0, 0.005, this, tr( "Modulation amount" ) ), + m_decayModel( 0.1, 0.01, 5.0, 0.0001, 20000.0, this, tr( "Release decay" ) ), + m_muteModel( FALSE, this, tr( "Mute output" ) ) +{ +} + + + +void peakControllerEffectControls::loadSettings( const QDomElement & _this ) +{ +} + + + + +void peakControllerEffectControls::saveSettings( QDomDocument & _doc, + QDomElement & _this ) +{ +} + + + +#include "peak_controller_effect_controls.moc" + diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.h b/plugins/peak_controller_effect/peak_controller_effect_controls.h new file mode 100644 index 000000000..2ec60cac7 --- /dev/null +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.h @@ -0,0 +1,75 @@ +/* + * stereomatrix_controls.h - controls for stereoMatrix-effect + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 _PEAK_CONTROLLER_EFFECT_CONTROLS_H +#define _PEAK_CONTROLLER_EFFECT_CONTROLS_H + +#include "effect_controls.h" +#include "peak_controller_effect_control_dialog.h" +#include "knob.h" + +class peakControllerEffect; + +class peakControllerEffectControls : public effectControls +{ + Q_OBJECT +public: + peakControllerEffectControls( peakControllerEffect( * _eff ) ); + virtual ~peakControllerEffectControls() + { + } + + virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); + virtual void loadSettings( const QDomElement & _this ); + inline virtual QString nodeName( void ) const + { + return( "peakcontrollereffectcontrols" ); + } + + virtual ch_cnt_t getControlCount( void ) + { + return( 1 ); + } + + virtual effectControlDialog * createView( void ) + { + return new peakControllerEffectControlDialog( this ); + } + + +private: + peakControllerEffect * m_effect; + + floatModel m_baseModel; + floatModel m_amountModel; + tempoSyncKnobModel m_decayModel; + boolModel m_muteModel; + + friend class peakControllerEffectControlDialog; + friend class peakControllerEffect; + +} ; + + +#endif diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 710bd5a03..f460a392a 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -37,6 +37,7 @@ #include "controller_dialog.h" #include "lfo_controller.h" #include "midi_controller.h" +#include "peak_controller.h" unsigned int controller::s_frames = 0; @@ -155,6 +156,10 @@ controller * controller::create( ControllerTypes _ct, model * _parent ) c = new lfoController( _parent ); break; + case PeakController: + c = new peakController( _parent ); + break; + case MidiController: c = new midiController( _parent ); break; diff --git a/src/core/peak_controller.cpp b/src/core/peak_controller.cpp new file mode 100644 index 000000000..09441f15e --- /dev/null +++ b/src/core/peak_controller.cpp @@ -0,0 +1,103 @@ +#ifndef SINGLE_SOURCE_COMPILE + +/* + * lfo_controller.cpp - implementation of class controller which handles + * remote-control of automatableModels + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 +#include +#include +#include + + +#include "song.h" +#include "engine.h" +#include "mixer.h" +#include "peak_controller.h" +#include "controller_dialog.h" +#include "plugins/peak_controller_effect/peak_controller_effect.h" + + +peakController::peakController( model * _parent, + peakControllerEffect * _peak_effect ) : + controller( PeakController, _parent ), + m_peakEffect( _peak_effect ) +{ +} + + + + +peakController::~peakController() +{ + // disconnects +} + + + +float peakController::value( int _offset ) +{ + if( m_peakEffect ) + { + return m_peakEffect->lastSample(); + } +} + + + + +void peakController::saveSettings( QDomDocument & _doc, QDomElement & _this ) +{ + // Probably not the best idea.. +// controller::saveSettings( _doc, _this ); +} + + + +void peakController::loadSettings( const QDomElement & _this ) +{ +// controller::loadSettings( _this ); +} + + + +QString peakController::nodeName( void ) const +{ + return( "peakcontroller" ); +} + + + +controllerDialog * peakController::createDialog( QWidget * _parent ) +{ + controllerDialog * d = new peakControllerDialog( this, _parent ); + return d; +} + + +#include "peak_controller.moc" + + +#endif + diff --git a/src/gui/peak_controller_dialog.cpp b/src/gui/peak_controller_dialog.cpp new file mode 100644 index 000000000..04fb14d34 --- /dev/null +++ b/src/gui/peak_controller_dialog.cpp @@ -0,0 +1,114 @@ +#ifndef SINGLE_SOURCE_COMPILE + +/* + * lfo_controller_dialog.cpp - per-controller-specific view for changing a + * controller's settings + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 +#include +#include +#include +#include + +#include "caption_menu.h" +#include "gui_templates.h" +#include "embed.h" +#include "engine.h" +#include "led_checkbox.h" +#include "main_window.h" +#include "tooltip.h" + + +#include "peak_controller.h" +#include "controller_dialog.h" +#include "mv_base.h" +#include "knob.h" +#include "tempo_sync_knob.h" +#include "pixmap_button.h" + +peakControllerDialog::peakControllerDialog( controller * _model, QWidget * _parent ) : + controllerDialog( _model, _parent ) +{ + setWindowTitle( tr( "PEAK" ) ); + setWindowIcon( embed::getIconPixmap( "controller" ) ); + setFixedSize( 256, 64 ); + + toolTip::add( this, tr( "LFO Controller" ) ); + + QLabel * l = new QLabel( this ); + l->setText( "Use FX's controls" ); + l->move(10, 10); + + setModel( _model ); +} + + + + +peakControllerDialog::~peakControllerDialog() +{ +} + + + +/* +void effectView::displayHelp( void ) +{ + QWhatsThis::showText( mapToGlobal( rect().bottomRight() ), + whatsThis() ); +} + + + + +void effectView::closeEffects( void ) +{ + m_subWindow->hide(); + m_show = TRUE; +} +*/ + + +void peakControllerDialog::contextMenuEvent( QContextMenuEvent * ) +{ +} + + + + +void peakControllerDialog::paintEvent( QPaintEvent * ) +{ + QPainter p( this ); +} + + + +void peakControllerDialog::modelChanged( void ) +{ + m_peakController = castModel(); +} + + +#endif