lot of bugfixes, especially in VST-support-layer and some nice new features

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@44 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-01-03 13:15:42 +00:00
parent f049e70334
commit 052224c8e2
72 changed files with 2103 additions and 871 deletions

View File

@@ -27,19 +27,22 @@
#define _AUDIO_DUMMY_H
#include "audio_device.h"
#include "micro_timer.h"
class audioDummy : public audioDevice
class audioDummy : public audioDevice, public QThread
{
public:
audioDummy( Uint32 _sample_rate, bool & _success_ful ) :
audioDevice( _sample_rate, DEFAULT_CHANNELS )
audioDevice( _sample_rate, DEFAULT_CHANNELS ),
m_quit( FALSE )
{
_success_ful = TRUE;
}
virtual ~audioDummy()
{
stopProcessing();
}
inline static QString name( void )
@@ -68,8 +71,43 @@ public:
private:
// TODO: derive from QThread and call getNextBuffer() in an
// endless loop
virtual void startProcessing( void )
{
start();
}
virtual void stopProcessing( void )
{
if( isRunning() )
{
m_quit = TRUE;
wait( 1000 );
terminate();
}
}
virtual void run( void )
{
microTimer timer;
while( m_quit == FALSE )
{
timer.reset();
processNextBuffer();
const Sint32 microseconds = static_cast<Sint32>(
mixer::inst()->framesPerAudioBuffer() *
1000000.0f /
mixer::inst()->sampleRate() -
timer.elapsed() );
if( microseconds > 0 )
{
usleep( microseconds );
}
}
}
volatile bool m_quit;
} ;

View File

@@ -72,7 +72,7 @@ public:
inline static QString name( void )
{
return( setupWidget::tr( "JACK (Jack Audio Connection Kit)" ) );
return( setupWidget::tr( "JACK (JACK Audio Connection Kit)" ) );
}

View File

@@ -55,9 +55,6 @@ public:
bbTCO( track * _track, const QColor & _c = QColor() );
virtual ~bbTCO();
virtual void FASTCALL movePosition( const midiTime & _pos );
virtual void FASTCALL changeLength( const midiTime & _length );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );

View File

@@ -2,7 +2,7 @@
* dummy_instrument.h - instrument used as fallback if an instrument couldn't
* be loaded
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -34,7 +34,7 @@ class dummyInstrument : public instrument
{
public:
inline dummyInstrument( channelTrack * _channel_track ) :
instrument( _channel_track, "Dummy instrument" )
instrument( _channel_track, NULL )
{
}

View File

@@ -1,8 +1,8 @@
/*
* dummy_plugin.h - empty plugin which is used as fallback if a plugin wasn't
* found
* dummy_plugin.h - empty plugin which is used as fallback if a plugin couldn't
* be found
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -34,7 +34,7 @@ class dummyPlugin : public plugin
{
public:
inline dummyPlugin( void ) :
plugin( "Dummy plugin", plugin::UNDEFINED )
plugin( NULL )
{
}

View File

@@ -1,7 +1,7 @@
/*
* embed.h - misc. stuff for using embedded data (resources linked into binary)
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*

77
include/fade_button.h Normal file
View File

@@ -0,0 +1,77 @@
/*
* fade_button.h - declaration of class fadeButton
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _FADE_BUTTON_H
#define _FADE_BUTTON_H
#include "qt3support.h"
#ifdef QT4
#include <QButton>
#include <QColor>
#else
#include <qbutton.h>
#include <qcolor.h>
#endif
class fadeButton : public QButton
{
Q_OBJECT
public:
fadeButton( const QColor & _normal_color, const QColor &
_activated_color, QWidget * _parent );
virtual ~fadeButton();
public slots:
void activate( void );
void reset( void );
protected:
virtual void paintEvent( QPaintEvent * _pe );
private slots:
void nextState( void );
private:
float m_state;
QColor m_normalColor;
QColor m_activatedColor;
} ;
#endif

View File

@@ -2,7 +2,7 @@
* instrument.h - declaration of class instrument, which provides a
* standard interface for all instrument plugins
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -60,7 +60,8 @@ class notePlayHandle;
class instrument : public QWidget, public plugin
{
public:
instrument( channelTrack * _channel_track, const QString & _name );
instrument( channelTrack * _channel_track,
const descriptor * _descriptor );
virtual ~instrument();
// if the plugin doesn't play each note, it can create an instrument-
@@ -68,7 +69,7 @@ public:
// output buffer only once per mixer-period
virtual void play( void );
// must be overloaded by actual plugin
// to be overloaded by actual plugin
virtual void FASTCALL playNote( notePlayHandle * note_to_play );
// needed for deleting plugin-specific-data of a note - plugin has to

View File

@@ -34,7 +34,7 @@ class instrumentPlayHandle : public playHandle
{
public:
inline instrumentPlayHandle( instrument * _instrument ) :
playHandle(),
playHandle( INSTRUMENT_PLAY_HANDLE ),
m_instrument( _instrument )
{
}

70
include/micro_timer.h Normal file
View File

@@ -0,0 +1,70 @@
/*
* micro_timer.h - simple high-precision timer
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _MICRO_TIMER
#define _MICRO_TIMER
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
class microTimer
{
public:
inline microTimer( void )
{
reset();
}
inline ~microTimer()
{
}
inline void reset( void )
{
gettimeofday( &begin, NULL );
}
inline Uint32 elapsed( void ) const
{
struct timeval now;
gettimeofday( &now, NULL );
return( ( now.tv_sec - begin.tv_sec ) * 1000 * 1000 +
( now.tv_usec - begin.tv_usec ) );
}
private:
struct timeval begin;
} ;
#endif

View File

@@ -81,7 +81,7 @@ public:
return( m_mode );
}
void setMode( modes _mode );
void FASTCALL setMode( modes _mode );
inline Sint8 inputChannel( void ) const
{

View File

@@ -2,7 +2,7 @@
* midi_tab_widget.h - tab-widget in channel-track-window for setting up
* MIDI-related stuff
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -74,11 +74,13 @@ public:
}
public slots:
void midiPortModeToggled( bool = FALSE );
protected slots:
void inputChannelChanged( int );
void outputChannelChanged( int );
void midiPortModeToggled( bool );
void readablePortsChanged( void );
void writeablePortsChanged( void );
void activatedReadablePort( QAction * _item );
@@ -99,7 +101,9 @@ private:
QMenu * m_readablePorts;
QMenu * m_writeablePorts;
friend class channelTrack;
} ;

View File

@@ -242,7 +242,7 @@ public:
}
void clear( void );
void FASTCALL clear( bool _everything = FALSE );
void FASTCALL clearAudioBuffer( sampleFrame * _ab, Uint32 _frames );

View File

@@ -2,7 +2,7 @@
* note_play_handle.h - declaration of class notePlayHandle which is needed
* by LMMS-Play-Engine
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -46,9 +46,9 @@ public:
void * m_pluginData;
basicFilters<> * m_filter;
notePlayHandle( channelTrack * _chnl_trk, Uint32 _frames_ahead,
Uint32 _frames, note * n,
bool _arp_note = FALSE ) FASTCALL;
notePlayHandle( channelTrack * _chnl_trk, const Uint32 _frames_ahead,
const Uint32 _frames, note * _n,
const bool _arp_note = FALSE ) FASTCALL;
~notePlayHandle();

View File

@@ -33,11 +33,13 @@
#include <QWidget>
#include <QVector>
#include <QPixmap>
#else
#include <qwidget.h>
#include <qvaluevector.h>
#include <qpixmap.h>
#endif
@@ -72,25 +74,38 @@ public:
}
void FASTCALL setCurrentPattern( pattern * _new_pattern );
inline bool isRecording( void ) const
{
return( m_recording );
}
inline const pattern * currentPattern( void ) const
{
return( m_pattern );
}
inline bool validPattern( void ) const
{
return( m_pattern != NULL );
}
public slots:
virtual void update( void );
protected:
void closeEvent( QCloseEvent * _ce );
void paintEvent( QPaintEvent * _pe );
void resizeEvent( QResizeEvent * _re );
void mousePressEvent( QMouseEvent * _me );
void mouseReleaseEvent( QMouseEvent * _me );
void mouseMoveEvent( QMouseEvent * _me );
void keyPressEvent( QKeyEvent * _ke );
void wheelEvent( QWheelEvent * _we );
virtual void closeEvent( QCloseEvent * _ce );
virtual void enterEvent( QEvent * _e );
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void leaveEvent( QEvent * _e );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
virtual void wheelEvent( QWheelEvent * _we );
int FASTCALL getKey( int _y );
inline void drawNoteRect( QPainter & _p, Uint16 _x, Uint16 _y,
@@ -154,6 +169,12 @@ private:
} ;
pianoRoll( void );
pianoRoll( const pianoRoll & );
~pianoRoll();
static pianoRoll * s_instanceOfMe;
static QPixmap * s_whiteKeyBigPm;
@@ -184,6 +205,9 @@ private:
QComboBox * m_zoomingComboBox;
QPixmap m_paintPixmap;
bool m_cursorInside;
pattern * m_pattern;
QScrollBar * m_leftRightScroll;
@@ -225,10 +249,6 @@ private:
bool m_scrollBack;
pianoRoll( void );
pianoRoll( const pianoRoll & );
~pianoRoll();
friend class lmmsMainWin;

View File

@@ -47,12 +47,26 @@
class playHandle
{
public:
inline playHandle( void )
enum types
{
NOTE_PLAY_HANDLE, INSTRUMENT_PLAY_HANDLE, SAMPLE_PLAY_HANDLE,
PRESET_PREVIEW_PLAY_HANDLE
} ;
inline playHandle( types _type ) :
m_type( _type )
{
}
virtual inline ~playHandle()
{
}
inline types type( void ) const
{
return( m_type );
}
virtual void play( void ) = 0;
virtual bool done( void ) const = 0;
@@ -67,6 +81,7 @@ public:
private:
types m_type;
} ;

View File

@@ -1,7 +1,7 @@
/*
* plugin.h - class plugin, the base-class and generic interface for all plugins
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -85,21 +85,25 @@ public:
} ;
// contructor of a plugin
// _name: public name of plugin
// _type: one of the plugin-types defined above
plugin( const QString & _public_name, pluginTypes _type );
plugin( const descriptor * _descriptor );
virtual ~plugin();
// returns the name, the plugin passed to plugin-constructor
inline const QString & publicName( void ) const
// returns public-name out of descriptor
inline QString publicName( void ) const
{
return( m_publicName );
return( m_descriptor->public_name );
}
// return type
// return plugin-type
inline pluginTypes type( void ) const
{
return( m_type );
return( m_descriptor->type );
}
// return plugin-descriptor for further information
inline const descriptor * getDescriptor( void ) const
{
return( m_descriptor );
}
// plugins can overload this for making other classes able to change
@@ -122,8 +126,7 @@ public:
vvector<descriptor> & _plugin_descs );
private:
const QString m_publicName;
const pluginTypes m_type;
const descriptor * m_descriptor;
// pointer to instantiation-function in plugin
typedef plugin * ( * instantiationHook )( void * );

View File

@@ -82,6 +82,7 @@ inline QString baseName( const QString & _file )
// QWidget
#define setWindowTitle setCaption
#define setWindowIcon setIcon
#define windowIcon icon
#define isExplicitlyHidden isHidden
#define accessibleName name
#define ensurePolished constPolish
@@ -116,6 +117,7 @@ inline QString baseName( const QString & _file )
// QAbstractButton/QButton
#define setCheckable setToggleButton
#define isCheckable isToggleButton
#define setShortcut setAccel

View File

@@ -72,6 +72,7 @@ public:
sampleBuffer( const QString & _audio_file = "",
bool _is_base64_data = FALSE );
sampleBuffer( const sampleFrame * _data, Uint32 _frames );
sampleBuffer( Uint32 _frames );
~sampleBuffer();
@@ -80,32 +81,40 @@ public:
mixer::inst()->framesPerAudioBuffer(),
float _freq = BASE_FREQ, bool _looped = FALSE,
void * * _resampling_data = NULL );
void FASTCALL drawWaves( QPainter & _p, QRect _dr,
drawMethods _dm = LINE_CONNECT );
inline const QString & audioFile( void ) const
{
return( m_audioFile );
}
inline Uint32 startFrame( void ) const
{
return( m_startFrame );
}
inline Uint32 endFrame( void ) const
{
return( m_endFrame );
}
inline Uint32 frames( void ) const
{
return( m_frames );
}
inline float amplification( void ) const
{
return( m_amplification );
}
inline bool reversed( void ) const
{
return( m_reversed );
}
inline const sampleFrame * data( void ) const
{
return( m_data );
@@ -118,6 +127,21 @@ public:
QString toBase64( void ) const;
static sampleBuffer * FASTCALL resample( sampleFrame * _data,
const Uint32 _frames,
const Uint32 _src_sr,
const Uint32 _dst_sr );
static inline sampleBuffer * FASTCALL resample(
sampleBuffer * _buf,
const Uint32 _src_sr,
const Uint32 _dst_sr )
{
return( resample( _buf->m_data, _buf->m_frames, _src_sr,
_dst_sr ) );
}
public slots:
void setAudioFile( const QString & _audio_file );
void loadFromBase64( const QString & _data );
@@ -132,15 +156,18 @@ private:
#ifdef SDL_SDL_SOUND_H
Uint32 FASTCALL decodeSampleSDL( const char * _f, Sint16 * & _buf,
Uint8 & _channels );
Uint8 & _channels,
Uint32 & _sample_rate );
#endif
#ifdef HAVE_SNDFILE_H
Uint32 FASTCALL decodeSampleSF( const char * _f, Sint16 * & _buf,
Uint8 & _channels );
Uint8 & _channels,
Uint32 & _sample_rate );
#endif
#ifdef HAVE_VORBIS_VORBISFILE_H
Uint32 FASTCALL decodeSampleOGG( const char * _f, Sint16 * & _buf,
Uint8 & _channels );
Uint32 FASTCALL decodeSampleOGGVorbis( const char * _f, Sint16 * & _buf,
Uint8 & _channels,
Uint32 & _sample_rate );
#endif
QString m_audioFile;

View File

@@ -43,6 +43,7 @@
class toolButton : public QToolButton
{
Q_OBJECT
public:
toolButton( const QPixmap & _pixmap, const QString & _tooltip,
QObject * _receiver, const char * _slot,
@@ -57,7 +58,7 @@ public:
leaveEvent( NULL );
}
~toolButton();
virtual ~toolButton();
inline void setStandardColor( const QColor & _color )
{
@@ -82,6 +83,10 @@ protected:
virtual void leaveEvent( QEvent * _ev );
private slots:
void toggledBool( bool _on );
private:
static const QColor s_stdColor;
static const QColor s_hlColor;

View File

@@ -58,6 +58,7 @@
class QMenu;
class QPushButton;
class pixmapButton;
class textFloat;
@@ -66,7 +67,7 @@ class trackContainer;
class trackContentWidget;
class trackWidget;
typedef QWidget trackOperationsWidget;
typedef QWidget trackSettingsWidget;
@@ -111,12 +112,13 @@ protected:
virtual void constructContextMenu( QMenu * )
{
}
virtual void contextMenuEvent( QContextMenuEvent * _cme );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void leaveEvent( QEvent * _e );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
void setAutoResizeEnabled( bool _e = FALSE );
@@ -203,20 +205,39 @@ private:
class trackSettingsWidget : public QWidget
class trackOperationsWidget : public QWidget
{
Q_OBJECT
public:
trackSettingsWidget( trackWidget * _parent );
~trackSettingsWidget();
trackOperationsWidget( trackWidget * _parent );
~trackOperationsWidget();
bool muted( void ) const;
public slots:
void setMuted( bool _muted );
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
private slots:
void cloneTrack( void );
void removeTrack( void );
void muteBtnRightClicked( void );
private:
static QPixmap * s_grip;
trackWidget * m_trackWidget;
QPushButton * m_trackOps;
pixmapButton * m_muteBtn;
} ;
@@ -242,6 +263,12 @@ public:
return( m_track );
}
inline const trackOperationsWidget & getTrackOperationsWidget( void )
const
{
return( m_trackOperationsWidget );
}
inline const trackSettingsWidget & getTrackSettingsWidget( void ) const
{
return( m_trackSettingsWidget );
@@ -252,6 +279,11 @@ public:
return( m_trackContentWidget );
}
inline trackOperationsWidget & getTrackOperationsWidget( void )
{
return( m_trackOperationsWidget );
}
inline trackSettingsWidget & getTrackSettingsWidget( void )
{
return( m_trackSettingsWidget );
@@ -262,22 +294,22 @@ public:
return( m_trackContentWidget );
}
bool muted( void ) const;
bool isMovingTrack( void ) const
{
return( m_movingTrack );
}
public slots:
void changePosition( const midiTime & _new_pos = -1 );
void cloneTrack( void );
void removeTrack( void );
void moveTrackUp( void );
void moveTrackDown( void );
void setMuted( bool _muted );
void muteBtnRightClicked( void );
protected:
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
@@ -291,7 +323,8 @@ private:
trackSettingsWidget m_trackSettingsWidget;
trackContentWidget m_trackContentWidget;
pixmapButton * m_muteBtn;
bool m_movingTrack;
Sint16 m_initialMouseX;
} ;
@@ -324,9 +357,15 @@ public:
inline bool muted( void ) const
{
return( m_trackWidget->muted() );
return( m_trackWidget->getTrackOperationsWidget().muted() );
}
inline void setMuted( bool _muted )
{
m_trackWidget->getTrackOperationsWidget().setMuted( _muted );
}
// pure virtual functions
virtual trackTypes type( void ) const = 0;

View File

@@ -55,28 +55,35 @@ class trackContainer : public QMainWindow, public settings
{
Q_OBJECT
public:
trackContainer();
trackContainer( void );
~trackContainer();
inline QWidget * containerWidget( void )
{
return( m_scrollArea );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline float pixelsPerTact( void ) const
{
return( m_ppt );
}
inline const midiTime & currentPosition( void ) const
{
return( m_currentPosition );
}
virtual bool fixedTCOs( void ) const
{
return( FALSE );
}
unsigned int FASTCALL countTracks( track::trackTypes _tt =
track::TOTAL_TRACK_TYPES ) const;
@@ -92,6 +99,8 @@ public:
void FASTCALL moveTrackDown( track * _track );
void FASTCALL realignTracks( bool _complete_update = FALSE );
const trackWidget * trackWidgetAt( const int _y ) const;
protected:
virtual void dragEnterEvent( QDragEnterEvent * _dee );

View File

@@ -6,7 +6,7 @@
* 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
* 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.
*