heavy improvements on mixer-system and GUI

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@26 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2005-12-05 12:26:16 +00:00
parent ab719618f7
commit 614b106752
79 changed files with 1429 additions and 1445 deletions

View File

@@ -48,7 +48,7 @@ class lcdSpinBox;
class QLineEdit;
class audioALSA : public audioDevice
class audioALSA : public audioDevice, public QThread
{
public:
audioALSA( Uint32 _sample_rate, bool & _success_ful );
@@ -79,9 +79,9 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_gain );
virtual void startProcessing( void );
virtual void stopProcessing( void );
virtual void run( void );
int FASTCALL setHWParams( Uint32 _sample_rate, Uint32 _channels,
snd_pcm_access_t _access );
@@ -98,6 +98,7 @@ private:
snd_pcm_sw_params_t * m_swParams;
bool m_littleEndian;
volatile bool m_quit;
} ;

View File

@@ -32,11 +32,13 @@
#include <QPair>
#include <QMutex>
#include <QThread>
#else
#include <qpair.h>
#include <qmutex.h>
#include <qthread.h>
#endif
@@ -74,12 +76,6 @@ public:
m_devMutex.unlock();
}
// called by mixer for writing final output-buffer with given sample-
// rate and master-gain
void FASTCALL writeBuffer( surroundSampleFrame * _ab, Uint32 _frames,
Uint32 _src_sample_rate,
float _master_gain );
// if audio-driver supports ports, classes inherting audioPort
// (e.g. channel-tracks) can register themselves for making
@@ -87,7 +83,7 @@ public:
// them at a specific port - currently only supported by JACK
virtual void registerPort( audioPort * _port );
virtual void unregisterPort( audioPort * _port );
virtual void renamePort( audioPort * _port, const QString & _name );
virtual void renamePort( audioPort * _port );
inline Uint32 sampleRate( void ) const
@@ -100,6 +96,15 @@ public:
return( m_channels );
}
void processNextBuffer( void );
virtual void startProcessing( void )
{
}
virtual void stopProcessing( void )
{
}
class setupWidget : public tabWidget
@@ -122,10 +127,16 @@ public:
protected:
// to be implemented by audio-driver - last step in a mixer period
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
// subclasses can overload this for being used in conjunction with
// processNextBuffer()
virtual void FASTCALL writeBuffer( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_gain ) = 0;
float _master_gain )
{
}
// called by according driver for fetching new sound-data
Uint32 FASTCALL getNextBuffer( surroundSampleFrame * _ab );
// convert a given audio-buffer to a buffer in signed 16-bit samples
// returns num of bytes in outbuf
@@ -139,7 +150,8 @@ protected:
Uint32 _frames );
// resample given buffer from samplerate _src_src to samplerate _dst_src
void FASTCALL resample( surroundSampleFrame * _src, Uint32 _frames,
void FASTCALL resample( const surroundSampleFrame * _src,
Uint32 _frames,
surroundSampleFrame * _dst,
Uint32 _src_sr, Uint32 _dst_sr );
@@ -159,6 +171,8 @@ private:
SRC_STATE * m_srcState;
#endif
surroundSampleFrame * m_buffer;
} ;

View File

@@ -68,13 +68,8 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame *,
Uint32 /*_frames*/, float )
{
//usleep( (Uint32)( _frames * 1000.0f * 1000.0f /
// DEFAULT_SAMPLE_RATE ) );
}
// TODO: derive from QThread and call getNextBuffer() in an
// endless loop
} ;

View File

@@ -54,6 +54,7 @@ public:
virtual ~audioFileDevice();
protected:
int FASTCALL writeData( const void * _data, int _len );
void seekToBegin( void );

View File

@@ -48,7 +48,7 @@ public:
Uint16 _min_bitrate, Uint16 _max_bitrate );
~audioFileOgg();
static audioDevice * getInst( Uint32 _sample_rate, Uint32 _channels,
static audioFileDevice * getInst( Uint32 _sample_rate, Uint32 _channels,
bool & _success_ful,
const QString & _file,
bool _use_vbr,
@@ -63,7 +63,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
virtual void FASTCALL writeBuffer( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_gain );

View File

@@ -41,7 +41,7 @@ public:
Uint16 _min_bitrate, Uint16 _max_bitrate );
virtual ~audioFileWave();
static audioDevice * getInst( Uint32 _sample_rate, Uint32 _channels,
static audioFileDevice * getInst( Uint32 _sample_rate, Uint32 _channels,
bool & _success_ful,
const QString & _file, bool _use_vbr,
Uint16 _nom_bitrate,
@@ -56,7 +56,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
virtual void FASTCALL writeBuffer( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_gain );
@@ -83,8 +83,6 @@ private:
Uint32 data_bytes; // total size of sample-data
} m_waveFileHeader;
//outputSampleType * m_outputBuffer;
} ;

View File

@@ -44,12 +44,14 @@
#include <QMutex>
#include <QVector>
#include <QList>
#include <QMap>
#else
#include <qmutex.h>
#include <qvaluevector.h>
#include <qvaluelist.h>
#include <qmap.h>
#endif
@@ -90,34 +92,38 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_gain );
virtual void startProcessing( void );
virtual void stopProcessing( void );
virtual void registerPort( audioPort * _port );
virtual void unregisterPort( audioPort * _port );
virtual void renamePort( audioPort * _port, const QString & _name );
virtual void renamePort( audioPort * _port );
static int processCallback( jack_nframes_t _nframes, void * _udata );
static int bufSizeCallback( jack_nframes_t _nframes, void * _udata );
static void shutdownCallback( void * _udata );
jack_client_t * m_client;
bool m_stopped;
QMutex m_processCallbackMutex;
vvector<jack_port_t *> m_outputPorts;
struct bufset
surroundSampleFrame * m_outBuf;
Uint32 m_framesDoneInCurBuf;
Uint32 m_framesToDoInCurBuf;
struct stereoPort
{
sampleType * buf;
Uint32 frames;
jack_port_t * ports[2];
} ;
vlist<vvector<bufset> > m_bufferSets;
Uint32 m_framesDoneInCurBuf;
volatile Uint32 m_frameSync;
Uint32 m_jackBufSize;
QMutex m_bufMutex;
typedef QMap<audioPort *, stereoPort> jackPortMap;
jackPortMap m_portMap;
} ;

View File

@@ -44,7 +44,7 @@ class lcdSpinBox;
class QLineEdit;
class audioOSS : public audioDevice
class audioOSS : public audioDevice, public QThread
{
public:
audioOSS( Uint32 _sample_rate, bool & _success_ful );
@@ -74,13 +74,14 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_gain );
virtual void startProcessing( void );
virtual void stopProcessing( void );
virtual void run( void );
int m_audioFD;
bool m_convertEndian;
volatile bool m_quit;
} ;

View File

@@ -80,6 +80,11 @@ public:
m_nextFxChannel = _chnl;
}
const QString & name( void ) const
{
return( m_name );
}
void setName( const QString & _new_name );
enum bufferUsages
@@ -94,6 +99,8 @@ private:
bool m_extOutputEnabled;
fxChnl m_nextFxChannel;
QString m_name;
} ;

View File

@@ -62,7 +62,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
virtual void FASTCALL writeBuffer( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_gain );

View File

@@ -37,18 +37,6 @@
#endif
#include "qt3support.h"
#ifdef QT4
#include <QMutex>
#else
#include <qmutex.h>
#endif
#include SDL_SDL_H
#include SDL_SDL_AUDIO_H
@@ -87,20 +75,14 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_gain );
void clearBuffer( void );
virtual void startProcessing( void );
virtual void stopProcessing( void );
static void sdlAudioCallback( void * _udata, Uint8 * _buf, int _len );
SDL_AudioSpec m_audioHandle;
outputSampleType * m_buffer;
QMutex m_bufMutex;
QMutex m_callbackMutex;
surroundSampleFrame * m_outBuf;
bool m_convertEndian;

View File

@@ -33,7 +33,7 @@
#include "lmms_main_win.h"
class pixmapButton;
class toolButton;
class songEditor;
class QPixmap;
@@ -88,8 +88,6 @@ protected:
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void resizeEvent( QResizeEvent * _re );
void updateBackground( void );
protected slots:
void play( void );
@@ -105,10 +103,11 @@ private:
static bbEditor * s_instanceOfMe;
static QPixmap * s_titleArtwork;
pixmapButton * m_playButton;
pixmapButton * m_stopButton;
QWidget * m_toolBar;
toolButton * m_playButton;
toolButton * m_stopButton;
friend class songEditor;

View File

@@ -27,10 +27,11 @@
#include "types.h"
class audioDevice;
class audioFileDevice;
typedef audioDevice * ( * getDeviceInst)( Uint32 _sample_rate,
typedef audioFileDevice * ( * getDeviceInst)( Uint32 _sample_rate,
Uint32 _channels,
bool & _success_ful,
const QString & _file,
@@ -48,6 +49,7 @@ enum fileTypes
} ;
struct fileEncodeDevice
{
fileTypes m_fileType;
@@ -56,6 +58,7 @@ struct fileEncodeDevice
getDeviceInst m_getDevInst;
} ;
extern fileEncodeDevice fileEncodeDevices[];

View File

@@ -62,7 +62,6 @@ class exportProjectDialog : public QDialog
public:
exportProjectDialog( const QString & _file_name, QWidget * _parent );
~exportProjectDialog();
void FASTCALL updateProgressBar( int _new_val );
public slots:
@@ -77,10 +76,16 @@ protected:
private slots:
void changedType( const QString & );
void cancelBtnClicked( void );
void redrawProgressBar( void );
private:
void finishProjectExport( void );
void abortProjectExport( void );
static fileTypes FASTCALL getFileTypeFromExtension( const QString &
_ext );
static Sint16 s_availableBitrates[];
QString m_fileName;
QLabel * m_typeLbl;
QComboBox * m_typeCombo;
@@ -92,20 +97,9 @@ private:
QPushButton * m_exportBtn;
QPushButton * m_cancelBtn;
QProgressBar * m_exportProgressBar;
fileTypes m_fileType;
bool m_deleteFile;
int m_oldProgressVal;
int m_progressVal;
QTimer * m_progressBarUpdateTimer;
static Sint16 s_availableBitrates[];
void finishProjectExport( void );
void abortProjectExport( void );
static fileTypes FASTCALL getFileTypeFromExtension( const QString &
_ext );
} ;

View File

@@ -58,7 +58,7 @@ struct pollfd;
class QLineEdit;
class midiALSARaw : public midiRawClient, public QThread
class midiALSARaw : public midiClientRaw, public QThread
{
public:
midiALSARaw( void );
@@ -74,7 +74,7 @@ public:
}
class setupWidget : public midiRawClient::setupWidget
class setupWidget : public midiClientRaw::setupWidget
{
public:
setupWidget( QWidget * _parent );

View File

@@ -102,15 +102,14 @@ protected:
const Uint8 RAW_MIDI_PARSE_BUF_SIZE = 16;
class midiRawClient : public midiClient
class midiClientRaw : public midiClient
{
public:
midiRawClient( void );
~midiRawClient();
midiClientRaw( void );
virtual ~midiClientRaw();
protected:

View File

@@ -32,11 +32,11 @@
#include "tab_widget.h"
class midiDummy : public midiRawClient
class midiDummy : public midiClientRaw
{
public:
midiDummy() :
midiRawClient()
midiClientRaw()
{
}
~midiDummy()
@@ -53,7 +53,7 @@ public:
{
public:
setupWidget( QWidget * _parent ) :
midiRawClient::setupWidget( midiDummy::name(), _parent )
midiClientRaw::setupWidget( midiDummy::name(), _parent )
{
}

View File

@@ -40,7 +40,7 @@
class QLineEdit;
class midiOSS : public midiRawClient, public QThread
class midiOSS : public midiClientRaw, public QThread
{
public:
midiOSS( void );
@@ -55,7 +55,7 @@ public:
}
class setupWidget : public midiRawClient::setupWidget
class setupWidget : public midiClientRaw::setupWidget
{
public:
setupWidget( QWidget * _parent );

View File

@@ -34,14 +34,12 @@
#ifdef QT4
#include <QThread>
#include <QMutex>
#include <QVector>
#else
#include <qobject.h>
#include <qthread.h>
#include <qmutex.h>
#include <qvaluevector.h>
@@ -104,11 +102,7 @@ const octaves BASE_OCTAVE = OCTAVE_4;
class mixer :
#ifndef QT4
public QObject,
#endif
public QThread
class mixer : public QObject
{
Q_OBJECT
public:
@@ -202,20 +196,20 @@ public:
inline int sampleRate( void )
inline Uint32 sampleRate( void )
{
return( SAMPLE_RATES[m_qualityLevel] );
}
inline float masterOutput( void ) const
inline float masterGain( void ) const
{
return( m_masterOutput );
return( m_masterGain );
}
inline void setMasterOutput( float _mo )
inline void setMasterGain( float _mo )
{
m_masterOutput = _mo;
m_masterGain = _mo;
}
@@ -235,12 +229,12 @@ public:
void pause( void )
{
m_safetySyncMutex.lock();
m_mixMutex.lock();
}
void play( void )
{
m_safetySyncMutex.unlock();
m_mixMutex.unlock();
}
@@ -259,6 +253,8 @@ public:
}
const surroundSampleFrame * renderNextBuffer( void );
public slots:
void setHighQuality( bool _hq_on = FALSE );
@@ -275,7 +271,7 @@ private:
mixer();
~mixer();
void quitThread( void );
void stopProcessing( void );
// we don't allow to create mixer by using copy-ctor
@@ -283,7 +279,6 @@ private:
{
}
virtual void run( void );
audioDevice * tryAudioDevices( void );
@@ -292,11 +287,6 @@ private:
void processBuffer( surroundSampleFrame * _buf, fxChnl _fx_chnl );
/* sampleFrame * m_silence;
#ifndef DISABLE_SURROUND
surroundSampleFrame * m_surroundSilence;// cool, silence in surround ;-)
#endif*/
vvector<audioPort *> m_audioPorts;
@@ -305,16 +295,16 @@ private:
surroundSampleFrame * m_curBuf;
surroundSampleFrame * m_nextBuf;
bool m_discardCurBuf;
/* bool m_discardCurBuf;*/
playHandleVector m_playHandles;
playHandleVector m_playHandlesToRemove;
Uint8 m_qualityLevel;
volatile float m_masterOutput;
volatile float m_masterGain;
volatile bool m_quit;
/* volatile bool m_quit;*/
audioDevice * m_audioDev;
@@ -326,8 +316,8 @@ private:
QString m_midiClientName;
QMutex m_safetySyncMutex;
QMutex m_devMutex;
QMutex m_mixMutex;
/* QMutex m_devMutex;*/
friend class lmmsMainWin;

View File

@@ -34,14 +34,14 @@
#ifdef QT4
#include <QWidget>
#include <QPushButton>
#include <QPixmap>
#include <QVector>
#include <QPair>
#else
#include <qwidget.h>
#include <qpushbutton.h>
#include <qpixmap.h>
#include <qvaluevector.h>
#include <qpair.h>
@@ -49,7 +49,7 @@
#endif
class nStateButton : public QWidget
class nStateButton : public QPushButton
{
Q_OBJECT
public:
@@ -73,11 +73,11 @@ public slots:
signals:
void stateChanged( int _n );
void changedState( int _n );
protected:
virtual void paintEvent( QPaintEvent * _pe );
/* virtual void paintEvent( QPaintEvent * _pe );*/
virtual void mousePressEvent( QMouseEvent * _me );

View File

@@ -53,12 +53,9 @@
class channelTrack;
class sampleBuffer;
class audioSampleRecorder;
class QTimer;
class QProgressBar;
class QPushButton;
class QPixmap;
class patternFreezeStatusDialog;
@@ -72,7 +69,7 @@ class pattern : public trackContentObject
public:
enum patternTypes
{
BEAT_PATTERN, MELODY_PATTERN/*, EVENT_PATTERN*/
BEAT_PATTERN, MELODY_PATTERN/*, AUTOMATION_PATTERN*/
} ;
pattern( channelTrack * _channel_track );
@@ -83,9 +80,13 @@ public:
virtual midiTime length( void ) const;
note * FASTCALL addNote( const note & _new_note );
void FASTCALL removeNote( const note * _note_to_del );
note * FASTCALL rearrangeNote( const note * _note_to_proc );
void clearNotes( void );
inline noteVector & notes( void )
@@ -98,32 +99,39 @@ public:
return( m_patternType );
}
void FASTCALL setType( patternTypes _new_pattern_type );
inline const QString & name( void ) const
{
return( m_name );
}
inline void setName( const QString & _name )
{
m_name = _name;
update();
}
inline channelTrack * getChannelTrack( void )
{
return( m_channelTrack );
}
// functions which are part of freezing-feature
inline bool freezing( void ) const
{
return( m_freezing );
}
inline bool frozen( void ) const
{
return( m_frozenPattern != NULL );
}
void FASTCALL playFrozenData( sampleFrame * _ab, Uint32 _start_frame,
Uint32 _frames );
inline bool isFreezing( void ) const
{
return( m_freezeRecorder != NULL );
}
void finishFreeze( void );
note * FASTCALL noteAt( int _note_num );
@@ -147,7 +155,6 @@ protected slots:
void changeName( void );
void freeze( void );
void unfreeze( void );
void updateFreezeStatusDialog( void );
void abortFreeze( void );
@@ -177,9 +184,9 @@ private:
QMutex m_frozenPatternMutex;
sampleBuffer * m_frozenPattern;
audioSampleRecorder * m_freezeRecorder;
patternFreezeStatusDialog * m_freezeStatusDialog;
QTimer * m_freezeStatusUpdateTimer;
bool m_freezing;
volatile bool m_freezeAborted;
} ;

View File

@@ -50,10 +50,9 @@ class QPainter;
class QPixmap;
class QScrollBar;
class crystalButton;
class toolButton;
class pattern;
class notePlayHandle;
class pixmapButton;
class timeLine;
class lmmsMainWin;
@@ -112,10 +111,10 @@ protected slots:
void horScrolled( int _new_pos );
void verScrolled( int _new_pos );
void drawButtonToggled( bool = FALSE );
void eraseButtonToggled( bool = FALSE );
void selectButtonToggled( bool = FALSE );
void moveButtonToggled( bool = FALSE );
void drawButtonToggled( void );
void eraseButtonToggled( void );
void selectButtonToggled( void );
void moveButtonToggled( void );
void copySelectedNotes( void );
void cutSelectedNotes( void );
@@ -160,8 +159,6 @@ private:
static QPixmap * s_whiteKeyBigPm;
static QPixmap * s_whiteKeySmallPm;
static QPixmap * s_artwork1;
static QPixmap * s_artwork2;
static QPixmap * s_blackKeyPm;
static QPixmap * s_toolDraw;
static QPixmap * s_toolErase;
@@ -171,18 +168,20 @@ private:
static pianoRollKeyTypes prKeyOrder[];
pixmapButton * m_playButton;
pixmapButton * m_recordButton;
pixmapButton * m_stopButton;
QWidget * m_toolBar;
crystalButton * m_drawButton;
crystalButton * m_eraseButton;
crystalButton * m_selectButton;
crystalButton * m_moveButton;
toolButton * m_playButton;
toolButton * m_recordButton;
toolButton * m_stopButton;
crystalButton * m_cutButton;
crystalButton * m_copyButton;
crystalButton * m_pasteButton;
toolButton * m_drawButton;
toolButton * m_eraseButton;
toolButton * m_selectButton;
toolButton * m_moveButton;
toolButton * m_cutButton;
toolButton * m_copyButton;
toolButton * m_pasteButton;
QComboBox * m_zoomingComboBox;

View File

@@ -52,6 +52,14 @@ typedef int csize;
#define vvector QVector
#define vlist QList
#include <QFileInfo>
inline QString baseName( const QString & _file )
{
return( QFileInfo( _file ).absolutePath() + "/" +
QFileInfo( _file ).completeBaseName() );
}
#else
@@ -73,7 +81,6 @@ typedef int csize;
// QMenu/QPopupMenu
#define addAction insertItem
//#define addSeparator insertSeparator
// QFile/QIODevice
@@ -115,15 +122,8 @@ typedef int csize;
#define setTextVisible setPercentageVisible
// QFileInfo
//#define completeSuffix extension
//#define suffix() extension( FALSE )
// QComboBox
#define addItem insertItem
//#define currentIndex currentItem
//#define setCurrentIndex setCurrentItem
// QString
@@ -148,7 +148,6 @@ typedef int csize;
#define NoFilter DefaultFilter
#define homePath homeDirPath
#define rootPath rootDirPath
//#define absolutePath absPath
// QToolButton
@@ -178,6 +177,17 @@ typedef unsigned int csize;
#endif
#include <qfileinfo.h>
inline QString baseName( const QString & _file )
{
return( QFileInfo( _file ).dirPath() + "/" +
QFileInfo( _file ).baseName( TRUE ) );
}
#if QT_VERSION < 0x030100
#include <qmutex.h>

View File

@@ -40,7 +40,6 @@
#endif
#include "lmms_main_win.h"
#include "track_container.h"
#include "types.h"
@@ -48,20 +47,18 @@
class QComboBox;
class QLabel;
class QPixmap;
class QPushButton;
class QScrollBar;
class QSlider;
class QToolButton;
class exportProjectDialog;
class lcdSpinBox;
class lmmsMainWin;
class pattern;
class projectNotes;
class timeLine;
class toolButton;
class visualizationWidget;
const int MIN_BPM = 10;
const int DEFAULT_BPM = 140;
const int MAX_BPM = 999;
@@ -142,19 +139,20 @@ public:
return( m_exporting == TRUE &&
m_playPos[PLAY_SONG].getTact() >= lengthInTacts() + 1 );
}
inline void setExportProjectDialog( exportProjectDialog * _epd )
{
m_epd = _epd;
}
inline playModes playMode( void ) const
{
return( m_playMode );
}
inline playPos & getPlayPos( playModes _pm )
{
return( m_playPos[_pm] );
}
tact lengthInTacts( void ) const;
int getBPM( void );
// every function that replaces current file (e.g. creates new file,
@@ -228,8 +226,8 @@ protected:
protected slots:
void insertTact( void );
void removeTact( void );
void insertBar( void );
void removeBar( void );
void addBBTrack( void );
void addSampleTrack( void );
void scrolled( int _new_pos );
@@ -243,7 +241,6 @@ protected slots:
void masterPitchPressed( void );
void masterPitchMoved( int _new_val );
void masterPitchReleased( void );
void toggleHQMode( void );
void updatePosition( const midiTime & _t );
@@ -264,7 +261,6 @@ private:
}
midiTime length( void ) const;
tact lengthInTacts( void ) const;
inline tact64th currentTact64th( void ) const
{
return( m_playPos[m_playMode].getTact64th() );
@@ -278,8 +274,10 @@ private:
QScrollBar * m_leftRightScroll;
QToolButton * m_playButton;
QToolButton * m_stopButton;
QWidget * m_toolBar;
toolButton * m_playButton;
toolButton * m_stopButton;
lcdSpinBox * m_bpmSpinBox;
QSlider * m_masterVolumeSlider;
@@ -288,11 +286,10 @@ private:
visualizationWidget * m_masterOutputGraph;
QToolButton * m_addChannelTrackButton;
QToolButton * m_addBBTrackButton;
QToolButton * m_addSampleTrackButton;
QToolButton * m_insertTactButton;
QToolButton * m_removeTactButton;
toolButton * m_addBBTrackButton;
toolButton * m_addSampleTrackButton;
toolButton * m_insertBarButton;
toolButton * m_removeBarButton;
QComboBox * m_zoomingComboBox;
@@ -314,8 +311,6 @@ private:
bool m_scrollBack;
exportProjectDialog * m_epd;
projectNotes * m_projectNotes;
@@ -336,7 +331,7 @@ private:
friend lmmsMainWin::~lmmsMainWin();
friend class lmmsMainWin;

View File

@@ -50,6 +50,22 @@ class timeLine : public QWidget
{
Q_OBJECT
public:
enum autoScrollStates
{
AUTOSCROLL_ENABLED, AUTOSCROLL_DISABLED
} ;
enum loopPointStates
{
LOOP_POINTS_DISABLED, LOOP_POINTS_ENABLED
} ;
enum behaviourAtStopStates
{
BACK_TO_ZERO, BACK_TO_START, KEEP_STOP_POSITION
} ;
timeLine( int _xoff, int _yoff, float _ppt, songEditor::playPos & _pos,
const midiTime & _begin, QWidget * _parent );
~timeLine();
@@ -59,15 +75,16 @@ public:
return( m_pos );
}
enum behaviourAtStopStates
behaviourAtStopStates behaviourAtStop( void ) const
{
BACK_TO_ZERO, BACK_TO_START, KEEP_STOP_POSITION
} ;
return( m_behaviourAtStop );
}
bool loopPointsEnabled( void ) const
{
return( m_loopPoints == LOOP_POINTS_ENABLED );
}
behaviourAtStopStates behaviourAtStop( void ) const;
bool loopPointsEnabled( void ) const;
inline const midiTime & loopBegin( void ) const
{
return( ( m_loopPos[0] < m_loopPos[1] ) ?
@@ -94,10 +111,14 @@ public:
update();
}
void addToolButtons( QWidget * _tool_bar );
public slots:
void updatePosition( const midiTime & = 0 );
void toggleAutoScroll( int _n );
void toggleLoopPoints( int _n );
void toggleBehaviourAtStop( int _n );
protected:
@@ -114,14 +135,14 @@ private:
m_ppt / 64.0f ) );
}
static QPixmap * s_timeLinePixmap;
static QPixmap * s_posMarkerPixmap;
static QPixmap * s_loopPointPixmap;
static QPixmap * s_loopPointDisabledPixmap;
nStateButton * m_autoScroll;
nStateButton * m_loopPoints;
nStateButton * m_behaviourAtStop;
autoScrollStates m_autoScroll;
loopPointStates m_loopPoints;
behaviourAtStopStates m_behaviourAtStop;
int m_xOffset;
int m_posMarkerX;
@@ -141,17 +162,6 @@ private:
int m_moveXOff;
enum autoScrollStates
{
AUTOSCROLL_ENABLED, AUTOSCROLL_DISABLED
} ;
enum loopPointStates
{
LOOP_POINTS_DISABLED, LOOP_POINTS_ENABLED
} ;
signals:
void positionChanged( const midiTime & _t );

69
include/tool_button.h Normal file
View File

@@ -0,0 +1,69 @@
/*
* tool_button.h - declaration of class toolButton
*
* 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 _TOOL_BUTTON_H
#define _TOOL_BUTTON_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QPushButton>
#else
#include <qpushbutton.h>
#endif
#include "tooltip.h"
class toolButton : public QPushButton
{
public:
toolButton( const QPixmap & _pixmap, const QString & _tooltip,
QObject * _receiver, const char * _slot,
QWidget * _parent ) :
QPushButton( _parent )
{
connect( this, SIGNAL( clicked() ), _receiver, _slot );
toolTip::add( this, _tooltip );
setPaletteBackgroundColor( QColor( 224, 224, 224 ) );
setFixedSize( 30, 30 );
setPixmap( _pixmap );
}
~toolButton()
{
}
} ;
#endif