From 21da0b432c0dc064f3628dc9be8ea756076ddb78 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 24 Jun 2008 22:18:43 +0000 Subject: [PATCH] * fixed wrong config.h-inclusion and deprecated macro-names from config.h/lmmsconfig.h at various places - makes Vibed plugin work again * fixed plugin-instantiation for BitInvader and Vibed * use int instead of Uint32 in graphModel * various coding-style fixes git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1169 0778d3d1-df1d-0410-868b-ea421aaaa00d --- plugins/vibed/Makefile.am | 2 +- plugins/vibed/nine_button_selector.cpp | 4 +-- plugins/vibed/nine_button_selector.h | 3 +- plugins/vibed/string_container.h | 1 - plugins/vibed/vibed.cpp | 46 ++++++++++++++++++++------ plugins/vibed/vibed.h | 7 ++-- plugins/vibed/vibrating_string.cpp | 10 +++--- plugins/vibed/vibrating_string.h | 9 ++--- 8 files changed, 49 insertions(+), 33 deletions(-) diff --git a/plugins/vibed/Makefile.am b/plugins/vibed/Makefile.am index abdd52c34..d2800b6c6 100644 --- a/plugins/vibed/Makefile.am +++ b/plugins/vibed/Makefile.am @@ -36,7 +36,7 @@ EMBEDDED_RESOURCES = $(wildcard *png) EXTRA_DIST = $(EMBEDDED_RESOURCES) -CLEANFILES = $(MOC_FILES) ./embedded_resources.h +CLEANFILES = $(MOC_FILES) ./embedded_resources.h $(DLL) diff --git a/plugins/vibed/nine_button_selector.cpp b/plugins/vibed/nine_button_selector.cpp index 95bab7906..51995776a 100644 --- a/plugins/vibed/nine_button_selector.cpp +++ b/plugins/vibed/nine_button_selector.cpp @@ -236,13 +236,13 @@ void nineButtonSelector::modelChanged( void ) updateButton( model()->value() ); } -void FASTCALL nineButtonSelector::setSelected( Uint8 _new_button ) +void nineButtonSelector::setSelected( Uint8 _new_button ) { model()->setValue(_new_button); updateButton( _new_button ); } -void FASTCALL nineButtonSelector::updateButton( Uint8 _new_button ) +void nineButtonSelector::updateButton( Uint8 _new_button ) { m_lastBtn->setChecked( FALSE ); m_lastBtn->update(); diff --git a/plugins/vibed/nine_button_selector.h b/plugins/vibed/nine_button_selector.h index 2084f804b..c8a421dae 100644 --- a/plugins/vibed/nine_button_selector.h +++ b/plugins/vibed/nine_button_selector.h @@ -24,7 +24,6 @@ #ifndef _NINE_BUTTON_SELECTOR_H #define _NINE_BUTTON_SELECTOR_H -#include "config.h" #include "types.h" #include "pixmap_button.h" @@ -55,7 +54,7 @@ public: Uint8 _default, Uint32 _x, Uint32 _y, QWidget * _parent); - ~nineButtonSelector(); + virtual ~nineButtonSelector(); // inline Uint8 getSelected() { // return( castModel()->value() ); diff --git a/plugins/vibed/string_container.h b/plugins/vibed/string_container.h index c1daf0df8..47022cebf 100644 --- a/plugins/vibed/string_container.h +++ b/plugins/vibed/string_container.h @@ -26,7 +26,6 @@ #include -#include "config.h" #include "types.h" #include "vibrating_string.h" diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 18fda8696..de877a7cc 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -117,7 +117,7 @@ vibed::vibed( instrumentTrack * instrument_track ) : harmonic = new nineButtonSelectorModel( 2, 0, 8, this ); m_harmonics.append( harmonic ); - graphTmp = new graphModel( -1.0, 1.0, m_sampleLength, this ); + graphTmp = new graphModel( -1.0, 1.0, __sampleLength, this ); graphTmp->setWaveToSine(); m_graphs.append( graphTmp ); @@ -135,8 +135,7 @@ vibed::~vibed() -void vibed::saveSettings( QDomDocument & _doc, - QDomElement & _this ) +void vibed::saveSettings( QDomDocument & _doc, QDomElement & _this ) { QString name; @@ -185,7 +184,7 @@ void vibed::saveSettings( QDomDocument & _doc, QString sampleString; base64::encode( (const char *)m_graphs[i]->samples(), - m_sampleLength * sizeof(float), + __sampleLength * sizeof(float), sampleString ); name = "graph" + QString::number( i ); _this.setAttribute( name, sampleString ); @@ -280,7 +279,7 @@ void vibed::playNote( notePlayHandle * _n, bool, sampleFrame * _working_buffer ) { _n->m_pluginData = new stringContainer( _n->frequency(), engine::getMixer()->processingSampleRate(), - m_sampleLength ); + __sampleLength ); for( Uint8 i = 0; i < 9; ++i ) { @@ -342,6 +341,8 @@ void vibed::deleteNotePluginData( notePlayHandle * _n ) } + + pluginView * vibed::instantiateView( QWidget * _parent ) { return( new vibedView( this, _parent ) ); @@ -358,7 +359,7 @@ vibedView::vibedView( instrument * _instrument, setAutoFillBackground( TRUE ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( - "artwork" ) ); + "artwork" ) ); setPalette( pal ); m_volumeKnob = new knob( knobBright_26, this ); @@ -550,7 +551,7 @@ vibedView::vibedView( instrument * _instrument, connect( m_stringSelector, SIGNAL( nineButtonSelection( Uint8 ) ), this, SLOT( showString( Uint8 ) ) ); - showString( 0 ); + showString( 0 ); // Get current graph-model graphModel * gModel = m_graph->model(); @@ -660,12 +661,16 @@ vibedView::vibedView( instrument * _instrument, } + + void vibedView::modelChanged( void ) { showString( 0 ); } + + void vibedView::showString( Uint8 _string ) { vibed * v = castModel(); @@ -686,36 +691,48 @@ void vibedView::showString( Uint8 _string ) } + + void vibedView::sinWaveClicked( void ) { m_graph->model()->setWaveToSine(); engine::getSong()->setModified(); } + + void vibedView::triangleWaveClicked( void ) { m_graph->model()->setWaveToTriangle(); engine::getSong()->setModified(); } + + void vibedView::sawWaveClicked( void ) { m_graph->model()->setWaveToSaw(); engine::getSong()->setModified(); } + + void vibedView::sqrWaveClicked( void ) { m_graph->model()->setWaveToSquare(); engine::getSong()->setModified(); } + + void vibedView::noiseWaveClicked( void ) { m_graph->model()->setWaveToNoise(); engine::getSong()->setModified(); } + + void vibedView::usrWaveClicked( void ) { // TODO: load file @@ -723,12 +740,16 @@ void vibedView::usrWaveClicked( void ) //engine::getSongEditor()->setModified(); } + + void vibedView::smoothClicked( void ) { m_graph->model()->smooth(); engine::getSong()->setModified(); } + + void vibedView::normalizeClicked( void ) { m_graph->model()->normalize(); @@ -737,6 +758,7 @@ void vibedView::normalizeClicked( void ) + void vibedView::contextMenuEvent( QContextMenuEvent * ) { @@ -748,6 +770,8 @@ void vibedView::contextMenuEvent( QContextMenuEvent * ) } + + void vibedView::displayHelp( void ) { QWhatsThis::showText( mapToGlobal( rect().bottomRight() ), @@ -759,10 +783,10 @@ extern "C" { // neccessary for getting instance out of shared lib - plugin * PLUGIN_EXPORT lmms_plugin_main( void * _data ) - { - return( new vibed( static_cast( _data ) ) ); - } +plugin * PLUGIN_EXPORT lmms_plugin_main( model *, void * _data ) +{ + return( new vibed( static_cast( _data ) ) ); +} } diff --git a/plugins/vibed/vibed.h b/plugins/vibed/vibed.h index aa1294884..694dda73c 100644 --- a/plugins/vibed/vibed.h +++ b/plugins/vibed/vibed.h @@ -39,9 +39,8 @@ class notePlayHandle; class vibed : public instrument { Q_OBJECT - public: - vibed( instrumentTrack * _channel_track ); + vibed( instrumentTrack * _instrument_track ); virtual ~vibed(); virtual void playNote( notePlayHandle * _n, bool _try_parallelizing, @@ -70,8 +69,8 @@ private: QList m_graphs; QList m_impulses; QList m_harmonics; - - static const int m_sampleLength = 128; + + static const int __sampleLength = 128; friend class vibedView; } ; diff --git a/plugins/vibed/vibrating_string.cpp b/plugins/vibed/vibrating_string.cpp index 61cb23c41..cdffd2caf 100644 --- a/plugins/vibed/vibrating_string.cpp +++ b/plugins/vibed/vibrating_string.cpp @@ -90,8 +90,7 @@ vibratingString::vibratingString( float _pitch, -vibratingString::delayLine * FASTCALL vibratingString::initDelayLine( - int _len, +vibratingString::delayLine * vibratingString::initDelayLine( int _len, int _pick ) { delayLine * dl = new vibratingString::delayLine[_len]; @@ -124,7 +123,7 @@ vibratingString::delayLine * FASTCALL vibratingString::initDelayLine( -void FASTCALL vibratingString::freeDelayLine( delayLine * _dl ) +void vibratingString::freeDelayLine( delayLine * _dl ) { if( _dl ) { @@ -136,9 +135,8 @@ void FASTCALL vibratingString::freeDelayLine( delayLine * _dl ) -void FASTCALL vibratingString::resample( float *_src, - f_cnt_t _src_frames, - f_cnt_t _dst_frames ) +void vibratingString::resample( float *_src, f_cnt_t _src_frames, + f_cnt_t _dst_frames ) { for( f_cnt_t frame = 0; frame < _dst_frames; ++frame ) { diff --git a/plugins/vibed/vibrating_string.h b/plugins/vibed/vibrating_string.h index 4f7c36a48..9efb96437 100644 --- a/plugins/vibed/vibrating_string.h +++ b/plugins/vibed/vibrating_string.h @@ -27,7 +27,6 @@ #include #include -#include "config.h" #include "types.h" class vibratingString @@ -105,11 +104,9 @@ private: sample_t * m_outsamp; - delayLine * FASTCALL initDelayLine( int _len, int _pick ); - static void FASTCALL freeDelayLine( delayLine * _dl ); - void FASTCALL resample( float *_src, - f_cnt_t _src_frames, - f_cnt_t _dst_frames ); + delayLine * initDelayLine( int _len, int _pick ); + static void freeDelayLine( delayLine * _dl ); + void resample( float *_src, f_cnt_t _src_frames, f_cnt_t _dst_frames ); /* setDelayLine initializes the string with an impulse at the pick * position unless the impulse is longer than the string, in which