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 000000000..89e9f3680 Binary files /dev/null and b/plugins/peak_controller_effect/logo.png differ diff --git a/plugins/peak_controller_effect/peak_controller_effect.cpp b/plugins/peak_controller_effect/peak_controller_effect.cpp new file mode 100644 index 000000000..bbdf999de --- /dev/null +++ b/plugins/peak_controller_effect/peak_controller_effect.cpp @@ -0,0 +1,127 @@ +/* + * stereo_matrix.cpp - 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. + * + */ + + +#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