implemented automation recording

This commit is contained in:
Andrew Kelley
2009-04-26 19:39:15 -07:00
parent 12d26ed0aa
commit f40b61045a
11 changed files with 250 additions and 5 deletions

View File

@@ -0,0 +1,78 @@
/*
* automation_recorder.h - declaration of class AutomationRecorder
* which accepts a controllerEvent call from midi
* controllers and creates automation TCOs if automation
* recording is on.
*
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2009-2009 Andrew Kelley <superjoe30/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _AUTOMATION_RECORDER_H
#define _AUTOMATION_RECORDER_H
#include <QObject>
#include "controller.h"
#include "automation_track.h"
#include "automation_pattern.h"
class AutomationRecorder : public QObject
{
Q_OBJECT
public:
typedef struct
{
// during this recording, have we seen this controller change?
bool seen;
// the track that contains the tco
automationTrack* auto_track;
// the tco that we're putting this automation in
automationPattern* pat;
} ControllerMetaData;
typedef QMap<const controller *, ControllerMetaData> ControllerMap;
AutomationRecorder();
~AutomationRecorder();
// midi controllers call this
void controllerEvent( const controller * _controller, float _val );
// must be called at some point between a recording ending and a new
// one beginning
void initRecord( void );
inline bool recording( void ) const { return m_recording; }
inline void setRecording( bool _recording ){ m_recording = _recording; }
private:
bool m_recording; // while the song is playing, should we record automation?
ControllerMap m_controllers; // remember state during recording
friend class engine;
} ;
#endif

View File

@@ -34,6 +34,7 @@
#include "lmms_style.h"
class automationEditor;
class AutomationRecorder;
class bbEditor;
class bbTrackContainer;
class dummyTrackContainer;
@@ -139,6 +140,11 @@ public:
return s_automationEditor;
}
static AutomationRecorder * getAutomationRecorder( void )
{
return s_automationRecorder;
}
static ladspa2LMMS * getLADSPAManager( void )
{
return s_ladspaManager;
@@ -195,6 +201,7 @@ private:
static fxMixerView * s_fxMixerView;
static songEditor * s_songEditor;
static automationEditor * s_automationEditor;
static AutomationRecorder * s_automationRecorder;
static bbEditor * s_bbEditor;
static pianoRoll * s_pianoRoll;
static projectNotes * s_projectNotes;

View File

@@ -136,6 +136,7 @@ public slots:
void undo( void );
void redo( void );
void toggleRecordAutomation( bool );
protected:
virtual void closeEvent( QCloseEvent * _ce );

View File

@@ -49,7 +49,7 @@ public:
virtual void processOutEvent( const midiEvent& _me,
const midiTime & _time)
{
// No output yet
// No output yet (TODO?)
}
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );