improved undo/redo-system

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@109 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-03-21 13:42:28 +00:00
parent bf139a65e4
commit fe9dc8c391
88 changed files with 3327 additions and 772 deletions

View File

@@ -1,8 +1,84 @@
2006-03-19 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/track.cpp:
* src/core/track_container.cpp:
* src/tracks/pattern.cpp:
in loadSettings(): do not get confused by meta-data (journal etc.)
* src/lib/journalling_object.cpp:
- lot of bugfixes
- save/load data of journal-entry (QVariant) by encoding/decoding it
with base64
* include/base64.h:
* src/lib/base64.cpp:
support for encoding and decoding whole QVariant, independent of its
type (the result is one string, representing data of any type (int,
QMap, QVector QString...) - this is just awesome!!)
* src/tracks/instrument_track.cpp:
do not crash in several situations if instrument is not loaded for
some reason (e.g. invalid preset)
* src/core/track.cpp:
full support for undo/redo adding/removing a TCO (track-type
independent)
2006-03-18 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/main_window.cpp:
avoid layouting-errors when restore widget-state by showing widget
while moving it
* include/note.h:
* src/core/note.cpp:
undo/redo-support for note-properties
* most files:
- derive from journallingObject instead of settings and/or engineObject
- in saveSettings() do not create own node, instead directly set
attributes of passed dom-element
* include/journalling_object.h:
* src/lib/journalling_object.cpp:
- added saveSettings() and loadSettings()-method from former
settings-class
- new wrapper-functions around saveSettings() and loadSettings():
saveState()
restoreState()
-> objects do not have to create a new node on their own,
saveState() does it for them using nodeName() as node-name
-> journal of object is saved/restored automatically
* include/settings.h:
removed
2006-03-16 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/journalling_object.h:
- renamed from editable_object.h
- renamed editStep to journalEntry
- renamed editableObject to journallingObject
- renamed other method-names
* include/project_journal.h:
* src/lib/project_journal.cpp:
renamed editHistory to projectJournal and changed file-names
accordingly
* most files:
renamed class channelTrack to instrumentTrack and changed other
method-names to match new naming-convention
* include/instrument_track.h:
* src/tracks/instrument_track.cpp:
renamed channel_track.* to instrument_track.*
2006-03-16 Andreas Brandmaier <andreas/at/brandmaier/dot/de>
* plugins/organic/organic.cpp
* plugins/organic/organic.h
* plugins/organic/randomise.png
* plugins/organic/organic.cpp:
* plugins/organic/organic.h:
* plugins/organic/randomise.png:
added "randomise preset" button to organic plugin
2006-03-14 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>

View File

@@ -50,7 +50,7 @@ lmms_MOC = \
./automatable_button.moc \
./bb_editor.moc \
./bb_track.moc \
./channel_track.moc \
./instrument_track.moc \
./combobox.moc \
./config_mgr.moc \
./cpuload_widget.moc \
@@ -152,7 +152,8 @@ lmms_SOURCES = \
$(srcdir)/src/lib/base64.cpp \
$(srcdir)/src/lib/buffer_allocator.cpp \
$(srcdir)/src/lib/clipboard.cpp \
$(srcdir)/src/lib/edit_history.cpp \
$(srcdir)/src/lib/journalling_object.cpp \
$(srcdir)/src/lib/project_journal.cpp \
$(srcdir)/src/lib/embed.cpp \
$(srcdir)/src/lib/ladspa_manager.cpp \
$(srcdir)/src/lib/mmp.cpp \
@@ -166,7 +167,7 @@ lmms_SOURCES = \
$(srcdir)/src/midi/midi_oss.cpp \
$(srcdir)/src/midi/midi_port.cpp \
$(srcdir)/src/tracks/bb_track.cpp \
$(srcdir)/src/tracks/channel_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 \
@@ -209,7 +210,7 @@ lmms_SOURCES = \
$(srcdir)/include/interpolation.h \
$(srcdir)/include/mixer.h \
$(srcdir)/include/pattern.h \
$(srcdir)/include/channel_track.h \
$(srcdir)/include/instrument_track.h \
$(srcdir)/include/note.h \
$(srcdir)/include/volume.h \
$(srcdir)/include/panning.h \
@@ -220,7 +221,6 @@ lmms_SOURCES = \
$(srcdir)/include/piano_widget.h \
$(srcdir)/include/effect_board.h \
$(srcdir)/include/pixmap_button.h \
$(srcdir)/include/settings.h \
$(srcdir)/include/rename_dialog.h \
$(srcdir)/include/export_project_dialog.h \
$(srcdir)/include/note_play_handle.h \
@@ -300,8 +300,8 @@ lmms_SOURCES = \
$(srcdir)/include/rubberband.h \
$(srcdir)/include/base64.h \
$(srcdir)/include/automatable_object.h \
$(srcdir)/include/editable_object.h \
$(srcdir)/include/edit_history.h \
$(srcdir)/include/journalling_object.h \
$(srcdir)/include/project_journal.h \
$(srcdir)/include/import_filter.h \
$(srcdir)/include/engine.h \
$(srcdir)/include/qxembed.h

2
README
View File

@@ -108,7 +108,7 @@ or in the Wiki:
http://wiki.mindrules.net
Before coding a new big feature, please ALWAYS post your idea and suggestions
about your feature and about the actual implementation to the
about your feature and about the intended implementation to the
LMMS-devel-mailinglist (lmms-devel@lists.sourceforge.net) and wait for replies!
Maybe there're different ideas, improvements, hints or maybe your feature is
not welcome/needed at the moment (but for sure this will be very seldom).

10
TODO
View File

@@ -1,7 +1,9 @@
- implement editableSettingsObject
- unique id's for all editable objects
- add edit-history to project for making it possible to undo things even if you did them in a previous session
- make edit-history qobject and undo/redo slots -> direct connection to GUI
- font-size-scaling-coefficient in setup-dialog
- make note able of journalling
- before calling undoStep/redoStep from journallingObject, save journalling-state-context and disabled journalling, restore afterwards
- intelligent journal-entry-merging
- undo/redo-support in note/track etc.
- save tco-settings in trackContentWidget::saveSettings() etc. instead of track::...
- restore stacking-order of windows when loading project
- fix MIDI-import-filter
- bristol-bindings

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(lmms, 0.1.4-cvs20060314, tobydox/at/users/dot/sourceforge/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.1.4-cvs20060314)
AC_INIT(lmms, 0.1.4-cvs20060320, tobydox/at/users/dot/sourceforge/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.1.4-cvs20060320)
AM_CONFIG_HEADER(config.h)

View File

@@ -43,7 +43,7 @@
#include <config.h>
#endif
#include "settings.h"
#include "journalling_object.h"
#include "types.h"
#include "engine.h"
@@ -51,7 +51,7 @@
class QPixmap;
class automatableButtonGroup;
class channelTrack;
class instrumentTrack;
class comboBox;
class groupBox;
class knob;
@@ -62,12 +62,11 @@ class tempoSyncKnob;
const int MAX_CHORD_POLYPHONY = 10;
class arpAndChordsTabWidget : public QWidget, public settings,
public engineObject
class arpAndChordsTabWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
arpAndChordsTabWidget( channelTrack * _channel_track );
arpAndChordsTabWidget( instrumentTrack * _channel_track );
virtual ~arpAndChordsTabWidget();
static struct chord

View File

@@ -61,10 +61,15 @@ public:
virtual void setValue( const bool _on );
inline void setToggleButton( bool _on )
inline void setCheckable( bool _on )
{
m_toggleButton = _on;
setStepRecording( m_toggleButton );
m_checkable = _on;
setJournalling( m_checkable );
}
inline bool isCheckable( void ) const
{
return( m_checkable );
}
@@ -83,7 +88,7 @@ protected:
private:
automatableButtonGroup * m_group;
bool m_toggleButton;
bool m_checkable;
friend class automatableButtonGroup;

View File

@@ -28,12 +28,22 @@
#include <math.h>
#include "editable_object.h"
#include "journalling_object.h"
#include "templates.h"
#ifndef QT3
#include <Qt/QtXml>
#else
#include <qdom.h>
#endif
template<typename T, typename EDIT_STEP_TYPE = T>
class automatableObject : public editableObject
class automatableObject : public journallingObject
{
public:
typedef automatableObject<T, EDIT_STEP_TYPE> autoObj;
@@ -41,7 +51,7 @@ public:
automatableObject( engine * _engine, const T _val = 0, const T _min = 0,
const T _max = 0,
const T _step = defaultRelStep() ) :
editableObject( _engine ),
journallingObject( _engine ),
m_oldValue( _val ),
m_value( _val ),
m_minValue( _min ),
@@ -127,9 +137,9 @@ public:
inline virtual void setInitValue( const T _value )
{
saveStepRecordingState( FALSE );
saveJournallingState( FALSE );
setValue( _value );
restoreStepRecordingState();
restoreJournallingState();
}
inline virtual void setValue( const T _value )
@@ -140,10 +150,9 @@ public:
if( old_val != m_value )
{
// add changes to history so user can undo it
addStep( editStep( 0, static_cast<EDIT_STEP_TYPE>(
m_value ) -
static_cast<EDIT_STEP_TYPE>(
old_val ) ) );
addJournalEntry( journalEntry( 0,
static_cast<EDIT_STEP_TYPE>( m_value ) -
static_cast<EDIT_STEP_TYPE>( old_val ) ) );
// notify linked objects
@@ -158,10 +167,10 @@ public:
it->fittedValue( value() ) !=
it->value() )
{
it->saveStepRecordingState(
isRecordingSteps() );
it->saveJournallingState(
isJournalling() );
it->setValue( value() );
it->restoreStepRecordingState();
it->restoreJournallingState();
}
}
}
@@ -238,39 +247,57 @@ public:
_object2->linkObject( _object1 );
}
virtual QString nodeName( void ) const
{
return( "automatableobject" );
}
protected:
virtual void redoStep( const editStep & _edit_step )
virtual void redoStep( journalEntry & _je )
{
saveStepRecordingState( FALSE );
saveJournallingState( FALSE );
#ifndef QT3
setValue( static_cast<T>( value() +
_edit_step.data().value<EDIT_STEP_TYPE>() ) );
_je.data().value<EDIT_STEP_TYPE>() ) );
#else
setValue( static_cast<T>( value() + static_cast<EDIT_STEP_TYPE>(
_edit_step.data().toDouble() ) ) );
_je.data().toDouble() ) ) );
#endif
restoreStepRecordingState();
restoreJournallingState();
}
virtual void undoStep( const editStep & _edit_step )
virtual void undoStep( journalEntry & _je )
{
journalEntry je( _je.actionID(),
#ifndef QT3
redoStep( editStep( _edit_step.actionID(),
-_edit_step.data().value<EDIT_STEP_TYPE>() ) );
-_je.data().value<EDIT_STEP_TYPE>();
#else
redoStep( editStep( _edit_step.actionID(),
static_cast<EDIT_STEP_TYPE>(
-_edit_step.data().toDouble() ) ) );
static_cast<EDIT_STEP_TYPE>( -_je.data().toDouble() )
#endif
);
redoStep( je );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
_this.setAttribute( "value", value() );
}
virtual void FASTCALL loadSettings( const QDomElement & _this )
{
setValue( static_cast<T>(
_this.attribute( "value" ).toDouble() ) );
}
// most objects will need this temporarily
T m_oldValue;
inline void addStepFromOldToCurVal( void )
inline void addJournalEntryFromOldToCurVal( void )
{
addStep( editStep( 0, value() - m_oldValue ) );
addJournalEntry( journalEntry( 0, value() - m_oldValue ) );
}

View File

@@ -36,6 +36,9 @@
#endif
class QVariant;
namespace base64
{
#ifndef QT3
@@ -55,6 +58,9 @@ namespace base64
void encode( const char * _data, const int _size, QString & _dst );
void decode( const QString & _b64, char * * _data, int * _size );
#endif
QString encode( const QVariant & _data );
QVariant decode( const QString & _b64 );
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* clipboard.h - the clipboard for patterns, notes etc.
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -46,14 +46,14 @@
#endif
class settings;
class journallingObject;
namespace clipboard
{
typedef QMap<QString, QDomElement> map;
extern map content;
void FASTCALL copy( settings * _settings_object );
void FASTCALL copy( journallingObject * _object );
const QDomElement * FASTCALL getContent( const QString & _node_name );
} ;

View File

@@ -33,7 +33,7 @@
class dummyInstrument : public instrument
{
public:
inline dummyInstrument( channelTrack * _channel_track ) :
inline dummyInstrument( instrumentTrack * _channel_track ) :
instrument( _channel_track, NULL )
{
}

View File

@@ -27,7 +27,7 @@
#define _ENGINE_H
class bbEditor;
class editHistory;
class projectJournal;
class mainWindow;
class mixer;
class pianoRoll;
@@ -92,9 +92,9 @@ public:
return( m_projectNotes );
}
inline editHistory * getEditHistory( void )
inline projectJournal * getProjectJournal( void )
{
return( m_editHistory );
return( m_projectJournal );
}
@@ -107,7 +107,7 @@ private:
bbEditor * m_bbEditor;
pianoRoll * m_pianoRoll;
projectNotes * m_projectNotes;
editHistory * m_editHistory;
projectJournal * m_projectJournal;
} ;

View File

@@ -49,7 +49,7 @@
#endif
#include "settings.h"
#include "journalling_object.h"
#include "types.h"
#include "spc_bg_hndl_widget.h"
#include "sample_buffer.h"
@@ -67,9 +67,8 @@ class tempoSyncKnob;
class envelopeAndLFOWidget : public QWidget, public settings,
public specialBgHandlingWidget,
public engineObject
class envelopeAndLFOWidget : public QWidget, public journallingObject,
public specialBgHandlingWidget
{
Q_OBJECT
public:

View File

@@ -41,14 +41,13 @@
#endif
#include "settings.h"
#include "basic_filters.h"
#include "envelope_and_lfo_widget.h"
class QLabel;
class channelTrack;
class instrumentTrack;
class comboBox;
class groupBox;
class knob;
@@ -57,12 +56,11 @@ class pixmapButton;
class tabWidget;
class envelopeTabWidget : public QWidget, public settings,
public engineObject
class envelopeTabWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
envelopeTabWidget( channelTrack * _channel_track );
envelopeTabWidget( instrumentTrack * _channel_track );
virtual ~envelopeTabWidget();
void FASTCALL processAudioBuffer( sampleFrame * _ab,

View File

@@ -79,14 +79,14 @@ protected slots:
void contextMenuRequest( QListViewItem * _i, const QPoint & _pos,
int _col );
#endif
void sendToActiveChannel( void );
void openInNewChannelSE( void );
void openInNewChannelBBE( void );
void sendToActiveInstrumentTrack( void );
void openInNewInstrumentTrackSE( void );
void openInNewInstrumentTrackBBE( void );
private:
virtual void keyPressEvent( QKeyEvent * _ke );
void openInNewChannel( trackContainer * _tc );
void openInNewInstrumentTrack( trackContainer * _tc );
listView * m_l;
fileItem * m_contextMenuItem;

View File

@@ -53,14 +53,14 @@
// forward-declarations
class channelTrack;
class instrumentTrack;
class notePlayHandle;
class instrument : public QWidget, public plugin
{
public:
instrument( channelTrack * _channel_track,
instrument( instrumentTrack * _channel_track,
const descriptor * _descriptor );
virtual ~instrument();
@@ -96,12 +96,12 @@ public:
// instantiate instrument-plugin with given name or return NULL
// on failure
static instrument * FASTCALL instantiate( const QString & _plugin_name,
channelTrack * _channel_track );
instrumentTrack * _channel_track );
protected:
inline channelTrack * getChannelTrack( void ) const
inline instrumentTrack * getInstrumentTrack( void ) const
{
return( m_channelTrack );
return( m_instrumentTrack );
}
// instruments can use this for invalidating themselves, which is for
@@ -115,7 +115,7 @@ protected:
private:
channelTrack * m_channelTrack;
instrumentTrack * m_instrumentTrack;
bool m_valid;
} ;

View File

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

306
include/instrument_track.h Executable file
View File

@@ -0,0 +1,306 @@
/*
* instrument_track.h - declaration of class instrumentTrack, a track + window
* which holds an instrument-plugin
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _INSTRUMENT_TRACK_H
#define _INSTRUMENT_TRACK_H
#include "qt3support.h"
#ifdef QT4
#include <QApplication>
#include <QPushButton>
#include <QPainter>
#include <QMutex>
#else
#include <qapplication.h>
#include <qpushbutton.h>
#include <qpainter.h>
#include <qmutex.h>
#endif
#include "track.h"
#include "mixer.h"
#include "midi_event_processor.h"
#include "gui_templates.h"
#include "tab_widget.h"
#include "engine.h"
class QLineEdit;
class arpAndChordsTabWidget;
class audioPort;
class instrumentTrackButton;
class envelopeTabWidget;
class fadeButton;
class instrument;
class knob;
class lcdSpinBox;
class midiPort;
class midiTabWidget;
class notePlayHandle;
class pianoWidget;
class presetPreviewPlayHandle;
class surroundArea;
class instrumentTrack : public QWidget, public track, public midiEventProcessor
{
Q_OBJECT
public:
instrumentTrack( trackContainer * _tc );
virtual ~instrumentTrack();
inline virtual trackTypes type( void ) const
{
return( m_trackType );
}
// used by instrument
void FASTCALL processAudioBuffer( sampleFrame * _buf,
const fpab_t _frames,
notePlayHandle * _n );
virtual void FASTCALL processInEvent( const midiEvent & _me,
const midiTime & _time );
virtual void FASTCALL processOutEvent( const midiEvent & _me,
const midiTime & _time );
// returns the frequency of a given tone & octave.
// This function also includes base_tone & base_octave in
// its calculations
float FASTCALL frequency( notePlayHandle * _n ) const;
f_cnt_t FASTCALL beatLen( notePlayHandle * _n ) const;
// for capturing note-play-events -> need that for arpeggio,
// filter and so on
void FASTCALL playNote( notePlayHandle * _n );
QString instrumentName( void ) const;
void FASTCALL deleteNotePluginData( notePlayHandle * _n );
// name-stuff
inline const QString & name( void ) const
{
return( m_name );
}
void FASTCALL 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 );
const QPoint & surroundAreaPos( void ) const;
// base-tone stuff
void FASTCALL setBaseTone( tones _new_tone );
void FASTCALL setBaseOctave( octaves _new_octave );
inline tones baseTone( void ) const
{
return( m_baseTone );
}
inline octaves baseOctave( void ) const
{
return( m_baseOctave );
}
int FASTCALL masterKey( notePlayHandle * _n ) const;
// play everything in given frame-range - creates note-play-handles
virtual bool FASTCALL play( const midiTime & _start,
const f_cnt_t _start_frame,
const fpab_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
// create new track-content-object = pattern
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
// called by track
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
// load instrument whose name matches given one
instrument * FASTCALL loadInstrument( const QString &
_instrument_name );
// parent for all internal tab-widgets
QWidget * tabWidgetParent( void )
{
return( m_tabWidget );
}
public slots:
void surroundAreaPosChanged( const QPoint & _new_p );
void textChanged( const QString & _new_name );
void toggledInstrumentTrackButton( bool _on );
protected:
// capture close-events for toggling instrument-track-button
virtual void closeEvent( QCloseEvent * _ce );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
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 );
protected slots:
void saveSettingsBtnClicked( void );
void activityIndicatorPressed( void );
void activityIndicatorReleased( void );
void midiInSelected( void );
void midiOutSelected( void );
void midiConfigChanged( bool );
private:
trackTypes m_trackType;
midiPort * m_midiPort;
audioPort * m_audioPort;
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
QMutex m_notesMutex;
tones m_baseTone;
octaves m_baseOctave;
QString m_name;
// widgets on the top of a instrument-track-window
tabWidget * m_generalSettingsWidget;
QLineEdit * m_instrumentNameLE;
knob * m_volumeKnob;
surroundArea * m_surroundArea;
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;
// test-piano at the bottom of every instrument-settings-window
pianoWidget * m_pianoWidget;
// widgets in track-settings-widget
knob * m_tswVolumeKnob;
fadeButton * m_tswActivityIndicator;
instrumentTrackButton * m_tswInstrumentTrackButton;
QMenu * m_tswMidiMenu;
#ifdef QT4
QAction * m_midiInputAction;
QAction * m_midiOutputAction;
#else
int m_midiInputID;
int m_midiOutputID;
#endif
friend class instrumentTrackButton;
friend class notePlayHandle;
friend class presetPreviewPlayHandle;
signals:
void noteDone( const note & _n );
} ;
class instrumentTrackButton : public QPushButton
{
public:
instrumentTrackButton( instrumentTrack * _instrument_track );
virtual ~instrumentTrackButton();
#ifdef QT3
inline void setChecked( bool _on )
{
setOn( _on );
}
inline bool isChecked( void ) const
{
return( isOn() );
}
inline void setCheckable( bool _on )
{
QPushButton::setToggleButton( _on );
}
#endif
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 );
// allow drops on this button - we simply forward them to
// instrument-track
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
private:
instrumentTrack * m_instrumentTrack;
} ;
#endif

213
include/journalling_object.h Executable file
View File

@@ -0,0 +1,213 @@
/*
* journalling_object.h - declaration of class journallingObject
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _JOURNALLING_OBJECT_H
#define _JOURNALLING_OBJECT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "types.h"
#include "engine.h"
#include "qt3support.h"
#ifndef QT3
#include <QVariant>
#include <QVector>
#include <QStack>
#else
#include <qvariant.h>
#include <qvaluevector.h>
#include <qvaluestack.h>
#endif
class QDomDocument;
class QDomElement;
typedef Uint32 t_action_id;
class journallingObject;
class journalEntry
{
public:
journalEntry( const t_action_id _action_id, const QVariant & _data ) :
m_actionID( _action_id ),
m_data( _data )
{
}
journalEntry( void ) :
m_actionID( 0 ),
m_data( 0 )
{
}
~journalEntry()
{
}
t_action_id actionID( void ) const
{
return( m_actionID );
}
t_action_id & actionID( void )
{
return( m_actionID );
}
const QVariant & data( void ) const
{
return( m_data );
}
QVariant & data( void )
{
return( m_data );
}
private:
t_action_id m_actionID;
QVariant m_data;
} ;
typedef vvector<journalEntry> journalEntryVector;
class journallingObject : public engineObject
{
public:
journallingObject( engine * _engine );
virtual ~journallingObject();
inline const jo_id_t id( void ) const
{
return( m_id );
}
void undo( void );
void redo( void );
void clear( void )
{
m_journalEntries.clear();
m_currentJournalEntry = m_journalEntries.end();
}
void clearRedoSteps( void )
{
m_journalEntries.erase( m_currentJournalEntry,
m_journalEntries.end() );
m_currentJournalEntry = m_journalEntries.end();
}
void saveJournallingState( const bool _new_state )
{
m_journallingStateStack.push( m_journalling );
m_journalling = _new_state;
}
void restoreJournallingState( void )
{
m_journalling = m_journallingStateStack.pop();
}
virtual QDomElement FASTCALL saveState( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL 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 );
}
inline void setJournalling( const bool _sr )
{
m_journalling = _sr;
}
// to be implemented by sub-objects
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
}
virtual void FASTCALL loadSettings( const QDomElement & _this )
{
}
virtual void undoStep( journalEntry & _je )
{
}
virtual void redoStep( journalEntry & _je )
{
}
private:
void saveJournal( QDomDocument & _doc, QDomElement & _parent );
void loadJournal( const QDomElement & _this );
jo_id_t m_id;
journalEntryVector m_journalEntries;
journalEntryVector::iterator m_currentJournalEntry;
bool m_journalling;
vstack<bool> m_journallingStateStack;
} ;
#endif

View File

@@ -43,7 +43,7 @@
#include <config.h>
#endif
#include "settings.h"
#include "journalling_object.h"
#include "engine.h"
@@ -51,18 +51,18 @@ class QMenu;
class QPixmap;
class QAction;
class channelTrack;
class instrumentTrack;
class tabWidget;
class ledCheckBox;
class lcdSpinBox;
class midiPort;
class midiTabWidget : public QWidget, public settings, public engineObject
class midiTabWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
midiTabWidget( channelTrack * _channel_track, midiPort * _port );
midiTabWidget( instrumentTrack * _channel_track, midiPort * _port );
virtual ~midiTabWidget();
@@ -91,7 +91,7 @@ protected slots:
void activatedWriteablePort( int _id );
private:
channelTrack * m_channelTrack;
instrumentTrack * m_instrumentTrack;
midiPort * m_midiPort;
tabWidget * m_setupTabWidget;
@@ -103,7 +103,7 @@ private:
QMenu * m_readablePorts;
QMenu * m_writeablePorts;
friend class channelTrack;
friend class instrumentTrack;
} ;

View File

@@ -50,12 +50,13 @@ public:
UNKNOWN,
SONG_PROJECT,
SONG_PROJECT_TEMPLATE,
CHANNEL_SETTINGS,
INSTRUMENT_TRACK_SETTINGS,
DRAG_N_DROP_DATA,
JOURNAL_DATA,
EFFECT_SETTINGS,
VIDEO_PROJECT, // will come later...
BURN_PROJECT, // will come later...
PLAYLIST, // will come later...
VIDEO_PROJECT, // might come later...
BURN_PROJECT, // might come later...
PLAYLIST, // might come later...
PROJ_TYPE_COUNT
} ;

View File

@@ -46,7 +46,7 @@
#include "volume.h"
#include "panning.h"
#include "midi_time.h"
#include "settings.h"
#include "journalling_object.h"
enum tones
{
@@ -89,15 +89,18 @@ const int OCTAVES = 9;
class note : public settings
class note : public journallingObject
{
public:
note( const midiTime & _length = 0, const midiTime & _pos = 0,
tones _tone = A, octaves _octave = DEFAULT_OCTAVE,
note( engine * _engine = NULL,
const midiTime & _length = 0,
const midiTime & _pos = 0,
tones _tone = A,
octaves _octave = DEFAULT_OCTAVE,
volume _volume = DEFAULT_VOLUME,
panning _panning = DEFAULT_PANNING ) FASTCALL;
~note();
virtual ~note();
void FASTCALL setLength( const midiTime & _length );
void FASTCALL setPos( const midiTime & _pos );
@@ -154,18 +157,31 @@ public:
return( m_panning );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "note" );
}
protected:
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
private:
midiTime FASTCALL quantized( const midiTime & _m, const int _q_grid );
enum actions
{
CHANGE_KEY, CHANGE_VOLUME, CHANGE_PANNING,
CHANGE_LENGTH, CHANGE_POSITION
} ;
tones m_tone;
octaves m_octave;
volume m_volume;

View File

@@ -32,7 +32,7 @@
#include "note.h"
class channelTrack;
class instrumentTrack;
class notePlayHandle;
typedef vvector<notePlayHandle *> notePlayHandleVector;
@@ -45,8 +45,8 @@ public:
void * m_pluginData;
basicFilters<> * m_filter;
notePlayHandle( channelTrack * _chnl_trk, const f_cnt_t _frames_ahead,
const f_cnt_t _frames, note * _n,
notePlayHandle( instrumentTrack * _chnl_trk, const f_cnt_t _frames_ahead,
const f_cnt_t _frames, const note & _n,
const bool _arp_note = FALSE );
virtual ~notePlayHandle();
@@ -57,7 +57,7 @@ public:
{
return( ( m_released && m_framesBeforeRelease == 0 &&
m_releaseFramesDone >= m_releaseFramesToDo ) ||
m_channelTrack == NULL );
m_instrumentTrack == NULL );
}
virtual void checkValidity( void );
@@ -118,10 +118,10 @@ public:
m_arpNote = _n->arpNote() && baseNote();
}
// returns channel-track this note-play-handle plays
inline channelTrack * getChannelTrack( void )
// returns instrument-track this note-play-handle plays
inline instrumentTrack * getInstrumentTrack( void )
{
return( m_channelTrack );
return( m_instrumentTrack );
}
// returns whether note is a base-note, e.g. is not part of an arpeggio
@@ -161,15 +161,15 @@ public:
// note-play-handles belonging to given channel
static constNotePlayHandleVector nphsOfChannelTrack(
const channelTrack * _ct );
const instrumentTrack * _ct );
// return whether given note-play-handle is equal to *this
bool operator==( const notePlayHandle & _nph ) const;
private:
channelTrack * m_channelTrack; // needed for calling
// channelTrack::playNote
instrumentTrack * m_instrumentTrack; // needed for calling
// instrumentTrack::playNote
f_cnt_t m_frames; // total frames to play
f_cnt_t m_framesAhead; // numbers of frames ahead in buffer
// to mix in

View File

@@ -59,7 +59,7 @@ class QAction;
class QProgressBar;
class QPushButton;
class channelTrack;
class instrumentTrack;
class patternFreezeThread;
class sampleBuffer;
@@ -78,7 +78,7 @@ public:
BEAT_PATTERN, MELODY_PATTERN/*, AUTOMATION_PATTERN*/
} ;
pattern( channelTrack * _channel_track );
pattern( instrumentTrack * _channel_track );
pattern( const pattern & _pat_to_copy );
virtual ~pattern();
@@ -154,9 +154,9 @@ public:
return( "pattern" );
}
inline channelTrack * getChannelTrack( void )
inline instrumentTrack * getInstrumentTrack( void )
{
return( m_channelTrack );
return( m_instrumentTrack );
}
@@ -208,7 +208,7 @@ private:
bool m_needsUpdate;
// general stuff
channelTrack * m_channelTrack;
instrumentTrack * m_instrumentTrack;
patternTypes m_patternType;
QString m_name;

View File

@@ -46,7 +46,7 @@
#include "types.h"
#include "note.h"
#include "engine.h"
#include "settings.h"
#include "journalling_object.h"
class QPainter;
@@ -60,7 +60,7 @@ class timeLine;
class toolButton;
class pianoRoll : public QWidget, public engineObject, public settings
class pianoRoll : public QWidget, public journallingObject
{
Q_OBJECT
public:

View File

@@ -48,7 +48,7 @@
#include "templates.h"
class channelTrack;
class instrumentTrack;
class notePlayHandle;
@@ -63,7 +63,7 @@ class pianoWidget : public QWidget
{
Q_OBJECT
public:
pianoWidget( channelTrack * _channel_track );
pianoWidget( instrumentTrack * _channel_track );
virtual ~pianoWidget();
inline void setKeyState( int _key, bool _on = FALSE )
@@ -97,7 +97,7 @@ private:
bool m_pressedKeys[NOTES_PER_OCTAVE * OCTAVES];
QScrollBar * m_pianoScroll;
channelTrack * m_channelTrack;
instrumentTrack * m_instrumentTrack;
tones m_startTone; // first key when drawing
octaves m_startOctave;

View File

@@ -44,10 +44,7 @@
#endif
#include "engine.h"
class playHandle : public engineObject
class playHandle
{
public:
enum types
@@ -56,8 +53,7 @@ public:
PRESET_PREVIEW_PLAY_HANDLE
} ;
playHandle( const types _type, engine * _engine ) :
engineObject( _engine ),
playHandle( const types _type ) :
m_type( _type )
{
}

View File

@@ -47,9 +47,8 @@
#include "types.h"
#include "settings.h"
#include "journalling_object.h"
#include "embed.h"
#include "engine.h"
#define STRINGIFY_PLUGIN_NAME(s) STR(s)
@@ -59,7 +58,7 @@
class QPixmap;
class plugin : public settings, public engineObject
class plugin : public journallingObject
{
public:
enum pluginTypes

View File

@@ -31,25 +31,25 @@
#ifdef QT4
#include <QMutex>
#include <QMap>
#else
#include <qmutex.h>
#include <qmap.h>
#endif
#include "note_play_handle.h"
#include "engine.h"
class instrumentTrack;
class notePlayHandle;
class previewTrackContainer;
class channelTrack;
class presetPreviewPlayHandle : public playHandle
class presetPreviewPlayHandle : public playHandle, public engineObject
{
public:
presetPreviewPlayHandle( const QString & _preset_file,
@@ -61,7 +61,7 @@ public:
static void cleanUp( engine * _engine );
static constNotePlayHandleVector nphsOfChannelTrack(
const channelTrack * _ct );
const instrumentTrack * _ct );
private:
inline previewTrackContainer * previewTC( void )

120
include/project_journal.h Executable file
View File

@@ -0,0 +1,120 @@
/*
* project_journal.h - declaration of class projectJournal
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _PROJECT_JOURNAL_H
#define _PROJECT_JOURNAL_H
#include "types.h"
#include "engine.h"
#include "qt3support.h"
#ifndef QT3
#include <QVariant>
#include <QVector>
#include <QMap>
#else
#include <qvariant.h>
#include <qvaluevector.h>
#include <qmap.h>
#endif
class journallingObject;
class projectJournal : public engineObject
{
public:
projectJournal( engine * _engine );
virtual ~projectJournal();
void undo( void );
void redo( void );
// tell history that a new journal entry was added to object with ID _id
void journalEntryAdded( const jo_id_t _id );
bool isJournalling( void ) const
{
return( m_journalling );
}
void setJournalling( const bool _on )
{
m_journalling = _on;
}
// alloc new ID and register object _obj to it
jo_id_t allocID( journallingObject * _obj );
// if there's already something known about ID _id, but it is currently
// unused (e.g. after jouralling object was deleted), register object
// _obj to this id
void reallocID( const jo_id_t _id, journallingObject * _obj );
// make ID _id unused, but keep all global journalling information
// (order of journalling entries etc.) referring to _id - needed for
// restoring a journalling object later
void freeID( const jo_id_t _id )
{
reallocID( _id, NULL );
}
// completely remove everything linked with ID _id - all global
// journalling information about the ID get's lost
void forgetAboutID( const jo_id_t _id );
void clear( void );
journallingObject * getJournallingObject( const jo_id_t _id )
{
if( m_joIDs.contains( _id ) )
{
return( m_joIDs[_id] );
}
return( NULL );
}
private:
typedef QMap<jo_id_t, journallingObject *> joIDMap;
typedef vvector<jo_id_t> journalEntryVector;
joIDMap m_joIDs;
journalEntryVector m_journalEntries;
journalEntryVector::iterator m_currentJournalEntry;
bool m_journalling;
} ;
#endif

View File

@@ -39,7 +39,7 @@
#endif
#include "settings.h"
#include "journalling_object.h"
#include "engine.h"
@@ -48,7 +48,7 @@ class QComboBox;
class QTextEdit;
class projectNotes : public QMainWindow, public settings, public engineObject
class projectNotes : public QMainWindow, public journallingObject
{
Q_OBJECT
public:

View File

@@ -130,8 +130,6 @@ inline QString baseName( const QString & _file )
// QAbstractButton/QButton
#define setCheckable setToggleButton
#define isCheckable isToggleButton
#define setShortcut setAccel

View File

@@ -28,13 +28,13 @@
#include "play_handle.h"
#include "types.h"
#include "engine.h"
class sampleBuffer;
class audioPort;
class samplePlayHandle : public playHandle
class samplePlayHandle : public playHandle, public engineObject
{
public:
samplePlayHandle( const QString & _sample_file, engine * _engine );

View File

@@ -150,9 +150,7 @@ public:
{
return( m_fileName );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "songeditor" );

View File

@@ -48,7 +48,11 @@ public:
QPushButton( _text, _parent ),
m_id( _id )
{
#ifndef QT3
setCheckable( TRUE );
#else
setToggleButton( TRUE );
#endif
connect( this, SIGNAL( clicked() ), this,
SLOT( slotClicked() ) );
}

View File

@@ -47,7 +47,7 @@ class nStateButton;
class textFloat;
class timeLine : public QWidget, public engineObject, public settings
class timeLine : public QWidget, public journallingObject
{
Q_OBJECT
public:

View File

@@ -54,10 +54,9 @@
#include "types.h"
#include "midi_time.h"
#include "settings.h"
#include "rubberband.h"
#include "engine.h"
#include "editable_object.h"
#include "journalling_object.h"
class QMenu;
@@ -79,8 +78,8 @@ const Uint16 TRACK_OP_WIDTH = 70;
const Uint16 TCO_BORDER_WIDTH = 1;
class trackContentObject : public selectableObject, public settings,
public editableObject
class trackContentObject : public selectableObject,
public journallingObject
{
Q_OBJECT
public:
@@ -130,8 +129,8 @@ protected:
void setAutoResizeEnabled( bool _e = FALSE );
float pixelsPerTact( void );
virtual void undoStep( const editStep & _edit_step );
virtual void redoStep( const editStep & _edit_step );
virtual void undoStep( journalEntry & _edit_step );
virtual void redoStep( journalEntry & _edit_step );
protected slots:
@@ -164,7 +163,7 @@ private:
class trackContentWidget : public QWidget, public editableObject
class trackContentWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
@@ -206,8 +205,13 @@ protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
virtual void undoStep( const editStep & _edit_step );
virtual void redoStep( const editStep & _edit_step );
virtual QString nodeName( void ) const
{
return( "trackcontentwidget" );
}
virtual void undoStep( journalEntry & _edit_step );
virtual void redoStep( journalEntry & _edit_step );
private:
@@ -364,7 +368,7 @@ private:
// base-class for all tracks
class track : public settings, public engineObject
class track : public journallingObject
{
public:
enum trackTypes
@@ -419,7 +423,7 @@ public:
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
QDomElement & _this );
virtual void FASTCALL loadSettings( const QDomElement & _this );

View File

@@ -45,7 +45,7 @@
#include "track.h"
#include "settings.h"
#include "journalling_object.h"
#include "rubberband.h"
#include "engine.h"
@@ -56,7 +56,7 @@ const Uint16 DEFAULT_SCROLLBAR_SIZE = 16;
class trackContainer : public QMainWindow, public settings, public engineObject
class trackContainer : public QMainWindow, public journallingObject
{
Q_OBJECT
public:

View File

@@ -54,6 +54,6 @@ typedef Uint16 bpm_t; // tempo (MIN_BPM to MAX_BPM)
typedef Uint16 bitrate_t; // bitrate in kbps
typedef Sint8 fx_ch_t; // FX-channel (0 to MAX_EFFECT_CHANNEL)
typedef Uint32 eo_id_t; // (unique) ID of an editable object
typedef Uint32 jo_id_t; // (unique) ID of an journalling object
#endif

View File

@@ -47,7 +47,7 @@
#include "audio_file_processor.h"
#include "song_editor.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "paths.h"
#include "interpolation.h"
@@ -72,7 +72,8 @@ plugin::descriptor audiofileprocessor_plugin_descriptor =
"AudioFileProcessor",
QT_TRANSLATE_NOOP( "pluginBrowser",
"simple sampler with various settings for "
"using samples (e.g. drums) in a channel" ),
"using samples (e.g. drums) in an "
"instrument-track" ),
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
plugin::INSTRUMENT,
@@ -86,7 +87,7 @@ QPixmap * audioFileProcessor::s_artwork = NULL;
audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) :
instrument( _channel_track, &audiofileprocessor_plugin_descriptor ),
specialBgHandlingWidget( PLUGIN_NAME::getIconPixmap( "artwork" ) ),
m_sampleBuffer( eng(), "" ),
@@ -103,7 +104,6 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
m_openAudioFileButton = new pixmapButton( this, eng() );
m_openAudioFileButton->setCheckable( FALSE );
m_openAudioFileButton->setCursor( QCursor( Qt::PointingHandCursor ) );
m_openAudioFileButton->move( 200, 90 );
m_openAudioFileButton->setActiveGraphic( embed::getIconPixmap(
@@ -129,6 +129,7 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
"doesn't sound like the original one..." ) );
m_reverseButton = new pixmapButton( this, eng() );
m_reverseButton->setCheckable( TRUE );
m_reverseButton->move( 160, 124 );
m_reverseButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"reverse_on" ) );
@@ -148,6 +149,7 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
"crash." ) );
m_loopButton = new pixmapButton( this, eng() );
m_loopButton->setCheckable( TRUE );
m_loopButton->move( 180, 124 );
m_loopButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"loop_on" ) );
@@ -283,27 +285,25 @@ audioFileProcessor::~audioFileProcessor()
void audioFileProcessor::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
QDomElement & _this )
{
QDomElement afp_de = _doc.createElement( nodeName() );
afp_de.setAttribute( "src", m_sampleBuffer.audioFile() );
_this.setAttribute( "src", m_sampleBuffer.audioFile() );
if( m_sampleBuffer.audioFile() == "" )
{
QString s;
afp_de.setAttribute( "sampledata", m_sampleBuffer.toBase64( s ) );
_this.setAttribute( "sampledata", m_sampleBuffer.toBase64( s ) );
}
afp_de.setAttribute( "sframe", QString::number(
_this.setAttribute( "sframe", QString::number(
m_sampleBuffer.startFrame() /
(float)m_sampleBuffer.frames() ) );
afp_de.setAttribute( "eframe", QString::number(
_this.setAttribute( "eframe", QString::number(
m_sampleBuffer.endFrame() /
(float)m_sampleBuffer.frames() ) );
afp_de.setAttribute( "reversed", QString::number(
_this.setAttribute( "reversed", QString::number(
m_reverseButton->isChecked() ) );
afp_de.setAttribute( "looped", QString::number(
_this.setAttribute( "looped", QString::number(
m_loopButton->isChecked() ) );
afp_de.setAttribute( "amp", QString::number( m_ampKnob->value() ) );
_parent.appendChild( afp_de );
_this.setAttribute( "amp", QString::number( m_ampKnob->value() ) );
}
@@ -356,7 +356,7 @@ void audioFileProcessor::setParameter( const QString & _param,
Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const
{
const float freq_factor = BASE_FREQ /
( getChannelTrack()->frequency( _n ) *
( getInstrumentTrack()->frequency( _n ) *
DEFAULT_SAMPLE_RATE /
eng()->getMixer()->sampleRate() );
@@ -371,12 +371,12 @@ Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const
void audioFileProcessor::setAudioFile( const QString & _audio_file )
{
// is current channel-name equal to previous-filename??
if( getChannelTrack()->name() ==
if( getInstrumentTrack()->name() ==
QFileInfo( m_sampleBuffer.audioFile() ).fileName() ||
m_sampleBuffer.audioFile() == "" )
{
// then set it to new one
getChannelTrack()->setName( QFileInfo( _audio_file
getInstrumentTrack()->setName( QFileInfo( _audio_file
).fileName() );
}
// else we don't touch the channel-name, because the user named it self
@@ -395,7 +395,7 @@ void audioFileProcessor::playNote( notePlayHandle * _n )
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>( frames );
// calculate frequency of note
const float note_freq = getChannelTrack()->frequency( _n ) /
const float note_freq = getInstrumentTrack()->frequency( _n ) /
( eng()->getMixer()->sampleRate() /
DEFAULT_SAMPLE_RATE );
if( m_sampleBuffer.play( buf, _n->totalFramesPlayed(),
@@ -403,7 +403,7 @@ void audioFileProcessor::playNote( notePlayHandle * _n )
m_loopButton->isChecked(),
&_n->m_pluginData ) == TRUE )
{
getChannelTrack()->processAudioBuffer( buf, frames, _n );
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
}
bufferAllocator::free( buf );
}
@@ -674,7 +674,7 @@ extern "C"
plugin * lmms_plugin_main( void * _data )
{
return( new audioFileProcessor(
static_cast<channelTrack *>( _data ) ) );
static_cast<instrumentTrack *>( _data ) ) );
}

View File

@@ -52,7 +52,7 @@ class audioFileProcessor : public instrument, public specialBgHandlingWidget
{
Q_OBJECT
public:
audioFileProcessor( channelTrack * _channel_track );
audioFileProcessor( instrumentTrack * _channel_track );
virtual ~audioFileProcessor();
virtual void FASTCALL playNote( notePlayHandle * _n );

View File

@@ -57,7 +57,7 @@ using namespace std;
#include "bit_invader.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "templates.h"
#include "buffer_allocator.h"
@@ -173,7 +173,7 @@ sample_t bSynth::nextStringSample( void )
***********************************************************************/
bitInvader::bitInvader( channelTrack * _channel_track ) :
bitInvader::bitInvader( instrumentTrack * _channel_track ) :
instrument( _channel_track,
&bitinvader_plugin_descriptor ),
specialBgHandlingWidget( PLUGIN_NAME::getIconPixmap( "artwork" ) )
@@ -565,34 +565,28 @@ bitInvader::~bitInvader()
void bitInvader::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
void bitInvader::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement to_de = _doc.createElement( nodeName() );
// Save plugin version
to_de.setAttribute( "version", "0.1" );
_this.setAttribute( "version", "0.1" );
// Save sample length
to_de.setAttribute( "sampleLength", QString::number( sample_length ) );
_this.setAttribute( "sampleLength", QString::number( sample_length ) );
// Save sample shape base64-encoded
QString sampleString;
base64::encode( (const char *)sample_shape,
sample_length * sizeof(float), sampleString );
to_de.setAttribute( "sampleShape", sampleString );
_this.setAttribute( "sampleShape", sampleString );
// save LED normalize
to_de.setAttribute( "interpolation",
_this.setAttribute( "interpolation",
m_interpolationToggle->isChecked() );
// save LED
to_de.setAttribute( "normalize", m_normalizeToggle->isChecked() );
_parent.appendChild( to_de );
_this.setAttribute( "normalize", m_normalizeToggle->isChecked() );
}
@@ -686,7 +680,7 @@ void bitInvader::playNote( notePlayHandle * _n )
if ( _n->totalFramesPlayed() == 0 )
{
float freq = getChannelTrack()->frequency( _n );
float freq = getInstrumentTrack()->frequency( _n );
float factor;
if (!normalize) {
@@ -713,7 +707,7 @@ void bitInvader::playNote( notePlayHandle * _n )
}
}
getChannelTrack()->processAudioBuffer( buf, frames, _n );
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
bufferAllocator::free( buf );
}
@@ -805,7 +799,7 @@ extern "C"
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
{
return( new bitInvader( static_cast<channelTrack *>( _data ) ) );
return( new bitInvader( static_cast<instrumentTrack *>( _data ) ) );
}

View File

@@ -75,7 +75,7 @@ class bitInvader : public instrument, public specialBgHandlingWidget
{
Q_OBJECT
public:
bitInvader(channelTrack * _channel_track );
bitInvader(instrumentTrack * _channel_track );
virtual ~bitInvader();
virtual void FASTCALL playNote( notePlayHandle * _n );

View File

@@ -26,7 +26,7 @@
#include "midi_import.h"
#include "track_container.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "pattern.h"
@@ -217,7 +217,7 @@ invalid_format:
}
// now create new channel-track for reading track
channelTrack * ct = dynamic_cast<channelTrack *>(
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
track::create(
track::CHANNEL_TRACK,
_tc ) );
@@ -226,7 +226,7 @@ invalid_format:
#endif
// TODO: setup program, channel etc.
ct->loadInstrument( "tripleoscillator" );
ct->toggledChannelButton( FALSE );
ct->toggledInstrumentTrackButton( FALSE );
// now create pattern to store notes in
pattern * p = dynamic_cast<pattern *>( ct->createTCO( 0 ) );
@@ -269,7 +269,8 @@ invalid_format:
NOTES_PER_OCTAVE * OCTAVES &&
keys[ev.key()][0] >= 0 )
{
note n( midiTime( ( tick - keys[ev.key()][0] ) / 10 ),
note n( eng(),
midiTime( ( tick - keys[ev.key()][0] ) / 10 ),
midiTime( keys[ev.key()][0] / 10 ),
(tones)( ev.key() % NOTES_PER_OCTAVE ),
(octaves)( ev.key() / NOTES_PER_OCTAVE ),

View File

@@ -1,5 +1,5 @@
/*
* bit_invader.cpp - instrument which uses a usereditable wavetable
* organic.cpp - additive synthesizer for organ-like sounds
*
* Copyright (c) 2006 Andreas Brandmaier <andy/at/brandmaier/dot/de>
*
@@ -57,7 +57,7 @@ using namespace std;
#include "organic.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "templates.h"
#include "buffer_allocator.h"
@@ -102,7 +102,7 @@ QPixmap * organicInstrument::s_artwork = NULL;
***********************************************************************/
organicInstrument::organicInstrument( channelTrack * _channel_track ) :
organicInstrument::organicInstrument( instrumentTrack * _channel_track ) :
instrument( _channel_track,
&organic_plugin_descriptor ),
specialBgHandlingWidget( PLUGIN_NAME::getIconPixmap( "artwork" ) )
@@ -190,7 +190,7 @@ organicInstrument::organicInstrument( channelTrack * _channel_track ) :
//m_randBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
// createHeuristicMask() ) );
connect( m_randBtn, SIGNAL ( toggled(bool) ),
connect( m_randBtn, SIGNAL ( clicked() ),
this, SLOT( randomiseSettings() ) );
// set harmonics
@@ -232,36 +232,26 @@ organicInstrument::~organicInstrument()
void organicInstrument::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
void organicInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement to_de = _doc.createElement( nodeName() );
to_de.setAttribute( "num_osc", QString::number( m_num_oscillators ) );
to_de.setAttribute( "foldback", QString::number( fx1Knob->value() ) );
to_de.setAttribute( "vol", QString::number( volKnob->value() ) );
_this.setAttribute( "num_osc", QString::number( m_num_oscillators ) );
_this.setAttribute( "foldback", QString::number( fx1Knob->value() ) );
_this.setAttribute( "vol", QString::number( volKnob->value() ) );
for( int i = 0; i < m_num_oscillators; ++i )
{
QString is = QString::number( i );
to_de.setAttribute( "vol" + is, QString::number(
_this.setAttribute( "vol" + is, QString::number(
m_osc[i].volKnob->value() ) );
to_de.setAttribute( "pan" + is, QString::number(
_this.setAttribute( "pan" + is, QString::number(
m_osc[i].panKnob->value() ) );
to_de.setAttribute( "harmonic" + is, QString::number(
_this.setAttribute( "harmonic" + is, QString::number(
m_osc[i].harmonic ) );
to_de.setAttribute( "detune" + is, QString::number(
_this.setAttribute( "detune" + is, QString::number(
m_osc[i].detuneKnob->value() ) );
to_de.setAttribute( "wavetype" + is, QString::number(
_this.setAttribute( "wavetype" + is, QString::number(
m_osc[i].waveShape ) );
}
_parent.appendChild( to_de );
}
@@ -306,7 +296,7 @@ void organicInstrument::playNote( notePlayHandle * _n )
{
if( _n->totalFramesPlayed() == 0 )
{
float freq = getChannelTrack()->frequency( _n );
float freq = getInstrumentTrack()->frequency( _n );
oscillator * oscs_l[m_num_oscillators];
oscillator * oscs_r[m_num_oscillators];
@@ -417,7 +407,7 @@ void organicInstrument::playNote( notePlayHandle * _n )
// -- --
getChannelTrack()->processAudioBuffer( buf, frames, _n );
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
bufferAllocator::free( buf );
}
@@ -535,7 +525,7 @@ extern "C"
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
{
return( new organicInstrument( static_cast<channelTrack *>( _data ) ) );
return( new organicInstrument( static_cast<instrumentTrack *>( _data ) ) );
}

View File

@@ -1,6 +1,5 @@
/*
* bit_invader.h - declaration of class bitInvader and bSynth which
* are a wavetable synthesizer
* organic.h - additive synthesizer for organ-like sounds
*
* Copyright (c) 2006 Andreas Brandmaier <andy/at/brandmaier/dot/de>
*
@@ -54,7 +53,7 @@ class organicInstrument : public instrument, public specialBgHandlingWidget
{
Q_OBJECT
public:
organicInstrument(channelTrack * _channel_track );
organicInstrument( instrumentTrack * _channel_track );
virtual ~organicInstrument();
virtual void FASTCALL playNote( notePlayHandle * _n );

View File

@@ -39,7 +39,7 @@
#include "plucked_string_synth.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "templates.h"
#include "buffer_allocator.h"
@@ -70,7 +70,7 @@ plugin::descriptor pluckedstringsynth_plugin_descriptor =
// TODO: make this synth stereo for better better spacial (room) feeling and
// add distortion
pluckedStringSynth::pluckedStringSynth( channelTrack * _channel_track ) :
pluckedStringSynth::pluckedStringSynth( instrumentTrack * _channel_track ) :
instrument( _channel_track, &pluckedstringsynth_plugin_descriptor )
{
m_pickKnob = new knob( knobDark_28, this, tr( "Pick position" ),
@@ -107,13 +107,11 @@ pluckedStringSynth::~pluckedStringSynth()
void pluckedStringSynth::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
QDomElement & _this )
{
QDomElement pss_de = _doc.createElement( nodeName() );
pss_de.setAttribute( "pick", QString::number( m_pickKnob->value() ) );
pss_de.setAttribute( "pickup", QString::number(
_this.setAttribute( "pick", QString::number( m_pickKnob->value() ) );
_this.setAttribute( "pickup", QString::number(
m_pickupKnob->value() ) );
_parent.appendChild( pss_de );
}
@@ -140,7 +138,7 @@ void pluckedStringSynth::playNote( notePlayHandle * _n )
{
if ( _n->totalFramesPlayed() == 0 )
{
float freq = getChannelTrack()->frequency( _n );
float freq = getInstrumentTrack()->frequency( _n );
_n->m_pluginData = new pluckSynth( freq, m_pickKnob->value(),
m_pickupKnob->value(),
eng()->getMixer()->sampleRate() );
@@ -159,7 +157,7 @@ void pluckedStringSynth::playNote( notePlayHandle * _n )
}
}
getChannelTrack()->processAudioBuffer( buf, frames, _n );
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
bufferAllocator::free( buf );
}
@@ -269,7 +267,7 @@ extern "C"
plugin * lmms_plugin_main( void * _data )
{
return( new pluckedStringSynth(
static_cast<channelTrack *>( _data ) ) );
static_cast<instrumentTrack *>( _data ) ) );
}

View File

@@ -194,7 +194,7 @@ private:
class pluckedStringSynth : public instrument
{
public:
pluckedStringSynth(channelTrack * _channel_track );
pluckedStringSynth( instrumentTrack * _channel_track );
virtual ~pluckedStringSynth();
virtual void FASTCALL playNote( notePlayHandle * _n );

View File

@@ -45,7 +45,7 @@
#include "triple_oscillator.h"
#include "song_editor.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "knob.h"
#include "buffer_allocator.h"
@@ -79,7 +79,7 @@ plugin::descriptor tripleoscillator_plugin_descriptor =
}
tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) :
instrument( _channel_track, &tripleoscillator_plugin_descriptor ),
m_modulationAlgo1( oscillator::MIX ),
m_modulationAlgo2( oscillator::MIX )
@@ -505,37 +505,33 @@ tripleOscillator::~tripleOscillator()
void tripleOscillator::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
void tripleOscillator::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement to_de = _doc.createElement( nodeName() );
to_de.setAttribute( "modalgo1", QString::number( m_modulationAlgo1 ) );
to_de.setAttribute( "modalgo2", QString::number( m_modulationAlgo2 ) );
_this.setAttribute( "modalgo1", QString::number( m_modulationAlgo1 ) );
_this.setAttribute( "modalgo2", QString::number( m_modulationAlgo2 ) );
for( int i = 0; i < NUM_OF_OSCILLATORS; ++i )
{
QString is = QString::number( i );
to_de.setAttribute( "vol" + is, QString::number(
_this.setAttribute( "vol" + is, QString::number(
m_osc[i].volKnob->value() ) );
to_de.setAttribute( "pan" + is, QString::number(
_this.setAttribute( "pan" + is, QString::number(
m_osc[i].panKnob->value() ) );
to_de.setAttribute( "coarse" + is, QString::number(
_this.setAttribute( "coarse" + is, QString::number(
m_osc[i].coarseKnob->value() ) );
to_de.setAttribute( "finel" + is, QString::number(
_this.setAttribute( "finel" + is, QString::number(
m_osc[i].fineLKnob->value() ) );
to_de.setAttribute( "finer" + is, QString::number(
_this.setAttribute( "finer" + is, QString::number(
m_osc[i].fineRKnob->value() ) );
to_de.setAttribute( "phoffset" + is, QString::number(
_this.setAttribute( "phoffset" + is, QString::number(
m_osc[i].phaseOffsetKnob->value() ) );
to_de.setAttribute( "stphdetun" + is, QString::number(
_this.setAttribute( "stphdetun" + is, QString::number(
m_osc[i].stereoPhaseDetuningKnob->value() ) );
to_de.setAttribute( "wavetype" + is, QString::number(
_this.setAttribute( "wavetype" + is, QString::number(
m_osc[i].waveShape ) );
to_de.setAttribute( "userwavefile" + is,
_this.setAttribute( "userwavefile" + is,
m_osc[i].m_sampleBuffer->audioFile() );
}
_parent.appendChild( to_de );
}
@@ -590,7 +586,7 @@ void tripleOscillator::playNote( notePlayHandle * _n )
{
if( _n->totalFramesPlayed() == 0 )
{
float freq = getChannelTrack()->frequency( _n );
float freq = getInstrumentTrack()->frequency( _n );
oscillator * oscs_l[NUM_OF_OSCILLATORS];
oscillator * oscs_r[NUM_OF_OSCILLATORS];
@@ -695,7 +691,7 @@ void tripleOscillator::playNote( notePlayHandle * _n )
osc_l->update( buf, frames, 0 );
osc_r->update( buf, frames, 1 );
getChannelTrack()->processAudioBuffer( buf, frames, _n );
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
bufferAllocator::free( buf );
}
@@ -821,7 +817,7 @@ extern "C"
plugin * lmms_plugin_main( void * _data )
{
return( new tripleOscillator(
static_cast<channelTrack *>( _data ) ) );
static_cast<instrumentTrack *>( _data ) ) );
}
}

View File

@@ -45,7 +45,7 @@ class tripleOscillator : public instrument
{
Q_OBJECT
public:
tripleOscillator( channelTrack * _channel );
tripleOscillator( instrumentTrack * _channel );
virtual ~tripleOscillator();
virtual void FASTCALL playNote( notePlayHandle * _n );
@@ -72,7 +72,7 @@ protected slots:
private:
channelTrack * m_channelTrack;
instrumentTrack * m_instrumentTrack;
struct oscillatorData
{

View File

@@ -49,7 +49,7 @@
#endif
#include "channel_track.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "buffer_allocator.h"
#include "mixer.h"
@@ -87,7 +87,7 @@ plugin::descriptor vestige_plugin_descriptor =
QPixmap * vestigeInstrument::s_artwork = NULL;
vestigeInstrument::vestigeInstrument( channelTrack * _channel_track ) :
vestigeInstrument::vestigeInstrument( instrumentTrack * _channel_track ) :
instrument( _channel_track, &vestige_plugin_descriptor ),
specialBgHandlingWidget( PLUGIN_NAME::getIconPixmap( "artwork" ) ),
m_plugin( NULL ),
@@ -211,33 +211,30 @@ void vestigeInstrument::loadSettings( const QDomElement & _this )
void vestigeInstrument::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
void vestigeInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement vst_de = _doc.createElement( nodeName() );
vst_de.setAttribute( "plugin", m_pluginDLL );
_this.setAttribute( "plugin", m_pluginDLL );
m_pluginMutex.lock();
if( m_plugin != NULL )
{
if( m_plugin->pluginWidget() != NULL )
{
vst_de.setAttribute( "guivisible",
_this.setAttribute( "guivisible",
m_plugin->pluginWidget()->isVisible() );
}
const QMap<QString, QString> & dump = m_plugin->parameterDump();
vst_de.setAttribute( "numparams", dump.size() );
_this.setAttribute( "numparams", dump.size() );
for( QMap<QString, QString>::const_iterator it = dump.begin();
it != dump.end(); ++it )
{
#ifdef QT4
vst_de.setAttribute( it.key(), it.value() );
_this.setAttribute( it.key(), it.value() );
#else
vst_de.setAttribute( it.key(), it.data() );
_this.setAttribute( it.key(), it.data() );
#endif
}
}
m_pluginMutex.unlock();
_parent.appendChild( vst_de );
}
@@ -258,9 +255,9 @@ void vestigeInstrument::setParameter( const QString & _param,
{
m_pluginMutex.lock();
bool set_ch_name = ( m_plugin != NULL &&
getChannelTrack()->name() == m_plugin->name() ) ||
getChannelTrack()->name() ==
channelTrack::tr( "Default" );
getInstrumentTrack()->name() == m_plugin->name() ) ||
getInstrumentTrack()->name() ==
instrumentTrack::tr( "Default" );
m_pluginMutex.unlock();
closePlugin();
@@ -305,16 +302,16 @@ void vestigeInstrument::setParameter( const QString & _param,
m_plugin->setTempo( eng()->getSongEditor()->getTempo() );
if( set_ch_name == TRUE )
{
getChannelTrack()->setName( m_plugin->name() );
getInstrumentTrack()->setName( m_plugin->name() );
}
if( m_plugin->pluginWidget() != NULL )
{
#ifdef QT4
m_plugin->pluginWidget()->setWindowIcon(
getChannelTrack()->windowIcon() );
getInstrumentTrack()->windowIcon() );
#else
m_plugin->pluginWidget()->setWindowIcon(
*( getChannelTrack()->windowIcon() ) );
*( getInstrumentTrack()->windowIcon() ) );
#endif
}
m_pluginMutex.unlock();
@@ -339,7 +336,7 @@ void vestigeInstrument::play( void )
m_plugin->process( NULL, buf );
getChannelTrack()->processAudioBuffer( buf, frames, NULL );
getInstrumentTrack()->processAudioBuffer( buf, frames, NULL );
bufferAllocator::free( buf );
}
@@ -355,7 +352,7 @@ void vestigeInstrument::playNote( notePlayHandle * _n )
if( _n->totalFramesPlayed() == 0 && m_plugin != NULL )
{
m_plugin->enqueueMidiEvent( midiEvent( NOTE_ON, 0,
getChannelTrack()->masterKey( _n ),
getInstrumentTrack()->masterKey( _n ),
_n->getVolume() ), _n->framesAhead() );
}
m_pluginMutex.unlock();
@@ -370,7 +367,7 @@ void vestigeInstrument::deleteNotePluginData( notePlayHandle * _n )
if( m_plugin != NULL )
{
m_plugin->enqueueMidiEvent( midiEvent( NOTE_OFF, 0,
getChannelTrack()->masterKey( _n ),
getInstrumentTrack()->masterKey( _n ),
0 ), 0 );
}
m_pluginMutex.unlock();
@@ -551,7 +548,7 @@ extern "C"
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
{
return( new vestigeInstrument( static_cast<channelTrack *>( _data ) ) );
return( new vestigeInstrument( static_cast<instrumentTrack *>( _data ) ) );
}

View File

@@ -53,7 +53,7 @@ class vestigeInstrument : public instrument, public specialBgHandlingWidget
{
Q_OBJECT
public:
vestigeInstrument( channelTrack * _channel_track );
vestigeInstrument( instrumentTrack * _channel_track );
virtual ~vestigeInstrument();
virtual void play( void );

View File

@@ -2,7 +2,7 @@
/*
* arp_and_chords_tab_widget.cpp - widget for use in arp/chord-tab of
* channel-window
* instrument-track-window
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -57,7 +57,7 @@
#include "tooltip.h"
#include "gui_templates.h"
#include "tempo_sync_knob.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "led_checkbox.h"
#include "preset_preview_play_handle.h"
#include "combobox.h"
@@ -194,10 +194,9 @@ const int ARP_GROUPBOX_HEIGHT = 240 - ARP_GROUPBOX_Y;
arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
QWidget( _channel_track->tabWidgetParent() ),
settings(),
engineObject( _channel_track->eng() )
arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_track ) :
QWidget( _instrument_track->tabWidgetParent() ),
journallingObject( _instrument_track->eng() )
{
m_chordsGroupBox = new groupBox( tr( "CHORDS" ), this, eng() );
m_chordsGroupBox->setGeometry( CHORDS_GROUPBOX_X, CHORDS_GROUPBOX_Y,
@@ -449,7 +448,8 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
break;
}
// create copy of base-note
note note_copy( 0, 0, (tones)( sub_note_key %
note note_copy( NULL, 0, 0,
(tones)( sub_note_key %
NOTES_PER_OCTAVE ),
(octaves)( sub_note_key /
NOTES_PER_OCTAVE ),
@@ -459,9 +459,9 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// different
notePlayHandle * note_play_handle =
new notePlayHandle(
_n->getChannelTrack(),
_n->getInstrumentTrack(),
_n->framesAhead(),
_n->frames(), &note_copy );
_n->frames(), note_copy );
// add sub-note to base-note, now all stuff is
// done by notePlayHandle::play_note()
_n->addSubNote( note_play_handle );
@@ -484,12 +484,12 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
const int selected_arp = m_arpComboBox->value();
constNotePlayHandleVector cnphv = notePlayHandle::nphsOfChannelTrack(
_n->getChannelTrack() );
_n->getInstrumentTrack() );
if( m_arpModeComboBox->value() != FREE && cnphv.size() == 0 )
{
// maybe we're playing only a preset-preview-note?
cnphv = presetPreviewPlayHandle::nphsOfChannelTrack(
_n->getChannelTrack() );
_n->getInstrumentTrack() );
if( cnphv.size() == 0 )
{
// still nothing found here, so lets return
@@ -600,7 +600,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
}
// create new arp-note
note new_note( midiTime( 0 ), midiTime( 0 ),
note new_note( NULL, midiTime( 0 ), midiTime( 0 ),
static_cast<tones>( sub_note_key %
NOTES_PER_OCTAVE ),
static_cast<octaves>( sub_note_key /
@@ -612,14 +612,14 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// duplicate note-play-handle, only ptr to note is different
// and is_arp_note=TRUE
notePlayHandle * note_play_handle = new notePlayHandle(
_n->getChannelTrack(),
_n->getInstrumentTrack(),
( ( m_arpModeComboBox->value() !=
FREE ) ?
cnphv.first()->framesAhead() :
_n->framesAhead() ) +
frames_processed,
gated_frames,
&new_note,
new_note,
TRUE );
// add sub-note to base-note - now all stuff is done by
@@ -643,24 +643,22 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
QDomElement & _this )
{
QDomElement act_de = _doc.createElement( nodeName() );
act_de.setAttribute( "chorddisabled", !m_chordsGroupBox->isActive() );
act_de.setAttribute( "chord", m_chordsComboBox->value() );
act_de.setAttribute( "chordrange", m_chordRangeKnob->value() );
_this.setAttribute( "chorddisabled", !m_chordsGroupBox->isActive() );
_this.setAttribute( "chord", m_chordsComboBox->value() );
_this.setAttribute( "chordrange", m_chordRangeKnob->value() );
act_de.setAttribute( "arpdisabled", !m_arpGroupBox->isActive() );
act_de.setAttribute( "arp", m_arpComboBox->value() );
act_de.setAttribute( "arprange", m_arpRangeKnob->value() );
act_de.setAttribute( "arptime", m_arpTimeKnob->value() );
act_de.setAttribute( "arpgate", m_arpGateKnob->value() );
act_de.setAttribute( "arpdir", m_arpDirectionBtnGrp->value() );
act_de.setAttribute( "arpsyncmode",
_this.setAttribute( "arpdisabled", !m_arpGroupBox->isActive() );
_this.setAttribute( "arp", m_arpComboBox->value() );
_this.setAttribute( "arprange", m_arpRangeKnob->value() );
_this.setAttribute( "arptime", m_arpTimeKnob->value() );
_this.setAttribute( "arpgate", m_arpGateKnob->value() );
_this.setAttribute( "arpdir", m_arpDirectionBtnGrp->value() );
_this.setAttribute( "arpsyncmode",
( int ) m_arpTimeKnob->getSyncMode() );
act_de.setAttribute( "arpmode", m_arpModeComboBox->value() );
_parent.appendChild( act_de );
_this.setAttribute( "arpmode", m_arpModeComboBox->value() );
}

View File

@@ -26,7 +26,7 @@
#include "bb_editor.h"
#include "edit_history.h"
#include "project_journal.h"
#include "engine.h"
#include "main_window.h"
#include "mixer.h"
@@ -43,9 +43,9 @@ engine::engine( const bool _has_gui ) :
m_songEditor( NULL ),
m_bbEditor( NULL ),
m_pianoRoll( NULL ),
m_editHistory( NULL )
m_projectJournal( NULL )
{
m_editHistory = new editHistory( this );
m_projectJournal = new projectJournal( this );
m_mainWindow = new mainWindow( this );
m_mixer = new mixer( this );
m_songEditor = new songEditor( this );

View File

@@ -110,13 +110,12 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount,
QWidget * _parent,
engine * _engine ) :
QWidget( _parent ),
settings(),
journallingObject( _engine ),
#ifdef QT4
specialBgHandlingWidget( palette().color( backgroundRole() ) ),
#else
specialBgHandlingWidget( paletteBackgroundColor() ),
#endif
engineObject( _engine ),
m_used( FALSE ),
m_valueForZeroAmount( _value_for_zero_amount ),
m_pahdEnv( NULL ),

View File

@@ -2,7 +2,7 @@
/*
* envelope_tab_widget.cpp - widget for use in envelope/lfo/filter-tab of
* channel-window
* instrument-track-window
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -50,7 +50,7 @@
#include "tab_widget.h"
#include "embed.h"
#include "gui_templates.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "combobox.h"
@@ -83,10 +83,9 @@ static const QString targetNames[envelopeTabWidget::TARGET_COUNT][2] =
envelopeTabWidget::envelopeTabWidget( channelTrack * _channel_track ) :
QWidget( _channel_track->tabWidgetParent() ),
settings(),
engineObject( _channel_track->eng() )
envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) :
QWidget( _instrument_track->tabWidgetParent() ),
journallingObject( _instrument_track->eng() )
{
m_targetsTabWidget = new tabWidget( tr( "TARGET" ), this );
@@ -171,14 +170,14 @@ envelopeTabWidget::envelopeTabWidget( channelTrack * _channel_track ) :
QWhatsThis::add( m_filterComboBox,
#endif
tr( "Here you can select the built-in filter you want to use "
"in this channel. Filters are very important for "
"changing the characteristics of a sound." ) );
"for this instrument-track. Filters are very important "
"for changing the characteristics of a sound." ) );
m_filterCutKnob = new knob( knobBright_26, m_filterGroupBox, tr(
"cutoff-frequency" ), eng() );
m_filterCutKnob->setLabel( tr( "CUTOFF" ) );
m_filterCutKnob->setRange( 0.0, 10000.0, 1.0 );
m_filterCutKnob->setRange( 0.0, 14000.0, 1.0 );
m_filterCutKnob->move( 140, 18 );
m_filterCutKnob->setInitValue( 16000.0 );
m_filterCutKnob->setHintText( tr( "cutoff-frequency:" ) + " ", " " +
@@ -494,24 +493,18 @@ f_cnt_t envelopeTabWidget::releaseFrames( void )
void envelopeTabWidget::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
void envelopeTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement etw_de = _doc.createElement( nodeName() );
etw_de.setAttribute( "ftype", m_filterComboBox->value() );
etw_de.setAttribute( "fcut", m_filterCutKnob->value() );
etw_de.setAttribute( "fres", m_filterResKnob->value() );
etw_de.setAttribute( "fwet", m_filterGroupBox->isActive() );
_parent.appendChild( etw_de );
_this.setAttribute( "ftype", m_filterComboBox->value() );
_this.setAttribute( "fcut", m_filterCutKnob->value() );
_this.setAttribute( "fres", m_filterResKnob->value() );
_this.setAttribute( "fwet", m_filterGroupBox->isActive() );
for( int i = 0; i < TARGET_COUNT; ++i )
{
QDomElement target_de = _doc.createElement(
m_envLFOWidgets[i]->nodeName() +
QString(
targetNames[i][1] ).toLower() );
m_envLFOWidgets[i]->saveSettings( _doc, target_de );
etw_de.appendChild( target_de );
m_envLFOWidgets[i]->saveState( _doc, _this ).setTagName(
m_envLFOWidgets[i]->nodeName() +
QString( targetNames[i][1] ).toLower() );
}
}
@@ -537,7 +530,7 @@ void envelopeTabWidget::loadSettings( const QDomElement & _this )
m_envLFOWidgets[i]->nodeName() +
QString( targetNames[i][1] ).toLower() )
{
m_envLFOWidgets[i]->loadSettings(
m_envLFOWidgets[i]->restoreState(
node.toElement() );
}
}

View File

@@ -51,7 +51,7 @@
#include "song_editor.h"
#include "bb_editor.h"
#include "embed.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "mmp.h"
#include "preset_preview_play_handle.h"
#include "sample_play_handle.h"
@@ -177,14 +177,17 @@ void fileBrowser::contextMenuRequest( QListViewItem * i, const QPoint &, int )
{
m_contextMenuItem = f;
QMenu * contextMenu = new QMenu( this );
contextMenu->addAction( tr( "Send to active channel" ), this,
SLOT( sendToActiveChannel() ) );
contextMenu->addAction( tr( "Open in new channel/Song-Editor" ),
contextMenu->addAction( tr( "Send to active instrument-track" ),
this,
SLOT( openInNewChannelSE() ) );
contextMenu->addAction( tr( "Open in new channel/B+B Editor" ),
SLOT( sendToActiveInstrumentTrack() ) );
contextMenu->addAction( tr( "Open in new instrument-track/"
"Song-Editor" ),
this,
SLOT( openInNewChannelBBE() ) );
SLOT( openInNewInstrumentTrackSE() ) );
contextMenu->addAction( tr( "Open in new instrument-track/"
"B+B Editor" ),
this,
SLOT( openInNewInstrumentTrackBBE() ) );
contextMenu->exec( QCursor::pos() );
m_contextMenuItem = NULL;
delete contextMenu;
@@ -195,7 +198,7 @@ void fileBrowser::contextMenuRequest( QListViewItem * i, const QPoint &, int )
void fileBrowser::sendToActiveChannel( void )
void fileBrowser::sendToActiveInstrumentTrack( void )
{
if( eng()->getMainWindow()->workspace() != NULL )
{
@@ -209,24 +212,24 @@ void fileBrowser::sendToActiveChannel( void )
#ifdef QT4
QListIterator<QWidget *> w( pl );
w.toBack();
// now we travel through the window-list until we find a
// channel-track
// now we travel through the window-list until we find an
// instrument-track
while( w.hasPrevious() )
{
channelTrack * ct = dynamic_cast<channelTrack *>(
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
w.previous() );
#else
QWidget * w = pl.last();
// now we travel through the window-list until we find a
// channel-track
// now we travel through the window-list until we find an
// instrument-track
while( w != NULL )
{
channelTrack * ct = dynamic_cast<channelTrack *>( w );
instrumentTrack * ct = dynamic_cast<instrumentTrack *>( w );
#endif
if( ct != NULL && ct->isHidden() == FALSE )
{
// ok, it's a channel-track, so we can apply the
// sample or the preset
// ok, it's an instrument-track, so we can apply
// the sample or the preset
if( m_contextMenuItem->type() ==
fileItem::SAMPLE_FILE )
{
@@ -248,7 +251,7 @@ void fileBrowser::sendToActiveChannel( void )
firstChild().
toElement() );
}
ct->toggledChannelButton( TRUE );
ct->toggledInstrumentTrackButton( TRUE );
break;
}
#ifndef QT4
@@ -261,11 +264,11 @@ void fileBrowser::sendToActiveChannel( void )
void fileBrowser::openInNewChannel( trackContainer * _tc )
void fileBrowser::openInNewInstrumentTrack( trackContainer * _tc )
{
if( m_contextMenuItem->type() == fileItem::SAMPLE_FILE )
{
channelTrack * ct = dynamic_cast<channelTrack *>(
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
track::create( track::CHANNEL_TRACK, _tc ) );
#ifdef LMMS_DEBUG
assert( ct != NULL );
@@ -276,19 +279,19 @@ void fileBrowser::openInNewChannel( trackContainer * _tc )
afp->setParameter( "samplefile",
m_contextMenuItem->fullName() );
}
ct->toggledChannelButton( TRUE );
ct->toggledInstrumentTrackButton( TRUE );
}
else if( m_contextMenuItem->type() == fileItem::PRESET_FILE )
{
multimediaProject mmp( m_contextMenuItem->fullName() );
track * t = track::create( track::CHANNEL_TRACK, _tc );
channelTrack * ct = dynamic_cast<channelTrack *>( t );
instrumentTrack * ct = dynamic_cast<instrumentTrack *>( t );
if( ct != NULL )
{
ct->loadTrackSpecificSettings( mmp.content().
firstChild().
toElement() );
ct->toggledChannelButton( TRUE );
ct->toggledInstrumentTrackButton( TRUE );
}
}
}
@@ -296,17 +299,17 @@ void fileBrowser::openInNewChannel( trackContainer * _tc )
void fileBrowser::openInNewChannelSE( void )
void fileBrowser::openInNewInstrumentTrackSE( void )
{
openInNewChannel( eng()->getSongEditor() );
openInNewInstrumentTrack( eng()->getSongEditor() );
}
void fileBrowser::openInNewChannelBBE( void )
void fileBrowser::openInNewInstrumentTrackBBE( void )
{
openInNewChannel( eng()->getBBEditor() );
openInNewInstrumentTrack( eng()->getBBEditor() );
}
@@ -352,7 +355,7 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me )
{
// samples are per default opened in bb-editor because
// they're likely drum-samples etc.
channelTrack * ct = dynamic_cast<channelTrack *>(
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
track::create( track::CHANNEL_TRACK,
eng()->getBBEditor() ) );
#ifdef LMMS_DEBUG
@@ -365,7 +368,7 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me )
afp->setParameter( "samplefile",
f->fullName() );
}
ct->toggledChannelButton( TRUE );
ct->toggledInstrumentTrackButton( TRUE );
}
else if( f->type() == fileItem::PRESET_FILE )
{
@@ -373,13 +376,13 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me )
multimediaProject mmp( f->fullName() );
track * t = track::create( track::CHANNEL_TRACK,
eng()->getBBEditor() );
channelTrack * ct = dynamic_cast<channelTrack *>( t );
instrumentTrack * ct = dynamic_cast<instrumentTrack *>( t );
if( ct != NULL )
{
ct->loadTrackSpecificSettings( mmp.content().
firstChild().
toElement() );
ct->toggledChannelButton( TRUE );
ct->toggledInstrumentTrackButton( TRUE );
}
}
else if( f->type() == fileItem::PROJECT_FILE )
@@ -797,7 +800,7 @@ void fileItem::determineFileType( void )
{
m_type = PROJECT_FILE;
}
else if( t == multimediaProject::CHANNEL_SETTINGS )
else if( t == multimediaProject::INSTRUMENT_TRACK_SETTINGS )
{
m_type = PRESET_FILE;
}

View File

@@ -26,19 +26,19 @@
#include "instrument.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "dummy_instrument.h"
instrument::instrument( channelTrack * _channel_track,
instrument::instrument( instrumentTrack * _instrument_track,
const descriptor * _descriptor ) :
QWidget( _channel_track->tabWidgetParent() ),
plugin( _descriptor, _channel_track->eng() ),
m_channelTrack( _channel_track ),
QWidget( _instrument_track->tabWidgetParent() ),
plugin( _descriptor, _instrument_track->eng() ),
m_instrumentTrack( _instrument_track ),
m_valid( TRUE )
{
setFixedSize( 250, 250 );
m_channelTrack->setWindowIcon( *getDescriptor()->logo );
m_instrumentTrack->setWindowIcon( *getDescriptor()->logo );
}
@@ -81,9 +81,9 @@ f_cnt_t instrument::beatLen( notePlayHandle * ) const
instrument * instrument::instantiate( const QString & _plugin_name,
channelTrack * _channel_track )
instrumentTrack * _instrument_track )
{
plugin * p = plugin::instantiate( _plugin_name, _channel_track );
plugin * p = plugin::instantiate( _plugin_name, _instrument_track );
// check whether instantiated plugin is an instrument
if( dynamic_cast<instrument *>( p ) != NULL )
{
@@ -93,7 +93,7 @@ instrument * instrument::instantiate( const QString & _plugin_name,
// not quite... so delete plugin and return dummy instrument
delete p;
return( new dummyInstrument( _channel_track ) );
return( new dummyInstrument( _instrument_track ) );
}

View File

@@ -76,7 +76,7 @@
#include "setup_dialog.h"
#include "audio_dummy.h"
#include "tool_button.h"
#include "edit_history.h"
#include "project_journal.h"
#if QT_VERSION >= 0x030100
@@ -621,8 +621,9 @@ void mainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
_de.attribute( "height" ).toInt() );
if( !r.isNull() )
{
_w->setShown( _de.attribute( "visible" ).toInt() );
_w->show();
_w->parentWidget()->move( r.topLeft() );
_w->setShown( _de.attribute( "visible" ).toInt() );
_w->resize( r.size() );
}
}
@@ -857,7 +858,7 @@ void mainWindow::togglePianoRollWin( void )
void mainWindow::undo( void )
{
eng()->getEditHistory()->undo();
eng()->getProjectJournal()->undo();
}
@@ -865,7 +866,7 @@ void mainWindow::undo( void )
void mainWindow::redo( void )
{
eng()->getEditHistory()->redo();
eng()->getProjectJournal()->redo();
}

View File

@@ -48,7 +48,7 @@
#include "midi_tab_widget.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "midi_port.h"
#include "tab_widget.h"
#include "led_checkbox.h"
@@ -60,12 +60,11 @@
midiTabWidget::midiTabWidget( channelTrack * _channel_track,
midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track,
midiPort * _port ) :
QWidget( _channel_track->tabWidgetParent() ),
settings(),
engineObject( _channel_track->eng() ),
m_channelTrack( _channel_track ),
QWidget( _instrument_track->tabWidgetParent() ),
journallingObject( _instrument_track->eng() ),
m_instrumentTrack( _instrument_track ),
m_midiPort( _port ),
m_readablePorts( NULL ),
m_writeablePorts( NULL )
@@ -194,13 +193,12 @@ midiTabWidget::~midiTabWidget()
void midiTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void midiTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement mw_de = _doc.createElement( nodeName() );
mw_de.setAttribute( "inputchannel", m_inputChannelSpinBox->value() );
mw_de.setAttribute( "outputchannel", m_outputChannelSpinBox->value() );
mw_de.setAttribute( "receive", m_receiveCheckBox->isChecked() );
mw_de.setAttribute( "send", m_sendCheckBox->isChecked() );
_this.setAttribute( "inputchannel", m_inputChannelSpinBox->value() );
_this.setAttribute( "outputchannel", m_outputChannelSpinBox->value() );
_this.setAttribute( "receive", m_receiveCheckBox->isChecked() );
_this.setAttribute( "send", m_sendCheckBox->isChecked() );
if( m_readablePorts != NULL && m_receiveCheckBox->isChecked() == TRUE )
{
@@ -230,7 +228,7 @@ void midiTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _parent )
{
rp.truncate( rp.length() - 1 );
}
mw_de.setAttribute( "inports", rp );
_this.setAttribute( "inports", rp );
}
if( m_writeablePorts != NULL && m_sendCheckBox->isChecked() == TRUE )
@@ -261,10 +259,8 @@ void midiTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _parent )
{
wp.truncate( wp.length() - 1 );
}
mw_de.setAttribute( "outports", wp );
_this.setAttribute( "outports", wp );
}
_parent.appendChild( mw_de );
}

View File

@@ -45,8 +45,10 @@
note::note( const midiTime & _length, const midiTime & _pos, tones _tone,
octaves _octave, volume _volume, panning _panning ) :
note::note( engine * _engine, const midiTime & _length, const midiTime & _pos,
tones _tone, octaves _octave, volume _volume,
panning _panning ) :
journallingObject( _engine ),
m_tone( C ),
m_octave( DEFAULT_OCTAVE ),
m_volume( DEFAULT_VOLUME ),
@@ -54,10 +56,15 @@ note::note( const midiTime & _length, const midiTime & _pos, tones _tone,
m_length( _length ),
m_pos( _pos )
{
//saveJournallingState( FALSE );
setJournalling( FALSE );
setTone( _tone );
setOctave( _octave );
setVolume( _volume );
setPanning( _panning );
//restoreJournallingState();
}
@@ -72,6 +79,7 @@ note::~note()
void note::setLength( const midiTime & _length )
{
addJournalEntry( journalEntry( CHANGE_LENGTH, m_length - _length ) );
m_length = _length;
}
@@ -80,6 +88,7 @@ void note::setLength( const midiTime & _length )
void note::setPos( const midiTime & _pos )
{
addJournalEntry( journalEntry( CHANGE_POSITION, m_pos - _pos ) );
m_pos = _pos;
}
@@ -88,17 +97,9 @@ void note::setPos( const midiTime & _pos )
void note::setTone( const tones _tone )
{
if( _tone >= C && _tone <= H )
{
m_tone = _tone;
}
else
{
m_tone = tLimit( _tone, C, H );
#ifdef LMMS_DEBUG
printf ( "Tone out of range (note::setTone)\n" );
#endif
}
const tones t = tLimit( _tone, C, H );
addJournalEntry( journalEntry( CHANGE_KEY, (int) m_tone - t ) );
m_tone = t;
}
@@ -106,17 +107,10 @@ void note::setTone( const tones _tone )
void note::setOctave( const octaves _octave )
{
if( _octave >= MIN_OCTAVE && _octave <= MAX_OCTAVE )
{
m_octave = _octave;
}
else
{
m_octave = tLimit( _octave, MIN_OCTAVE, MAX_OCTAVE );
#ifdef LMMS_DEBUG
printf( "Octave out of range (note::setOctave)\n" );
#endif
}
const octaves o = tLimit( _octave, MIN_OCTAVE, MAX_OCTAVE );
addJournalEntry( journalEntry( CHANGE_KEY, NOTES_PER_OCTAVE *
( (int) m_octave - o ) ) );
m_octave = o;
}
@@ -124,8 +118,12 @@ void note::setOctave( const octaves _octave )
void note::setKey( const int _key )
{
const int k = key();
saveJournallingState( FALSE );
setTone( static_cast<tones>( _key % NOTES_PER_OCTAVE ) );
setOctave( static_cast<octaves>( _key / NOTES_PER_OCTAVE ) );
restoreJournallingState();
addJournalEntry( journalEntry( CHANGE_KEY, k - key() ) );
}
@@ -133,17 +131,9 @@ void note::setKey( const int _key )
void note::setVolume( const volume _volume )
{
if( _volume <= MAX_VOLUME )
{
m_volume = _volume;
}
else
{
m_volume = tMin( _volume, MAX_VOLUME );
#ifdef LMMS_DEBUG
printf( "Volume out of range (note::setVolume)\n" );
#endif
}
const volume v = tMin( _volume, MAX_VOLUME );
addJournalEntry( journalEntry( CHANGE_VOLUME, (int) m_volume - v ) );
m_volume = v;
}
@@ -151,16 +141,9 @@ void note::setVolume( const volume _volume )
void note::setPanning( const panning _panning )
{
if( _panning >= PANNING_LEFT && _panning <= PANNING_RIGHT )
{
m_panning = _panning;
}
#ifdef LMMS_DEBUG
else
{
printf( "Paning out of range (note::setPanning)\n" );
}
#endif
const panning p = tLimit( _panning, PANNING_LEFT, PANNING_RIGHT );
addJournalEntry( journalEntry( CHANGE_PANNING, (int) m_panning - p ) );
m_panning = p;
}
@@ -199,16 +182,14 @@ void note::quantizePos( const int _q_grid )
void note::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void note::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement note_de = _doc.createElement( "note" );
note_de.setAttribute( "tone", m_tone );
note_de.setAttribute( "oct", m_octave );
note_de.setAttribute( "vol", m_volume );
note_de.setAttribute( "pan", m_panning );
note_de.setAttribute( "len", m_length );
note_de.setAttribute( "pos", m_pos );
_parent.appendChild( note_de );
_this.setAttribute( "tone", m_tone );
_this.setAttribute( "oct", m_octave );
_this.setAttribute( "vol", m_volume );
_this.setAttribute( "pan", m_panning );
_this.setAttribute( "len", m_length );
_this.setAttribute( "pos", m_pos );
}
@@ -227,5 +208,43 @@ void note::loadSettings( const QDomElement & _this )
void note::undoStep( journalEntry & _je )
{
saveJournallingState( FALSE );
switch( static_cast<actions>( _je.actionID() ) )
{
case CHANGE_KEY:
setKey( key() - _je.data().toInt() );
break;
case CHANGE_VOLUME:
setVolume( getVolume() - _je.data().toInt() );
break;
case CHANGE_PANNING:
setVolume( getPanning() - _je.data().toInt() );
break;
case CHANGE_LENGTH:
setLength( length() - _je.data().toInt() );
break;
case CHANGE_POSITION:
setPos( pos() - _je.data().toInt() );
break;
}
restoreJournallingState();
}
void note::redoStep( journalEntry & _je )
{
journalEntry je( _je.actionID(), -_je.data().toInt() );
undoStep( je );
}
#endif

View File

@@ -27,26 +27,27 @@
#include "note_play_handle.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "envelope_tab_widget.h"
#include "midi.h"
#include "midi_port.h"
#include "song_editor.h"
#include "piano_widget.h"
#include "config_mgr.h"
#include "project_journal.h"
notePlayHandle::notePlayHandle( channelTrack * _chnl_trk,
notePlayHandle::notePlayHandle( instrumentTrack * _it,
const f_cnt_t _frames_ahead,
const f_cnt_t _frames,
note * _n,
const note & _n,
const bool _arp_note ) :
playHandle( NOTE_PLAY_HANDLE, _chnl_trk->eng() ),
note( *_n ),
playHandle( NOTE_PLAY_HANDLE ),
note( NULL, _n.length(), _n.pos(), _n.tone(), _n.octave(),
_n.getVolume(), _n.getPanning() ),
m_pluginData( NULL ),
m_filter( NULL ),
m_channelTrack( _chnl_trk ),
m_instrumentTrack( _it ),
m_frames( 0 ),
m_framesAhead( _frames_ahead ),
m_totalFramesPlayed( 0 ),
@@ -62,18 +63,18 @@ notePlayHandle::notePlayHandle( channelTrack * _chnl_trk,
if( !configManager::inst()->value( "ui",
"manualchannelpiano" ).toInt() )
{
m_channelTrack->m_pianoWidget->setKeyState( key(), TRUE );
m_instrumentTrack->m_pianoWidget->setKeyState( key(), TRUE );
}
// send MIDI-note-on-event
m_channelTrack->processOutEvent( midiEvent( NOTE_ON,
m_channelTrack->m_midiPort->outputChannel(),
m_instrumentTrack->processOutEvent( midiEvent( NOTE_ON,
m_instrumentTrack->m_midiPort->outputChannel(),
key(),
tLimit<Uint16>(
(Uint16) ( ( getVolume() / 100.0f ) *
( m_channelTrack->getVolume() / 100.0f ) *
( m_instrumentTrack->getVolume() / 100.0f ) *
127 ), 0, 127 ) ),
midiTime::fromFrames( m_framesAhead,
eng()->getSongEditor()->framesPerTact() ) );
m_instrumentTrack->eng()->getSongEditor()->framesPerTact() ) );
}
@@ -86,9 +87,9 @@ notePlayHandle::~notePlayHandle()
noteOff( 0 );
}
if( m_channelTrack != NULL )
if( m_instrumentTrack != NULL )
{
m_channelTrack->deleteNotePluginData( this );
m_instrumentTrack->deleteNotePluginData( this );
}
for( notePlayHandleVector::iterator it = m_subNotes.begin();
@@ -106,24 +107,26 @@ notePlayHandle::~notePlayHandle()
void notePlayHandle::play( void )
{
if( m_muted == TRUE || m_channelTrack == NULL )
if( m_muted == TRUE || m_instrumentTrack == NULL )
{
return;
}
if( m_released == FALSE &&
m_totalFramesPlayed +
eng()->getMixer()->framesPerAudioBuffer() >= m_frames )
m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer() >=
m_frames )
{
noteOff( m_frames - m_totalFramesPlayed );
}
// play note!
m_channelTrack->playNote( this );
m_instrumentTrack->playNote( this );
if( m_released == TRUE )
{
f_cnt_t todo = eng()->getMixer()->framesPerAudioBuffer();
f_cnt_t todo =
m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer();
// if this note is base-note for arpeggio, always set
// m_releaseFramesToDo to bigger value than m_releaseFramesDone
// because we do not allow notePlayHandle::done() to be true
@@ -132,7 +135,7 @@ void notePlayHandle::play( void )
if( arpBaseNote() == TRUE )
{
m_releaseFramesToDo = m_releaseFramesDone + 2 *
eng()->getMixer()->framesPerAudioBuffer();
m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer();
}
// look whether we have frames left to be done before release
if( m_framesBeforeRelease )
@@ -140,7 +143,7 @@ void notePlayHandle::play( void )
// yes, then look whether these samples can be played
// within one audio-buffer
if( m_framesBeforeRelease <=
eng()->getMixer()->framesPerAudioBuffer() )
m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer() )
{
// yes, then we did less releaseFramesDone
todo -= m_framesBeforeRelease;
@@ -153,7 +156,7 @@ void notePlayHandle::play( void )
// release-phase yet)
todo = 0;
m_framesBeforeRelease -=
eng()->getMixer()->framesPerAudioBuffer();
m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer();
}
}
// look whether we're in release-phase
@@ -201,7 +204,8 @@ void notePlayHandle::play( void )
}
// update internal data
m_totalFramesPlayed += eng()->getMixer()->framesPerAudioBuffer();
m_totalFramesPlayed +=
m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer();
}
@@ -209,8 +213,8 @@ void notePlayHandle::play( void )
void notePlayHandle::checkValidity( void )
{
if( m_channelTrack != NULL &&
m_channelTrack->type() == track::NULL_TRACK )
if( m_instrumentTrack != NULL &&
m_instrumentTrack->type() == track::NULL_TRACK )
{
// track-type being track::NULL_TRACK indicates a track whose
// removal is in progress, so we have to invalidate ourself
@@ -218,8 +222,8 @@ void notePlayHandle::checkValidity( void )
{
noteOff( 0 );
}
m_channelTrack->deleteNotePluginData( this );
m_channelTrack = NULL;
m_instrumentTrack->deleteNotePluginData( this );
m_instrumentTrack = NULL;
}
// sub-notes might not be registered at mixer (for example arpeggio-
// notes), so they wouldn't invalidate them-selves
@@ -244,23 +248,23 @@ void notePlayHandle::noteOff( const f_cnt_t _s )
// then set some variables indicating release-state
m_framesBeforeRelease = _s;
if( m_channelTrack != NULL )
if( m_instrumentTrack != NULL )
{
m_releaseFramesToDo = tMax<f_cnt_t>( 10,
m_channelTrack->m_envWidget->releaseFrames() );
m_instrumentTrack->m_envWidget->releaseFrames() );
if( !configManager::inst()->value( "ui",
"manualchannelpiano" ).toInt() )
{
m_channelTrack->m_pianoWidget->setKeyState( key(),
m_instrumentTrack->m_pianoWidget->setKeyState( key(),
FALSE );
}
// send MIDI-note-off-event
m_channelTrack->processOutEvent( midiEvent( NOTE_OFF,
m_channelTrack->m_midiPort->outputChannel(),
m_instrumentTrack->processOutEvent( midiEvent( NOTE_OFF,
m_instrumentTrack->m_midiPort->outputChannel(),
key(), 0 ),
midiTime::fromFrames(
m_framesBeforeRelease,
eng()->getSongEditor()->framesPerTact() ) );
m_instrumentTrack->eng()->getSongEditor()->framesPerTact() ) );
}
else
{
@@ -275,8 +279,8 @@ void notePlayHandle::noteOff( const f_cnt_t _s )
f_cnt_t notePlayHandle::actualReleaseFramesToDo( void ) const
{
return( ( m_channelTrack != NULL ) ?
m_channelTrack->m_envWidget->releaseFrames() : 0 );
return( ( m_instrumentTrack != NULL ) ?
m_instrumentTrack->m_envWidget->releaseFrames() : 0 );
}
@@ -285,9 +289,9 @@ f_cnt_t notePlayHandle::actualReleaseFramesToDo( void ) const
void notePlayHandle::setFrames( const f_cnt_t _frames )
{
m_frames = _frames;
if( m_frames == 0 && m_channelTrack != NULL )
if( m_frames == 0 && m_instrumentTrack != NULL )
{
m_frames = m_channelTrack->beatLen( this );
m_frames = m_instrumentTrack->beatLen( this );
}
}
@@ -296,8 +300,8 @@ void notePlayHandle::setFrames( const f_cnt_t _frames )
float notePlayHandle::volumeLevel( const f_cnt_t _frame )
{
return( ( m_channelTrack != NULL ) ?
m_channelTrack->m_envWidget->volumeLevel( this, _frame ) : 0 );
return( ( m_instrumentTrack != NULL ) ?
m_instrumentTrack->m_envWidget->volumeLevel( this, _frame ) : 0 );
}
@@ -319,14 +323,15 @@ void notePlayHandle::mute( void )
int notePlayHandle::index( void ) const
{
const playHandleVector & phv = eng()->getMixer()->playHandles();
const playHandleVector & phv =
m_instrumentTrack->eng()->getMixer()->playHandles();
int idx = 0;
for( constPlayHandleVector::const_iterator it = phv.begin();
it != phv.end(); ++it )
{
const notePlayHandle * nph =
dynamic_cast<const notePlayHandle *>( *it );
if( nph == NULL || nph->m_channelTrack != m_channelTrack ||
if( nph == NULL || nph->m_instrumentTrack != m_instrumentTrack ||
nph->released() == TRUE )
{
continue;
@@ -344,9 +349,9 @@ int notePlayHandle::index( void ) const
constNotePlayHandleVector notePlayHandle::nphsOfChannelTrack(
const channelTrack * _ct )
const instrumentTrack * _it )
{
const playHandleVector & phv = _ct->eng()->getMixer()->playHandles();
const playHandleVector & phv = _it->eng()->getMixer()->playHandles();
constNotePlayHandleVector cnphv;
for( constPlayHandleVector::const_iterator it = phv.begin();
@@ -354,7 +359,7 @@ constNotePlayHandleVector notePlayHandle::nphsOfChannelTrack(
{
const notePlayHandle * nph =
dynamic_cast<const notePlayHandle *>( *it );
if( nph != NULL && nph->m_channelTrack == _ct &&
if( nph != NULL && nph->m_instrumentTrack == _it &&
nph->released() == FALSE )
{
cnphv.push_back( nph );
@@ -372,7 +377,7 @@ bool notePlayHandle::operator==( const notePlayHandle & _nph ) const
key() == _nph.key() &&
getVolume() == _nph.getVolume() &&
getPanning() == _nph.getPanning() &&
m_channelTrack == _nph.m_channelTrack &&
m_instrumentTrack == _nph.m_instrumentTrack &&
m_frames == _nph.m_frames &&
m_framesAhead == _nph.m_framesAhead &&
m_totalFramesPlayed == _nph.m_totalFramesPlayed &&

View File

@@ -49,6 +49,7 @@
#include <qdom.h>
#define addButton insert
#define setCheckable setToggleButton
#endif
@@ -69,7 +70,7 @@
#include "templates.h"
#include "gui_templates.h"
#include "timeline.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "tooltip.h"
#include "midi.h"
#include "tool_button.h"
@@ -131,7 +132,7 @@ const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * DEFAULT_STEPS_PER_TACT;
pianoRoll::pianoRoll( engine * _engine ) :
QWidget( _engine->getMainWindow()->workspace() ),
engineObject( _engine ),
journallingObject( _engine ),
m_paintPixmap(),
m_cursorInside( FALSE ),
m_pattern( NULL ),
@@ -545,7 +546,7 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
// and now connect to noteDone()-signal of channel so that
// we receive note-off-events from it's midi-port for recording it
connect( m_pattern->getChannelTrack(),
connect( m_pattern->getInstrumentTrack(),
SIGNAL( noteDone( const note & ) ),
this, SLOT( recordNote( const note & ) ) );
@@ -557,11 +558,9 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
void pianoRoll::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void pianoRoll::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement pr_de = _doc.createElement( nodeName() );
mainWindow::saveWidgetState( this, pr_de );
_parent.appendChild( pr_de );
mainWindow::saveWidgetState( this, _this );
}
@@ -1243,7 +1242,8 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
midiTime note_pos( pos_tact_64th );
midiTime note_len( newNoteLen() );
note new_note( note_len, note_pos,
note new_note( eng(),
note_len, note_pos,
(tones)( key_num %
NOTES_PER_OCTAVE ),
(octaves)( key_num /
@@ -1370,7 +1370,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
if( play_note == TRUE && m_recording == FALSE &&
eng()->getSongEditor()->playing() == FALSE )
{
m_pattern->getChannelTrack()->processInEvent(
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_ON, 0, key_num,
vol * 127 / 100 ),
midiTime() );
@@ -1387,13 +1387,13 @@ void pianoRoll::mouseReleaseEvent( QMouseEvent * _me )
{
if( m_action == CHANGE_NOTE_VOLUME && m_currentNote != NULL )
{
m_pattern->getChannelTrack()->processInEvent(
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_OFF, 0,
m_currentNote->key(), 0 ), midiTime() );
}
else
{
m_pattern->getChannelTrack()->processInEvent(
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_OFF, 0, getKey( _me->y() ), 0 ),
midiTime() );
}
@@ -1446,7 +1446,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
#endif
Qt::LeftButton )
{
m_pattern->getChannelTrack()->processInEvent(
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_OFF, 0, released_key, 0 ),
midiTime() );
if(
@@ -1462,7 +1462,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
m_recording == FALSE &&
eng()->getSongEditor()->playing() == FALSE )
{
m_pattern->getChannelTrack()->processInEvent(
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_ON, 0, key_num,
DEFAULT_VOLUME * 127 / 100 ),
midiTime() );
@@ -1487,7 +1487,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
MAX_VOLUME );
m_currentNote->setVolume( vol );
m_pattern->update();
m_pattern->getChannelTrack()->processInEvent(
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( KEY_PRESSURE, 0, key_num,
vol * 127 / 100 ),
midiTime() );
@@ -2524,6 +2524,7 @@ midiTime pianoRoll::newNoteLen( void ) const
#ifdef QT3
#undef addButton
#undef setCheckable
#endif

View File

@@ -42,7 +42,7 @@
#include "piano_widget.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "midi.h"
#include "templates.h"
#include "embed.h"
@@ -77,9 +77,9 @@ const int PW_BLACK_KEY_HEIGHT = 38;
const int LABEL_TEXT_SIZE = 7;
pianoWidget::pianoWidget (channelTrack * _parent ) :
pianoWidget::pianoWidget( instrumentTrack * _parent ) :
QWidget( _parent ),
m_channelTrack( _parent ),
m_instrumentTrack( _parent ),
m_startTone( C ),
m_startOctave( OCTAVE_3 )
{
@@ -242,7 +242,7 @@ void pianoWidget::mousePressEvent( QMouseEvent * _me )
vol = DEFAULT_VOLUME;
}
// set note on
m_channelTrack->processInEvent(
m_instrumentTrack->processInEvent(
midiEvent( NOTE_ON, 0, key_num,
vol * 127 / 100 ),
midiTime() );
@@ -250,9 +250,9 @@ void pianoWidget::mousePressEvent( QMouseEvent * _me )
}
else
{
m_channelTrack->setBaseTone( static_cast<tones>(
m_instrumentTrack->setBaseTone( static_cast<tones>(
key_num % NOTES_PER_OCTAVE ) );
m_channelTrack->setBaseOctave( static_cast<octaves>(
m_instrumentTrack->setBaseOctave( static_cast<octaves>(
key_num / NOTES_PER_OCTAVE ) );
}
@@ -269,7 +269,7 @@ void pianoWidget::mouseReleaseEvent( QMouseEvent * _me )
{
int released_key = getKeyFromMouse( _me->pos() );
m_channelTrack->processInEvent(
m_instrumentTrack->processInEvent(
midiEvent( NOTE_OFF, 0, released_key, 0 ), midiTime() );
m_pressedKeys[released_key] = FALSE;
@@ -309,7 +309,7 @@ void pianoWidget::mouseMoveEvent( QMouseEvent * _me )
// user just moved the cursor one pixel left but on the same key)
if( key_num != released_key )
{
m_channelTrack->processInEvent(
m_instrumentTrack->processInEvent(
midiEvent( NOTE_OFF, 0, released_key, 0 ),
midiTime() );
m_pressedKeys[released_key] = FALSE;
@@ -321,16 +321,16 @@ void pianoWidget::mouseMoveEvent( QMouseEvent * _me )
{
if( _me->pos().y() > PIANO_BASE )
{
m_channelTrack->processInEvent(
m_instrumentTrack->processInEvent(
midiEvent( NOTE_ON, 0, key_num, vol ),
midiTime() );
m_pressedKeys[key_num] = TRUE;
}
else
{
m_channelTrack->setBaseTone( (tones)
m_instrumentTrack->setBaseTone( (tones)
( key_num % NOTES_PER_OCTAVE ) );
m_channelTrack->setBaseOctave( (octaves)
m_instrumentTrack->setBaseOctave( (octaves)
( key_num / NOTES_PER_OCTAVE ) );
}
}
@@ -339,7 +339,7 @@ void pianoWidget::mouseMoveEvent( QMouseEvent * _me )
}
else if( m_pressedKeys[key_num] == TRUE )
{
m_channelTrack->processInEvent(
m_instrumentTrack->processInEvent(
midiEvent( KEY_PRESSURE, 0, key_num, vol ),
midiTime() );
}
@@ -397,7 +397,7 @@ void pianoWidget::keyPressEvent( QKeyEvent * _ke )
if( _ke->isAutoRepeat() == FALSE && key_num > -1 )
{
m_channelTrack->processInEvent(
m_instrumentTrack->processInEvent(
midiEvent( NOTE_ON, 0, key_num, DEFAULT_VOLUME ),
midiTime() );
m_pressedKeys[key_num] = TRUE;
@@ -418,7 +418,7 @@ void pianoWidget::keyReleaseEvent( QKeyEvent * _ke )
( DEFAULT_OCTAVE - 1 ) * NOTES_PER_OCTAVE;
if( _ke->isAutoRepeat() == FALSE && key_num > -1 )
{
m_channelTrack->processInEvent(
m_instrumentTrack->processInEvent(
midiEvent( NOTE_OFF, 0, key_num, 0 ),
midiTime() );
m_pressedKeys[key_num] = FALSE;
@@ -442,7 +442,7 @@ void pianoWidget::focusOutEvent( QFocusEvent * )
{
if( m_pressedKeys[i] == TRUE )
{
m_channelTrack->processInEvent(
m_instrumentTrack->processInEvent(
midiEvent( NOTE_OFF, 0, i, 0 ),
midiTime() );
m_pressedKeys[i] = FALSE;
@@ -523,8 +523,8 @@ void pianoWidget::paintEvent( QPaintEvent * )
p.setPen( QColor ( 0xFF, 0xFF, 0xFF ) );
int base_key = m_channelTrack->baseTone() +
m_channelTrack->baseOctave() * NOTES_PER_OCTAVE;
int base_key = m_instrumentTrack->baseTone() +
m_instrumentTrack->baseOctave() * NOTES_PER_OCTAVE;
if( KEY_ORDER[base_key % NOTES_PER_OCTAVE] == WHITE_KEY )
{
p.fillRect( QRect( getKeyX( base_key ), 1, PW_WHITE_KEY_WIDTH-1,

View File

@@ -64,8 +64,7 @@ static plugin::descriptor dummy_plugin_descriptor =
plugin::plugin( const descriptor * _descriptor, engine * _engine ) :
settings(),
engineObject( _engine ),
journallingObject( _engine ),
m_descriptor( _descriptor )
{
if( dummy_plugin_descriptor.logo == NULL )

View File

@@ -42,7 +42,7 @@
#include "preset_preview_play_handle.h"
#include "note_play_handle.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "track_container.h"
#include "mmp.h"
#include "debug.h"
@@ -56,7 +56,7 @@ class previewTrackContainer : public trackContainer
public:
previewTrackContainer( engine * _engine ) :
trackContainer( _engine ),
m_previewChannelTrack( dynamic_cast<channelTrack *>(
m_previewChannelTrack( dynamic_cast<instrumentTrack *>(
track::create( track::CHANNEL_TRACK,
this ) )),
m_previewNote( NULL ),
@@ -81,7 +81,7 @@ public:
return( "previewtc" );
}
channelTrack * previewChannelTrack( void )
instrumentTrack * previewChannelTrack( void )
{
return( m_previewChannelTrack );
}
@@ -108,7 +108,7 @@ public:
private:
channelTrack * m_previewChannelTrack;
instrumentTrack * m_previewChannelTrack;
notePlayHandle * m_previewNote;
QMutex m_dataMutex;
@@ -123,7 +123,8 @@ QMap<const engine *, previewTrackContainer *>
presetPreviewPlayHandle::presetPreviewPlayHandle(
const QString & _preset_file,
engine * _engine ) :
playHandle( PRESET_PREVIEW_PLAY_HANDLE, _engine ),
playHandle( PRESET_PREVIEW_PLAY_HANDLE ),
engineObject( _engine ),
m_previewNote( NULL )
{
if( s_previewTCs.contains( _engine ) == FALSE )
@@ -149,11 +150,12 @@ presetPreviewPlayHandle::presetPreviewPlayHandle(
midiPort::DUMMY );
// create temporary note
note n( 0, 0, static_cast<tones>( A ),
static_cast<octaves>( DEFAULT_OCTAVE-1 ), 100 );
note n();
// create note-play-handle for it
m_previewNote = new notePlayHandle( previewTC()->previewChannelTrack(),
0, ~0, &n );
0, ~0,
note( NULL, 0, 0, static_cast<tones>( A ),
static_cast<octaves>( DEFAULT_OCTAVE-1 ), 100 ) );
previewTC()->setPreviewNote( m_previewNote );
@@ -209,15 +211,15 @@ void presetPreviewPlayHandle::cleanUp( engine * _engine )
constNotePlayHandleVector presetPreviewPlayHandle::nphsOfChannelTrack(
const channelTrack * _ct )
const instrumentTrack * _it )
{
constNotePlayHandleVector cnphv;
if( s_previewTCs.contains( _ct->eng() ) == TRUE )
if( s_previewTCs.contains( _it->eng() ) == TRUE )
{
previewTrackContainer * tc = s_previewTCs[_ct->eng()];
previewTrackContainer * tc = s_previewTCs[_it->eng()];
tc->lockData();
if( tc->previewNote() != NULL &&
tc->previewNote()->getChannelTrack() == _ct )
tc->previewNote()->getInstrumentTrack() == _it )
{
cnphv.push_back( tc->previewNote() );
}

View File

@@ -34,7 +34,8 @@
samplePlayHandle::samplePlayHandle( const QString & _sample_file,
engine * _engine ) :
playHandle( SAMPLE_PLAY_HANDLE, _engine ),
playHandle( SAMPLE_PLAY_HANDLE ),
engineObject( _engine ),
m_sampleBuffer( new sampleBuffer( eng(), _sample_file ) ),
m_ownSampleBuffer( TRUE ),
m_doneMayReturnTrue( TRUE ),
@@ -47,7 +48,8 @@ samplePlayHandle::samplePlayHandle( const QString & _sample_file,
samplePlayHandle::samplePlayHandle( sampleBuffer * _sample_buffer ) :
playHandle( SAMPLE_PLAY_HANDLE, _sample_buffer->eng() ),
playHandle( SAMPLE_PLAY_HANDLE ),
engineObject( _sample_buffer->eng() ),
m_sampleBuffer( _sample_buffer ),
m_ownSampleBuffer( FALSE ),
m_doneMayReturnTrue( TRUE ),

View File

@@ -65,6 +65,7 @@
#include <qbuttongroup.h>
#define addButton insert
#define setCheckable setToggleButton
#endif
@@ -76,7 +77,7 @@
#include "templates.h"
#include "export_project_dialog.h"
#include "bb_track.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "mmp.h"
#include "midi_client.h"
#include "timeline.h"
@@ -94,7 +95,7 @@
#include "combobox.h"
#include "main_window.h"
#include "import_filter.h"
#include "edit_history.h"
#include "project_journal.h"
#include "debug.h"
@@ -382,7 +383,7 @@ songEditor::songEditor( engine * _engine ) :
static_cast<int>( powf( 2.0f, i ) ) ) +
"%" );
}
m_zoomingComboBox->setValue( m_zoomingComboBox->findText(
m_zoomingComboBox->setInitValue( m_zoomingComboBox->findText(
"100%" ) );
connect( m_zoomingComboBox, SIGNAL( activated( const QString & ) ),
this, SLOT( zoomingChanged( const QString & ) ) );
@@ -1339,7 +1340,7 @@ bool songEditor::mayChangeProject( void )
void songEditor::clearProject( void )
{
eng()->getEditHistory()->setGlobalStepRecording( FALSE );
eng()->getProjectJournal()->setJournalling( FALSE );
if( m_playing )
{
@@ -1362,11 +1363,14 @@ void songEditor::clearProject( void )
}
clearAllTracks();
eng()->getBBEditor()->clearAllTracks();
eng()->getProjectNotes()->clear();
eng()->getEditHistory()->setGlobalStepRecording( TRUE );
eng()->getProjectJournal()->clear();
eng()->getProjectJournal()->setJournalling( TRUE );
}
@@ -1378,15 +1382,15 @@ void songEditor::createNewProject( void )
{
clearProject();
eng()->getEditHistory()->setGlobalStepRecording( FALSE );
eng()->getProjectJournal()->setJournalling( FALSE );
track * t;
t = track::create( track::CHANNEL_TRACK, this );
dynamic_cast< channelTrack * >( t )->loadInstrument(
dynamic_cast< instrumentTrack * >( t )->loadInstrument(
"tripleoscillator" );
track::create( track::SAMPLE_TRACK, this );
t = track::create( track::CHANNEL_TRACK, eng()->getBBEditor() );
dynamic_cast< channelTrack * >( t )->loadInstrument(
dynamic_cast< instrumentTrack * >( t )->loadInstrument(
"tripleoscillator" );
track::create( track::BB_TRACK, this );
@@ -1402,7 +1406,7 @@ void songEditor::createNewProject( void )
eng()->getMainWindow()->resetWindowTitle( "" );
eng()->getEditHistory()->setGlobalStepRecording( TRUE );
eng()->getProjectJournal()->setJournalling( TRUE );
}
@@ -1426,7 +1430,7 @@ void FASTCALL songEditor::loadProject( const QString & _file_name )
{
clearProject();
eng()->getEditHistory()->setGlobalStepRecording( FALSE );
eng()->getProjectJournal()->setJournalling( FALSE );
m_fileName = _file_name;
m_oldFileName = _file_name;
@@ -1485,24 +1489,24 @@ void FASTCALL songEditor::loadProject( const QString & _file_name )
{
if( node.nodeName() == "trackcontainer" )
{
loadSettings( node.toElement() );
restoreState( node.toElement() );
}
else if( node.nodeName() ==
eng()->getPianoRoll()->nodeName() )
{
eng()->getPianoRoll()->loadSettings(
eng()->getPianoRoll()->restoreState(
node.toElement() );
}
else if( node.nodeName() ==
eng()->getProjectNotes()->nodeName() )
{
eng()->getProjectNotes()->loadSettings(
eng()->getProjectNotes()->restoreState(
node.toElement() );
}
else if( node.nodeName() ==
m_playPos[PLAY_SONG].m_timeLine->nodeName() )
{
m_playPos[PLAY_SONG].m_timeLine->loadSettings(
m_playPos[PLAY_SONG].m_timeLine->restoreState(
node.toElement() );
}
}
@@ -1516,7 +1520,7 @@ void FASTCALL songEditor::loadProject( const QString & _file_name )
eng()->getMainWindow()->resetWindowTitle( "" );
eng()->getEditHistory()->setGlobalStepRecording( TRUE );
eng()->getProjectJournal()->setJournalling( TRUE );
}
@@ -1540,11 +1544,11 @@ bool songEditor::saveProject( void )
mmp.head().appendChild( mp );
saveSettings( mmp, mmp.content() );
saveState( mmp, mmp.content() );
eng()->getPianoRoll()->saveSettings( mmp, mmp.content() );
eng()->getProjectNotes()->saveSettings( mmp, mmp.content() );
m_playPos[PLAY_SONG].m_timeLine->saveSettings( mmp, mmp.content() );
eng()->getPianoRoll()->saveState( mmp, mmp.content() );
eng()->getProjectNotes()->saveState( mmp, mmp.content() );
m_playPos[PLAY_SONG].m_timeLine->saveState( mmp, mmp.content() );
if( mmp.writeFile( m_fileName, m_oldFileName == "" ||
m_fileName != m_oldFileName ) == TRUE )
@@ -1687,27 +1691,12 @@ void songEditor::exportProject( void )
void songEditor::saveSettings( QDomDocument & _doc, QDomElement & _parent )
{
trackContainer::saveSettings( _doc, _parent );
}
void songEditor::loadSettings( const QDomElement & _this )
{
trackContainer::loadSettings( _this );
}
#include "song_editor.moc"
#ifdef QT3
#undef addButton
#undef setCheckable
#endif

View File

@@ -66,7 +66,7 @@ timeLine::timeLine( const int _xoff, const int _yoff, const float _ppt,
songEditor::playPos & _pos, const midiTime & _begin,
QWidget * _parent, engine * _engine ) :
QWidget( _parent ),
engineObject( _engine ),
journallingObject( _engine ),
m_autoScroll( AUTOSCROLL_ENABLED ),
m_loopPoints( LOOP_POINTS_DISABLED ),
m_behaviourAtStop( BACK_TO_ZERO ),
@@ -176,13 +176,11 @@ void timeLine::addToolButtons( QWidget * _tool_bar )
void timeLine::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void timeLine::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement tl_de = _doc.createElement( nodeName() );
tl_de.setAttribute( "lp0pos", (int) loopBegin() );
tl_de.setAttribute( "lp1pos", (int) loopEnd() );
tl_de.setAttribute( "lpstate", m_loopPoints );
_parent.appendChild( tl_de );
_this.setAttribute( "lp0pos", (int) loopBegin() );
_this.setAttribute( "lp1pos", (int) loopEnd() );
_this.setAttribute( "lpstate", m_loopPoints );
}

View File

@@ -51,7 +51,7 @@
#include "track.h"
#include "track_container.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "bb_track.h"
#include "sample_track.h"
#include "song_editor.h"
@@ -65,7 +65,7 @@
#include "mmp.h"
#include "main_window.h"
#include "text_float.h"
#include "project_journal.h"
const Sint16 RESIZE_GRIP_WIDTH = 4;
@@ -88,8 +88,7 @@ trackContentObject::trackContentObject( track * _track ) :
, Qt::WDestructiveClose
#endif
),
settings(),
editableObject( _track->eng() ),
journallingObject( _track->eng() ),
m_track( _track ),
m_startPosition(),
m_length(),
@@ -112,10 +111,10 @@ trackContentObject::trackContentObject( track * _track ) :
#endif
show();
setStepRecording( FALSE );
setJournalling( FALSE );
movePosition( 0 );
changeLength( 0 );
setStepRecording( TRUE );
setJournalling( TRUE );
setFixedHeight( parentWidget()->height() - 2 );
setAcceptDrops( TRUE );
@@ -146,7 +145,7 @@ void trackContentObject::movePosition( const midiTime & _pos )
if( m_startPosition != _pos )
{
//getTrack()->eng()->getSongEditor()->setModified();
addStep( editStep( MOVE, m_startPosition - _pos ) );
addJournalEntry( journalEntry( MOVE, m_startPosition - _pos ) );
m_startPosition = _pos;
}
m_track->getTrackWidget()->changePosition();
@@ -163,7 +162,7 @@ void trackContentObject::changeLength( const midiTime & _length )
if( m_length != _length )
{
//getTrack()->eng()->getSongEditor()->setModified();
addStep( editStep( RESIZE, m_length - _length ) );
addJournalEntry( journalEntry( RESIZE, m_length - _length ) );
m_length = _length;
}
setFixedWidth( static_cast<int>( m_length * pixelsPerTact() /
@@ -197,7 +196,7 @@ void trackContentObject::dropEvent( QDropEvent * _de )
// at least save position before getting to moved to somewhere
// the user doesn't expect...
midiTime pos = startPosition();
loadSettings( mmp.content().firstChild().toElement() );
restoreState( mmp.content().firstChild().toElement() );
movePosition( pos );
_de->accept();
}
@@ -253,7 +252,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
getTrack()->eng()->getMainWindow()->isCtrlPressed() == TRUE )
{
multimediaProject mmp( multimediaProject::DRAG_N_DROP_DATA );
saveSettings( mmp, mmp.content() );
saveState( mmp, mmp.content() );
#ifdef QT4
QPixmap thumbnail = QPixmap::grabWidget( this ).scaled(
128, 128,
@@ -265,8 +264,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
QPixmap thumbnail = QPixmap::grabWidget( this ).
convertToImage().smoothScale( s );
#endif
new stringPairDrag( "tco_" +
QString::number( m_track->type() ),
new stringPairDrag( QString( "tco_%1" ).arg( m_track->type() ),
mmp.toString(), thumbnail, this,
m_track->eng() );
}
@@ -274,7 +272,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
/* eng()->getMainWindow()->isShiftPressed() == FALSE &&*/
fixedTCOs() == FALSE )
{
setStepRecording( FALSE );
setJournalling( FALSE );
m_initialMouseX = _me->x();
@@ -308,7 +306,6 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
// setup text-float as if TCO was already moved/resized
mouseMoveEvent( _me );
s_textFloat->show();
}
else if( ( _me->button() == Qt::MidButton/* ||
( _me->button() == Qt::LeftButton &&
@@ -431,8 +428,8 @@ void trackContentObject::mouseReleaseEvent( QMouseEvent * _me )
{
if( m_action == MOVE || m_action == RESIZE )
{
setStepRecording( TRUE );
addStep( editStep( m_action, m_oldTime -
setJournalling( TRUE );
addJournalEntry( journalEntry( m_action, m_oldTime -
( ( m_action == MOVE ) ?
m_startPosition : m_length ) ) );
}
@@ -493,29 +490,28 @@ float trackContentObject::pixelsPerTact( void )
void trackContentObject::undoStep( const editStep & _edit_step )
void trackContentObject::undoStep( journalEntry & _je )
{
saveStepRecordingState( FALSE );
switch( _edit_step.actionID() )
saveJournallingState( FALSE );
switch( _je.actionID() )
{
case MOVE:
movePosition( startPosition() +
_edit_step.data().toInt() );
movePosition( startPosition() + _je.data().toInt() );
break;
case RESIZE:
changeLength( length() + _edit_step.data().toInt() );
changeLength( length() + _je.data().toInt() );
break;
}
restoreStepRecordingState();
restoreJournallingState();
}
void trackContentObject::redoStep( const editStep & _edit_step )
void trackContentObject::redoStep( journalEntry & _je )
{
undoStep( editStep( _edit_step.actionID(),
-_edit_step.data().toInt() ) );
journalEntry je( _je.actionID(), -_je.data().toInt() );
undoStep( je );
}
@@ -556,7 +552,7 @@ void trackContentObject::paste( void )
{
if( clipboard::getContent( nodeName() ) != NULL )
{
loadSettings( *( clipboard::getContent( nodeName() ) ) );
restoreState( *( clipboard::getContent( nodeName() ) ) );
}
}
@@ -576,7 +572,7 @@ void trackContentObject::setAutoResizeEnabled( bool _e )
// ===========================================================================
trackContentWidget::trackContentWidget( trackWidget * _parent ) :
QWidget( _parent ),
editableObject( _parent->getTrack()->eng() ),
journallingObject( _parent->getTrack()->eng() ),
m_trackWidget( _parent )
{
#ifdef QT4
@@ -625,15 +621,18 @@ csize trackContentWidget::numOfTCOs( void )
trackContentObject * FASTCALL trackContentWidget::addTCO(
trackContentObject * _tco )
{
//addStep( editStep( ADD_TCO, 0 ) );
QMap<QString, QVariant> map;
map["id"] = _tco->id();
addJournalEntry( journalEntry( ADD_TCO, map ) );
m_trackContentObjects.push_back( _tco );
_tco->move( 0, 1 );
_tco->saveStepRecordingState( FALSE );
_tco->saveJournallingState( FALSE );
m_trackWidget->changePosition();
_tco->restoreStepRecordingState();
_tco->restoreJournallingState();
getTrack()->eng()->getSongEditor()->setModified();
//getTrack()->eng()->getSongEditor()->setModified();
return( _tco ); // just for convenience
}
@@ -656,7 +655,12 @@ void trackContentWidget::removeTCO( trackContentObject * _tco,
_tco );
if( it != m_trackContentObjects.end() )
{
//addStep( editStep( REMOVE_TCO, 0 ) );
QMap<QString, QVariant> map;
multimediaProject mmp( multimediaProject::JOURNAL_DATA );
_tco->saveState( mmp, mmp.content() );
map["id"] = _tco->id();
map["state"] = mmp.toString();
addJournalEntry( journalEntry( REMOVE_TCO, map ) );
if( _also_delete )
{
delete _tco;
@@ -785,7 +789,7 @@ void trackContentWidget::dropEvent( QDropEvent * _de )
multimediaProject mmp( value, FALSE );
// at least save position before getting moved to somewhere
// the user doesn't expect...
tco->loadSettings( mmp.content().firstChild().toElement() );
tco->restoreState( mmp.content().firstChild().toElement() );
tco->movePosition( pos );
_de->accept();
}
@@ -812,9 +816,9 @@ void trackContentWidget::mousePressEvent( QMouseEvent * _me )
const midiTime pos = getPosition( _me->x() ).getTact() * 64;
trackContentObject * tco = addTCO( getTrack()->createTCO(
pos ) );
tco->saveStepRecordingState( FALSE );
tco->saveJournallingState( FALSE );
tco->movePosition( pos );
tco->restoreStepRecordingState();
tco->restoreJournallingState();
}
}
@@ -861,26 +865,57 @@ void trackContentWidget::resizeEvent( QResizeEvent * _re )
void trackContentWidget::undoStep( const editStep & _edit_step )
void trackContentWidget::undoStep( journalEntry & _je )
{
saveStepRecordingState( FALSE );
switch( _edit_step.actionID() )
saveJournallingState( FALSE );
switch( _je.actionID() )
{
case ADD_TCO:
{
QMap<QString, QVariant> map = _je.data().toMap();
journallingObject * jo =
eng()->getProjectJournal()->getJournallingObject( map["id"].toInt() );
assert( jo != NULL );
multimediaProject mmp(
multimediaProject::JOURNAL_DATA );
jo->saveState( mmp, mmp.content() );
map["state"] = mmp.toString();
_je.data() = map;
delete jo;
break;
}
case REMOVE_TCO:
{
trackContentObject * tco = addTCO(
getTrack()->createTCO(
midiTime( 0 ) ) );
multimediaProject mmp(
_je.data().toMap()["state"].toString(), FALSE );
tco->restoreState(
mmp.content().firstChild().toElement() );
break;
}
}
restoreStepRecordingState();
restoreJournallingState();
}
void trackContentWidget::redoStep( const editStep & _edit_step )
void trackContentWidget::redoStep( journalEntry & _je )
{
/* undoStep( editStep( _edit_step.actionID(),
-_edit_step.data().toInt() ) );*/
switch( _je.actionID() )
{
case ADD_TCO:
case REMOVE_TCO:
_je.actionID() = ( _je.actionID() == ADD_TCO ) ?
REMOVE_TCO : ADD_TCO;
undoStep( _je );
_je.actionID() = ( _je.actionID() == ADD_TCO ) ?
REMOVE_TCO : ADD_TCO;
break;
}
}
@@ -945,6 +980,7 @@ trackOperationsWidget::trackOperationsWidget( trackWidget * _parent ) :
m_muteBtn = new pixmapButton( this, m_trackWidget->getTrack()->eng() );
m_muteBtn->setActiveGraphic( embed::getIconPixmap( "mute_on" ) );
m_muteBtn->setInactiveGraphic( embed::getIconPixmap( "mute_off" ) );
m_muteBtn->setCheckable( TRUE );
m_muteBtn->move( 44, 4 );
m_muteBtn->show();
connect( m_muteBtn, SIGNAL( toggled( bool ) ), this,
@@ -993,9 +1029,9 @@ m_trackWidget->getTrack()->eng()->getMainWindow()->isCtrlPressed() == TRUE &&
m_trackWidget->getTrack()->type() != track::BB_TRACK )
{
multimediaProject mmp( multimediaProject::DRAG_N_DROP_DATA );
m_trackWidget->getTrack()->saveSettings( mmp, mmp.content() );
new stringPairDrag( "track_" +
QString::number( m_trackWidget->getTrack()->type() ),
m_trackWidget->getTrack()->saveState( mmp, mmp.content() );
new stringPairDrag( QString( "track_%1" ).arg(
m_trackWidget->getTrack()->type() ),
mmp.toString(), QPixmap::grabWidget(
&m_trackWidget->getTrackSettingsWidget() ),
this, m_trackWidget->getTrack()->eng() );
@@ -1214,7 +1250,7 @@ void trackWidget::dropEvent( QDropEvent * _de )
// value contains our XML-data so simply create a
// multimediaProject which does the rest for us...
multimediaProject mmp( value, FALSE );
m_track->loadSettings( mmp.content().firstChild().toElement() );
m_track->restoreState( mmp.content().firstChild().toElement() );
_de->accept();
}
}
@@ -1370,8 +1406,7 @@ midiTime trackWidget::endPosition( const midiTime & _pos_start )
// ===========================================================================
track::track( trackContainer * _tc ) :
settings(),
engineObject( _tc->eng() ),
journallingObject( _tc->eng() ),
m_trackContainer( _tc )
{
m_trackWidget = new trackWidget( this,
@@ -1404,7 +1439,7 @@ track * FASTCALL track::create( trackTypes _tt, trackContainer * _tc )
switch( _tt )
{
case CHANNEL_TRACK: t = new channelTrack( _tc ); break;
case CHANNEL_TRACK: t = new instrumentTrack( _tc ); break;
case BB_TRACK: t = new bbTrack( _tc ); break;
case SAMPLE_TRACK: t = new sampleTrack( _tc ); break;
// case EVENT_TRACK:
@@ -1430,7 +1465,7 @@ track * FASTCALL track::create( const QDomElement & _this,
{
track * t = create( static_cast<trackTypes>( _this.attribute(
"type" ).toInt() ), _tc );
t->loadSettings( _this );
t->restoreState( _this );
return( t );
}
@@ -1441,7 +1476,7 @@ track * FASTCALL track::clone( track * _track )
{
QDomDocument doc;
QDomElement parent = doc.createElement( "clone" );
_track->saveSettings( doc, parent );
_track->saveState( doc, parent );
QDomElement e = parent.firstChild().toElement();
return( create( e, _track->getTrackContainer() ) );
}
@@ -1457,25 +1492,26 @@ tact track::length( void ) const
void FASTCALL track::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void FASTCALL track::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
csize num_of_tcos = getTrackContentWidget()->numOfTCOs();
QDomElement track_de = _doc.createElement( "track" );
track_de.setAttribute( "type", type() );
track_de.setAttribute( "muted", muted() );
track_de.setAttribute( "height", m_trackWidget->height() );
_parent.appendChild( track_de );
_this.setTagName( "track" );
_this.setAttribute( "type", type() );
_this.setAttribute( "muted", muted() );
_this.setAttribute( "height", m_trackWidget->height() );
// let actual track (channelTrack, bbTrack, sampleTrack etc.) save
QDomElement ts_de = _doc.createElement( nodeName() );
// let actual track (instrumentTrack, bbTrack, sampleTrack etc.) save
// its settings
saveTrackSpecificSettings( _doc, track_de );
saveTrackSpecificSettings( _doc, ts_de );
_this.appendChild( ts_de );
// now save settings of all TCO's
for( csize i = 0; i < num_of_tcos; ++i )
{
trackContentObject * tco = getTCO( i );
tco->saveSettings( _doc, track_de );
tco->saveState( _doc, _this );
}
}
@@ -1500,15 +1536,20 @@ void FASTCALL track::loadSettings( const QDomElement & _this )
{
if( node.isElement() )
{
if( nodeName() == node.nodeName() )
if( node.nodeName() == nodeName() ||
#warning compat-code, remove in 0.3.0
( node.nodeName() == "channeltrack" &&
nodeName() == "instrumenttrack" )
)
{
loadTrackSpecificSettings( node.toElement() );
}
else
else if(
!node.toElement().attribute( "metadata" ).toInt() )
{
trackContentObject * tco = createTCO(
midiTime( 0 ) );
tco->loadSettings( node.toElement() );
tco->restoreState( node.toElement() );
addTCO( tco );
}
}

View File

@@ -55,7 +55,7 @@
#include "mixer.h"
#include "song_editor.h"
#include "string_pair_drag.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "mmp.h"
#include "config_mgr.h"
#include "import_filter.h"
@@ -70,8 +70,7 @@ trackContainer::trackContainer( engine * _engine ) :
, 0, Qt::WStyle_Title
#endif
),
settings(),
engineObject( _engine ),
journallingObject( _engine ),
m_currentPosition( 0, 0 ),
m_scrollArea( new scrollArea( this ) ),
m_ppt( DEFAULT_PIXELS_PER_TACT ),
@@ -105,18 +104,17 @@ trackContainer::~trackContainer()
void trackContainer::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void trackContainer::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement tc_de = _doc.createElement( "trackcontainer" );
tc_de.setAttribute( "type", nodeName() );
mainWindow::saveWidgetState( this, tc_de );
_parent.appendChild( tc_de );
_this.setTagName( "trackcontainer" );
_this.setAttribute( "type", nodeName() );
mainWindow::saveWidgetState( this, _this );
// save settings of each track
for( trackWidgetVector::iterator it = m_trackWidgets.begin();
it != m_trackWidgets.end(); ++it )
{
( *it )->getTrack()->saveSettings( _doc, tc_de );
( *it )->getTrack()->saveState( _doc, _this );
}
}
@@ -170,7 +168,8 @@ void trackContainer::loadSettings( const QDomElement & _this )
break;
}
if( node.isElement() )
if( node.isElement() &&
!node.toElement().attribute( "metadata" ).toInt() )
{
track::create( node.toElement(), this );
}
@@ -436,32 +435,32 @@ void trackContainer::dropEvent( QDropEvent * _de )
QString value = stringPairDrag::decodeValue( _de );
if( type == "instrument" )
{
channelTrack * ct = dynamic_cast<channelTrack *>(
instrumentTrack * it = dynamic_cast<instrumentTrack *>(
track::create( track::CHANNEL_TRACK,
this ) );
ct->loadInstrument( value );
ct->toggledChannelButton( TRUE );
it->loadInstrument( value );
it->toggledInstrumentTrackButton( TRUE );
_de->accept();
}
else if( type == "sampledata" || type == "samplefile" )
{
channelTrack * ct = dynamic_cast<channelTrack *>(
instrumentTrack * it = dynamic_cast<instrumentTrack *>(
track::create( track::CHANNEL_TRACK,
this ) );
instrument * i = ct->loadInstrument( "audiofileprocessor" );
instrument * i = it->loadInstrument( "audiofileprocessor" );
i->setParameter( type, value );
ct->toggledChannelButton( TRUE );
it->toggledInstrumentTrackButton( TRUE );
_de->accept();
}
else if( type == "presetfile" )
{
multimediaProject mmp( value );
channelTrack * ct = dynamic_cast<channelTrack *>(
instrumentTrack * it = dynamic_cast<instrumentTrack *>(
track::create( track::CHANNEL_TRACK,
this ) );
ct->loadTrackSpecificSettings( mmp.content().firstChild().
it->loadTrackSpecificSettings( mmp.content().firstChild().
toElement() );
ct->toggledChannelButton( TRUE );
it->toggledInstrumentTrackButton( TRUE );
_de->accept();
}
else if( type == "midifile" )

View File

@@ -30,8 +30,16 @@
#include "base64.h"
#include "types.h"
#ifndef QT3
#include <QVariant>
#include <QBuffer>
#else
#include <qvariant.h>
#include <qbuffer.h>
#ifdef QT3
namespace base64
{
@@ -168,4 +176,55 @@ void decode( const QString & _b64, char * * _data, int * _size )
#endif
namespace base64
{
QString encode( const QVariant & _data )
{
QBuffer buf;
#ifndef QT3
buf.open( QBuffer::WriteOnly );
#else
buf.open( IO_WriteOnly );
#endif
QDataStream out( &buf );
out << _data;
QByteArray data = buf.buffer();
QString dst;
#ifndef QT3
encode( data.constData(), data.size(), dst );
#else
encode( data.data(), data.size(), dst );
#endif
return( dst );
}
QVariant decode( const QString & _b64 )
{
char * dst = NULL;
int dsize = 0;
base64::decode( _b64, &dst, &dsize );
#ifndef QT3
QByteArray ba( dst, dsize );
QBuffer buf( &ba );
buf.open( QBuffer::ReadOnly );
#else
QByteArray ba;
ba.setRawData( dst, dsize );
QBuffer buf( ba );
buf.open( IO_ReadOnly );
#endif
QDataStream in( &buf );
QVariant ret;
in >> ret;
return( ret );
}
} ;
#endif

View File

@@ -26,7 +26,7 @@
#include "clipboard.h"
#include "settings.h"
#include "journalling_object.h"
namespace clipboard
@@ -35,13 +35,12 @@ namespace clipboard
map content;
void copy( settings * _settings_object )
void copy( journallingObject * _obj )
{
QDomDocument doc;
QDomElement parent = doc.createElement( "clipboard" );
_settings_object->saveSettings( doc, parent );
content[_settings_object->nodeName()] =
parent.firstChild().toElement();
_obj->saveState( doc, parent );
content[_obj->nodeName()] = parent.firstChild().toElement();
}

View File

@@ -0,0 +1,222 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* journalling_object.cpp - implementation of journalling-object related stuff
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include "journalling_object.h"
#include "project_journal.h"
#include "base64.h"
#include "qt3support.h"
#ifndef QT3
#include <Qt/QtXml>
#else
#include <qdom.h>
#endif
journallingObject::journallingObject( engine * _engine ) :
engineObject( _engine ),
m_id( ( eng() != NULL ) ? eng()->getProjectJournal()->allocID( this ) :
0 ),
m_journalEntries(),
m_currentJournalEntry( m_journalEntries.end() ),
m_journalling( TRUE )
{
}
journallingObject::~journallingObject()
{
if( eng() != NULL )
{
eng()->getProjectJournal()->freeID( id() );
}
}
void journallingObject::undo( void )
{
if( m_journalEntries.empty() == TRUE )
{
return;
}
if( m_currentJournalEntry - 1 >= m_journalEntries.begin() )
{
undoStep( *--m_currentJournalEntry );
}
}
void journallingObject::redo( void )
{
if( m_journalEntries.empty() == TRUE )
{
return;
}
if( m_currentJournalEntry < m_journalEntries.end() )
{
redoStep( *m_currentJournalEntry++ );
}
}
QDomElement journallingObject::saveState( QDomDocument & _doc,
QDomElement & _parent )
{
QDomElement _this = _doc.createElement( nodeName() );
saveSettings( _doc, _this );
saveJournal( _doc, _this );
_parent.appendChild( _this );
return( _this );
}
void journallingObject::restoreState( const QDomElement & _this )
{
saveJournallingState( FALSE );
loadSettings( _this );
QDomNode node = _this.firstChild();
while( !node.isNull() )
{
if( node.isElement() && node.nodeName() == "journal" )
{
loadJournal( node.toElement() );
}
node = node.nextSibling();
}
restoreJournallingState();
}
void journallingObject::addJournalEntry( const journalEntry & _edit_step )
{
if( !( eng() == NULL ||
eng()->getProjectJournal()->isJournalling() == FALSE ||
isJournalling() == FALSE ) )
{
m_journalEntries.erase( m_currentJournalEntry,
m_journalEntries.end() );
m_journalEntries.push_back( _edit_step );
m_currentJournalEntry = m_journalEntries.end();
eng()->getProjectJournal()->journalEntryAdded( id() );
}
}
void journallingObject::saveJournal( QDomDocument & _doc,
QDomElement & _parent )
{
/* // avoid creating empty journal-nodes
if( m_journalEntries.size() == 0 )
{
return;
}*/
QDomElement journal_de = _doc.createElement( "journal" );
journal_de.setAttribute( "id", id() );
journal_de.setAttribute( "entries", m_journalEntries.size() );
journal_de.setAttribute( "curentry", m_currentJournalEntry -
m_journalEntries.begin() );
journal_de.setAttribute( "metadata", TRUE );
for( journalEntryVector::const_iterator it = m_journalEntries.begin();
it != m_journalEntries.end(); ++it )
{
QDomElement je_de = _doc.createElement( "entry" );
je_de.setAttribute( "pos", it - m_journalEntries.begin() );
je_de.setAttribute( "actionid", it->actionID() );
je_de.setAttribute( "data", base64::encode( it->data() ) );
journal_de.appendChild( je_de );
}
_parent.appendChild( journal_de );
}
void journallingObject::loadJournal( const QDomElement & _this )
{
clear();
const jo_id_t new_id = _this.attribute( "id" ).toInt();
if( new_id == 0 )
{
return;
}
if( id() != new_id )
{
eng()->getProjectJournal()->forgetAboutID( id() );
eng()->getProjectJournal()->reallocID( new_id, this );
m_id = new_id;
}
m_journalEntries.resize( _this.attribute( "entries" ).toInt() );
QDomNode node = _this.firstChild();
while( !node.isNull() )
{
if( node.isElement() )
{
const QDomElement & je = node.toElement();
m_journalEntries[je.attribute( "pos" ).toInt()] =
journalEntry(
je.attribute( "actionid" ).toInt(),
base64::decode( je.attribute( "data" ) ) );
}
node = node.nextSibling();
}
m_currentJournalEntry = m_journalEntries.begin() +
_this.attribute( "curentry" ).toInt();
}
#endif

View File

@@ -55,11 +55,14 @@ multimediaProject::typeDescStruct
{ multimediaProject::UNKNOWN, "unknown" },
{ multimediaProject::SONG_PROJECT, "song" },
{ multimediaProject::SONG_PROJECT_TEMPLATE, "songtemplate" },
{ multimediaProject::CHANNEL_SETTINGS, "channelsettings" },
#warning compat-code, remove in 0.3.0
{ multimediaProject::INSTRUMENT_TRACK_SETTINGS,
"instrumenttracksettings,channelsettings" },
{ multimediaProject::DRAG_N_DROP_DATA, "dnddata" },
{ multimediaProject::JOURNAL_DATA, "journaldata" },
{ multimediaProject::EFFECT_SETTINGS, "effectsettings" },
{ multimediaProject::VIDEO_PROJECT, "video" },
{ multimediaProject::BURN_PROJECT, "burn" },
{ multimediaProject::VIDEO_PROJECT, "videoproject" },
{ multimediaProject::BURN_PROJECT, "burnproject" },
{ multimediaProject::PLAYLIST, "playlist" }
} ;
@@ -162,7 +165,9 @@ multimediaProject::multimediaProject( const QString & _in_file_name,
{
m_head = node.toElement();
}
else if( node.nodeName() == typeName( m_type ) )
else if( node.nodeName() == typeName( m_type ) ||
#warning compat-code, remove in 0.3.0
node.nodeName() == "channelsettings" )
{
m_content = node.toElement();
}
@@ -189,7 +194,7 @@ bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
#endif
);
QString fn = _fn;
if( type() == CHANNEL_SETTINGS )
if( type() == INSTRUMENT_TRACK_SETTINGS )
{
if( fn.section( '.', -2, -1 ) != "cs.xml" )
{
@@ -282,7 +287,12 @@ multimediaProject::projectTypes multimediaProject::type(
{
for( int i = 0; i < PROJ_TYPE_COUNT; ++i )
{
if( s_types[i].m_name == _type_name )
if( s_types[i].m_name == _type_name || (
s_types[i].m_name.contains( "," ) && (
s_types[i].m_name.section( ',', 0, 0 ) == _type_name ||
s_types[i].m_name.section( ',', 1, 1 ) == _type_name ) )
)
{
return( static_cast<multimediaProject::projectTypes>(
i ) );

162
src/lib/project_journal.cpp Normal file
View File

@@ -0,0 +1,162 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* project_journal.cpp - implementation of project-journal
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include <cstdlib>
#include "project_journal.h"
#include "journalling_object.h"
#include "song_editor.h"
projectJournal::projectJournal( engine * _engine ) :
engineObject( _engine ),
m_joIDs(),
m_journalEntries(),
m_currentJournalEntry( m_journalEntries.end() )
{
}
projectJournal::~projectJournal()
{
}
void projectJournal::undo( void )
{
if( m_journalEntries.empty() == TRUE )
{
return;
}
journallingObject * jo;
if( m_currentJournalEntry - 1 >= m_journalEntries.begin() &&
( jo = m_joIDs[*--m_currentJournalEntry] ) != NULL )
{
jo->undo();
eng()->getSongEditor()->setModified();
}
}
void projectJournal::redo( void )
{
if( m_journalEntries.empty() == TRUE )
{
return;
}
journallingObject * jo;
if( m_currentJournalEntry < m_journalEntries.end() &&
( jo = m_joIDs[*m_currentJournalEntry++] ) != NULL )
{
jo->redo();
eng()->getSongEditor()->setModified();
}
}
void projectJournal::journalEntryAdded( const jo_id_t _id )
{
m_journalEntries.erase( m_currentJournalEntry, m_journalEntries.end() );
m_journalEntries.push_back( _id );
m_currentJournalEntry = m_journalEntries.end();
eng()->getSongEditor()->setModified();
printf("history size:%d\n", m_journalEntries.size());
}
jo_id_t projectJournal::allocID( journallingObject * _obj )
{
const jo_id_t EO_ID_MAX = 1 << 20;
jo_id_t id;
while( m_joIDs.contains( id = static_cast<jo_id_t>( (float) rand() /
RAND_MAX * EO_ID_MAX ) ) )
{
}
m_joIDs[id] = _obj;
//printf("new id: %d\n", id );
return( id );
}
void projectJournal::reallocID( const jo_id_t _id, journallingObject * _obj )
{
//printf("realloc %d %d\n", _id, _obj);
if( m_joIDs.contains( _id ) )
{
m_joIDs[_id] = _obj;
}
}
void projectJournal::forgetAboutID( const jo_id_t _id )
{
journalEntryVector::iterator it;
while( ( it = qFind( m_journalEntries.begin(), m_journalEntries.end(),
_id ) ) != m_journalEntries.end() )
{
if( m_currentJournalEntry >= it )
{
--m_currentJournalEntry;
}
m_journalEntries.erase( it );
}
m_joIDs.erase( _id );
}
void projectJournal::clear( void )
{
while( m_joIDs.size() )
{
forgetAboutID( m_joIDs.keys().front() );
}
}
#endif

View File

@@ -1,8 +1,11 @@
#ifdef SINGLE_SOURCE_COMPILE
#undef SINGLE_SOURCE_COMPILE
#include "src/tracks/instrument_track.cpp"
#include "src/core/midi_tab_widget.cpp"
#include "src/lib/string_pair_drag.cpp"
#include "src/lib/buffer_allocator.cpp"
#include "src/lib/edit_history.cpp"
#include "src/lib/journalling_object.cpp"
#include "src/lib/project_journal.cpp"
#include "src/lib/embed.cpp"
#include "src/lib/base64.cpp"
#include "src/lib/mmp.cpp"
@@ -39,7 +42,6 @@
#include "src/core/track.cpp"
#include "src/core/file_browser.cpp"
#include "src/core/surround_area.cpp"
#include "src/core/midi_tab_widget.cpp"
#include "src/midi/midi_alsa_seq.cpp"
#include "src/midi/midi_oss.cpp"
#include "src/midi/midi_port.cpp"
@@ -59,7 +61,6 @@
#include "src/lmms_single_source.cpp"
#include "src/tracks/pattern.cpp"
#include "src/tracks/bb_track.cpp"
#include "src/tracks/channel_track.cpp"
#include "src/tracks/sample_track.cpp"
#include "src/widgets/project_notes.cpp"
#include "src/widgets/led_checkbox.cpp"

View File

@@ -72,9 +72,9 @@ bbTCO::bbTCO( track * _track, const QColor & _c ) :
bbTrack::numOfBBTrack( getTrack() ) );
if( t > 0 )
{
saveStepRecordingState( FALSE );
saveJournallingState( FALSE );
changeLength( midiTime( t, 0 ) );
restoreStepRecordingState();
restoreJournallingState();
}
}
@@ -192,21 +192,19 @@ void bbTCO::paintEvent( QPaintEvent * )
void bbTCO::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void bbTCO::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement bbtco_de = _doc.createElement( nodeName() );
bbtco_de.setAttribute( "name", m_name );
if( _parent.nodeName() == "clipboard" )
_this.setAttribute( "name", m_name );
if( _this.parentNode().nodeName() == "clipboard" )
{
bbtco_de.setAttribute( "pos", -1 );
_this.setAttribute( "pos", -1 );
}
else
{
bbtco_de.setAttribute( "pos", startPosition() );
_this.setAttribute( "pos", startPosition() );
}
bbtco_de.setAttribute( "len", length() );
bbtco_de.setAttribute( "color", m_color.rgb() );
_parent.appendChild( bbtco_de );
_this.setAttribute( "len", length() );
_this.setAttribute( "color", m_color.rgb() );
}
@@ -419,18 +417,16 @@ trackContentObject * bbTrack::createTCO( const midiTime & _pos )
void bbTrack::saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent )
QDomElement & _this )
{
QDomElement bbt_de = _doc.createElement( nodeName() );
bbt_de.setAttribute( "name", m_trackLabel->text() );
bbt_de.setAttribute( "icon", m_trackLabel->pixmapFile() );
/* bbt_de.setAttribute( "current", s_infoMap[this] ==
_this.setAttribute( "name", m_trackLabel->text() );
_this.setAttribute( "icon", m_trackLabel->pixmapFile() );
/* _this.setAttribute( "current", s_infoMap[this] ==
eng()->getBBEditor()->currentBB() );*/
_parent.appendChild( bbt_de );
if( s_infoMap[this] == 0 &&
_parent.parentNode().nodeName() != "clone" )
_this.parentNode().nodeName() != "clone" )
{
eng()->getBBEditor()->saveSettings( _doc, bbt_de );
eng()->getBBEditor()->saveState( _doc, _this );
}
}
@@ -446,7 +442,7 @@ void bbTrack::loadTrackSpecificSettings( const QDomElement & _this )
}
if( _this.firstChild().isElement() )
{
eng()->getBBEditor()->loadSettings(
eng()->getBBEditor()->restoreState(
_this.firstChild().toElement() );
}
/* doesn't work yet because bbTrack-ctor also sets current bb so if

File diff suppressed because it is too large Load Diff

View File

@@ -56,7 +56,7 @@
#include "pattern.h"
#include "channel_track.h"
#include "instrument_track.h"
#include "templates.h"
#include "gui_templates.h"
#include "embed.h"
@@ -81,13 +81,13 @@ QPixmap * pattern::s_frozen = NULL;
pattern::pattern ( channelTrack * _channel_track ) :
trackContentObject( _channel_track ),
pattern::pattern ( instrumentTrack * _instrument_track ) :
trackContentObject( _instrument_track ),
m_paintPixmap(),
m_needsUpdate( TRUE ),
m_channelTrack( _channel_track ),
m_instrumentTrack( _instrument_track ),
m_patternType( BEAT_PATTERN ),
m_name( _channel_track->name() ),
m_name( _instrument_track->name() ),
m_steps( DEFAULT_STEPS_PER_TACT ),
m_frozenPatternMutex(),
m_frozenPattern( NULL ),
@@ -101,10 +101,10 @@ pattern::pattern ( channelTrack * _channel_track ) :
pattern::pattern( const pattern & _pat_to_copy ) :
trackContentObject( _pat_to_copy.m_channelTrack ),
trackContentObject( _pat_to_copy.m_instrumentTrack ),
m_paintPixmap(),
m_needsUpdate( TRUE ),
m_channelTrack( _pat_to_copy.m_channelTrack ),
m_instrumentTrack( _pat_to_copy.m_instrumentTrack ),
m_patternType( _pat_to_copy.m_patternType ),
m_name( "" ),
m_steps( _pat_to_copy.m_steps ),
@@ -186,12 +186,12 @@ void pattern::init( void )
s_frozen = new QPixmap( embed::getIconPixmap( "frozen" ) );
}
saveStepRecordingState( FALSE );
saveJournallingState( FALSE );
ensureBeatNotes();
changeLength( length() );
restoreStepRecordingState();
restoreJournallingState();
#ifndef QT4
// set background-mode for flicker-free redraw
@@ -411,27 +411,25 @@ void pattern::playFrozenData( sampleFrame * _ab, const f_cnt_t _start_frame,
void pattern::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void pattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement pattern_de = _doc.createElement( nodeName() );
pattern_de.setAttribute( "type", m_patternType );
pattern_de.setAttribute( "name", m_name );
_this.setAttribute( "type", m_patternType );
_this.setAttribute( "name", m_name );
// as the target of copied/dragged pattern is always an existing
// pattern, we must not store actual position, instead we store -1
// which tells loadSettings() not to mess around with position
if( _parent.nodeName() == "clipboard" ||
_parent.nodeName() == "dnddata" )
if( _this.parentNode().nodeName() == "clipboard" ||
_this.parentNode().nodeName() == "dnddata" )
{
pattern_de.setAttribute( "pos", -1 );
_this.setAttribute( "pos", -1 );
}
else
{
pattern_de.setAttribute( "pos", startPosition() );
_this.setAttribute( "pos", startPosition() );
}
pattern_de.setAttribute( "len", length() );
pattern_de.setAttribute( "steps", m_steps );
pattern_de.setAttribute( "frozen", m_frozenPattern != NULL );
_parent.appendChild( pattern_de );
_this.setAttribute( "len", length() );
_this.setAttribute( "steps", m_steps );
_this.setAttribute( "frozen", m_frozenPattern != NULL );
// now save settings of all notes
for( noteVector::iterator it = m_notes.begin();
@@ -439,7 +437,7 @@ void pattern::saveSettings( QDomDocument & _doc, QDomElement & _parent )
{
if( ( *it )->length() )
{
( *it )->saveSettings( _doc, pattern_de );
( *it )->saveState( _doc, _this );
}
}
}
@@ -465,10 +463,11 @@ void pattern::loadSettings( const QDomElement & _this )
QDomNode node = _this.firstChild();
while( !node.isNull() )
{
if( node.isElement() )
if( node.isElement() &&
!node.toElement().attribute( "metadata" ).toInt() )
{
note * n = new note();
n->loadSettings( node.toElement() );
note * n = new note( eng() );
n->restoreState( node.toElement() );
m_notes.push_back( n );
}
node = node.nextSibling();
@@ -530,7 +529,7 @@ void pattern::clear( void )
void pattern::resetName( void )
{
m_name = m_channelTrack->name();
m_name = m_instrumentTrack->name();
}
@@ -558,7 +557,7 @@ void pattern::freeze( void )
QMessageBox::Ok );
return;
}
if( m_channelTrack->muted() )
if( m_instrumentTrack->muted() )
{
if( QMessageBox::
#if QT_VERSION >= 0x030200
@@ -1143,7 +1142,7 @@ void pattern::ensureBeatNotes( void )
}
if( found == FALSE )
{
addNote( note( midiTime( 0 ), midiTime( i *
addNote( note( eng(), midiTime( 0 ), midiTime( i *
BEATS_PER_TACT ) ) );
}
}

View File

@@ -64,9 +64,9 @@ sampleTCO::sampleTCO( track * _track ) :
setBackgroundMode( Qt::NoBackground );
#endif
saveStepRecordingState( FALSE );
saveJournallingState( FALSE );
setSampleFile( "" );
restoreStepRecordingState();
restoreJournallingState();
// we need to receive bpm-change-events, because then we have to
// change length of this TCO
@@ -253,26 +253,24 @@ midiTime sampleTCO::getSampleLength( void ) const
void FASTCALL sampleTCO::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
QDomElement & _this )
{
QDomElement sampletco_de = _doc.createElement( nodeName() );
if( _parent.nodeName() == "clipboard" )
if( _this.parentNode().nodeName() == "clipboard" )
{
sampletco_de.setAttribute( "pos", -1 );
_this.setAttribute( "pos", -1 );
}
else
{
sampletco_de.setAttribute( "pos", startPosition() );
_this.setAttribute( "pos", startPosition() );
}
sampletco_de.setAttribute( "len", length() );
sampletco_de.setAttribute( "src", sampleFile() );
_this.setAttribute( "len", length() );
_this.setAttribute( "src", sampleFile() );
if( sampleFile() == "" )
{
QString s;
sampletco_de.setAttribute( "data", m_sampleBuffer.toBase64( s ) );
_this.setAttribute( "data", m_sampleBuffer.toBase64( s ) );
}
// TODO: start- and end-frame
_parent.appendChild( sampletco_de );
}
@@ -454,12 +452,10 @@ trackContentObject * sampleTrack::createTCO( const midiTime & )
void sampleTrack::saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent )
QDomElement & _this )
{
QDomElement st_de = _doc.createElement( nodeName() );
st_de.setAttribute( "name", m_trackLabel->text() );
st_de.setAttribute( "icon", m_trackLabel->pixmapFile() );
_parent.appendChild( st_de );
_this.setAttribute( "name", m_trackLabel->text() );
_this.setAttribute( "icon", m_trackLabel->pixmapFile() );
}

View File

@@ -33,7 +33,7 @@ automatableButton::automatableButton( QWidget * _parent, engine * _engine ) :
QWidget( _parent ),
autoObj( _engine, FALSE, TRUE, FALSE ),
m_group( NULL ),
m_toggleButton( FALSE )
m_checkable( FALSE )
{
}
@@ -55,7 +55,7 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton )
{
if( m_toggleButton == FALSE )
if( m_checkable == FALSE )
{
setChecked( TRUE );
}
@@ -76,7 +76,7 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
void automatableButton::mouseReleaseEvent( QMouseEvent * _me )
{
if( m_toggleButton == FALSE )
if( m_checkable == FALSE )
{
setChecked( FALSE );
}
@@ -88,7 +88,7 @@ void automatableButton::mouseReleaseEvent( QMouseEvent * _me )
void automatableButton::toggle( void )
{
if( m_toggleButton == TRUE && m_group != NULL )
if( m_checkable == TRUE && m_group != NULL )
{
if( value() == FALSE )
{
@@ -147,11 +147,11 @@ automatableButtonGroup::~automatableButtonGroup()
void automatableButtonGroup::addButton( automatableButton * _btn )
{
_btn->m_group = this;
_btn->setToggleButton( TRUE );
_btn->setCheckable( TRUE );
_btn->setChecked( FALSE );
// disable step-recording as we're recording changes of states of
// button-group members on our own
_btn->setStepRecording( FALSE );
_btn->setJournalling( FALSE );
m_buttons.push_back( _btn );
setRange( 0, m_buttons.size() - 1 );

View File

@@ -74,7 +74,7 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent,
updatePixmap();
m_led = new pixmapButton( this, eng() );
m_led->setToggleButton( TRUE );
m_led->setCheckable( TRUE );
m_led->move( 2, 3 );
m_led->setActiveGraphic( embed::getIconPixmap( "led_green" ) );
m_led->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );

View File

@@ -5,7 +5,7 @@
#include "qt3support.h"
#ifdef QT4
#ifndef QT3
#include "kmultitabbar.h"
@@ -1220,7 +1220,7 @@ KMultiTabBarTab::KMultiTabBarTab(const QPixmap& pic, const QString& text,
d=new KMultiTabBarTabPrivate();
setIcon(pic);
m_expandedSize=24;
setCheckable(true);
setToggleButton(true);
}
KMultiTabBarTab::~KMultiTabBarTab() {

View File

@@ -411,7 +411,7 @@ void knob::mousePressEvent( QMouseEvent * _me )
if( _me->button() == Qt::LeftButton &&
eng()->getMainWindow()->isCtrlPressed() == FALSE )
{
setStepRecording( FALSE );
setJournalling( FALSE );
m_oldValue = value();
const QPoint & p = _me->pos();
@@ -478,8 +478,8 @@ void knob::mouseMoveEvent( QMouseEvent * _me )
//! Mouse Release Event handler
void knob::mouseReleaseEvent( QMouseEvent * /* _me*/ )
{
setStepRecording( TRUE );
addStepFromOldToCurVal();
setJournalling( TRUE );
addJournalEntryFromOldToCurVal();
if( m_buttonPressed )
{

View File

@@ -170,10 +170,10 @@ void lcdSpinBox::mouseMoveEvent( QMouseEvent * _me )
int dy = _me->globalY() - m_origMousePos.y();
if( dy > 1 || dy < -1 )
{
setStepRecording( FALSE );// why is this neccessary?!
setJournalling( FALSE );// why is this neccessary?!
setInitValue( value() - dy / 2 * step() );
emit valueChanged( value() );
setStepRecording( TRUE );
setJournalling( TRUE );
QCursor::setPos( m_origMousePos );
}
}
@@ -184,7 +184,7 @@ void lcdSpinBox::mouseMoveEvent( QMouseEvent * _me )
void lcdSpinBox::mouseReleaseEvent( QMouseEvent * _me )
{
addStepFromOldToCurVal();
addJournalEntryFromOldToCurVal();
QCursor::setPos( m_origMousePos );
QApplication::restoreOverrideCursor();

View File

@@ -59,7 +59,7 @@ ledCheckBox::ledCheckBox( const QString & _text, QWidget * _parent,
automatableButton( _parent, _engine ),
m_text( _text )
{
setToggleButton( TRUE );
setCheckable( TRUE );
if( _color >= TOTAL_COLORS || _color < YELLOW )
{

View File

@@ -79,7 +79,7 @@ projectNotes::projectNotes( engine * _engine) :
, 0, Qt::WStyle_Title
#endif
),
engineObject( _engine )
journallingObject( _engine )
{
#ifdef QT4
eng()->getMainWindow()->workspace()->addWindow( this );
@@ -570,15 +570,12 @@ void projectNotes::alignmentChanged( int _a )
void projectNotes::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void projectNotes::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
QDomElement pn_de = _doc.createElement( nodeName() );
mainWindow::saveWidgetState( this, pn_de );
mainWindow::saveWidgetState( this, _this );
QDomCDATASection ds = _doc.createCDATASection( m_edit->toHtml() );
pn_de.appendChild( ds );
_parent.appendChild( pn_de );
_this.appendChild( ds );
}