renamed time* classes to automation* ones
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@183 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
12
Makefile.am
12
Makefile.am
@@ -48,6 +48,8 @@ lmms_MOC = \
|
||||
./about_dialog.moc \
|
||||
./arp_and_chords_tab_widget.moc \
|
||||
./automatable_button.moc \
|
||||
./automation_editor.moc \
|
||||
./automation_pattern.moc \
|
||||
./bb_editor.moc \
|
||||
./bb_track.moc \
|
||||
./instrument_track.moc \
|
||||
@@ -92,8 +94,6 @@ lmms_MOC = \
|
||||
./tab_button.moc \
|
||||
./tab_widget.moc \
|
||||
./tempo_sync_knob.moc \
|
||||
./time_pattern.moc \
|
||||
./time_roll.moc \
|
||||
./timeline.moc \
|
||||
./tool_button.moc \
|
||||
./track_container.moc \
|
||||
@@ -125,6 +125,7 @@ lmms_SOURCES = \
|
||||
$(srcdir)/src/audio/audio_sdl.cpp \
|
||||
$(srcdir)/src/core/about_dialog.cpp \
|
||||
$(srcdir)/src/core/arp_and_chords_tab_widget.cpp \
|
||||
$(srcdir)/src/core/automation_editor.cpp \
|
||||
$(srcdir)/src/core/bb_editor.cpp \
|
||||
$(srcdir)/src/core/config_mgr.cpp \
|
||||
$(srcdir)/src/core/engine.cpp \
|
||||
@@ -152,7 +153,6 @@ lmms_SOURCES = \
|
||||
$(srcdir)/src/core/track.cpp \
|
||||
$(srcdir)/src/core/track_container.cpp \
|
||||
$(srcdir)/src/core/surround_area.cpp \
|
||||
$(srcdir)/src/core/time_roll.cpp \
|
||||
$(srcdir)/src/core/timeline.cpp \
|
||||
$(srcdir)/src/lib/base64.cpp \
|
||||
$(srcdir)/src/lib/buffer_allocator.cpp \
|
||||
@@ -171,11 +171,11 @@ lmms_SOURCES = \
|
||||
$(srcdir)/src/midi/midi_mapper.cpp \
|
||||
$(srcdir)/src/midi/midi_oss.cpp \
|
||||
$(srcdir)/src/midi/midi_port.cpp \
|
||||
$(srcdir)/src/tracks/automation_pattern.cpp \
|
||||
$(srcdir)/src/tracks/bb_track.cpp \
|
||||
$(srcdir)/src/tracks/instrument_track.cpp \
|
||||
$(srcdir)/src/tracks/pattern.cpp \
|
||||
$(srcdir)/src/tracks/sample_track.cpp \
|
||||
$(srcdir)/src/tracks/time_pattern.cpp \
|
||||
$(srcdir)/src/widgets/automatable_button.cpp \
|
||||
$(srcdir)/src/widgets/combobox.cpp \
|
||||
$(srcdir)/src/widgets/cpuload_widget.cpp \
|
||||
@@ -214,6 +214,8 @@ lmms_SOURCES = \
|
||||
$(srcdir)/include/audio_oss.h \
|
||||
$(srcdir)/include/audio_sample_recorder.h \
|
||||
$(srcdir)/include/audio_sdl.h \
|
||||
$(srcdir)/include/automation_editor.h \
|
||||
$(srcdir)/include/automation_pattern.h \
|
||||
$(srcdir)/include/interpolation.h \
|
||||
$(srcdir)/include/lmms_constants.h \
|
||||
$(srcdir)/include/lmms_math.h \
|
||||
@@ -272,8 +274,6 @@ lmms_SOURCES = \
|
||||
$(srcdir)/include/types.h \
|
||||
$(srcdir)/include/qt3support.h \
|
||||
$(srcdir)/include/embed.h \
|
||||
$(srcdir)/include/time_pattern.h \
|
||||
$(srcdir)/include/time_roll.h \
|
||||
$(srcdir)/include/timeline.h \
|
||||
$(srcdir)/include/config_mgr.h \
|
||||
$(srcdir)/include/spc_bg_hndl_widget.h \
|
||||
|
||||
258
include/automation_editor.h
Normal file
258
include/automation_editor.h
Normal file
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* automation_editor.h - declaration of class automationEditor which is a window
|
||||
* where you can edit dynamic values in an easy way
|
||||
*
|
||||
* Copyright (c) 2006 Javier Serrano Polo <jasp00/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 _AUTOMATION_EDITOR_H
|
||||
#define _AUTOMATION_EDITOR_H
|
||||
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtGui/QPixmap>
|
||||
|
||||
#else
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qvaluevector.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "note.h"
|
||||
#include "engine.h"
|
||||
#include "journalling_object.h"
|
||||
#include "automation_pattern.h"
|
||||
|
||||
|
||||
class QPainter;
|
||||
class QPixmap;
|
||||
class QScrollBar;
|
||||
|
||||
class comboBox;
|
||||
class notePlayHandle;
|
||||
class timeLine;
|
||||
class toolButton;
|
||||
|
||||
|
||||
class automationEditor : public QWidget, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
void FASTCALL setCurrentPattern( automationPattern * _new_pattern );
|
||||
|
||||
inline const automationPattern * currentPattern( void ) const
|
||||
{
|
||||
return( m_pattern );
|
||||
}
|
||||
|
||||
inline bool validPattern( void ) const
|
||||
{
|
||||
return( m_pattern != NULL );
|
||||
}
|
||||
|
||||
int quantization( void ) const;
|
||||
|
||||
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "automation-editor" );
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void update( void );
|
||||
|
||||
|
||||
protected:
|
||||
typedef automationPattern::timeMap timeMap;
|
||||
|
||||
virtual void closeEvent( QCloseEvent * _ce );
|
||||
virtual void enterEvent( QEvent * _e );
|
||||
virtual void keyPressEvent( QKeyEvent * _ke );
|
||||
virtual void leaveEvent( QEvent * _e );
|
||||
virtual void mousePressEvent( QMouseEvent * _me );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * _me );
|
||||
virtual void mouseMoveEvent( QMouseEvent * _me );
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
virtual void resizeEvent( QResizeEvent * _re );
|
||||
virtual void wheelEvent( QWheelEvent * _we );
|
||||
|
||||
int FASTCALL getValue( int _y );
|
||||
static inline void drawValueRect( QPainter & _p, Uint16 _x, Uint16 _y,
|
||||
Sint16 _width, Sint16 _height,
|
||||
const bool _is_selected );
|
||||
void removeSelection( void );
|
||||
void selectAll( void );
|
||||
void FASTCALL getSelectedValues( timeMap & _selected_values );
|
||||
|
||||
|
||||
protected slots:
|
||||
void play( void );
|
||||
void stop( void );
|
||||
|
||||
void horScrolled( int _new_pos );
|
||||
void verScrolled( int _new_pos );
|
||||
|
||||
void drawButtonToggled( void );
|
||||
void eraseButtonToggled( void );
|
||||
void selectButtonToggled( void );
|
||||
void moveButtonToggled( void );
|
||||
|
||||
void copySelectedValues( void );
|
||||
void cutSelectedValues( void );
|
||||
void pasteValues( void );
|
||||
void deleteSelectedValues( void );
|
||||
|
||||
void updatePosition( const midiTime & _t );
|
||||
|
||||
void zoomingXChanged( const QString & _zfac );
|
||||
void zoomingYChanged( const QString & _zfac );
|
||||
|
||||
|
||||
private:
|
||||
|
||||
enum editModes
|
||||
{
|
||||
DRAW,
|
||||
ERASE,
|
||||
SELECT,
|
||||
MOVE
|
||||
} ;
|
||||
|
||||
enum actions
|
||||
{
|
||||
NONE,
|
||||
MOVE_VALUE,
|
||||
SELECT_VALUES,
|
||||
MOVE_SELECTION
|
||||
} ;
|
||||
|
||||
// some constants...
|
||||
static const int INITIAL_WIDTH = 640;
|
||||
static const int INITIAL_HEIGHT = 480;
|
||||
|
||||
static const int SCROLLBAR_SIZE = 16;
|
||||
static const int TOP_MARGIN = 48;
|
||||
|
||||
static const int DEFAULT_Y_DELTA = 12;
|
||||
static const int DEFAULT_STEPS_PER_TACT = 16;
|
||||
static const int DEFAULT_PPT = 12 * DEFAULT_STEPS_PER_TACT;
|
||||
|
||||
static const int VALUES_WIDTH = 64;
|
||||
|
||||
automationEditor( engine * _engine );
|
||||
automationEditor( const automationEditor & );
|
||||
virtual ~automationEditor();
|
||||
|
||||
|
||||
static QPixmap * s_toolDraw;
|
||||
static QPixmap * s_toolErase;
|
||||
static QPixmap * s_toolSelect;
|
||||
static QPixmap * s_toolMove;
|
||||
|
||||
|
||||
QWidget * m_toolBar;
|
||||
|
||||
toolButton * m_playButton;
|
||||
toolButton * m_stopButton;
|
||||
|
||||
toolButton * m_drawButton;
|
||||
toolButton * m_eraseButton;
|
||||
toolButton * m_selectButton;
|
||||
toolButton * m_moveButton;
|
||||
|
||||
toolButton * m_cutButton;
|
||||
toolButton * m_copyButton;
|
||||
toolButton * m_pasteButton;
|
||||
|
||||
comboBox * m_zoomingXComboBox;
|
||||
comboBox * m_zoomingYComboBox;
|
||||
comboBox * m_quantizeComboBox;
|
||||
|
||||
QPixmap m_paintPixmap;
|
||||
bool m_cursorInside;
|
||||
|
||||
|
||||
automationPattern * m_pattern;
|
||||
int m_min_level;
|
||||
int m_max_level;
|
||||
int m_scroll_level;
|
||||
int m_bottom_level;
|
||||
int m_top_level;
|
||||
|
||||
void updateTopBottomLevels( void );
|
||||
|
||||
QScrollBar * m_leftRightScroll;
|
||||
QScrollBar * m_topBottomScroll;
|
||||
|
||||
midiTime m_currentPosition;
|
||||
|
||||
actions m_action;
|
||||
|
||||
Uint32 m_selectStartTact64th;
|
||||
int m_selectedTact64th;
|
||||
int m_selectStartKey;
|
||||
int m_selectedKeys;
|
||||
|
||||
int m_moveStartKey;
|
||||
int m_moveStartTact64th;
|
||||
int m_moveXOffset;
|
||||
|
||||
int m_ppt;
|
||||
int m_y_delta;
|
||||
|
||||
timeMap m_valuesToCopy;
|
||||
timeMap m_selValuesForMove;
|
||||
|
||||
|
||||
editModes m_editMode;
|
||||
|
||||
|
||||
timeLine * m_timeLine;
|
||||
bool m_scrollBack;
|
||||
|
||||
bool xVisible( int _x );
|
||||
bool inBBEditor( void );
|
||||
|
||||
|
||||
|
||||
friend class engine;
|
||||
|
||||
|
||||
signals:
|
||||
void positionChanged( const midiTime & );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
111
include/automation_pattern.h
Normal file
111
include/automation_pattern.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* automation_pattern.h - declaration of class automationPattern, which contains
|
||||
* all information about an automation pattern
|
||||
*
|
||||
* Copyright (c) 2006 Javier Serrano Polo <jasp00/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 _AUTOMATION_PATTERN_H
|
||||
#define _AUTOMATION_PATTERN_H
|
||||
|
||||
#include "qt3support.h"
|
||||
#include "track.h"
|
||||
#include "level_object.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class automationPattern : public QObject, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef QMap<midiTime, int> timeMap;
|
||||
|
||||
automationPattern( track * _channel_track, levelObject * _object );
|
||||
automationPattern( const automationPattern & _pat_to_copy );
|
||||
virtual ~automationPattern();
|
||||
|
||||
|
||||
virtual midiTime length( void ) const;
|
||||
|
||||
midiTime FASTCALL putValue( const midiTime & _time, const int _value,
|
||||
const bool _quant_pos = TRUE );
|
||||
|
||||
void FASTCALL removeValue( const midiTime & _time );
|
||||
|
||||
void clearValues( void );
|
||||
|
||||
inline timeMap & getTimeMap( void )
|
||||
{
|
||||
return( m_time_map );
|
||||
}
|
||||
|
||||
int FASTCALL valueAt( const midiTime & _time );
|
||||
|
||||
const QString name( void );
|
||||
|
||||
// settings-management
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
|
||||
static inline const QString classNodeName( void )
|
||||
{
|
||||
return( "automation-pattern" );
|
||||
}
|
||||
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( classNodeName() );
|
||||
}
|
||||
|
||||
inline track * getTrack( void )
|
||||
{
|
||||
return( m_track );
|
||||
}
|
||||
|
||||
inline levelObject * object( void )
|
||||
{
|
||||
return( m_object );
|
||||
}
|
||||
|
||||
void processMidiTime( const midiTime & _time );
|
||||
|
||||
|
||||
protected slots:
|
||||
void openInAutomationEditor( void );
|
||||
void clear( void );
|
||||
|
||||
|
||||
private:
|
||||
track * m_track;
|
||||
levelObject * m_object;
|
||||
timeMap m_time_map;
|
||||
|
||||
void init( void );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -26,6 +26,7 @@
|
||||
#ifndef _ENGINE_H
|
||||
#define _ENGINE_H
|
||||
|
||||
class automationEditor;
|
||||
class bbEditor;
|
||||
class projectJournal;
|
||||
class mainWindow;
|
||||
@@ -33,7 +34,6 @@ class mixer;
|
||||
class pianoRoll;
|
||||
class projectNotes;
|
||||
class songEditor;
|
||||
class timeRoll;
|
||||
|
||||
|
||||
class engine
|
||||
@@ -98,9 +98,9 @@ public:
|
||||
return( m_projectJournal );
|
||||
}
|
||||
|
||||
inline timeRoll * getTimeRoll( void )
|
||||
inline automationEditor * getAutomationEditor( void )
|
||||
{
|
||||
return( m_timeRoll );
|
||||
return( m_automationEditor );
|
||||
}
|
||||
|
||||
|
||||
@@ -110,11 +110,11 @@ private:
|
||||
mixer * m_mixer;
|
||||
mainWindow * m_mainWindow;
|
||||
songEditor * m_songEditor;
|
||||
automationEditor * m_automationEditor;
|
||||
bbEditor * m_bbEditor;
|
||||
pianoRoll * m_pianoRoll;
|
||||
projectNotes * m_projectNotes;
|
||||
projectJournal * m_projectJournal;
|
||||
timeRoll * m_timeRoll;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -118,11 +118,11 @@ public slots:
|
||||
void showSettingsDialog( void );
|
||||
void aboutLMMS( void );
|
||||
void help( void );
|
||||
void toggleAutomationEditorWin( void );
|
||||
void toggleBBEditorWin( void );
|
||||
void toggleSongEditorWin( void );
|
||||
void toggleProjectNotesWin( void );
|
||||
void togglePianoRollWin( void );
|
||||
void toggleTimeRollWin( void );
|
||||
|
||||
void undo( void );
|
||||
void redo( void );
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
PLAY_TRACK,
|
||||
PLAY_BB,
|
||||
PLAY_PATTERN,
|
||||
PLAY_TIME_PATTERN,
|
||||
PLAY_AUTOMATION_PATTERN,
|
||||
PLAY_MODE_CNT
|
||||
} ;
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
class QMenu;
|
||||
class QPushButton;
|
||||
|
||||
class automationPattern;
|
||||
class pixmapButton;
|
||||
class textFloat;
|
||||
class timePattern;
|
||||
class track;
|
||||
class trackContainer;
|
||||
class trackContentWidget;
|
||||
@@ -485,8 +485,8 @@ public:
|
||||
return( &m_trackWidget->getTrackContentWidget() );
|
||||
}
|
||||
|
||||
void addTimePattern( timePattern * _pattern );
|
||||
void removeTimePattern( timePattern * _pattern );
|
||||
void addAutomationPattern( automationPattern * _pattern );
|
||||
void removeAutomationPattern( automationPattern * _pattern );
|
||||
|
||||
// name-stuff
|
||||
inline virtual const QString & name( void ) const
|
||||
@@ -507,7 +507,7 @@ protected:
|
||||
private:
|
||||
trackContainer * m_trackContainer;
|
||||
trackWidget * m_trackWidget;
|
||||
QPtrList<timePattern> m_time_patterns;
|
||||
QPtrList<automationPattern> m_automation_patterns;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
2082
src/core/automation_editor.cpp
Normal file
2082
src/core/automation_editor.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "automation_editor.h"
|
||||
#include "bb_editor.h"
|
||||
#include "project_journal.h"
|
||||
#include "engine.h"
|
||||
@@ -34,7 +35,6 @@
|
||||
#include "preset_preview_play_handle.h"
|
||||
#include "project_notes.h"
|
||||
#include "song_editor.h"
|
||||
#include "time_roll.h"
|
||||
|
||||
|
||||
engine::engine( const bool _has_gui ) :
|
||||
@@ -42,10 +42,10 @@ engine::engine( const bool _has_gui ) :
|
||||
m_mixer( NULL ),
|
||||
m_mainWindow( NULL ),
|
||||
m_songEditor( NULL ),
|
||||
m_automationEditor( NULL ),
|
||||
m_bbEditor( NULL ),
|
||||
m_pianoRoll( NULL ),
|
||||
m_projectJournal( NULL ),
|
||||
m_timeRoll( NULL )
|
||||
m_projectJournal( NULL )
|
||||
{
|
||||
m_projectJournal = new projectJournal( this );
|
||||
m_mainWindow = new mainWindow( this );
|
||||
@@ -54,7 +54,7 @@ engine::engine( const bool _has_gui ) :
|
||||
m_projectNotes = new projectNotes( this );
|
||||
m_bbEditor = new bbEditor( this );
|
||||
m_pianoRoll = new pianoRoll( this );
|
||||
m_timeRoll = new timeRoll( this );
|
||||
m_automationEditor = new automationEditor( this );
|
||||
|
||||
m_mixer->initDevices();
|
||||
|
||||
@@ -74,7 +74,7 @@ engine::~engine()
|
||||
delete m_songEditor;
|
||||
delete m_bbEditor;
|
||||
delete m_pianoRoll;
|
||||
delete m_timeRoll;
|
||||
delete m_automationEditor;
|
||||
|
||||
presetPreviewPlayHandle::cleanUp( this );
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
#include "audio_dummy.h"
|
||||
#include "tool_button.h"
|
||||
#include "project_journal.h"
|
||||
#include "time_roll.h"
|
||||
#include "automation_editor.h"
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x030100
|
||||
@@ -383,21 +383,23 @@ void mainWindow::finalize( void )
|
||||
|
||||
|
||||
//TODO: Change icon
|
||||
toolButton * time_roll_window = new toolButton(
|
||||
embed::getIconPixmap( "piano" ),
|
||||
tr( "Show/hide Time-Roll" ) +
|
||||
toolButton * automation_editor_window = new toolButton(
|
||||
embed::getIconPixmap( "piano" ),
|
||||
tr( "Show/hide Automation Editor" ) +
|
||||
" (F9)",
|
||||
this, SLOT( toggleTimeRollWin() ),
|
||||
m_toolBar );
|
||||
time_roll_window->setShortcut( Qt::Key_F9 );
|
||||
this,
|
||||
SLOT( toggleAutomationEditorWin() ),
|
||||
m_toolBar );
|
||||
automation_editor_window->setShortcut( Qt::Key_F9 );
|
||||
#ifdef QT4
|
||||
time_roll_window->setWhatsThis(
|
||||
automation_editor_window->setWhatsThis(
|
||||
#else
|
||||
QWhatsThis::add( time_roll_window,
|
||||
QWhatsThis::add( automation_editor_window,
|
||||
#endif
|
||||
tr( "By pressing this button, you can show or hide the "
|
||||
"Time-Roll. With the help of the Time-Roll "
|
||||
"you can edit dynamic values in an easy way."
|
||||
"Automation Editor. With the help of the "
|
||||
"Automation Editor you can edit dynamic values "
|
||||
"in an easy way."
|
||||
) );
|
||||
|
||||
//TODO: Relocate effect board button
|
||||
@@ -435,7 +437,7 @@ void mainWindow::finalize( void )
|
||||
m_toolBarLayout->addWidget( bb_editor_window, 1, 1 );
|
||||
m_toolBarLayout->addWidget( piano_roll_window, 1, 2 );
|
||||
m_toolBarLayout->addWidget( song_editor_window, 1, 3 );
|
||||
m_toolBarLayout->addWidget( time_roll_window, 1, 4 );
|
||||
m_toolBarLayout->addWidget( automation_editor_window, 1, 4 );
|
||||
//TODO: Relocate effect board
|
||||
//m_toolBarLayout->addWidget( effect_board_window, 1, 4 );
|
||||
m_toolBarLayout->addWidget( project_notes_window, 1, 5 );
|
||||
@@ -897,18 +899,18 @@ void mainWindow::togglePianoRollWin( void )
|
||||
|
||||
|
||||
|
||||
void mainWindow::toggleTimeRollWin( void )
|
||||
void mainWindow::toggleAutomationEditorWin( void )
|
||||
{
|
||||
if( eng()->getTimeRoll()->isHidden() == TRUE ||
|
||||
( m_workspace != NULL &&
|
||||
m_workspace->activeWindow() != eng()->getTimeRoll() ) )
|
||||
if( eng()->getAutomationEditor()->isHidden() == TRUE ||
|
||||
( m_workspace != NULL && m_workspace->activeWindow()
|
||||
!= eng()->getAutomationEditor() ) )
|
||||
{
|
||||
eng()->getTimeRoll()->show();
|
||||
eng()->getTimeRoll()->setFocus();
|
||||
eng()->getAutomationEditor()->show();
|
||||
eng()->getAutomationEditor()->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
eng()->getTimeRoll()->hide();
|
||||
eng()->getAutomationEditor()->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1730,17 +1730,17 @@ void track::swapPositionOfTCOs( csize _tco_num1, csize _tco_num2 )
|
||||
|
||||
|
||||
|
||||
void track::addTimePattern( timePattern * _pattern )
|
||||
void track::addAutomationPattern( automationPattern * _pattern )
|
||||
{
|
||||
m_time_patterns.append( _pattern );
|
||||
m_automation_patterns.append( _pattern );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void track::removeTimePattern( timePattern * _pattern )
|
||||
void track::removeAutomationPattern( automationPattern * _pattern )
|
||||
{
|
||||
m_time_patterns.remove( _pattern );
|
||||
m_automation_patterns.remove( _pattern );
|
||||
}
|
||||
|
||||
|
||||
@@ -1748,8 +1748,8 @@ void track::removeTimePattern( timePattern * _pattern )
|
||||
|
||||
void track::sendMidiTime( const midiTime & _time )
|
||||
{
|
||||
QPtrListIterator<timePattern> it( m_time_patterns );
|
||||
timePattern * pattern ;
|
||||
QPtrListIterator<automationPattern> it( m_automation_patterns );
|
||||
automationPattern * pattern ;
|
||||
while( ( pattern = it.current() ) )
|
||||
{
|
||||
++it;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "src/core/sample_play_handle.cpp"
|
||||
#include "src/core/piano_roll.cpp"
|
||||
#include "src/core/arp_and_chords_tab_widget.cpp"
|
||||
#include "src/core/automation_editor.cpp"
|
||||
#include "src/core/about_dialog.cpp"
|
||||
#include "src/core/instrument.cpp"
|
||||
#include "src/core/main.cpp"
|
||||
@@ -38,7 +39,6 @@
|
||||
#include "src/core/piano_widget.cpp"
|
||||
#include "src/core/name_label.cpp"
|
||||
#include "src/core/preset_preview_play_handle.cpp"
|
||||
#include "src/core/time_roll.cpp"
|
||||
#include "src/core/track_container.cpp"
|
||||
#include "src/core/track.cpp"
|
||||
#include "src/core/file_browser.cpp"
|
||||
@@ -60,10 +60,10 @@
|
||||
#include "src/audio/audio_sample_recorder.cpp"
|
||||
#include "src/audio/audio_file_wave.cpp"
|
||||
#include "src/lmms_single_source.cpp"
|
||||
#include "src/tracks/automation_pattern.cpp"
|
||||
#include "src/tracks/pattern.cpp"
|
||||
#include "src/tracks/bb_track.cpp"
|
||||
#include "src/tracks/sample_track.cpp"
|
||||
#include "src/tracks/time_pattern.cpp"
|
||||
#include "src/widgets/project_notes.cpp"
|
||||
#include "src/widgets/led_checkbox.cpp"
|
||||
#include "src/widgets/knob.cpp"
|
||||
|
||||
249
src/tracks/automation_pattern.cpp
Normal file
249
src/tracks/automation_pattern.cpp
Normal file
@@ -0,0 +1,249 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* automation_pattern.cpp - implementation of class automationPattern which
|
||||
* holds dynamic values
|
||||
*
|
||||
* Copyright (c) 2006 Javier Serrano Polo <jasp00/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 "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <Qt/QtXml>
|
||||
|
||||
#else
|
||||
|
||||
#include <qdom.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "automation_pattern.h"
|
||||
#include "templates.h"
|
||||
#include "automation_editor.h"
|
||||
|
||||
|
||||
|
||||
|
||||
automationPattern::automationPattern ( track * _track, levelObject * _object ) :
|
||||
journallingObject( _track->eng() ),
|
||||
m_track( _track ),
|
||||
m_object( _object )
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
automationPattern::automationPattern( const automationPattern & _pat_to_copy ) :
|
||||
journallingObject( _pat_to_copy.m_track->eng() ),
|
||||
m_track( _pat_to_copy.m_track ),
|
||||
m_object( _pat_to_copy.m_object )
|
||||
{
|
||||
for( timeMap::const_iterator it = _pat_to_copy.m_time_map.begin();
|
||||
it != _pat_to_copy.m_time_map.end(); ++it )
|
||||
{
|
||||
m_time_map[it.key()] = it.data();
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
automationPattern::~automationPattern()
|
||||
{
|
||||
m_track->removeAutomationPattern( this );
|
||||
|
||||
if( eng()->getAutomationEditor()->currentPattern() == this )
|
||||
{
|
||||
eng()->getAutomationEditor()->setCurrentPattern( NULL );
|
||||
}
|
||||
|
||||
m_time_map.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationPattern::init( void )
|
||||
{
|
||||
m_track->addAutomationPattern( this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
midiTime automationPattern::length( void ) const
|
||||
{
|
||||
Sint32 max_length = 0;
|
||||
|
||||
for( timeMap::const_iterator it = m_time_map.begin();
|
||||
it != m_time_map.end();
|
||||
++it )
|
||||
{
|
||||
max_length = tMax<Sint32>( max_length, it.key() );
|
||||
}
|
||||
if( max_length % 64 == 0 )
|
||||
{
|
||||
return( midiTime( tMax<Sint32>( max_length, 64 ) ) );
|
||||
}
|
||||
return( midiTime( tMax( midiTime( max_length ).getTact() + 1, 1 ),
|
||||
0 ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
midiTime automationPattern::putValue( const midiTime & _time, const int _value,
|
||||
const bool _quant_pos )
|
||||
{
|
||||
midiTime new_time = _quant_pos ?
|
||||
note::quantized( _time,
|
||||
eng()->getAutomationEditor()->quantization() ) :
|
||||
_time;
|
||||
|
||||
m_time_map[new_time] = _value;
|
||||
|
||||
return( new_time );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationPattern::removeValue( const midiTime & _time )
|
||||
{
|
||||
m_time_map.remove( _time );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationPattern::clearValues( void )
|
||||
{
|
||||
m_time_map.clear();
|
||||
if( eng()->getAutomationEditor()->currentPattern() == this )
|
||||
{
|
||||
eng()->getAutomationEditor()->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int automationPattern::valueAt( const midiTime & _time )
|
||||
{
|
||||
if( m_time_map.contains( _time ) )
|
||||
{
|
||||
return( m_time_map[_time] );
|
||||
}
|
||||
//TODO: Return a better value!!
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationPattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
for( timeMap::iterator it = m_time_map.begin(); it != m_time_map.end();
|
||||
++it )
|
||||
{
|
||||
QDomElement element = _doc.createElement( "time" );
|
||||
element.setAttribute( "pos", static_cast<Sint32>( it.key() ) );
|
||||
element.setAttribute( "value", m_object->levelToLabel(
|
||||
it.data() ) );
|
||||
_this.appendChild( element );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationPattern::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
clearValues();
|
||||
|
||||
for( QDomNode node = _this.firstChild(); !node.isNull();
|
||||
node = node.nextSibling() )
|
||||
{
|
||||
QDomElement element = node.toElement();
|
||||
if( element.isNull() || element.tagName() != "time" )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
m_time_map[midiTime( element.attribute( "pos" ).toInt() )]
|
||||
= m_object->labelToLevel(
|
||||
element.attribute( "value" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationPattern::openInAutomationEditor( void )
|
||||
{
|
||||
eng()->getAutomationEditor()->setCurrentPattern( this );
|
||||
eng()->getAutomationEditor()->show();
|
||||
eng()->getAutomationEditor()->setFocus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationPattern::clear( void )
|
||||
{
|
||||
clearValues();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const QString automationPattern::name( void )
|
||||
{
|
||||
return( m_track->name() + " - " + dynamic_cast<QWidget *>( m_object )
|
||||
->accessibleName() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationPattern::processMidiTime( const midiTime & _time )
|
||||
{
|
||||
timeMap::iterator it = m_time_map.find( _time );
|
||||
if( it != m_time_map.end() )
|
||||
{
|
||||
m_object->setLevel( it.data() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "automation_pattern.moc"
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1106,7 +1106,7 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
m_midiWidget->restoreState( node.toElement() );
|
||||
}
|
||||
else if( timePattern::classNodeName()
|
||||
else if( automationPattern::classNodeName()
|
||||
!= node.nodeName() )
|
||||
{
|
||||
// if node-name doesn't match any known one,
|
||||
|
||||
@@ -522,7 +522,8 @@ void sampleTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
}
|
||||
else
|
||||
{
|
||||
QDomNode node = _this.namedItem( timePattern::classNodeName() );
|
||||
QDomNode node = _this.namedItem(
|
||||
automationPattern::classNodeName() );
|
||||
if( node.isElement() && node.namedItem( "vol" ).isElement() )
|
||||
{
|
||||
m_volumeKnob->loadSettings( _this, "vol" );
|
||||
|
||||
@@ -118,7 +118,7 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name,
|
||||
m_knobPixmap = new QPixmap( embed::getIconPixmap( "knob0" +
|
||||
QString::number( m_knobNum + 1 ) ) );
|
||||
#endif
|
||||
getTimePattern();
|
||||
getAutomationPattern();
|
||||
|
||||
setRange( 0.0f, 100.0f, 1.0f );
|
||||
|
||||
@@ -374,9 +374,9 @@ void knob::contextMenuEvent( QContextMenuEvent * )
|
||||
contextMenu.addSeparator();
|
||||
//TODO: Change icon
|
||||
contextMenu.addAction( embed::getIconPixmap( "piano" ),
|
||||
tr( "&Open in time-roll" ),
|
||||
getTimePattern(),
|
||||
SLOT( openInTimeRoll() ) );
|
||||
tr( "&Open in automation editor" ),
|
||||
getAutomationPattern(),
|
||||
SLOT( openInAutomationEditor() ) );
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction( tr( "Connect to MIDI-device" ), this,
|
||||
SLOT( connectToMidiDevice() ) );
|
||||
|
||||
Reference in New Issue
Block a user