* 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
This commit is contained in:
Tobias Doerffel
2008-06-24 22:18:43 +00:00
parent 161e5265dc
commit 21da0b432c
8 changed files with 49 additions and 33 deletions

View File

@@ -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)

View File

@@ -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();

View File

@@ -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<nineButtonSelectorModel>()->value() );

View File

@@ -26,7 +26,6 @@
#include <QtCore/QVector>
#include "config.h"
#include "types.h"
#include "vibrating_string.h"

View File

@@ -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<vibed>();
@@ -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<instrumentTrack *>( _data ) ) );
}
plugin * PLUGIN_EXPORT lmms_plugin_main( model *, void * _data )
{
return( new vibed( static_cast<instrumentTrack *>( _data ) ) );
}
}

View File

@@ -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<graphModel*> m_graphs;
QList<boolModel*> m_impulses;
QList<nineButtonSelectorModel*> m_harmonics;
static const int m_sampleLength = 128;
static const int __sampleLength = 128;
friend class vibedView;
} ;

View File

@@ -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 )
{

View File

@@ -27,7 +27,6 @@
#include <stdio.h>
#include <stdlib.h>
#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