moved old trunk to lmms-pre-mv-branch

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@729 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-02-28 11:33:26 +00:00
472 changed files with 52934 additions and 16749 deletions

1001
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@@ -47,7 +47,6 @@ man1_MANS = lmms.1
lmms_MOC = \
./about_dialog.moc \
./arp_and_chords_tab_widget.moc \
./automatable_button.moc \
./automatable_slider.moc \
./automation_editor.moc \
@@ -63,13 +62,15 @@ lmms_MOC = \
./effect_control_dialog.moc \
./effect_label.moc \
./effect_select_dialog.moc \
./effect_tab_widget.moc \
./envelope_and_lfo_widget.moc \
./envelope_tab_widget.moc \
./envelope_and_lfo_parameters.moc \
./envelope_and_lfo_view.moc \
./export_project_dialog.moc \
./fade_button.moc \
./file_browser.moc \
./graph.moc \
./group_box.moc \
./instrument_midi_io.moc \
./instrument_midi_io_view.moc \
./kmultitabbar.moc \
./knob.moc \
./ladspa_control.moc \
@@ -77,27 +78,28 @@ lmms_MOC = \
./led_checkbox.moc \
./main_window.moc \
./mixer.moc \
./mv_base.moc \
./name_label.moc \
./nstate_button.moc \
./meter_dialog.moc \
./midi_alsa_seq.moc \
./midi_tab_widget.moc \
./instrument_midi_io.moc \
./pattern.moc \
./piano_roll.moc \
./piano_widget.moc \
./piano.moc \
./pixmap_button.moc \
./plugin_browser.moc \
./project_notes.moc \
./rack_plugin.moc \
./rack_view.moc \
./effect_view.moc \
./effect_rack_view.moc \
./rubberband.moc \
./rename_dialog.moc \
./sample_buffer.moc \
./sample_play_handle.moc \
./sample_track.moc \
./setup_dialog.moc \
./side_bar.moc \
./side_bar_widget.moc \
./song.moc \
./song_editor.moc \
./surround_area.moc \
./tab_bar.moc \
@@ -151,7 +153,6 @@ lmms_SOURCES = \
$(srcdir)/src/audio/audio_sample_recorder.cpp \
$(srcdir)/src/audio/audio_sdl.cpp \
$(srcdir)/src/core/about_dialog.cpp \
$(srcdir)/src/core/arp_and_chords_tab_widget.cpp \
$(srcdir)/src/core/automation_editor.cpp \
$(srcdir)/src/core/automation_pattern.cpp \
$(srcdir)/src/core/bb_editor.cpp \
@@ -159,34 +160,35 @@ lmms_SOURCES = \
$(srcdir)/src/core/effect_chain.cpp \
$(srcdir)/src/core/effect_control_dialog.cpp \
$(srcdir)/src/core/effect_select_dialog.cpp \
$(srcdir)/src/core/effect_tab_widget.cpp \
$(srcdir)/src/core/effect.cpp \
$(srcdir)/src/core/engine.cpp \
$(srcdir)/src/core/envelope_and_lfo_widget.cpp \
$(srcdir)/src/core/envelope_tab_widget.cpp \
$(srcdir)/src/core/envelope_and_lfo_parameters.cpp \
$(srcdir)/src/core/instrument_sound_shaping.cpp \
$(srcdir)/src/core/export_project_dialog.cpp \
$(srcdir)/src/core/file_browser.cpp \
$(srcdir)/src/core/import_filter.cpp \
$(srcdir)/src/core/instrument.cpp \
$(srcdir)/src/core/instrument_functions.cpp \
$(srcdir)/src/core/ladspa_2_lmms.cpp \
$(srcdir)/src/core/ladspa_manager.cpp \
$(srcdir)/src/core/ladspa_control.cpp \
$(srcdir)/src/core/main_window.cpp \
$(srcdir)/src/core/main.cpp \
$(srcdir)/src/core/meter_dialog.cpp \
$(srcdir)/src/core/midi_tab_widget.cpp \
$(srcdir)/src/core/instrument_midi_io.cpp \
$(srcdir)/src/core/mixer.cpp \
$(srcdir)/src/core/mv_base.cpp \
$(srcdir)/src/core/name_label.cpp \
$(srcdir)/src/core/note.cpp \
$(srcdir)/src/core/note_play_handle.cpp \
$(srcdir)/src/core/piano_roll.cpp \
$(srcdir)/src/core/piano_widget.cpp \
$(srcdir)/src/core/piano.cpp \
$(srcdir)/src/core/plugin.cpp \
$(srcdir)/src/core/plugin_browser.cpp \
$(srcdir)/src/core/preset_preview_play_handle.cpp \
$(srcdir)/src/core/sample_play_handle.cpp \
$(srcdir)/src/core/setup_dialog.cpp \
$(srcdir)/src/core/song_editor.cpp \
$(srcdir)/src/core/song.cpp \
$(srcdir)/src/core/tool.cpp \
$(srcdir)/src/core/track.cpp \
$(srcdir)/src/core/track_container.cpp \
@@ -213,27 +215,33 @@ lmms_SOURCES = \
$(srcdir)/src/tracks/bb_track.cpp \
$(srcdir)/src/tracks/instrument_track.cpp \
$(srcdir)/src/tracks/pattern.cpp \
$(srcdir)/src/tracks/sample_track.cpp \
$(srcdir)/src/widgets/automatable_button.cpp \
$(srcdir)/src/widgets/automatable_slider.cpp \
$(srcdir)/src/widgets/caption_menu.cpp \
$(srcdir)/src/widgets/combobox.cpp \
$(srcdir)/src/widgets/cpuload_widget.cpp \
$(srcdir)/src/widgets/effect_label.cpp \
$(srcdir)/src/widgets/effect_rack_view.cpp \
$(srcdir)/src/widgets/effect_view.cpp \
$(srcdir)/src/widgets/fade_button.cpp \
$(srcdir)/src/widgets/graph.cpp \
$(srcdir)/src/widgets/group_box.cpp \
$(srcdir)/src/widgets/envelope_and_lfo_view.cpp \
$(srcdir)/src/widgets/instrument_function_views.cpp \
$(srcdir)/src/widgets/instrument_midi_io_view.cpp \
$(srcdir)/src/widgets/instrument_sound_shaping_view.cpp \
$(srcdir)/src/widgets/kmultitabbar.cpp \
$(srcdir)/src/widgets/knob.cpp \
$(srcdir)/src/widgets/ladspa_control_view.cpp \
$(srcdir)/src/widgets/lcd_spinbox.cpp \
$(srcdir)/src/widgets/led_checkbox.cpp \
$(srcdir)/src/widgets/nstate_button.cpp \
$(srcdir)/src/widgets/pixmap_button.cpp \
$(srcdir)/src/widgets/project_notes.cpp \
$(srcdir)/src/widgets/rack_plugin.cpp \
$(srcdir)/src/widgets/rack_view.cpp \
$(srcdir)/src/widgets/rubberband.cpp \
$(srcdir)/src/widgets/rename_dialog.cpp \
$(srcdir)/src/widgets/side_bar_widget.cpp \
$(srcdir)/src/core/song_editor.cpp \
$(srcdir)/src/widgets/tab_bar.cpp \
$(srcdir)/src/widgets/tab_widget.cpp \
$(srcdir)/src/widgets/text_float.cpp \
@@ -270,11 +278,14 @@ lmms_SOURCES = \
$(srcdir)/include/note.h \
$(srcdir)/include/volume.h \
$(srcdir)/include/panning.h \
$(srcdir)/include/song.h \
$(srcdir)/include/song_editor.h \
$(srcdir)/include/plugin.h \
$(srcdir)/include/plugin_view.h \
$(srcdir)/include/instrument.h \
$(srcdir)/include/instrument_view.h \
$(srcdir)/include/bb_editor.h \
$(srcdir)/include/piano_widget.h \
$(srcdir)/include/piano.h \
$(srcdir)/include/effect_board.h \
$(srcdir)/include/pixmap_button.h \
$(srcdir)/include/rename_dialog.h \
@@ -282,12 +293,19 @@ lmms_SOURCES = \
$(srcdir)/include/note_play_handle.h \
$(srcdir)/include/piano_roll.h \
$(srcdir)/include/basic_filters.h \
$(srcdir)/include/envelope_tab_widget.h \
$(srcdir)/include/envelope_and_lfo_widget.h \
$(srcdir)/include/envelope_and_lfo_parameters.h \
$(srcdir)/include/instrument_sound_shaping.h \
$(srcdir)/include/envelope_and_lfo_parameters.h \
$(srcdir)/include/about_dialog.h \
$(srcdir)/include/oscillator.h \
$(srcdir)/include/arp_and_chords_tab_widget.h \
$(srcdir)/include/instrument_functions.h \
$(srcdir)/include/instrument_function_views.h \
$(srcdir)/include/instrument_sound_shaping_view.h \
$(srcdir)/include/export.h \
$(srcdir)/include/mv_base.h \
$(srcdir)/include/automatable_model.h \
$(srcdir)/include/automatable_model_templates.h \
$(srcdir)/include/graph.h \
$(srcdir)/include/group_box.h \
$(srcdir)/include/tab_widget.h \
$(srcdir)/include/knob.h \
@@ -345,7 +363,8 @@ lmms_SOURCES = \
$(srcdir)/include/dummy_instrument.h \
$(srcdir)/include/instrument_play_handle.h \
$(srcdir)/include/string_pair_drag.h \
$(srcdir)/include/midi_tab_widget.h \
$(srcdir)/include/instrument_midi_io.h \
$(srcdir)/include/instrument_midi_io_view.h \
$(srcdir)/include/audio_port.h \
$(srcdir)/include/tool.h \
$(srcdir)/include/tool_button.h \
@@ -358,8 +377,6 @@ lmms_SOURCES = \
$(srcdir)/include/combobox.h \
$(srcdir)/include/rubberband.h \
$(srcdir)/include/base64.h \
$(srcdir)/include/automatable_object.h \
$(srcdir)/include/automatable_object_templates.h \
$(srcdir)/include/journalling_object.h \
$(srcdir)/include/level_object.h \
$(srcdir)/include/project_journal.h \
@@ -368,12 +385,12 @@ lmms_SOURCES = \
$(srcdir)/include/engine.h \
$(srcdir)/include/effect.h \
$(srcdir)/include/effect_chain.h \
$(srcdir)/include/effect_controls.h \
$(srcdir)/include/effect_control_dialog.h \
$(srcdir)/include/effect_label.h \
$(srcdir)/include/effect_tab_widget.h \
$(srcdir)/include/rack_plugin.h \
$(srcdir)/include/rack_view.h \
$(srcdir)/include/effect_rack_view.h \
$(srcdir)/include/effect_select_dialog.h \
$(srcdir)/include/effect_view.h \
$(srcdir)/include/dummy_effect.h \
$(srcdir)/include/ladspa-1.1.h \
$(srcdir)/include/sweep_oscillator.h \
@@ -382,10 +399,12 @@ lmms_SOURCES = \
$(srcdir)/include/ladspa_manager.h \
$(srcdir)/include/ladspa_2_lmms.h \
$(srcdir)/include/ladspa_control.h \
$(srcdir)/include/ladspa_control_view.h \
$(srcdir)/include/ladspa_base.h \
$(THIRD_PARTY_CODE)
# $(srcdir)/src/tracks/sample_track.cpp
EXTRA_DIST = $(lmms_EMBEDDED_RESOURCES) lmms.1

5
README
View File

@@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
What is LMMS??
What is LMMS?
--------------
LMMS aims to be a free alternative to popular (but commercial and closed-
@@ -47,8 +47,7 @@ least 500 MHz, but for really enjoying LMMS less than 1 GHz makes no sense...
Required libraries:
- multithreaded version of Qt 3.0 (at least 3.2 recommended) or higher with
devel-files
- Qt >= 4.3.0 with devel-files
Optional, but strongly recommended:
- JACK with devel-files

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(lmms, 0.4.0-svn20080105, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.4.0-svn20080105)
AC_INIT(lmms, 0.4.0-svn20080227-mv, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.4.0-svn20080227-mv)
AM_CONFIG_HEADER(config.h)
@@ -453,33 +453,40 @@ else
fi
# check whether to disable single-source-compile
AC_MSG_CHECKING([whether to enable single-source-compile])
#AC_MSG_CHECKING([whether to enable single-source-compile])
# AH_TEMPLATE(SINGLE_SOURCE_COMPILE, [Define if you want to enable single-source-compile.])
AC_ARG_ENABLE([ssc],
AS_HELP_STRING([--enable-ssc],
[enable single-source-compile]), [ENABLE_SSC=$enableval])
if test "x$ENABLE_SSC" = "xyes" ; then
AC_MSG_RESULT(yes)
# AC_DEFINE(SINGLE_SOURCE_COMPILE)
CXXFLAGS="$CXXFLAGS -DSINGLE_SOURCE_COMPILE"
else
AC_MSG_RESULT(no)
fi
#AC_ARG_ENABLE([ssc],
# AS_HELP_STRING([--enable-ssc],
# [enable single-source-compile]), [ENABLE_SSC=$enableval])
#if test "x$ENABLE_SSC" = "xyes" ; then
# AC_MSG_RESULT(yes)
# # AC_DEFINE(SINGLE_SOURCE_COMPILE)
# CXXFLAGS="$CXXFLAGS -DSINGLE_SOURCE_COMPILE"
#else
# AC_MSG_RESULT(no)
#fi
# check whether compiler of current platform supports attribute regparm(x)
AC_MSG_CHECKING([whether we can use function-attribute regparm(x) on current platform])
AH_TEMPLATE(FASTCALL, [Define to any attribute, speeding up function-calls])
AC_RUN_IFELSE([ int __attribute__((regparm(3))) foo( int a, int b, int c )
{ return( a=b=c ); }
int __attribute__((regparm(3))) main( void )
{ return( foo(2,1,0) ); }],
AC_MSG_RESULT(yes)
AC_DEFINE(FASTCALL, [__attribute__((regparm(3)))]),
AC_MSG_RESULT(no)
AC_ARG_ENABLE([fastcall],
AS_HELP_STRING([--enable-fastcall],
[enable fastcall (regparm-attribute)]), [ENABLE_FASTCALL=$enableval])
if test "x$ENABLE_FASTCALL" = "xyes" ; then
AC_MSG_CHECKING([whether we can use function-attribute regparm(x) on current platform])
AH_TEMPLATE(FASTCALL, [Define to any attribute, speeding up function-calls])
AC_RUN_IFELSE([ int __attribute__((regparm(3))) foo( int a, int b, int c )
{ return( a=b=c ); }
int __attribute__((regparm(3))) main( void )
{ return( foo(2,1,0) ); }],
AC_MSG_RESULT(yes)
AC_DEFINE(FASTCALL, [__attribute__((regparm(3)))]),
AC_MSG_RESULT(no)
AC_DEFINE_UNQUOTED(FASTCALL,[])
)
else
AC_DEFINE_UNQUOTED(FASTCALL,[])
)
fi
AC_MSG_CHECKING([whether floorf is known by compiler])
@@ -567,9 +574,9 @@ lmmsdatadir="$datadir/$PACKAGE"
AC_SUBST(lmmsdatadir)
EXTRA_WARNINGS="-Wextra -Wno-unused-parameter -Wunsafe-loop-optimizations -Winline -Wdisabled-optimization"
EXTRA_WARNINGS="-Wno-unused-parameter -Wunsafe-loop-optimizations -Wdisabled-optimization"
if test "x$CXX" == "xg++" ; then
CXXFLAGS="$CXXFLAGS -ansi -Wall $EXTRA_WARNINGS -fno-exceptions"
CXXFLAGS="-ansi -Wall $EXTRA_WARNINGS $CXXFLAGS -fno-exceptions"
fi
LDFLAGS="$LDFLAGS -L/usr/local/lib"
@@ -651,6 +658,23 @@ AC_CONFIG_FILES([Makefile
plugins/singerbot/Makefile
plugins/stk/Makefile
plugins/stk/mallets/Makefile
plugins/stk/voices/Makefile
plugins/stk/voices/b3/Makefile
plugins/stk/voices/bandedwg/Makefile
plugins/stk/voices/blow_bottle/Makefile
plugins/stk/voices/blow_hole/Makefile
plugins/stk/voices/bowed/Makefile
plugins/stk/voices/brass/Makefile
plugins/stk/voices/clarinet/Makefile
plugins/stk/voices/flute/Makefile
plugins/stk/voices/fmvoices/Makefile
plugins/stk/voices/metal/Makefile
plugins/stk/voices/moog/Makefile
plugins/stk/voices/percflute/Makefile
plugins/stk/voices/resonate/Makefile
plugins/stk/voices/rhodey/Makefile
plugins/stk/voices/tubebell/Makefile
plugins/stk/voices/wurley/Makefile
plugins/triple_oscillator/Makefile
plugins/vestige/Makefile
plugins/vibed/Makefile

View File

@@ -1,124 +0,0 @@
/*
* arp_and_chords_tab_widget.h - declaration of class arpAndChordWidget which
* provides code for using arpeggio and chords
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _ARP_AND_CHORDS_TAB_WIDGET_H
#define _ARP_AND_CHORDS_TAB_WIDGET_H
#include <QtGui/QWidget>
#include "journalling_object.h"
#include "types.h"
class QLabel;
class QPixmap;
class automatableButtonGroup;
class flpImport;
class instrumentTrack;
class comboBox;
class groupBox;
class knob;
class notePlayHandle;
class tempoSyncKnob;
const int MAX_CHORD_POLYPHONY = 10;
class arpAndChordsTabWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
enum arpDirections
{
UP,
DOWN,
UP_AND_DOWN,
RANDOM
} ;
arpAndChordsTabWidget( instrumentTrack * _channel_track );
virtual ~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" );
}
private:
enum arpModes
{
FREE,
SORT,
SYNC
} ;
// chord-stuff
groupBox * m_chordsGroupBox;
comboBox * m_chordsComboBox;
knob * m_chordRangeKnob;
// arpeggio-stuff
groupBox * m_arpGroupBox;
comboBox * m_arpComboBox;
knob * m_arpRangeKnob;
tempoSyncKnob * m_arpTimeKnob;
knob * m_arpGateKnob;
QLabel * m_arpDirectionLbl;
automatableButtonGroup * m_arpDirectionBtnGrp;
comboBox * m_arpModeComboBox;
friend class flpImport;
} ;
#endif

View File

@@ -48,7 +48,7 @@ public:
protected:
Sint32 FASTCALL writeData( const void * _data, Sint32 _len );
Sint32 writeData( const void * _data, Sint32 _len );
void seekToBegin( void );
inline bool useVBR( void ) const

View File

@@ -1,7 +1,7 @@
/*
* audio_port.h - base-class for objects providing sound at a port
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,6 +27,8 @@
#define _AUDIO_PORT_H
#include <QtCore/QString>
#include <QtCore/QMutex>
#include <QtCore/QMutexLocker>
#include "effect_chain.h"
@@ -34,7 +36,7 @@
class audioPort
{
public:
audioPort( const QString & _name );
audioPort( const QString & _name, track * _track );
~audioPort();
inline surroundSampleFrame * firstBuffer( void )
@@ -46,6 +48,26 @@ public:
return( m_secondBuffer );
}
inline void lockFirstBuffer( void )
{
m_firstBufferLock.lock();
}
inline void lockSecondBuffer( void )
{
m_secondBufferLock.lock();
}
inline void unlockFirstBuffer( void )
{
m_firstBufferLock.unlock();
}
inline void unlockSecondBuffer( void )
{
m_secondBufferLock.unlock();
}
void nextPeriod( void );
@@ -66,7 +88,7 @@ public:
inline effectChain * getEffects( void )
{
return( m_effects );
return( &m_effects );
}
void setNextFxChannel( const fx_ch_t _chnl )
@@ -85,20 +107,30 @@ public:
enum bufferUsages
{
NONE, FIRST, BOTH
NoUsage,
FirstBuffer,
BothBuffers
} m_bufferUsage;
inline bool processEffects( void ) { return( m_effects->processAudioBuffer( m_firstBuffer, m_frames ) ); };
inline bool processEffects( void )
{
QMutexLocker m( &m_firstBufferLock );
return( m_effects.processAudioBuffer( m_firstBuffer,
m_frames ) );
}
private:
surroundSampleFrame * m_firstBuffer;
surroundSampleFrame * m_secondBuffer;
QMutex m_firstBufferLock;
QMutex m_secondBufferLock;
bool m_extOutputEnabled;
fx_ch_t m_nextFxChannel;
QString m_name;
effectChain * m_effects;
effectChain m_effects;
fpp_t m_frames;
} ;

View File

@@ -28,37 +28,33 @@
#include <QtGui/QPushButton>
#include "automatable_object.h"
#include "automatable_model.h"
class automatableButtonGroup;
class automatableButton : public QPushButton, public automatableObject<bool,
signed char>
class automatableButton : public QPushButton, public boolModelView
{
Q_OBJECT
public:
automatableButton( QWidget * _parent, const QString & _name,
track * _track );
automatableButton( QWidget * _parent, const QString & _name );
virtual ~automatableButton();
virtual void setValue( const bool _on );
inline void setCheckable( bool _on )
{
QPushButton::setCheckable( _on );
setJournalling( _on );
model()->setJournalling( _on );
}
public slots:
virtual void update( void );
virtual void toggle( void );
virtual void setChecked( bool _on )
{
// QPushButton::setChecked is called in setValue()
setValue( _on );
// QPushButton::setChecked is called in update-slot
model()->setValue( _on );
}
@@ -74,16 +70,17 @@ private:
friend class automatableButtonGroup;
using QPushButton::setChecked;
using QPushButton::isChecked;
} ;
class automatableButtonGroup : public QWidget, public automatableObject<int>
class automatableButtonGroup : public QWidget, public intModelView
{
Q_OBJECT
public:
automatableButtonGroup( QWidget * _parent, const QString & _name,
track * _track );
automatableButtonGroup( QWidget * _parent, const QString & _name );
virtual ~automatableButtonGroup();
void addButton( automatableButton * _btn );
@@ -91,16 +88,16 @@ public:
void activateButton( automatableButton * _btn );
virtual void setValue( const int _value );
virtual void modelChanged( void );
private slots:
void updateButtons( void );
private:
QList<automatableButton *> m_buttons;
signals:
void valueChanged( int );
} ;

309
include/automatable_model.h Normal file
View File

@@ -0,0 +1,309 @@
/*
* automatable_model.h - declaration of class automatableModel
*
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _AUTOMATABLE_MODEL_H
#define _AUTOMATABLE_MODEL_H
#include <math.h>
#include "journalling_object.h"
#include "level_object.h"
#include "mv_base.h"
#include <QtCore/QPointer>
class automationPattern;
class track;
// simple way to map a property of a view to a model
#define mapPropertyFromModelPtr(type,getfunc,setfunc,modelname) \
public: \
inline type getfunc( void ) const \
{ \
return( modelname->value() ); \
} \
public slots: \
inline void setfunc( const type _val ) \
{ \
modelname->setValue( _val ); \
}
#define mapPropertyFromModel(type,getfunc,setfunc,modelname) \
public: \
inline type getfunc( void ) const \
{ \
return( modelname.value() ); \
} \
public slots: \
inline void setfunc( const type _val ) \
{ \
modelname.setValue( _val ); \
}
template<typename T, typename EDIT_STEP_TYPE = T>
class automatableModel : public model, public journallingObject,
public levelObject
{
public:
typedef automatableModel<T, EDIT_STEP_TYPE> autoModel;
automatableModel( const T _val = 0,
const T _min = 0,
const T _max = 0,
const T _step = defaultRelStep(),
::model * _parent = NULL,
bool _default_constructed = FALSE );
virtual ~automatableModel();
static inline T minRelStep( void )
{
return( 1 );
}
static inline T defaultRelStep( void )
{
return( 1 );
}
static inline T minEps( void )
{
return( 1 );
}
inline virtual T value( void ) const
{
return( m_value );
}
inline virtual T initValue( void ) const
{
return( m_initValue );
}
inline virtual T minValue( void ) const
{
return( m_minValue );
}
inline virtual T maxValue( void ) const
{
return( m_maxValue );
}
inline virtual T step( void ) const
{
return( m_step );
}
inline int curLevel( void ) const
{
return( m_curLevel );
}
inline T fittedValue( T _value ) const;
inline T value( int _level ) const
{
return( fittedValue( _level * m_step ) );
}
virtual void setInitValue( const T _value );
virtual void setValue( const T _value );
inline virtual void incValue( int _steps )
{
setValue( m_value + _steps * m_step );
}
virtual void setRange( const T _min, const T _max,
const T _step = defaultRelStep() );
virtual void setStep( const T _step );
static void linkModels( autoModel * _model1, autoModel * _model2 );
static void unlinkModels( autoModel * _model1, autoModel * _model2 );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this,
const QString & _name = "value" );
virtual void FASTCALL loadSettings( const QDomElement & _this,
const QString & _name = "value" );
virtual QString nodeName( void ) const
{
return( "automatablemodel" );
}
inline automationPattern * getAutomationPattern( void );
inline void setTrack( track * _track )
{
m_track = _track;
}
inline bool nullTrack( void )
{
return( m_track == NULL );
}
void initAutomationPattern( void )
{
m_automationPattern = new automationPattern( NULL, this );
}
void prepareJournalEntryFromOldVal( void );
void addJournalEntryFromOldToCurVal( void );
protected:
virtual void redoStep( journalEntry & _je );
virtual void undoStep( journalEntry & _je );
inline void setFirstValue( void );
private:
T m_value;
T m_initValue;
T m_minValue;
T m_maxValue;
T m_step;
int m_curLevel;
QPointer<automationPattern> m_automationPattern;
track * m_track;
// most objects will need this temporarily
T m_oldValue;
bool m_journalEntryReady;
typedef QVector<autoModel *> autoModelVector;
autoModelVector m_linkedModels;
inline void linkModel( autoModel * _model );
inline void unlinkModel( autoModel * _model );
inline static T attributeValue( QString _value );
inline void syncAutomationPattern( void );
inline void setLevel( int _level );
inline int level( T _value ) const
{
return( (int)roundf( _value / (float)m_step ) );
}
QString levelToLabel( int _level ) const
{
return( QString::number( value( _level ) ) );
}
int labelToLevel( QString _label )
{
return( level( attributeValue( _label ) ) );
}
} ;
template<typename T, typename EDIT_STEP_TYPE = T>
class automatableModelView : public modelView
{
public:
typedef automatableModel<T, EDIT_STEP_TYPE> autoModel;
typedef automatableModelView<T, EDIT_STEP_TYPE> autoModelView;
automatableModelView( ::model * _model ) :
modelView( _model )
{
}
// some basic functions for convenience
autoModel * model( void )
{
return( castModel<autoModel>() );
}
const autoModel * model( void ) const
{
return( castModel<autoModel>() );
}
inline virtual T value( void ) const
{
return( model() ? model()->value() : 0 );
}
inline virtual void setValue( const T _value )
{
if( model() )
{
model()->setValue( _value );
}
}
} ;
#define generateModelPrimitive(type,type2) \
typedef automatableModel<type,type2> type##Model; \
typedef automatableModelView<type,type2> type##ModelView; \
// some model-primitives
generateModelPrimitive(float,float);
generateModelPrimitive(int,int);
class boolModel : public automatableModel<bool, signed char>
{
public:
boolModel( const bool _val = FALSE,
::model * _parent = NULL,
bool _default_constructed = FALSE ) :
autoModel( _val, FALSE, TRUE, defaultRelStep(), _parent,
_default_constructed )
{
}
} ;
typedef automatableModelView<bool, signed char> boolModelView;
#endif

View File

@@ -1,7 +1,7 @@
/*
* automatable_object_templates.h - definition of automatableObject templates
* automatable_model_templates.h - definition of automatableModel templates
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -23,12 +23,12 @@
*/
#ifndef _AUTOMATABLE_OBJECT_TEMPLATES_H
#define _AUTOMATABLE_OBJECT_TEMPLATES_H
#ifndef _AUTOMATABLE_MODEL_TEMPLATES_H
#define _AUTOMATABLE_MODEL_TEMPLATES_H
#include <QtXml/QDomElement>
#include "automatable_object.h"
#include "automatable_model.h"
#include "automation_editor.h"
#include "automation_pattern.h"
#include "engine.h"
@@ -37,15 +37,21 @@
template<typename T, typename EDIT_STEP_TYPE>
automatableObject<T, EDIT_STEP_TYPE>::automatableObject( track * _track,
const T _val, const T _min,
const T _max, const T _step ) :
automatableModel<T, EDIT_STEP_TYPE>::automatableModel(
const T _val,
const T _min,
const T _max,
const T _step,
::model * _parent,
bool _default_constructed ) :
model( _parent, _default_constructed ),
m_value( _val ),
m_initValue( _val ),
m_minValue( _min ),
m_maxValue( _max ),
m_step( _step ),
m_automation_pattern( NULL ),
m_track( _track ),
m_automationPattern( NULL ),
m_track( NULL ),
m_journalEntryReady( FALSE )
{
m_curLevel = level( _val );
@@ -57,13 +63,13 @@ automatableObject<T, EDIT_STEP_TYPE>::automatableObject( track * _track,
template<typename T, typename EDIT_STEP_TYPE>
automatableObject<T, EDIT_STEP_TYPE>::~automatableObject()
automatableModel<T, EDIT_STEP_TYPE>::~automatableModel()
{
delete m_automation_pattern;
while( m_linkedObjects.empty() == FALSE )
delete m_automationPattern;
while( m_linkedModels.empty() == FALSE )
{
m_linkedObjects.last()->unlinkObject( this );
m_linkedObjects.erase( m_linkedObjects.end() - 1 );
m_linkedModels.last()->unlinkModel( this );
m_linkedModels.erase( m_linkedModels.end() - 1 );
}
}
@@ -71,7 +77,7 @@ automatableObject<T, EDIT_STEP_TYPE>::~automatableObject()
template<typename T, typename EDIT_STEP_TYPE>
T automatableObject<T, EDIT_STEP_TYPE>::fittedValue( T _value ) const
T automatableModel<T, EDIT_STEP_TYPE>::fittedValue( T _value ) const
{
_value = tLimit<T>( _value, minValue(), maxValue() );
@@ -104,11 +110,12 @@ T automatableObject<T, EDIT_STEP_TYPE>::fittedValue( T _value ) const
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setInitValue( const T _value )
void automatableModel<T, EDIT_STEP_TYPE>::setInitValue( const T _value )
{
m_initValue = _value;
bool journalling = testAndSetJournalling( FALSE );
setValue( _value );
if( m_automation_pattern )
if( m_automationPattern )
{
setFirstValue();
}
@@ -119,7 +126,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::setInitValue( const T _value )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setValue( const T _value )
void automatableModel<T, EDIT_STEP_TYPE>::setValue( const T _value )
{
const T old_val = m_value;
@@ -133,15 +140,15 @@ void automatableObject<T, EDIT_STEP_TYPE>::setValue( const T _value )
static_cast<EDIT_STEP_TYPE>( m_value ) -
static_cast<EDIT_STEP_TYPE>( old_val ) ) );
// notify linked objects
// notify linked models
// doesn't work because of implicit typename T
// for( autoObjVector::iterator it =
// m_linkedObjects.begin();
// it != m_linkedObjects.end(); ++it )
for( int i = 0; i < m_linkedObjects.size(); ++i )
// for( autoModelVector::iterator it =
// m_linkedModels.begin();
// it != m_linkedModels.end(); ++it )
for( int i = 0; i < m_linkedModels.size(); ++i )
{
autoObj * it = m_linkedObjects[i];
autoModel * it = m_linkedModels[i];
if( value() != it->value() && it->fittedValue( value() )
!= it->value() )
{
@@ -151,6 +158,12 @@ void automatableObject<T, EDIT_STEP_TYPE>::setValue( const T _value )
it->setJournalling( journalling );
}
}
setFirstValue();
emit dataChanged();
}
else
{
emit dataUnchanged();
}
}
@@ -158,25 +171,30 @@ void automatableObject<T, EDIT_STEP_TYPE>::setValue( const T _value )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setRange( const T _min, const T _max,
void automatableModel<T, EDIT_STEP_TYPE>::setRange( const T _min, const T _max,
const T _step )
{
m_minValue = _min;
m_maxValue = _max;
if( m_minValue > m_maxValue )
if( ( m_maxValue != _max ) || ( m_minValue != _min ) )
{
qSwap<T>( m_minValue, m_maxValue );
m_minValue = _min;
m_maxValue = _max;
if( m_minValue > m_maxValue )
{
qSwap<T>( m_minValue, m_maxValue );
}
setStep( _step );
// re-adjust value
autoModel::setInitValue( value() );
emit propertiesChanged();
}
setStep( _step );
// re-adjust value
autoObj::setInitValue( value() );
}
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setStep( const T _step )
void automatableModel<T, EDIT_STEP_TYPE>::setStep( const T _step )
{
/*
const T intv = maxValue() - minValue();
@@ -201,26 +219,32 @@ void automatableObject<T, EDIT_STEP_TYPE>::setStep( const T _step )
m_step = minRelStep() * intv;
}
}*/
m_step = _step;
m_curLevel = level( m_value );
m_minLevel = level( m_minValue );
m_maxLevel = level( m_maxValue );
if( m_step != _step )
{
m_step = _step;
m_curLevel = level( m_value );
m_minLevel = level( m_minValue );
m_maxLevel = level( m_maxValue );
emit propertiesChanged();
}
}
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::linkObjects( autoObj * _object1,
autoObj * _object2 )
{
_object1->linkObject( _object2 );
_object2->linkObject( _object1 );
if( _object1->m_automation_pattern != _object2->m_automation_pattern )
template<typename T, typename EDIT_STEP_TYPE>
void automatableModel<T, EDIT_STEP_TYPE>::linkModels( autoModel * _model1,
autoModel * _model2 )
{
_model1->linkModel( _model2 );
_model2->linkModel( _model1 );
if( _model1->m_automationPattern != _model2->m_automationPattern )
{
delete _object2->m_automation_pattern;
_object2->m_automation_pattern = _object1->m_automation_pattern;
delete _model2->m_automationPattern;
_model2->m_automationPattern = _model1->m_automationPattern;
}
}
@@ -228,17 +252,17 @@ void automatableObject<T, EDIT_STEP_TYPE>::linkObjects( autoObj * _object1,
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::unlinkObjects( autoObj * _object1,
autoObj * _object2 )
void automatableModel<T, EDIT_STEP_TYPE>::unlinkModels( autoModel * _model1,
autoModel * _model2 )
{
_object1->unlinkObject( _object2 );
_object2->unlinkObject( _object1 );
_model1->unlinkModel( _model2 );
_model2->unlinkModel( _model1 );
if( _object1->m_automation_pattern && _object1->m_automation_pattern
== _object2->m_automation_pattern )
if( _model1->m_automationPattern && _model1->m_automationPattern
== _model2->m_automationPattern )
{
_object2->m_automation_pattern = new automationPattern(
*_object1->m_automation_pattern, _object2 );
_model2->m_automationPattern = new automationPattern(
*_model1->m_automationPattern, _model2 );
}
}
@@ -246,11 +270,11 @@ void automatableObject<T, EDIT_STEP_TYPE>::unlinkObjects( autoObj * _object1,
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::saveSettings( QDomDocument & _doc,
void automatableModel<T, EDIT_STEP_TYPE>::saveSettings( QDomDocument & _doc,
QDomElement & _this,
const QString & _name )
{
if( m_automation_pattern && m_automation_pattern->getTimeMap().size()
if( m_automationPattern && m_automationPattern->getTimeMap().size()
> 1 )
{
QDomElement pattern_element;
@@ -267,7 +291,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::saveSettings( QDomDocument & _doc,
_this.appendChild( pattern_element );
}
QDomElement element = _doc.createElement( _name );
m_automation_pattern->saveSettings( _doc, element );
m_automationPattern->saveSettings( _doc, element );
pattern_element.appendChild( element );
}
else
@@ -280,18 +304,18 @@ void automatableObject<T, EDIT_STEP_TYPE>::saveSettings( QDomDocument & _doc,
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::loadSettings(
void automatableModel<T, EDIT_STEP_TYPE>::loadSettings(
const QDomElement & _this,
const QString & _name )
{
QDomNode node = _this.namedItem( automationPattern::classNodeName() );
if( node.isElement() )
if( node.isElement() && getAutomationPattern() )
{
node = node.namedItem( _name );
if( node.isElement() )
{
m_automation_pattern->loadSettings( node.toElement() );
setLevel( m_automation_pattern->valueAt( 0 ) );
m_automationPattern->loadSettings( node.toElement() );
setLevel( m_automationPattern->valueAt( 0 ) );
return;
}
}
@@ -303,22 +327,22 @@ void automatableObject<T, EDIT_STEP_TYPE>::loadSettings(
template<typename T, typename EDIT_STEP_TYPE>
automationPattern * automatableObject<T, EDIT_STEP_TYPE>::getAutomationPattern(
automationPattern * automatableModel<T, EDIT_STEP_TYPE>::getAutomationPattern(
void )
{
if( !m_automation_pattern )
if( !m_automationPattern )
{
m_automation_pattern = new automationPattern( m_track, this );
m_automationPattern = new automationPattern( m_track, this );
syncAutomationPattern();
}
return( m_automation_pattern );
return( m_automationPattern );
}
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::redoStep( journalEntry & _je )
void automatableModel<T, EDIT_STEP_TYPE>::redoStep( journalEntry & _je )
{
bool journalling = testAndSetJournalling( FALSE );
setValue( static_cast<T>( value() + static_cast<EDIT_STEP_TYPE>(
@@ -330,7 +354,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::redoStep( journalEntry & _je )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::undoStep( journalEntry & _je )
void automatableModel<T, EDIT_STEP_TYPE>::undoStep( journalEntry & _je )
{
journalEntry je( _je.actionID(),
static_cast<EDIT_STEP_TYPE>( -_je.data().toDouble() ) );
@@ -341,7 +365,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::undoStep( journalEntry & _je )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::prepareJournalEntryFromOldVal( void )
void automatableModel<T, EDIT_STEP_TYPE>::prepareJournalEntryFromOldVal( void )
{
m_oldValue = value();
saveJournallingState( FALSE );
@@ -352,7 +376,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::prepareJournalEntryFromOldVal( void )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::addJournalEntryFromOldToCurVal(
void automatableModel<T, EDIT_STEP_TYPE>::addJournalEntryFromOldToCurVal(
void )
{
if( m_journalEntryReady )
@@ -371,14 +395,14 @@ void automatableObject<T, EDIT_STEP_TYPE>::addJournalEntryFromOldToCurVal(
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setFirstValue( void )
void automatableModel<T, EDIT_STEP_TYPE>::setFirstValue( void )
{
if( m_automation_pattern && m_automation_pattern->updateFirst() )
if( m_automationPattern && m_automationPattern->updateFirst() )
{
m_automation_pattern->putValue( 0, m_curLevel, FALSE );
m_automationPattern->putValue( 0, m_curLevel, FALSE );
if( engine::getAutomationEditor() &&
engine::getAutomationEditor()->currentPattern()
== m_automation_pattern )
== m_automationPattern )
{
engine::getAutomationEditor()->update();
}
@@ -389,12 +413,12 @@ void automatableObject<T, EDIT_STEP_TYPE>::setFirstValue( void )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::linkObject( autoObj * _object )
void automatableModel<T, EDIT_STEP_TYPE>::linkModel( autoModel * _model )
{
if( qFind( m_linkedObjects.begin(), m_linkedObjects.end(), _object )
== m_linkedObjects.end() )
if( qFind( m_linkedModels.begin(), m_linkedModels.end(), _model )
== m_linkedModels.end() )
{
m_linkedObjects.push_back( _object );
m_linkedModels.push_back( _model );
}
}
@@ -402,14 +426,14 @@ void automatableObject<T, EDIT_STEP_TYPE>::linkObject( autoObj * _object )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::unlinkObject( autoObj * _object )
void automatableModel<T, EDIT_STEP_TYPE>::unlinkModel( autoModel * _model )
{
if( qFind( m_linkedObjects.begin(), m_linkedObjects.end(), _object )
!= m_linkedObjects.end() )
if( qFind( m_linkedModels.begin(), m_linkedModels.end(), _model )
!= m_linkedModels.end() )
{
m_linkedObjects.erase( qFind( m_linkedObjects.begin(),
m_linkedObjects.end(),
_object ) );
m_linkedModels.erase( qFind( m_linkedModels.begin(),
m_linkedModels.end(),
_model ) );
}
}
@@ -417,14 +441,14 @@ void automatableObject<T, EDIT_STEP_TYPE>::unlinkObject( autoObj * _object )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::syncAutomationPattern( void )
void automatableModel<T, EDIT_STEP_TYPE>::syncAutomationPattern( void )
{
for( int i = 0; i < m_linkedObjects.size(); ++i )
for( int i = 0; i < m_linkedModels.size(); ++i )
{
autoObj * it = m_linkedObjects[i];
if( m_automation_pattern != it->m_automation_pattern )
autoModel * it = m_linkedModels[i];
if( m_automationPattern != it->m_automationPattern )
{
it->m_automation_pattern = m_automation_pattern;
it->m_automationPattern = m_automationPattern;
}
}
}
@@ -433,16 +457,16 @@ void automatableObject<T, EDIT_STEP_TYPE>::syncAutomationPattern( void )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setLevel( int _level )
void automatableModel<T, EDIT_STEP_TYPE>::setLevel( int _level )
{
if( m_curLevel == _level )
{
return;
}
bool journalling = testAndSetJournalling( FALSE );
m_automation_pattern->setUpdateFirst( FALSE );
m_automationPattern->setUpdateFirst( FALSE );
setValue( _level * m_step );
m_automation_pattern->setUpdateFirst( TRUE );
m_automationPattern->setUpdateFirst( TRUE );
setJournalling( journalling );
}
@@ -450,7 +474,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::setLevel( int _level )
template<>
inline float automatableObject<float>::minRelStep( void )
inline float automatableModel<float>::minRelStep( void )
{
return( 1.0e-10 );
}
@@ -459,7 +483,7 @@ inline float automatableObject<float>::minRelStep( void )
template<>
inline float automatableObject<float>::defaultRelStep( void )
inline float automatableModel<float>::defaultRelStep( void )
{
return( 1.0e-2 );
}
@@ -468,7 +492,7 @@ inline float automatableObject<float>::defaultRelStep( void )
template<>
inline float automatableObject<float>::minEps( void )
inline float automatableModel<float>::minEps( void )
{
return( 1.0e-10 );
}
@@ -477,7 +501,7 @@ inline float automatableObject<float>::minEps( void )
template<>
inline float automatableObject<float>::attributeValue( QString _value )
inline float automatableModel<float>::attributeValue( QString _value )
{
return( _value.toFloat() );
}
@@ -486,7 +510,7 @@ inline float automatableObject<float>::attributeValue( QString _value )
template<>
inline int automatableObject<int>::attributeValue( QString _value )
inline int automatableModel<int>::attributeValue( QString _value )
{
return( _value.toInt() );
}
@@ -495,7 +519,15 @@ inline int automatableObject<int>::attributeValue( QString _value )
template<>
inline bool automatableObject<bool, signed char>::attributeValue(
inline bool automatableModel<bool>::attributeValue( QString _value )
{
return( static_cast<bool>( _value.toInt() ) );
}
template<>
inline bool automatableModel<bool, signed char>::attributeValue(
QString _value )
{
return( static_cast<bool>( _value.toInt() ) );

View File

@@ -1,204 +0,0 @@
/*
* automatable_object.h - declaration of class automatableObject
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _AUTOMATABLE_OBJECT_H
#define _AUTOMATABLE_OBJECT_H
#include <math.h>
#include "journalling_object.h"
#include "level_object.h"
#include <QtCore/QPointer>
class automationPattern;
class track;
template<typename T, typename EDIT_STEP_TYPE = T>
class automatableObject : public journallingObject, public levelObject
{
public:
typedef automatableObject<T, EDIT_STEP_TYPE> autoObj;
automatableObject( track * _track = NULL, const T _val = 0,
const T _min = 0, const T _max = 0,
const T _step = defaultRelStep() );
virtual ~automatableObject();
static inline T minRelStep( void )
{
return( 1 );
}
static inline T defaultRelStep( void )
{
return( 1 );
}
static inline T minEps( void )
{
return( 1 );
}
inline virtual T value( void ) const
{
return( m_value );
}
inline virtual T minValue( void ) const
{
return( m_minValue );
}
inline virtual T maxValue( void ) const
{
return( m_maxValue );
}
inline virtual T step( void ) const
{
return( m_step );
}
inline int curLevel( void ) const
{
return( m_curLevel );
}
inline T fittedValue( T _value ) const;
T value( int _level ) const
{
return( fittedValue( _level * m_step ) );
}
virtual void setInitValue( const T _value );
inline virtual void setValue( const T _value );
inline virtual void incValue( int _steps )
{
setValue( m_value + _steps * m_step );
}
virtual void setRange( const T _min, const T _max,
const T _step = defaultRelStep() );
inline virtual void setStep( const T _step );
static void linkObjects( autoObj * _object1, autoObj * _object2 );
static void unlinkObjects( autoObj * _object1, autoObj * _object2 );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this,
const QString & _name = "value" );
virtual void FASTCALL loadSettings( const QDomElement & _this,
const QString & _name = "value" );
virtual QString nodeName( void ) const
{
return( "automatableobject" );
}
inline automationPattern * getAutomationPattern( void );
inline bool nullTrack( void )
{
return( m_track == NULL );
}
void initAutomationPattern( void )
{
m_automation_pattern = new automationPattern( NULL, this );
}
protected:
virtual void redoStep( journalEntry & _je );
virtual void undoStep( journalEntry & _je );
void prepareJournalEntryFromOldVal( void );
void addJournalEntryFromOldToCurVal( void );
inline void setFirstValue( void );
private:
T m_value;
T m_minValue;
T m_maxValue;
T m_step;
int m_curLevel;
QPointer<automationPattern> m_automation_pattern;
track * m_track;
// most objects will need this temporarily
T m_oldValue;
bool m_journalEntryReady;
typedef QVector<autoObj *> autoObjVector;
autoObjVector m_linkedObjects;
inline void linkObject( autoObj * _object );
inline void unlinkObject( autoObj * _object );
static inline T attributeValue( QString _value );
inline void syncAutomationPattern( void );
inline void setLevel( int _level );
inline int level( T _value ) const
{
return( (int)roundf( _value / (float)m_step ) );
}
QString levelToLabel( int _level ) const
{
return( QString::number( value( _level ) ) );
}
int labelToLevel( QString _label )
{
return( level( attributeValue( _label ) ) );
}
} ;
#endif

View File

@@ -30,18 +30,18 @@
#include <QtXml/QDomElement>
class knob;
#include "automatable_model.h"
class automatableSlider : public QSlider
class automatableSlider : public QSlider, public automatableModelView<int>
{
Q_OBJECT
public:
automatableSlider( QWidget * _parent, const QString & _name,
class track * _track );
automatableSlider( QWidget * _parent, const QString & _name );
virtual ~automatableSlider();
virtual void setRange( int _min, int _max );
/* virtual void setRange( int _min, int _max );
virtual void setValue( int _value );
virtual void setInitValue( int _value );
@@ -51,11 +51,11 @@ public:
const QString & _name );
int logicValue( void );
void clearAutomationValues( void );
void clearAutomationValues( void );*/
bool showStatus( void )
{
return( m_show_status );
return( m_showStatus );
}
@@ -70,10 +70,11 @@ protected:
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void wheelEvent( QWheelEvent * _me );
virtual void modelChanged( void );
private:
knob * m_knob;
bool m_show_status;
bool m_showStatus;
private slots:
@@ -84,6 +85,7 @@ private slots:
} ;
typedef automatableSlider::autoModel sliderModel;
#endif

View File

@@ -33,13 +33,13 @@
#include "journalling_object.h"
#include "midi_time.h"
#include "automation_pattern.h"
#include "combobox.h"
class QPainter;
class QPixmap;
class QScrollBar;
class comboBox;
class notePlayHandle;
class timeLine;
class toolButton;
@@ -118,8 +118,8 @@ protected slots:
void updatePosition( const midiTime & _t );
void zoomingXChanged( const QString & _zfac );
void zoomingYChanged( const QString & _zfac );
void zoomingXChanged( void );
void zoomingYChanged( void );
private:
@@ -182,6 +182,9 @@ private:
comboBox * m_zoomingYComboBox;
comboBox * m_quantizeComboBox;
comboBoxModel m_zoomingXModel;
comboBoxModel m_zoomingYModel;
comboBoxModel m_quantizeModel;
automationPattern * m_pattern;
int m_min_level;

View File

@@ -2,7 +2,7 @@
* automation_track.h - declaration of class automationTrack, which handles
* automation of objects without a track
*
* Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -30,34 +30,30 @@
#include "track.h"
class automationTrack : public QWidget, public track
class automationTrack : public track
{
Q_OBJECT
public:
automationTrack( trackContainer * _tc );
virtual ~automationTrack();
private:
inline QString nodeName( void ) const
{
return( "automation-track" );
}
virtual trackTypes type( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
const fpp_t _frames,
virtual bool play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual QString nodeName( void ) const
{
return( "automationtrack" );
}
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
virtual trackView * createView( trackContainerView * )
{
return( NULL );
}
virtual trackContentObject * createTCO( const midiTime & _pos );
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
} ;

View File

@@ -92,17 +92,7 @@ public:
m_sampleRate( _sample_rate ),
m_subFilter( NULL )
{
// reset in/out history
for( ch_cnt_t _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;
}
clearHistory();
}
inline ~basicFilters()
@@ -110,6 +100,21 @@ public:
delete m_subFilter;
}
inline void clearHistory( void )
{
// reset in/out history
for( ch_cnt_t _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 sample_t update( sample_t _in0, ch_cnt_t _chnl )
{
sample_t out;

View File

@@ -1,7 +1,7 @@
/*
* bb_editor.h - declaration of class bbEditor, a basic-component of LMMS
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,51 +27,44 @@
#define _BB_EDITOR_H
#include "track_container.h"
#include "combobox.h"
class QPixmap;
class comboBox;
class toolButton;
class bbEditor : public trackContainer
class bbTrackContainer : public trackContainer
{
Q_OBJECT
mapPropertyFromModel(int,currentBB,setCurrentBB,m_bbComboBoxModel);
public:
virtual bool FASTCALL play( midiTime _start, const fpp_t _frames,
bbTrackContainer( void );
virtual ~bbTrackContainer();
virtual bool play( midiTime _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
// virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
// virtual void loadSettings( const QDomElement & _this );
virtual void updateAfterTrackAdd( void );
inline virtual QString nodeName( void ) const
{
return( "bbeditor" );
return( "bbtrackcontainer" );
}
virtual inline bool fixedTCOs( void ) const
{
return( TRUE );
}
int currentBB( void ) const
{
return( m_currentBB );
}
tact FASTCALL lengthOfBB( const int _bb );
tact lengthOfBB( int _bb );
inline tact lengthOfCurrentBB( void )
{
return( lengthOfBB( currentBB() ) );
}
void FASTCALL removeBB( const int _bb );
int numOfBBs( void ) const;
void removeBB( int _bb );
void FASTCALL swapBB( const int _bb1, const int _bb2 );
void swapBB( int _bb1, int _bb2 );
void updateBBTrack( trackContentObject * _tco );
@@ -80,23 +73,46 @@ public slots:
void play( void );
void stop( void );
void updateComboBox( void );
void setCurrentBB( int _bb );
protected:
virtual void keyPressEvent( QKeyEvent * _ke );
void currentBBChanged( void );
private:
bbEditor( void );
//bbEditor( const bbEditor & );
void createTCOsForBB( int _bb );
comboBoxModel m_bbComboBoxModel;
friend class bbEditor;
} ;
class bbEditor : public trackContainerView
{
Q_OBJECT
public:
bbEditor( bbTrackContainer * _tc );
virtual ~bbEditor();
void FASTCALL createTCOsForBB( const int _bb );
virtual inline bool fixedTCOs( void ) const
{
return( TRUE );
}
void removeBBView( int _bb );
int m_currentBB;
public slots:
void play( void );
void stop( void );
void updatePosition( void );
private:
virtual void keyPressEvent( QKeyEvent * _ke );
bbTrackContainer * m_bbtc;
QWidget * m_toolBar;
toolButton * m_playButton;
@@ -104,9 +120,6 @@ private:
comboBox * m_bbComboBox;
friend class engine;
} ;

View File

@@ -2,7 +2,7 @@
* bb_track.h - class bbTrack, a wrapper for using bbEditor
* (which is a singleton-class) as track
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -38,27 +38,51 @@ class trackContainer;
class bbTCO : public trackContentObject
{
Q_OBJECT
public:
bbTCO( track * _track, const QColor & _c = QColor() );
bbTCO( track * _track, unsigned int _color = 0 );
virtual ~bbTCO();
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "bbtco" );
}
const QColor & color( void ) const
inline unsigned int color( void ) const
{
return( m_color );
}
virtual trackContentObjectView * createView( trackView * _tv );
private:
QString m_name;
unsigned int m_color;
friend class bbTCOView;
} ;
class bbTCOView : public trackContentObjectView
{
Q_OBJECT
public:
bbTCOView( trackContentObject * _tco, trackView * _tv );
virtual ~bbTCOView();
QColor color( void ) const
{
return( m_bbTCO->m_color );
}
void setColor( QColor _new_color );
protected slots:
void openInBBEditor( bool _c );
void openInBBEditor( void );
void resetName( void );
void changeName( void );
@@ -72,62 +96,48 @@ protected:
private:
QString m_name;
QColor m_color;
void setColor( QColor _new_color );
bbTCO * m_bbTCO;
} ;
class bbTrack : public QObject, public track
class bbTrack : public track
{
Q_OBJECT
public:
bbTrack( trackContainer * _tc );
virtual ~bbTrack();
virtual trackTypes type( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
virtual bool play( const midiTime & _start,
const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual trackView * createView( trackContainerView * _tcv );
virtual trackContentObject * createTCO( const midiTime & _pos );
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
static bbTrack * FASTCALL findBBTrack( int _bb_num );
static int FASTCALL numOfBBTrack( track * _track );
static void FASTCALL swapBBTracks( track * _track1, track * _track2 );
inline nameLabel * trackLabel( void )
{
return( m_trackLabel );
}
static bbTrack * findBBTrack( int _bb_num );
static int numOfBBTrack( track * _track );
static void swapBBTracks( track * _track1, track * _track2 );
bool automationDisabled( track * _track )
{
return( m_disabled_tracks.contains( _track ) );
return( m_disabledTracks.contains( _track ) );
}
void disableAutomation( track * _track )
{
m_disabled_tracks.append( _track );
m_disabledTracks.append( _track );
}
void enableAutomation( track * _track )
{
m_disabled_tracks.removeAll( _track );
m_disabledTracks.removeAll( _track );
}
public slots:
void clickedTrackLabel( void );
protected:
inline virtual QString nodeName( void ) const
{
@@ -136,13 +146,43 @@ protected:
private:
nameLabel * m_trackLabel;
QList<track *> m_disabled_tracks;
QList<track *> m_disabledTracks;
typedef QMap<bbTrack *, int> infoMap;
static infoMap s_infoMap;
friend class bbTrackView;
} ;
class bbTrackView : public trackView
{
Q_OBJECT
public:
bbTrackView( bbTrack * _bbt, trackContainerView * _tcv );
virtual ~bbTrackView();
inline nameLabel * trackLabel( void )
{
return( m_trackLabel );
}
virtual bool close( void );
public slots:
void clickedTrackLabel( void );
private:
bbTrack * m_bbTrack;
nameLabel * m_trackLabel;
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* combobox.h - class comboBox, a very cool combo-box
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -29,41 +29,93 @@
#include <QtGui/QWidget>
#include <QtCore/QVector>
#include <QtGui/QMenu>
#include <QtGui/QPixmap>
#include <QtCore/QPair>
#include "automatable_object.h"
#include "automatable_model.h"
#include "templates.h"
class QAction;
class comboBox : public QWidget, public automatableObject<int>
class comboBoxModel : public intModel
{
Q_OBJECT
public:
comboBox( QWidget * _parent, const QString & _name, track * _track );
virtual ~comboBox();
void addItem( const QString & _item, const QPixmap & _pixmap =
QPixmap() );
inline void clear( void )
comboBoxModel( ::model * _parent = NULL ) :
automatableModel<int>( 0, 0, 0, defaultRelStep(), _parent )
{
setRange( 0, 0 );
m_items.clear();
m_menu.clear();
update();
}
void addItem( const QString & _item, QPixmap * _data = NULL );
void clear( void );
int findText( const QString & _txt ) const;
QString currentText( void ) const
inline const QString & currentText( void ) const
{
return( m_items[value()].first );
}
void setValue( const int _idx );
inline const QPixmap * currentData( void ) const
{
return( m_items[value()].second );
}
inline const QString & itemText( int _i ) const
{
return( m_items[tLimit<int>( _i, minValue(), maxValue() )].
first );
}
inline const QPixmap * itemPixmap( int _i ) const
{
return( m_items[tLimit<int>( _i, minValue(), maxValue() )].
second );
}
inline int size( void ) const
{
return( m_items.size() );
}
private:
typedef QPair<QString, QPixmap *> item;
QVector<item> m_items;
signals:
void itemPixmapRemoved( QPixmap * _item );
} ;
class comboBox : public QWidget, public intModelView
{
Q_OBJECT
public:
comboBox( QWidget * _parent, const QString & _name = QString::null );
virtual ~comboBox();
comboBoxModel * model( void )
{
return( castModel<comboBoxModel>() );
}
const comboBoxModel * model( void ) const
{
return( castModel<comboBoxModel>() );
}
virtual void modelChanged( void )
{
if( model() != NULL )
{
connect( model(), SIGNAL( itemPixmapRemoved( QPixmap * ) ),
this, SLOT( deletePixmap( QPixmap * ) ) );
}
}
protected:
@@ -79,21 +131,13 @@ private:
QMenu m_menu;
typedef QPair<QString, QPixmap> item;
QVector<item> m_items;
bool m_pressed;
private slots:
void deletePixmap( QPixmap * _pixmap );
void setItem( QAction * _item );
signals:
void activated( const QString & );
void valueChanged( int );
} ;
#endif

View File

@@ -27,14 +27,16 @@
#define _DETUNING_HELPER_H
#include "automatable_model.h"
#include "shared_object.h"
#include "automation_editor.h"
class detuningHelper : public automatableObject<float>, public sharedObject
class detuningHelper : public floatModel, public sharedObject
{
public:
detuningHelper( void ) :
autoObj( NULL )
autoModel( NULL )
{
}

View File

@@ -27,14 +27,30 @@
#define _DUMMY_EFFECT_H
#include "effect.h"
#include "effect_controls.h"
#include "effect_control_dialog.h"
class dummyEffectControlDialog : public effectControlDialog
{
public:
dummyEffectControlDialog( effect * _eff ) :
effectControlDialog( NULL, _eff )
dummyEffectControlDialog( effectControls * _controls ) :
effectControlDialog( _controls )
{
}
} ;
class dummyEffectControls : public effectControls
{
public:
dummyEffectControls( effect * _eff ) :
effectControls( _eff )
{
}
virtual ~dummyEffectControls()
{
}
@@ -43,28 +59,6 @@ public:
return( 0 );
}
inline virtual QString nodeName( void ) const
{
return( "dummycontrols" );
}
} ;
class dummyEffect : public effect
{
public:
inline dummyEffect( void ) :
effect( NULL, NULL )
{
}
inline virtual ~dummyEffect()
{
}
inline virtual void saveSettings( QDomDocument &, QDomElement & )
{
}
@@ -75,13 +69,37 @@ public:
inline virtual QString nodeName( void ) const
{
return( "dummyeffect" );
return( "dummycontrols" );
}
inline virtual effectControlDialog * createControlDialog( track * )
virtual effectControlDialog * createView( void )
{
return( new dummyEffectControlDialog( this ) );
}
} ;
class dummyEffect : public effect
{
public:
inline dummyEffect( model * _parent ) :
effect( NULL, _parent, NULL ),
m_controls( this )
{
}
inline virtual ~dummyEffect()
{
}
inline virtual effectControls * getControls( void )
{
return( &m_controls );
}
private:
dummyEffectControls m_controls;
} ;

View File

@@ -2,7 +2,7 @@
* dummy_instrument.h - instrument used as fallback if an instrument couldn't
* be loaded
*
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,29 +33,33 @@
class dummyInstrument : public instrument
{
public:
inline dummyInstrument( instrumentTrack * _channel_track ) :
instrument( _channel_track, NULL )
dummyInstrument( instrumentTrack * _instrument_track ) :
instrument( _instrument_track, NULL )
{
}
inline virtual ~dummyInstrument()
virtual ~dummyInstrument()
{
}
inline virtual void saveSettings( QDomDocument &, QDomElement & )
virtual void saveSettings( QDomDocument &, QDomElement & )
{
}
inline virtual void loadSettings( const QDomElement & )
virtual void loadSettings( const QDomElement & )
{
}
inline virtual QString nodeName( void ) const
virtual QString nodeName( void ) const
{
return( "dummyinstrument" );
}
virtual pluginView * instantiateView( QWidget * _parent )
{
return( new instrumentView( this, _parent ) );
}
} ;

View File

@@ -2,7 +2,7 @@
* dummy_plugin.h - empty plugin which is used as fallback if a plugin couldn't
* be found
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,13 +28,14 @@
#define _DUMMY_PLUGIN_H
#include "plugin.h"
#include "plugin_view.h"
class dummyPlugin : public plugin
{
public:
inline dummyPlugin( void ) :
plugin( NULL )
plugin( NULL, NULL )
{
}
@@ -56,6 +57,12 @@ public:
return( "dummyplugin" );
}
protected:
virtual pluginView * instantiateView( QWidget * _parent )
{
return( new pluginView( this, _parent ) );
}
} ;

View File

@@ -2,7 +2,7 @@
* effect.h - base class for effects
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -34,10 +34,14 @@
#include <Qt/QtXml>
#include "plugin.h"
#include "engine.h"
#include "mixer.h"
#include "automatable_model.h"
#include "tempo_sync_knob.h"
class effectControlDialog;
class effectChain;
class effectControls;
class track;
@@ -45,141 +49,148 @@ class effect : public plugin
{
public:
effect( const plugin::descriptor * _desc,
model * _parent,
const descriptor::subPluginFeatures::key * _key );
virtual ~effect();
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "effect" );
}
virtual bool FASTCALL processAudioBuffer(
virtual bool processAudioBuffer(
surroundSampleFrame * _buf, const fpp_t _frames );
inline ch_cnt_t getProcessorCount( void )
inline ch_cnt_t getProcessorCount( void ) const
{
return( m_processors );
}
inline void setProcessorCount( ch_cnt_t _processors )
{
m_processors = _processors;
}
inline bool isOkay( void )
inline bool isOkay( void ) const
{
return( m_okay );
}
inline void setOkay( bool _state )
{
m_okay = _state;
}
inline bool isRunning( void )
inline bool isRunning( void ) const
{
return( m_running );
}
inline void startRunning( void )
{
m_bufferCount = 0;
m_running = TRUE;
}
inline void stopRunning( void )
{
m_running = FALSE;
}
inline bool isBypassed( void )
inline bool isEnabled( void ) const
{
return( m_bypass );
return( m_enabledModel.value() );
}
inline void setBypass( bool _mode )
inline f_cnt_t getTimeout( void ) const
{
m_bypass = _mode;
const float samples = engine::getMixer()->sampleRate() *
m_autoQuitModel.value() / 1000.0f;
return( 1 + ( static_cast<Uint32>( samples ) /
engine::getMixer()->framesPerPeriod() ) );
}
inline Uint32 getTimeout( void )
inline float getWetLevel( void ) const
{
return( m_silenceTimeout );
return( m_wetDryModel.value() );
}
inline void setTimeout( Uint32 _time_out )
inline float getDryLevel( void ) const
{
m_silenceTimeout = _time_out;
return( 1.0f - m_wetDryModel.value() );
}
inline float getWetLevel( void )
inline float getGate( void ) const
{
return( m_wetDry );
const float level = m_gateModel.value();
return( level*level * m_processors *
engine::getMixer()->framesPerPeriod() );
}
inline float getDryLevel( void )
{
return( 1.0f - m_wetDry );
}
inline void setWetLevel( float _wet )
{
m_wetDry = _wet;
}
inline float getGate( void )
{
return( m_gate );
}
void setGate( float _level );
inline Uint32 getBufferCount( void )
inline f_cnt_t getBufferCount( void ) const
{
return( m_bufferCount );
}
inline void resetBufferCount( void )
{
m_bufferCount = 0;
}
inline void incrementBufferCount( void )
{
m_bufferCount++;
++m_bufferCount;
}
inline bool dontRun( void )
inline bool dontRun( void ) const
{
return( m_noRun );
}
inline void setDontRun( bool _state )
{
m_noRun = _state;
}
inline const descriptor::subPluginFeatures::key & getKey( void )
inline const descriptor::subPluginFeatures::key & getKey( void ) const
{
return( m_key );
}
virtual effectControlDialog * createControlDialog( track * _track ) = 0;
virtual effectControls * getControls( void ) = 0;
static effect * instantiate( const QString & _plugin_name,
model * _parent,
descriptor::subPluginFeatures::key * _key );
protected:
virtual pluginView * instantiateView( QWidget * );
private:
descriptor::subPluginFeatures::key m_key;
ch_cnt_t m_processors;
bool m_okay;
bool m_noRun;
bool m_running;
bool m_bypass;
Uint32 m_bufferCount;
Uint32 m_silenceTimeout;
float m_wetDry;
float m_gate;
f_cnt_t m_bufferCount;
boolModel m_enabledModel;
floatModel m_wetDryModel;
floatModel m_gateModel;
tempoSyncKnobModel m_autoQuitModel;
friend class effectView;
friend class effectChain;
} ;

View File

@@ -1,7 +1,8 @@
/*
* effect_chain.h - class for processing and effects chain
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,37 +28,49 @@
#include "effect.h"
typedef QVector<effect *> effect_list_t;
class effectChain
class effectChain : public journallingObject, public model
{
public:
effectChain( void );
effectChain( audioPort * _port, track * _track );
virtual ~effectChain();
void FASTCALL appendEffect( effect * _effect );
void FASTCALL removeEffect( effect * _effect );
void FASTCALL moveDown( effect * _effect );
void FASTCALL moveUp( effect * _effect );
bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf,
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "fxchain" );
}
void appendEffect( effect * _effect );
void removeEffect( effect * _effect );
void moveDown( effect * _effect );
void moveUp( effect * _effect );
bool processAudioBuffer( surroundSampleFrame * _buf,
const fpp_t _frames );
void startRunning( void );
bool isRunning( void );
inline void setBypass( bool _mode )
{
m_bypassed = _mode;
}
inline const effect_list_t & getEffects( void )
/* inline const effect_list_t & getEffects( void )
{
return( m_effects );
}
}*/
void deleteAllPlugins( void );
private:
effect_list_t m_effects;
bool m_bypassed;
typedef QVector<effect *> effectList;
effectList m_effects;
audioPort * m_port;
track * m_track;
boolModel m_enabledModel;
friend class effectRackView;
} ;

View File

@@ -2,7 +2,7 @@
* effect_control_dialog.h - base-class for effect-dialogs for displaying and
* editing control port values
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,22 +28,19 @@
#include <QtGui/QWidget>
#include "journalling_object.h"
#include "mv_base.h"
class effect;
class track;
class effectControls;
class effectControlDialog : public QWidget, public journallingObject
class effectControlDialog : public QWidget, public modelView
{
Q_OBJECT
public:
effectControlDialog( QWidget * _parent, effect * _eff );
effectControlDialog( effectControls * _controls );
virtual ~effectControlDialog();
virtual ch_cnt_t getControlCount( void ) = 0;
signals:
void closed();
@@ -51,15 +48,10 @@ signals:
protected:
virtual void closeEvent( QCloseEvent * _ce );
template<class T>
T * getEffect( void )
{
return( dynamic_cast<T *>( m_effect ) );
}
private:
effect * m_effect;
effectControls * m_effectControls;
} ;

68
include/effect_controls.h Normal file
View File

@@ -0,0 +1,68 @@
/*
* effect_controls.h - model for effect-controls
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _EFFECT_CONTROLS_H
#define _EFFECT_CONTROLS_H
#include "mv_base.h"
#include "journalling_object.h"
#include "effect.h"
class track;
class effectControlDialog;
class effectControls : public journallingObject, public model
{
public:
effectControls( effect * _eff ) :
journallingObject(),
model( _eff ),
m_effect( _eff )
{
}
virtual ~effectControls()
{
}
virtual ch_cnt_t getControlCount( void ) = 0;
virtual effectControlDialog * createView( void ) = 0;
// template<class T>
effect * getEffect( void )
{
return( m_effect );
//return( dynamic_cast<T *>( m_effect ) );
}
private:
effect * m_effect;
} ;
#endif

View File

@@ -3,6 +3,7 @@
* offers access to an effect rack
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,18 +29,15 @@
#include <QtGui/QWidget>
#include "journalling_object.h"
class QLabel;
class QPushButton;
class effectTabWidget;
class effectRackView;
class sampleTrack;
class tabWidget;
class effectLabel: public QWidget, public journallingObject
class effectLabel: public QWidget
{
Q_OBJECT
public:
@@ -48,22 +46,14 @@ public:
virtual ~effectLabel();
QString text( void ) const;
void FASTCALL setText( const QString & _text );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "sample_track" );
}
void setText( const QString & _text );
public slots:
void showEffects( void );
void rename( void );
signals:
void clicked( void );
void nameChanged( void );
@@ -78,13 +68,12 @@ protected:
private:
sampleTrack * m_track;
QLabel * m_label;
QPushButton * m_effectBtn;
tabWidget * m_tabWidget;
effectTabWidget * m_effWidget;
QWidget * m_effWindow;
effectRackView * m_effectRack;
};
} ;
#endif

View File

@@ -1,7 +1,8 @@
/*
* right_frame.h - provides the display for the rackInsert instances
* effect_rack_view.h - view for effectChain-model
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn@netscape.net>
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -22,63 +23,61 @@
*
*/
#ifndef _RACK_VIEW_H
#define _RACK_VIEW_H
#ifndef _EFFECT_RACK_VIEW_H
#define _EFFECT_RACK_VIEW_H
#include <QtGui/QWidget>
#include <QtGui/QLayout>
#include <QtGui/QScrollArea>
#include <QtGui/QVBoxLayout>
#include "effect_chain.h"
#include "types.h"
#include "journalling_object.h"
class QPushButton;
class QScrollArea;
class QVBoxLayout;
class effectView;
class groupBox;
class audioPort;
class effect;
class rackPlugin;
class track;
class rackView: public QWidget, public journallingObject
class effectRackView : public QWidget, public modelView
{
Q_OBJECT
public:
rackView( QWidget * _parent, track * _track, audioPort * _port );
~rackView();
void addEffect( effect * _e );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "rack" );
}
void deleteAllPlugins( void );
effectRackView( effectChain * _model, QWidget * _parent );
virtual ~effectRackView();
public slots:
void moveUp( rackPlugin * _plugin );
void moveDown( rackPlugin * _plugin );
void deletePlugin( rackPlugin * _plugin );
void moveUp( effectView * _view );
void moveDown( effectView * _view );
void deletePlugin( effectView * _view );
private slots:
virtual void update( void );
void addEffect( void );
private:
void redraw();
virtual void modelChanged( void );
inline effectChain * fxChain( void )
{
return( castModel<effectChain>() );
}
inline const effectChain * fxChain( void ) const
{
return( castModel<effectChain>() );
}
QVector<rackPlugin *> m_rackInserts;
QVector<effectView *> m_effectViews;
QVBoxLayout * m_mainLayout;
groupBox * m_effectsGroupBox;
QScrollArea * m_scrollArea;
track * m_track;
audioPort * m_port;
QPushButton * m_addButton;
Uint32 m_lastY;

View File

@@ -29,7 +29,7 @@
#include <QtGui/QDialog>
#include <QtGui/QListWidget>
#include "effect.h"
#include "effect_chain.h"
class effectSelectDialog : public QDialog
@@ -39,7 +39,7 @@ public:
effectSelectDialog( QWidget * _parent );
virtual ~effectSelectDialog();
effect * instantiateSelectedPlugin( void );
effect * instantiateSelectedPlugin( effectChain * _parent );
public slots:
void showPorts( void );
@@ -53,13 +53,13 @@ private:
class effectList : public QWidget
class effectListWidget : public QWidget
{
Q_OBJECT
public:
effectList( QWidget * _parent );
effectListWidget( QWidget * _parent );
virtual ~effectList();
virtual ~effectListWidget();
inline effectKey getSelected( void )
{

View File

@@ -1,8 +1,8 @@
/*
* rack_plugin.h - tab-widget in channel-track-window for setting up
* effects
* effect_view.h - view-component for an effect
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -22,13 +22,12 @@
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _RACK_PLUGIN_H
#define _RACK_PLUGIN_H
#include <QtGui/QWidget>
#include "journalling_object.h"
#ifndef _EFFECT_VIEW_H
#define _EFFECT_VIEW_H
#include "automatable_model.h"
#include "plugin_view.h"
class QGroupBox;
class QLabel;
@@ -44,48 +43,43 @@ class tempoSyncKnob;
class track;
class rackPlugin: public QWidget, public journallingObject
class effectView : public pluginView
{
Q_OBJECT
public:
rackPlugin( QWidget * _parent, effect * _eff, track * _track,
audioPort * _port );
virtual ~rackPlugin();
effectView( effect * _model, QWidget * _parent );
virtual ~effectView();
inline effect * getEffect()
inline effect * getEffect( void )
{
return( m_effect );
return( castModel<effect>() );
}
inline const effect * getEffect( void ) const
{
return( castModel<effect>() );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "effect" );
}
public slots:
void editControls( void );
void bypassed( bool _state );
void setWetDry( float _value );
void setAutoQuit( float _value );
void setGate( float _value );
void moveUp( void );
void moveDown( void );
void deletePlugin( void );
void displayHelp( void );
void closeEffects( void );
signals:
void moveUp( rackPlugin * _plugin );
void moveDown( rackPlugin * _plugin );
void deletePlugin( rackPlugin * _plugin );
void moveUp( effectView * _plugin );
void moveDown( effectView * _plugin );
void deletePlugin( effectView * _plugin );
protected:
void contextMenuEvent( QContextMenuEvent * _me );
virtual void modelChanged( void );
private:
ledCheckBox * m_bypass;
knob * m_wetDry;
@@ -95,11 +89,8 @@ private:
QGroupBox * m_controls;
QLabel * m_label;
QPushButton * m_editButton;
QMdiSubWindow *m_subWindow;
effect * m_effect;
QMdiSubWindow * m_subWindow;
effectControlDialog * m_controlView;
track * m_track;
audioPort * m_port;
bool m_show;
} ;

View File

@@ -1,7 +1,7 @@
/*
* engine.h - engine-system of LMMS
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -34,11 +34,13 @@
class automationEditor;
class bbEditor;
class bbTrackContainer;
class projectJournal;
class mainWindow;
class mixer;
class pianoRoll;
class projectNotes;
class song;
class songEditor;
class ladspa2LMMS;
@@ -54,11 +56,28 @@ public:
return( s_hasGUI );
}
// core
static mixer * getMixer( void )
{
return( s_mixer );
}
static song * getSong( void )
{
return( s_song );
}
static bbTrackContainer * getBBTrackContainer( void )
{
return( s_bbTrackContainer );
}
static projectJournal * getProjectJournal( void )
{
return( s_projectJournal );
}
// GUI
static mainWindow * getMainWindow( void )
{
return( s_mainWindow );
@@ -84,11 +103,6 @@ public:
return( s_projectNotes );
}
static projectJournal * getProjectJournal( void )
{
return( s_projectJournal );
}
static automationEditor * getAutomationEditor( void )
{
return( s_automationEditor );
@@ -101,33 +115,38 @@ public:
static float framesPerTact64th( void )
{
return( s_frames_per_tact64th );
return( s_framesPerTact64th );
}
static void updateFramesPerTact64th( void );
static const QMap<QString, QString> & sampleExtensions( void )
{
return( s_sample_extensions );
return( s_sampleExtensions );
}
private:
static bool s_hasGUI;
static float s_frames_per_tact64th;
static float s_framesPerTact64th;
// core
static mixer * s_mixer;
static song * s_song;
static bbTrackContainer * s_bbTrackContainer;
static projectJournal * s_projectJournal;
// GUI
static mainWindow * s_mainWindow;
static songEditor * s_songEditor;
static automationEditor * s_automationEditor;
static bbEditor * s_bbEditor;
static pianoRoll * s_pianoRoll;
static projectNotes * s_projectNotes;
static projectJournal * s_projectJournal;
static ladspa2LMMS * s_ladspaManager;
static QMap<QString, QString> s_sample_extensions;
static QMap<QString, QString> s_sampleExtensions;
static void load_extensions( void );
static void loadExtensions( void );
} ;

View File

@@ -0,0 +1,159 @@
/*
* envelope_and_lfo_parameters.h - class envelopeAndLFOParameters
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _ENVELOPE_AND_LFO_PARAMETERS_H
#define _ENVELOPE_AND_LFO_PARAMETERS_H
#include <QtCore/QVector>
#include "journalling_object.h"
#include "automatable_model.h"
#include "sample_buffer.h"
#include "tempo_sync_knob.h"
#include "types.h"
class track;
class envelopeAndLFOParameters : public model, public journallingObject
{
Q_OBJECT
public:
envelopeAndLFOParameters( float _value_for_zero_amount,
track * _track,
model * _parent );
virtual ~envelopeAndLFOParameters();
static inline float expKnobVal( float _val )
{
return( ( ( _val < 0 ) ? -_val : _val ) * _val );
}
static void triggerLFO( void );
static void resetLFO( void );
void fillLevel( float * _buf, f_cnt_t _frame,
const f_cnt_t _release_begin,
const fpp_t _frames );
inline bool used( void ) const
{
return( m_used );
}
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual QString nodeName( void ) const
{
return( "el" );
}
inline f_cnt_t PAHD_Frames( void ) const
{
return( m_pahdFrames );
}
inline f_cnt_t releaseFrames( void ) const
{
return( m_rFrames );
}
public slots:
void updateSampleVars( void );
protected:
void fillLFOLevel( float * _buf, f_cnt_t _frame, const fpp_t _frames );
private:
static QVector<envelopeAndLFOParameters *> s_EaLParametersInstances;
bool m_used;
floatModel m_predelayModel;
floatModel m_attackModel;
floatModel m_holdModel;
floatModel m_decayModel;
floatModel m_sustainModel;
floatModel m_releaseModel;
floatModel m_amountModel;
float m_sustainLevel;
float m_amount;
float m_valueForZeroAmount;
float m_amountAdd;
f_cnt_t m_pahdFrames;
f_cnt_t m_rFrames;
sample_t * m_pahdEnv;
sample_t * m_rEnv;
floatModel m_lfoPredelayModel;
floatModel m_lfoAttackModel;
tempoSyncKnobModel m_lfoSpeedModel;
floatModel m_lfoAmountModel;
intModel m_lfoWaveModel;
boolModel m_x100Model;
boolModel m_controlEnvAmountModel;
f_cnt_t m_lfoPredelayFrames;
f_cnt_t m_lfoAttackFrames;
f_cnt_t m_lfoOscillationFrames;
f_cnt_t m_lfoFrame;
float m_lfoAmount;
bool m_lfoAmountIsZero;
sample_t * m_lfoShapeData;
bool m_bad_lfoShapeData;
sampleBuffer m_userWave;
enum LfoShapes
{
SineWave,
TriangleWave,
SawWave,
SquareWave,
UserDefinedWave,
NumLfoShapes
} ;
sample_t lfoShapeSample( fpp_t _frame_offset );
void updateLFOShapeData( void );
friend class envelopeAndLFOView;
friend class flpImport;
} ;
#endif

View File

@@ -0,0 +1,98 @@
/*
* envelope_and_lfo_view.h - declaration of class envelopeAndLFOWidget which
* is used by envelope/lfo/filter-tab of
* channel-window
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _ENVELOPE_AND_LFO_VIEW_H
#define _ENVELOPE_AND_LFO_VIEW_H
#include <QtGui/QWidget>
#include "mv_base.h"
class QPaintEvent;
class QPixmap;
class envelopeAndLFOParameters;
class automatableButtonGroup;
class knob;
class ledCheckBox;
class pixmapButton;
class tempoSyncKnob;
class envelopeAndLFOView : public QWidget, public modelView
{
Q_OBJECT
public:
envelopeAndLFOView( QWidget * _parent );
virtual ~envelopeAndLFOView();
protected:
virtual void modelChanged( void );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
protected slots:
void lfoUserWaveChanged( void );
private:
static QPixmap * s_envGraph;
static QPixmap * s_lfoGraph;
envelopeAndLFOParameters * m_params;
// envelope-stuff
knob * m_predelayKnob;
knob * m_attackKnob;
knob * m_holdKnob;
knob * m_decayKnob;
knob * m_sustainKnob;
knob * m_releaseKnob;
knob * m_amountKnob;
// LFO-stuff
knob * m_lfoPredelayKnob;
knob * m_lfoAttackKnob;
tempoSyncKnob * m_lfoSpeedKnob;
knob * m_lfoAmountKnob;
pixmapButton * m_userLfoBtn;
automatableButtonGroup * m_lfoWaveBtnGrp;
ledCheckBox * m_x100Cb;
ledCheckBox * m_controlEnvAmountCb;
} ;
#endif

View File

@@ -1,178 +0,0 @@
/*
* envelope_and_lfo_widget.h - declaration of class envelopeAndLFOWidget which
* is used by envelope/lfo/filter-tab of
* channel-window
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _ENVELOPE_AND_LFO_WIDGET_H
#define _ENVELOPE_AND_LFO_WIDGET_H
#include <QtCore/QVector>
#include <QtGui/QWidget>
#include "journalling_object.h"
#include "sample_buffer.h"
#include "types.h"
class QPaintEvent;
class QPixmap;
class automatableButtonGroup;
class envelopeTabWidget;
class knob;
class ledCheckBox;
class pixmapButton;
class tempoSyncKnob;
class track;
class flpImport;
class envelopeAndLFOWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
envelopeAndLFOWidget( float _value_for_zero_amount, QWidget * _parent,
track * _track );
virtual ~envelopeAndLFOWidget();
static inline float expKnobVal( float _val )
{
return( ( ( _val < 0 ) ? -_val : _val ) * _val );
}
static void triggerLFO( void );
static void resetLFO( void );
void FASTCALL fillLevel( float * _buf, f_cnt_t _frame,
const f_cnt_t _release_begin,
const fpp_t _frames );
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:
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
void FASTCALL fillLFOLevel( float * _buf, f_cnt_t _frame,
const fpp_t _frames );
protected slots:
void updateAfterKnobChange( float );
void lfoWaveCh( int );
void lfoUserWaveCh( bool );
void x100Toggled( bool );
private:
static QPixmap * s_envGraph;
static QPixmap * s_lfoGraph;
static QVector<envelopeAndLFOWidget *> s_EaLWidgets;
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;
float m_sustainLevel;
float m_amount;
float m_valueForZeroAmount;
float m_amountAdd;
f_cnt_t m_pahdFrames;
f_cnt_t m_rFrames;
sample_t * m_pahdEnv;
sample_t * m_rEnv;
// LFO-stuff
knob * m_lfoPredelayKnob;
knob * m_lfoAttackKnob;
tempoSyncKnob * m_lfoSpeedKnob;
knob * m_lfoAmountKnob;
pixmapButton * m_userLfoBtn;
automatableButtonGroup * m_lfoWaveBtnGrp;
ledCheckBox * m_x100Cb;
ledCheckBox * m_controlEnvAmountCb;
f_cnt_t m_lfoPredelayFrames;
f_cnt_t m_lfoAttackFrames;
f_cnt_t m_lfoOscillationFrames;
f_cnt_t m_lfoFrame;
float m_lfoAmount;
bool m_lfoAmountIsZero;
sample_t * m_lfoShapeData;
bool m_bad_lfoShapeData;
sampleBuffer m_userWave;
enum lfoShapes
{
SIN,
TRIANGLE,
SAW,
SQUARE,
USER
} m_lfoShape;
sample_t lfoShapeSample( fpp_t _frame_offset );
void updateLFOShapeData( void );
friend class envelopeTabWidget;
friend class flpImport;
} ;
#endif

View File

@@ -1,99 +0,0 @@
/*
* envelope_tab_widget.h - declaration of class envelopeTabWidget which
* provides UI- and DSP-code for using envelopes, LFOs
* and a filter
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _ENVELOPE_TAB_WIDGET_H
#define _ENVELOPE_TAB_WIDGET_H
#include <QtGui/QWidget>
#include "mixer.h"
class QLabel;
class instrumentTrack;
class comboBox;
class envelopeAndLFOWidget;
class groupBox;
class knob;
class notePlayHandle;
class pixmapButton;
class tabWidget;
class envelopeTabWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
envelopeTabWidget( instrumentTrack * _channel_track );
virtual ~envelopeTabWidget();
void FASTCALL processAudioBuffer( sampleFrame * _ab,
const fpp_t _frames,
notePlayHandle * _n );
enum targets
{
VOLUME,
/* PANNING,
PITCH,*/
CUT,
RES,
TARGET_COUNT
} ;
f_cnt_t envFrames( const bool _only_vol = FALSE );
f_cnt_t releaseFrames( const bool _only_vol = FALSE );
float FASTCALL volumeLevel( notePlayHandle * _n, const f_cnt_t _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:
tabWidget * m_targetsTabWidget;
envelopeAndLFOWidget * m_envLFOWidgets[TARGET_COUNT];
instrumentTrack * m_instrumentTrack;
// filter-stuff
groupBox * m_filterGroupBox;
comboBox * m_filterComboBox;
knob * m_filterCutKnob;
knob * m_filterResKnob;
friend class flpImport;
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* export.h - header which is needed for song-export
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -43,18 +43,18 @@ typedef audioFileDevice * ( * getDeviceInst)( const sample_rate_t _sample_rate,
mixer * _mixer );
enum fileTypes
enum ExportFileTypes
{
WAVE_FILE,
OGG_FILE,
NULL_FILE = 0xFF
WaveFile,
OggFile,
NullFile = 0xFF
} ;
struct fileEncodeDevice
{
fileTypes m_fileType;
ExportFileTypes m_fileType;
const char * m_description;
const char * m_extension;
getDeviceInst m_getDevInst;

View File

@@ -2,7 +2,7 @@
* export_project_dialog.h - declaration of class exportProjectDialog which is
* responsible for exporting project
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -30,13 +30,14 @@
#include <QtGui/QDialog>
#include "export.h"
#include "automatable_model.h"
#include "combobox.h"
class QLabel;
class QPushButton;
class QProgressBar;
class comboBox;
class ledCheckBox;
class pixmapButton;
@@ -67,11 +68,15 @@ private:
void finishProjectExport( void );
void abortProjectExport( void );
static fileTypes getFileTypeFromExtension( const QString & _ext );
static ExportFileTypes getFileTypeFromExtension( const QString & _ext );
static Sint16 s_availableBitrates[];
QString m_fileName;
comboBoxModel m_typeModel;
comboBoxModel m_kbpsModel;
boolModel m_vbrEnabledModel;
boolModel m_hqmEnabledModel;
QLabel * m_typeLbl;
comboBox * m_typeCombo;
QLabel * m_kbpsLbl;
@@ -83,7 +88,8 @@ private:
QPushButton * m_cancelBtn;
QProgressBar * m_exportProgressBar;
fileTypes m_fileType;
QString m_fileName;
ExportFileTypes m_fileType;
bool m_deleteFile;
} ;

View File

@@ -173,13 +173,18 @@ public:
text( 0 ) );
}
enum fileTypes
enum FileTypes
{
PROJECT_FILE, PRESET_FILE, SAMPLE_FILE, MIDI_FILE, FLP_FILE,
UNKNOWN
ProjectFile,
PresetFile,
SampleFile,
MidiFile,
FlpFile,
UnknownFile,
NumFileTypes
} ;
inline fileTypes type( void )
inline FileTypes type( void )
{
return( m_type );
}
@@ -200,7 +205,7 @@ private:
static QPixmap * s_unknownFilePixmap;
QString m_path;
fileTypes m_type;
FileTypes m_type;
} ;

150
include/graph.h Normal file
View File

@@ -0,0 +1,150 @@
/*
* graph.h - a QT widget for displaying and manipulating waveforms
*
* Copyright (c) 2006-2007 Andreas Brandmaier <andy/at/brandmaier/dot/de>
* 2008 Paul Giblock <drfaygo/at/gmail/dot/com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _GRAPH_H
#define _GRAPH_H
#include <QtGui/QWidget>
#include <QtGui/QPixmap>
#include <QtGui/QCursor>
#include "mv_base.h"
#include "types.h"
class graphModel;
class track;
class graph : public QWidget, public modelView
{
Q_OBJECT
public:
graph( QWidget * _parent );
virtual ~graph();
void setForeground( const QPixmap & _pixmap );
// void loadSampleFromFile( const QString & _filename );
virtual inline graphModel * model( void ) {
return castModel<graphModel>();
}
protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void dropEvent( QDropEvent * _de );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
protected slots:
void updateGraph( Uint32 _startPos, Uint32 _endPos );
void updateGraph( void );
private:
virtual void modelChanged( void );
void changeSampleAt(int _x, int _y);
QPixmap m_foreground;
graphModel * m_graphModel;
bool m_mouseDown;
int m_lastCursorX;
} ;
class graphModel : public model
{
Q_OBJECT
public:
graphModel( float _min,
float _max,
Uint32 _size,
:: model * _parent, track * _track = NULL,
bool _default_constructed = FALSE );
virtual ~graphModel();
// TODO: saveSettings, loadSettings?
inline float minValue( void ) const
{
return( m_minValue );
}
inline float maxValue( void ) const
{
return( m_maxValue );
}
inline Uint32 length( void ) const
{
return( m_samples.count() );
}
inline const float* samples( void ) const
{
return( m_samples.data() );
}
public slots:
void setRange( float _min, float _max );
void setLength( Uint32 _size );
void setSampleAt( Uint32 _samplePos, float _value );
void setSamples( const float * _value );
void setWaveToSine( void );
void setWaveToTriangle( void );
void setWaveToSaw( void );
void setWaveToSquare( void );
void setWaveToNoise( void );
//void setWaveToUser( );
void smooth( void );
void normalize( void );
signals:
void lengthChanged( void );
void samplesChanged( Uint32 startPos, Uint32 endPos );
void rangeChanged( void );
private:
QVector<float> m_samples;
float m_maxValue;
float m_minValue;
friend class graph;
};
#endif

View File

@@ -28,41 +28,26 @@
#include <QtGui/QWidget>
#include "automatable_model.h"
#include "pixmap_button.h"
class QPixmap;
class groupBox : public QWidget
class groupBox : public QWidget, public boolModelView
{
Q_OBJECT
public:
groupBox( const QString & _caption, QWidget * _parent, track * _track );
groupBox( const QString & _caption, QWidget * _parent );
virtual ~groupBox();
bool isActive( void ) const
{
return( m_led->isChecked() );
}
void saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name );
void loadSettings( const QDomElement & _this, const QString & _name );
public slots:
void setState( bool _on, bool _anim = FALSE );
void animate( void );
signals:
void toggled( bool _state );
virtual void modelChanged( void );
protected:
virtual void resizeEvent( QResizeEvent * _re );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void resizeEvent( QResizeEvent * _re );
private:
@@ -73,9 +58,10 @@ private:
pixmapButton * m_led;
QString m_caption;
int m_origHeight;
bool m_animating;
} ;
typedef groupBox::autoModel groupBoxModel;
#endif

View File

@@ -2,7 +2,7 @@
* instrument.h - declaration of class instrument, which provides a
* standard interface for all instrument plugins
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,9 +27,7 @@
#ifndef _INSTRUMENT_H
#define _INSTRUMENT_H
#include <QtGui/QWidget>
#include <QtCore/QVector>
#include "plugin.h"
#include "mixer.h"
@@ -37,19 +35,24 @@
// forward-declarations
class instrumentTrack;
class notePlayHandle;
class instrumentView;
class midiEvent;
class midiTime;
class notePlayHandle;
class track;
class instrument : public QWidget, public plugin
class instrument : public plugin
{
public:
instrument( instrumentTrack * _channel_track,
instrument( instrumentTrack * _instrument_track,
const descriptor * _descriptor );
virtual ~instrument();
// --------------------------------------------------------------------
// functions that can/should be re-implemented:
// --------------------------------------------------------------------
// if the plugin doesn't play each note, it can create an instrument-
// play-handle and re-implement this method, so that it mixes it's
// output buffer only once per mixer-period
@@ -101,10 +104,15 @@ public:
return( FALSE );
}
// --------------------------------------------------------------------
// provided functions:
// --------------------------------------------------------------------
// instantiate instrument-plugin with given name or return NULL
// on failure
static instrument * FASTCALL instantiate( const QString & _plugin_name,
instrumentTrack * _channel_track );
instrumentTrack * _instrument_track );
virtual bool isFromTrack( const track * _track ) const;
@@ -120,7 +128,6 @@ protected:
// desiredReleaseFrames() frames are left
void applyRelease( sampleFrame * buf, const notePlayHandle * _n );
private:
instrumentTrack * m_instrumentTrack;

View File

@@ -0,0 +1,91 @@
/*
* instrument_function_views.h - views for instrument-functions-tab
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_FUNCTION_VIEWS_H
#define _INSTRUMENT_FUNCTION_VIEWS_H
#include "mv_base.h"
class automatableButtonGroup;
class comboBox;
class groupBox;
class knob;
class tempoSyncKnob;
class arpeggiator;
class chordCreator;
class chordCreatorView : public QWidget, public modelView
{
public:
chordCreatorView( chordCreator * _cc, QWidget * _parent );
virtual ~chordCreatorView();
private:
virtual void modelChanged( void );
chordCreator * m_cc;
groupBox * m_chordsGroupBox;
comboBox * m_chordsComboBox;
knob * m_chordRangeKnob;
} ;
class arpeggiatorView : public QWidget, public modelView
{
public:
arpeggiatorView( arpeggiator * _arp, QWidget * _parent );
virtual ~arpeggiatorView();
private:
virtual void modelChanged( void );
arpeggiator * m_a;
groupBox * m_arpGroupBox;
comboBox * m_arpComboBox;
knob * m_arpRangeKnob;
tempoSyncKnob * m_arpTimeKnob;
knob * m_arpGateKnob;
QLabel * m_arpDirectionLbl;
automatableButtonGroup * m_arpDirectionBtnGrp;
comboBox * m_arpModeComboBox;
} ;
#endif

View File

@@ -0,0 +1,142 @@
/*
* instrument_functions.h - models for instrument-functions-tab
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_FUNCTIONS_H
#define _INSTRUMENT_FUNCTIONS_H
#include "journalling_object.h"
#include "types.h"
#include "automatable_model.h"
#include "tempo_sync_knob.h"
#include "combobox.h"
class instrumentTrack;
class notePlayHandle;
const int MAX_CHORD_POLYPHONY = 10;
class chordCreator : public model, public journallingObject
{
public:
chordCreator( instrumentTrack * _instrument_track );
virtual ~chordCreator();
void processNote( notePlayHandle * _n );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "chordcreator" );
}
static struct chord
{
const QString name;
Sint8 interval[MAX_CHORD_POLYPHONY];
} s_chordTable[];
static inline int getChordSize( chord & _c )
{
int idx = 0;
while( _c.interval[idx] != -1 )
{
++idx;
}
return( idx );
}
private:
boolModel m_chordsEnabledModel;
comboBoxModel m_chordsModel;
floatModel m_chordRangeModel;
friend class chordCreatorView;
} ;
class arpeggiator : public model, public journallingObject
{
public:
enum ArpDirections
{
ArpDirUp,
ArpDirDown,
ArpDirUpAndDown,
ArpDirRandom
} ;
arpeggiator( instrumentTrack * _instrument_track );
virtual ~arpeggiator();
void processNote( notePlayHandle * _n );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "arpeggiator" );
}
private:
enum ArpModes
{
FreeMode,
SortMode,
SyncMode
} ;
boolModel m_arpEnabledModel;
comboBoxModel m_arpModel;
floatModel m_arpRangeModel;
tempoSyncKnobModel m_arpTimeModel;
floatModel m_arpGateModel;
intModel m_arpDirectionModel;
comboBoxModel m_arpModeModel;
friend class flpImport;
friend class instrumentTrack;
friend class arpeggiatorView;
} ;
#endif

View File

@@ -0,0 +1,94 @@
/*
* instrument_midi_io.h - class instrumentMidiIO
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_MIDI_IO_H
#define _INSTRUMENT_MIDI_IO_H
#include <QtCore/QList>
#include "automatable_model.h"
class instrumentTrack;
class midiPort;
class instrumentMidiIO : public model, public journallingObject
{
Q_OBJECT
public:
typedef QPair<QString, bool> descriptiveMidiPort;
typedef QList<descriptiveMidiPort> midiPortMap;
instrumentMidiIO( instrumentTrack * _instrument_track,
midiPort * _port );
virtual ~instrumentMidiIO();
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual QString nodeName( void ) const
{
return( "midi" );
}
public slots:
void midiPortModeChanged( void );
protected slots:
void inputChannelChanged( void );
void outputChannelChanged( void );
void defaultVelInChanged( void );
void defaultVelOutChanged( void );
void readablePortsChanged( void );
void writeablePortsChanged( void );
void activatedReadablePort( const descriptiveMidiPort & _port );
void activatedWriteablePort( const descriptiveMidiPort & _port );
private:
instrumentTrack * m_instrumentTrack;
midiPort * m_midiPort;
intModel m_inputChannelModel;
intModel m_outputChannelModel;
boolModel m_receiveEnabledModel;
boolModel m_sendEnabledModel;
boolModel m_defaultVelocityInEnabledModel;
boolModel m_defaultVelocityOutEnabledModel;
midiPortMap m_readablePorts;
midiPortMap m_writeablePorts;
friend class instrumentMidiIOView;
} ;
#endif

View File

@@ -1,8 +1,8 @@
/*
* midi_tab_widget.h - tab-widget in channel-track-window for setting up
* MIDI-related stuff
* instrument_midi_io_view.h - tab-widget in instrument-track-window for setting
* up MIDI-related stuff
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -24,59 +24,37 @@
*/
#ifndef _MIDI_TAB_WIDGET_H
#define _MIDI_TAB_WIDGET_H
#ifndef _INSTRUMENT_MIDI_IO_VIEW_H
#define _INSTRUMENT_MIDI_IO_VIEW_H
#include <QtGui/QWidget>
#include "journalling_object.h"
#include "mv_base.h"
class QMenu;
class QPixmap;
class QAction;
class instrumentTrack;
class tabWidget;
class ledCheckBox;
class lcdSpinBox;
class midiPort;
class midiTabWidget : public QWidget, public journallingObject
class instrumentMidiIOView : public QWidget, public modelView
{
Q_OBJECT
public:
midiTabWidget( instrumentTrack * _channel_track, midiPort * _port );
virtual ~midiTabWidget();
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "midi" );
}
public slots:
void midiPortModeToggled( bool = FALSE );
instrumentMidiIOView( QWidget * _parent );
virtual ~instrumentMidiIOView();
protected slots:
void inputChannelChanged( int );
void outputChannelChanged( int );
void defaultVelInChanged( bool );
void defaultVelOutChanged( bool );
void readablePortsChanged( void );
void writeablePortsChanged( void );
void activatedReadablePort( QAction * _item );
void activatedWriteablePort( QAction * _item );
private:
instrumentTrack * m_instrumentTrack;
midiPort * m_midiPort;
virtual void modelChanged( void );
tabWidget * m_setupTabWidget;
lcdSpinBox * m_inputChannelSpinBox;
@@ -89,7 +67,8 @@ private:
QMenu * m_readablePorts;
QMenu * m_writeablePorts;
friend class instrumentTrack;
friend class instrumentTrackWindow;
} ;

View File

@@ -0,0 +1,89 @@
/*
* instrument_sound_shaping.h - class instrumentSoundShaping
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_SOUND_SHAPING_H
#define _INSTRUMENT_SOUND_SHAPING_H
#include "mixer.h"
#include "automatable_model.h"
#include "combobox.h"
class instrumentTrack;
class envelopeAndLFOParameters;
class notePlayHandle;
class instrumentSoundShaping : public model, public journallingObject
{
public:
instrumentSoundShaping( instrumentTrack * _instrument_track );
virtual ~instrumentSoundShaping();
void processAudioBuffer( sampleFrame * _ab, const fpp_t _frames,
notePlayHandle * _n );
enum Targets
{
Volume,
Cut,
Resonance,
NumTargets
} ;
f_cnt_t envFrames( const bool _only_vol = FALSE ) const;
f_cnt_t releaseFrames( const bool _only_vol = FALSE ) const;
float volumeLevel( notePlayHandle * _n, const f_cnt_t _frame );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "eldata" );
}
private:
envelopeAndLFOParameters * m_envLFOParameters[NumTargets];
instrumentTrack * m_instrumentTrack;
boolModel m_filterEnabledModel;
comboBoxModel m_filterModel;
floatModel m_filterCutModel;
floatModel m_filterResModel;
friend class instrumentSoundShapingView;
friend class flpImport;
} ;
extern const QString __targetNames[instrumentSoundShaping::NumTargets][2];
#endif

View File

@@ -0,0 +1,63 @@
/*
* instrument_sound_shaping_view.h - view for instrumentSoundShaping-class
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_SOUND_SHAPING_VIEW_H
#define _INSTRUMENT_SOUND_SHAPING_VIEW_H
#include <QtGui/QWidget>
#include "instrument_sound_shaping.h"
class envelopeAndLFOView;
class comboBox;
class groupBox;
class knob;
class tabWidget;
class instrumentSoundShapingView : public QWidget, public modelView
{
public:
instrumentSoundShapingView( QWidget * _parent );
virtual ~instrumentSoundShapingView();
private:
virtual void modelChanged( void );
instrumentSoundShaping * m_ss;
tabWidget * m_targetsTabWidget;
envelopeAndLFOView * m_envLFOViews[instrumentSoundShaping::NumTargets];
// filter-stuff
groupBox * m_filterGroupBox;
comboBox * m_filterComboBox;
knob * m_filterCutKnob;
knob * m_filterResKnob;
} ;
#endif

View File

@@ -2,7 +2,7 @@
* instrument_track.h - declaration of class instrumentTrack, a track + window
* which holds an instrument-plugin
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,61 +28,63 @@
#define _INSTRUMENT_TRACK_H
#include <QtGui/QPushButton>
#include <QtGui/QPainter>
#include "audio_port.h"
#include "automatable_model.h"
#include "instrument_functions.h"
#include "instrument_midi_io.h"
#include "instrument_sound_shaping.h"
#include "lcd_spinbox.h"
#include "midi_event_processor.h"
#include "mixer.h"
#include "piano.h"
#include "effect_chain.h"
#include "surround_area.h"
#include "tab_widget.h"
#include "track.h"
class QLineEdit;
class arpAndChordsTabWidget;
class audioPort;
class effectTabWidget;
class envelopeTabWidget;
class arpeggiatorView;
class chordCreatorView;
class effectRackView;
class instrumentSoundShapingView;
class fadeButton;
class instrument;
class instrumentMidiIOView;
class instrumentTrackButton;
class lcdSpinBox;
class instrumentTrackWindow;
class midiPort;
class midiTabWidget;
class notePlayHandle;
class pianoWidget;
class pluginView;
class presetPreviewPlayHandle;
class surroundArea;
class volumeKnob;
class instrumentTrack : public QWidget, public track, public midiEventProcessor
class instrumentTrack : public track, public midiEventProcessor
{
Q_OBJECT
mapPropertyFromModel(int,getVolume,setVolume,m_volumeModel);
public:
instrumentTrack( trackContainer * _tc );
virtual ~instrumentTrack();
inline virtual trackTypes type( void ) const
{
return( m_trackType );
}
// used by instrument
void FASTCALL processAudioBuffer( sampleFrame * _buf,
const fpp_t _frames,
void processAudioBuffer( sampleFrame * _buf, const fpp_t _frames,
notePlayHandle * _n );
virtual void FASTCALL processInEvent( const midiEvent & _me,
virtual void processInEvent( const midiEvent & _me,
const midiTime & _time );
virtual void FASTCALL processOutEvent( const midiEvent & _me,
virtual void processOutEvent( const midiEvent & _me,
const midiTime & _time );
f_cnt_t FASTCALL beatLen( notePlayHandle * _n ) const;
f_cnt_t beatLen( notePlayHandle * _n ) const;
// for capturing note-play-events -> need that for arpeggio,
// filter and so on
void FASTCALL playNote( notePlayHandle * _n, bool _try_parallelizing );
void playNote( notePlayHandle * _n, bool _try_parallelizing );
QString instrumentName( void ) const;
inline const instrument * getInstrument( void ) const
@@ -90,57 +92,167 @@ public:
return( m_instrument );
}
void FASTCALL deleteNotePluginData( notePlayHandle * _n );
void deleteNotePluginData( notePlayHandle * _n );
// name-stuff
inline const QString & name( void ) const
{
return( m_name );
}
void FASTCALL setName( const QString & _new_name );
virtual void setName( const QString & _new_name );
// volume & surround-position-stuff
void FASTCALL setVolume( volume _new_volume );
volume getVolume( void ) const;
void FASTCALL setSurroundAreaPos( const QPoint & _p );
void FASTCALL setBaseNote( Uint32 _new_note, bool _modified = TRUE );
inline tones baseTone( void ) const
{
return( m_baseTone );
}
inline octaves baseOctave( void ) const
{
return( m_baseOctave );
}
int FASTCALL masterKey( notePlayHandle * _n ) const;
int masterKey( notePlayHandle * _n ) const;
// play everything in given frame-range - creates note-play-handles
virtual bool FASTCALL play( const midiTime & _start,
const fpp_t _frames,
const f_cnt_t _frame_base,
virtual bool play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
// create new view for me
virtual trackView * createView( trackContainerView * _tcv );
// create new track-content-object = pattern
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual trackContentObject * createTCO( const midiTime & _pos );
// called by track
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
using track::setJournalling;
// load instrument whose name matches given one
instrument * FASTCALL loadInstrument( const QString &
_instrument_name );
instrument * loadInstrument( const QString & _instrument_name );
inline audioPort * getAudioPort( void )
{
return( &m_audioPort );
}
intModel * baseNoteModel( void )
{
return( &m_baseNoteModel );
}
piano * getPiano( void )
{
return( &m_piano );
}
bool arpeggiatorEnabled( void ) const
{
return( m_arpeggiator.m_arpEnabledModel.value() );
}
signals:
void instrumentChanged( void );
void newNote( void );
void noteDone( const note & _n );
void nameChanged( void );
protected:
virtual QString nodeName( void ) const
{
return( "instrumenttrack" );
}
// invalidates all note-play-handles linked to this instrument
void invalidateAllMyNPH( void );
protected slots:
void updateBaseNote( void );
private:
midiPort * m_midiPort;
audioPort m_audioPort;
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
intModel m_baseNoteModel;
QList<notePlayHandle *> m_processHandles;
floatModel m_volumeModel;
surroundAreaModel m_surroundAreaModel;
lcdSpinBoxModel m_effectChannelModel;
instrument * m_instrument;
instrumentSoundShaping m_soundShaping;
arpeggiator m_arpeggiator;
chordCreator m_chordCreator;
instrumentMidiIO m_midiIO;
piano m_piano;
friend class instrumentTrackView;
friend class instrumentTrackWindow;
friend class notePlayHandle;
friend class presetPreviewPlayHandle;
friend class flpImport;
} ;
class instrumentTrackView : public trackView
{
Q_OBJECT
public:
instrumentTrackView( instrumentTrack * _it, trackContainerView * _tc );
virtual ~instrumentTrackView();
instrumentTrackWindow * getInstrumentTrackWindow( void );
instrumentTrack * model( void )
{
return( castModel<instrumentTrack>() );
}
const instrumentTrack * model( void ) const
{
return( castModel<instrumentTrack>() );
}
private slots:
void toggledInstrumentTrackButton( bool _on );
void activityIndicatorPressed( void );
void activityIndicatorReleased( void );
void updateName( void );
private:
instrumentTrackWindow * m_window;
// widgets in track-settings-widget
volumeKnob * m_tswVolumeKnob;
fadeButton * m_tswActivityIndicator;
instrumentTrackButton * m_tswInstrumentTrackButton;
QMenu * m_tswMidiMenu;
friend class instrumentTrackButton;
friend class instrumentTrackWindow;
} ;
class instrumentTrackWindow : public QWidget, public modelView,
public journallingObjectHook
{
Q_OBJECT
public:
instrumentTrackWindow( instrumentTrackView * _tv );
virtual ~instrumentTrackWindow();
// parent for all internal tab-widgets
QWidget * tabWidgetParent( void )
@@ -148,25 +260,16 @@ public:
return( m_tabWidget );
}
pianoWidget * getPianoWidget( void )
{
return( m_pianoWidget );
}
inline audioPort * getAudioPort( void )
{
return( m_audioPort );
}
public slots:
void surroundAreaPosChanged( const QPoint & _new_p );
void textChanged( const QString & _new_name );
void toggledInstrumentTrackButton( bool _on );
void updateName( void );
void updateInstrumentView( void );
signals:
void noteDone( const note & _n );
void midiInSelected( void );
void midiOutSelected( void );
void midiConfigChanged( bool );
protected:
@@ -176,41 +279,21 @@ protected:
virtual void dropEvent( QDropEvent * _de );
virtual void focusInEvent( QFocusEvent * _fe );
inline virtual QString nodeName( void ) const
{
return( "instrumenttrack" );
}
// invalidates all note-play-handles linked to this instrument
void invalidateAllMyNPH( void );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
virtual void loadSettings( const QDomElement & _this );
protected slots:
void saveSettingsBtnClicked( void );
void activityIndicatorPressed( void );
void activityIndicatorReleased( void );
void midiInSelected( void );
void midiOutSelected( void );
void midiConfigChanged( bool );
private:
trackTypes m_trackType;
virtual void modelChanged( void );
midiPort * m_midiPort;
instrumentTrack * m_track;
instrumentTrackView * m_itv;
audioPort * m_audioPort;
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
tones m_baseTone;
octaves m_baseOctave;
QList<notePlayHandle *> m_processHandles;
// widgets on the top of a instrument-track-window
// widgets on the top of an instrument-track-window
tabWidget * m_generalSettingsWidget;
QLineEdit * m_instrumentNameLE;
volumeKnob * m_volumeKnob;
@@ -218,36 +301,24 @@ private:
lcdSpinBox * m_effectChannelNumber;
QPushButton * m_saveSettingsBtn;
// tab-widget with all children
tabWidget * m_tabWidget;
instrument * m_instrument;
envelopeTabWidget * m_envWidget;
arpAndChordsTabWidget * m_arpWidget;
midiTabWidget * m_midiWidget;
effectTabWidget * m_effWidget;
pluginView * m_instrumentView;
instrumentSoundShapingView * m_ssView;
chordCreatorView * m_chordView;
arpeggiatorView * m_arpView;
instrumentMidiIOView * m_midiView;
effectRackView * m_effectView;
// test-piano at the bottom of every instrument-settings-window
pianoWidget * m_pianoWidget;
pianoView * m_pianoView;
// widgets in track-settings-widget
volumeKnob * m_tswVolumeKnob;
fadeButton * m_tswActivityIndicator;
instrumentTrackButton * m_tswInstrumentTrackButton;
QMenu * m_tswMidiMenu;
QAction * m_midiInputAction;
QAction * m_midiOutputAction;
friend class instrumentTrackButton;
friend class notePlayHandle;
friend class presetPreviewPlayHandle;
friend class flpImport;
// base-tone stuff
void FASTCALL setBaseTone( tones _new_tone );
void FASTCALL setBaseOctave( octaves _new_octave );
friend class instrumentView;
} ;
@@ -257,14 +328,14 @@ private:
class instrumentTrackButton : public QPushButton
{
public:
instrumentTrackButton( instrumentTrack * _instrument_track );
instrumentTrackButton( instrumentTrackView * _instrument_track_view );
virtual ~instrumentTrackButton();
protected:
// since we want to draw a special label (instrument- and instrument-
// name) on our button, we have to re-implement this for doing so
virtual void drawButtonLabel( QPainter * _p );
virtual void paintEvent( QPaintEvent * _pe );
// allow drops on this button - we simply forward them to
// instrument-track
@@ -273,7 +344,7 @@ protected:
private:
instrumentTrack * m_instrumentTrack;
instrumentTrackView * m_instrumentTrackView;
} ;

58
include/instrument_view.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* instrument_view.h - definition of instrumentView-class
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_VIEW_H
#define _INSTRUMENT_VIEW_H
#include "instrument.h"
#include "plugin_view.h"
class instrumentTrackWindow;
class instrumentView : public pluginView
{
public:
instrumentView( instrument * _instrument, QWidget * _parent );
virtual ~instrumentView();
instrument * model( void )
{
return( castModel<instrument>() );
}
const instrument * model( void ) const
{
return( castModel<instrument>() );
}
virtual void setModel( ::model * _model, bool = FALSE );
instrumentTrackWindow * getInstrumentTrackWindow( void );
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* journalling_object.h - declaration of class journallingObject
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -37,15 +37,15 @@
#include <QtCore/QStack>
class QDomDocument;
class QDomElement;
typedef Uint32 t_action_id;
typedef uint32_t t_action_id;
class journallingObject;
class journallingObjectHook;
class journalEntry
@@ -98,14 +98,13 @@ private:
typedef QVector<journalEntry> journalEntryVector;
class journallingObject
{
public:
journallingObject( void );
virtual ~journallingObject();
inline const jo_id_t id( void ) const
inline jo_id_t id( void ) const
{
return( m_id );
}
@@ -138,19 +137,15 @@ public:
m_journalling = m_journallingStateStack.pop();
}
virtual QDomElement FASTCALL saveState( QDomDocument & _doc,
virtual QDomElement saveState( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL restoreState( const QDomElement & _this );
virtual void restoreState( const QDomElement & _this );
// to be implemented by actual object
virtual QString nodeName( void ) const = 0;
protected:
void addJournalEntry( const journalEntry & _je );
inline bool isJournalling( void ) const
{
return( m_journalling );
@@ -168,14 +163,23 @@ protected:
return( old_journalling );
}
void setHook( journallingObjectHook * _hook );
journallingObjectHook * getHook( void )
{
return( m_hook );
}
protected:
void addJournalEntry( const journalEntry & _je );
// to be implemented by sub-objects
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this )
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this )
{
}
virtual void FASTCALL loadSettings( const QDomElement & _this )
virtual void loadSettings( const QDomElement & _this )
{
}
@@ -201,9 +205,36 @@ private:
QStack<bool> m_journallingStateStack;
journallingObjectHook * m_hook;
} ;
class journallingObjectHook
{
public:
journallingObjectHook() :
m_hookedIn( NULL )
{
}
virtual ~journallingObjectHook()
{
if( m_hookedIn != NULL )
{
m_hookedIn->setHook( NULL );
}
}
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this ) = 0;
virtual void loadSettings( const QDomElement & _this ) = 0;
private:
journallingObject * m_hookedIn;
friend class journallingObject;
} ;
#endif

View File

@@ -32,7 +32,8 @@
#include <QtGui/QWidget>
#include <QtCore/QPoint>
#include "automatable_object.h"
#include "automatable_model.h"
#include "templates.h"
class QPixmap;
@@ -46,32 +47,20 @@ enum knobTypes
class knob : public QWidget, public automatableObject<float>
class knob : public QWidget, public floatModelView
{
Q_OBJECT
public:
knob( int _knob_num, QWidget * _parent, const QString & _name,
track * _track );
knob( int _knob_num, QWidget * _parent, const QString & _name );
virtual ~knob();
void setHintText( const QString & _txt_before,
const QString & _txt_after );
void setLabel( const QString & _txt );
void setTotalAngle( float _angle );
inline virtual void setInitValue( const float _val )
{
m_initValue = _val;
autoObj::setInitValue( _val );
}
virtual void setValue( const float _x );
virtual void setRange( const float _min, const float _max,
const float _step = 0.0 );
public slots:
void reset( void );
@@ -83,8 +72,8 @@ public slots:
signals:
void valueChanged( float value );
void valueChanged( void );
// void valueChanged( float value );
// void valueChanged( void );
void sliderPressed( void );
void sliderReleased( void );
void sliderMoved( float value );
@@ -102,8 +91,6 @@ protected:
QString m_hintTextBeforeValue;
QString m_hintTextAfterValue;
float m_initValue;
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
@@ -112,7 +99,6 @@ protected:
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _me );
virtual void resizeEvent( QResizeEvent * _me );
virtual void wheelEvent( QWheelEvent * _me );
void drawKnob( QPainter * _p );
@@ -122,16 +108,16 @@ protected:
private:
void layoutKnob( bool _update = TRUE );
void recalcAngle( void );
void valueChange( void );
void rangeChange( void );
inline float pageSize( void ) const
{
return( tMax<float>( ( model()->maxValue() -
model()->minValue() ) / 100.0f,
model()->step() ) );
}
void valueChange( void );
void buttonReleased( void );
float m_pageSize;
float m_angle;
float m_totalAngle;
int m_knobNum;
@@ -139,4 +125,7 @@ private:
} ;
typedef knob::autoModel knobModel;
#endif

View File

@@ -1,7 +1,7 @@
/*
* ladspa_control.h - widget for controlling a LADSPA port
* ladspa_control.h - model for controlling a LADSPA port
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -25,9 +25,6 @@
#ifndef _LADSPA_CONTROL_H
#define _LADSPA_CONTROL_H
#include <QtGui/QWidget>
#include <QtGui/QLayout>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -39,42 +36,41 @@
#endif
#include "journalling_object.h"
#include "automatable_model.h"
#include "knob.h"
class knob;
class ledCheckBox;
class track;
typedef struct portDescription port_desc_t;
class ladspaControl : public QWidget, public journallingObject
class ladspaControl : public model, public journallingObject
{
Q_OBJECT
public:
ladspaControl( QWidget * _parent, port_desc_t * _port, track * _track,
ladspaControl( model * _parent, port_desc_t * _port, track * _track,
bool _link = FALSE );
~ladspaControl();
LADSPA_Data getValue( void );
void FASTCALL setValue( LADSPA_Data _value );
void FASTCALL setLink( bool _state );
void FASTCALL linkControls( ladspaControl * _control );
void FASTCALL unlinkControls( ladspaControl * _control );
inline ledCheckBox * getToggle( void )
inline boolModel * getToggledModel( void )
{
return( m_toggle );
return( &m_toggledModel );
}
inline knob * getKnob( void )
inline knobModel * getKnobModel( void )
{
return( m_knob );
return( &m_knobModel );
}
inline port_desc_t * getPort( void )
{
return( m_port );
@@ -89,22 +85,29 @@ public:
return( "port" );
}
signals:
void changed( Uint16 _port, LADSPA_Data _value );
void linkChanged( Uint16 _port, bool _state );
protected slots:
void ledChange( bool _state );
void knobChange( float _value );
void portLink( bool _state );
void ledChanged( void );
void knobChanged( void );
void linkStateChanged( void );
private:
bool m_link;
port_desc_t * m_port;
track * m_track;
QHBoxLayout * m_layout;
ledCheckBox * m_link;
ledCheckBox * m_toggle;
knob * m_knob;
};
boolModel m_linkEnabledModel;
boolModel m_toggledModel;
knobModel m_knobModel;
friend class ladspaControlView;
} ;
#endif

View File

@@ -0,0 +1,47 @@
/*
* ladspa_control_view.h - widget for controlling a LADSPA port
*
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _LADSPA_CONTROL_VIEW_H
#define _LADSPA_CONTROL_VIEW_H
#include <QtGui/QWidget>
#include "mv_base.h"
class ladspaControl;
class ladspaControlView : public QWidget, public modelView
{
public:
ladspaControlView( QWidget * _parent, ladspaControl * _ctl );
virtual ~ladspaControlView();
private:
ladspaControl * m_ctl;
} ;
#endif

View File

@@ -29,33 +29,38 @@
#include <QtCore/QMap>
#include <QtGui/QLCDNumber>
#include "automatable_object.h"
#include "automatable_model.h"
class QLabel;
class lcdSpinBox : public QWidget, public automatableObject<int>
class lcdSpinBox : public QWidget, public automatableModelView<int>
{
Q_OBJECT
public:
lcdSpinBox( int _min, int _max, int _num_digits, QWidget * _parent,
const QString & _name, track * _track );
lcdSpinBox( int _num_digits, QWidget * _parent, const QString & _name =
QString::null );
virtual ~lcdSpinBox();
virtual void setStep( const int _step );
void setLabel( const QString & _txt );
inline void addTextForValue( int _val, const QString & _text )
{
m_textForValue[_val] = _text;
update();
}
virtual void modelChanged( void )
{
modelView::modelChanged();
update();
}
public slots:
virtual void setValue( const int _value );
virtual void setEnabled( bool _on );
virtual void update( void );
protected:
@@ -76,9 +81,10 @@ private:
signals:
void valueChanged( int );
void manualChange( void );
} ;
typedef lcdSpinBox::autoModel lcdSpinBoxModel;
#endif

View File

@@ -42,8 +42,8 @@ public:
} ;
ledCheckBox( const QString & _txt, QWidget * _parent,
const QString & _name, track * _track,
ledColors _color = YELLOW );
const QString & _name = QString::null,
ledColors _color = YELLOW );
virtual ~ledCheckBox();

View File

@@ -37,7 +37,7 @@ class QMdiArea;
class QSplashScreen;
class configManager;
class tool;
class pluginView;
class toolButton;
@@ -58,7 +58,7 @@ public:
int addWidgetToToolBar( QWidget * _w, int _row = -1, int _col = -1 );
void addSpacingToToolBar( int _size );
void resetWindowTitle( bool _modified = FALSE );
void resetWindowTitle( void );
// every function that replaces current file (e.g. creates new file,
@@ -155,10 +155,8 @@ private:
bool m_alt;
} m_keyMods;
QMenu * m_tools_menu;
QList<tool *> m_tools;
bool m_modified;
QMenu * m_toolsMenu;
QList<pluginView *> m_tools;
friend class engine;

View File

@@ -1,7 +1,7 @@
/*
* meter_dialog.h - dialog for entering meter settings
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/yahoo.com>
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/yahoo.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -30,12 +30,12 @@
#include "lcd_spinbox.h"
class meterDialog : public QWidget
class meterModel : public model
{
Q_OBJECT
public:
meterDialog( QWidget * _parent, track * _track );
~meterDialog();
meterModel( ::model * _parent, track * _track );
~meterModel();
void saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name );
@@ -44,21 +44,43 @@ public:
inline int getNumerator( void )
{
return( m_numerator->value() );
return( m_numeratorModel.value() );
}
inline int getDenominator( void )
{
return( m_denominator->value() );
return( m_denominatorModel.value() );
}
private:
lcdSpinBoxModel m_numeratorModel;
lcdSpinBoxModel m_denominatorModel;
signals:
void numeratorChanged( void );
void denominatorChanged( void );
friend class meterDialog;
} ;
class meterDialog : public QWidget, public modelView
{
public:
meterDialog( QWidget * _parent );
~meterDialog();
virtual void modelChanged( void );
private:
lcdSpinBox * m_numerator;
lcdSpinBox * m_denominator;
signals:
void numeratorChanged( int );
void denominatorChanged( int );
};
} ;
#endif

View File

@@ -31,6 +31,7 @@
#endif
#include <QtCore/QMutex>
#include <QtCore/QSemaphore>
#include <QtCore/QThread>
#include <QtCore/QVector>
@@ -91,6 +92,8 @@ const tones BASE_TONE = A;
const octaves BASE_OCTAVE = OCTAVE_4;
class mixerWorkerThread;
class mixer : public QObject
{
@@ -361,7 +364,11 @@ private:
bool m_newBuffer[SURROUND_CHANNELS];
Uint8 m_cpuLoad;
int m_parallelizingLevel;
bool m_multiThreaded;
QVector<mixerWorkerThread *> m_workers;
int m_numWorkers;
QSemaphore m_workerSem;
playHandleVector m_playHandles;
constPlayHandleVector m_playHandlesToRemove;
@@ -389,6 +396,7 @@ private:
friend class engine;
friend class mixerWorkerThread;
} ;

View File

@@ -1,7 +1,7 @@
/*
* mmp.h - class for reading and writing multimedia-project-files
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -34,27 +34,27 @@
class multimediaProject : public QDomDocument
{
public:
enum projectTypes
enum ProjectTypes
{
UNKNOWN,
SONG_PROJECT,
SONG_PROJECT_TEMPLATE,
INSTRUMENT_TRACK_SETTINGS,
DRAG_N_DROP_DATA,
CLIPBOARD_DATA,
JOURNAL_DATA,
EFFECT_SETTINGS,
VIDEO_PROJECT, // might come later...
BURN_PROJECT, // might come later...
PLAYLIST, // might come later...
PROJ_TYPE_COUNT
UnknownType,
SongProject,
SongProjectTemplate,
InstrumentTrackSettings,
DragNDropData,
ClipboardData,
JournalData,
EffectSettings,
VideoProject, // might come later...
BurnProject, // might come later...
Playlist, // might come later...
NumProjectTypes
} ;
multimediaProject( const QString & _in_file_name,
bool _is_filename = TRUE,
bool _upgrade = TRUE );
multimediaProject( projectTypes _project_type );
multimediaProject( ProjectTypes _project_type );
~multimediaProject();
QString nameWithExtension( const QString & _fn ) const;
@@ -70,17 +70,17 @@ public:
return( m_head );
}
inline projectTypes type( void ) const
inline ProjectTypes type( void ) const
{
return( m_type );
}
static projectTypes typeOfFile( const QString & _fn );
static ProjectTypes typeOfFile( const QString & _fn );
private:
static projectTypes type( const QString & _type_name );
static QString typeName( projectTypes _project_type );
static ProjectTypes type( const QString & _type_name );
static QString typeName( ProjectTypes _project_type );
void cleanMetaNodes( QDomElement _de );
@@ -89,14 +89,14 @@ private:
struct typeDescStruct
{
projectTypes m_type;
ProjectTypes m_type;
QString m_name;
} ;
static typeDescStruct s_types[PROJ_TYPE_COUNT];
static typeDescStruct s_types[NumProjectTypes];
QDomElement m_content;
QDomElement m_head;
projectTypes m_type;
ProjectTypes m_type;
} ;

113
include/mv_base.h Normal file
View File

@@ -0,0 +1,113 @@
/*
* mv_base.h - base for M/V-architecture of LMMS
*
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _MV_BASE_H
#define _MV_BASE_H
#include <QtCore/QObject>
class modelView;
class model : public QObject
{
Q_OBJECT
public:
model( model * _parent, bool _default_constructed = FALSE ) :
QObject( _parent ),
m_defaultConstructed( _default_constructed )
{
}
virtual ~model()
{
}
inline bool defaultConstructed( void )
{
return( m_defaultConstructed );
}
private:
bool m_defaultConstructed;
signals:
// emitted if actual data of the model (e.g. values) have changed
void dataChanged( void );
// emitted in case new data was not set as it's been equal to old data
void dataUnchanged( void );
// emitted if properties of the model (e.g. ranges) have changed
void propertiesChanged( void );
} ;
class modelView
{
public:
modelView( model * _model ) :
m_model( _model )
{
}
virtual ~modelView()
{
}
virtual void setModel( model * _model, bool _old_model_valid = TRUE );
template<class T>
T * castModel( void )
{
return( dynamic_cast<T *>( m_model ) );
}
template<class T>
const T * castModel( void ) const
{
return( dynamic_cast<T *>( m_model ) );
}
protected:
// sub-classes can re-implement this to track model-changes
virtual void modelChanged( void )
{
}
private:
model * m_model;
} ;
#endif

View File

@@ -2,7 +2,7 @@
* name_label.h - class nameLabel, a label which is renamable by
* double-clicking it
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -58,7 +58,6 @@ public slots:
signals:
void clicked( void );
void nameChanged( void );
void nameChanged( const QString & _new_name );
void pixmapChanged( void );

View File

@@ -1,7 +1,7 @@
/*
* oscillator.h - header-file for oscillator.cpp, a powerful oscillator-class
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -38,40 +38,49 @@
#include "sample_buffer.h"
#include "lmms_constants.h"
#include "lmms_math.h"
#include "automatable_model.h"
class oscillator
{
public:
enum waveShapes
enum WaveShapes
{
SIN_WAVE,
TRIANGLE_WAVE,
SAW_WAVE,
SQUARE_WAVE,
MOOG_SAW_WAVE,
EXP_WAVE,
WHITE_NOISE_WAVE,
USER_DEF_WAVE
SineWave,
TriangleWave,
SawWave,
SquareWave,
MoogSawWave,
ExponentialWave,
WhiteNoise,
UserDefinedWave,
NumWaveShapes
} ;
enum modulationAlgos
enum ModulationAlgos
{
PHASE_MODULATION, AMP_MODULATION, MIX, SYNC, FREQ_MODULATION
PhaseModulation,
AmplitudeModulation,
SignalMix,
SynchronizedBySubOsc,
FrequencyModulation,
NumModulationAlgos,
} ;
oscillator( const waveShapes & _wave_shape,
const modulationAlgos & _modulation_algo,
oscillator( const intModel & _wave_shape_model,
const intModel & _mod_algo_model,
const float & _freq,
const float & _detuning,
const float & _phase_offset,
const float & _volume,
oscillator * _m_subOsc = NULL ) FASTCALL;
oscillator * _m_subOsc = NULL );
virtual ~oscillator()
{
delete m_subOsc;
}
inline void setUserWave( const sampleBuffer * _wave )
{
m_userWave = _wave;
@@ -80,13 +89,6 @@ public:
void update( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
/*#define FLOAT_TO_INT(in,out) \
register const float round_const = -0.5f; \
__asm__ __volatile__ ("fadd %%st,%%st(0)\n" \
"fadd %2\n" \
"fistpl %0\n" \
"shrl $1,%0" : "=m" (out) : "t" (in),"m"(round_const) : "st") ;*/
// now follow the wave-shape-routines...
static inline sample_t sinSample( const float _sample )
@@ -154,8 +156,8 @@ public:
private:
const waveShapes & m_waveShape;
const modulationAlgos & m_modulationAlgo;
const intModel & m_waveShapeModel;
const intModel & m_modulationAlgoModel;
const float & m_freq;
const float & m_detuning;
const float & m_volume;
@@ -183,26 +185,26 @@ private:
const ch_cnt_t _chnl );
inline bool syncOk( float _osc_coeff );
template<waveShapes W>
template<WaveShapes W>
void updateNoSub( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<waveShapes W>
template<WaveShapes W>
void updatePM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<waveShapes W>
template<WaveShapes W>
void updateAM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<waveShapes W>
template<WaveShapes W>
void updateMix( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<waveShapes W>
template<WaveShapes W>
void updateSync( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<waveShapes W>
template<WaveShapes W>
void updateFM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<waveShapes W>
template<WaveShapes W>
inline sample_t getSample( const float _sample );
inline void FASTCALL recalcPhase( void );

View File

@@ -2,7 +2,7 @@
* pattern.h - declaration of class pattern, which contains all informations
* about a pattern
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -56,12 +56,13 @@ class pattern : public trackContentObject
{
Q_OBJECT
public:
enum patternTypes
enum PatternTypes
{
BEAT_PATTERN, MELODY_PATTERN/*, AUTOMATION_PATTERN*/
BeatPattern,
MelodyPattern
} ;
pattern( instrumentTrack * _channel_track );
pattern( instrumentTrack * _instrument_track );
pattern( const pattern & _pat_to_copy );
virtual ~pattern();
@@ -70,13 +71,12 @@ public:
virtual midiTime length( void ) const;
note * FASTCALL addNote( const note & _new_note,
const bool _quant_pos = TRUE );
note * addNote( const note & _new_note, const bool _quant_pos = TRUE );
void FASTCALL removeNote( const note * _note_to_del );
void removeNote( const note * _note_to_del );
note * FASTCALL rearrangeNote( const note * _note_to_proc,
const bool _quant_pos = TRUE );
note * rearrangeNote( const note * _note_to_proc,
const bool _quant_pos = TRUE );
void clearNotes( void );
@@ -86,11 +86,11 @@ public:
}
// pattern-type stuff
inline patternTypes type( void ) const
inline PatternTypes type( void ) const
{
return( m_patternType );
}
void FASTCALL setType( patternTypes _new_pattern_type );
void setType( PatternTypes _new_pattern_type );
void checkType( void );
@@ -103,7 +103,7 @@ public:
inline void setName( const QString & _name )
{
m_name = _name;
update();
emit dataChanged();
}
@@ -124,9 +124,8 @@ public:
}
// settings-management
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "pattern" );
@@ -140,57 +139,32 @@ public:
bool empty( void );
public slots:
virtual void update( void );
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 abortFreeze( void );
void addSteps( QAction * _item );
void removeSteps( QAction * _item );
void addSteps( int _n );
void removeSteps( int _n );
virtual trackContentObjectView * createView( trackView * _tv );
using model::dataChanged;
protected:
virtual void constructContextMenu( QMenu * );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = TRUE;
trackContentObject::resizeEvent( _re );
}
virtual void wheelEvent( QWheelEvent * _we );
void ensureBeatNotes( void );
void updateBBTrack( void );
void abortFreeze( void );
protected slots:
void clear( void );
void freeze( void );
void unfreeze( void );
private:
static QPixmap * s_stepBtnOn;
static QPixmap * s_stepBtnOverlay;
static QPixmap * s_stepBtnOff;
static QPixmap * s_stepBtnOffLight;
static QPixmap * s_frozen;
QPixmap m_paintPixmap;
bool m_needsUpdate;
// general stuff
instrumentTrack * m_instrumentTrack;
patternTypes m_patternType;
PatternTypes m_patternType;
QString m_name;
// data-stuff
@@ -203,25 +177,77 @@ private:
volatile bool m_freezeAborted;
// as in Qt4 QThread is inherits from QObject and our base
// trackContentObject is a QWidget (=QObject), we cannot inherit from
// QThread. That's why we have to put pattern-freezing into separate
// thread-class -> patternFreezeThread
friend class patternView;
friend class patternFreezeThread;
} ;
class patternView : public trackContentObjectView
{
Q_OBJECT
public:
patternView( pattern * _pattern, trackView * _parent );
virtual ~patternView();
public slots:
virtual void update( void );
protected slots:
void openInPianoRoll( bool _c );
void openInPianoRoll( void );
void resetName( void );
void changeName( void );
void addSteps( QAction * _item );
void removeSteps( QAction * _item );
protected:
virtual void constructContextMenu( QMenu * );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = TRUE;
trackContentObjectView::resizeEvent( _re );
}
virtual void wheelEvent( QWheelEvent * _we );
private:
static QPixmap * s_stepBtnOn;
static QPixmap * s_stepBtnOverlay;
static QPixmap * s_stepBtnOff;
static QPixmap * s_stepBtnOffLight;
static QPixmap * s_frozen;
pattern * m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;
} ;
// TODO: move to own header-files
//
class patternFreezeStatusDialog : public QDialog
{
Q_OBJECT
public:
patternFreezeStatusDialog( QThread * _thread );
~patternFreezeStatusDialog();
virtual ~patternFreezeStatusDialog();
void FASTCALL setProgress( int _p );
void setProgress( int _p );
protected:

View File

@@ -1,8 +1,7 @@
/*
* piano_widget.h - declaration of class pianoWidget, a widget which provides
* an interactive piano/keyboard-widget
* piano.h - piano and pianoView, an interactive piano/keyboard-widget
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -24,8 +23,8 @@
*/
#ifndef _PIANO_WIDGET_H
#define _PIANO_WIDGET_H
#ifndef _PIANO_H
#define _PIANO_H
#include <QtGui/QWidget>
#include <QtGui/QPixmap>
@@ -33,43 +32,58 @@
#include "note.h"
#include "automatable_model.h"
class instrumentTrack;
class knob;
class instrumentTrackView;
class notePlayHandle;
enum keyTypes
enum KeyTypes
{
WHITE_KEY,
BLACK_KEY
WhiteKey,
BlackKey
} ;
class pianoWidget : public QWidget
class piano : public model
{
public:
piano( instrumentTrack * _it );
virtual ~piano();
void setKeyState( int _key, bool _on = FALSE );
static int getKeyFromKeycode( int _kc );
private:
instrumentTrack * m_instrumentTrack;
bool m_pressedKeys[NOTES_PER_OCTAVE * OCTAVES];
friend class pianoView;
} ;
class pianoView : public QWidget, public modelView
{
Q_OBJECT
public:
pianoWidget( instrumentTrack * _channel_track );
virtual ~pianoWidget();
pianoView( QWidget * _parent );
virtual ~pianoView();
void setKeyState( int _key, bool _on = FALSE );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name );
virtual void loadSettings( const QDomElement & _this,
const QString & _name );
protected:
virtual void modelChanged( void );
virtual void keyPressEvent( QKeyEvent * ke );
virtual void keyReleaseEvent( QKeyEvent * ke );
#ifndef BUILD_WIN32
virtual bool x11Event( XEvent * _xe );
#endif
protected:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void customEvent( QEvent * );
virtual void paintEvent( QPaintEvent * );
virtual void mousePressEvent( QMouseEvent * me );
virtual void mouseReleaseEvent( QMouseEvent * me );
@@ -78,31 +92,26 @@ protected:
private:
int FASTCALL getKeyFromMouse( const QPoint & _p ) const;
int FASTCALL getKeyFromKeyboard( int _k ) const;
int FASTCALL getKeyX( int _key_num ) const;
int getKeyFromMouse( const QPoint & _p ) const;
int getKeyX( int _key_num ) const;
static QPixmap * s_whiteKeyPm;
static QPixmap * s_blackKeyPm;
static QPixmap * s_whiteKeyPressedPm;
static QPixmap * s_blackKeyPressedPm;
bool m_pressedKeys[NOTES_PER_OCTAVE * OCTAVES];
piano * m_piano;
QScrollBar * m_pianoScroll;
instrumentTrack * m_instrumentTrack;
tones m_startTone; // first key when drawing
octaves m_startOctave;
int m_lastKey;
unsigned int m_keycode;
knob * m_noteKnob;
unsigned int m_keyCode;
private slots:
void pianoScrolled( int _new_pos );
void updateBaseNote( void );
} ;

View File

@@ -39,6 +39,7 @@ class QPixmap;
class QScrollBar;
class comboBox;
class comboBoxModel;
class notePlayHandle;
class pattern;
class timeLine;
@@ -125,7 +126,7 @@ protected slots:
void updatePosition( const midiTime & _t );
void zoomingChanged( const QString & _zfac );
void zoomingChanged( void );
private:
@@ -196,6 +197,11 @@ private:
comboBox * m_quantizeComboBox;
comboBox * m_noteLenComboBox;
comboBoxModel * m_zoomingModel;
comboBoxModel * m_quantizeModel;
comboBoxModel * m_noteLenModel;
pattern * m_pattern;
QScrollBar * m_leftRightScroll;

View File

@@ -35,8 +35,7 @@ class pixmapButton : public automatableButton
{
Q_OBJECT
public:
pixmapButton( QWidget * _parent, const QString & _name,
track * _track );
pixmapButton( QWidget * _parent, const QString & _name );
virtual ~pixmapButton();
void setActiveGraphic( const QPixmap & _pm );

View File

@@ -1,7 +1,7 @@
/*
* plugin.h - class plugin, the base-class and generic interface for all plugins
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -32,6 +32,7 @@
#include <QtCore/QVector>
#include "journalling_object.h"
#include "mv_base.h"
#include "base64.h"
@@ -42,11 +43,13 @@
class QPixmap;
class QWidget;
class pluginView;
class plugin : public journallingObject
class plugin : public journallingObject, public model
{
public:
enum pluginTypes
enum PluginTypes
{
Instrument, // instrument being used in channel-track
Effect, // effect-plugin for effect-board
@@ -69,7 +72,7 @@ public:
const char * description;
const char * author;
int version;
pluginTypes type;
PluginTypes type;
const QPixmap * logo;
class subPluginFeatures
{
@@ -91,7 +94,8 @@ public:
desc( NULL )
{
const QList<QVariant> l =
base64::decode( _dump_data, QVariant::List ).
base64::decode( _dump_data,
QVariant::List ).
toList();
if( l.empty() )
{
@@ -116,7 +120,7 @@ public:
};
typedef QList<key> keyList;
subPluginFeatures( plugin::pluginTypes _type ) :
subPluginFeatures( plugin::PluginTypes _type ) :
m_type( _type )
{
}
@@ -142,14 +146,14 @@ public:
protected:
const plugin::pluginTypes m_type;
const plugin::PluginTypes m_type;
}
* sub_plugin_features;
} ;
// contructor of a plugin
plugin( const descriptor * _descriptor );
plugin( const descriptor * _descriptor, model * _parent );
virtual ~plugin();
// returns public-name out of descriptor
@@ -159,7 +163,7 @@ public:
}
// return plugin-type
inline pluginTypes type( void ) const
inline PluginTypes type( void ) const
{
return( m_descriptor->type );
}
@@ -183,6 +187,7 @@ public:
// returns an instance of a plugin whose name matches to given one
// if specified plugin couldn't be loaded, it creates a dummy-plugin
static plugin * FASTCALL instantiate( const QString & _plugin_name,
model * _parent,
void * _data );
// some plugins run external programs for doing their actual work
@@ -193,21 +198,29 @@ public:
// of course isn't that efficient
virtual bool supportsParallelizing( void ) const;
// plugins supporting parallelizing, should re-implement that as the
// plugins supporting parallelization, should re-implement that as the
// mixer will call this at the end of processing according chain
// of plugins
virtual void waitForWorkerThread( void );
// fills given vector with descriptors of all available plugins
static void FASTCALL getDescriptorsOfAvailPlugins(
QVector<descriptor> & _plugin_descs );
// create a view for the model
pluginView * createView( QWidget * _parent );
protected:
// create a view for the model
virtual pluginView * instantiateView( QWidget * ) = 0;
private:
const descriptor * m_descriptor;
// pointer to instantiation-function in plugin
typedef plugin * ( * instantiationHook )( void * );
typedef plugin * ( * instantiationHook )( model *, void * );
} ;

46
include/plugin_view.h Normal file
View File

@@ -0,0 +1,46 @@
/*
* plugin_view.h - definition of pluginView-class
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _PLUGIN_VIEW_H
#define _PLUGIN_VIEW_H
#include <QtGui/QWidget>
#include "plugin.h"
class pluginView : public QWidget, public modelView
{
public:
pluginView( plugin * _plugin, QWidget * _parent ) :
QWidget( _parent ),
modelView( _plugin )
{
}
} ;
#endif

View File

@@ -30,6 +30,7 @@
#include "play_handle.h"
#include "sample_buffer.h"
#include "automatable_model.h"
class bbTrack;
class pattern;
@@ -38,9 +39,8 @@ class track;
class audioPort;
class samplePlayHandle : public QObject, public playHandle
class samplePlayHandle : public playHandle
{
Q_OBJECT
public:
samplePlayHandle( const QString & _sample_file );
samplePlayHandle( sampleBuffer * _sample_buffer );
@@ -68,9 +68,10 @@ public:
m_bbTrack = _bb_track;
}
public slots:
void setVolume( float _new_volume );
void setVolumeModel( floatModel * _model )
{
m_volumeModel = _model;
}
private:
@@ -83,7 +84,8 @@ private:
audioPort * m_audioPort;
const bool m_ownAudioPort;
float m_volume;
floatModel m_defaultVolumeModel;
floatModel * m_volumeModel;
track * m_track;
bbTrack * m_bbTrack;

View File

@@ -2,7 +2,7 @@
* sample_track.h - class sampleTrack, a track which provides arrangement of
* samples
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -29,13 +29,13 @@
#include <QtGui/QDialog>
#include "audio_port.h"
#include "track.h"
#include "volume_knob.h"
class QLabel;
class audioPort;
class effectLabel;
class sampleBuffer;
class volumeKnob;
//class sampleTCOSettingsDialog;
@@ -47,12 +47,12 @@ public:
sampleTCO( track * _track );
virtual ~sampleTCO();
virtual void FASTCALL changeLength( const midiTime & _length );
virtual void changeLength( const midiTime & _length );
const QString & sampleFile( void ) const;
virtual void FASTCALL saveSettings( QDomDocument & _doc,
virtual void saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "sampletco" );
@@ -110,30 +110,27 @@ private:
class sampleTrack : public QObject, public track
class sampleTrack : public track
{
Q_OBJECT
public:
sampleTrack( trackContainer * _tc );
virtual ~sampleTrack();
virtual trackTypes type( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
const fpp_t _frames,
virtual bool play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual trackView * createView( trackContainerView * _tcv );
virtual trackContentObject * createTCO( const midiTime & _pos );
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
inline audioPort * getAudioPort( void )
{
return( m_audioPort );
return( &m_audioPort );
}
virtual QString nodeName( void ) const
@@ -142,13 +139,31 @@ public:
}
private:
audioPort m_audioPort;
knobModel m_volumeModel;
friend class sampleTrackView;
} ;
class sampleTrackView : public track
{
public:
sampleTrackView( sampleTrack * _track, trackContainerView * _tcv );
virtual ~sampleTrackView();
private:
effectLabel * m_trackLabel;
audioPort * m_audioPort;
volumeKnob * m_volumeKnob;
} ;
#endif

View File

@@ -99,7 +99,6 @@ private slots:
void toggleDisableChActInd( bool _disabled );
void toggleManualChPiano( bool _enabled );
void setParallelizingLevel( int _level );
private:
@@ -138,7 +137,6 @@ private:
bool m_disableChActInd;
bool m_manualChPiano;
int m_parLevel;
typedef QMap<QString, audioDevice::setupWidget *> aswMap;
typedef QMap<QString, midiClient::setupWidget *> mswMap;

271
include/song.h Normal file
View File

@@ -0,0 +1,271 @@
/*
* song.h - class song - the root of the model-tree
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _SONG_H
#define _SONG_H
#include "track_container.h"
#include "automatable_model.h"
#include "automatable_slider.h"
#include "lcd_spinbox.h"
class pattern;
class timeLine;
const bpm_t MIN_BPM = 10;
const bpm_t DEFAULT_BPM = 140;
const bpm_t MAX_BPM = 999;
const Uint16 MAX_SONG_LENGTH = 9999;
class song : public trackContainer
{
Q_OBJECT
mapPropertyFromModel(int,getTempo,setTempo,m_tempoModel);
mapPropertyFromModel(int,masterPitch,setMasterPitch,m_masterPitchModel);
mapPropertyFromModel(int,masterVolume,setMasterVolume,
m_masterVolumeModel);
public:
enum PlayModes
{
Mode_PlaySong,
Mode_PlayTrack,
Mode_PlayBB,
Mode_PlayPattern,
Mode_PlayAutomationPattern,
Mode_Count
} ;
class playPos : public midiTime
{
public:
playPos( Sint32 _abs = 0 ) :
midiTime( _abs ),
m_timeLine( NULL ),
m_timeLineUpdate( TRUE ),
m_currentFrame( 0.0f )
{
}
inline void setCurrentFrame( const float _f )
{
m_currentFrame = _f;
}
inline float currentFrame( void ) const
{
return( m_currentFrame );
}
timeLine * m_timeLine;
bool m_timeLineUpdate;
private:
float m_currentFrame;
} ;
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 );
}
bool realTimeTask( void ) const;
inline bool exportDone( void ) const
{
return( m_exporting == TRUE &&
m_playPos[Mode_PlaySong].getTact() >=
lengthInTacts() + 1 );
}
inline PlayModes playMode( void ) const
{
return( m_playMode );
}
inline playPos & getPlayPos( PlayModes _pm )
{
return( m_playPos[_pm] );
}
tact lengthInTacts( void ) const;
bpm_t getTempo( void );
virtual automationPattern * tempoAutomationPattern( void );
// file management
void createNewProject( void );
void createNewProjectFromTemplate( const QString & _template );
void loadProject( const QString & _file_name );
bool saveProject( void );
bool saveProjectAs( const QString & _file_name );
inline const QString & projectFileName( void ) const
{
return( m_fileName );
}
inline bool isLoadingProject( void ) const
{
return( m_loadingProject );
}
inline bool isModified( void ) const
{
return( m_modified );
}
inline virtual QString nodeName( void ) const
{
return( "song" );
}
virtual inline bool fixedTCOs( void ) const
{
return( FALSE );
}
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 );
void setModified( void );
void clearProject( void );
private slots:
void insertBar( void );
void removeBar( void );
void addBBTrack( void );
void addSampleTrack( void );
void setTempo( void );
void masterVolumeChanged( void );
void doActions( void );
void updateFramesPerTact64th( void );
private:
song( void );
song( const song & );
virtual ~song();
inline tact currentTact( void ) const
{
return( m_playPos[m_playMode].getTact() );
}
midiTime length( void ) const;
inline tact64th currentTact64th( void ) const
{
return( m_playPos[m_playMode].getTact64th() );
}
void setPlayPos( tact _tact_num, tact64th _t_64th, PlayModes
_play_mode );
track * m_automationTrack;
lcdSpinBoxModel m_tempoModel;
sliderModel m_masterVolumeModel;
sliderModel m_masterPitchModel;
QString m_fileName;
QString m_oldFileName;
bool m_modified;
volatile bool m_exporting;
volatile bool m_playing;
volatile bool m_paused;
bool m_loadingProject;
PlayModes m_playMode;
playPos m_playPos[Mode_Count];
track * m_trackToPlay;
pattern * m_patternToPlay;
bool m_loopPattern;
enum Actions
{
ActionStop,
ActionPlaySong,
ActionPlayTrack,
ActionPlayBB,
ActionPlayPattern,
ActionPause,
ActionResumeFromPause
} ;
QVector<Actions> m_actions;
friend class engine;
friend class songEditor;
signals:
void tempoChanged( bpm_t _new_bpm );
} ;
#endif

View File

@@ -2,7 +2,7 @@
* song_editor.h - declaration of class songEditor, a window where you can
* setup your songs
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,173 +28,29 @@
#define _SONG_EDITOR_H
#include "track_container.h"
#include "lcd_spinbox.h"
#include "automatable_slider.h"
class QLabel;
class QScrollBar;
class automatableSlider;
class comboBox;
class lcdSpinBox;
class pattern;
class song;
class textFloat;
class timeLine;
class toolButton;
const bpm_t MIN_BPM = 10;
const bpm_t DEFAULT_BPM = 140;
const bpm_t MAX_BPM = 999;
const Uint16 MAX_SONG_LENGTH = 9999;
class songEditor : public trackContainer
class songEditor : public trackContainerView
{
Q_OBJECT
public:
enum playModes
{
PLAY_SONG,
PLAY_TRACK,
PLAY_BB,
PLAY_PATTERN,
PLAY_AUTOMATION_PATTERN,
PLAY_MODE_CNT
} ;
songEditor( song * _song );
virtual ~songEditor();
class playPos : public midiTime
{
public:
playPos( Sint32 _abs = 0 ) :
midiTime( _abs ),
m_timeLine( NULL ),
m_timeLineUpdate( TRUE ),
m_currentFrame( 0.0f )
{
}
inline void setCurrentFrame( const float _f )
{
m_currentFrame = _f;
}
inline float currentFrame( void ) const
{
return( m_currentFrame );
}
timeLine * m_timeLine;
bool m_timeLineUpdate;
private:
float m_currentFrame;
} ;
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 );
}
bool realTimeTask( void ) const;
inline bool exportDone( void ) const
{
return( m_exporting == TRUE &&
m_playPos[PLAY_SONG].getTact() >= lengthInTacts() + 1 );
}
inline playModes playMode( void ) const
{
return( m_playMode );
}
inline playPos & getPlayPos( playModes _pm )
{
return( m_playPos[_pm] );
}
tact lengthInTacts( void ) const;
bpm_t getTempo( void );
virtual automationPattern * tempoAutomationPattern( void );
// 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 );
}
inline virtual QString nodeName( void ) const
{
return( "songeditor" );
}
virtual inline bool fixedTCOs( void ) const
{
return( FALSE );
}
int masterPitch( void ) const;
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 tempo in BPM (beats per minute)
void setTempo( int _new_bpm = DEFAULT_BPM );
void setMasterVolume( volume _vol );
void setMasterPitch( int _master_pitch );
void setModified( void );
void clearProject( void );
protected:
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void wheelEvent( QWheelEvent * _we );
virtual void paintEvent( QPaintEvent * _pe );
virtual bool allowRubberband( void ) const;
protected slots:
void insertBar( void );
void removeBar( void );
void addBBTrack( void );
void addSampleTrack( void );
private slots:
void scrolled( int _new_pos );
void updateTimeLinePosition( void );
@@ -209,31 +65,20 @@ protected slots:
void updatePosition( const midiTime & _t );
void zoomingChanged( const QString & _zfac );
void doActions( void );
void zoomingChanged( void );
private:
songEditor( void );
songEditor( const songEditor & );
virtual ~songEditor();
inline tact currentTact( void ) const
{
return( m_playPos[m_playMode].getTact() );
}
midiTime length( 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 );
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void wheelEvent( QWheelEvent * _we );
virtual void paintEvent( QPaintEvent * _pe );
virtual bool allowRubberband( void ) const;
// virtual void modelChanged( void );
song * m_s;
QScrollBar * m_leftRightScroll;
@@ -241,10 +86,11 @@ private:
toolButton * m_playButton;
toolButton * m_stopButton;
lcdSpinBox * m_bpmSpinBox;
lcdSpinBox * m_tempoSpinBox;
automatableSlider * m_masterVolumeSlider;
automatableSlider * m_masterPitchSlider;
textFloat * m_mvsStatus;
textFloat * m_mpsStatus;
@@ -257,47 +103,10 @@ private:
comboBox * m_zoomingComboBox;
QString m_fileName;
QString m_oldFileName;
volatile bool m_exporting;
volatile bool m_playing;
volatile bool m_paused;
bool m_loadingProject;
playModes m_playMode;
playPos m_playPos[PLAY_MODE_CNT];
track * m_trackToPlay;
pattern * m_patternToPlay;
bool m_loopPattern;
bool m_scrollBack;
track * m_automation_track;
enum ACTIONS
{
ACT_STOP_PLAY, ACT_PLAY_SONG, ACT_PLAY_TRACK, ACT_PLAY_BB,
ACT_PLAY_PATTERN, ACT_PAUSE, ACT_RESUME_FROM_PAUSE
} ;
QVector<ACTIONS> m_actions;
friend class engine;
private slots:
void updateFramesPerTact64th( void );
signals:
void tempoChanged( bpm_t _new_bpm );
} ;
#endif

View File

@@ -30,6 +30,7 @@
#include <QtGui/QWidget>
#include "automatable_model.h"
#include "mixer.h"
@@ -41,24 +42,70 @@ class track;
const int SURROUND_AREA_SIZE = 1024;
class surroundArea : public QWidget
class surroundAreaModel : public model
{
Q_OBJECT
mapPropertyFromModel(int,x,setX,m_posX);
mapPropertyFromModel(int,y,setY,m_posY);
public:
surroundAreaModel( ::model * _parent, track * _track = NULL,
bool _default_constructed = FALSE );
volumeVector getVolumeVector( float _v_scale ) const;
void saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name = "surpos" );
void loadSettings( const QDomElement & _this,
const QString & _name = "surpos" );
inline void prepareJournalEntryFromOldVal( void )
{
m_posX.prepareJournalEntryFromOldVal();
m_posY.prepareJournalEntryFromOldVal();
}
inline void addJournalEntryFromOldToCurVal( void )
{
m_posX.addJournalEntryFromOldToCurVal();
m_posY.addJournalEntryFromOldToCurVal();
}
automationPattern * automationPatternX( void )
{
return( m_posX.getAutomationPattern() );
}
automationPattern * automationPatternY( void )
{
return( m_posY.getAutomationPattern() );
}
private:
intModel m_posX;
intModel m_posY;
} ;
class surroundArea : public QWidget, public modelView
{
Q_OBJECT
public:
surroundArea( QWidget * _parent, const QString & _name,
track * _track );
surroundArea( QWidget * _parent, const QString & _name );
virtual ~surroundArea();
volumeVector getVolumeVector( float _v_scale ) const;
inline const QPoint & value( void ) const
{
return( m_sndSrcPos );
}
void FASTCALL setValue( const QPoint & _p );
void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name = "surpos" );
void FASTCALL loadSettings( const QDomElement & _this,
const QString & _name = "surpos" );
surroundAreaModel * model( void )
{
return( castModel<surroundAreaModel>() );
}
const surroundAreaModel * model( void ) const
{
return( castModel<surroundAreaModel>() );
}
protected:
@@ -69,23 +116,9 @@ protected:
virtual void mouseReleaseEvent( QMouseEvent * _me );
signals:
void valueChanged( const QPoint & _p );
private:
QPoint m_sndSrcPos;
static QPixmap * s_backgroundArtwork;
knob * m_position_x;
knob * m_position_y;
private slots:
void updatePositionX( void );
void updatePositionY( void );
} ;

View File

@@ -1,7 +1,7 @@
/*
* tab_widget.h - LMMS-tabwidget
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -35,10 +35,9 @@ class tabWidget : public QWidget
Q_OBJECT
public:
tabWidget( const QString & _caption, QWidget * _parent );
~tabWidget();
virtual ~tabWidget();
void addTab( QWidget * _w, const QString & _name,
int _idx = -1 );
void addTab( QWidget * _w, const QString & _name, int _idx = -1 );
void setActiveTab( int _idx );

View File

@@ -1,7 +1,7 @@
/*
* tempo_sync_knob.h - adds bpm to ms conversion for knob class
*
* Copyright (c) 2005-2007 Danny McRae <khjklujn/at/yahoo.com>
* Copyright (c) 2005-2008 Danny McRae <khjklujn/at/yahoo.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -29,38 +29,41 @@
#include <QtGui/QPixmap>
#include "knob.h"
#include "meter_dialog.h"
class QAction;
class meterDialog;
class tempoSyncKnob : public knob
class tempoSyncKnobModel : public knobModel
{
Q_OBJECT
public:
enum tempoSyncMode
{
NO_SYNC,
DOUBLE_WHOLE_NOTE,
WHOLE_NOTE,
HALF_NOTE,
QUARTER_NOTE,
EIGHTH_NOTE,
SIXTEENTH_NOTE,
THIRTYSECOND_NOTE,
CUSTOM
SyncNone,
SyncDoubleWholeNote,
SyncWholeNote,
SyncHalfNote,
SyncQuarterNote,
SyncEighthNote,
SyncSixteenthNote,
SyncThirtysecondNote,
SyncCustom
} ;
tempoSyncKnob( int _knob_num, QWidget * _parent, const QString & _name,
track * _track, float _scale = 1.0f );
virtual ~tempoSyncKnob();
tempoSyncKnobModel( const float _val, const float _min,
const float _max, const float _step,
const float _scale, ::model * _parent );
virtual ~tempoSyncKnobModel();
virtual void FASTCALL saveSettings( QDomDocument & _doc,
virtual void saveSettings( QDomDocument & _doc,
QDomElement & _this,
const QString & _name );
virtual void FASTCALL loadSettings( const QDomElement & _this,
virtual void loadSettings( const QDomElement & _this,
const QString & _name );
tempoSyncMode getSyncMode( void );
@@ -69,24 +72,62 @@ public:
float getScale( void );
void setScale( float _new_scale );
signals:
void syncModeChanged( tempoSyncMode _new_mode );
void scaleChanged( float _new_scale );
public slots:
void setTempoSync( int _note_type );
void setTempoSync( QAction * _item );
protected slots:
void calculateTempoSyncTime( bpm_t _bpm );
void updateCustom( void );
private:
tempoSyncMode m_tempoSyncMode;
tempoSyncMode m_tempoLastSyncMode;
float m_scale;
meterModel m_custom;
friend class tempoSyncKnob;
} ;
class tempoSyncKnob : public knob
{
Q_OBJECT
public:
tempoSyncKnob( int _knob_num, QWidget * _parent,
const QString & _name );
virtual ~tempoSyncKnob();
const QString & getSyncDescription( void );
void setSyncDescription( const QString & _new_description );
const QPixmap & getSyncIcon( void );
void setSyncIcon( const QPixmap & _new_pix );
tempoSyncKnobModel * model( void )
{
return( castModel<tempoSyncKnobModel>() );
}
virtual void modelChanged( void );
signals:
void syncModeChanged( tempoSyncMode _new_mode );
void scaleChanged( float _new_scale );
void syncDescriptionChanged( const QString & _new_description );
void syncIconChanged( void );
public slots:
void setTempoSync( int _note_type );
void setTempoSync( QAction * _item );
protected:
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void contextMenuEvent( QContextMenuEvent * _me );
@@ -94,20 +135,18 @@ protected:
protected slots:
void calculateTempoSyncTime( bpm_t _bpm );
void updateCustom( int );
void updateDescAndIcon( void );
void showCustom( void );
private:
tempoSyncMode m_tempoSyncMode;
float m_scale;
QPixmap m_tempoSyncIcon;
QString m_tempoSyncDescription;
tempoSyncMode m_tempoLastSyncMode;
QPointer<meterDialog> m_custom;
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* timeline.h - class timeLine, representing a time-line with position marker
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,7 +28,7 @@
#include <QtGui/QWidget>
#include "song_editor.h"
#include "song.h"
class QPixmap;
@@ -40,39 +40,43 @@ class timeLine : public QWidget, public journallingObject
{
Q_OBJECT
public:
enum autoScrollStates
enum AutoScrollStates
{
AUTOSCROLL_ENABLED, AUTOSCROLL_DISABLED
AutoScrollEnabled,
AutoScrollDisabled
} ;
enum loopPointStates
enum LoopPointStates
{
LOOP_POINTS_DISABLED, LOOP_POINTS_ENABLED
LoopPointsDisabled,
LoopPointsEnabled
} ;
enum behaviourAtStopStates
enum BehaviourAtStopStates
{
BACK_TO_ZERO, BACK_TO_START, KEEP_STOP_POSITION
BackToZero,
BackToStart,
KeepStopPosition
} ;
timeLine( int _xoff, int _yoff, float _ppt, songEditor::playPos & _pos,
timeLine( int _xoff, int _yoff, float _ppt, song::playPos & _pos,
const midiTime & _begin, QWidget * _parent );
virtual ~timeLine();
inline songEditor::playPos & pos( void )
inline song::playPos & pos( void )
{
return( m_pos );
}
behaviourAtStopStates behaviourAtStop( void ) const
BehaviourAtStopStates behaviourAtStop( void ) const
{
return( m_behaviourAtStop );
}
bool loopPointsEnabled( void ) const
{
return( m_loopPoints == LOOP_POINTS_ENABLED );
return( m_loopPoints == LoopPointsEnabled );
}
inline const midiTime & loopBegin( void ) const
@@ -105,9 +109,8 @@ public:
void addToolButtons( QWidget * _tool_bar );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "timeline" );
@@ -145,16 +148,16 @@ private:
static QPixmap * s_loopPointPixmap;
static QPixmap * s_loopPointDisabledPixmap;
autoScrollStates m_autoScroll;
loopPointStates m_loopPoints;
behaviourAtStopStates m_behaviourAtStop;
AutoScrollStates m_autoScroll;
LoopPointStates m_loopPoints;
BehaviourAtStopStates m_behaviourAtStop;
bool m_changedPosition;
int m_xOffset;
int m_posMarkerX;
float m_ppt;
songEditor::playPos & m_pos;
song::playPos & m_pos;
const midiTime & m_begin;
midiTime m_loopPos[2];
@@ -166,7 +169,10 @@ private:
enum actions
{
NONE, MOVE_POS_MARKER, MOVE_LOOP_BEGIN, MOVE_LOOP_END
NoAction,
MovePositionMarker,
MoveLoopBegin,
MoveLoopEnd
} m_action;
int m_moveXOff;

View File

@@ -2,6 +2,7 @@
* tool.h - declaration of class tool, standard interface for all tool plugins
*
* Copyright (c) 2006-2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -26,24 +27,31 @@
#ifndef _TOOL_H
#define _TOOL_H
#include <QtGui/QWidget>
#include "plugin.h"
#include "plugin_view.h"
class tool : public QWidget, public plugin
class tool : public plugin
{
public:
tool( const descriptor * _descriptor );
tool( const descriptor * _descriptor, model * _parent );
virtual ~tool();
// instantiate tool-plugin with given name or return NULL
// on failure
static tool * FASTCALL instantiate( const QString & _plugin_name );
static tool * FASTCALL instantiate( const QString & _plugin_name,
model * _parent );
} ;
class toolView : public pluginView
{
public:
toolView( tool * _tool );
} ;
#endif

View File

@@ -2,7 +2,7 @@
* track.h - declaration of classes concerning tracks -> neccessary for all
* track-like objects (beat/bassline, sample-track...)
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -44,6 +44,7 @@
#include "midi_time.h"
#include "rubberband.h"
#include "journalling_object.h"
#include "automatable_model.h"
class QMenu;
@@ -54,26 +55,27 @@ class bbTrack;
class pixmapButton;
class textFloat;
class track;
class trackContentObjectView;
class trackContainer;
class trackContainerView;
class trackContentWidget;
class trackWidget;
class trackView;
typedef QWidget trackSettingsWidget;
const Uint16 DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
const Uint16 TRACK_OP_WIDTH = 70;
const Uint16 TCO_BORDER_WIDTH = 1;
const int DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
const int TRACK_OP_WIDTH = 70;
const int TCO_BORDER_WIDTH = 1;
class trackContentObject : public selectableObject,
public journallingObject
class trackContentObject : public model, public journallingObject
{
Q_OBJECT
public:
trackContentObject( track * _track );
trackContentObject( const trackContentObject & _copy );
// trackContentObject( const trackContentObject & _copy );
virtual ~trackContentObject();
inline track * getTrack( void )
{
@@ -94,17 +96,71 @@ public:
bool muted( void ) const
{
return( m_muted );
return( m_mutedModel.value() );
}
virtual void movePosition( const midiTime & _pos );
virtual void changeLength( const midiTime & _length );
virtual trackContentObjectView * createView( trackView * _tv ) = 0;
protected:
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
protected slots:
void cut( void );
void copy( void );
void paste( void );
void toggleMute( void );
signals:
void lengthChanged( void );
void positionChanged( void );
private:
enum Actions
{
NoAction,
Move,
Resize
} ;
track * m_track;
midiTime m_startPosition;
midiTime m_length;
boolModel m_mutedModel;
friend class trackContentObjectView;
} ;
class trackContentObjectView : public selectableObject, public modelView
{
Q_OBJECT
public:
trackContentObjectView( trackContentObject * _tco, trackView * _tv );
virtual ~trackContentObjectView();
bool fixedTCOs( void );
virtual void FASTCALL movePosition( const midiTime & _pos );
virtual void FASTCALL changeLength( const midiTime & _length );
inline trackContentObject * getTrackContentObject( void )
{
return( m_tco );
}
public slots:
virtual void close( void );
virtual bool close( void );
protected:
@@ -123,34 +179,34 @@ protected:
void setAutoResizeEnabled( bool _e = FALSE );
float pixelsPerTact( void );
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
inline trackView * getTrackView( void )
{
return( m_trackView );
}
protected slots:
void cut( void );
void copy( void );
void paste( void );
void toggleMute( void );
void updateLength( void );
void updatePosition( void );
private:
enum actions
enum Actions
{
NONE, MOVE, MOVE_SELECTION, RESIZE
NoAction,
Move,
MoveSelection,
Resize
} ;
static textFloat * s_textFloat;
track * m_track;
midiTime m_startPosition;
midiTime m_length;
actions m_action;
trackContentObject * m_tco;
trackView * m_trackView;
Actions m_action;
bool m_autoResize;
Sint16 m_initialMouseX;
bool m_muted;
textFloat * m_hint;
midiTime m_oldTime;// used for undo/redo while mouse-button is pressed
@@ -160,39 +216,30 @@ private:
class trackContentWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
trackContentWidget( trackWidget * _parent );
trackContentWidget( trackView * _parent );
virtual ~trackContentWidget();
trackContentObject * FASTCALL getTCO( int _tco_num );
int numOfTCOs( void );
trackContentObject * FASTCALL addTCO( trackContentObject * _tco );
void FASTCALL removeTCO( int _tco_num, bool _also_delete = TRUE );
void FASTCALL removeTCO( trackContentObject * _tco,
bool _also_delete = TRUE );
void removeAllTCOs( void );
void FASTCALL swapPositionOfTCOs( int _tco_num1, int _tco_num2 );
inline Uint16 pixelsPerTact( void ) const
void addTCOView( trackContentObjectView * _tcov );
void removeTCOView( trackContentObjectView * _tcov );
void removeTCOView( int _tco_num )
{
return( m_pixelsPerTact );
if( _tco_num >= 0 && _tco_num < m_tcoViews.size() )
{
removeTCOView( m_tcoViews[_tco_num] );
}
}
inline void setPixelsPerTact( Uint16 _ppt )
{
m_pixelsPerTact = _ppt;
}
tact length( void ) const;
midiTime endPosition( const midiTime & _pos_start );
public slots:
void insertTact( const midiTime & _pos );
void removeTact( const midiTime & _pos );
void update( void );
void changePosition( const midiTime & _new_pos = -1 );
protected:
@@ -212,19 +259,21 @@ protected:
private:
enum actions
enum Actions
{
ADD_TCO, REMOVE_TCO
AddTrackContentObject,
RemoveTrackContentObject
} ;
track * getTrack( void );
midiTime getPosition( int _mouse_x );
typedef QVector<trackContentObject *> tcoVector;
trackView * m_trackView;
tcoVector m_trackContentObjects;
trackWidget * m_trackWidget;
Uint16 m_pixelsPerTact;
typedef QVector<trackContentObjectView *> tcoViewVector;
tcoViewVector m_tcoViews;
int m_pixelsPerTact;
} ;
@@ -236,7 +285,7 @@ class trackOperationsWidget : public QWidget
{
Q_OBJECT
public:
trackOperationsWidget( trackWidget * _parent );
trackOperationsWidget( trackView * _parent );
~trackOperationsWidget();
bool muted( void ) const;
@@ -267,7 +316,7 @@ private:
static QPixmap * s_muteOnDisabled;
static QPixmap * s_muteOnEnabled;
trackWidget * m_trackWidget;
trackView * m_trackView;
QPushButton * m_trackOps;
pixmapButton * m_muteBtn;
@@ -277,20 +326,146 @@ private:
bbTrack * currentBBTrack( void );
bool inBBEditor( void );
friend class trackView;
} ;
// base-class for all tracks
class track : public model, public journallingObject
{
Q_OBJECT
mapPropertyFromModel(bool,muted,setMuted,m_mutedModel);
public:
enum TrackTypes
{
InstrumentTrack,
BBTrack,
SampleTrack,
EventTrack,
VideoTrack,
AutomationTrack,
NumTrackTypes
} ;
// actual widget shown in trackContainer
class trackWidget : public QWidget, public journallingObject
track( TrackTypes _type, trackContainer * _tc );
virtual ~track();
static track * create( TrackTypes _tt, trackContainer * _tc );
static track * create( const QDomElement & _this,
trackContainer * _tc );
void clone( void );
// pure virtual functions
TrackTypes type( void ) const
{
return( m_type );
}
virtual bool play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 ) = 0;
virtual trackView * createView( trackContainerView * _view ) = 0;
virtual trackContentObject * createTCO( const midiTime & _pos ) = 0;
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent ) = 0;
virtual void loadTrackSpecificSettings( const QDomElement & _this ) = 0;
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
virtual void loadSettings( const QDomElement & _this );
// -- for usage by trackContentObject only ---------------
trackContentObject * addTCO( trackContentObject * _tco );
void removeTCO( trackContentObject * _tco );
// -------------------------------------------------------
int numOfTCOs( void );
trackContentObject * getTCO( int _tco_num );
int getTCONum( trackContentObject * _tco );
void getTCOsInRange( QList<trackContentObject *> & _tco_v,
const midiTime & _start,
const midiTime & _end );
void swapPositionOfTCOs( int _tco_num1, int _tco_num2 );
void insertTact( const midiTime & _pos );
void removeTact( const midiTime & _pos );
tact length( void ) const;
inline trackContainer * getTrackContainer( void ) const
{
return( m_trackContainer );
}
void addAutomationPattern( automationPattern * _pattern );
void removeAutomationPattern( automationPattern * _pattern );
// name-stuff
virtual const QString & name( void ) const
{
return( m_name );
}
inline const QPixmap * pixmap( void )
{
return( m_pixmap );
}
using model::dataChanged;
public slots:
virtual void setName( const QString & _new_name )
{
m_name = _new_name;
}
protected:
void sendMidiTime( const midiTime & _time );
private:
trackContainer * m_trackContainer;
TrackTypes m_type;
QString m_name;
QPixmap * m_pixmap;
boolModel m_mutedModel;
typedef QVector<trackContentObject *> tcoVector;
tcoVector m_trackContentObjects;
QList<automationPattern *> m_automationPatterns;
friend class trackView;
signals:
void trackContentObjectAdded( trackContentObject * );
} ;
class trackView : public QWidget, public modelView, public journallingObject
{
Q_OBJECT
public:
trackWidget( track * _track, QWidget * _parent );
virtual ~trackWidget();
trackView( track * _track, trackContainerView * _tcv );
virtual ~trackView();
inline const track * getTrack( void ) const
{
@@ -302,56 +477,46 @@ public:
return( m_track );
}
inline const trackOperationsWidget & getTrackOperationsWidget( void )
const
inline trackContainerView * getTrackContainerView( void )
{
return( m_trackOperationsWidget );
return( m_trackContainerView );
}
inline const trackSettingsWidget & getTrackSettingsWidget( void ) const
inline trackOperationsWidget * getTrackOperationsWidget( void )
{
return( m_trackSettingsWidget );
return( &m_trackOperationsWidget );
}
inline const trackContentWidget & getTrackContentWidget( void ) const
inline trackSettingsWidget * getTrackSettingsWidget( void )
{
return( m_trackContentWidget );
return( &m_trackSettingsWidget );
}
inline trackOperationsWidget & getTrackOperationsWidget( void )
inline trackContentWidget * getTrackContentWidget( void )
{
return( m_trackOperationsWidget );
}
inline trackSettingsWidget & getTrackSettingsWidget( void )
{
return( m_trackSettingsWidget );
}
inline trackContentWidget & getTrackContentWidget( void )
{
return( m_trackContentWidget );
return( &m_trackContentWidget );
}
bool isMovingTrack( void ) const
{
return( m_action == MOVE_TRACK );
return( m_action == MoveTrack );
}
virtual void update( void );
public slots:
void changePosition( const midiTime & _new_pos = -1 );
virtual bool close( void );
protected:
virtual void modelChanged( void );
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
virtual QString nodeName( void ) const
{
return( "trackwidget" );
return( "trackview" );
}
@@ -363,153 +528,30 @@ protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
midiTime FASTCALL endPosition( const midiTime & _pos_start );
private:
enum actions
enum Actions
{
NONE, MOVE_TRACK, RESIZE_TRACK
NoAction,
MoveTrack,
ResizeTrack
} ;
track * m_track;
trackContainerView * m_trackContainerView;
trackOperationsWidget m_trackOperationsWidget;
trackSettingsWidget m_trackSettingsWidget;
trackContentWidget m_trackContentWidget;
actions m_action;
Actions m_action;
private slots:
void createTCOView( trackContentObject * _tco );
} ;
// base-class for all tracks
class track : public journallingObject
{
public:
enum trackTypes
{
INSTRUMENT_TRACK,
BB_TRACK,
SAMPLE_TRACK,
EVENT_TRACK,
VIDEO_TRACK,
AUTOMATION_TRACK,
TOTAL_TRACK_TYPES
} ;
track( trackContainer * _tc, bool _create_widget = TRUE );
virtual ~track();
static track * FASTCALL create( trackTypes _tt, trackContainer * _tc );
static void FASTCALL create( const QDomElement & _this,
trackContainer * _tc );
void FASTCALL clone( void );
tact length( void ) const;
inline bool muted( void ) const
{
return( m_trackWidget->getTrackOperationsWidget().muted() );
}
inline void setMuted( bool _muted )
{
m_trackWidget->getTrackOperationsWidget().setMuted( _muted );
}
// pure virtual functions
virtual trackTypes type( void ) const = 0;
virtual bool FASTCALL play( const midiTime & _start,
const fpp_t _frames,
const f_cnt_t _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 & _this );
virtual void FASTCALL loadSettings( const QDomElement & _this );
trackContentObject * FASTCALL addTCO( trackContentObject * _tco );
void FASTCALL removeTCO( int _tco_num );
int numOfTCOs( void );
trackContentObject * FASTCALL getTCO( int _tco_num );
int FASTCALL getTCONum( trackContentObject * _tco );
void FASTCALL getTCOsInRange( QList<trackContentObject *> & _tco_v,
const midiTime & _start,
const midiTime & _end );
void FASTCALL swapPositionOfTCOs( int _tco_num1, int _tco_num2 );
inline trackWidget * getTrackWidget( void )
{
return( m_trackWidget );
}
inline trackContainer * getTrackContainer( void ) const
{
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() );
}
void addAutomationPattern( automationPattern * _pattern );
void removeAutomationPattern( automationPattern * _pattern );
// name-stuff
inline virtual const QString & name( void ) const
{
return( m_name );
}
inline virtual void setName( const QString & _new_name )
{
m_name = _new_name;
}
protected:
void sendMidiTime( const midiTime & _time );
QString m_name;
private:
trackContainer * m_trackContainer;
trackWidget * m_trackWidget;
QList<automationPattern *> m_automation_patterns;
} ;
#endif

View File

@@ -2,7 +2,7 @@
* track_container.h - base-class for all track-containers like Song-Editor,
* BB-Editor...
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -36,65 +36,98 @@
#include "journalling_object.h"
class trackContainerView;
class QVBoxLayout;
class trackContainer : public QWidget, public journallingObject
class trackContainer : public model, public journallingObject
{
Q_OBJECT
public:
trackContainer( void );
virtual ~trackContainer();
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual automationPattern * tempoAutomationPattern( void )
{
return( NULL );
}
int countTracks( track::TrackTypes _tt = track::NumTrackTypes ) const;
void setMutedOfAllTracks( bool _muted );
virtual void updateAfterTrackAdd( void );
void addTrack( track * _track );
void removeTrack( track * _track );
void clearAllTracks( void );
const QList<track *> & tracks( void ) const
{
return( m_tracks );
}
static const QString classNodeName( void )
{
return( "trackcontainer" );
}
//const QList<track *> tracks( void ) const;
signals:
void trackAdded( track * _track );
private:
QList<track *> m_tracks;
friend class trackContainerView;
} ;
class trackContainerView : public QWidget, public modelView,
public journallingObject
{
Q_OBJECT
public:
trackContainerView( trackContainer * _tc );
virtual ~trackContainerView();
QWidget * contentWidget( 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 automationPattern * tempoAutomationPattern( void )
{
return( NULL );
}
virtual bool fixedTCOs( void ) const
{
return( FALSE );
}
Uint16 FASTCALL countTracks( track::trackTypes _tt =
track::TOTAL_TRACK_TYPES ) const;
inline float pixelsPerTact( void ) const
{
return( m_ppt );
}
void FASTCALL setMutedOfAllTracks( bool _muted );
void setPixelsPerTact( int _ppt );
virtual void updateAfterTrackAdd( void );
void FASTCALL setPixelsPerTact( Uint16 _ppt );
void FASTCALL addTrack( track * _track );
void FASTCALL removeTrack( track * _track );
void FASTCALL moveTrackUp( track * _track );
void FASTCALL moveTrackDown( track * _track );
void FASTCALL realignTracks( void );
void clearAllTracks( void );
const trackWidget * trackWidgetAt( const int _y ) const;
const trackView * trackViewAt( const int _y ) const;
virtual bool allowRubberband( void ) const;
@@ -110,73 +143,101 @@ public:
return( m_rubberBand->selectedObjects() );
}
return( QVector<selectableObject *>() );
/* QVector<selectableObject *> foo;
return( foo );*/
}
QList<track *> tracks( void );
static const QString classNodeName( void )
trackContainer * model( void )
{
return( "trackcontainer" );
return( m_tc );
}
const trackContainer * model( void ) const
{
return( m_tc );
}
void moveTrackViewUp( trackView * _tv );
void moveTrackViewDown( trackView * _tv );
// -- for usage by trackView only ---------------
trackView * addTrackView( trackView * _tv );
void removeTrackView( trackView * _tv );
// -------------------------------------------------------
void clearAllTracks( void );
virtual QString nodeName( void ) const
{
return( "trackcontainerview" );
}
signals:
void positionChanged( const midiTime & _pos );
public slots:
void realignTracks( void );
void createTrackView( track * _t );
protected:
static const Uint16 DEFAULT_PIXELS_PER_TACT = 16;
static const int DEFAULT_PIXELS_PER_TACT = 16;
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
const QList<trackView *> & trackViews( void ) const
{
return( m_trackViews );
}
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void resizeEvent( QResizeEvent * );
const QList<track *> tracks( void ) const;
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
midiTime m_currentPosition;
private:
enum actions
enum Actions
{
ADD_TRACK, REMOVE_TRACK
AddTrack,
RemoveTrack
} ;
class scrollArea : public QScrollArea
{
public:
scrollArea( trackContainer * _parent );
scrollArea( trackContainerView * _parent );
virtual ~scrollArea();
protected:
virtual void wheelEvent( QWheelEvent * _we );
private:
trackContainer * m_trackContainer;
trackContainerView * m_trackContainerView;
} ;
trackContainer * m_tc;
typedef QList<trackView *> trackViewList;
trackViewList m_trackViews;
scrollArea * m_scrollArea;
QVBoxLayout * m_scrollLayout;
QList<track *> m_tracks;
float m_ppt;
rubberBand * m_rubberBand;
QPoint m_origin;
signals:
void positionChanged( const midiTime & _pos );
} ;
#endif

View File

@@ -0,0 +1,91 @@
/*
* transformable_auto_model.h - template transformableAutoModel
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _TRANSFORMABLE_AUTO_MODEL_H
#define _TRANSFORMABLE_AUTO_MODEL_H
#include "automatable_model.h"
//#include "automatable_model_templates.h"
template<typename T>
struct AutoModelTransformer
{
inline virtual T transform( const T & _val ) const
{
return( _val );
}
} ;
template<typename T, typename EDIT_STEP_TYPE>
class transformableAutoModel : public automatableModel<T, EDIT_STEP_TYPE>
{
public:
transformableAutoModel( const AutoModelTransformer<T> * _transformer,
const T _val = 0,
const T _min = 0,
const T _max = 0,
const T _step = defaultRelStep(),
::model * _parent = NULL,
bool _default_constructed = FALSE ) :
automatableModel( _val, _min, _max, _step, _parent,
_default_constructed ),
m_transformer( _transformer )
{
}
inline virtual ~transformableAutoModel()
{
}
inline virtual void setValue( const T _value )
{
autoModel::setValue( _value );
if( m_transformer != NULL )
{
m_transformedValue = m_transformer->transform(
autoModel::value() );
}
else
{
m_transformedValue = autoModel::value();
}
}
inline virtual T value( void ) const
{
return( m_transformedValue );
}
private:
T m_transformedValue;
const AutoModelTransformer<T> * m_transformer;
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* types.h - typedefs for common types that are used in the whole app
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -26,6 +26,8 @@
#ifndef _TYPES_H
#define _TYPES_H
#include <limits>
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
@@ -60,13 +62,15 @@ typedef Uint32 jo_id_t; // (unique) ID of a journalling object
template<typename T>
struct valueRanges
{
enum
static inline T min( void )
{
max = static_cast<T>( static_cast<T>( ~0 ) > 0 ?
~0 : ( ( ( T ) 1 << ( sizeof( T ) * 8 - 1 ) ) - 1 ) ),
min = static_cast<T>( static_cast<T>( ~0 ) > 0 ?
0 : ( -max - 1 ) )
} ;
return( std::numeric_limits<T>::min() );
}
static inline T max( void )
{
return( std::numeric_limits<T>::max() );
}
} ;

View File

@@ -34,8 +34,7 @@ class volumeKnob : public knob
{
Q_OBJECT
public:
volumeKnob( int _knob_num, QWidget * _parent, const QString & _name,
track * _track );
volumeKnob( int _knob_num, QWidget * _parent, const QString & _name );
virtual ~volumeKnob();

View File

@@ -31,18 +31,16 @@
#include "audio_file_processor.h"
#include "automatable_model_templates.h"
#include "engine.h"
#include "song_editor.h"
#include "song.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "interpolation.h"
#include "gui_templates.h"
#include "pixmap_button.h"
#include "knob.h"
#include "tooltip.h"
#include "string_pair_drag.h"
#include "mmp.h"
#include "volume_knob.h"
#undef SINGLE_SOURCE_COMPILE
@@ -70,120 +68,31 @@ plugin::descriptor audiofileprocessor_plugin_descriptor =
}
QPixmap * audioFileProcessor::s_artwork = NULL;
audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) :
instrument( _channel_track, &audiofileprocessor_plugin_descriptor )
audioFileProcessor::audioFileProcessor( instrumentTrack * _instrument_track ) :
instrument( _instrument_track, &audiofileprocessor_plugin_descriptor ),
m_sampleBuffer(),
m_ampModel( 100, 0, 500, 1, this ),
m_startPointModel( 0, 0, 1, 0.0000001f, this ),
m_endPointModel( 1, 0, 1, 0.0000001f, this ),
m_reverseModel( FALSE, this ),
m_loopModel( FALSE, this )
{
connect( &m_sampleBuffer, SIGNAL( sampleUpdated() ), this,
SLOT( sampleUpdated() ) );
if( s_artwork == NULL )
{
s_artwork = new QPixmap( PLUGIN_NAME::getIconPixmap(
"artwork" ) );
}
m_openAudioFileButton = new pixmapButton( this, NULL, NULL );
m_openAudioFileButton->setCursor( QCursor( Qt::PointingHandCursor ) );
m_openAudioFileButton->move( 200, 90 );
m_openAudioFileButton->setActiveGraphic( embed::getIconPixmap(
"project_open_down" ) );
m_openAudioFileButton->setInactiveGraphic( embed::getIconPixmap(
"project_open" ) );
connect( m_openAudioFileButton, SIGNAL( clicked() ), this,
SLOT( openAudioFile() ) );
toolTip::add( m_openAudioFileButton, tr( "Open other sample" ) );
m_openAudioFileButton->setWhatsThis(
tr( "Click here, if you want to open another audio-file. After "
"clicking on this button, a file-open-dialog appears "
"and you can select your file. Settings like Looping-"
"Mode, start- and end-point, amplify-value and so on "
"are not reset, so please don't wonder if your sample "
"doesn't sound like the original one..." ) );
m_reverseButton = new pixmapButton( this, NULL, NULL );
m_reverseButton->setCheckable( TRUE );
m_reverseButton->move( 160, 124 );
m_reverseButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"reverse_on" ) );
m_reverseButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"reverse_off" ) );
connect( m_reverseButton, SIGNAL( toggled( bool ) ), this,
SLOT( reverseBtnToggled( bool ) ) );
toolTip::add( m_reverseButton, tr( "Reverse sample" ) );
m_reverseButton->setWhatsThis(
tr( "If you enable this button, the whole sample is reversed. "
"This is useful for cool effects, e.g. a reversed "
"crash." ) );
m_loopButton = new pixmapButton( this, tr( "Loop" ), _channel_track );
m_loopButton->setCheckable( TRUE );
m_loopButton->move( 180, 124 );
m_loopButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"loop_on" ) );
m_loopButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"loop_off" ) );
toolTip::add( m_loopButton,
tr( "Loop sample at start- and end-point" ) );
m_loopButton->setWhatsThis(
tr( "Here you can set, whether Looping-Mode is enabled. If "
"enabled, AudioFileProcessor loops between start- and "
"end-point of a sample until the whole note is played. "
"This is useful for things like string- and choir-"
"samples." ) );
m_ampKnob = new volumeKnob( knobDark_28, this, tr( "Amplify" ), NULL );
m_ampKnob->setRange( 0, 500, 1.0f );
m_ampKnob->move( 6, 114 );
m_ampKnob->setInitValue( 100.0f );
m_ampKnob->setHintText( tr( "Amplify:" )+" ", "%" );
m_ampKnob->setLabel( tr( "AMP" ) );
connect( m_ampKnob, SIGNAL( valueChanged( float ) ), this,
SLOT( ampKnobChanged( float ) ) );
m_ampKnob->setWhatsThis(
tr( "With this knob you can set the amplify-ratio. When you "
"set a value of 100% your sample isn't changed. "
"Otherwise it will be amplified up or down (your "
"actual sample-file isn't touched!)" ) );
m_startKnob = new knob( knobDark_28, this, tr( "Start of sample" ),
_channel_track );
m_startKnob->setRange( 0.0f, 1.0f, 0.00001f );
m_startKnob->move( 46, 114 );
m_startKnob->setInitValue( 0.0f );
m_startKnob->setHintText( tr( "Startpoint:" )+" ", "" );
m_startKnob->setLabel( tr( "START" ) );
connect( m_startKnob, SIGNAL( valueChanged( float ) ), this,
SLOT( startKnobChanged( float ) ) );
m_startKnob->setWhatsThis(
tr( "With this knob you can set the point where "
"AudioFileProcessor should begin playing your sample. "
"If you enable Looping-Mode, this is the point to "
"which AudioFileProcessor returns if a note is longer "
"than the sample between start- and end-point." ) );
m_endKnob = new knob( knobDark_28, this, tr( "End of sample" ),
_channel_track );
m_endKnob->setRange( 0.0f, 1.0f, 0.00001f );
m_endKnob->move( 84, 114 );
m_endKnob->setInitValue( 1.0f );
m_endKnob->setHintText( tr( "Endpoint:" )+" ", "" );
m_endKnob->setLabel( tr( "END" ) );
connect( m_endKnob, SIGNAL( valueChanged( float ) ), this,
SLOT( endKnobChanged( float ) ) );
m_endKnob->setWhatsThis(
tr( "With this knob you can set the point where "
"AudioFileProcessor should stop playing your sample. "
"If you enable Looping-Mode, this is the point where "
"AudioFileProcessor returns if a note is longer than "
"the sample between start- and end-point." ) );
setAcceptDrops( TRUE );
connect( &m_reverseModel, SIGNAL( dataChanged() ),
this, SLOT( reverseModelChanged() ) );
connect( &m_ampModel, SIGNAL( dataChanged() ),
this, SLOT( ampModelChanged() ) );
connect( &m_startPointModel, SIGNAL( dataChanged() ),
this, SLOT( startPointModelChanged() ) );
connect( &m_endPointModel, SIGNAL( dataChanged() ),
this, SLOT( endPointModelChanged() ) );
m_ampModel.setTrack( _instrument_track );
m_startPointModel.setTrack( _instrument_track );
m_endPointModel.setTrack( _instrument_track );
m_reverseModel.setTrack( _instrument_track );
m_loopModel.setTrack( _instrument_track );
}
@@ -196,6 +105,37 @@ audioFileProcessor::~audioFileProcessor()
void audioFileProcessor::playNote( notePlayHandle * _n, bool )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
sampleFrame * buf = new sampleFrame[frames];
if( !_n->m_pluginData )
{
_n->m_pluginData = new handleState( _n->hasDetuningInfo() );
}
if( m_sampleBuffer.play( buf, (handleState *)_n->m_pluginData,
frames, _n->frequency(),
m_loopModel.value() ) == TRUE )
{
applyRelease( buf, _n );
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
}
delete[] buf;
}
void audioFileProcessor::deleteNotePluginData( notePlayHandle * _n )
{
delete (handleState *)_n->m_pluginData;
}
void audioFileProcessor::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
@@ -203,13 +143,14 @@ void audioFileProcessor::saveSettings( QDomDocument & _doc,
if( m_sampleBuffer.audioFile() == "" )
{
QString s;
_this.setAttribute( "sampledata", m_sampleBuffer.toBase64( s ) );
_this.setAttribute( "sampledata",
m_sampleBuffer.toBase64( s ) );
}
m_reverseButton->saveSettings( _doc, _this, "reversed" );
m_loopButton->saveSettings( _doc, _this, "looped" );
m_ampKnob->saveSettings( _doc, _this, "amp" );
m_startKnob->saveSettings( _doc, _this, "sframe" );
m_endKnob->saveSettings( _doc, _this, "eframe" );
m_reverseModel.saveSettings( _doc, _this, "reversed" );
m_loopModel.saveSettings( _doc, _this, "looped" );
m_ampModel.saveSettings( _doc, _this, "amp" );
m_startPointModel.saveSettings( _doc, _this, "sframe" );
m_endPointModel.saveSettings( _doc, _this, "eframe" );
}
@@ -225,14 +166,14 @@ void audioFileProcessor::loadSettings( const QDomElement & _this )
{
m_sampleBuffer.loadFromBase64( _this.attribute( "srcdata" ) );
}
m_reverseButton->loadSettings( _this, "reversed" );
m_loopButton->loadSettings( _this, "looped" );
m_ampKnob->loadSettings( _this, "amp" );
m_startKnob->loadSettings( _this, "sframe" );
m_endKnob->loadSettings( _this, "eframe" );
m_reverseModel.loadSettings( _this, "reversed" );
m_loopModel.loadSettings( _this, "looped" );
m_ampModel.loadSettings( _this, "amp" );
m_startPointModel.loadSettings( _this, "sframe" );
m_endPointModel.loadSettings( _this, "eframe" );
startKnobChanged( m_startKnob->value() );
endKnobChanged( m_endKnob->value() );
startPointModelChanged();
endPointModelChanged();
}
@@ -275,7 +216,16 @@ Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const
void audioFileProcessor::setAudioFile( const QString & _audio_file, bool _rename )
pluginView * audioFileProcessor::instantiateView( QWidget * _parent )
{
return( new audioFileProcessorView( this, _parent ) );
}
void audioFileProcessor::setAudioFile( const QString & _audio_file,
bool _rename )
{
// is current channel-name equal to previous-filename??
if( _rename &&
@@ -287,56 +237,217 @@ void audioFileProcessor::setAudioFile( const QString & _audio_file, bool _rename
getInstrumentTrack()->setName( QFileInfo( _audio_file
).fileName() );
}
// else we don't touch the channel-name, because the user named it self
// else we don't touch the track-name, because the user named it self
m_sampleBuffer.setAudioFile( _audio_file );
startKnobChanged( m_startKnob->value() );
endKnobChanged( m_endKnob->value() );
startPointModelChanged();
endPointModelChanged();
}
void audioFileProcessor::reverseModelChanged( void )
{
m_sampleBuffer.setReversed( m_reverseModel.value() );
}
void audioFileProcessor::ampModelChanged( void )
{
m_sampleBuffer.setAmplification( m_ampModel.value() / 100.0f );
}
void audioFileProcessor::startPointModelChanged( void )
{
if( m_startPointModel.value() < m_endPointModel.value() )
{
m_sampleBuffer.setStartFrame( static_cast<Uint32>(
m_startPointModel.value() *
m_sampleBuffer.frames() ) );
}
else
{
m_startPointModel.setValue( m_endPointModel.value() - 0.01f );
}
emit dataChanged();
}
void audioFileProcessor::endPointModelChanged( void )
{
if( m_endPointModel.value() > m_startPointModel.value() )
{
if( m_endPointModel.value() * m_sampleBuffer.frames() >= 1.0f )
{
m_sampleBuffer.setEndFrame( static_cast<Uint32>(
m_endPointModel.value() *
m_sampleBuffer.frames() ) - 1 );
}
else
{
m_sampleBuffer.setEndFrame( 0 );
}
}
else
{
m_endPointModel.setValue( m_startPointModel.value() + 0.01f );
}
emit dataChanged();
}
void audioFileProcessor::playNote( notePlayHandle * _n, bool )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
sampleFrame * buf = new sampleFrame[frames];
if( !_n->m_pluginData )
audioFileProcessor::subPluginFeatures::subPluginFeatures(
plugin::PluginTypes _type ) :
plugin::descriptor::subPluginFeatures( _type )
{
}
const QStringList & audioFileProcessor::subPluginFeatures::supportedExtensions(
void )
{
static QStringList extensions = QStringList()
<< "wav" << "ogg" << "ds" << "spx" << "au"
<< "voc" << "aif" << "aiff" << "flac" << "raw";
return( extensions );
}
QPixmap * audioFileProcessorView::s_artwork = NULL;
audioFileProcessorView::audioFileProcessorView( instrument * _instrument,
QWidget * _parent ) :
instrumentView( _instrument, _parent )
{
if( s_artwork == NULL )
{
_n->m_pluginData = new handleState( _n->hasDetuningInfo() );
s_artwork = new QPixmap( PLUGIN_NAME::getIconPixmap(
"artwork" ) );
}
if( m_sampleBuffer.play( buf, (handleState *)_n->m_pluginData,
frames, _n->frequency(),
m_loopButton->isChecked() ) == TRUE )
{
applyRelease( buf, _n );
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
}
delete[] buf;
m_openAudioFileButton = new pixmapButton( this, NULL );
m_openAudioFileButton->setCursor( QCursor( Qt::PointingHandCursor ) );
m_openAudioFileButton->move( 200, 90 );
m_openAudioFileButton->setActiveGraphic( embed::getIconPixmap(
"project_open_down" ) );
m_openAudioFileButton->setInactiveGraphic( embed::getIconPixmap(
"project_open" ) );
connect( m_openAudioFileButton, SIGNAL( clicked() ),
this, SLOT( openAudioFile() ) );
toolTip::add( m_openAudioFileButton, tr( "Open other sample" ) );
m_openAudioFileButton->setWhatsThis(
tr( "Click here, if you want to open another audio-file. After "
"clicking on this button, a file-open-dialog appears "
"and you can select your file. Settings like Looping-"
"Mode, start- and end-point, amplify-value and so on "
"are not reset, so please don't wonder if your sample "
"doesn't sound like the original one..." ) );
m_reverseButton = new pixmapButton( this, NULL );
m_reverseButton->setCheckable( TRUE );
m_reverseButton->move( 160, 124 );
m_reverseButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"reverse_on" ) );
m_reverseButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"reverse_off" ) );
toolTip::add( m_reverseButton, tr( "Reverse sample" ) );
m_reverseButton->setWhatsThis(
tr( "If you enable this button, the whole sample is reversed. "
"This is useful for cool effects, e.g. a reversed "
"crash." ) );
m_loopButton = new pixmapButton( this, tr( "Loop" ) );
m_loopButton->setCheckable( TRUE );
m_loopButton->move( 180, 124 );
m_loopButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"loop_on" ) );
m_loopButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"loop_off" ) );
toolTip::add( m_loopButton,
tr( "Loop sample at start- and end-point" ) );
m_loopButton->setWhatsThis(
tr( "Here you can set, whether Looping-Mode is enabled. If "
"enabled, AudioFileProcessor loops between start- and "
"end-point of a sample until the whole note is played. "
"This is useful for things like string- and choir-"
"samples." ) );
m_ampKnob = new volumeKnob( knobDark_28, this, tr( "Amplify" ) );
m_ampKnob->move( 6, 114 );
m_ampKnob->setHintText( tr( "Amplify:" )+" ", "%" );
m_ampKnob->setLabel( tr( "AMP" ) );
m_ampKnob->setWhatsThis(
tr( "With this knob you can set the amplify-ratio. When you "
"set a value of 100% your sample isn't changed. "
"Otherwise it will be amplified up or down (your "
"actual sample-file isn't touched!)" ) );
m_startKnob = new knob( knobDark_28, this, tr( "Start of sample" ) );
m_startKnob->move( 46, 114 );
m_startKnob->setHintText( tr( "Startpoint:" )+" ", "" );
m_startKnob->setLabel( tr( "START" ) );
m_startKnob->setWhatsThis(
tr( "With this knob you can set the point where "
"AudioFileProcessor should begin playing your sample. "
"If you enable Looping-Mode, this is the point to "
"which AudioFileProcessor returns if a note is longer "
"than the sample between start- and end-point." ) );
m_endKnob = new knob( knobDark_28, this, tr( "End of sample" ) );
m_endKnob->move( 84, 114 );
m_endKnob->setHintText( tr( "Endpoint:" )+" ", "" );
m_endKnob->setLabel( tr( "END" ) );
m_endKnob->setWhatsThis(
tr( "With this knob you can set the point where "
"AudioFileProcessor should stop playing your sample. "
"If you enable Looping-Mode, this is the point where "
"AudioFileProcessor returns if a note is longer than "
"the sample between start- and end-point." ) );
setAcceptDrops( TRUE );
}
void audioFileProcessor::deleteNotePluginData( notePlayHandle * _n )
audioFileProcessorView::~audioFileProcessorView()
{
delete (handleState *)_n->m_pluginData;
}
void audioFileProcessor::dragEnterEvent( QDragEnterEvent * _dee )
void audioFileProcessorView::dragEnterEvent( QDragEnterEvent * _dee )
{
if( _dee->mimeData()->hasFormat( stringPairDrag::mimeType() ) )
{
QString txt = _dee->mimeData()->data(
stringPairDrag::mimeType() );
if( txt.section( ':', 0, 0 ) == QString( "tco_%1" ).arg(
track::SAMPLE_TRACK ) )
track::SampleTrack ) )
{
_dee->acceptProposedAction();
}
@@ -358,21 +469,21 @@ void audioFileProcessor::dragEnterEvent( QDragEnterEvent * _dee )
void audioFileProcessor::dropEvent( QDropEvent * _de )
void audioFileProcessorView::dropEvent( QDropEvent * _de )
{
QString type = stringPairDrag::decodeKey( _de );
QString value = stringPairDrag::decodeValue( _de );
if( type == "samplefile" )
{
setAudioFile( value );
castModel<audioFileProcessor>()->setAudioFile( value );
_de->accept();
return;
}
else if( type == QString( "tco_%1" ).arg( track::SAMPLE_TRACK ) )
else if( type == QString( "tco_%1" ).arg( track::SampleTrack ) )
{
multimediaProject mmp( value, FALSE );
setAudioFile( mmp.content().firstChild().toElement().
attribute( "src" ) );
castModel<audioFileProcessor>()->setAudioFile( mmp.content().
firstChild().toElement().attribute( "src" ) );
_de->accept();
return;
}
@@ -383,15 +494,16 @@ void audioFileProcessor::dropEvent( QDropEvent * _de )
void audioFileProcessor::paintEvent( QPaintEvent * )
void audioFileProcessorView::paintEvent( QPaintEvent * )
{
QPainter p( this );
p.drawPixmap( 0, 0, *s_artwork );
audioFileProcessor * a = castModel<audioFileProcessor>();
QString file_name = "";
Uint16 idx = m_sampleBuffer.audioFile().length();
Uint16 idx = a->m_sampleBuffer.audioFile().length();
p.setFont( pointSize<8>( font() ) );
@@ -402,7 +514,7 @@ void audioFileProcessor::paintEvent( QPaintEvent * )
while( idx > 0 &&
fm.size( Qt::TextSingleLine, file_name + "..." ).width() < 210 )
{
file_name = m_sampleBuffer.audioFile()[--idx] + file_name;
file_name = a->m_sampleBuffer.audioFile()[--idx] + file_name;
}
if( idx > 0 )
@@ -418,11 +530,11 @@ void audioFileProcessor::paintEvent( QPaintEvent * )
p.setPen( QColor( 0xFF, 0xAA, 0x00 ) );
const QRect graph_rect( 4, 174, 241, 70 );
const f_cnt_t frames = tMax( m_sampleBuffer.frames(),
const f_cnt_t frames = tMax( a->m_sampleBuffer.frames(),
static_cast<f_cnt_t>( 1 ) );
const Uint16 start_frame_x = m_sampleBuffer.startFrame() *
const Uint16 start_frame_x = a->m_sampleBuffer.startFrame() *
graph_rect.width() / frames;
const Uint16 end_frame_x = m_sampleBuffer.endFrame() *
const Uint16 end_frame_x = a->m_sampleBuffer.endFrame() *
( graph_rect.width() - 1 ) / frames;
p.drawLine( start_frame_x + graph_rect.x(), graph_rect.y(),
@@ -437,13 +549,14 @@ void audioFileProcessor::paintEvent( QPaintEvent * )
void audioFileProcessor::sampleUpdated( void )
void audioFileProcessorView::sampleUpdated( void )
{
m_graph = QPixmap( 245, 75 );
m_graph.fill( Qt::transparent );
QPainter p( &m_graph );
p.setPen( QColor( 64, 255, 160 ) );
m_sampleBuffer.visualize( p, QRect( 2, 2, m_graph.width() - 4,
castModel<audioFileProcessor>()->m_sampleBuffer.
visualize( p, QRect( 2, 2, m_graph.width() - 4,
m_graph.height() - 4 ) );
update();
}
@@ -451,108 +564,43 @@ void audioFileProcessor::sampleUpdated( void )
void audioFileProcessor::reverseBtnToggled( bool _on )
void audioFileProcessorView::openAudioFile( void )
{
m_sampleBuffer.setReversed( _on );
engine::getSongEditor()->setModified();
}
void audioFileProcessor::ampKnobChanged( float _val )
{
m_sampleBuffer.setAmplification( _val / 100.0f );
}
void audioFileProcessor::startKnobChanged( float _new_value )
{
if( _new_value < m_endKnob->value() )
{
m_sampleBuffer.setStartFrame( static_cast<Uint32>( _new_value *
m_sampleBuffer.frames() ) );
}
else
{
m_startKnob->setValue( m_endKnob->value() - 0.01f );
}
update();
}
void audioFileProcessor::endKnobChanged( float _new_value )
{
if( _new_value > m_startKnob->value() )
{
if( _new_value * m_sampleBuffer.frames() >= 1.0f )
{
m_sampleBuffer.setEndFrame( static_cast<Uint32>(
_new_value *
m_sampleBuffer.frames() ) - 1 );
}
else
{
m_sampleBuffer.setEndFrame( 0 );
}
}
else
{
m_endKnob->setValue( m_startKnob->value() + 0.01f );
}
update();
}
void audioFileProcessor::openAudioFile( void )
{
QString af = m_sampleBuffer.openAudioFile();
QString af = castModel<audioFileProcessor>()->m_sampleBuffer.
openAudioFile();
if( af != "" )
{
setAudioFile( af );
engine::getSongEditor()->setModified();
castModel<audioFileProcessor>()->setAudioFile( af );
engine::getSong()->setModified();
}
}
audioFileProcessor::subPluginFeatures::subPluginFeatures(
plugin::pluginTypes _type ) :
plugin::descriptor::subPluginFeatures( _type )
void audioFileProcessorView::modelChanged( void )
{
audioFileProcessor * a = castModel<audioFileProcessor>();
connect( &a->m_sampleBuffer, SIGNAL( sampleUpdated() ),
this, SLOT( sampleUpdated() ) );
m_ampKnob->setModel( &a->m_ampModel );
m_startKnob->setModel( &a->m_startPointModel );
m_endKnob->setModel( &a->m_endPointModel );
m_reverseButton->setModel( &a->m_reverseModel );
m_loopButton->setModel( &a->m_loopModel );
sampleUpdated();
}
const QStringList & audioFileProcessor::subPluginFeatures::supported_extensions(
void )
{
static QStringList extensions = QStringList()
<< "wav" << "ogg" << "ds" << "spx" << "au"
<< "voc" << "aif" << "aiff" << "flac" << "raw";
return( extensions );
}
extern "C"
{
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
plugin * lmms_plugin_main( model *, void * _data )
{
return( new audioFileProcessor(
static_cast<instrumentTrack *>( _data ) ) );

View File

@@ -30,13 +30,12 @@
#include <QtGui/QPixmap>
#include "instrument.h"
#include "instrument_view.h"
#include "sample_buffer.h"
#include "volume_knob.h"
#include "pixmap_button.h"
class knob;
class pixmapButton;
class volumeKnob;
class audioFileProcessor : public instrument
{
@@ -45,19 +44,14 @@ public:
class subPluginFeatures : public plugin::descriptor::subPluginFeatures
{
public:
subPluginFeatures( plugin::pluginTypes _type );
subPluginFeatures( plugin::PluginTypes _type );
virtual const QStringList & supportedExtensions( void )
{
return( supported_extensions() );
}
static const QStringList & supported_extensions( void );
virtual const QStringList & supportedExtensions( void );
} ;
audioFileProcessor( instrumentTrack * _channel_track );
audioFileProcessor( instrumentTrack * _instrument_track );
virtual ~audioFileProcessor();
virtual void FASTCALL playNote( notePlayHandle * _n,
@@ -80,18 +74,49 @@ public:
return( 128 );
}
virtual pluginView * instantiateView( QWidget * _parent );
public slots:
void setAudioFile( const QString & _audio_file, bool _rename = TRUE );
private slots:
void reverseModelChanged( void );
void ampModelChanged( void );
void startPointModelChanged( void );
void endPointModelChanged( void );
private:
typedef sampleBuffer::handleState handleState;
sampleBuffer m_sampleBuffer;
knobModel m_ampModel;
knobModel m_startPointModel;
knobModel m_endPointModel;
boolModel m_reverseModel;
boolModel m_loopModel;
friend class audioFileProcessorView;
} ;
class audioFileProcessorView : public instrumentView
{
Q_OBJECT
public:
audioFileProcessorView( instrument * _instrument, QWidget * _parent );
virtual ~audioFileProcessorView();
protected slots:
void openAudioFile( void );
void reverseBtnToggled( bool _on );
void ampKnobChanged( float _new_value );
void startKnobChanged( float _new_value );
void endKnobChanged( float _new_value );
void sampleUpdated( void );
void openAudioFile( void );
protected:
@@ -101,13 +126,10 @@ protected:
private:
typedef sampleBuffer::handleState handleState;
virtual void modelChanged( void );
static QPixmap * s_artwork;
sampleBuffer m_sampleBuffer;
QPixmap m_graph;
volumeKnob * m_ampKnob;
knob * m_startKnob;
@@ -116,10 +138,9 @@ private:
pixmapButton * m_reverseButton;
pixmapButton * m_loopButton;
void updateSample( void );
} ;
#endif

View File

@@ -11,7 +11,7 @@ AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="bassbooster"
$(MOC) -o $@ $<
MOC_FILES = ./bassbooster_control_dialog.moc
MOC_FILES = ./bassbooster_controls.moc
BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h
EMBEDDED_RESOURCES = $(wildcard *png)
@@ -30,6 +30,8 @@ pkglib_LTLIBRARIES= libbassbooster.la
libbassbooster_la_SOURCES = bass_booster.cpp \
bass_booster.h \
bassbooster_controls.cpp \
bassbooster_controls.h \
bassbooster_control_dialog.cpp \
bassbooster_control_dialog.h

View File

@@ -1,7 +1,7 @@
/*
* bass_booster.cpp - bass-booster-effect-plugin
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -24,6 +24,7 @@
#include "bass_booster.h"
#include "automatable_model_templates.h"
#undef SINGLE_SOURCE_COMPILE
@@ -51,10 +52,11 @@ plugin::descriptor bassbooster_plugin_descriptor =
bassBoosterEffect::bassBoosterEffect(
bassBoosterEffect::bassBoosterEffect( model * _parent,
const descriptor::subPluginFeatures::key * _key ) :
effect( &bassbooster_plugin_descriptor, _key ),
m_bbFX( effectLib::fastBassBoost<>( 70.0f, 1.0f, 2.8f ) )
effect( &bassbooster_plugin_descriptor, _parent, _key ),
m_bbFX( effectLib::fastBassBoost<>( 70.0f, 1.0f, 2.8f ) ),
m_bbControls( this )
{
}
@@ -71,7 +73,7 @@ bassBoosterEffect::~bassBoosterEffect()
bool FASTCALL bassBoosterEffect::processAudioBuffer( surroundSampleFrame * _buf,
const fpp_t _frames )
{
if( isBypassed() || !isRunning () )
if( !isEnabled() || !isRunning () )
{
return( FALSE );
}
@@ -114,9 +116,9 @@ extern "C"
{
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
plugin * lmms_plugin_main( model * _parent, void * _data )
{
return( new bassBoosterEffect(
return( new bassBoosterEffect( _parent,
static_cast<const plugin::descriptor::subPluginFeatures::key *>(
_data ) ) );
}

View File

@@ -1,7 +1,7 @@
/*
* bass_booster.h - bass-booster-effect-plugin
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,34 +33,32 @@
#include "effect_lib.h"
#include "engine.h"
#include "main_window.h"
#include "bassbooster_control_dialog.h"
#include "bassbooster_controls.h"
class bassBoosterEffect : public effect
{
public:
bassBoosterEffect( const descriptor::subPluginFeatures::key * _key );
bassBoosterEffect( model * _parent,
const descriptor::subPluginFeatures::key * _key );
virtual ~bassBoosterEffect();
virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf,
const fpp_t _frames );
inline virtual QString nodeName( void ) const
{
return( "bassboostereffect" );
}
virtual inline effectControlDialog * createControlDialog( track * )
virtual effectControls * getControls( void )
{
return( new bassBoosterControlDialog(
NULL /*engine::getMainWindow()->workspace()*/,
this ) );
return( &m_bbControls );
}
private:
effectLib::monoToStereoAdaptor<effectLib::fastBassBoost<> > m_bbFX;
friend class bassBoosterControlDialog;
bassBoosterControls m_bbControls;
friend class bassBoosterControls;
} ;

View File

@@ -1,7 +1,7 @@
/*
* bassbooster_control_dialog.cpp - control-dialog for bassbooster-effect
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -25,126 +25,35 @@
#include <QtGui/QLayout>
#include "bass_booster.h"
#include "knob.h"
#include "bassbooster_control_dialog.h"
#include "bassbooster_controls.h"
bassBoosterControlDialog::bassBoosterControlDialog( QWidget * _parent,
bassBoosterEffect * _eff ) :
effectControlDialog( _parent, _eff ),
m_effect( _eff )
bassBoosterControlDialog::bassBoosterControlDialog(
bassBoosterControls * _controls ) :
effectControlDialog( _controls )
{
QHBoxLayout * l = new QHBoxLayout( this );
m_freqKnob = new knob( knobBright_26, this, tr( "Frequency" ), NULL );
m_freqKnob->setRange( 50.0f, 200.0f, 1.0f );
m_freqKnob->setInitValue( 100.0f );
m_freqKnob->setLabel( tr( "FREQ" ) );
m_freqKnob->setHintText( tr( "Frequency:" ) + " ", "Hz" );
connect( m_freqKnob, SIGNAL( valueChanged( float ) ),
this, SLOT( changeFrequency( void ) ) );
knob * freqKnob = new knob( knobBright_26, this, tr( "Frequency" ) );
freqKnob->setModel( &_controls->m_freqModel );
freqKnob->setLabel( tr( "FREQ" ) );
freqKnob->setHintText( tr( "Frequency:" ) + " ", "Hz" );
m_gainKnob = new knob( knobBright_26, this, tr( "Gain" ), NULL );
m_gainKnob->setRange( 0.1f, 5.0f, 0.1f );
m_gainKnob->setInitValue( 1.0f );
m_gainKnob->setLabel( tr( "GAIN" ) );
m_gainKnob->setHintText( tr( "Gain:" ) + " ", "" );
connect( m_gainKnob, SIGNAL( valueChanged( float ) ),
this, SLOT( changeGain( void ) ) );
knob * gainKnob = new knob( knobBright_26, this, tr( "Gain" ) );
gainKnob->setModel( &_controls->m_gainModel );
gainKnob->setLabel( tr( "GAIN" ) );
gainKnob->setHintText( tr( "Gain:" ) + " ", "" );
m_ratioKnob = new knob( knobBright_26, this, tr( "Ratio" ), NULL );
m_ratioKnob->setRange( 0.1f, 10.0f, 0.1f );
m_ratioKnob->setInitValue( 2.0f );
m_ratioKnob->setLabel( tr( "RATIO" ) );
m_ratioKnob->setHintText( tr( "Ratio:" ) + " ", "" );
connect( m_ratioKnob, SIGNAL( valueChanged( float ) ),
this, SLOT( changeRatio( void ) ) );
knob * ratioKnob = new knob( knobBright_26, this, tr( "Ratio" ) );
ratioKnob->setModel( &_controls->m_ratioModel );
ratioKnob->setLabel( tr( "RATIO" ) );
ratioKnob->setHintText( tr( "Ratio:" ) + " ", "" );
l->addWidget( m_freqKnob );
l->addWidget( m_gainKnob );
l->addWidget( m_ratioKnob );
changeFrequency();
changeGain();
changeRatio();
l->addWidget( freqKnob );
l->addWidget( gainKnob );
l->addWidget( ratioKnob );
}
void bassBoosterControlDialog::changeFrequency( void )
{
m_effect->m_bbFX.leftFX().setFrequency( m_freqKnob->value() );
m_effect->m_bbFX.rightFX().setFrequency( m_freqKnob->value() );
}
void bassBoosterControlDialog::changeGain( void )
{
m_effect->m_bbFX.leftFX().setGain( m_gainKnob->value() );
m_effect->m_bbFX.rightFX().setGain( m_gainKnob->value() );
}
void bassBoosterControlDialog::changeRatio( void )
{
m_effect->m_bbFX.leftFX().setRatio( m_ratioKnob->value() );
m_effect->m_bbFX.rightFX().setRatio( m_ratioKnob->value() );
}
/*
void bassBoosterControlDialog::updateEffect( void )
{
//m_effect->m_bbFX = effectLib::bassBoost<>( m_freqKnob->value(),
// m_gainKnob->value(), m_ratioKnob->value() );
m_effect->m_bbFX = effectLib::monoToStereoAdaptor<
effectLib::bassBoost<> >(
effectLib::bassBoost<>( m_freqKnob->value(),
m_gainKnob->value(), m_ratioKnob->value(),
m_effect->m_bbFX.leftFX() ),
effectLib::bassBoost<>( m_freqKnob->value(),
m_gainKnob->value(), m_ratioKnob->value(),
m_effect->m_bbFX.rightFX() )
);
m_effect->m_bbFX.leftFX().setSelectivity( m_freqKnob->value() );
m_effect->m_bbFX.rightFX().setSelectivity( m_freqKnob->value() );
m_effect->m_bbFX.leftFX().setGain( m_gainKnob->value() );
m_effect->m_bbFX.rightFX().setGain( m_gainKnob->value() );
m_effect->m_bbFX.leftFX().setRatio( m_ratioKnob->value() );
m_effect->m_bbFX.rightFX().setRatio( m_ratioKnob->value() );
}
*/
void FASTCALL bassBoosterControlDialog::loadSettings(
const QDomElement & _this )
{
m_freqKnob->setValue( _this.attribute( "freq" ).toFloat() );
m_gainKnob->setValue( _this.attribute( "gain" ).toFloat() );
m_ratioKnob->setValue( _this.attribute( "ratio" ).toFloat() );
}
void FASTCALL bassBoosterControlDialog::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
_this.setAttribute( "freq", m_freqKnob->value() );
_this.setAttribute( "gain", m_gainKnob->value() );
_this.setAttribute( "ratio", m_ratioKnob->value() );
}
#include "bassbooster_control_dialog.moc"

View File

@@ -1,7 +1,7 @@
/*
* bassbooster_control_dialog.h - control-dialog for bassbooster-effect
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,45 +27,18 @@
#include "effect_control_dialog.h"
class knob;
class bassBoosterEffect;
class bassBoosterControls;
class bassBoosterControlDialog : public effectControlDialog
{
Q_OBJECT
public:
bassBoosterControlDialog( QWidget * _parent, bassBoosterEffect * _eff );
bassBoosterControlDialog( bassBoosterControls * _controls );
virtual ~bassBoosterControlDialog()
{
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "bassboostercontrols" );
}
virtual ch_cnt_t getControlCount( void )
{
return( 3 );
}
private slots:
void changeFrequency( void );
void changeGain( void );
void changeRatio( void );
private:
bassBoosterEffect * m_effect;
knob * m_freqKnob;
knob * m_gainKnob;
knob * m_ratioKnob;
} ;
#endif

View File

@@ -0,0 +1,104 @@
/*
* bassbooster_controls.cpp - controls for bassbooster-effect
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "bassbooster_controls.h"
#include "bass_booster.h"
#include "automatable_model_templates.h"
bassBoosterControls::bassBoosterControls( bassBoosterEffect * _eff ) :
effectControls( _eff ),
m_effect( _eff ),
m_freqModel( 100.0f, 50.0f, 200.0f, 1.0f, this ),
m_gainModel( 1.0f, 0.1f, 5.0f, 0.05f, this ),
m_ratioModel( 2.0f, 0.1f, 10.0f, 0.1f, this )
{
connect( &m_freqModel, SIGNAL( dataChanged( void ) ),
this, SLOT( changeFrequency( void ) ) );
connect( &m_gainModel, SIGNAL( dataChanged( void ) ),
this, SLOT( changeGain( void ) ) );
connect( &m_ratioModel, SIGNAL( dataChanged( void ) ),
this, SLOT( changeRatio( void ) ) );
changeFrequency();
changeGain();
changeRatio();
}
void bassBoosterControls::changeFrequency( void )
{
m_effect->m_bbFX.leftFX().setFrequency( m_freqModel.value() );
m_effect->m_bbFX.rightFX().setFrequency( m_freqModel.value() );
}
void bassBoosterControls::changeGain( void )
{
m_effect->m_bbFX.leftFX().setGain( m_gainModel.value() );
m_effect->m_bbFX.rightFX().setGain( m_gainModel.value() );
}
void bassBoosterControls::changeRatio( void )
{
m_effect->m_bbFX.leftFX().setRatio( m_ratioModel.value() );
m_effect->m_bbFX.rightFX().setRatio( m_ratioModel.value() );
}
void bassBoosterControls::loadSettings( const QDomElement & _this )
{
m_freqModel.setValue( _this.attribute( "freq" ).toFloat() );
m_gainModel.setValue( _this.attribute( "gain" ).toFloat() );
m_ratioModel.setValue( _this.attribute( "ratio" ).toFloat() );
}
void bassBoosterControls::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
_this.setAttribute( "freq", m_freqModel.value() );
_this.setAttribute( "gain", m_gainModel.value() );
_this.setAttribute( "ratio", m_ratioModel.value() );
}
#include "bassbooster_controls.moc"

View File

@@ -0,0 +1,79 @@
/*
* bassbooster_controls.h - controls for bassbooster-effect
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _BASSBOOSTER_CONTROLS_H
#define _BASSBOOSTER_CONTROLS_H
#include "effect_controls.h"
#include "bassbooster_control_dialog.h"
#include "knob.h"
class bassBoosterEffect;
class bassBoosterControls : public effectControls
{
Q_OBJECT
public:
bassBoosterControls( bassBoosterEffect * _eff );
virtual ~bassBoosterControls()
{
}
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "bassboostercontrols" );
}
virtual ch_cnt_t getControlCount( void )
{
return( 3 );
}
virtual effectControlDialog * createView( void )
{
return( new bassBoosterControlDialog( this ) );
}
private slots:
void changeFrequency( void );
void changeGain( void );
void changeRatio( void );
private:
bassBoosterEffect * m_effect;
knobModel m_freqModel;
knobModel m_gainModel;
knobModel m_ratioModel;
friend class bassBoosterControlDialog;
} ;
#endif

View File

@@ -11,7 +11,7 @@ AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="bitinvader"
$(MOC) -o $@ $<
MOC_FILES = ./bit_invader.moc ./graph.moc
MOC_FILES = ./bit_invader.moc
BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h
EMBEDDED_RESOURCES = $(wildcard *png)
@@ -28,6 +28,6 @@ CLEANFILES = $(MOC_FILES) ./embedded_resources.h
pkglib_LTLIBRARIES = libbitinvader.la
libbitinvader_la_SOURCES = bit_invader.cpp bit_invader.h graph.cpp graph.h
libbitinvader_la_SOURCES = bit_invader.cpp bit_invader.h
$(libbitinvader_la_SOURCES): ./embedded_resources.h

View File

@@ -43,6 +43,7 @@ using namespace std;
#include "song_editor.h"
#include "templates.h"
#include "tooltip.h"
#include "song.h"
#undef SINGLE_SOURCE_COMPILE
#include "embed.cpp"
@@ -65,8 +66,6 @@ plugin::descriptor bitinvader_plugin_descriptor =
}
QPixmap * bitInvader::s_artwork = NULL;
bSynth::bSynth( float * shape, int length, float _pitch, bool _interpolation,
float factor, const sample_rate_t _sample_rate )
@@ -113,19 +112,19 @@ sample_t bSynth::nextStringSample( void )
if (interpolation) {
// find position in shape
int a = static_cast<int>(sample_realindex);
int b;
if (a < (sample_length-1)) {
b = static_cast<int>(sample_realindex+1);
} else {
b = 0;
}
// Nachkommaanteil
float frac = sample_realindex - static_cast<int>(sample_realindex);
sample = sample_shape[a]*(1-frac) + sample_shape[b]*(frac);
// find position in shape
int a = static_cast<int>(sample_realindex);
int b;
if (a < (sample_length-1)) {
b = static_cast<int>(sample_realindex+1);
} else {
b = 0;
}
// Nachkommaanteil
float frac = sample_realindex - static_cast<int>(sample_realindex);
sample = sample_shape[a]*(1-frac) + sample_shape[b]*(frac);
} else {
// No interpolation
@@ -136,8 +135,6 @@ sample_t bSynth::nextStringSample( void )
// progress in shape
sample_realindex += sample_step;
// cout << sample_index << "\t";
return sample;
}
@@ -151,275 +148,25 @@ sample_t bSynth::nextStringSample( void )
bitInvader::bitInvader( instrumentTrack * _channel_track ) :
instrument( _channel_track,
&bitinvader_plugin_descriptor )
instrument( _channel_track, &bitinvader_plugin_descriptor ),
m_sampleLength( 128, 8, 128, 1, this ),
m_graph( -1.0f, 1.0f, 128, this ),
m_interpolation( FALSE, this ),
m_normalize( FALSE, this)
{
m_graph.setWaveToSine();
m_graph = NULL;
normalize = false;
interpolation = false;
if( s_artwork == NULL )
{
s_artwork = new QPixmap( PLUGIN_NAME::getIconPixmap(
"artwork" ) );
}
connect( &m_sampleLength, SIGNAL( dataChanged( ) ),
this, SLOT( lengthChanged( ) )
);
m_sampleLengthKnob = new knob( knobDark_28, this, tr( "Samplelength" ),
_channel_track );
m_sampleLengthKnob->setRange( 8, 128, 1 );
m_sampleLengthKnob->setInitValue( 128 );
m_sampleLengthKnob->move( 10, 120 );
m_sampleLengthKnob->setHintText( tr( "Sample Length" ) + " ", "" );
connect( m_sampleLengthKnob, SIGNAL( valueChanged( float ) ),
this, SLOT ( sampleSizeChanged( float ) )
);
m_interpolationToggle = new ledCheckBox( "Interpolation", this,
tr( "Interpolation" ),
_channel_track );
m_interpolationToggle->move( 55,80 );
connect( m_interpolationToggle, SIGNAL( toggled( bool ) ),
this, SLOT ( interpolationToggle( bool ) ) );
m_normalizeToggle = new ledCheckBox( "Normalize", this,
tr( "Normalize" ),
_channel_track );
m_normalizeToggle->move( 55, 100 );
connect( m_normalizeToggle, SIGNAL( toggled( bool ) ),
this, SLOT ( normalizeToggle( bool ) ) );
m_graph = new graph( this );
m_graph->move(53,118); // 55,120 - 2px border
m_graph->setCursor( QCursor( Qt::CrossCursor ) );
toolTip::add( m_graph, tr ( "Draw your own waveform here"
"by dragging your mouse onto this graph"
));
QPixmap p = PLUGIN_NAME::getIconPixmap("wavegraph3") ;
m_graph->setBackground( p );
connect( m_graph, SIGNAL ( sampleSizeChanged( float ) ),
this, SLOT (sampleSizeChanged( float ) ) );
connect( m_graph, SIGNAL ( sampleChanged( void ) ),
this, SLOT ( sampleChanged( void ) ) );
sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ),
_channel_track );
sinWaveBtn->move( 188, 120 );
sinWaveBtn->setActiveGraphic( embed::getIconPixmap(
"sin_wave_active" ) );
sinWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"sin_wave_inactive" ) );
toolTip::add( sinWaveBtn,
tr( "Click here if you want a sine-wave for "
"current oscillator." ) );
triangleWaveBtn = new pixmapButton( this, tr( "Triangle wave" ),
_channel_track );
triangleWaveBtn->move( 188, 136 );
triangleWaveBtn->setActiveGraphic(
embed::getIconPixmap( "triangle_wave_active" ) );
triangleWaveBtn->setInactiveGraphic(
embed::getIconPixmap( "triangle_wave_inactive" ) );
toolTip::add( triangleWaveBtn,
tr( "Click here if you want a triangle-wave "
"for current oscillator." ) );
sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ),
_channel_track );
sawWaveBtn->move( 188, 152 );
sawWaveBtn->setActiveGraphic( embed::getIconPixmap(
"saw_wave_active" ) );
sawWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"saw_wave_inactive" ) );
toolTip::add( sawWaveBtn,
tr( "Click here if you want a saw-wave for "
"current oscillator." ) );
sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ),
_channel_track );
sqrWaveBtn->move( 188, 168 );
sqrWaveBtn->setActiveGraphic( embed::getIconPixmap(
"square_wave_active" ) );
sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"square_wave_inactive" ) );
toolTip::add( sqrWaveBtn,
tr( "Click here if you want a square-wave for "
"current oscillator." ) );
whiteNoiseWaveBtn = new pixmapButton( this,
tr( "White noise wave" ),
_channel_track );
whiteNoiseWaveBtn->move( 188, 184 );
whiteNoiseWaveBtn->setActiveGraphic(
embed::getIconPixmap( "white_noise_wave_active" ) );
whiteNoiseWaveBtn->setInactiveGraphic(
embed::getIconPixmap( "white_noise_wave_inactive" ) );
toolTip::add( whiteNoiseWaveBtn,
tr( "Click here if you want a white-noise for "
"current oscillator." ) );
usrWaveBtn = new pixmapButton( this, tr( "User defined wave" ),
_channel_track );
usrWaveBtn->move( 188, 200 );
usrWaveBtn->setActiveGraphic( embed::getIconPixmap(
"usr_wave_active" ) );
usrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"usr_wave_inactive" ) );
toolTip::add( usrWaveBtn,
tr( "Click here if you want a user-defined "
"wave-shape for current oscillator." ) );
connect( sinWaveBtn, SIGNAL (clicked ( void ) ),
this, SLOT ( sinWaveClicked( void ) ) );
connect( triangleWaveBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( triangleWaveClicked( void ) ) );
connect( sawWaveBtn, SIGNAL (clicked ( void ) ),
this, SLOT ( sawWaveClicked( void ) ) );
connect( sqrWaveBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( sqrWaveClicked( void ) ) );
connect( whiteNoiseWaveBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( noiseWaveClicked( void ) ) );
connect( usrWaveBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( usrWaveClicked( void ) ) );
smoothBtn = new pixmapButton( this, tr( "Smooth" ),
_channel_track );
smoothBtn->move( 55, 225 );
smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"smooth" ) );
smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"smooth" ) );
smoothBtn->setChecked( TRUE );
toolTip::add( smoothBtn,
tr( "Click here to "
"smooth waveform." ) );
connect( smoothBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( smoothClicked( void ) ) );
setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
"artwork" ) );
setPalette( pal );
sample_length = 128;
sample_shape = new float[128];
m_graph->setSamplePointer( sample_shape, sample_length );
emit( sinWaveClicked() );
connect( &m_graph, SIGNAL( samplesChanged( Uint32, Uint32 ) ),
this, SLOT( samplesChanged( Uint32, Uint32 ) ) );
}
void bitInvader::sinWaveClicked( void )
{
// generate a Sinus wave using static oscillator-method
for (int i=0; i < sample_length; i++)
{
sample_shape[i] = oscillator::sinSample( i / static_cast<float>(
sample_length ) );
}
sampleChanged();
}
void bitInvader::triangleWaveClicked( void )
{
// generate a Triangle wave using static oscillator-method
for (int i=0; i < sample_length; i++)
{
sample_shape[i] = oscillator::triangleSample( i /
static_cast<float>( sample_length) );
}
sampleChanged();
}
void bitInvader::sawWaveClicked( void )
{
// generate a Saw wave using static oscillator-method
for (int i=0; i < sample_length; i++)
{
sample_shape[i] = oscillator::sawSample( i / static_cast<float>(
sample_length ) );
}
sampleChanged();
}
void bitInvader::sqrWaveClicked( void )
{
// generate a Sqr wave using static oscillator-method
for (int i=0; i < sample_length; i++)
{
sample_shape[i] = oscillator::squareSample( i /
static_cast<float>( sample_length ) );
}
sampleChanged();
}
void bitInvader::noiseWaveClicked( void )
{
// generate a Noise wave using static oscillator-method
for (int i=0; i < sample_length; i++)
{
sample_shape[i] = oscillator::noiseSample( i /
static_cast<float>( sample_length ) );
}
sampleChanged();
}
void bitInvader::usrWaveClicked( void )
{
// zero sample_shape
for (int i = 0; i < sample_length; i++)
{
sample_shape[i] = 0;
}
// load user shape
sampleBuffer buffer;
QString af = buffer.openAudioFile();
if ( af != "" )
{
buffer.setAudioFile( af );
// copy buffer data
sample_length = min( sample_length, static_cast<int>(
buffer.frames() ) );
for ( int i = 0; i < sample_length; i++ )
{
sample_shape[i] = (float)*buffer.data()[i];
}
}
sampleChanged();
}
bitInvader::~bitInvader()
{
}
@@ -434,21 +181,20 @@ void bitInvader::saveSettings( QDomDocument & _doc, QDomElement & _this )
_this.setAttribute( "version", "0.1" );
// Save sample length
m_sampleLengthKnob->saveSettings( _doc, _this, "sampleLength" );
m_sampleLength.saveSettings( _doc, _this, "sampleLength" );
// Save sample shape base64-encoded
QString sampleString;
base64::encode( (const char *)sample_shape,
sample_length * sizeof(float), sampleString );
base64::encode( (const char *)m_graph.samples(),
m_graph.length() * sizeof(float), sampleString );
_this.setAttribute( "sampleShape", sampleString );
// save LED normalize
m_interpolationToggle->saveSettings( _doc, _this, "interpolation" );
m_interpolation.saveSettings( _doc, _this, "interpolation" );
// save LED
m_normalizeToggle->saveSettings( _doc, _this, "normalize" );
m_normalize.saveSettings( _doc, _this, "normalize" );
}
@@ -457,89 +203,71 @@ void bitInvader::saveSettings( QDomDocument & _doc, QDomElement & _this )
void bitInvader::loadSettings( const QDomElement & _this )
{
// Load sample length
m_sampleLengthKnob->loadSettings( _this, "sampleLength" );
m_sampleLength.loadSettings( _this, "sampleLength" );
sample_length = (int)m_sampleLengthKnob->value();
int sampleLength = (int)m_sampleLength.value();
// Load sample shape
delete[] sample_shape;
sample_shape = new float[sample_length];
int size = 0;
char * dst = 0;
base64::decode( _this.attribute( "sampleShape"), &dst, &size );
memcpy( sample_shape, dst, tMin<int>( size, sample_length *
sizeof( float ) ) );
m_graph.setLength( size );
m_graph.setSamples( (float*) dst );
delete[] dst;
m_graph->setSamplePointer( sample_shape, sample_length );
// Load LED normalize
m_interpolationToggle->loadSettings( _this, "interpolation" );
m_interpolation.loadSettings( _this, "interpolation" );
// Load LED
m_normalizeToggle->loadSettings( _this, "normalize" );
update();
m_normalize.loadSettings( _this, "normalize" );
// songEditor::inst()->setModified();
}
void bitInvader::interpolationToggle( bool value )
void bitInvader::lengthChanged( void )
{
interpolation = value;
m_graph.setLength( m_sampleLength.value() );
engine::getSongEditor()->setModified();
normalize();
}
void bitInvader::normalizeToggle( bool value )
void bitInvader::samplesChanged( Uint32 _begin, Uint32 _end )
{
normalize = value;
engine::getSongEditor()->setModified();
normalize();
//engine::getSongEditor()->setModified();
}
void bitInvader::normalize( void )
{
// analyze
float max = 0;
const float* samples = m_graph.samples();
for (int i=0; i < m_graph.length(); i++)
{
if (fabsf(samples[i]) > max) { max = fabs(samples[i]); }
}
normalizeFactor = 1.0 / max;
}
QString bitInvader::nodeName( void ) const
{
return( bitinvader_plugin_descriptor.name );
}
void bitInvader::smoothClicked( void )
{
// store values in temporary array
float* temp = new float[sample_length];
memcpy( temp, sample_shape, sizeof( float ) * sample_length );
// Smoothing
sample_shape[0] = ( temp[0]+temp[sample_length-1] ) * 0.5f;
for ( int i=1; i < sample_length; i++)
{
sample_shape[i] = (temp[i-1] + temp[i]) * 0.5f;
}
// Clean up
delete[] temp;
// paint
update();
m_graph->update();
engine::getSongEditor()->setModified();
}
void bitInvader::playNote( notePlayHandle * _n, bool )
{
if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )
{
float factor;
if( !normalize )
if( !m_normalize.value() )
{
factor = 1.0f;
}
@@ -548,8 +276,9 @@ void bitInvader::playNote( notePlayHandle * _n, bool )
factor = normalizeFactor;
}
_n->m_pluginData = new bSynth( sample_shape, sample_length,
_n->frequency(), interpolation, factor,
_n->m_pluginData = new bSynth( const_cast<float*>( m_graph.samples() ),
m_graph.length(),
_n->frequency(), m_interpolation.value(), factor,
engine::getMixer()->sampleRate() );
}
@@ -574,85 +303,248 @@ void bitInvader::playNote( notePlayHandle * _n, bool )
}
void bitInvader::deleteNotePluginData( notePlayHandle * _n )
{
delete static_cast<bSynth *>( _n->m_pluginData );
}
void bitInvader::sampleSizeChanged( float _new_sample_length )
pluginView * bitInvader::instantiateView( QWidget * _parent )
{
int new_sample_length = static_cast<int>(_new_sample_length);
// ** grow array
if (new_sample_length > sample_length) {
// store values in temporary array
float* temp = new float[sample_length];
for (int i=0; i < sample_length; i++)
{
temp[i] = sample_shape[i];
}
// reinitialize sample array
delete[] sample_shape;
sample_shape = new float[new_sample_length];
for (int i=0; i < new_sample_length; i++)
{
sample_shape[i] = 0;
}
// fill in old values
for (int i=0; i < sample_length; i++)
{
sample_shape[i] = temp[i];
}
delete[] temp;
sample_length = new_sample_length;
}
// ** shrink array
if (new_sample_length < sample_length) {
sample_length = new_sample_length;
}
// update sample graph
m_graph->setSamplePointer( sample_shape, sample_length );
// set Song modified
engine::getSongEditor()->setModified();
}
void bitInvader::sampleChanged()
{
// analyze
float max = 0;
for (int i=0; i < sample_length; i++)
{
if (fabsf(sample_shape[i]) > max) { max = fabs(sample_shape[i]); }
}
normalizeFactor = 1.0 / max;
// update
if (m_graph != NULL) {
m_graph->update();
}
engine::getSongEditor()->setModified();
return( new bitInvaderView( this, _parent ) );
}
bitInvaderView::bitInvaderView( instrument * _instrument,
QWidget * _parent ) :
instrumentView( _instrument, _parent )
{
setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
"artwork" ) );
setPalette( pal );
m_sampleLengthKnob = new knob( knobDark_28, this, tr( "Samplelength" ) );
m_sampleLengthKnob->move( 10, 120 );
m_sampleLengthKnob->setHintText( tr( "Sample Length" ) + " ", "" );
m_graph = new graph( this );
m_graph->move(53,118); // 55,120 - 2px border
m_graph->setAutoFillBackground( TRUE );
toolTip::add( m_graph, tr ( "Draw your own waveform here"
"by dragging your mouse onto this graph"
));
pal = QPalette();
pal.setBrush( backgroundRole(),
PLUGIN_NAME::getIconPixmap("wavegraph3") );
m_graph->setPalette( pal );
sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ) );
sinWaveBtn->move( 188, 120 );
sinWaveBtn->setActiveGraphic( embed::getIconPixmap(
"sin_wave_active" ) );
sinWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"sin_wave_inactive" ) );
toolTip::add( sinWaveBtn,
tr( "Click here if you want a sine-wave for "
"current oscillator." ) );
triangleWaveBtn = new pixmapButton( this, tr( "Triangle wave" ) );
triangleWaveBtn->move( 188, 136 );
triangleWaveBtn->setActiveGraphic(
embed::getIconPixmap( "triangle_wave_active" ) );
triangleWaveBtn->setInactiveGraphic(
embed::getIconPixmap( "triangle_wave_inactive" ) );
toolTip::add( triangleWaveBtn,
tr( "Click here if you want a triangle-wave "
"for current oscillator." ) );
sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ) );
sawWaveBtn->move( 188, 152 );
sawWaveBtn->setActiveGraphic( embed::getIconPixmap(
"saw_wave_active" ) );
sawWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"saw_wave_inactive" ) );
toolTip::add( sawWaveBtn,
tr( "Click here if you want a saw-wave for "
"current oscillator." ) );
sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ) );
sqrWaveBtn->move( 188, 168 );
sqrWaveBtn->setActiveGraphic( embed::getIconPixmap(
"square_wave_active" ) );
sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"square_wave_inactive" ) );
toolTip::add( sqrWaveBtn,
tr( "Click here if you want a square-wave for "
"current oscillator." ) );
whiteNoiseWaveBtn = new pixmapButton( this,
tr( "White noise wave" ) );
whiteNoiseWaveBtn->move( 188, 184 );
whiteNoiseWaveBtn->setActiveGraphic(
embed::getIconPixmap( "white_noise_wave_active" ) );
whiteNoiseWaveBtn->setInactiveGraphic(
embed::getIconPixmap( "white_noise_wave_inactive" ) );
toolTip::add( whiteNoiseWaveBtn,
tr( "Click here if you want a white-noise for "
"current oscillator." ) );
usrWaveBtn = new pixmapButton( this, tr( "User defined wave" ) );
usrWaveBtn->move( 188, 200 );
usrWaveBtn->setActiveGraphic( embed::getIconPixmap(
"usr_wave_active" ) );
usrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"usr_wave_inactive" ) );
toolTip::add( usrWaveBtn,
tr( "Click here if you want a user-defined "
"wave-shape for current oscillator." ) );
smoothBtn = new pixmapButton( this, tr( "Smooth" ) );
smoothBtn->move( 55, 225 );
smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"smooth" ) );
smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"smooth" ) );
smoothBtn->setChecked( TRUE );
toolTip::add( smoothBtn,
tr( "Click here to "
"smooth waveform." ) );
m_interpolationToggle = new ledCheckBox( "Interpolation", this,
tr( "Interpolation" ) );
m_interpolationToggle->move( 55,80 );
m_normalizeToggle = new ledCheckBox( "Normalize", this,
tr( "Normalize" ) );
m_normalizeToggle->move( 55, 100 );
connect( sinWaveBtn, SIGNAL (clicked ( void ) ),
this, SLOT ( sinWaveClicked( void ) ) );
connect( triangleWaveBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( triangleWaveClicked( void ) ) );
connect( sawWaveBtn, SIGNAL (clicked ( void ) ),
this, SLOT ( sawWaveClicked( void ) ) );
connect( sqrWaveBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( sqrWaveClicked( void ) ) );
connect( whiteNoiseWaveBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( noiseWaveClicked( void ) ) );
connect( usrWaveBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( usrWaveClicked( void ) ) );
connect( smoothBtn, SIGNAL ( clicked ( void ) ),
this, SLOT ( smoothClicked( void ) ) );
connect( m_interpolationToggle, SIGNAL( toggled( bool ) ),
this, SLOT ( interpolationToggled( bool ) ) );
connect( m_normalizeToggle, SIGNAL( toggled( bool ) ),
this, SLOT ( normalizeToggled( bool ) ) );
}
void bitInvaderView::modelChanged( void )
{
bitInvader * b = castModel<bitInvader>();
m_graph->setModel( &b->m_graph );
m_sampleLengthKnob->setModel( &b->m_sampleLength );
m_interpolationToggle->setModel( &b->m_interpolation );
m_normalizeToggle->setModel( &b->m_normalize );
}
void bitInvaderView::sinWaveClicked( void )
{
m_graph->model()->setWaveToSine();
engine::getSong()->setModified();
}
void bitInvaderView::triangleWaveClicked( void )
{
m_graph->model()->setWaveToTriangle();
engine::getSong()->setModified();
}
void bitInvaderView::sawWaveClicked( void )
{
m_graph->model()->setWaveToSaw();
engine::getSong()->setModified();
}
void bitInvaderView::sqrWaveClicked( void )
{
m_graph->model()->setWaveToSquare();
engine::getSong()->setModified();
}
void bitInvaderView::noiseWaveClicked( void )
{
m_graph->model()->setWaveToNoise();
engine::getSong()->setModified();
}
void bitInvaderView::usrWaveClicked( void )
{
/*
m_graph->model()->setWaveToNoise();
engine::getSong()->setModified();
// zero sample_shape
for (int i = 0; i < sample_length; i++)
{
sample_shape[i] = 0;
}
// load user shape
sampleBuffer buffer;
QString af = buffer.openAudioFile();
if ( af != "" )
{
buffer.setAudioFile( af );
// copy buffer data
sample_length = min( sample_length, static_cast<int>(
buffer.frames() ) );
for ( int i = 0; i < sample_length; i++ )
{
sample_shape[i] = (float)*buffer.data()[i];
}
}
sampleChanged();
*/
}
void bitInvaderView::smoothClicked( void )
{
m_graph->model()->smooth();
engine::getSong()->setModified();
}
void bitInvaderView::interpolationToggled( bool value )
{
engine::getSong()->setModified();
}
void bitInvaderView::normalizeToggled( bool value )
{
engine::getSong()->setModified();
}
extern "C"
{
@@ -668,5 +560,4 @@ plugin * lmms_plugin_main( void * _data )
#include "bit_invader.moc"

View File

@@ -29,15 +29,15 @@
#include "instrument.h"
#include "instrument_view.h"
#include "types.h"
#include "graph.h"
#include "knob.h"
#include "pixmap_button.h"
#include "led_checkbox.h"
class QPixmap;
class graph;
class knob;
class ledCheckBox;
class oscillator;
class pixmapButton;
class bitInvaderView;
class bSynth
{
@@ -83,29 +83,59 @@ public:
return( 64 );
}
virtual pluginView * instantiateView( QWidget * _parent );
public slots:
void sampleSizeChanged( float _new_sample_length );
void sampleChanged( void );
protected slots:
void lengthChanged( void );
void samplesChanged( Uint32, Uint32 );
void interpolationToggle( bool value );
void normalizeToggle( bool value );
void smoothClicked( void );
void normalize( void );
void sinWaveClicked( void );
void triangleWaveClicked( void );
void sqrWaveClicked( void );
void sawWaveClicked( void );
void noiseWaveClicked( void );
void usrWaveClicked( void );
/*
protected:
virtual void paintEvent( QPaintEvent * );
*/
private:
knob * m_sampleLengthKnob;
knobModel m_sampleLength;
graphModel m_graph;
boolModel m_interpolation;
boolModel m_normalize;
float normalizeFactor;
oscillator * m_osc;
friend class bitInvaderView;
} ;
class bitInvaderView : public instrumentView
{
Q_OBJECT
public:
bitInvaderView( instrument * _instrument,
QWidget * _parent );
virtual ~bitInvaderView() {};
protected slots:
//void sampleSizeChanged( float _new_sample_length );
void interpolationToggled( bool value );
void normalizeToggled( bool value );
void sinWaveClicked( void );
void triangleWaveClicked( void );
void sqrWaveClicked( void );
void sawWaveClicked( void );
void noiseWaveClicked( void );
void usrWaveClicked( void );
void smoothClicked( void );
private:
virtual void modelChanged( void );
knob * m_sampleLengthKnob;
pixmapButton * sinWaveBtn;
pixmapButton * triangleWaveBtn;
pixmapButton * sqrWaveBtn;
@@ -120,17 +150,8 @@ private:
ledCheckBox * m_interpolationToggle;
ledCheckBox * m_normalizeToggle;
int sample_length;
float* sample_shape;
bool interpolation;
bool normalize;
float normalizeFactor;
oscillator * m_osc;
} ;
#endif

View File

@@ -1,221 +0,0 @@
/*
* graph.cpp - a QT widget for displaying and manipulating waveforms
*
* Copyright (c) 2006-2007 Andreas Brandmaier <andy/at/brandmaier/dot/de>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include <QtGui/QPaintEvent>
#include <QtGui/QFontMetrics>
#include <QtGui/QPainter>
#include "graph.h"
#include "string_pair_drag.h"
#include "sample_buffer.h"
#include <iostream>
#include <cstdlib>
using namespace std;
graph::graph( QWidget * _parent ) :
QWidget( _parent )
{
// m_background = 0; TODO
m_mouseDown = false;
setFixedSize( 132, 104 );
setAcceptDrops( TRUE );
}
graph::~graph()
{
}
void graph::setBackground( const QPixmap &_pixmap )
{
m_background = _pixmap;
}
void graph::setSamplePointer( float * _pointer, int _length )
{
samplePointer = _pointer;
sampleLength = _length;
update();
}
void graph::loadSampleFromFile( const QString & _filename )
{
// zero sample_shape
for (int i = 0; i < sampleLength; i++)
{
samplePointer[i] = 0;
}
// load user shape
sampleBuffer buffer( _filename );
// copy buffer data
sampleLength = min( sampleLength, static_cast<int>(buffer.frames()) );
for ( int i = 0; i < sampleLength; i++ )
{
samplePointer[i] = (float)*buffer.data()[i];
}
}
void graph::mouseMoveEvent ( QMouseEvent * _me )
{
// get position
int x = _me->x();
int y = _me->y();
// avoid mouse leaps
int diff = x - m_lastCursorX;
if (diff >= 1) {
x = m_lastCursorX + 1;
} else if (diff <= 1) {
x = m_lastCursorX - 1;
} else {
x = m_lastCursorX;
}
changeSampleAt( x, y );
// update mouse
m_lastCursorX = x;
}
void graph::mousePressEvent( QMouseEvent * _me )
{
// toggle mouse state
m_mouseDown = true;
// get position
int x = _me->x();
int y = _me->y();
changeSampleAt( x,y );
// toggle mouse state
m_mouseDown = true;
setCursor( Qt::BlankCursor );
m_lastCursorX = x;
}
void graph::changeSampleAt(int _x, int _y)
{
// consider border of background image
_x -= 2;
_y -= 2;
// boundary check
if (_x < 0) { return; }
if (_x > sampleLength) { return; }
if (_y < 0) { return; }
if (_y >= 100) { return; }
_y = 100 - _y;
// change sample shape
samplePointer[_x] = (_y-50.0)/50.0;
emit sampleChanged();
}
void graph::mouseReleaseEvent( QMouseEvent * _me )
{
// toggle mouse state
m_mouseDown = false;
setCursor( Qt::ArrowCursor );
update();
}
void graph::paintEvent( QPaintEvent * )
{
QPainter p( this );
// if (m_background != NULL) {
p.drawPixmap( 0, 0, m_background );
// }
p.setPen( QColor( 0xFF, 0xAA, 0x00 ) );
p.drawLine( 1+sampleLength, 2, 1+sampleLength, 102);
// float xscale = 200.0 / sampleLength;
float xscale = 1.0;
for (int i=0; i < sampleLength-1; i++)
{
p.drawLine(2+static_cast<int>(i*xscale),
2+static_cast<int>(-samplePointer[i]*50) + 50,
2+static_cast<int>((i+1)*xscale),
2+static_cast<int>(-samplePointer[i+1]*50 + 50)
);
}
// draw Pointer
if (m_mouseDown) {
QPoint cursor = mapFromGlobal( QCursor::pos() );
p.setPen( QColor( 0xAA, 0xFF, 0x00 ) );
p.drawLine( 2, cursor.y(), 130, cursor.y() );
p.drawLine( cursor.x(), 2, cursor.x(), 102 );
}
}
void graph::dropEvent( QDropEvent * _de )
{
QString type = stringPairDrag::decodeKey( _de );
QString value = stringPairDrag::decodeValue( _de );
if( type == "samplefile" )
{
loadSampleFromFile( value );
_de->accept();
}
}
void graph::dragEnterEvent( QDragEnterEvent * _dee )
{
if( stringPairDrag::processDragEnterEvent( _dee,
QString( "samplefile" ) ) == FALSE )
{
_dee->ignore();
}
}
#include "graph.moc"

View File

@@ -1,72 +0,0 @@
/*
* graph.h - a QT widget for displaying and manipulating waveforms
*
* Copyright (c) 2006-2007 Andreas Brandmaier <andy/at/brandmaier/dot/de>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _GRAPH_H
#define _GRAPH_H
#include <QtGui/QWidget>
#include <QtGui/QPixmap>
#include <QtGui/QCursor>
class graph : public QWidget
{
Q_OBJECT
public:
graph( QWidget * _parent );
virtual ~graph();
void setSamplePointer( float * pointer, int length );
void setBackground ( const QPixmap & _pixmap );
void loadSampleFromFile( const QString & _filename );
signals:
void sampleSizeChanged( float f );
void sampleChanged( void );
protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void dropEvent( QDropEvent * _de );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
private:
void changeSampleAt(int _x, int _y);
QPixmap m_background;
float *samplePointer;
int sampleLength;
bool m_mouseDown;
int m_lastCursorX;
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* flp_import.cpp - support for importing FLP-files
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -30,7 +30,6 @@
#include <QtCore/QBuffer>
#include "flp_import.h"
#include "arp_and_chords_tab_widget.h"
#include "basic_filters.h"
#include "bb_editor.h"
#include "bb_track.h"
@@ -38,18 +37,17 @@
#include "config_mgr.h"
#include "debug.h"
#include "engine.h"
#include "envelope_tab_widget.h"
#include "envelope_and_lfo_widget.h"
#include "group_box.h"
#include "instrument.h"
#include "instrument_track.h"
#include "envelope_and_lfo_parameters.h"
#include "knob.h"
#include "oscillator.h"
#include "pattern.h"
#include "piano_widget.h"
#include "piano.h"
#include "project_journal.h"
#include "project_notes.h"
#include "song_editor.h"
#include "song.h"
#include "tempo_sync_knob.h"
#include "track_container.h"
@@ -232,7 +230,7 @@ bool flpImport::tryImport( trackContainer * _tc )
int ev_cnt = 0;
engine::getSongEditor()->clearProject();
engine::getSong()->clearProject();
const bool is_journ = engine::getProjectJournal()->isJournalling();
engine::getProjectJournal()->setJournalling( FALSE );
@@ -314,7 +312,7 @@ bool flpImport::tryImport( trackContainer * _tc )
case FLP_MainVol:
printf( "main-volume: %d\n", data );
engine::getSongEditor()->setMasterVolume(
engine::getSong()->setMasterVolume(
static_cast<volume>( data * 100 /
128 ) );
break;
@@ -345,12 +343,12 @@ bool flpImport::tryImport( trackContainer * _tc )
printf( "new channel\n" );
it = dynamic_cast<instrumentTrack *>(
track::create( track::INSTRUMENT_TRACK, engine::getBBEditor() ) );
track::create( track::InstrumentTrack, engine::getBBTrackContainer() ) );
assert( it != NULL );
i_tracks.push_back( it );
it_inst = it->loadInstrument(
"audiofileprocessor" );
it->toggledInstrumentTrackButton( FALSE );
// it->toggledInstrumentTrackButton( FALSE );
// reset some values
step_pattern = 0;
@@ -365,7 +363,7 @@ bool flpImport::tryImport( trackContainer * _tc )
case FLP_Tempo:
printf( "tempo: %d\n", data );
engine::getSongEditor()->setTempo( data );
engine::getSong()->setTempo( data );
break;
case FLP_CurrentPatNum:
@@ -398,7 +396,7 @@ bool flpImport::tryImport( trackContainer * _tc )
break;
case FLP_MainPitch:
engine::getSongEditor()->setMasterPitch( data );
engine::getSong()->setMasterPitch( data );
break;
case FLP_Resonance:
@@ -460,8 +458,7 @@ bool flpImport::tryImport( trackContainer * _tc )
case FLP_MiddleNote:
data += 8;
it->setBaseNote( data );
it->getPianoWidget()->update();
it->baseNoteModel()->setValue( data );
break;
case FLP_DelayReso:
@@ -602,27 +599,27 @@ bool flpImport::tryImport( trackContainer * _tc )
case FLP_ChanParams:
{
const arpAndChordsTabWidget::arpDirections
const arpeggiator::ArpDirections
mappedArpDir[] =
{
arpAndChordsTabWidget::UP,
arpAndChordsTabWidget::UP,
arpAndChordsTabWidget::DOWN,
arpAndChordsTabWidget::UP_AND_DOWN,
arpAndChordsTabWidget::UP_AND_DOWN,
arpAndChordsTabWidget::RANDOM
arpeggiator::ArpDirUp,
arpeggiator::ArpDirUp,
arpeggiator::ArpDirDown,
arpeggiator::ArpDirUpAndDown,
arpeggiator::ArpDirUpAndDown,
arpeggiator::ArpDirRandom
} ;
const Uint32 * p = (const Uint32 *) text;
arpAndChordsTabWidget * actw = it->m_arpWidget;
actw->m_arpDirectionBtnGrp->setValue(
arpeggiator * arp = &it->m_arpeggiator;
arp->m_arpDirectionModel.setValue(
mappedArpDir[p[10]] );
actw->m_arpRangeKnob->setValue( p[11] );
actw->m_arpComboBox->setValue( p[12] );
actw->m_arpTimeKnob->setValue( p[13] / 8.0f );
arp->m_arpRangeModel.setValue( p[11] );
arp->m_arpModel.setValue( p[12] );
arp->m_arpTimeModel.setValue( p[13] / 8.0f );
//// 100.0f );
actw->m_arpGateKnob->setValue( p[14] * 100.0f /
arp->m_arpGateModel.setValue( p[14] * 100.0f /
48.0f );
actw->m_arpGroupBox->setState( p[10] > 0 );
arp->m_arpEnabledModel.setValue( p[10] > 0 );
printf( "channel params: " );
dump_mem( text, text_len );
//printf( "channel params: arpdir: %d range: %d time: %d gate: %d\n", p[10], p[11], p[13], p[14] );
@@ -634,36 +631,36 @@ bool flpImport::tryImport( trackContainer * _tc )
const Uint32 * p = (const Uint32 *) text;
printf( "envelope and lfo params: " );
dump_mem( text, text_len );
envelopeTabWidget * etw = it->m_envWidget;
envelopeAndLFOWidget * elw = NULL;
instrumentSoundShaping * iss = &it->m_soundShaping;
envelopeAndLFOParameters * elp = NULL;
switch( env_lfo_target )
{
case 1:
elw = etw->m_envLFOWidgets[envelopeTabWidget::VOLUME];
break;
elp = iss->m_envLFOParameters[instrumentSoundShaping::Volume];
break;
case 2:
elw = etw->m_envLFOWidgets[envelopeTabWidget::CUT];
break;
elp = iss->m_envLFOParameters[instrumentSoundShaping::Cut];
break;
case 3:
elw = etw->m_envLFOWidgets[envelopeTabWidget::RES];
break;
elp = iss->m_envLFOParameters[instrumentSoundShaping::Resonance];
break;
default:
break;
}
++env_lfo_target;
if( elw == NULL )
if( elp == NULL )
{
break;
}
const float scaling = 0.8f / 65536.0f;
elw->m_predelayKnob->setValue( p[2] * scaling );
elw->m_attackKnob->setValue( p[3] * scaling );
elw->m_holdKnob->setValue( p[4] * scaling );
elw->m_decayKnob->setValue( p[5] * scaling );
elw->m_sustainKnob->setValue( p[6] * scaling );
elw->m_releaseKnob->setValue( p[7] * scaling );
elw->m_amountKnob->setValue( p[1] ? 1 : 0 );
elw->updateSampleVars();
elp->m_predelayModel.setValue( p[2] * scaling );
elp->m_attackModel.setValue( p[3] * scaling );
elp->m_holdModel.setValue( p[4] * scaling );
elp->m_decayModel.setValue( p[5] * scaling );
elp->m_sustainModel.setValue( p[6] * scaling );
elp->m_releaseModel.setValue( p[7] * scaling );
elp->m_amountModel.setValue( p[1] ? 1 : 0 );
elp->updateSampleVars();
break;
}
@@ -684,24 +681,24 @@ bool flpImport::tryImport( trackContainer * _tc )
basicFilters<>::SIMPLE_FLT_CNT
} ;
Uint32 * p = (Uint32 *) text;
envelopeTabWidget * etw = it->m_envWidget;
instrumentSoundShaping * iss = &it->m_soundShaping;
/* printf( "filter values: " );
for( int i = 0; i < 6; ++i )
{
printf( "%d ", ((Sint32*)text)[i] );
}
printf( "\n" );*/
etw->m_filterComboBox->setValue(
iss->m_filterModel.setValue(
mappedFilter[p[5]] );
etw->m_filterCutKnob->setValue( p[3] / 255.0f *
( etw->m_filterCutKnob->maxValue() -
etw->m_filterCutKnob->minValue() ) +
etw->m_filterCutKnob->minValue() );
etw->m_filterResKnob->setValue( p[4] / 1024.0f *
( etw->m_filterResKnob->maxValue() -
etw->m_filterResKnob->minValue() ) +
etw->m_filterResKnob->minValue() );
etw->m_filterGroupBox->setState( p[3] < 256 );
iss->m_filterCutModel.setValue( p[3] / 255.0f *
( iss->m_filterCutModel.maxValue() -
iss->m_filterCutModel.minValue() ) +
iss->m_filterCutModel.minValue() );
iss->m_filterResModel.setValue( p[4] / 1024.0f *
( iss->m_filterResModel.maxValue() -
iss->m_filterResModel.minValue() ) +
iss->m_filterResModel.minValue() );
iss->m_filterEnabledModel.setValue( p[3] < 256 );
break;
}
@@ -786,10 +783,9 @@ bool flpImport::tryImport( trackContainer * _tc )
const int ch = ( *it ) >> 16;
const int pat = ( ( *it ) & 0xffff ) / 16;
const int pos = ( ( ( *it ) & 0xffff ) % 16 ) * 4;
while( engine::getBBEditor()->numOfBBs() <= pat )
while( engine::getBBTrackContainer()->numOfBBs() <= pat )
{
track::create( track::BB_TRACK,
engine::getSongEditor() );
track::create( track::BBTrack, engine::getSong() );
}
pattern * p = dynamic_cast<pattern *>(
i_tracks[ch]->getTCO( pat ) );
@@ -811,10 +807,9 @@ bool flpImport::tryImport( trackContainer * _tc )
{
continue;
}
while( engine::getBBEditor()->numOfBBs() <= pat )
while( engine::getBBTrackContainer()->numOfBBs() <= pat )
{
track::create( track::BB_TRACK,
engine::getSongEditor() );
track::create( track::BBTrack, engine::getSong() );
qApp->processEvents( QEventLoop::AllEvents, 100 );
}
pattern * p = dynamic_cast<pattern *>(
@@ -834,10 +829,9 @@ bool flpImport::tryImport( trackContainer * _tc )
{
continue;
}
while( engine::getBBEditor()->numOfBBs() <= pat_num )
while( engine::getBBTrackContainer()->numOfBBs() <= pat_num )
{
track::create( track::BB_TRACK,
engine::getSongEditor() );
track::create( track::BBTrack, engine::getSong() );
qApp->processEvents( QEventLoop::AllEvents, 100 );
}
@@ -846,9 +840,9 @@ bool flpImport::tryImport( trackContainer * _tc )
tco->movePosition( midiTime( ( ( *it ) & 0xffff ) * 64 ) );
}
if( project_cur_pat < engine::getBBEditor()->numOfBBs() )
if( project_cur_pat < engine::getBBTrackContainer()->numOfBBs() )
{
engine::getBBEditor()->setCurrentBB( project_cur_pat );
engine::getBBTrackContainer()->setCurrentBB( project_cur_pat );
}
engine::getProjectJournal()->setJournalling( is_journ );
@@ -869,21 +863,21 @@ bool flpImport::processPluginParams( const flPlugins _plugin,
{
case FL_Plugin_3x_Osc:
{
const oscillator::waveShapes mapped_3xOsc_Shapes[] =
const oscillator::WaveShapes mapped_3xOsc_Shapes[] =
{
oscillator::SIN_WAVE,
oscillator::TRIANGLE_WAVE,
oscillator::SQUARE_WAVE,
oscillator::SAW_WAVE,
oscillator::SQUARE_WAVE, // square-sin
oscillator::WHITE_NOISE_WAVE,
oscillator::USER_DEF_WAVE
oscillator::SineWave,
oscillator::TriangleWave,
oscillator::SquareWave,
oscillator::SawWave,
oscillator::SquareWave, // square-sin
oscillator::WhiteNoise,
oscillator::UserDefinedWave
} ;
QDomDocument dd;
QDomElement de = dd.createElement( _i->nodeName() );
de.setAttribute( "modalgo1", oscillator::MIX );
de.setAttribute( "modalgo2", oscillator::MIX );
de.setAttribute( "modalgo1", oscillator::SignalMix );
de.setAttribute( "modalgo2", oscillator::SignalMix );
for( Uint8 i = 0; i < 3; ++i )
{
const Sint32 * d = (const Sint32 *)( _data +

View File

@@ -1,7 +1,7 @@
/*
* flp_import.h - support for importing FLP-files
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -169,6 +169,11 @@ public:
flpImport( const QString & _file );
virtual ~flpImport();
virtual pluginView * instantiateView( QWidget * )
{
return( NULL );
}
private:
virtual bool tryImport( trackContainer * _tc );

View File

@@ -1,7 +1,7 @@
/*
* kicker.cpp - bassdrum-synthesizer
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -32,6 +32,7 @@
#include "knob.h"
#include "note_play_handle.h"
#include "sweep_oscillator.h"
#include "automatable_model_templates.h"
#undef SINGLE_SOURCE_COMPILE
#include "embed.cpp"
@@ -57,58 +58,13 @@ plugin::descriptor kicker_plugin_descriptor =
kickerInstrument::kickerInstrument( instrumentTrack * _instrument_track ) :
instrument( _instrument_track, &kicker_plugin_descriptor )
instrument( _instrument_track, &kicker_plugin_descriptor ),
m_startFreqModel( 150.0f, 5.0f, 1000.0f, 1.0f, this ),
m_endFreqModel( 40.0f, 5.0f, 1000.0f, 1.0f, this ),
m_decayModel( 120.0f, 5.0f, 1000.0f, 1.0f, this ),
m_distModel( 0.8f, 0.0f, 100.0f, 0.1f, this ),
m_gainModel( 1.0f, 0.1f, 5.0f, 0.05f, this )
{
QVBoxLayout * vl = new QVBoxLayout( this );
QHBoxLayout * hl = new QHBoxLayout;
m_startFreqKnob = new knob( knobDark_28, this, tr( "Start frequency" ),
_instrument_track );
m_startFreqKnob->setRange( 5.0f, 1000.0f, 1.0f );
m_startFreqKnob->setInitValue( 150.0f );
m_startFreqKnob->setLabel( tr( "START" ) );
m_startFreqKnob->setHintText( tr( "Start frequency:" ) + " ", "Hz" );
m_endFreqKnob = new knob( knobDark_28, this, tr( "End frequency" ),
_instrument_track );
m_endFreqKnob->setRange( 5.0f, 1000.0f, 1.0f );
m_endFreqKnob->setInitValue( 40.0f );
m_endFreqKnob->setLabel( tr( "END" ) );
m_endFreqKnob->setHintText( tr( "End frequency:" ) + " ", "Hz" );
m_decayKnob = new knob( knobDark_28, this, tr( "Decay" ),
_instrument_track );
m_decayKnob->setRange( 5.0f, 1000.0f, 1.0f );
m_decayKnob->setInitValue( 120.0f );
m_decayKnob->setLabel( tr( "DECAY" ) );
m_decayKnob->setHintText( tr( "Decay:" ) + " ", "ms" );
m_distKnob = new knob( knobDark_28, this, tr( "Distortion" ),
_instrument_track );
m_distKnob->setRange( 0.0f, 100.0f, 0.1f );
m_distKnob->setInitValue( 0.8f );
m_distKnob->setLabel( tr( "DIST" ) );
m_distKnob->setHintText( tr( "Distortion:" ) + " ", "" );
m_gainKnob = new knob( knobDark_28, this, tr( "Gain" ),
_instrument_track );
m_gainKnob->setRange( 0.1f, 5.0f, 0.05f );
m_gainKnob->setInitValue( 1.0f );
m_gainKnob->setLabel( tr( "GAIN" ) );
m_gainKnob->setHintText( tr( "Gain:" ) + " ", "" );
hl->addWidget( m_startFreqKnob );
hl->addWidget( m_endFreqKnob );
hl->addWidget( m_decayKnob );
hl->addWidget( m_distKnob );
hl->addWidget( m_gainKnob );
vl->addLayout( hl );
setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
"artwork" ) );
setPalette( pal );
}
@@ -124,11 +80,11 @@ kickerInstrument::~kickerInstrument()
void kickerInstrument::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
m_startFreqKnob->saveSettings( _doc, _this, "startfreq" );
m_endFreqKnob->saveSettings( _doc, _this, "endfreq" );
m_decayKnob->saveSettings( _doc, _this, "decay" );
m_distKnob->saveSettings( _doc, _this, "dist" );
m_gainKnob->saveSettings( _doc, _this, "gain" );
m_startFreqModel.saveSettings( _doc, _this, "startfreq" );
m_endFreqModel.saveSettings( _doc, _this, "endfreq" );
m_decayModel.saveSettings( _doc, _this, "decay" );
m_distModel.saveSettings( _doc, _this, "dist" );
m_gainModel.saveSettings( _doc, _this, "gain" );
}
@@ -136,11 +92,11 @@ void kickerInstrument::saveSettings( QDomDocument & _doc,
void kickerInstrument::loadSettings( const QDomElement & _this )
{
m_startFreqKnob->loadSettings( _this, "startfreq" );
m_endFreqKnob->loadSettings( _this, "endfreq" );
m_decayKnob->loadSettings( _this, "decay" );
m_distKnob->loadSettings( _this, "dist" );
m_gainKnob->loadSettings( _this, "gain" );
m_startFreqModel.loadSettings( _this, "startfreq" );
m_endFreqModel.loadSettings( _this, "endfreq" );
m_decayModel.loadSettings( _this, "decay" );
m_distModel.loadSettings( _this, "dist" );
m_gainModel.loadSettings( _this, "gain" );
}
@@ -160,15 +116,15 @@ typedef sweepOscillator<effectLib::monoToStereoAdaptor<distFX> > sweepOsc;
void kickerInstrument::playNote( notePlayHandle * _n, bool )
{
const float decfr = m_decayKnob->value() *
const float decfr = m_decayModel.value() *
engine::getMixer()->sampleRate() / 1000.0f;
const f_cnt_t tfp = _n->totalFramesPlayed();
if ( tfp == 0 )
{
_n->m_pluginData = new sweepOsc(
distFX( m_distKnob->value(),
m_gainKnob->value() ) );
distFX( m_distModel.value(),
m_gainModel.value() ) );
}
else if( tfp > decfr && !_n->released() )
{
@@ -176,7 +132,7 @@ void kickerInstrument::playNote( notePlayHandle * _n, bool )
}
//const float freq = getInstrumentTrack()->frequency( _n ) / 2;
const float fdiff = m_endFreqKnob->value() - m_startFreqKnob->value();
const float fdiff = m_endFreqModel.value() - m_startFreqModel.value();
/* const fpp_t frames = _n->released() ?
tMax( tMin<f_cnt_t>( desiredReleaseFrames() -
_n->releaseFramesDone(),
@@ -184,8 +140,8 @@ void kickerInstrument::playNote( notePlayHandle * _n, bool )
:
engine::getMixer()->framesPerAudioBuffer();*/
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const float f1 = m_startFreqKnob->value() + tfp * fdiff / decfr;
const float f2 = m_startFreqKnob->value() + (frames+tfp-1)*fdiff/decfr;
const float f1 = m_startFreqModel.value() + tfp * fdiff / decfr;
const float f2 = m_startFreqModel.value() + (frames+tfp-1)*fdiff/decfr;
sampleFrame * buf = new sampleFrame[frames];
@@ -222,6 +178,76 @@ void kickerInstrument::deleteNotePluginData( notePlayHandle * _n )
pluginView * kickerInstrument::instantiateView( QWidget * _parent )
{
return( new kickerInstrumentView( this, _parent ) );
}
kickerInstrumentView::kickerInstrumentView( instrument * _instrument,
QWidget * _parent ) :
instrumentView( _instrument, _parent )
{
QVBoxLayout * vl = new QVBoxLayout( this );
QHBoxLayout * hl = new QHBoxLayout;
m_startFreqKnob = new knob( knobDark_28, this, tr( "Start frequency" ) );
m_startFreqKnob->setLabel( tr( "START" ) );
m_startFreqKnob->setHintText( tr( "Start frequency:" ) + " ", "Hz" );
m_endFreqKnob = new knob( knobDark_28, this, tr( "End frequency" ) );
m_endFreqKnob->setLabel( tr( "END" ) );
m_endFreqKnob->setHintText( tr( "End frequency:" ) + " ", "Hz" );
m_decayKnob = new knob( knobDark_28, this, tr( "Decay" ) );
m_decayKnob->setLabel( tr( "DECAY" ) );
m_decayKnob->setHintText( tr( "Decay:" ) + " ", "ms" );
m_distKnob = new knob( knobDark_28, this, tr( "Distortion" ) );
m_distKnob->setLabel( tr( "DIST" ) );
m_distKnob->setHintText( tr( "Distortion:" ) + " ", "" );
m_gainKnob = new knob( knobDark_28, this, tr( "Gain" ) );
m_gainKnob->setLabel( tr( "GAIN" ) );
m_gainKnob->setHintText( tr( "Gain:" ) + " ", "" );
hl->addWidget( m_startFreqKnob );
hl->addWidget( m_endFreqKnob );
hl->addWidget( m_decayKnob );
hl->addWidget( m_distKnob );
hl->addWidget( m_gainKnob );
vl->addLayout( hl );
setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
"artwork" ) );
setPalette( pal );
}
kickerInstrumentView::~kickerInstrumentView()
{
}
void kickerInstrumentView::modelChanged( void )
{
kickerInstrument * k = castModel<kickerInstrument>();
m_startFreqKnob->setModel( &k->m_startFreqModel );
m_endFreqKnob->setModel( &k->m_endFreqModel );
m_decayKnob->setModel( &k->m_decayModel );
m_distKnob->setModel( &k->m_distModel );
m_gainKnob->setModel( &k->m_gainModel );
}
@@ -229,7 +255,7 @@ extern "C"
{
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
plugin * lmms_plugin_main( model *, void * _data )
{
return( new kickerInstrument(
static_cast<instrumentTrack *>( _data ) ) );

Some files were not shown because too many files have changed in this diff Show More