Initial revision

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@3 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2005-09-22 13:49:52 +00:00
commit 4c7832a975
242 changed files with 23424 additions and 0 deletions

69
include/about_dialog.h Normal file
View File

@@ -0,0 +1,69 @@
/*
* about_dialog.h - declaration of class aboutDialog
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _ABOUT_DIALOG_H
#define _ABOUT_DIALOG_H
#include "qt3support.h"
#ifdef QT4
#include <QDialog>
#else
#include <qdialog.h>
#endif
class QPushButton;
class QLabel;
class QTabWidget;
class aboutDialog : public QDialog
{
Q_OBJECT
public:
aboutDialog( void );
~aboutDialog();
protected:
void keyPressEvent( QKeyEvent * _ke );
void resizeEvent( QResizeEvent * _re );
private:
QPushButton * m_okBtn;
QLabel * m_iconLbl;
QLabel * m_appNameLbl;
QTabWidget * m_aboutTabs;
} ;
#endif

View File

@@ -0,0 +1,138 @@
/*
* arp_and_chords_tab_widget.h - declaration of class arpAndChordWidget which
* provides code for using arpeggio and chords
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _ARP_AND_CHORDS_TAB_WIDGET_H
#define _ARP_AND_CHORDS_TAB_WIDGET_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#else
#include <qwidget.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "settings.h"
#include "types.h"
class channelTrack;
class groupBox;
class knob;
class pixmapButton;
class QComboBox;
class QPixmap;
class notePlayHandle;
const int MAX_CHORD_POLYPHONY = 10;
class arpAndChordsTabWidget : public QWidget, public settings
{
Q_OBJECT
public:
arpAndChordsTabWidget( channelTrack * _channel_track,
QWidget * _parent );
~arpAndChordsTabWidget();
static struct chord
{
const QString name;
Sint8 interval[MAX_CHORD_POLYPHONY];
} s_chords[];
void FASTCALL processNote( notePlayHandle * _n );
static inline int getChordSize( chord & _c )
{
int idx = 0;
while( _c.interval[idx] != -1 )
{
++idx;
}
return( idx );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "arpandchords" );
}
protected slots:
// void arpOffToggled( bool );
void arpUpToggled( bool );
void arpDownToggled( bool );
void arpUpAndDownToggled( bool );
void arpRandomToggled( bool );
private:
enum arpDirections
{
OFF,
UP,
DOWN,
UP_AND_DOWN,
RANDOM
} m_arpDirection;
channelTrack * m_channelTrack;
// chord-stuff
groupBox * m_chordsGroupBox;
QComboBox * m_chordsComboBox;
knob * m_chordRangeKnob;
// arpeggio-stuff
groupBox * m_arpGroupBox;
QComboBox * m_arpComboBox;
knob * m_arpRangeKnob;
knob * m_arpTimeKnob;
knob * m_arpGateKnob;
QLabel * m_arpDirectionLbl;
//pixmapButton * m_arpOffBtn;
pixmapButton * m_arpUpBtn;
pixmapButton * m_arpDownBtn;
pixmapButton * m_arpUpAndDownBtn;
pixmapButton * m_arpRandomBtn;
} ;
#endif

102
include/audio_alsa.h Normal file
View File

@@ -0,0 +1,102 @@
/*
* audio_alsa.h - device-class that implements ALSA-PCM-output
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_ALSA_H
#define _AUDIO_ALSA_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_ALSA_ASOUNDLIB_H
#ifndef ALSA_SUPPORT
#define ALSA_SUPPORT
#endif
#include <alsa/asoundlib.h>
#include "audio_device.h"
class lcdSpinBox;
class QLineEdit;
class audioALSA : public audioDevice
{
public:
audioALSA( Uint32 _sample_rate, bool & _success_ful );
~audioALSA();
inline static QString name( void )
{
return( setupWidget::tr( "ALSA (Advanced Linux Sound "
"Architecture)" ) );
}
static QString probeDevice( void );
class setupWidget : public audioDevice::setupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();
virtual void saveSettings( void );
private:
QLineEdit * m_device;
lcdSpinBox * m_channels;
} ;
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
int FASTCALL setHWParams( Uint32 _sample_rate, Uint32 _channels,
snd_pcm_access_t _access );
int setSWParams( void );
int FASTCALL handleError( int _err );
snd_pcm_t * m_handle;
snd_pcm_uframes_t m_bufferSize;
snd_pcm_uframes_t m_periodSize;
snd_pcm_hw_params_t * m_hwParams;
snd_pcm_sw_params_t * m_swParams;
bool m_littleEndian;
} ;
#endif
#endif

143
include/audio_device.h Normal file
View File

@@ -0,0 +1,143 @@
/*
* audio_device.h - base-class for audio-devices, used by LMMS-mixer
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_DEVICE_H
#define _AUDIO_DEVICE_H
#include "qt3support.h"
#ifdef QT4
#include <QMutex>
#else
#include <qmutex.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_SAMPLERATE_H
#include <samplerate.h>
#endif
#include "mixer.h"
#include "tab_widget.h"
class audioDevice
{
public:
audioDevice( Uint32 _sample_rate, Uint8 _channels );
virtual ~audioDevice();
inline void lock( void )
{
m_devMutex.lock();
}
inline void unlock( void )
{
m_devMutex.unlock();
}
void FASTCALL writeBuffer( surroundSampleFrame * _ab, Uint32 _frames,
Uint32 _src_sample_rate,
float _master_output );
inline Uint32 sampleRate( void ) const
{
return( m_sampleRate );
}
Uint8 channels( void ) const
{
return( m_channels );
}
class setupWidget : public tabWidget
{
public:
setupWidget( const QString & _caption, QWidget * _parent ) :
tabWidget( tabWidget::tr( "Settings for %1" ).arg(
_caption ), _parent )
{
}
virtual ~setupWidget()
{
}
virtual void saveSettings( void ) = 0;
} ;
protected:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output ) = 0;
// convert a given audio-buffer to a buffer in signed 16-bit samples
// returns num of bytes in outbuf
int FASTCALL convertToS16( surroundSampleFrame * _ab, Uint32 _frames,
float _master_output,
outputSampleType * _output_buffer,
bool _convert_endian = FALSE );
// clear given signed-int-16-buffer
void FASTCALL clearS16Buffer( outputSampleType * _outbuf,
Uint32 _frames );
// resample given buffer from samplerate _src_src to samplerate _dst_src
void FASTCALL resample( surroundSampleFrame * _src, Uint32 _frames,
surroundSampleFrame * _dst,
Uint32 _src_sr, Uint32 _dst_sr );
inline void setSampleRate( Uint32 _new_sr )
{
m_sampleRate = _new_sr;
}
private:
Uint32 m_sampleRate;
Uint8 m_channels;
QMutex m_devMutex;
#ifdef HAVE_SAMPLERATE_H
SRC_DATA m_srcData;
SRC_STATE * m_srcState;
#endif
} ;
#endif

80
include/audio_dummy.h Normal file
View File

@@ -0,0 +1,80 @@
/*
* audio_dummy.h - dummy-audio-device
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_DUMMY_H
#define _AUDIO_DUMMY_H
#include "audio_device.h"
class audioDummy : public audioDevice
{
public:
audioDummy( Uint32 _sample_rate, bool & _success_ful ) :
audioDevice( _sample_rate, DEFAULT_CHANNELS )
{
_success_ful = TRUE;
}
virtual ~audioDummy()
{
}
inline static QString name( void )
{
return( setupWidget::tr( "Dummy (no sound output)" ) );
}
class setupWidget : public audioDevice::setupWidget
{
public:
setupWidget( QWidget * _parent ) :
audioDevice::setupWidget( audioDummy::name(), _parent )
{
}
virtual ~setupWidget()
{
}
virtual void saveSettings( void )
{
}
} ;
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame *,
Uint32 /*_frames*/, float )
{
//usleep( (Uint32)( _frames * 1000.0f * 1000.0f /
// DEFAULT_SAMPLE_RATE ) );
}
} ;
#endif

View File

@@ -0,0 +1,94 @@
/*
* audio_file_device.h - base-class for audio-device-classes which write
* their output into a file
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_FILE_DEVICE_H
#define _AUDIO_FILE_DEVICE_H
#include "qt3support.h"
#ifdef QT4
#include <QFile>
#else
#include <qfile.h>
#endif
#include "audio_device.h"
class audioFileDevice : public audioDevice
{
public:
audioFileDevice( Uint32 _sample_rate, Uint8 _channels,
const QString & _file, bool _use_vbr,
Uint16 _nom_bitrate, Uint16 _min_bitrate,
Uint16 _max_bitrate );
virtual ~audioFileDevice();
protected:
int FASTCALL writeData( const void * _data, int _len );
void seekToBegin( void );
inline bool useVBR( void ) const
{
return( m_useVbr );
}
inline Uint16 nominalBitrate( void ) const
{
return( m_nomBitrate );
}
inline Uint16 minBitrate( void ) const
{
return( m_minBitrate );
}
inline Uint16 maxBitrate( void ) const
{
return( m_maxBitrate );
}
inline bool outputFileOpened( void ) const
{
return( m_outputFile.isOpen() );
}
private:
QFile m_outputFile;
bool m_useVbr;
Uint16 m_nomBitrate;
Uint16 m_minBitrate;
Uint16 m_maxBitrate;
} ;
#endif

102
include/audio_file_ogg.h Normal file
View File

@@ -0,0 +1,102 @@
/*
* audio_file_ogg.h - Audio-device which encodes wave-stream and writes it
* into an OGG-file. This is used for song-export.
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_FILE_OGG_H
#define _AUDIO_FILE_OGG_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_VORBIS_CODEC_H
#include <vorbis/codec.h>
#include "audio_file_device.h"
class audioFileOgg : public audioFileDevice
{
public:
audioFileOgg( Uint32 _sample_rate, Uint32 _channels,
bool & _success_ful, const QString & _file,
bool _use_vbr, Uint16 _nom_bitrate,
Uint16 _min_bitrate, Uint16 _max_bitrate );
~audioFileOgg();
static audioDevice * getInst( Uint32 _sample_rate, Uint32 _channels,
bool & _success_ful,
const QString & _file,
bool _use_vbr,
Uint16 _nom_bitrate,
Uint16 _min_bitrate,
Uint16 _max_bitrate )
{
return( new audioFileOgg( _sample_rate, _channels, _success_ful,
_file, _use_vbr, _nom_bitrate,
_min_bitrate, _max_bitrate ) );
}
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
bool startEncoding( void );
void finishEncoding( void );
inline int writePage( void );
int m_channels;
long m_rate;
// Various bitrate/quality options
int m_managed;
int m_bitrate;
int m_minBitrate;
int m_maxBitrate;
unsigned int m_serialNo;
vorbis_comment * m_comments;
// encoding setup - init by init_ogg_encoding
ogg_stream_state m_os;
ogg_page m_og;
ogg_packet m_op;
vorbis_dsp_state m_vd;
vorbis_block m_vb;
vorbis_info m_vi;
} ;
#endif
#endif

90
include/audio_file_wave.h Normal file
View File

@@ -0,0 +1,90 @@
/*
* audio_file_wave.h - Audio-device which encodes wave-stream and writes it
* into an WAVE-file. This is used for song-export.
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_FILE_WAVE_H
#define _AUDIO_FILE_WAVE_H
#include "audio_file_device.h"
class audioFileWave : public audioFileDevice
{
public:
audioFileWave( Uint32 _sample_rate, Uint32 _channels,
bool & _success_ful, const QString & _file,
bool _use_vbr, Uint16 _nom_bitrate,
Uint16 _min_bitrate, Uint16 _max_bitrate );
virtual ~audioFileWave();
static audioDevice * getInst( Uint32 _sample_rate, Uint32 _channels,
bool & _success_ful,
const QString & _file, bool _use_vbr,
Uint16 _nom_bitrate,
Uint16 _min_bitrate,
Uint16 _max_bitrate )
{
return( new audioFileWave( _sample_rate, _channels,
_success_ful, _file, _use_vbr,
_nom_bitrate, _min_bitrate,
_max_bitrate ) );
}
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
bool startEncoding( void );
void finishEncoding( void );
int m_bytesWritten;
struct waveFileHeader
{
char riff_id[4]; // "RIFF"
Uint32 total_bytes; // total filesize-8
char wave_fmt_str[8]; // "WAVEfmt"
Uint32 bitrate_1; // bitrate, e.g. 16
Uint16 uncompressed; // 1 if PCM
Uint16 channels; // 1 = mono 2 = stereo
Uint32 sample_rate; // sample-rate e.g. 44100
Uint32 bytes_per_second; // sample-rate*channels*
// (bitrate/8)
Uint16 block_alignment; // channels*(bitrate/8)
Uint16 bitrate_2; // bitrate, e.g. 16
char data_chunk_id[4]; // "data"
Uint32 data_bytes; // total size of sample-data
} m_waveFileHeader;
//outputSampleType * m_outputBuffer;
} ;
#endif

122
include/audio_jack.h Normal file
View File

@@ -0,0 +1,122 @@
/*
* audio_jack.h - support for JACK-transport
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_JACK_H
#define _AUDIO_JACK_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_JACK_JACK_H
#define JACK_SUPPORT
#include <jack/jack.h>
#include "qt3support.h"
#ifdef QT4
#include <QMutex>
#include <QVector>
#include <QList>
#else
#include <qmutex.h>
#include <qvaluevector.h>
#include <qvaluelist.h>
#endif
#include "audio_device.h"
#include "tab_widget.h"
class QLineEdit;
class lcdSpinBox;
class audioJACK : public audioDevice
{
public:
audioJACK( Uint32 _sample_rate, bool & _success_ful );
~audioJACK();
inline static QString name( void )
{
return( setupWidget::tr( "JACK (Jack Audio Connection Kit)" ) );
}
class setupWidget : public audioDevice::setupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();
virtual void saveSettings( void );
private:
QLineEdit * m_clientName;
lcdSpinBox * m_channels;
} ;
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
void clearBuffer( void );
static int processCallback( jack_nframes_t _nframes, void * _udata );
static int bufSizeCallback( jack_nframes_t _nframes, void * _udata );
jack_client_t * m_client;
vvector<jack_port_t *> m_outputPorts;
struct bufset
{
sampleType * buf;
Uint32 frames;
} ;
vlist<vvector<bufset> > m_bufferSets;
Uint32 m_framesDoneInCurBuf;
volatile Uint32 m_frameSync;
Uint32 m_jackBufSize;
QMutex m_bufMutex;
} ;
#endif
#endif

79
include/audio_oss.h Normal file
View File

@@ -0,0 +1,79 @@
/*
* audio_oss.h - device-class that implements OSS-PCM-output
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_OSS_H
#define _AUDIO_OSS_H
#include "audio_device.h"
#include "tab_widget.h"
#define OSS_SUPPORT
class lcdSpinBox;
class QLineEdit;
class audioOSS : public audioDevice
{
public:
audioOSS( Uint32 _sample_rate, bool & _success_ful );
~audioOSS();
inline static QString name( void )
{
return( setupWidget::tr( "OSS (Open Sound System)" ) );
}
static QString probeDevice( void );
class setupWidget : public audioDevice::setupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();
virtual void saveSettings( void );
private:
QLineEdit * m_device;
lcdSpinBox * m_channels;
} ;
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
int m_audioFD;
bool m_convertEndian;
} ;
#endif

View File

@@ -0,0 +1,74 @@
/*
* audio_sample_recorder.h - device-class that implements recording
* surround-audio-buffers into RAM, maybe later
* also harddisk
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_SAMPLE_RECORDER_H
#define _AUDIO_SAMPLE_RECORDER_H
#include "qt3support.h"
#ifdef QT4
#include <QVector>
#include <QPair>
#else
#include <qvaluevector.h>
#include <qpair.h>
#endif
#include "audio_device.h"
class sampleBuffer;
class audioSampleRecorder : public audioDevice
{
public:
audioSampleRecorder( Uint32 _sample_rate, Uint32 _channels,
bool & _success_ful );
~audioSampleRecorder();
Uint32 framesRecorded( void ) const;
void FASTCALL createSampleBuffer( sampleBuffer * * _sample_buf ) const;
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
typedef vvector<QPair<sampleFrame *, Uint32> > bufferVector;
bufferVector m_buffers;
} ;
#endif

110
include/audio_sdl.h Normal file
View File

@@ -0,0 +1,110 @@
/*
* audio_sdl.h - device-class that performs PCM-output via SDL
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _AUDIO_SDL_H
#define _AUDIO_SDL_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_SDL_SDL_AUDIO_H
#ifndef SDL_AUDIO_SUPPORT
#define SDL_AUDIO_SUPPORT
#endif
#include "qt3support.h"
#ifdef QT4
#include <QMutex>
#else
#include <qmutex.h>
#endif
#include SDL_SDL_H
#include SDL_SDL_AUDIO_H
#include "audio_device.h"
#include "tab_widget.h"
class QLineEdit;
class audioSDL : public audioDevice
{
public:
audioSDL( Uint32 _sample_rate, bool & _success_ful );
~audioSDL();
inline static QString name( void )
{
return( setupWidget::tr( "SDL (Simple DirectMedia Layer)" ) );
}
class setupWidget : public audioDevice::setupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();
virtual void saveSettings( void );
private:
QLineEdit * m_device;
} ;
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
void clearBuffer( void );
static void sdlAudioCallback( void * _udata, Uint8 * _buf, int _len );
SDL_AudioSpec m_audioHandle;
outputSampleType * m_buffer;
QMutex m_bufMutex;
QMutex m_callbackMutex;
bool m_convertEndian;
} ;
#endif
#endif

258
include/basic_filters.h Normal file
View File

@@ -0,0 +1,258 @@
/*
* basic_filters.h - simple but powerful filter-class with most used filters
*
* original file by ???
* modified and enhanced by Tobias Doerffel, 2004
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _BASIC_FILTERS_H
#define _BASIC_FILTERS_H
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
#include <math.h>
#include "types.h"
#include "mixer.h"
#include "templates.h"
template<Uint8 CHANNELS = DEFAULT_CHANNELS>
class basicFilters
{
public:
enum filterTypes
{
LOWPASS,
HIPASS,
BANDPASS_CSG,
BANDPASS_CZPG,
NOTCH,
ALLPASS,
MOOG,
DOUBLE_LOWPASS,
DOUBLE_MOOG
} ;
inline basicFilters( const float _sampleRate ) :
m_b0a0( 0.0f ),
m_b1a0( 0.0f ),
m_b2a0( 0.0f ),
m_a1a0( 0.0f ),
m_a2a0( 0.0f ),
m_sampleRate( _sampleRate ),
m_subFilter( NULL )
{
// reset in/out history
for( Uint8 _chnl = 0; _chnl < CHANNELS; ++_chnl )
{
// reset in/out history for simple filters
m_ou1[_chnl] = m_ou2[_chnl] = m_in1[_chnl] =
m_in2[_chnl] = 0.0f;
// reset in/out historey for moog-filter
m_y1[_chnl] = m_y2[_chnl] = m_y3[_chnl] = m_y4[_chnl] =
m_oldx[_chnl] = m_oldy1[_chnl] =
m_oldy2[_chnl] = m_oldy3[_chnl] = 0.0f;
}
}
inline ~basicFilters()
{
delete m_subFilter;
}
inline sampleType update( sampleType _in0, Uint8 _chnl )
{
sampleType out;
if( m_type != MOOG )
{
// filter
out = m_b0a0*_in0 + m_b1a0*m_in1[_chnl] +
m_b2a0*m_in2[_chnl] - m_a1a0*m_ou1[_chnl] -
m_a2a0*m_ou2[_chnl];
// push in/out buffers
m_in2[_chnl] = m_in1[_chnl];
m_in1[_chnl] = _in0;
m_ou2[_chnl] = m_ou1[_chnl];
m_ou1[_chnl] = out;
}
else
{
sampleType x = _in0 - m_r*m_y4[_chnl];
// Four cascaded onepole filters (bilinear transform)
m_y1[_chnl] = x*m_p + m_oldx[_chnl]*m_p -
m_k*m_y1[_chnl];
m_y2[_chnl] = m_y1[_chnl]*m_p+m_oldy1[_chnl]*m_p -
m_k*m_y2[_chnl];
m_y3[_chnl] = m_y2[_chnl]*m_p+m_oldy2[_chnl]*m_p -
m_k*m_y3[_chnl];
m_y4[_chnl] = m_y3[_chnl]*m_p+m_oldy3[_chnl]*m_p -
m_k*m_y4[_chnl];
m_oldx[_chnl] = x;
m_oldy1[_chnl] = m_y1[_chnl];
m_oldy2[_chnl] = m_y2[_chnl];
m_oldy3[_chnl] = m_y3[_chnl];
out = m_y4[_chnl] - m_y4[_chnl] * m_y4[_chnl] *
m_y4[_chnl] * ( 1.0f/6.0f );
}
if( m_subFilter != NULL )
{
return( m_subFilter->update( out, _chnl ) );
}
// Clipper band limited sigmoid
return( out );
}
inline void calcFilterCoeffs( const filterTypes _type, float _freq,
const float _q
/*, const bool _q_is_bandwidth = FALSE*/ )
{
// temp coef vars
m_type = _type;
_freq = tMax( _freq, 0.01f );// limit freq for not getting
// bad noise out of the filter...
if( m_type == MOOG || m_type == DOUBLE_MOOG )
{
const float f = 2 * _freq / m_sampleRate; // [0 - 1]
m_k = 3.6f*f - 1.6f*f*f - 1; // (Empirical tunning)
m_p = (m_k+1)*0.5f;
m_r = _q*powf( M_E, ( ( 1-m_p ) * 1.386249f ) );
if( m_type == DOUBLE_MOOG )
{
if( m_subFilter == NULL )
{
m_subFilter =
new basicFilters<CHANNELS>(
m_sampleRate );
}
m_subFilter->calcFilterCoeffs( MOOG, _freq,
_q );
}
}
else
{
// other filters
const float omega = 2.0f * M_PI * _freq /
m_sampleRate;
const float tsin = sinf( omega );
const float tcos = cosf( omega );
//float alpha;
//if (q_is_bandwidth)
//alpha = tsin*sinhf(logf(2.0f)/2.0f*q*omega/tsin);
//else
const float alpha = tsin / ( 2.0f*_q );
const float a0 = 1.0f / ( 1.0f+alpha );
if( m_type == LOWPASS || m_type == DOUBLE_LOWPASS )
{
m_b0a0 = ((1.0f-tcos)/2.0f)*a0;
m_b1a0 = (1.0f-tcos)*a0;
m_b2a0 = m_b0a0;//((1.0f-tcos)/2.0f)*a0;
m_a1a0 = (-2.0f*tcos)*a0;
if( m_type == DOUBLE_LOWPASS )
{
if( m_subFilter == NULL )
{
m_subFilter =
new basicFilters<CHANNELS>( m_sampleRate );
}
m_subFilter->calcFilterCoeffs( LOWPASS,
_freq,
_q );
}
}
else if( m_type == HIPASS )
{
m_b0a0 = ((1.0f+tcos)/2.0f)*a0;
m_b1a0 = (-1.0f-tcos)*a0;
m_b2a0 = m_b0a0;//((1.0f+tcos)/2.0f)*a0;
m_a1a0 = (-2.0f*tcos)*a0;
}
else if( m_type == BANDPASS_CSG )
{
m_b0a0 = (tsin/2.0f)*a0;
m_b1a0 = 0.0f;
m_b2a0 = (-tsin/2.0f)*a0;
m_a1a0 = (-2.0f*tcos)*a0;
}
else if( m_type == BANDPASS_CZPG )
{
m_b0a0 = alpha*a0;
m_b1a0 = 0.0f;
m_b2a0 = (-alpha)*a0;
m_a1a0 = (-2.0f*tcos)*a0;
}
else if( m_type == NOTCH )
{
m_b0a0 = a0;
m_b1a0 = (-2.0f*tcos)*a0;
m_b2a0 = a0;
m_a1a0 = m_b1a0;//(-2.0f*tcos)*a0;
}
else if( m_type == ALLPASS )
{
m_b0a0 = (1.0f-alpha)*a0;
m_b1a0 = (-2.0f*tcos)*a0;
m_b2a0 = 1.0;//(1.0f+alpha)*a0;
m_a1a0 = m_b1a0;//(-2.0f*tcos)*a0;
//m_a2a0 = m_b0a0;//(1.0f-alpha)*a0;
}
m_a2a0 = (1.0f-alpha)*a0;
}
}
private:
// filter coeffs
float m_b0a0, m_b1a0, m_b2a0, m_a1a0, m_a2a0;
// coeffs for moog-filter
float m_r, m_p, m_k;
typedef sampleType frame[CHANNELS];
// in/out history
frame m_ou1, m_ou2, m_in1, m_in2;
// in/out history for moog-filter
frame m_y1, m_y2, m_y3, m_y4, m_oldx, m_oldy1, m_oldy2, m_oldy3;
filterTypes m_type;
float m_sampleRate;
basicFilters<CHANNELS> * m_subFilter;
} ;
#endif

119
include/bb_editor.h Normal file
View File

@@ -0,0 +1,119 @@
/*
* bb_editor.h - declaration of class bbEditor, a basic-component of LMMS
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _BB_EDITOR_H
#define _BB_EDITOR_H
#include "qt3support.h"
#include "track_container.h"
#include "lmms_main_win.h"
class pixmapButton;
class songEditor;
class QPixmap;
class bbEditor : public trackContainer
{
Q_OBJECT
public:
static inline bbEditor * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new bbEditor();
}
return( s_instanceOfMe );
}
virtual bool FASTCALL play( midiTime _start, Uint32 _start_frame,
Uint32 _frames, Uint32 _frame_base,
Sint16 _tco_num = -1 );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void updateAfterTrackAdd( void );
inline virtual QString nodeName( void ) const
{
return( "bbeditor" );
}
virtual inline bool fixedTCOs( void ) const
{
return( TRUE );
}
csize currentBB( void ) const;
void FASTCALL setCurrentBB( csize _bb );
tact FASTCALL lengthOfBB( csize _bb );
inline tact lengthOfCurrentBB( void )
{
return( lengthOfBB( currentBB() ) );
}
void FASTCALL removeBB( csize _bb );
csize numOfBBs( void ) const;
void FASTCALL swapBB( csize _bb1, csize _bb2 );
protected:
void closeEvent( QCloseEvent * _ce );
void keyPressEvent (QKeyEvent * _ke);
void wheelEvent( QWheelEvent * _we );
void resizeEvent( QResizeEvent * _re );
void updateBackground( void );
protected slots:
void play( void );
void stop( void );
private:
bbEditor();
//bbEditor( const bbEditor & );
~bbEditor();
void FASTCALL createTCOsForBB( csize _bb );
static bbEditor * s_instanceOfMe;
static QPixmap * s_titleArtwork;
pixmapButton * m_playButton;
pixmapButton * m_stopButton;
friend class songEditor;
friend lmmsMainWin::~lmmsMainWin();
} ;
#endif

150
include/bb_track.h Normal file
View File

@@ -0,0 +1,150 @@
/*
* bb_track.h - class bbTrack, a wrapper for using bbEditor
* (which is a singleton-class) as track
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _BB_TRACK_H
#define _BB_TRACK_H
#include "qt3support.h"
#ifdef QT4
#include <QObject>
#include <QMap>
#else
#include <qobject.h>
#include <qmap.h>
#endif
#include "track.h"
class nameLabel;
class trackContainer;
class bbTCO : public trackContentObject
{
Q_OBJECT
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 );
inline virtual QString nodeName( void ) const
{
return( "bbtco" );
}
const QColor & color( void ) const
{
return( m_color );
}
protected slots:
void openInBBEditor( bool _c );
void openInBBEditor( void );
void resetName( void );
void changeName( void );
void changeColor( void );
protected:
void paintEvent( QPaintEvent * );
void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void constructContextMenu( QMenu * );
private:
QString m_name;
QColor m_color;
} ;
class bbTrack : public QObject, public track
{
Q_OBJECT
public:
bbTrack( trackContainer * _tc );
virtual ~bbTrack();
virtual trackTypes trackType( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
Uint32 _start_frame, Uint32 _frames,
Uint32 _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
static bbTrack * FASTCALL findBBTrack( csize _bb_num );
static csize FASTCALL numOfBBTrack( track * _track );
static void FASTCALL swapBBTracks( track * _track1, track * _track2 );
inline nameLabel * trackLabel( void )
{
return( m_trackLabel );
}
public slots:
void clickedTrackLabel( void );
protected:
inline virtual QString nodeName( void ) const
{
return( "bbtrack" );
}
private:
nameLabel * m_trackLabel;
struct bbInfoStruct
{
csize num;
QString name;
} ;
static QMap<bbTrack *, bbInfoStruct> s_bbNums;
} ;
#endif

View File

@@ -0,0 +1,78 @@
/*
* buffer_allocator.h - namespace bufferAllocator providing routines for own
* optimized memory-management for audio-buffers
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _BUFFER_ALLOCATOR_H
#define _BUFFER_ALLOCATOR_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "types.h"
namespace bufferAllocator
{
void * FASTCALL allocBytes( Uint32 _bytes );
template<class T>
inline T * FASTCALL alloc( Uint32 _n )
{
return( (T *) allocBytes( sizeof( T ) * _n ) );
}
void FASTCALL free( void * _buf );
void FASTCALL cleanUp( Uint16 _level );
// simple class for automatically freeing buffer in complex functions
template<class T = void>
class autoCleaner
{
public:
autoCleaner( T * _ptr ) :
m_ptr( _ptr )
{
}
~autoCleaner()
{
bufferAllocator::free( m_ptr );
}
inline const T * ptr( void ) const
{
return( m_ptr );
}
private:
T * m_ptr;
} ;
} ;
#endif

59
include/clipboard.h Normal file
View File

@@ -0,0 +1,59 @@
/*
* clipboard.h - the clipboard for patterns, notes etc.
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _CLIPBOARD_H
#define _CLIPBOARD_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QMap>
#include <Qt/QtXml>
#else
#include <qmap.h>
#include <qdom.h>
#endif
class settings;
namespace clipboard
{
typedef QMap<QString, QDomElement> map;
extern map content;
void FASTCALL copy( settings * _settings_object );
const QDomElement * FASTCALL getContent( const QString & _node_name );
} ;
#endif

187
include/config_mgr.h Normal file
View File

@@ -0,0 +1,187 @@
/*
* config_mgr.h - class configManager, a class for managing LMMS-configuration
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _CONFIG_MGR_H
#define _CONFIG_MGR_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QDialog>
#include <QMap>
#include <QVector>
#include <QPair>
#else
#include <qdialog.h>
#include <qmap.h>
#include <qvaluevector.h>
#include <qpair.h>
#endif
#include "lmms_main_win.h"
class QLineEdit;
class QLabel;
class QRadioButton;
class QHBoxLayout;
class QVBoxLayout;
class QFrame;
const QString PROJECTS_PATH = "projects/";
const QString PRESETS_PATH = "presets/";
const QString SAMPLES_PATH = "samples/";
const QString ARTWORK_PATH = "artwork/";
const QString LOCALE_PATH = "locale/";
class configManager : public QDialog
{
Q_OBJECT
public:
static inline configManager * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new configManager();
}
return( s_instanceOfMe );
}
const QString & lmmsWorkingDir( void ) const
{
return( m_lmmsWorkingDir );
}
QString projectsDir( void ) const
{
return( m_lmmsWorkingDir + PROJECTS_PATH );
}
QString presetsDir( void ) const
{
return( m_lmmsWorkingDir + PRESETS_PATH );
}
QString samplesDir( void ) const
{
return( m_lmmsWorkingDir + SAMPLES_PATH );
}
QString artworkDir( void ) const
{
return( m_lmmsDataDir + ARTWORK_PATH );
}
QString localeDir( void ) const
{
return( m_lmmsDataDir + LOCALE_PATH );
}
const QString & value( const QString & _class,
const QString & _attribute ) const;
void setValue( const QString & _class, const QString & _attribute,
const QString & _value );
bool loadConfigFile( void );
void saveConfigFile( void );
protected slots:
void openWorkingDir( void );
void setWorkingDir( const QString & _wd );
virtual void accept( void );
void backButtonClicked( void );
void nextButtonClicked( void );
void switchPage( csize _pg );
void switchPage( QWidget * _pg );
private:
static configManager * s_instanceOfMe;
configManager( void );
configManager( const configManager & _c );
~configManager();
void createWidgets( void );
void FASTCALL addPage( QWidget * _w, const QString & _title );
static void processFilesRecursively( const QString & _src_dir,
const QString & _dst_dir,
void( * _proc_func )( const QString & _src, const QString &
_dst ) );
const QString m_lmmsRcFile;
QString m_lmmsWorkingDir;
QString m_lmmsDataDir;
typedef vvector<QPair<QString, QString> > stringPairVector;
typedef QMap<QString, stringPairVector> settingsMap;
settingsMap m_settings;
QWidget * m_pageIntro;
QWidget * m_pageWorkingDir;
QWidget * m_pageFiles;
QRadioButton * m_samplesCopyRB;
QRadioButton * m_presetsCopyRB;
QRadioButton * m_projectsCopyRB;
QLineEdit * m_wdLineEdit;
// wizard stuff
vlist<QPair<QWidget *, QString> > m_pages;
csize m_currentPage;
QFrame * m_hbar;
QWidget * m_contentWidget;
QLabel * m_title;
QPushButton * m_cancelButton;
QPushButton * m_backButton;
QPushButton * m_nextButton;
QPushButton * m_finishButton;
QHBoxLayout * m_buttonLayout;
QHBoxLayout * m_mainLayout;
QVBoxLayout * m_contentLayout;
// lmmsMainWin-dtor is allowed to destroy us...
friend lmmsMainWin::~lmmsMainWin();
} ;
#endif

41
include/debug.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* debug.h - header file to be included for debugging purposes
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _DEBUG_H
#define _DEBUG_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// set whether debug-stuff (like messages on the console, asserts and other
// additional range-checkings) should be compiled
#ifdef LMMS_DEBUG
#include <assert.h>
#include <cstdio>
#endif
#endif

31
include/effect_board.h Normal file
View File

@@ -0,0 +1,31 @@
/*
* effect_board.h - stuff for effect-board
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _EFFECT_BOARD_H
#define _EFFECT_BOARD_H
const int MIN_EFFECT_CHANNEL = 0;
const int MAX_EFFECT_CHANNEL = 63;
const int DEFAULT_EFFECT_CHANNEL = (MIN_EFFECT_CHANNEL);
#endif

51
include/embed.h Normal file
View File

@@ -0,0 +1,51 @@
/*
* embed.h - misc. stuff for using embedded data (resources linked into binary)
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _EMBED_H
#define _EMBED_H
#include "qt3support.h"
#ifdef QT4
#include <QPixmap>
#include <QString>
#else
#include <qpixmap.h>
#include <qstring.h>
#endif
namespace embed
{
QPixmap getIconPixmap( const char * _name, int _w = -1, int _h = -1 );
QString getText( const char * _name );
void loadTranslation( const QString & _tname );
}
#endif

59
include/endian_handling.h Normal file
View File

@@ -0,0 +1,59 @@
/*
* endian.h - handle endianess-problems
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _ENDIAN_HANDLING_H
#define _ENDIAN_HANDLING_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "types.h"
inline bool isLittleEndian( void )
{
#ifdef WORDS_BIGENDIAN
return( FALSE );
#else
return( TRUE );
#endif
}
inline Sint16 swap16IfBE( Sint16 _i )
{
return( isLittleEndian() ? _i : ( ( _i & 0xFF ) << 8) | ( ( _i >> 8 ) & 0xFF ) );
}
inline Sint32 swap32IfBE( Sint32 _i )
{
return( isLittleEndian() ? _i : ( ( _i & 0xff000000 ) >> 24 ) |
( ( _i & 0x00ff0000 ) >> 8 ) |
( ( _i & 0x0000ff00 ) << 8 ) |
( ( _i & 0x000000ff ) << 24 ) );
}
#endif

View File

@@ -0,0 +1,174 @@
/*
* envelope_and_lfo_widget.h - declaration of class envelopeAndLFOWidget which
* is used by envelope/lfo/filter-tab of
* channel-window
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _ENVELOPE_AND_LFO_WIDGET_H
#define _ENVELOPE_AND_LFO_WIDGET_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#else
#include <qwidget.h>
#endif
#include "settings.h"
#include "types.h"
#include "spc_bg_hndl_widget.h"
class envelopeTabWidget;
class pixmapButton;
class knob;
class QPaintEvent;
class QPixmap;
class envelopeAndLFOWidget : public QWidget, public settings,
public specialBgHandlingWidget
{
Q_OBJECT
public:
envelopeAndLFOWidget( float _value_for_zero_amount, QWidget * _parent );
~envelopeAndLFOWidget();
static inline float expKnobVal( float val )
{
return( ( ( val < 0 ) ? -1 : 1 ) * val*val );
}
static void triggerLFO( void );
static void resetLFO( void );
float FASTCALL level( Uint32 _frame, Uint32 _release_begin,
Uint32 _frame_offset ) const;
inline bool used( void ) const
{
return( m_used );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "el" );
}
public slots:
void updateSampleVars( void );
protected:
void paintEvent( QPaintEvent * _pe );
void mousePressEvent( QMouseEvent * _me );
float FASTCALL lfoLevel( Uint32 _frame, Uint32 _frame_offset ) const;
protected slots:
void updateAfterKnobChange( float );
void lfoSinWaveCh( bool );
void lfoTriangleWaveCh( bool );
void lfoSawWaveCh( bool );
void lfoSquareWaveCh( bool );
void x100Toggled( bool );
private:
static Uint32 s_lfoFrame;
bool m_used;
// envelope-stuff
knob * m_predelayKnob;
knob * m_attackKnob;
knob * m_holdKnob;
knob * m_decayKnob;
knob * m_sustainKnob;
knob * m_releaseKnob;
knob * m_amountKnob;
static QPixmap * s_envGraph;
float m_sustainLevel;
float m_amount;
float m_valueForZeroAmount;
float m_amountAdd;
Uint32 m_pahdFrames;
Uint32 m_rFrames;
float * m_pahdEnv;
float * m_rEnv;
// LFO-stuff
knob * m_lfoPredelayKnob;
knob * m_lfoAttackKnob;
knob * m_lfoSpeedKnob;
knob * m_lfoAmountKnob;
pixmapButton * m_sinLfoBtn;
pixmapButton * m_triangleLfoBtn;
pixmapButton * m_sawLfoBtn;
pixmapButton * m_sqrLfoBtn;
static QPixmap * s_lfoGraph;
pixmapButton * m_x100Btn;
pixmapButton * m_controlEnvAmountBtn;
Uint32 m_lfoPredelayFrames;
Uint32 m_lfoAttackFrames;
Uint32 m_lfoOscillationFrames;
float m_lfoAmount;
bool m_lfoAmountIsZero;
float * m_lfoShapeData;
enum lfoShapes
{
SIN,
TRIANGLE,
SAW,
SQUARE
} m_lfoShape;
volatile bool m_busy;
friend class envelopeTabWidget;
} ;
#endif

View File

@@ -0,0 +1,107 @@
/*
* envelope_tab_widget.h - declaration of class envelopeTabWidget which
* provides UI- and DSP-code for using envelopes, LFOs
* and a filter
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _ENVELOPE_TAB_WIDGET_H
#define _ENVELOPE_TAB_WIDGET_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#else
#include <qwidget.h>
#endif
#include "settings.h"
#include "basic_filters.h"
#include "envelope_and_lfo_widget.h"
class QComboBox;
class groupBox;
class tabWidget;
class QLabel;
class knob;
class pixmapButton;
class channelTrack;
class notePlayHandle;
class envelopeTabWidget : public QWidget, public settings
{
Q_OBJECT
public:
envelopeTabWidget( channelTrack * _channel_track, QWidget * parent );
~envelopeTabWidget();
void FASTCALL processAudioBuffer( sampleFrame * _ab, Uint32 _frames,
notePlayHandle * _n );
enum targets
{
VOLUME,
/* PANNING,
PITCH,*/
CUT,
RES,
TARGET_COUNT
} ;
Uint32 envFrames( void );
Uint32 releaseFrames( void );
float FASTCALL volumeLevel( notePlayHandle * _n, Uint32 _frame );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "eldata" );
}
private:
channelTrack * m_channelTrack;
tabWidget * m_targetsTabWidget;
envelopeAndLFOWidget * m_envLFOWidgets[TARGET_COUNT];
// filter-stuff
groupBox * m_filterGroupBox;
QComboBox * m_filterComboBox;
knob * m_filterCutKnob;
knob * m_filterResKnob;
} ;
#endif

61
include/export.h Normal file
View File

@@ -0,0 +1,61 @@
/*
* export.h - header which is needed for song-export
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _EXPORT_H
#define _EXPORT_H
#include "types.h"
class audioDevice;
typedef audioDevice * ( * getDeviceInst)( Uint32 _sample_rate,
Uint32 _channels,
bool & _success_ful,
const QString & _file,
bool _use_vbr,
Uint16 _nom_bitrate,
Uint16 _min_bitrate,
Uint16 _max_bitrate );
enum fileTypes
{
WAVE_FILE,
OGG_FILE,
NULL_FILE = 0xFF
} ;
struct fileEncodeDevice
{
fileTypes m_fileType;
const char * m_description;
const char * m_extension;
getDeviceInst m_getDevInst;
} ;
extern fileEncodeDevice fileEncodeDevices[];
#endif

View File

@@ -0,0 +1,111 @@
/*
* export_project_dialog.h - declaration of class exportProjectDialog which is
* responsible for exporting project
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _EXPORT_PROJECT_DIALOG_H
#define _EXPORT_PROJECT_DIALOG_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QDialog>
#else
#include <qdialog.h>
#endif
#include "export.h"
class QLabel;
class QPushButton;
class QComboBox;
class QProgressBar;
class QCheckBox;
class pixmapButton;
class exportProjectDialog : public QDialog
{
Q_OBJECT
public:
exportProjectDialog( const QString & _file_name, QWidget * _parent );
~exportProjectDialog();
void FASTCALL updateProgressBar( int _new_val );
public slots:
void exportBtnClicked( void );
protected:
void keyPressEvent( QKeyEvent * _ke );
void closeEvent( QCloseEvent * _ce );
private slots:
void changedType( const QString & );
void cancelBtnClicked( void );
void redrawProgressBar( void );
private:
QString m_fileName;
QLabel * m_typeLbl;
QComboBox * m_typeCombo;
QLabel * m_kbpsLbl;
QComboBox * m_kbpsCombo;
QCheckBox * m_vbrCb;
QCheckBox * m_hqmCb;
QLabel * m_hourglassLbl;
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 );
} ;
#endif

85
include/group_box.h Normal file
View File

@@ -0,0 +1,85 @@
/*
* group_box.h - LMMS-groupbox
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _GROUP_BOX_H
#define _GROUP_BOX_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#else
#include <qwidget.h>
#endif
#include "pixmap_button.h"
class QPixmap;
class groupBox : public QWidget
{
Q_OBJECT
public:
groupBox( const QString & _caption, QWidget * _parent );
~groupBox();
bool isActive( void ) const
{
#ifdef QT4
return( m_led->isChecked() );
#else
return( m_led->isOn() );
#endif
}
public slots:
void setState( bool _on, bool _anim = FALSE );
void animate( void );
protected:
virtual void resizeEvent( QResizeEvent * _re );
virtual void mousePressEvent( QMouseEvent * _me );
private:
void updatePixmap( void );
static QPixmap * s_ledBg;
pixmapButton * m_led;
QString m_caption;
int m_origHeight;
bool m_animating;
} ;
#endif

93
include/interpolation.h Normal file
View File

@@ -0,0 +1,93 @@
/*
* interpolation.h - fast implementations of several interpolation-algorithms
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _INTERPOLATION_H
#define _INTERPOLATION_H
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
#include <math.h>
inline float hermiteInterpolate( float x0, float x1, float x2, float x3,
float frac_pos )
{
const float frsq = frac_pos*frac_pos;
const float frsq2 = 2*frsq;
return( ( (x2-x0) *0.5f ) * ( frac_pos * (frsq+1) -frsq2 ) +
( frsq2*frac_pos - 3*frsq ) * ( x1-x2 ) +
frsq2 * (frac_pos-1) * ( ( x3-x1 ) * 0.25f ) + x1 );
/*
const float frsq = frac_pos*frac_pos;
//const float frsq2 = 2*frsq;
frac_pos *= 0.5;
const float frcu = frsq*frac_pos;
return (
(frcu - frsq + frac_pos) * ((x2 - x0)) +
(4*frcu - 3*frsq) * (x1 - x2)
//frsq*(2*frac_pos-3) * (x1 - x2)
+ (frcu - 0.5*frsq)*((x3 - x1))
+ x1
);
*/
}
inline float cubicInterpolate( float v0, float v1, float v2, float v3, float x )
{
float frsq = x*x;
float frcu = frsq*v0;
float t1 = v3 + 3*v1;
return( v1 + 0.5f * frcu + x * ( v2 - frcu * ( 1.0f/6.0f ) -
t1 * ( 1.0f/6.0f ) - v0 / 3.0f ) + frsq * x * ( t1 *
( 1.0f/6.0f ) - 0.5f * v2 ) + frsq * ( 0.5f * v2 - v1 ) );
}
inline float cosinusInterpolate( float v0, float v1, float x )
{
float f = cosf( x * ( M_PI*0.5f ) );
return( v0*f + v1*( 1.0f-f ) );
}
inline float linearInterpolate( float v0, float v1, float x )
{
return( v0*( 1.0f-x ) + v1*x );
}
#endif

320
include/kmultitabbar.h Normal file
View File

@@ -0,0 +1,320 @@
/***************************************************************************
kmultitabbar.h - description
-------------------
begin : 2001
copyright : (C) 2001,2002,2003 by Joseph Wenninger <jowenn@kde.org>
***************************************************************************/
/***************************************************************************
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
***************************************************************************/
#ifndef _KMultitabbar_h_
#define _KMultitabbar_h_
#include "qt3support.h"
class KMultiTabBarButton;
class KMultiTabBarTab;
#ifdef QT4
#include <QWidget>
#include <QMenu>
//#include <QVBoxWidget>
#include <QString>
#include <QBoxLayout>
#include <QList>
#include <QScrollArea>
#include <QPushButton>
typedef QList<KMultiTabBarButton *> buttonList;
typedef QList<KMultiTabBarTab *> tabList;
#else
#include <qscrollview.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qabstractlayout.h>
#include <qstring.h>
#include <qptrlist.h>
#include <qpushbutton.h>
typedef QPtrList<KMultiTabBarButton> buttonList;
typedef QPtrList<KMultiTabBarTab> tabList;
#endif
class QPixmap;
class QPainter;
class QFrame;
class KMultiTabBarPrivate;
class KMultiTabBarTabPrivate;
class KMultiTabBarButtonPrivate;
class KMultiTabBarInternal;
/**
* A Widget for horizontal and vertical tabs.
* It is possible to add normal buttons to the top/left
* The handling if only one tab at a time or multiple tabs
* should be raisable is left to the "user".
*@author Joseph Wenninger
*/
class KMultiTabBar: public QWidget
{
Q_OBJECT
public:
//enum KMultiTabBarMode{ Horizontal, Vertical };
enum KMultiTabBarPosition{DockLeft, DockRight, DockTop, DockBottom};
/**
* VSNET == Visual Studio .Net like (only show the text of active tabs
* KDEV3 == Kdevelop 3 like (always show the text)
* KONQSBC == konqy's classic sidebar style (unthemed), this one is disabled
* at the moment, but will be renabled soon too
*/
enum KMultiTabBarStyle{VSNET=0, KDEV3=1, KONQSBC=2, KDEV3ICON=3,STYLELAST=0xffff};
KMultiTabBar(Qt::Orientation o,QWidget *parent=0);
virtual ~KMultiTabBar();
/**
* append a new button to the button area. The button can later on be accessed with button(ID)
* eg for connecting signals to it
* @param pic a pixmap for the button
* @param id an arbitraty ID value. It will be emitted in the clicked signal for identifying the button
* if more than one button is connected to a signals.
* @param popup A popup menu which should be displayed if the button is clicked
* @param not_used_yet will be used for a popup text in the future
*/
int appendButton(const QPixmap &pic,int id=-1,QMenu* popup=0,const QString& not_used_yet=QString::null);
/**
* remove a button with the given ID
*/
void removeButton(int id);
/**
* append a new tab to the tab area. It can be accessed lateron with tabb(id);
* @param pic a bitmap for the tab
* @param id an arbitrary ID which can be used later on to identify the tab
* @param text if a mode with text is used it will be the tab text, otherwise a mouse over hint
*/
int appendTab(const QPixmap &pic,int id=-1,const QString& text=QString::null);
/**
* remove a tab with a given ID
*/
void removeTab(int id);
/**
* set a tab to "raised"
* @param id The ID of the tab to manipulate
* @param state true == activated/raised, false == not active
*/
void setTab(int id ,bool state);
/**
* return the state of a tab, identified by it's ID
*/
bool isTabRaised(int id) const;
/**
* get a pointer to a button within the button area identified by its ID
*/
class KMultiTabBarButton *button(int id) const;
/**
* get a pointer to a tab within the tab area, identiifed by its ID
*/
class KMultiTabBarTab *tab(int id) const;
/**
* set the real position of the widget.
* @param pos if the mode is horizontal, only use top, bottom, if it is vertical use left or right
*/
void setPosition(KMultiTabBarPosition pos);
/**
* set the display style of the tabs
*/
void setStyle(KMultiTabBarStyle style);
/**
* be carefull, don't delete tabs yourself and don't delete the list itself
*/
tabList * tabs();
/**
* be carefull, don't delete buttons yourself and don't delete the list itself
*/
buttonList * buttons();
/**
* might vanish, not sure yet
*/
void showActiveTabTexts(bool show=true);
protected:
friend class KMultiTabBarButton;
virtual void fontChange( const QFont& );
void updateSeparator();
private:
class KMultiTabBarInternal *m_internal;
QBoxLayout *m_l;
QFrame *m_btnTabSep;
buttonList m_buttons;
KMultiTabBarPosition m_position;
KMultiTabBarPrivate *d;
};
/**
* This class should never be created except with the appendButton call of KMultiTabBar
*/
class KMultiTabBarButton: public QPushButton
{
Q_OBJECT
public:
KMultiTabBarButton(const QPixmap& pic,const QString&, QMenu *popup,
int id,QWidget *parent, KMultiTabBar::KMultiTabBarPosition pos, KMultiTabBar::KMultiTabBarStyle style);
KMultiTabBarButton(const QString&, QMenu *popup,
int id,QWidget *parent, KMultiTabBar::KMultiTabBarPosition pos, KMultiTabBar::KMultiTabBarStyle style);
virtual ~KMultiTabBarButton();
int id() const;
public slots:
/**
* this is used internaly, but can be used by the user, if (s)he wants to
* It the according call of KMultiTabBar is invoked though this modifications will be overwritten
*/
void setPosition(KMultiTabBar::KMultiTabBarPosition);
/**
* this is used internaly, but can be used by the user, if (s)he wants to
* It the according call of KMultiTabBar is invoked though this modifications will be overwritten
*/
void setStyle(KMultiTabBar::KMultiTabBarStyle);
/**
* modify the text of the button
*/
void setText(const QString &);
QSize sizeHint() const;
protected:
KMultiTabBar::KMultiTabBarPosition m_position;
KMultiTabBar::KMultiTabBarStyle m_style;
QString m_text;
virtual void hideEvent( class QHideEvent*);
virtual void showEvent( class QShowEvent*);
private:
int m_id;
KMultiTabBarButtonPrivate *d;
signals:
/**
* this is emitted if the button is clicked
* @param id the ID identifying the button
*/
void clicked(int id);
protected slots:
virtual void slotClicked();
};
/**
* This class should never be created except with the appendTab call of KMultiTabBar
*/
class KMultiTabBarTab: public KMultiTabBarButton
{
Q_OBJECT
public:
KMultiTabBarTab(const QPixmap& pic,const QString&,int id,QWidget *parent,
KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style);
virtual ~KMultiTabBarTab();
/**
* set the active state of the tab
* @param state true==active false==not active
*/
void setState(bool state);
/**
* choose if the text should always be displayed
* this is only used in classic mode if at all
*/
void showActiveTabText(bool show);
void resize(){ setSize( neededSize() ); }
#ifndef QT4
virtual inline const QColorGroup & palette( void ) const
{
return( colorGroup() );
}
#endif
private:
bool m_showActiveTabText;
int m_expandedSize;
KMultiTabBarTabPrivate *d;
protected:
friend class KMultiTabBarInternal;
void setSize(int);
int neededSize();
void updateState();
virtual void drawButton(QPainter *);
virtual void drawButtonLabel(QPainter *);
void drawButtonStyled(QPainter *);
void drawButtonClassic(QPainter *);
protected slots:
virtual void slotClicked();
void setTabsPosition(KMultiTabBar::KMultiTabBarPosition);
public slots:
virtual void setIcon(const QString&);
virtual void setIcon(const QPixmap&);
};
class KMultiTabBarInternal: public Q3ScrollView
{
Q_OBJECT
public:
KMultiTabBarInternal(QWidget *parent,Qt::Orientation o);
int appendTab(const QPixmap &,int=-1,const QString& =QString::null);
KMultiTabBarTab *tab(int) const;
void removeTab(int);
void setPosition(enum KMultiTabBar::KMultiTabBarPosition pos);
void setStyle(enum KMultiTabBar::KMultiTabBarStyle style);
void showActiveTabTexts(bool show);
tabList * tabs(){return &m_tabs;}
#ifndef QT4
virtual inline const QColorGroup & palette( void ) const
{
return( colorGroup() );
}
#endif
private:
friend class KMultiTabBar;
QWidget *box;
QBoxLayout *mainLayout;
tabList m_tabs;
enum KMultiTabBar::KMultiTabBarPosition m_position;
bool m_showActiveTabTexts;
enum KMultiTabBar::KMultiTabBarStyle m_style;
int m_expandedTabSize;
int m_lines;
protected:
virtual void drawContents ( QPainter *, int, int, int, int);
/**
* [contentsM|m]ousePressEvent are reimplemented from QScrollView
* in order to ignore all mouseEvents on the viewport, so that the
* parent can handle them.
*/
virtual void contentsMousePressEvent(QMouseEvent *);
virtual void mousePressEvent(QMouseEvent *);
virtual void resizeEvent(QResizeEvent *);
};
#endif

191
include/knob.h Normal file
View File

@@ -0,0 +1,191 @@
/*
* knob.h - powerful knob-widget
*
* This file is based on the knob-widget of the Qwt Widget Library by Josef Wilgen
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _KNOB_H
#define _KNOB_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QPoint>
#else
#include <qwidget.h>
#include <qpoint.h>
#endif
#include "templates.h"
class QPixmap;
class textFloat;
enum knobTypes
{
knobDark_28, knobBright_26, knobSmall_17
} ;
class knob : public QWidget
{
Q_OBJECT
public:
knob( int _knob_num, QWidget * _parent, const QString & _name );
virtual ~knob();
enum ScrollMode
{
ScrNone,
ScrMouse,
ScrTimer,
ScrDirect,
ScrPage
} ;
void setTracking( bool _enable );
void setHintText( const QString & _txt_before,
const QString & _txt_after );
void setLabel( const QString & _txt );
void setTotalAngle( float _angle );
void setRange( float _vmin, float _vmax, float _vstep = 0.0,
int _pagesize = 1 );
inline float value( void ) const
{
return( m_value );
}
void setStep( float );
inline float maxValue( void ) const
{
return( m_maxValue );
}
inline float minValue( void ) const
{
return( m_minValue );
}
inline void incPages( int _n_pages )
{
setNewValue( m_value + float( _n_pages ) * m_pageSize, 1 );
}
public slots:
void setValue( float _val, bool _is_init_value = FALSE );
void fitValue( float _val );
void incValue( int _steps );
void reset( void );
void copyValue( void );
void pasteValue( void );
void connectToMidiDevice( void );
void displayHelp( void );
signals:
void valueChanged( float value );
void sliderPressed( void );
void sliderReleased( void );
void sliderMoved( float value );
protected:
virtual void paintEvent( QPaintEvent * _me );
virtual void resizeEvent( QResizeEvent * _me );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void wheelEvent( QWheelEvent * _me );
virtual void contextMenuEvent( QContextMenuEvent * _me );
void drawKnob( QPainter * _p );
void setPosition( const QPoint & _p );
private:
void layoutKnob( bool _update = TRUE );
float getValue( const QPoint & _p );
void getScrollMode( const QPoint & _p, int & _scroll_mode,
int & _direction );
void recalcAngle( void );
void valueChange( void );
void rangeChange( void );
void buttonReleased( void );
void setNewValue( float x, int align = 0 );
static float s_copiedValue;
static textFloat * s_textFloat;
int m_knobWidth;
int m_scrollMode;
float m_mouseOffset;
int m_direction;
int m_tracking;
QPoint m_origMousePos;
float m_angle;
float m_oldAngle;
float m_totalAngle;
float m_nTurns;
QPixmap * m_knobPixmap;
int m_knobNum;
QString m_hintTextBeforeValue;
QString m_hintTextAfterValue;
QString m_label;
float m_minValue;
float m_maxValue;
float m_step;
float m_pageSize;
float m_value;
float m_exactValue;
float m_exactPrevValue;
float m_prevValue;
float m_initValue;
} ;
#endif

84
include/lcd_spinbox.h Normal file
View File

@@ -0,0 +1,84 @@
/*
* lcd_spinbox.h - class lcdSpinBox, an improved QLCDNumber
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _LCD_SPINBOX_H
#define _LCD_SPINBOX_H
#include "qt3support.h"
#ifdef QT4
#include <QLCDNumber>
#else
#include <qlcdnumber.h>
#endif
class lcdSpinBox : public QWidget
{
Q_OBJECT
public:
lcdSpinBox( int _min, int _max, int _num_digits, QWidget * _parent );
virtual ~lcdSpinBox();
void setStep( int _step );
inline int value( void ) const
{
return( m_number->intValue() );
}
void setValue( int _value );
void setLabel( const QString & _txt );
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void wheelEvent( QWheelEvent * _we );
private:
int m_value;
int m_minValue;
int m_maxValue;
int m_step;
QLCDNumber * m_number;
QLabel * m_label;
QPoint m_origMousePos;
signals:
void valueChanged( int );
} ;
#endif

67
include/led_checkbox.h Normal file
View File

@@ -0,0 +1,67 @@
/*
* led_checkbox.h - class ledCheckBox, an improved QCheckBox
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _LED_CHECKBOX_H
#define _LED_CHECKBOX_H
#include "qt3support.h"
#ifdef QT4
#include <QCheckBox>
#else
#include <qcheckbox.h>
#endif
class QPixmap;
class ledCheckBox : public QCheckBox
{
public:
enum ledColors
{
YELLOW, GREEN, TOTAL_COLORS
} ;
ledCheckBox( const QString & _txt, QWidget * _parent,
ledColors _color = YELLOW );
virtual ~ledCheckBox();
protected:
virtual void paintEvent( QPaintEvent * _pe );
private:
QPixmap * m_ledOnPixmap;
QPixmap * m_ledOffPixmap;
} ;
#endif

107
include/midi.h Normal file
View File

@@ -0,0 +1,107 @@
/*
* midi.h - constants, structs etc. concerning MIDI
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _MIDI_H
#define _MIDI_H
#include "types.h"
enum midiEventTypes
{
// messages
NOTE_OFF = 0x80,
NOTE_ON = 0x90,
KEY_PRESSURE = 0xA0,
CONTROL_CHANGE = 0xB0,
PROGRAM_CHANGE = 0xC0,
CHANNEL_PRESSURE = 0xD0,
PITCH_BEND = 0xE0,
// system exclusive
MIDI_SYSEX = 0xF0,
// system common - never in midi files
MIDI_TIME_CODE = 0xF1,
MIDI_SONG_POSITION = 0xF2,
MIDI_SONG_SELECT = 0xF3,
MIDI_TUNE_REQUEST = 0xF6,
MIDI_EOX = 0xF7,
// system real-time - never in midi files
MIDI_SYNC = 0xF8,
MIDI_TICK = 0xF9,
MIDI_START = 0xFA,
MIDI_CONTINUE = 0xFB,
MIDI_STOP = 0xFC,
MIDI_ACTIVE_SENSING = 0xFE,
MIDI_SYSTEM_RESET = 0xFF,
// meta event - for midi files only
MIDI_META_EVENT = 0xFF
} ;
struct midiEvent
{
midiEvent( midiEventTypes _type = MIDI_ACTIVE_SENSING,
Uint8 _channel = 0,
Uint16 _param1 = 0,
Uint16 _param2 = 0 ) :
m_type( _type ),
m_channel( _channel ),
m_sysExData( NULL )
{
m_data.m_param[0] = _param1;
m_data.m_param[1] = _param2;
}
midiEvent( midiEventTypes _type, char * _sysex_data, int _data_len ) :
m_type( _type ),
m_channel( 0 ),
m_sysExData( _sysex_data )
{
m_data.m_sysExDataLen = _data_len;
}
inline Uint16 key( void ) const
{
return( m_data.m_param[0] );
}
inline Uint32 velocity( void ) const
{
return( m_data.m_param[1] );
}
midiEventTypes m_type; // MIDI event type
Uint8 m_channel; // MIDI channel
union
{
Uint16 m_param[2]; // first/second parameter (key/velocity)
int m_sysExDataLen; // len of m_sysExData
} m_data;
char * m_sysExData;
} ;
#endif

107
include/midi_alsa_raw.h Normal file
View File

@@ -0,0 +1,107 @@
/*
* midi_alsa_raw.h - midi-device-driver for RawMIDI via ALSA
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _MIDI_ALSA_RAW_H
#define _MIDI_ALSA_RAW_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_ALSA_ASOUNDLIB_H
#ifndef ALSA_SUPPORT
#define ALSA_SUPPORT
#endif
#include <alsa/asoundlib.h>
#include "qt3support.h"
#ifdef QT4
#include <QThread>
#else
#include <qthread.h>
#endif
#include "midi_device.h"
struct pollfd;
class QLineEdit;
class midiALSARaw : public midiDevice, public QThread
{
public:
midiALSARaw( channelTrack * _ct = NULL );
~midiALSARaw();
static QString probeDevice( void );
inline static QString name( void )
{
return( setupWidget::tr( "ALSA Raw-MIDI (Advanced Linux Sound "
"Architecture)" ) );
}
class setupWidget : public midiDevice::setupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();
virtual void saveSettings( void );
private:
QLineEdit * m_device;
} ;
protected:
virtual void FASTCALL sendByte( Uint8 _c );
virtual void FASTCALL run( void );
private:
snd_rawmidi_t * m_input, * * m_inputp;
snd_rawmidi_t * m_output, * * m_outputp;
int m_npfds;
pollfd * m_pfds;
volatile bool m_quit;
} ;
#endif
#endif

77
include/midi_dummy.h Normal file
View File

@@ -0,0 +1,77 @@
/*
* midi_dummy.h - dummy MIDI-driver
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _MIDI_DUMMY_H
#define _MIDI_DUMMY_H
#include "midi_device.h"
#include "tab_widget.h"
class midiDummy : public midiDevice
{
public:
midiDummy() :
midiDevice()
{
}
~midiDummy()
{
}
inline static QString name( void )
{
return( setupWidget::tr( "Dummy (no MIDI support)" ) );
}
class setupWidget : public midiDevice::setupWidget
{
public:
setupWidget( QWidget * _parent ) :
midiDevice::setupWidget( midiDummy::name(), _parent )
{
}
virtual ~setupWidget()
{
}
virtual void saveSettings( void )
{
}
} ;
protected:
virtual void FASTCALL sendByte( Uint8 )
{
}
} ;
#endif

112
include/midi_mapper.h Normal file
View File

@@ -0,0 +1,112 @@
/*
* midi_mapper.h - MIDI-mapper for any midiDevice
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _MIDI_MAPPER_H
#define _MIDI_MAPPER_H
#include "qt3support.h"
#ifdef QT4
#include <QPair>
#include <QFile>
#else
#include <qpair.h>
#include <qfile.h>
#endif
#include "types.h"
const Uint8 MIDI_PROGRAMS = 128;
const Uint8 MIDI_KEYS = 128;
const Uint8 MIDI_CHANNELS = 16;
class midiMapper
{
public:
midiMapper( const QString & _map );
~midiMapper();
inline const QString & programName( Uint8 _program ) const
{
return( m_patchMap[_program].second );
}
inline Uint8 mappedProgramNumber( Uint8 _program ) const
{
return( m_patchMap[_program].first );
}
inline const QString & drumsetKeyName( Uint8 _key ) const
{
return( m_drumsetKeyMap[_key].second );
}
inline Uint8 keyForDrumName( const QString & _name ) const
{
for( Uint8 i = 0; i < MIDI_KEYS; ++i )
{
if( m_drumsetKeyMap[i].second == _name )
{
return( i );
}
}
return( 0 );
}
inline Uint8 drumsetChannel( void ) const
{
return( m_drumsetChannel );
}
inline Uint8 drumsetPatch( void ) const
{
return( m_drumsetPatch );
}
inline Uint8 mappedChannel( Uint8 _channel ) const
{
return( m_channelMap[_channel] );
}
private:
void readPatchMap( QFile & _f );
void readDrumsetKeyMap( QFile & _f );
void readChannelMap( QFile & _f );
QPair<Uint8, QString> m_patchMap[MIDI_PROGRAMS];
QPair<Uint8, QString> m_drumsetKeyMap[MIDI_KEYS];
Uint8 m_channelMap[MIDI_CHANNELS];
Uint8 m_drumsetChannel;
Uint8 m_drumsetPatch;
} ;
#endif

79
include/midi_oss.h Normal file
View File

@@ -0,0 +1,79 @@
/*
* midi_oss.h - OSS-driver for MIDI-port
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _MIDI_OSS_H
#define _MIDI_OSS_H
#include <qthread.h>
#include <qfile.h>
#include "midi_device.h"
class QLineEdit;
class midiOSS : public midiDevice, public QThread
{
public:
midiOSS( channelTrack * _ct = NULL );
~midiOSS();
static QString probeDevice( void );
inline static QString name( void )
{
return( setupWidget::tr( "OSS Raw-MIDI (Open Sound System)" ) );
}
class setupWidget : public midiDevice::setupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();
virtual void saveSettings( void );
private:
QLineEdit * m_device;
} ;
protected:
virtual void FASTCALL sendByte( Uint8 _c );
virtual void FASTCALL run( void );
private:
QFile m_midiDev;
volatile bool m_quit;
} ;
#endif

122
include/midi_time.h Normal file
View File

@@ -0,0 +1,122 @@
/*
* midi_time.h - declaration of class midiTime which provides data-type for
* position- and length-variables
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _MIDI_TIME_H
#define _MIDI_TIME_H
#include "types.h"
class midiTime
{
public:
inline midiTime( tact _tact, tact64th _tact_64th ) :
m_tact( _tact ),
m_tact64th( _tact_64th )
{
}
inline midiTime( Sint32 _abs = 0 ) :
m_tact( _abs / 64 ),
m_tact64th( _abs % 64 )
{
}
inline midiTime( const midiTime & _t )
{
*this = _t;
}
inline midiTime & operator=( const midiTime & _t )
{
m_tact = _t.m_tact;
m_tact64th = _t.m_tact64th;
return( *this );
}
inline midiTime & operator+=( const midiTime & _t )
{
return( *this = static_cast<Sint32>( *this ) +
static_cast<Sint32>( _t ) );
}
inline midiTime & operator-=( const midiTime & _t )
{
return( *this = static_cast<Sint32>( *this ) -
static_cast<Sint32>( _t ) );
}
inline void setTact( tact _t )
{
m_tact = _t;
}
inline tact getTact( void ) const
{
return( m_tact );
}
inline void setTact64th( tact64th _t )
{
m_tact64th = _t;
}
inline tact64th getTact64th( void ) const
{
return( m_tact64th );
}
// converts time-class in an absolute value, useful for calculations,
// comparisons and so on...
inline operator Sint32( void ) const
{
return( static_cast<Sint32>( m_tact ) * 64 +
static_cast<Sint32>( m_tact64th ) );
}
// calculate number of frame that are needed this time
inline Uint32 frames( float _frames_per_tact ) const
{
if( m_tact >= 0 )
{
return( static_cast<Uint32>( m_tact *
_frames_per_tact +
m_tact64th *
_frames_per_tact /
64.0f ) );
}
return( 0 );
}
private:
tact m_tact;
tact64th m_tact64th;
} ;
#endif

341
include/mixer.h Normal file
View File

@@ -0,0 +1,341 @@
/*
* mixer.h - audio-device-independent mixer for LMMS
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _MIXER_H
#define _MIXER_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QThread>
#include <QMutex>
#include <QVector>
#else
#include <qobject.h>
#include <qthread.h>
#include <qmutex.h>
#include <qvaluevector.h>
#endif
#include "types.h"
#include "volume.h"
#include "panning.h"
#include "note.h"
#include "play_handle.h"
class audioDevice;
class midiDevice;
class lmmsMainWin;
const int DEFAULT_BUFFER_SIZE = 512;
const Uint16 MAX_SAMPLE_PACKETS = 256; // how many parallel audio-samples-
// buffers shall be maximal exist and
// mixed together?
const Uint8 DEFAULT_CHANNELS = 2;
const Uint8 SURROUND_CHANNELS =
#ifndef DISABLE_SURROUND
4;
#else
2;
#endif
const Uint8 QUALITY_LEVELS = 2;
const Uint32 DEFAULT_QUALITY_LEVEL = 0;
const Uint32 HIGH_QUALITY_LEVEL = DEFAULT_QUALITY_LEVEL+1;
extern Uint32 SAMPLE_RATES[QUALITY_LEVELS];
const Uint32 DEFAULT_SAMPLE_RATE = 44100;//SAMPLE_RATES[DEFAULT_QUALITY_LEVEL];
typedef sampleType sampleFrame[DEFAULT_CHANNELS];
typedef sampleType surroundSampleFrame[SURROUND_CHANNELS];
typedef struct
{
float vol[SURROUND_CHANNELS];
} volumeVector;
const Uint32 BYTES_PER_SAMPLE = sizeof( sampleType );
const Uint32 BYTES_PER_FRAME = sizeof( sampleFrame );
const Uint32 BYTES_PER_SURROUND_FRAME = sizeof( surroundSampleFrame );
const Uint32 BYTES_PER_OUTPUT_SAMPLE = sizeof( outputSampleType );
const float OUTPUT_SAMPLE_MULTIPLIER = 32767.0f;
const float BASE_FREQ = 440.0f;
const tones BASE_TONE = A;
const octaves BASE_OCTAVE = OCTAVE_4;
class mixer :
#ifndef QT4
public QObject,
#endif
public QThread
{
Q_OBJECT
public:
static inline mixer * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new mixer();
}
return( s_instanceOfMe );
}
void FASTCALL addBuffer( sampleFrame * _buf, Uint32 _frames,
Uint32 _framesAhead,
volumeVector & _volumeVector );
inline Uint32 framesPerAudioBuffer( void ) const
{
return( m_framesPerAudioBuffer );
}
inline bool highQuality( void ) const
{
return( m_qualityLevel > DEFAULT_QUALITY_LEVEL );
}
inline const surroundSampleFrame * currentAudioBuffer( void ) const
{
return( m_curBuf );
}
// audio-device-stuff
inline const QString & audioDevName( void ) const
{
return( m_audioDevName );
}
void FASTCALL setAudioDevice( audioDevice * _dev, bool _hq );
void restoreAudioDevice( void );
// MIDI-device-stuff
inline const QString & midiDevName( void ) const
{
return( m_midiDevName );
}
inline midiDevice * getMIDIDevice( void )
{
return( m_midiDev );
}
inline void addPlayHandle( playHandle * _ph )
{
m_playHandles.push_back( _ph );
}
inline void removePlayHandle( playHandle * _ph )
{
m_playHandlesToRemove.push_back( _ph );
}
void FASTCALL checkValidityOfPlayHandles( void );
inline int sampleRate( void )
{
return( SAMPLE_RATES[m_qualityLevel] );
}
inline float masterOutput( void ) const
{
return( m_masterOutput );
}
inline void setMasterOutput( float _mo )
{
m_masterOutput = _mo;
}
static inline sampleType clip( sampleType _s )
{
if( _s > 1.0f )
{
return( 1.0f );
}
else if( _s < -1.0f )
{
return( -1.0f );
}
return( _s );
}
inline void pause( void )
{
m_safetySyncMutex.lock();
}
inline void play( void )
{
m_safetySyncMutex.unlock();
}
void clear( void );
void FASTCALL clearAudioBuffer( sampleFrame * _ab, Uint32 _frames );
#ifndef DISABLE_SURROUND
void FASTCALL clearAudioBuffer( surroundSampleFrame * _ab,
Uint32 _frames );
#endif
inline bool haveNoRunningNotes( void ) const
{
return( m_playHandles.size() == 0 );
}
public slots:
void setHighQuality( bool _hq_on = FALSE );
signals:
void sampleRateChanged( void );
void nextAudioBuffer( const surroundSampleFrame *, Uint32 _frames );
private:
struct samplePacket
{
surroundSampleFrame * m_buffer; // actual buffer for
// wave-data
Uint32 m_frames;
Uint32 m_framesDone;
Uint32 m_framesAhead; // number of frames, the buffer
// should be mixed ahead
volume m_vol;
panning m_pan;
enum samplePacketStates
{
READY, FILLING, UNUSED
} m_state;
} ;
static mixer * s_instanceOfMe;
mixer();
~mixer();
void quitThread( void );
// we don't allow to create mixer by using copy-ctor
mixer( const mixer & ) :
#ifndef QT4
QObject(),
#endif
QThread(),
m_curBuf( m_buffer1 ),
m_nextBuf( m_buffer2 )
{
}
virtual void run( void );
void FASTCALL mixSamplePacket( samplePacket * _sp );
audioDevice * tryAudioDevices( void );
midiDevice * tryMIDIDevices( void );
sampleFrame * m_silence;
#ifndef DISABLE_SURROUND
surroundSampleFrame * m_surroundSilence;// cool, silence in surround ;-)
#endif
samplePacket m_samplePackets[MAX_SAMPLE_PACKETS];
Uint32 m_framesPerAudioBuffer;
surroundSampleFrame * m_buffer1;
surroundSampleFrame * m_buffer2;
surroundSampleFrame * m_curBuf;
surroundSampleFrame * m_nextBuf;
bool m_discardCurBuf;
playHandleVector m_playHandles;
playHandleVector m_playHandlesToRemove;
Uint8 m_qualityLevel;
volatile float m_masterOutput;
volatile bool m_quit;
audioDevice * m_audioDev;
audioDevice * m_oldAudioDev;
QString m_audioDevName;
midiDevice * m_midiDev;
QString m_midiDevName;
QMutex m_safetySyncMutex;
QMutex m_devMutex;
friend class lmmsMainWin;
} ;
#endif

109
include/mmp.h Normal file
View File

@@ -0,0 +1,109 @@
/*
* mmp.h - class for reading and writing multimedia-project-files
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _MMP_H
#define _MMP_H
#include "qt3support.h"
#ifdef QT4
#include <Qt/QtXml>
#else
#include <qdom.h>
#endif
#include "types.h"
class multimediaProject : public QDomDocument
{
public:
enum projectTypes
{
UNKNOWN,
SONG_PROJECT,
CHANNEL_SETTINGS,
EFFECT_SETTINGS,
VIDEO_PROJECT, // will come later...
BURN_PROJECT, // will come later...
PLAYLIST, // will come later...
PROJ_TYPE_COUNT
} ;
multimediaProject( const QString & _in_file_name );
multimediaProject( projectTypes _project_type );
~multimediaProject();
bool FASTCALL writeFile( const QString & _fn,
bool _overwrite_check = TRUE );
inline QDomElement & content( void )
{
return( m_content );
}
inline QDomElement & head( void )
{
return( m_head );
}
inline projectTypes type( void ) const
{
return( m_type );
}
static projectTypes FASTCALL typeOfFile( const QString & _fn );
private:
static projectTypes FASTCALL type( const QString & _type_name );
static QString FASTCALL typeName( projectTypes _project_type );
struct typeDescStruct
{
projectTypes m_type;
QString m_name;
} ;
static typeDescStruct s_types[PROJ_TYPE_COUNT];
QDomElement m_content;
QDomElement m_head;
projectTypes m_type;
} ;
const Uint8 MMP_MAJOR_VERSION = 1;
const Uint8 MMP_MINOR_VERSION = 0;
const QString MMP_VERSION_STRING = QString::number( MMP_MAJOR_VERSION ) + "." +
QString::number( MMP_MINOR_VERSION );
#endif

75
include/name_label.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* name_label.h - class nameLabel, a label which is renamable by
* double-clicking it
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _NAME_LABEL_H
#define _NAME_LABEL_H
#include "qt3support.h"
#ifdef QT4
#include <QLabel>
#include <QPixmap>
#else
#include <qlabel.h>
#include <qpixmap.h>
#endif
class nameLabel : public QLabel
{
Q_OBJECT
public:
nameLabel( const QString & _initial_name, QWidget * _parent,
const QPixmap & _pm = QPixmap() );
~nameLabel();
const QPixmap * pixmap( void ) const;
public slots:
void setPixmap( const QPixmap & _pm );
void rename( void );
signals:
void nameChanged( const QString & _new_name );
void clicked( void );
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
private:
QPixmap m_pm;
} ;
#endif

167
include/note.h Normal file
View File

@@ -0,0 +1,167 @@
/*
* note.h - declaration of class note which contains all informations about a
* note + definitions of several constants and enums
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _NOTE_H
#define _NOTE_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QVector>
#else
#include <qvaluevector.h>
#endif
#include "volume.h"
#include "panning.h"
#include "midi_time.h"
#include "settings.h"
enum tones
{
C = 0,
CIS = 1, DES = 1,
D = 2,
DIS = 3, ES = 3,
E = 4, FES = 4,
F = 5,
FIS = 6, GES = 6,
G = 7,
GIS = 8, AS = 8,
A = 9,
AIS = 10, B = 10,
H = 11
} ;
enum octaves
{
OCTAVE_0,
OCTAVE_1,
OCTAVE_2,
OCTAVE_3,
OCTAVE_4, // default
OCTAVE_5,
OCTAVE_6,
OCTAVE_7,
OCTAVE_8
} ;
const octaves DEFAULT_OCTAVE = OCTAVE_4;
const octaves MIN_OCTAVE = OCTAVE_0;
const octaves MAX_OCTAVE = OCTAVE_8;
const int WHITE_KEYS_PER_OCTAVE = 7;
const int BLACK_KEYS_PER_OCTAVE = 5;
const int NOTES_PER_OCTAVE = WHITE_KEYS_PER_OCTAVE + BLACK_KEYS_PER_OCTAVE;
const int OCTAVES = 9;
class note : public settings
{
public:
note( const midiTime & _length = 0, const midiTime & _pos = 0,
tones _tone = A, octaves _octave = DEFAULT_OCTAVE,
volume _volume = DEFAULT_VOLUME,
panning _panning = DEFAULT_PANNING ) FASTCALL;
~note();
void FASTCALL setLength( const midiTime & _length );
void FASTCALL setPos( const midiTime & _pos );
void FASTCALL setTone( tones _tone = C );
void FASTCALL setOctave( octaves _octave = DEFAULT_OCTAVE );
void FASTCALL setKey( int _key );
void FASTCALL setVolume( volume _volume = DEFAULT_VOLUME );
void FASTCALL setPanning( panning _panning = DEFAULT_PANNING );
inline midiTime endPos( void ) const
{
return( m_pos + m_length);
}
inline const midiTime & length( void ) const
{
return( m_length );
}
inline const midiTime & pos( void ) const
{
return( m_pos );
}
inline midiTime pos( midiTime _base_pos ) const
{
return( m_pos - _base_pos );
}
inline tones tone( void ) const
{
return( m_tone );
}
inline octaves octave( void ) const
{
return( m_octave );
}
inline int key( void ) const
{
return( m_octave * NOTES_PER_OCTAVE + m_tone );
}
inline volume getVolume( void ) const
{
return( m_volume );
}
inline panning getPanning( void ) const
{
return( m_panning );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "note" );
}
private:
tones m_tone;
octaves m_octave;
volume m_volume;
panning m_panning;
midiTime m_length;
midiTime m_pos;
} ;
typedef vvector<note *> noteVector;
#endif

180
include/note_play_handle.h Normal file
View File

@@ -0,0 +1,180 @@
/*
* note_play_handle.h - declaration of class notePlayHandle which is needed
* by LMMS-Play-Engine
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _NOTE_PLAY_HANDLE_H
#define _NOTE_PLAY_HANDLE_H
#include <qpair.h>
#include "play_handle.h"
#include "basic_filters.h"
#include "note.h"
class channelTrack;
class notePlayHandle;
typedef vvector<notePlayHandle *> notePlayHandleVector;
class notePlayHandle : public playHandle, public note
{
public:
void * m_pluginData;
basicFilters<> * m_filter;
notePlayHandle( channelTrack * _chnl_trk, Uint32 _frames_ahead,
Uint32 _frames, note * n,
bool _arp_note = FALSE ) FASTCALL;
~notePlayHandle();
virtual void play( void );
virtual inline bool done( void ) const
{
return( ( m_released && m_framesBeforeRelease == 0 &&
m_releaseFramesDone >= m_releaseFramesToDo ) ||
m_channelTrack == NULL );
}
virtual void checkValidity( void );
void FASTCALL noteOff( Uint32 _s = 0 );
inline Uint32 framesBeforeRelease( void ) const
{
return( m_framesBeforeRelease );
}
inline Uint32 releaseFramesDone( void ) const
{
return( m_releaseFramesDone );
}
Uint32 actualReleaseFramesToDo( void ) const;
// returns how many samples this note is aligned ahead, i.e.
// at which position it is inserted in the according buffer
inline Uint32 framesAhead( void ) const
{
return ( m_framesAhead );
}
// returns total numbers of frames to play
inline Uint32 frames( void ) const
{
return( m_frames );
}
void setFrames( Uint32 _frames );
// returns whether note was released
inline bool released( void ) const
{
return( m_released );
}
// returns total numbers of played frames
inline Uint32 totalFramesPlayed( void ) const
{
return( m_totalFramesPlayed );
}
// returns volume-level at frame _frame (envelope/LFO)
float FASTCALL volumeLevel( Uint32 _frame );
// adds note-play-handle _n as subnote
inline void addSubNote( notePlayHandle * _n )
{
m_subNotes.push_back( _n );
_n->m_baseNote = FALSE;
// if there was an arp-note added and this note is a base-note
// we set arp-note-flag for indicating that this note is an
// arpeggio-base-note
m_arpNote = _n->arpNote() && baseNote();
}
// returns channel-track this note-play-handle plays
inline channelTrack * getChannelTrack( void )
{
return( m_channelTrack );
}
// returns whether note is a base-note, e.g. is not part of an arpeggio
// or a chord
inline bool baseNote( void ) const
{
return( m_baseNote );
}
// returns whether note is part of an arpeggio
inline bool arpNote( void ) const
{
return( m_arpNote );
}
// returns whether note is base-note for arpeggio
inline bool arpBaseNote( void ) const
{
return( baseNote() && arpNote() );
}
inline bool muted( void ) const
{
return( m_muted );
}
void mute( void );
private:
channelTrack * m_channelTrack; // needed for calling
// channelTrack::playNote
Uint32 m_frames; // total frames to play
Uint32 m_framesAhead; // numbers of frames ahead in buffer
// to mix in
Uint32 m_totalFramesPlayed; // total frame-counter - used for
// figuring out whether a whole note
// has been played
Uint32 m_framesBeforeRelease; // number of frames after which note
// is released
Uint32 m_releaseFramesToDo; // total numbers of frames to be
// played after release
Uint32 m_releaseFramesDone; // number of frames done after
// release of note
notePlayHandleVector m_subNotes;// used for chords and arpeggios
bool m_released; // indicates whether note is released
bool m_baseNote; // indicates whether note is a
// base-note (i.e. no sub-note)
bool m_arpNote; // indicates whether note is part of
// an arpeggio (either base-note or
// sub-note)
bool m_muted; // indicates whether note is muted
} ;
#endif

91
include/nstate_button.h Normal file
View File

@@ -0,0 +1,91 @@
/*
* nstate_button.h - declaration of class nStateButton
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _NSTATE_BUTTON_H
#define _NSTATE_BUTTON_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QPixmap>
#include <QVector>
#include <QPair>
#else
#include <qwidget.h>
#include <qpixmap.h>
#include <qvaluevector.h>
#include <qpair.h>
#endif
class nStateButton : public QWidget
{
Q_OBJECT
public:
nStateButton( QWidget * _parent );
virtual ~nStateButton();
void addState( const QPixmap & _pixmap, const QString & _tooltip = "" );
inline void setGeneralToolTip( const QString & _tooltip )
{
m_generalToolTip = _tooltip;
}
inline int state( void ) const
{
return( m_curState );
}
public slots:
void changeState( int _n );
signals:
void stateChanged( int _n );
protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void mousePressEvent( QMouseEvent * _me );
private:
vvector<QPair<QPixmap *, QString> > m_states;
QString m_generalToolTip;
int m_curState;
} ;
#endif

211
include/oscillator.h Normal file
View File

@@ -0,0 +1,211 @@
/*
* oscillator.h - header-file for oscillator.cpp, a powerful oscillator-class
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _OSCILLATOR_H
#define _OSCILLATOR_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "mixer.h"
#include "interpolation.h"
// fwd-decl because we need it for the typedef below...
class oscillator;
typedef void ( oscillator:: * oscFuncPtr )
( sampleFrame * _ab, Uint32 _frames, Uint8 _chnl );
class oscillator
{
public:
enum waveShapes
{
SIN_WAVE,
TRIANGLE_WAVE,
SAW_WAVE,
SQUARE_WAVE,
MOOG_SAW_WAVE,
EXP_WAVE,
WHITE_NOISE_WAVE,
USER_DEF_WAVE
} ;
enum modulationAlgos
{
FREQ_MODULATION, AMP_MODULATION, MIX, SYNC
} ;
oscillator( modulationAlgos _modulation_algo, float _freq,
Sint16 _phase_offset, float _volume_factor,
oscillator * _m_subOsc );
inline virtual ~oscillator()
{
delete m_subOsc;
}
inline void setUserWave( const sampleFrame * _data, Uint32 _frames )
{
m_userWaveData = _data;
m_userWaveFrames = _frames;
}
inline void update( sampleFrame * _ab, Uint32 _frames, Uint8 _chnl )
{
( this->*m_callUpdate )( _ab, _frames, _chnl );
}
inline void setNewFreq( float _new_freq )
{
// save current state - we need it later for restoring same
// phase (otherwise we'll get clicks in the audio-stream)
const float v = m_sample * m_oscCoeff;
m_freq = _new_freq;
recalcOscCoeff( phase( v ) );
}
static oscillator * FASTCALL createNewOsc( waveShapes _wave_shape,
modulationAlgos _modulation_algo, float _freq,
Sint16 _phase_offset, float _volume_factor,
oscillator * _m_subOsc = NULL );
inline bool syncOk( void )
{
const float v1 = m_sample * m_oscCoeff;
const float v2 = ++m_sample * m_oscCoeff;
// check whether v2 is in next period
return( floorf( v2 ) > floorf( v1 ) );
}
static inline float phase( float _sample )
{
float t;
return( modff( _sample, &t ) );
//return( _sample - floorf( _sample ) );
}
// now follow the wave-shape-routines...
static inline sampleType sinSample( float _sample )
{
return( sinf( _sample * static_cast<sampleType>( 2.0f * M_PI
) ) );
}
static inline sampleType triangleSample( float _sample )
{
const float ph = phase( _sample );
if( ph <= 0.25f )
{
return( ph * 4.0f );
}
else if( ph <= 0.75f )
{
return( 2.0f - ph * 4.0f );
}
return( ph * 4.0f - 4.0f );
}
static inline sampleType sawSample( float _sample )
{
return( -1.0f + phase( _sample ) * 2.0f );
}
static inline sampleType squareSample( float _sample )
{
return( ( phase( _sample ) > 0.5f ) ? -1.0f : 1.0f );
}
static inline sampleType moogSawSample( float _sample )
{
const float ph= phase( _sample );
if( ph < 0.5f )
{
return( -1.0f + ph * 4.0f );
}
return( 1.0f - 2.0f * ph );
}
static inline sampleType expSample( float _sample )
{
float ph = phase( _sample );
if( ph > 0.5f )
{
ph = 1.0f - ph;
}
return( -1.0f + 8.0f * ph * ph );
}
static inline sampleType noiseSample( float )
{
return( 1.0f - 2.0f * ( ( float )rand() * ( 1.0f /
RAND_MAX ) ) );
}
inline sampleType userWaveSample( float _sample )
{
const float frame = phase( _sample ) * m_userWaveFrames;
const Uint32 f1 = static_cast<Uint32>( frame );
const Uint32 f2 = ( f1 + 1 ) % m_userWaveFrames;
return( linearInterpolate( m_userWaveData[f1][0],
m_userWaveData[f2][0],
frame - floorf( frame ) ) );
}
protected:
float m_freq;
float m_volumeFactor;
Sint16 m_phaseOffset;
oscillator * m_subOsc;
Uint32 m_sample;
float m_oscCoeff;
sampleFrame const * m_userWaveData;
Uint32 m_userWaveFrames;
oscFuncPtr m_callUpdate;
virtual void FASTCALL updateNoSub( sampleFrame * _ab, Uint32 _frames,
Uint8 _chnl ) = 0;
virtual void FASTCALL updateFM( sampleFrame * _ab, Uint32 _frames,
Uint8 _chnl ) = 0;
virtual void FASTCALL updateAM( sampleFrame * _ab, Uint32 _frames,
Uint8 _chnl ) = 0;
virtual void FASTCALL updateMix( sampleFrame * _ab, Uint32 _frames,
Uint8 _chnl ) = 0;
virtual void FASTCALL updateSync( sampleFrame * _ab, Uint32 _frames,
Uint8 _chnl ) = 0;
inline void sync( void )
{
m_sample = 0;
}
void FASTCALL recalcOscCoeff( const float _additional_phase_offset =
0.0 );
} ;
#endif

35
include/panning.h Normal file
View File

@@ -0,0 +1,35 @@
/*
* panning.h - declaration of some constants and types, concerning the
* panning of a note
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _PANNING_H
#define _PANNING_H
#include "types.h"
const panning PANNING_LEFT = ( 0 - 100);
const panning PANNING_RIGHT = ( 0 + 100);
const panning PANNING_CENTER = 0;
const panning DEFAULT_PANNING = PANNING_CENTER;
#endif

216
include/pattern.h Normal file
View File

@@ -0,0 +1,216 @@
/*
* pattern.h - declaration of class pattern, which contains all informations
* about a pattern
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _PATTERN_H
#define _PATTERN_H
#include "qt3support.h"
#ifdef QT4
#include <QVector>
#include <QWidget>
#include <QMutex>
#include <QDialog>
#else
#include <qvaluevector.h>
#include <qwidget.h>
#include <qmutex.h>
#include <qdialog.h>
#endif
#include "note.h"
#include "track.h"
#include "mixer.h"
class channelTrack;
class sampleBuffer;
class audioSampleRecorder;
class QTimer;
class QProgressBar;
class QPushButton;
class QPixmap;
class patternFreezeStatusDialog;
const int MAX_BEATS_PER_TACT = 16;
const int MAIN_BEATS_PER_TACT = 4;
class pattern : public trackContentObject
{
Q_OBJECT
public:
enum patternTypes
{
BEAT_PATTERN, MELODY_PATTERN/*, EVENT_PATTERN*/
} ;
pattern( channelTrack * _channel_track );
pattern( const pattern & _pat_to_copy ) FASTCALL;
virtual ~pattern();
virtual void FASTCALL movePosition( const midiTime & _pos );
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 )
{
return( m_notes );
}
inline patternTypes type( void ) const
{
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 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 );
void FASTCALL setNoteAt( int _note_num, note _new_note );
void checkType( void );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "pattern" );
}
protected slots:
void openInPianoRoll( bool _c );
void openInPianoRoll( void );
void clear( void );
void resetName( void );
void changeName( void );
void freeze( void );
void unfreeze( void );
void updateFreezeStatusDialog( void );
void abortFreeze( void );
protected:
void paintEvent( QPaintEvent * _pe );
void mousePressEvent( QMouseEvent * _me );
void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void constructContextMenu( QMenu * );
void ensureBeatNotes( void );
private:
static QPixmap * s_patternBg;
static QPixmap * s_stepBtnOn;
static QPixmap * s_stepBtnOff;
static QPixmap * s_stepBtnOffLight;
static QPixmap * s_frozen;
static void initPixmaps( void );
channelTrack * m_channelTrack;
patternTypes m_patternType;
QString m_name;
noteVector m_notes;
QMutex m_frozenPatternMutex;
sampleBuffer * m_frozenPattern;
audioSampleRecorder * m_freezeRecorder;
patternFreezeStatusDialog * m_freezeStatusDialog;
QTimer * m_freezeStatusUpdateTimer;
} ;
class patternFreezeStatusDialog : public QDialog
{
Q_OBJECT
public:
patternFreezeStatusDialog();
~patternFreezeStatusDialog();
void FASTCALL setProgress( int _p );
protected:
void closeEvent( QCloseEvent * _ce );
protected slots:
void cancelBtnClicked( void );
private:
QProgressBar * m_progressBar;
QPushButton * m_cancelBtn;
signals:
void aborted( void );
} ;
#endif

69
include/pch.h Normal file
View File

@@ -0,0 +1,69 @@
// Qt-headers
#include <qglobal.h>
#if QT_VERSION >= 0x040000
#include <QtCore/QtCore>
#include <QtGui/QtGui>
#include <QtXml/QtXml>
#else
#include <qobject.h>
#include <qfiledialog.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qpainter.h>
#include <qfontmetrics.h>
#include <qapplication.h>
#include <qtextcodec.h>
#include <qtextedit.h>
#include <qfileinfo.h>
#include <qbitmap.h>
#include <qcursor.h>
#include <qtooltip.h>
#include <qspinbox.h>
#include <qlineedit.h>
#include <qtoolbox.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qtabwidget.h>
#include <qgroupbox.h>
#include <qwidget.h>
#include <qvbox.h>
#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qworkspace.h>
#include <qradiobutton.h>
#include <qwhatsthis.h>
#include <qstatusbar.h>
#include <qsplashscreen.h>
#include <qscrollbar.h>
#include <qlistbox.h>
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qthread.h>
#include <qtimer.h>
#include <qpalette.h>
#include <qsplitter.h>
#include <qdatastream.h>
#include <qbuffer.h>
#include <qfile.h>
#include <qmutex.h>
#include <qdatetime.h>
#include <qdom.h>
#endif
// C++ STL / C-stdlib
#include <math.h>
#include <memory>
#include <fcntl.h>
#include <fstream>
#include <limits>
#include <unistd.h>

237
include/piano_roll.h Normal file
View File

@@ -0,0 +1,237 @@
/*
* piano_roll.h - declaration of class pianoRoll which is a window where you
* can set and edit notes in an easy way
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _PIANO_ROLL_H
#define _PIANO_ROLL_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QVector>
#else
#include <qwidget.h>
#include <qvaluevector.h>
#endif
#include "types.h"
#include "note.h"
class QScrollBar;
class QPainter;
class QPixmap;
class crystalButton;
class pattern;
class notePlayHandle;
class pixmapButton;
class timeLine;
class pianoRoll : public QWidget
{
Q_OBJECT
public:
static inline pianoRoll * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new pianoRoll();
}
return( s_instanceOfMe );
}
void FASTCALL setCurrentPattern( pattern * _new_pattern );
inline const pattern * currentPattern( void ) const
{
return( m_pattern );
}
inline bool validPattern( void ) const
{
return( m_pattern != NULL );
}
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 keyReleaseEvent( QKeyEvent * _ke );
void wheelEvent( QWheelEvent * _we );
int FASTCALL getKey( int _y );
inline void drawNoteRect( QPainter & _p, Uint16 _x, Uint16 _y,
Sint16 _width, bool _is_selected );
void removeSelection( void );
void selectAll( void );
void FASTCALL getSelectedNotes( noteVector & _selected_notes );
protected slots:
void play( void );
void record( void );
void stop( void );
void recordNote( const note & _n );
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 copySelectedNotes( void );
void cutSelectedNotes( void );
void pasteNotes( void );
void deleteSelectedNotes( void );
void updatePosition( const midiTime & _t );
private:
enum editModes
{
DRAW,
ERASE,
SELECT,
MOVE
} ;
enum actions
{
NONE,
MOVE_NOTE,
RESIZE_NOTE,
SELECT_NOTES,
MOVE_SELECTION,
CHANGE_NOTE_VOLUME,
CHANGE_NOTE_PANNING
} ;
enum pianoRollKeyTypes
{
PR_WHITE_KEY_SMALL,
PR_WHITE_KEY_BIG,
PR_BLACK_KEY
} ;
static pianoRoll * s_instanceOfMe;
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;
static QPixmap * s_toolSelect;
static QPixmap * s_toolMove;
static pianoRollKeyTypes prKeyOrder[];
pixmapButton * m_playButton;
pixmapButton * m_recordButton;
pixmapButton * m_stopButton;
crystalButton * m_drawButton;
crystalButton * m_eraseButton;
crystalButton * m_selectButton;
crystalButton * m_moveButton;
crystalButton * m_cutButton;
crystalButton * m_copyButton;
crystalButton * m_pasteButton;
pattern * m_pattern;
QScrollBar * m_leftRightScroll;
QScrollBar * m_topBottomScroll;
midiTime m_currentPosition;
bool m_recording;
note * m_currentNote;
actions m_action;
Uint32 m_selectStartTact64th;
int m_selectedTact64th;
int m_selectStartKey;
int m_selectedKeys;
int m_moveStartKey;
int m_moveStartTact64th;
int m_moveXOffset;
int m_notesEditHeight;
int m_ppt;
int m_totalKeysToScroll;
midiTime m_lenOfNewNotes;
bool m_shiftPressed;
bool m_controlPressed;
int m_startKey; // first key when drawing
int m_lastKey;
noteVector m_notesToCopy;
noteVector m_selNotesForMove;
editModes m_editMode;
timeLine * m_timeLine;
bool m_scrollBack;
pianoRoll( void );
pianoRoll( const pianoRoll & );
~pianoRoll();
signals:
void positionChanged( const midiTime & );
} ;
#endif

104
include/piano_widget.h Normal file
View File

@@ -0,0 +1,104 @@
/*
* piano_widget.h - declaration of class pianoWidget, a widget which provides
* an interactive piano/keyboard-widget
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _PIANO_WIDGET_H
#define _PIANO_WIDGET_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QPixmap>
#include <QScrollBar>
#else
#include <qwidget.h>
#include <qpixmap.h>
#include <qscrollbar.h>
#endif
#include "note.h"
class channelTrack;
class notePlayHandle;
enum keyTypes
{
WHITE_KEY,
BLACK_KEY
} ;
class pianoWidget : public QWidget
{
Q_OBJECT
public:
pianoWidget( channelTrack * _channel_track );
~pianoWidget();
protected:
void paintEvent( QPaintEvent * );
void mousePressEvent( QMouseEvent * me );
void mouseReleaseEvent( QMouseEvent * me );
void mouseMoveEvent( QMouseEvent * me );
void keyPressEvent( QKeyEvent * ke );
void keyReleaseEvent( QKeyEvent * ke );
void focusInEvent( QFocusEvent * _fe );
void focusOutEvent( QFocusEvent * _fe );
private:
int FASTCALL getKeyFromMouse( const QPoint & _p );
int FASTCALL getKeyFromKeyboard( int _k ) const;
int FASTCALL getKeyX( int _key_num );
static QPixmap * s_whiteKeyPm;
static QPixmap * s_blackKeyPm;
static QPixmap * s_whiteKeyPressedPm;
static QPixmap * s_blackKeyPressedPm;
QScrollBar * m_pianoScroll;
channelTrack * m_channelTrack;
tones m_startTone; // first key when drawing
octaves m_startOctave;
int m_lastKey;
private slots:
void pianoScrolled( int _new_pos );
} ;
#endif

78
include/pixmap_button.h Normal file
View File

@@ -0,0 +1,78 @@
/*
* pixmap_button.h - declaration of class pixmapButton
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _PIXMAP_BUTTON_H
#define _PIXMAP_BUTTON_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QPushButton>
#include <QPixmap>
#else
#include <qpushbutton.h>
#include <qpixmap.h>
#endif
class pixmapButton : public QPushButton
{
Q_OBJECT
public:
pixmapButton( QWidget * _parent );
virtual ~pixmapButton();
virtual void FASTCALL setActiveGraphic( const QPixmap & _pm );
virtual void FASTCALL setInactiveGraphic( const QPixmap & _pm,
bool _update = TRUE );
void FASTCALL setBgGraphic( const QPixmap & _pm );
signals:
void doubleClicked( void );
void clickedRight( void );
protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
private:
QPixmap * m_activePixmap;
QPixmap * m_inactivePixmap;
QPixmap * m_bgPixmap;
} ;
#endif

76
include/play_handle.h Normal file
View File

@@ -0,0 +1,76 @@
/*
* play_handle.h - base-class playHandle which is needed by
* LMMS-Play-Engine
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _PLAY_HANDLE_H
#define _PLAY_HANDLE_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QVector>
#else
#include <qvaluevector.h>
#endif
class playHandle
{
public:
inline playHandle( void )
{
}
virtual inline ~playHandle()
{
}
virtual void play( void ) = 0;
virtual bool done( void ) const = 0;
// play-handles can invalidate themselves if an object they depend on
// is going to be deleted or things like that - every of those objects
// has to call mixer::inst()->checkValidityOfPlayHandles() in it's dtor
// and set flag before, so LMMS doesn't crash because these play-handles
// would continue using pointers to deleted objects...
virtual void checkValidity( void )
{
}
private:
} ;
typedef vvector<playHandle *> playHandleVector;
#endif

View File

@@ -0,0 +1,60 @@
/*
* preset_preview_play_handle.h - play-handle for playing a short preview-sound
* of a preset
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _PRESET_PREVIEW_PLAY_HANDLE_H
#define _PRESET_PREVIEW_PLAY_HANDLE_H
#include "play_handle.h"
class channelTrack;
class notePlayHandle;
class QMutex;
class presetPreviewPlayHandle : public playHandle
{
public:
presetPreviewPlayHandle( const QString & _preset_file );
virtual ~presetPreviewPlayHandle();
static void cleanUp( void );
virtual void play( void );
virtual bool done( void ) const;
private:
static channelTrack * s_globalChannelTrack;
static notePlayHandle * s_globalPreviewNote;
static QMutex * s_globalDataMutex;
notePlayHandle * m_previewNote;
} ;
#endif

98
include/project_notes.h Normal file
View File

@@ -0,0 +1,98 @@
/*
* project_notes.h - header for project-notes-editor
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _PROJECT_NOTES_H
#define _PROJECT_NOTES_H
#include "qt3support.h"
#ifdef QT4
#include <QMainWindow>
#else
#include <qmainwindow.h>
#endif
#include "settings.h"
class QAction;
class QComboBox;
class QTextEdit;
class projectNotes : public QMainWindow, public settings
{
Q_OBJECT
public:
projectNotes();
void clear( void );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "projectnotes" );
}
protected:
void setupActions( void );
private slots:
void textBold( void );
void textUnderline( void );
void textItalic( void );
void textFamily( const QString & _f );
void textSize( const QString & _p );
void textColor( void );
void textAlign( QAction * _a );
void fontChanged( const QFont & _f );
void colorChanged( const QColor & _c );
void alignmentChanged( int _a );
private:
QTextEdit * m_edit;
QAction * m_actionTextBold,
* m_actionTextUnderline,
* m_actionTextItalic,
* m_actionTextColor,
* m_actionAlignLeft,
* m_actionAlignCenter,
* m_actionAlignRight,
* m_actionAlignJustify;
QComboBox * m_comboFont;
QComboBox * m_comboSize;
} ;
#endif

177
include/qt3support.h Normal file
View File

@@ -0,0 +1,177 @@
/*
* qt3support.h - layer for supporting Qt3
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _QT3SUPPORT_H
#define _QT3SUPPORT_H
// don't know why following line is neccessary, it's a bug in qt-headers -
// otherwise LMMS sometimes fails to compile
//#include <qmap.h>
#include <qglobal.h>
//#include <qpair.h>
#if QT_VERSION >= 0x040000
#ifndef QT4
#define QT4
#endif
#endif
#ifdef QT4
class QColorGroup;
#include <Qt3Support/Q3ListView>
typedef int csize;
#define QListViewItem Q3ListViewItem
#define vvector QVector
#define vlist QList
#else
#define vvector QValueVector
#define vlist QValueList
#define QMenu QPopupMenu
#define QAbstractButton QButton
#define QScrollArea QScrollView
// QWidget
#define setWindowTitle setCaption
#define setWindowIcon setIcon
#define isExplicitlyHidden isHidden
#define accessibleName name
#define ensurePolished constPolish
// QMenu/QPopupMenu
#define addAction insertItem
//#define addSeparator insertSeparator
// QFile/QIODevice
#define seek at
// QFileDialog
#define setFileMode setMode
#define setDirectory setDir
#define selectFile setSelection
// QThread
#define isRunning running
// QScrollView/QScrollArea
#define setHorizontalScrollBarPolicy setHScrollBarMode
// QScrollBar
#define setMaximum setMaxValue
#define setMinimum setMinValue
// QAbstractButton/QButton
#define setCheckable setToggleButton
// QInputEvent/QKeyEvent
#define modifiers state
// QButtonGroup
#define addButton insert
// QProgressBar
#define setTextVisible setPercentageVisible
// QFileInfo
//#define completeSuffix extension
//#define suffix() extension( FALSE )
// QComboBox
#define addItem insertItem
//#define currentIndex currentItem
//#define setCurrentIndex setCurrentItem
// QString
#define toLower lower
// QTextEdit
#define setLineWrapMode setWordWrap
#define setPlainText setText
// QSlider
#define setTickPosition setTickmarks
// QStatusBar/QSplashScreen
#define showMessage message
#define clearMessage clear
// QDir
#define NoFilter DefaultFilter
#define homePath homeDirPath
#define rootPath rootDirPath
//#define absolutePath absPath
// QToolButton
#define setMenu setPopup
// QPixmap
#define transformed xForm
#define Q3ListView QListView
#define Q3ListViewItem QListViewItem
#define Q3ScrollView QScrollView
#define QMatrix QWMatrix
#define QIcon QIconSet
#define ShiftModifier ShiftButton
#define ControlModifier ControlButton
typedef unsigned int csize;
#endif
#endif

70
include/rename_dialog.h Normal file
View File

@@ -0,0 +1,70 @@
/*
* rename_dialog.h - declaration of class renameDialog, a simple dialog for
* changing the content of a string
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _RENAME_DIALOG_H
#define _RENAME_DIALOG_H
#include "qt3support.h"
#ifdef QT4
#include <QDialog>
#else
#include <qdialog.h>
#endif
class QLineEdit;
class renameDialog : public QDialog
{
Q_OBJECT
public:
renameDialog( QString & _string );
~renameDialog();
protected:
void keyPressEvent( QKeyEvent * _ke );
protected slots:
void textChanged( const QString & _new_string );
private:
QString & m_stringToEdit;
QString m_originalString;
QLineEdit * m_stringLE;
} ;
#endif

168
include/sample_buffer.h Normal file
View File

@@ -0,0 +1,168 @@
/*
* sample_buffer.h - container-class sampleBuffer
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SAMPLE_BUFFER_H
#define _SAMPLE_BUFFER_H
#include "qt3support.h"
#ifdef QT4
#include <QObject>
#include <QMutex>
#else
#include <qobject.h>
#include <qmutex.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_SAMPLERATE_H
#include <samplerate.h>
#endif
#include "mixer.h"
#include "types.h"
class QPainter;
class sampleBuffer : public QObject
{
Q_OBJECT
public:
enum drawMethods
{
LINE_CONNECT,
DOTS
} ;
sampleBuffer( const QString & _audio_file = "" );
sampleBuffer( const sampleFrame * _data, Uint32 _frames );
~sampleBuffer();
bool FASTCALL play( sampleFrame * _ab, Uint32 _start_frame,
Uint32 _frames =
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 );
}
void FASTCALL deleteResamplingData( void * * _ptr );
QString openAudioFile( void ) const;
public slots:
void setAudioFile( const QString & _audio_file );
void setStartFrame( Uint32 _s );
void setEndFrame( Uint32 _e );
void setAmplification( float _a );
void setReversed( bool _on );
private:
void FASTCALL update( bool _keep_settings = FALSE );
#ifdef SDL_SDL_SOUND_H
Uint32 FASTCALL decodeSampleSDL( const char * _f, Sint16 * & _buf,
Uint8 & _channels );
#endif
#ifdef HAVE_SNDFILE_H
Uint32 FASTCALL decodeSampleSF( const char * _f, Sint16 * & _buf,
Uint8 & _channels );
#endif
#ifdef HAVE_VORBIS_VORBISFILE_H
Uint32 FASTCALL decodeSampleOGG( const char * _f, Sint16 * & _buf,
Uint8 & _channels );
#endif
QString m_audioFile;
sampleFrame * m_origData;
Uint32 m_origFrames;
sampleFrame * m_data;
Uint32 m_frames;
Uint32 m_startFrame;
Uint32 m_endFrame;
float m_amplification;
bool m_reversed;
QMutex m_dataMutex;
#ifdef HAVE_SAMPLERATE_H
void initResampling( void );
void quitResampling( void );
SRC_STATE * createResamplingContext( void );
void FASTCALL destroyResamplingContext( SRC_STATE * _context );
SRC_DATA m_srcData;
SRC_STATE * m_srcState;
#endif
signals:
void sampleUpdated( void );
} ;
#endif

View File

@@ -0,0 +1,66 @@
/*
* sample_play_handle.h - play-handle for playing a sample
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SAMPLE_PLAY_HANDLE_H
#define _SAMPLE_PLAY_HANDLE_H
#include "play_handle.h"
#include "types.h"
class sampleBuffer;
class samplePlayHandle : public playHandle
{
public:
samplePlayHandle( const QString & _sample_file );
samplePlayHandle( sampleBuffer * _sample_buffer );
virtual ~samplePlayHandle();
virtual void play( void );
virtual bool done( void ) const;
Uint32 totalFrames( void ) const;
inline Uint32 framesDone( void ) const
{
return( m_frame );
}
void setDoneMayReturnTrue( bool _enable )
{
m_doneMayReturnTrue = _enable;
}
private:
sampleBuffer * m_sampleBuffer;
const bool m_ownSampleBuffer;
bool m_doneMayReturnTrue;
Uint32 m_frame;
} ;
#endif

151
include/sample_track.h Normal file
View File

@@ -0,0 +1,151 @@
/*
* sample_track.h - class sampleTrack, a track which provides arrangement of
* samples
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SAMPLE_TRACK_H
#define _SAMPLE_TRACK_H
#include "qt3support.h"
#ifdef QT4
#include <QDialog>
#else
#include <qdialog.h>
#endif
#include "track.h"
#include "sample_buffer.h"
class nameLabel;
class QLabel;
//class sampleTCOSettingsDialog;
class sampleTCO : public trackContentObject
{
Q_OBJECT
public:
sampleTCO( track * _track );
virtual ~sampleTCO();
virtual void FASTCALL changeLength( const midiTime & _length );
void FASTCALL play( sampleFrame * _ab, Uint32 _start_frame,
Uint32 _frames );
const QString & sampleFile( void ) const;
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "sampletco" );
}
public slots:
void setSampleFile( const QString & _sf );
void updateLength( int = 0 );
protected:
void paintEvent( QPaintEvent * );
void mouseDoubleClickEvent( QMouseEvent * );
midiTime getSampleLength( void ) const;
private:
sampleBuffer m_sampleBuffer;
//friend class sampleTCOSettingsDialog;
} ;
/*
class sampleTCOSettingsDialog : public QDialog
{
Q_OBJECT
public:
sampleTCOSettingsDialog( sampleTCO * _stco );
~sampleTCOSettingsDialog();
protected slots:
void openSampleFile( void );
void setSampleFile( const QString & _f );
private:
sampleTCO * m_sampleTCO;
QLabel * m_fileLbl;
} ;
*/
class sampleTrack : public QObject, public track
{
Q_OBJECT
public:
sampleTrack( trackContainer * _tc );
virtual ~sampleTrack();
virtual trackTypes trackType( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
Uint32 _start_frame, Uint32 _frames,
Uint32 _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
public slots:
virtual QString nodeName( void ) const
{
return( "sampletrack" );
}
private:
nameLabel * m_trackLabel;
} ;
#endif

113
include/setup_dialog.h Normal file
View File

@@ -0,0 +1,113 @@
/*
* setup_dialog.h - dialog for setting up LMMS
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SETUP_DIALOG_H
#define _SETUP_DIALOG_H
#include "qt3support.h"
#ifdef QT4
#include <QDialog>
#include <QMap>
#else
#include <qdialog.h>
#include <qmap.h>
#endif
#include "audio_device.h"
#include "midi_device.h"
class QComboBox;
class QLabel;
class QSlider;
class tabBar;
class setupDialog : public QDialog
{
Q_OBJECT
public:
enum configTabs
{
GENERAL_SETTINGS, AUDIO_SETTINGS, MIDI_SETTINGS
} ;
setupDialog( configTabs _tab_to_open = GENERAL_SETTINGS );
~setupDialog();
protected slots:
virtual void accept( void );
private slots:
// general settings widget
void setBufferSize( int _value );
void resetBufSize( void );
void displayBufSizeHelp( void );
// audio settings widget
void audioInterfaceChanged( const QString & _driver );
void displayAudioHelp( void );
// MIDI settings widget
void midiInterfaceChanged( const QString & _driver );
void displayMIDIHelp( void );
void toggleToolTips( bool _disabled );
void toggleKnobUsability( bool _classical );
private:
tabBar * m_tabBar;
QSlider * m_bufSizeSlider;
QLabel * m_bufSizeLbl;
int m_bufferSize;
bool m_disableToolTips;
bool m_classicalKnobUsability;
typedef QMap<QString, audioDevice::setupWidget *> aswMap;
typedef QMap<QString, midiDevice::setupWidget *> mswMap;
QComboBox * m_audioInterfaces;
aswMap m_audioIfaceSetupWidgets;
QComboBox * m_midiInterfaces;
mswMap m_midiIfaceSetupWidgets;
} ;
#endif

106
include/side_bar.h Normal file
View File

@@ -0,0 +1,106 @@
/*
* side_bar.h - code for side-bar in LMMS
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SIDE_BAR_H
#define _SIDE_BAR_H
#include "qt3support.h"
#ifdef QT4
#include <QMap>
#else
#include <qmap.h>
#endif
#include "kmultitabbar.h"
#include "side_bar_widget.h"
class sideBar : public KMultiTabBar
{
Q_OBJECT
public:
sideBar( Qt::Orientation _o, QWidget * _parent ) :
KMultiTabBar( _o, _parent )
{
}
virtual ~sideBar()
{
}
inline int appendTab( sideBarWidget * _sbw, int _id )
{
int ret = KMultiTabBar::appendTab( _sbw->icon(), _id,
_sbw->title() );
m_widgets[_id] = _sbw;
_sbw->hide();
_sbw->setMinimumWidth( 200 );
connect( tab( _id ), SIGNAL( clicked( int ) ), this,
SLOT( tabClicked( int ) ) );
return( ret );
}
private slots:
inline void tabClicked( int _id )
{
// disable all other tabbar-buttons
QMap<int, QWidget *>::Iterator it;
for( it = m_widgets.begin(); it != m_widgets.end(); ++it )
{
if( it.key() != _id/* && isTabRaised(it.key()) == TRUE*/ )
{
setTab( it.key(), FALSE );
}
if( m_widgets[it.key()] != NULL )
{
m_widgets[it.key()]->hide();
}
}
if( m_widgets[_id] != NULL )
{
if( isTabRaised( _id ) )
{
m_widgets[_id]->show();
}
else
{
m_widgets[_id]->hide();
}
}
}
private:
QMap<int, QWidget *> m_widgets;
} ;
#endif

88
include/side_bar_widget.h Normal file
View File

@@ -0,0 +1,88 @@
/*
* side_bar_widget.h - base-class for all side-bar-widgets
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SIDE_BAR_WIDGET_H
#define _SIDE_BAR_WIDGET_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QVBoxLayout>
#include <QPixmap>
#else
#include <qwidget.h>
#include <qlayout.h>
#include <qpixmap.h>
#endif
class sideBarWidget : public QWidget
{
Q_OBJECT
public:
sideBarWidget( const QString & _title, const QPixmap & _icon,
QWidget * _parent );
~sideBarWidget();
inline const QPixmap & icon( void ) const
{
return( m_icon );
}
inline const QString & title( void ) const
{
return( m_title );
}
protected:
void paintEvent( QPaintEvent * _pe );
void resizeEvent( QResizeEvent * _re );
inline void contextMenuEvent( QContextMenuEvent * )
{
}
inline QWidget * contentParent( void )
{
return( m_contents );
}
inline void addContentWidget( QWidget * _w )
{
m_layout->addWidget( _w );
}
private:
QWidget * m_contents;
QVBoxLayout * m_layout;
QString m_title;
QPixmap m_icon;
} ;
#endif

342
include/song_editor.h Normal file
View File

@@ -0,0 +1,342 @@
/*
* song_editor.h - declaration of class songEditor, a window where you can
* setup your songs
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SONG_EDITOR_H
#define _SONG_EDITOR_H
#include "qt3support.h"
#ifdef QT4
#include <QMap>
#else
#include <qmap.h>
#endif
#include "lmms_main_win.h"
#include "track_container.h"
#include "types.h"
class QLabel;
class QPixmap;
class QPushButton;
class QScrollBar;
class QSlider;
class QToolButton;
class exportProjectDialog;
class lcdSpinBox;
class pattern;
class projectNotes;
class timeLine;
class visualizationWidget;
const int MIN_BPM = 10;
const int DEFAULT_BPM = 140;
const int MAX_BPM = 1000;
const Uint16 MAX_SONG_LENGTH = 9999;
class songEditor : public trackContainer
{
Q_OBJECT
public:
enum playModes
{
PLAY_SONG,
PLAY_TRACK,
PLAY_BB,
PLAY_PATTERN,
PLAY_MODE_CNT
} ;
class playPos : public midiTime
{
public:
playPos( Sint32 _abs = 0 ) :
midiTime( _abs ),
m_timeLine( NULL ),
m_timeLineUpdate( TRUE ),
m_currentFrame( 0 )
{
}
inline void setCurrentFrame( Uint32 _f )
{
m_currentFrame = _f;
}
inline Uint32 currentFrame( void ) const
{
return( m_currentFrame );
}
timeLine * m_timeLine;
bool m_timeLineUpdate;
private:
Uint32 m_currentFrame;
} ;
static inline songEditor * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new songEditor();
}
return( s_instanceOfMe );
}
void processNextBuffer( void );
inline bool paused( void ) const
{
return( m_paused );
}
inline bool playing( void ) const
{
return( m_playing && m_exporting == FALSE );
}
inline bool exporting( void ) const
{
return( m_exporting );
}
inline bool exportDone( void ) const
{
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] );
}
// every function that replaces current file (e.g. creates new file,
// opens another file...) has to call this before and may only process
// if this function returns true
bool mayChangeProject( void );
float framesPerTact( void ) const;
// file management
void createNewProject( void );
void FASTCALL createNewProjectFromTemplate( const QString & _template );
void FASTCALL loadProject( const QString & _file_name );
bool saveProject( void );
bool FASTCALL saveProjectAs( const QString & _file_name );
inline const QString & projectFileName( void ) const
{
return( m_fileName );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "songeditor" );
}
virtual inline bool fixedTCOs( void ) const
{
return( FALSE );
}
int masterPitch( void ) const;
projectNotes * getProjectNotesWindow( void )
{
return( m_projectNotes );
}
public slots:
void play( void );
void stop( void );
void playTrack( track * _trackToPlay );
void playBB( void );
void playPattern( pattern * _patternToPlay, bool _loop = TRUE );
void pause( void );
void resumeFromPause( void );
void importProject( void );
void exportProject( void );
void startExport( void );
void stopExport( void );
// set BPM (beats per minute)
void setBPM( int _new_bpm = DEFAULT_BPM );
inline void setModified( void )
{
m_modified = TRUE;
}
protected:
void closeEvent( QCloseEvent * _ce );
void resizeEvent( QResizeEvent * _re );
void keyPressEvent( QKeyEvent * _ke );
void wheelEvent( QWheelEvent * _we );
void paintEvent( QPaintEvent * _pe );
protected slots:
void insertTact( void );
void removeTact( void );
void addChannelTrack( void );
void addBBTrack( void );
void addSampleTrack( void );
void scrolled( int _new_pos );
void updateTimeLinePosition( void );
void masterVolumeChanged( int _new_val );
void masterVolumePressed( void );
void masterVolumeMoved( int _new_val );
void masterVolumeReleased( void );
void masterPitchChanged( int _new_val );
void masterPitchPressed( void );
void masterPitchMoved( int _new_val );
void masterPitchReleased( void );
void toggleHQMode( void );
void updatePosition( const midiTime & _t );
private:
songEditor();
songEditor( const songEditor & );
virtual ~songEditor();
void clearProject( void );
inline tact currentTact( void ) const
{
return( m_playPos[m_playMode].getTact() );
}
midiTime length( void ) const;
tact lengthInTacts( void ) const;
inline tact64th currentTact64th( void ) const
{
return( m_playPos[m_playMode].getTact64th() );
}
void FASTCALL setPlayPos( tact _tact_num, tact64th _t_64th, playModes
_play_mode );
static songEditor * s_instanceOfMe;
QScrollBar * m_leftRightScroll;
QToolButton * m_playButton;
QToolButton * m_stopButton;
lcdSpinBox * m_bpmSpinBox;
QSlider * m_masterVolumeSlider;
QSlider * m_masterPitchSlider;
visualizationWidget * m_masterOutputGraph;
QToolButton * m_addChannelTrackButton;
QToolButton * m_addBBTrackButton;
QToolButton * m_addSampleTrackButton;
QToolButton * m_insertTactButton;
QToolButton * m_removeTactButton;
QString m_fileName;
QString m_oldFileName;
bool m_modified;
volatile bool m_exporting;
volatile bool m_playing;
volatile bool m_paused;
playModes m_playMode;
playPos m_playPos[PLAY_MODE_CNT];
track * m_trackToPlay;
pattern * m_patternToPlay;
bool m_loopPattern;
bool m_scrollBack;
exportProjectDialog * m_epd;
projectNotes * m_projectNotes;
enum ACTIONS
{
ACT_STOP_PLAY, ACT_PLAY_SONG, ACT_PLAY_TRACK, ACT_PLAY_BB,
ACT_PLAY_PATTERN, ACT_PAUSE, ACT_RESUME_FROM_PAUSE
} ;
vvector<ACTIONS> m_actions;
void doActions( void );
bool m_shiftPressed;
bool m_controlPressed;
friend lmmsMainWin::~lmmsMainWin();
signals:
void bpmChanged( int _new_bpm );
} ;
#endif

View File

@@ -0,0 +1,135 @@
/*
* spc_bg_hndl_widget.h - class specialBgHandlingWidget
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SPC_BG_HNDL_WIDGET_H
#define _SPC_BG_HNDL_WIDGET_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QPainter>
#include <QPixmap>
#else
#include <qwidget.h>
#include <qpixmap.h>
#endif
class specialBgHandlingWidget
{
public:
specialBgHandlingWidget( const QPixmap & _pm ) :
m_backgroundPixmap( _pm ),
m_backgroundColor( QColor( 0, 0, 0 ) )
{
}
specialBgHandlingWidget( const QColor & _c ) :
m_backgroundPixmap(),
m_backgroundColor( _c )
{
}
~specialBgHandlingWidget()
{
}
const QPixmap & backgroundPixmap( void ) const
{
return( m_backgroundPixmap );
}
const QColor & backgroundColor( void ) const
{
return( m_backgroundColor );
}
static QPixmap getBackground( const QWidget * _w )
{
QPixmap pm( _w->size() );
const QWidget * pw = _w->parentWidget();
if( dynamic_cast<const specialBgHandlingWidget *>( pw ) )
{
const specialBgHandlingWidget * s = dynamic_cast<
const specialBgHandlingWidget *>( pw );
if( s->backgroundPixmap().isNull() == FALSE )
{
#ifdef QT4
QPainter p( &pm );
p.drawPixmap( 0, 0, s->backgroundPixmap(),
_w->x(), _w->y(), _w->width(),
_w->height() );
#else
bitBlt( &pm, 0, 0, &s->backgroundPixmap(),
_w->x(), _w->y(), _w->width(),
_w->height() );
#endif
}
else
{
pm.fill( s->backgroundColor() );
}
}
else
{
#ifdef QT4
QPainter p( &pm );
// TODO: fix that for background-pixmaps, because
// drawing is started at the top left edge even
// if this widget isn't posated there
p.fillRect( _w->rect(), pw->palette().brush(
pw->backgroundRole() ) );
#else
const QPixmap * pbp = pw->paletteBackgroundPixmap();
if( pbp == NULL )
{
pbp = pw->erasePixmap();
}
if( pbp )
{
bitBlt( &pm, 0, 0, pbp, _w->x(), _w->y(),
_w->width(), _w->height() );
}
else
{
pm.fill( pw->paletteBackgroundColor() );
}
#endif
}
return( pm );
}
private:
QPixmap m_backgroundPixmap;
QColor m_backgroundColor;
} ;
#endif

91
include/surround_area.h Normal file
View File

@@ -0,0 +1,91 @@
/*
* surround_area.h - class surroundArea which provides widget for setting
* position of a channel + calculation of volume for each
* speaker
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _SURROUND_AREA_H
#define _SURROUND_AREA_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#else
#include <qwidget.h>
#endif
#include "types.h"
#include "mixer.h"
#include "templates.h"
class QPixmap;
const int SURROUND_AREA_SIZE = 1024;
class surroundArea : public QWidget
{
Q_OBJECT
public:
surroundArea( QWidget * _parent = NULL );
virtual ~surroundArea();
volumeVector getVolumeVector( float _v_scale = 0.0f ) const;
inline const QPoint & value( void ) const
{
return( m_sndSrcPos );
}
void FASTCALL setValue( const QPoint & _p );
protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
signals:
void valueChanged( const QPoint & _p );
private:
float FASTCALL getVolume( const QPoint & _speaker_pos,
float _v_scale ) const;
QPoint m_sndSrcPos;
static const QPoint s_defaultSpeakerPositions[SURROUND_CHANNELS];
static QPixmap * s_backgroundArtwork;
} ;
#endif

102
include/tab_bar.h Normal file
View File

@@ -0,0 +1,102 @@
/*
* tab_bar.h - class tabBar
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TAB_BAR_H
#define _TAB_BAR_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QMap>
#include <QLayout>
#else
#include <qwidget.h>
#include <qmap.h>
#include <qlayout.h>
#endif
class tabButton;
class tabBar : public QWidget
{
Q_OBJECT
public:
tabBar( QWidget * _parent,
QBoxLayout::Direction _dir = QBoxLayout::LeftToRight );
virtual ~tabBar();
tabButton * FASTCALL addTab( QWidget * _w, const QString & _text,
int _id, bool _add_stretch = FALSE,
bool _text_is_tooltip = FALSE );
void FASTCALL removeTab( int _id );
inline void setExclusive( bool _on )
{
m_exclusive = _on;
}
int activeTab( void );
public slots:
void setActiveTab( int _id );
protected:
bool FASTCALL tabState( int _id );
void FASTCALL setTabState( int _id, bool _checked );
bool allHidden( void );
protected slots:
void hideAll( int _exception = -1 );
void tabClicked( int _id );
private:
QMap<int, QPair<tabButton *, QWidget *> > m_tabs;
QBoxLayout * m_layout;
bool m_exclusive;
signals:
void allWidgetsHidden( void );
void widgetShown( void );
} ;
#endif

75
include/tab_button.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* tab_button.h - declaration of class tabButton
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TAB_BUTTON_H
#define _TAB_BUTTON_H
#include "qt3support.h"
#ifdef QT4
#include <QPushButton>
#else
#include <qpushbutton.h>
#endif
class tabButton : public QPushButton
{
Q_OBJECT
public:
tabButton( const QString & _text, int _id, QWidget * _parent ) :
QPushButton( _text, _parent ),
m_id( _id )
{
setCheckable( TRUE );
connect( this, SIGNAL( clicked() ), this,
SLOT( slotClicked() ) );
}
virtual ~tabButton()
{
}
signals:
void clicked( int );
protected slots:
void slotClicked( void )
{
emit clicked( m_id );
}
private:
int m_id;
} ;
#endif

74
include/tab_widget.h Normal file
View File

@@ -0,0 +1,74 @@
/*
* tab_widget.h - LMMS-tabwidget
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TAB_WIDGET_H
#define _TAB_WIDGET_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QVector>
#else
#include <qwidget.h>
#include <qvaluevector.h>
#endif
class tabWidget : public QWidget
{
Q_OBJECT
public:
tabWidget( const QString & _caption, QWidget * _parent );
~tabWidget();
void addTab( QWidget * _w, const QString & _name );
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
private:
struct widgetDesc
{
QWidget * w; // ptr to widget
QString name; // name for widget
int nwidth; // width of name when painting
} ;
typedef vvector<widgetDesc> widgetStack;
widgetStack m_widgets;
int m_curWidget;
QString m_caption;
} ;
#endif

102
include/templates.h Normal file
View File

@@ -0,0 +1,102 @@
/*
* templates.h - miscellanous templates and algorithms
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TEMPLATES_H
#define _TEMPLATES_H
#include "qt3support.h"
#ifdef QT4
#include <QtAlgorithms>
#include <QX11Info>
#include <QFont>
#else
#include <qtl.h>
#include <qpaintdevice.h>
#include <qfont.h>
#endif
template<class T>
inline T tAbs( const T & x )
{
return( x < static_cast<T>( 0 ) ? -x : x );
}
template<class T>
inline T tMin( const T & x1, const T & x2 )
{
if( x1 < x2 )
{
return( x1 );
}
return( x2 );
}
template<class T>
inline T tMax( const T & x1, const T & x2 )
{
if( x1 > x2 )
{
return( x1 );
}
return( x2 );
}
template<class T>
inline T tLimit( const T & x, const T & x1, const T & x2 )
{
return( tMin<T>( tMax<T>( x, tMin<T>( x1, x2 ) ),
tMax<T>( x1, x2 ) ) );
}
template<int SIZE>
inline QFont pointSize( QFont _f )
{
const int DPI = 96;
#ifdef QT4
_f.setPointSizeF( SIZE * DPI / QX11Info::appDpiX() );
#else
_f.setPointSizeFloat( SIZE * DPI / QPaintDevice::x11AppDpiX() );
#endif
return( _f );
}
#endif

66
include/text_float.h Normal file
View File

@@ -0,0 +1,66 @@
/*
* text_float.h - class textFloat, a floating text-label
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TEXT_FLOAT
#define _TEXT_FLOAT
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#else
#include <qwidget.h>
#endif
class textFloat : public QWidget
{
public:
textFloat( QWidget * _parent );
virtual ~textFloat()
{
}
void setText( const QString & _text );
void reparent( QWidget * _new_parent );
void setVisibilityTimeOut( int _msecs );
protected:
virtual void paintEvent( QPaintEvent * _me );
private:
QString m_text;
} ;
#endif

160
include/timeline.h Normal file
View File

@@ -0,0 +1,160 @@
/*
* timeline.h - class timeLine, representing a time-line with position marker
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TIMELINE_H
#define _TIMELINE_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#else
#include <qwidget.h>
#endif
#include "song_editor.h"
class QPixmap;
class nStateButton;
class timeLine : public QWidget
{
Q_OBJECT
public:
timeLine( int _xoff, int _yoff, float _ppt, songEditor::playPos & _pos,
const midiTime & _begin, QWidget * _parent );
~timeLine();
inline songEditor::playPos & pos( void )
{
return( m_pos );
}
enum behaviourAtStopStates
{
BACK_TO_ZERO, BACK_TO_START, KEEP_STOP_POSITION
} ;
behaviourAtStopStates behaviourAtStop( void ) const;
bool loopPointsEnabled( void ) const;
inline const midiTime & loopBegin( void ) const
{
return( ( m_loopPos[0] < m_loopPos[1] ) ?
m_loopPos[0] : m_loopPos[1] );
}
inline const midiTime & loopEnd( void ) const
{
return( ( m_loopPos[0] > m_loopPos[1] ) ?
m_loopPos[0] : m_loopPos[1] );
}
inline void savePos( const midiTime & _pos )
{
m_savedPos = _pos;
}
inline const midiTime & savedPos( void ) const
{
return( m_savedPos );
}
inline void setPixelsPerTact( float _ppt )
{
m_ppt = _ppt;
update();
}
public slots:
void updatePosition( const midiTime & = 0 );
void toggleLoopPoints( int _n );
protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
private:
inline int markerX( const midiTime & _t ) const
{
return( m_xOffset + static_cast<int>( ( _t - m_begin ) *
m_ppt / 64.0f ) );
}
static QPixmap * s_timeLinePixmap;
static QPixmap * s_posMarkerPixmap;
static QPixmap * s_loopPointPixmap;
nStateButton * m_autoScroll;
nStateButton * m_loopPoints;
nStateButton * m_behaviourAtStop;
int m_xOffset;
int m_posMarkerX;
float m_ppt;
songEditor::playPos & m_pos;
const midiTime & m_begin;
midiTime m_loopPos[2];
midiTime m_savedPos;
enum actions
{
NONE, MOVE_POS_MARKER, MOVE_LOOP_BEGIN, MOVE_LOOP_END
} m_action;
int m_moveXOff;
enum autoScrollStates
{
AUTOSCROLL_ENABLED, AUTOSCROLL_DISABLED
} ;
enum loopPointStates
{
LOOP_POINTS_DISABLED, LOOP_POINTS_ENABLED
} ;
signals:
void positionChanged( const midiTime & _t );
} ;
#endif

42
include/tooltip.h Normal file
View File

@@ -0,0 +1,42 @@
/*
* tooltip.h - namespace toolTip, a tooltip-wrapper for LMMS
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TOOLTIP_H
#define _TOOLTIP_H
#include <qstring.h>
class QWidget;
namespace toolTip
{
void add( QWidget * _w, const QString & _txt );
//void remove( QWidget * _w );
} ;
#endif

358
include/track.h Normal file
View File

@@ -0,0 +1,358 @@
/*
* track.h - declaration of classes concerning tracks -> neccessary for all
* track-like objects (beat/bassline, sample-track...)
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TRACK_H
#define _TRACK_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QVector>
#include <QList>
#include <QWidget>
#else
#include <qwidget.h>
#include <qvaluevector.h>
#include <qvaluelist.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "types.h"
#include "midi_time.h"
#include "settings.h"
class track;
class trackContainer;
class trackContentWidget;
class trackWidget;
class pixmapButton;
class QMenu;
typedef QWidget trackSettingsWidget;
typedef QWidget trackOperationsWidget;
const Uint16 DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
const Uint16 TRACK_OP_WIDTH = 70;
const Uint16 TCO_BORDER_WIDTH = 1;
class trackContentObject : public QWidget, public settings
{
Q_OBJECT
public:
trackContentObject( track * _track );
trackContentObject( const trackContentObject & _copy );
virtual ~trackContentObject();
inline track * getTrack( void )
{
return( m_track );
}
inline const midiTime & startPosition( void ) const
{
return( m_startPosition );
}
inline midiTime endPosition( void ) const
{
return( m_startPosition + m_length );
}
inline const midiTime & length( void ) const
{
return( m_length );
}
bool fixedTCOs( void );
virtual void FASTCALL movePosition( const midiTime & _pos );
virtual void FASTCALL changeLength( const midiTime & _length );
public slots:
virtual void close( void );
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void contextMenuEvent( QContextMenuEvent * _cme );
virtual void constructContextMenu( QMenu * )
{
}
void setAutoResizeEnabled( bool _e = FALSE );
float pixelsPerTact( void );
protected slots:
void cut( void );
void copy( void );
void paste( void );
private:
track * m_track;
midiTime m_startPosition;
midiTime m_length;
bool m_moving;
bool m_resizing;
bool m_autoResize;
Sint16 m_initialMouseX;
} ;
class trackContentWidget : public QWidget
{
Q_OBJECT
public:
trackContentWidget( trackWidget * _parent );
virtual ~trackContentWidget();
trackContentObject * FASTCALL getTCO( csize _tco_num );
csize numOfTCOs( void );
trackContentObject * FASTCALL addTCO( trackContentObject * _tco );
void FASTCALL removeTCO( csize _tco_num, bool _also_delete = TRUE );
void FASTCALL removeTCO( trackContentObject * _tco,
bool _also_delete = TRUE );
void removeAllTCOs( void );
void FASTCALL swapPositionOfTCOs( csize _tco_num1, csize _tco_num2 );
inline Uint16 pixelsPerTact( void ) const
{
return( m_pixelsPerTact );
}
inline void setPixelsPerTact( Uint16 _ppt )
{
m_pixelsPerTact = _ppt;
}
tact length( void ) const;
public slots:
void insertTact( const midiTime & _pos );
void removeTact( const midiTime & _pos );
void updateTCOs( void );
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void resizeEvent( QResizeEvent * _re );
private:
typedef vvector<trackContentObject *> tcoVector;
tcoVector m_trackContentObjects;
trackWidget * m_trackWidget;
Uint16 m_pixelsPerTact;
} ;
// actual widget shown in trackContainer
class trackWidget : public QWidget
{
Q_OBJECT
public:
trackWidget( track * _track, QWidget * _parent );
virtual ~trackWidget();
inline const track * getTrack( void ) const
{
return( m_track );
}
inline track * getTrack( void )
{
return( m_track );
}
inline const trackSettingsWidget & getTrackSettingsWidget( void ) const
{
return( m_trackSettingsWidget );
}
inline const trackContentWidget & getTrackContentWidget( void ) const
{
return( m_trackContentWidget );
}
inline trackSettingsWidget & getTrackSettingsWidget( void )
{
return( m_trackSettingsWidget );
}
inline trackContentWidget & getTrackContentWidget( void )
{
return( m_trackContentWidget );
}
bool muted( void ) const;
public slots:
void changePosition( const midiTime & _new_pos = -1 );
void cloneTrack( void );
void deleteTrack( void );
void moveTrackUp( void );
void moveTrackDown( void );
void setMuted( bool _muted );
void muteBtnRightClicked( void );
protected:
virtual void resizeEvent( QResizeEvent * _re );
virtual void paintEvent( QPaintEvent * _pe );
midiTime FASTCALL endPosition( const midiTime & _pos_start );
private:
track * m_track;
trackOperationsWidget m_trackOperationsWidget;
trackSettingsWidget m_trackSettingsWidget;
trackContentWidget m_trackContentWidget;
pixmapButton * m_muteBtn;
} ;
// base-class for all tracks
class track : public settings
{
public:
enum trackTypes
{
CHANNEL_TRACK,
BB_TRACK,
SAMPLE_TRACK,
EVENT_TRACK,
VIDEO_TRACK,
NULL_TRACK,
TOTAL_TRACK_TYPES
} ;
track( trackContainer * _tc );
virtual ~track();
static track * FASTCALL createTrack( trackTypes _tt,
trackContainer * _tc );
static track * FASTCALL createTrack( const QDomElement & _this,
trackContainer * _tc );
static track * FASTCALL cloneTrack( track * _track );
tact length( void ) const;
inline bool muted( void ) const
{
return( m_trackWidget->muted() );
}
// pure virtual functions
virtual trackTypes trackType( void ) const = 0;
virtual bool FASTCALL play( const midiTime & _start,
Uint32 _start_frame,
Uint32 _frames,
Uint32 _frame_base,
Sint16 _tco_num = -1 ) = 0;
virtual trackContentObject * FASTCALL createTCO(
const midiTime & _pos ) = 0;
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent ) = 0;
virtual void FASTCALL loadTrackSpecificSettings(
const QDomElement & _this ) = 0;
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
trackContentObject * FASTCALL addTCO( trackContentObject * _tco );
void FASTCALL removeTCO( csize _tco_num );
csize numOfTCOs( void );
trackContentObject * FASTCALL getTCO( csize _tco_num );
csize FASTCALL getTCONum( trackContentObject * _tco );
void FASTCALL getTCOsInRange( vlist<trackContentObject *> & _tco_v,
const midiTime & _start,
const midiTime & _end );
void FASTCALL swapPositionOfTCOs( csize _tco_num1, csize _tco_num2 );
inline trackWidget * getTrackWidget( void )
{
return( m_trackWidget );
}
inline trackContainer * getTrackContainer( void )
{
return( m_trackContainer );
}
inline const trackSettingsWidget * getTrackSettingsWidget( void ) const
{
return( &m_trackWidget->getTrackSettingsWidget() );
}
inline const trackContentWidget * getTrackContentWidget( void ) const
{
return( &m_trackWidget->getTrackContentWidget() );
}
inline trackSettingsWidget * getTrackSettingsWidget( void )
{
return( &m_trackWidget->getTrackSettingsWidget() );
}
inline trackContentWidget * getTrackContentWidget( void )
{
return( &m_trackWidget->getTrackContentWidget() );
}
private:
trackContainer * m_trackContainer;
trackWidget * m_trackWidget;
} ;
typedef vvector<track *> trackVector;
typedef vvector<const track *> constTrackVector;
#endif

119
include/track_container.h Normal file
View File

@@ -0,0 +1,119 @@
/*
* track_container.h - base-class for all track-containers like Playlist-Editor, BB-Editor...
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TRACK_CONTAINER_H
#define _TRACK_CONTAINER_H
#include "qt3support.h"
#ifdef QT4
#include <QScrollArea>
#include <QVector>
#include <QMainWindow>
#else
#include <qscrollview.h>
#include <qvaluevector.h>
#include <qmainwindow.h>
#endif
#include "track.h"
#include "settings.h"
class trackContainer : public QMainWindow, public settings
{
Q_OBJECT
public:
trackContainer();
~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;
void FASTCALL setMutedOfAllTracks( bool _muted );
virtual void updateAfterTrackAdd( void );
void FASTCALL setPixelsPerTact( Uint16 _ppt );
void FASTCALL cloneTrack( track * _track );
void FASTCALL addTrack( track * _track );
void FASTCALL removeTrack( track * _track );
void FASTCALL moveTrackUp( track * _track );
void FASTCALL moveTrackDown( track * _track );
void FASTCALL realignTracks( bool _complete_update = FALSE );
protected:
constTrackVector tracks( void ) const;
trackVector tracks( void );
virtual void resizeEvent( QResizeEvent * );
midiTime m_currentPosition;
protected slots:
void updateScrollArea( void );
private:
QScrollArea * m_scrollArea;
typedef vvector<trackWidget *> trackWidgetVector;
trackWidgetVector m_trackWidgets;
float m_ppt;
signals:
void positionChanged( const midiTime & _pos );
} ;
#endif

48
include/types.h Normal file
View File

@@ -0,0 +1,48 @@
/*
* types.h - typedefs for common types that are used in the whole app
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _TYPES_H
#define _TYPES_H
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef signed short Sint16;
typedef unsigned int Uint32;
typedef signed int Sint32;
typedef Uint32 minute;
typedef Sint8 second;
typedef Sint32 tact;
typedef Sint8 tact64th;
typedef Uint8 volume;
typedef Sint8 panning;
typedef float sampleType;
typedef Sint16 outputSampleType;
#endif

View File

@@ -0,0 +1,81 @@
/*
* visualization_widget.h - widget for visualization of waves
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _OUTPUT_GRAPH_H
#define _OUTPUT_GRAPH_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QPixmap>
#else
#include <qwidget.h>
#include <qpixmap.h>
#endif
#include "mixer.h"
class QTimer;
class visualizationWidget : public QWidget
{
Q_OBJECT
public:
enum visualizationTypes
{
SIMPLE // add more here
} ;
visualizationWidget( const QPixmap & _bg, QWidget * _parent,
visualizationTypes _vtype = SIMPLE );
virtual ~visualizationWidget();
protected:
void paintEvent( QPaintEvent * _pe );
void mousePressEvent( QMouseEvent * _me );
protected slots:
void setAudioBuffer( const surroundSampleFrame * _ab, Uint32 _frames );
private:
QPixmap s_background;
bool m_enabled;
surroundSampleFrame * m_buffer;
Uint32 m_frames;
QTimer * m_updateTimer;
} ;
#endif

33
include/volume.h Normal file
View File

@@ -0,0 +1,33 @@
/*
* volume.h - declaration of some constants and types, concerning the volume of a note
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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 _VOLUME_H
#define _VOLUME_H
#include "types.h"
const volume MIN_VOLUME = 0;
const volume MAX_VOLUME = 200;
const volume DEFAULT_VOLUME = 100;
#endif