Reworked MIDI event handling in InstrumentTrack and renamed MIDI classes
The MIDI event handling in InstrumentTrack was complex and buggy. It has been simplified now such that processInEvent() tries to handle note on, note off and key pressure events. The actions taken should result in equivalent calls to processOutEvent() by NotePlayHandle instances. The processOutEvent() function sends according MIDI events to the attached instruments. All unhandled MIDI events are directly forwarded to the instrument in processInEvent(). It's possible that some corner-cases are not handled yet with the new code and we have regressions now. Furthermore renamed midiTime/midiEvent to MidiTime/MidiEvent to match coding style. Closes #72.
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "midi_time.h"
|
||||
#include "MidiTime.h"
|
||||
#include "AutomationPattern.h"
|
||||
#include "ComboBoxModel.h"
|
||||
|
||||
@@ -127,7 +127,7 @@ protected slots:
|
||||
void pasteValues();
|
||||
void deleteSelectedValues();
|
||||
|
||||
void updatePosition( const midiTime & _t );
|
||||
void updatePosition( const MidiTime & _t );
|
||||
|
||||
void zoomingXChanged();
|
||||
void zoomingYChanged();
|
||||
@@ -218,7 +218,7 @@ private:
|
||||
QScrollBar * m_leftRightScroll;
|
||||
QScrollBar * m_topBottomScroll;
|
||||
|
||||
midiTime m_currentPosition;
|
||||
MidiTime m_currentPosition;
|
||||
|
||||
actions m_action;
|
||||
|
||||
@@ -258,7 +258,7 @@ private:
|
||||
|
||||
signals:
|
||||
void currentPatternChanged();
|
||||
void positionChanged( const midiTime & );
|
||||
void positionChanged( const MidiTime & );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
|
||||
class AutomationTrack;
|
||||
class midiTime;
|
||||
class MidiTime;
|
||||
|
||||
|
||||
|
||||
@@ -72,12 +72,12 @@ public:
|
||||
}
|
||||
void setTension( QString _new_tension );
|
||||
|
||||
virtual midiTime length() const;
|
||||
virtual MidiTime length() const;
|
||||
|
||||
midiTime putValue( const midiTime & _time, const float _value,
|
||||
MidiTime putValue( const MidiTime & _time, const float _value,
|
||||
const bool _quant_pos = true );
|
||||
|
||||
void removeValue( const midiTime & _time );
|
||||
void removeValue( const MidiTime & _time );
|
||||
|
||||
inline const timeMap & getTimeMap() const
|
||||
{
|
||||
@@ -104,8 +104,8 @@ public:
|
||||
return m_timeMap.isEmpty() == false;
|
||||
}
|
||||
|
||||
float valueAt( const midiTime & _time ) const;
|
||||
float *valuesAfter( const midiTime & _time ) const;
|
||||
float valueAt( const MidiTime & _time ) const;
|
||||
float *valuesAfter( const MidiTime & _time ) const;
|
||||
|
||||
const QString name() const;
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
return classNodeName();
|
||||
}
|
||||
|
||||
void processMidiTime( const midiTime & _time );
|
||||
void processMidiTime( const MidiTime & _time );
|
||||
|
||||
virtual trackContentObjectView * createView( trackView * _tv );
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
AutomationTrack( TrackContainer* tc, bool _hidden = false );
|
||||
virtual ~AutomationTrack();
|
||||
|
||||
virtual bool play( const midiTime & _start, const fpp_t _frames,
|
||||
virtual bool play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _frame_base, int _tco_num = -1 );
|
||||
|
||||
virtual QString nodeName() const
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
}
|
||||
|
||||
virtual trackView * createView( TrackContainerView* );
|
||||
virtual trackContentObject * createTCO( const midiTime & _pos );
|
||||
virtual trackContentObject * createTCO( const MidiTime & _pos );
|
||||
|
||||
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
// forward-declarations
|
||||
class InstrumentTrack;
|
||||
class InstrumentView;
|
||||
class midiEvent;
|
||||
class midiTime;
|
||||
class MidiEvent;
|
||||
class MidiTime;
|
||||
class notePlayHandle;
|
||||
class track;
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
|
||||
// sub-classes can re-implement this for receiving all incoming
|
||||
// MIDI-events
|
||||
inline virtual bool handleMidiEvent( const midiEvent &, const midiTime & )
|
||||
inline virtual bool handleMidiEvent( const MidiEvent&, const MidiTime& = MidiTime() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -69,12 +69,10 @@ public:
|
||||
void processAudioBuffer( sampleFrame * _buf, const fpp_t _frames,
|
||||
notePlayHandle * _n );
|
||||
|
||||
midiEvent applyMasterKey( const midiEvent & _me );
|
||||
MidiEvent applyMasterKey( const MidiEvent& event );
|
||||
|
||||
virtual void processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
virtual void processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
virtual void processInEvent( const MidiEvent& event, const MidiTime& time = MidiTime() );
|
||||
virtual void processOutEvent( const MidiEvent& event, const MidiTime& time = MidiTime() );
|
||||
// silence all running notes played by this track
|
||||
void silenceAllNotes();
|
||||
|
||||
@@ -117,13 +115,13 @@ public:
|
||||
}
|
||||
|
||||
// play everything in given frame-range - creates note-play-handles
|
||||
virtual bool play( const midiTime & _start, const fpp_t _frames,
|
||||
virtual bool play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _frame_base, int _tco_num = -1 );
|
||||
// create new view for me
|
||||
virtual trackView * createView( TrackContainerView* tcv );
|
||||
|
||||
// create new track-content-object = pattern
|
||||
virtual trackContentObject * createTCO( const midiTime & _pos );
|
||||
virtual trackContentObject * createTCO( const MidiTime & _pos );
|
||||
|
||||
|
||||
// called by track
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* midi.h - constants, structs etc. concerning MIDI
|
||||
* Midi.h - constants, structs etc. concerning MIDI
|
||||
*
|
||||
* Copyright (c) 2005-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -26,8 +26,6 @@
|
||||
#define _MIDI_H
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "panning_constants.h"
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
enum MidiEventTypes
|
||||
@@ -60,7 +58,7 @@ enum MidiEventTypes
|
||||
MidiMetaEvent = 0xFF
|
||||
} ;
|
||||
|
||||
enum MidiMetaEvents
|
||||
enum MidiMetaEventTypes
|
||||
{
|
||||
MidiMetaInvalid = 0x00,
|
||||
MidiCopyright = 0x02,
|
||||
@@ -79,6 +77,7 @@ enum MidiMetaEvents
|
||||
MidiMetaCustom = 0x80,
|
||||
MidiNotePanning
|
||||
} ;
|
||||
typedef MidiMetaEventTypes MidiMetaEventType;
|
||||
|
||||
|
||||
enum MidiStandardControllers
|
||||
@@ -120,139 +119,4 @@ const int MidiMaxNote = 127;
|
||||
const int MidiMaxPanning = 127;
|
||||
const int MidiMinPanning = -128;
|
||||
|
||||
|
||||
struct midiEvent
|
||||
{
|
||||
midiEvent( MidiEventTypes _type = MidiActiveSensing,
|
||||
int8_t _channel = 0,
|
||||
int16_t _param1 = 0,
|
||||
int16_t _param2 = 0,
|
||||
const void * _sourcePort = NULL ) :
|
||||
m_type( _type ),
|
||||
m_metaEvent( MidiMetaInvalid ),
|
||||
m_channel( _channel ),
|
||||
m_sysExData( NULL ),
|
||||
m_sourcePort( _sourcePort ),
|
||||
m_fromMidiPort( false )
|
||||
{
|
||||
m_data.m_param[0] = _param1;
|
||||
m_data.m_param[1] = _param2;
|
||||
}
|
||||
|
||||
midiEvent( MidiEventTypes _type, const char * _sysex_data,
|
||||
int _data_len ) :
|
||||
m_type( _type ),
|
||||
m_metaEvent( MidiMetaInvalid ),
|
||||
m_channel( 0 ),
|
||||
m_sysExData( _sysex_data ),
|
||||
m_sourcePort( NULL ),
|
||||
m_fromMidiPort( false )
|
||||
{
|
||||
m_data.m_sysExDataLen = _data_len;
|
||||
}
|
||||
|
||||
midiEvent( const midiEvent & _copy ) :
|
||||
m_type( _copy.m_type ),
|
||||
m_metaEvent( _copy.m_metaEvent ),
|
||||
m_channel( _copy.m_channel ),
|
||||
m_data( _copy.m_data ),
|
||||
m_sysExData( _copy.m_sysExData ),
|
||||
m_sourcePort( _copy.m_sourcePort ),
|
||||
m_fromMidiPort( _copy.m_fromMidiPort )
|
||||
{
|
||||
}
|
||||
|
||||
inline MidiEventTypes type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
inline int channel() const
|
||||
{
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
inline int16_t key() const
|
||||
{
|
||||
return m_data.m_param[0];
|
||||
}
|
||||
|
||||
inline int16_t & key()
|
||||
{
|
||||
return m_data.m_param[0];
|
||||
}
|
||||
|
||||
inline uint8_t controllerNumber() const
|
||||
{
|
||||
return m_data.m_param[0];
|
||||
}
|
||||
|
||||
inline uint8_t controllerValue() const
|
||||
{
|
||||
return m_data.m_param[1];
|
||||
}
|
||||
|
||||
inline int16_t velocity() const
|
||||
{
|
||||
return m_data.m_param[1];
|
||||
}
|
||||
|
||||
inline int16_t & velocity()
|
||||
{
|
||||
return m_data.m_param[1];
|
||||
}
|
||||
|
||||
inline int16_t midiPanning() const
|
||||
{
|
||||
return m_data.m_param[1];
|
||||
}
|
||||
|
||||
inline volume_t getVolume() const
|
||||
{
|
||||
return (volume_t)( velocity() * 100 / MidiMaxVelocity );
|
||||
}
|
||||
|
||||
inline const void * sourcePort() const
|
||||
{
|
||||
return m_sourcePort;
|
||||
}
|
||||
|
||||
inline panning_t getPanning() const
|
||||
{
|
||||
return (panning_t) ( PanningLeft +
|
||||
( (float)( midiPanning() - MidiMinPanning ) ) /
|
||||
( (float)( MidiMaxPanning - MidiMinPanning ) ) *
|
||||
( (float)( PanningRight - PanningLeft ) ) );
|
||||
}
|
||||
|
||||
void setFromMidiPort( bool enabled )
|
||||
{
|
||||
m_fromMidiPort = enabled;
|
||||
}
|
||||
|
||||
bool isFromMidiPort() const
|
||||
{
|
||||
return m_fromMidiPort;
|
||||
}
|
||||
|
||||
MidiEventTypes m_type; // MIDI event type
|
||||
MidiMetaEvents m_metaEvent; // Meta event (mostly unused)
|
||||
int8_t m_channel; // MIDI channel
|
||||
union
|
||||
{
|
||||
int16_t m_param[2]; // first/second parameter (key/velocity)
|
||||
uint8_t m_bytes[4]; // raw bytes
|
||||
int32_t m_sysExDataLen; // len of m_sysExData
|
||||
} m_data;
|
||||
|
||||
const char * m_sysExData;
|
||||
const void * m_sourcePort;
|
||||
|
||||
|
||||
private:
|
||||
bool m_fromMidiPort;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -62,8 +62,8 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual void processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time,
|
||||
virtual void processOutEvent( const MidiEvent & _me,
|
||||
const MidiTime & _time,
|
||||
const MidiPort * _port );
|
||||
|
||||
virtual void applyPortMode( MidiPort * _port );
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
// return name of port which specified MIDI event came from
|
||||
virtual QString sourcePortName( const midiEvent & ) const;
|
||||
virtual QString sourcePortName( const MidiEvent & ) const;
|
||||
|
||||
// (un)subscribe given MidiPort to/from destination-port
|
||||
virtual void subscribeReadablePort( MidiPort * _port,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QtCore/QVector>
|
||||
|
||||
|
||||
#include "midi.h"
|
||||
#include "MidiEvent.h"
|
||||
#include "MidiEventProcessor.h"
|
||||
#include "tab_widget.h"
|
||||
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
virtual ~MidiClient();
|
||||
|
||||
// to be implemented by sub-classes
|
||||
virtual void processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time,
|
||||
virtual void processOutEvent( const MidiEvent & _me,
|
||||
const MidiTime & _time,
|
||||
const MidiPort * _port ) = 0;
|
||||
|
||||
// inheriting classes can re-implement this for being able to update
|
||||
@@ -78,13 +78,13 @@ public:
|
||||
}
|
||||
|
||||
// return name of port which specified MIDI event came from
|
||||
virtual QString sourcePortName( const midiEvent & ) const
|
||||
virtual QString sourcePortName( const MidiEvent & ) const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
// (un)subscribe given MidiPort to/from destination-port
|
||||
// (un)subscribe given MidiPort to/from destination-port
|
||||
virtual void subscribeReadablePort( MidiPort * _port,
|
||||
const QString & _dest,
|
||||
bool _subscribe = true );
|
||||
@@ -167,7 +167,7 @@ protected:
|
||||
private:
|
||||
// this does MIDI-event-process
|
||||
void processParsedEvent();
|
||||
virtual void processOutEvent( const midiEvent& event, const midiTime& time, const MidiPort* port );
|
||||
virtual void processOutEvent( const MidiEvent& event, const MidiTime& time, const MidiPort* port );
|
||||
|
||||
// small helper function returning length of a certain event - this
|
||||
// is necessary for parsing raw-MIDI-data
|
||||
@@ -188,7 +188,7 @@ private:
|
||||
// event type include?
|
||||
uint32_t m_buffer[RAW_MIDI_PARSE_BUF_SIZE];
|
||||
// buffer for incoming data
|
||||
midiEvent m_midiEvent; // midi-event
|
||||
MidiEvent m_midiEvent; // midi-event
|
||||
} m_midiParseData;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -43,11 +43,11 @@ public:
|
||||
MidiController( Model * _parent );
|
||||
virtual ~MidiController();
|
||||
|
||||
virtual void processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
virtual void processInEvent( const MidiEvent & _me,
|
||||
const MidiTime & _time );
|
||||
|
||||
virtual void processOutEvent( const midiEvent& _me,
|
||||
const midiTime & _time)
|
||||
virtual void processOutEvent( const MidiEvent& _me,
|
||||
const MidiTime & _time)
|
||||
{
|
||||
// No output yet
|
||||
}
|
||||
|
||||
209
include/MidiEvent.h
Normal file
209
include/MidiEvent.h
Normal file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* MidiEvent.h - MidiEvent class
|
||||
*
|
||||
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MIDI_EVENT_H
|
||||
#define _MIDI_EVENT_H
|
||||
|
||||
#include <cstdlib>
|
||||
#include "Midi.h"
|
||||
#include "panning_constants.h"
|
||||
|
||||
class MidiEvent
|
||||
{
|
||||
public:
|
||||
MidiEvent( MidiEventTypes type = MidiActiveSensing,
|
||||
int8_t channel = 0,
|
||||
int16_t param1 = 0,
|
||||
int16_t param2 = 0,
|
||||
const void* sourcePort = NULL ) :
|
||||
m_type( type ),
|
||||
m_metaEvent( MidiMetaInvalid ),
|
||||
m_channel( channel ),
|
||||
m_sysExData( NULL ),
|
||||
m_sourcePort( sourcePort )
|
||||
{
|
||||
m_data.m_param[0] = param1;
|
||||
m_data.m_param[1] = param2;
|
||||
}
|
||||
|
||||
MidiEvent( MidiEventTypes type, const char* sysExData, int dataLen ) :
|
||||
m_type( type ),
|
||||
m_metaEvent( MidiMetaInvalid ),
|
||||
m_channel( 0 ),
|
||||
m_sysExData( sysExData ),
|
||||
m_sourcePort( NULL )
|
||||
{
|
||||
m_data.m_sysExDataLen = dataLen;
|
||||
}
|
||||
|
||||
MidiEvent( const MidiEvent& other ) :
|
||||
m_type( other.m_type ),
|
||||
m_metaEvent( other.m_metaEvent ),
|
||||
m_channel( other.m_channel ),
|
||||
m_data( other.m_data ),
|
||||
m_sysExData( other.m_sysExData ),
|
||||
m_sourcePort( other.m_sourcePort )
|
||||
{
|
||||
}
|
||||
|
||||
MidiEventTypes type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void setType( MidiEventTypes type )
|
||||
{
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
void setMetaEvent( MidiMetaEventType metaEvent )
|
||||
{
|
||||
m_metaEvent = metaEvent;
|
||||
}
|
||||
|
||||
MidiMetaEventType metaEvent() const
|
||||
{
|
||||
return m_metaEvent;
|
||||
}
|
||||
|
||||
int8_t channel() const
|
||||
{
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
void setChannel( int8_t channel )
|
||||
{
|
||||
m_channel = channel;
|
||||
}
|
||||
|
||||
int16_t param( int i ) const
|
||||
{
|
||||
return m_data.m_param[i];
|
||||
}
|
||||
|
||||
void setParam( int i, uint16_t value )
|
||||
{
|
||||
m_data.m_param[i] = value;
|
||||
}
|
||||
|
||||
int16_t key() const
|
||||
{
|
||||
return param( 0 );
|
||||
}
|
||||
|
||||
void setKey( int16_t key )
|
||||
{
|
||||
m_data.m_param[0] = key;
|
||||
}
|
||||
|
||||
uint8_t velocity() const
|
||||
{
|
||||
return m_data.m_param[1] & 0x7F;
|
||||
}
|
||||
|
||||
void setVelocity( int16_t velocity )
|
||||
{
|
||||
m_data.m_param[1] = velocity;
|
||||
}
|
||||
|
||||
panning_t panning() const
|
||||
{
|
||||
return (panning_t) ( PanningLeft +
|
||||
( (float)( midiPanning() - MidiMinPanning ) ) /
|
||||
( (float)( MidiMaxPanning - MidiMinPanning ) ) *
|
||||
( (float)( PanningRight - PanningLeft ) ) );
|
||||
}
|
||||
int16_t midiPanning() const
|
||||
{
|
||||
return m_data.m_param[1];
|
||||
}
|
||||
|
||||
volume_t volume() const
|
||||
{
|
||||
return (volume_t)( velocity() * 100 / MidiMaxVelocity );
|
||||
}
|
||||
|
||||
const void* sourcePort() const
|
||||
{
|
||||
return m_sourcePort;
|
||||
}
|
||||
|
||||
uint8_t controllerNumber() const
|
||||
{
|
||||
return param( 0 ) & 0x7F;
|
||||
}
|
||||
|
||||
void setControllerNumber( uint8_t num )
|
||||
{
|
||||
setParam( 0, num );
|
||||
}
|
||||
|
||||
uint8_t controllerValue() const
|
||||
{
|
||||
return param( 1 );
|
||||
}
|
||||
|
||||
void setControllerValue( uint8_t value )
|
||||
{
|
||||
setParam( 1, value );
|
||||
}
|
||||
|
||||
uint8_t program() const
|
||||
{
|
||||
return param( 0 );
|
||||
}
|
||||
|
||||
uint8_t channelPressure() const
|
||||
{
|
||||
return param( 0 );
|
||||
}
|
||||
|
||||
int16_t pitchBend() const
|
||||
{
|
||||
return param( 0 );
|
||||
}
|
||||
|
||||
void setPitchBend( uint16_t pitchBend )
|
||||
{
|
||||
setParam( 0, pitchBend );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
MidiEventTypes m_type; // MIDI event type
|
||||
MidiMetaEventType m_metaEvent; // Meta event (mostly unused)
|
||||
int8_t m_channel; // MIDI channel
|
||||
union
|
||||
{
|
||||
int16_t m_param[2]; // first/second parameter (key/velocity)
|
||||
uint8_t m_bytes[4]; // raw bytes
|
||||
int32_t m_sysExDataLen; // len of m_sysExData
|
||||
} m_data;
|
||||
|
||||
const char* m_sysExData;
|
||||
const void* m_sourcePort;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
@@ -25,27 +25,25 @@
|
||||
#ifndef _MIDI_EVENT_PROCESSOR_H
|
||||
#define _MIDI_EVENT_PROCESSOR_H
|
||||
|
||||
class midiEvent;
|
||||
class midiTime;
|
||||
#include "MidiEvent.h"
|
||||
#include "MidiTime.h"
|
||||
|
||||
|
||||
// all classes being able to process MIDI-events should inherit from this
|
||||
class MidiEventProcessor
|
||||
{
|
||||
public:
|
||||
inline MidiEventProcessor()
|
||||
MidiEventProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
virtual inline ~MidiEventProcessor()
|
||||
virtual ~MidiEventProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
// to be implemented by inheriting classes
|
||||
virtual void processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time ) = 0;
|
||||
virtual void processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time ) = 0;
|
||||
virtual void processInEvent( const MidiEvent& event, const MidiTime& time = MidiTime() ) = 0;
|
||||
virtual void processOutEvent( const MidiEvent& event, const MidiTime& time = MidiTime() ) = 0;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* MidiPort.h - abstraction of MIDI ports which are part of LMMS's MIDI-
|
||||
* MidiPort.h - abstraction of MIDI ports which are part of LMMS' MIDI
|
||||
* sequencing system
|
||||
*
|
||||
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -28,16 +28,17 @@
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QPair>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
#include "midi.h"
|
||||
#include "Midi.h"
|
||||
#include "MidiTime.h"
|
||||
#include "AutomatableModel.h"
|
||||
|
||||
|
||||
class MidiClient;
|
||||
class MidiEvent;
|
||||
class MidiEventProcessor;
|
||||
class MidiPortMenu;
|
||||
class midiTime;
|
||||
|
||||
|
||||
// class for abstraction of MIDI-port
|
||||
@@ -104,8 +105,8 @@ public:
|
||||
return outputChannel() - 1;
|
||||
}
|
||||
|
||||
void processInEvent( const midiEvent & _me, const midiTime & _time );
|
||||
void processOutEvent( const midiEvent & _me, const midiTime & _time );
|
||||
void processInEvent( const MidiEvent& event, const MidiTime& time = MidiTime() );
|
||||
void processOutEvent( const MidiEvent& event, const MidiTime& time = MidiTime() );
|
||||
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* midi_time.h - declaration of class midiTime which provides data-type for
|
||||
* position- and length-variables
|
||||
* MidiTime.h - declaration of class MidiTime which provides data type for
|
||||
* position- and length-variables
|
||||
*
|
||||
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -35,25 +35,25 @@ const int DefaultStepsPerTact = 16;
|
||||
const int DefaultBeatsPerTact = DefaultTicksPerTact / DefaultStepsPerTact;
|
||||
|
||||
|
||||
class EXPORT midiTime
|
||||
class EXPORT MidiTime
|
||||
{
|
||||
public:
|
||||
inline midiTime( const tact_t _tact, const tick_t _ticks ) :
|
||||
m_ticks( _tact * s_ticksPerTact + _ticks )
|
||||
MidiTime( const tact_t tact, const tick_t ticks ) :
|
||||
m_ticks( tact * s_ticksPerTact + ticks )
|
||||
{
|
||||
}
|
||||
|
||||
inline midiTime( const tick_t _ticks = 0 ) :
|
||||
m_ticks( _ticks )
|
||||
MidiTime( const tick_t ticks = 0 ) :
|
||||
m_ticks( ticks )
|
||||
{
|
||||
}
|
||||
|
||||
inline midiTime( const midiTime & _t ) :
|
||||
m_ticks( _t.m_ticks )
|
||||
MidiTime( const MidiTime& time ) :
|
||||
m_ticks( time.m_ticks )
|
||||
{
|
||||
}
|
||||
|
||||
inline midiTime toNearestTact() const
|
||||
MidiTime toNearestTact() const
|
||||
{
|
||||
if( m_ticks % s_ticksPerTact >= s_ticksPerTact/2 )
|
||||
{
|
||||
@@ -62,30 +62,30 @@ public:
|
||||
return getTact() * s_ticksPerTact;
|
||||
}
|
||||
|
||||
inline midiTime & operator=( const midiTime & _t )
|
||||
MidiTime& operator=( const MidiTime& time )
|
||||
{
|
||||
m_ticks = _t.m_ticks;
|
||||
m_ticks = time.m_ticks;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline midiTime & operator+=( const midiTime & _t )
|
||||
MidiTime& operator+=( const MidiTime& time )
|
||||
{
|
||||
m_ticks += _t.m_ticks;
|
||||
m_ticks += time.m_ticks;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline midiTime & operator-=( const midiTime & _t )
|
||||
MidiTime& operator-=( const MidiTime& time )
|
||||
{
|
||||
m_ticks -= _t.m_ticks;
|
||||
m_ticks -= time.m_ticks;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline tact_t getTact() const
|
||||
tact_t getTact() const
|
||||
{
|
||||
return m_ticks / s_ticksPerTact;
|
||||
}
|
||||
|
||||
inline tact_t nextFullTact() const
|
||||
tact_t nextFullTact() const
|
||||
{
|
||||
if( m_ticks % s_ticksPerTact == 0 )
|
||||
{
|
||||
@@ -94,37 +94,34 @@ public:
|
||||
return m_ticks / s_ticksPerTact + 1;
|
||||
}
|
||||
|
||||
inline void setTicks( tick_t _t )
|
||||
void setTicks( tick_t ticks )
|
||||
{
|
||||
m_ticks = _t;
|
||||
m_ticks = ticks;
|
||||
}
|
||||
|
||||
inline tick_t getTicks() const
|
||||
tick_t getTicks() const
|
||||
{
|
||||
return m_ticks;
|
||||
}
|
||||
|
||||
inline operator int() const
|
||||
operator int() const
|
||||
{
|
||||
return m_ticks;
|
||||
}
|
||||
|
||||
// calculate number of frame that are needed this time
|
||||
inline f_cnt_t frames( const float _frames_per_tick ) const
|
||||
f_cnt_t frames( const float framesPerTick ) const
|
||||
{
|
||||
if( m_ticks >= 0 )
|
||||
{
|
||||
return static_cast<f_cnt_t>( m_ticks *
|
||||
_frames_per_tick );
|
||||
return static_cast<f_cnt_t>( m_ticks * framesPerTick );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline midiTime fromFrames( const f_cnt_t _frames,
|
||||
const float _frames_per_tick )
|
||||
static MidiTime fromFrames( const f_cnt_t frames, const float framesPerTick )
|
||||
{
|
||||
return midiTime( static_cast<int>( _frames /
|
||||
_frames_per_tick ) );
|
||||
return MidiTime( static_cast<int>( frames / framesPerTick ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +140,7 @@ public:
|
||||
s_ticksPerTact = _tpt;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
tick_t m_ticks;
|
||||
|
||||
@@ -56,8 +56,8 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual void processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time,
|
||||
virtual void processOutEvent( const MidiEvent & _me,
|
||||
const MidiTime & _time,
|
||||
const MidiPort * _port );
|
||||
|
||||
virtual void applyPortMode( MidiPort * _port );
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
#endif
|
||||
|
||||
// return name of port which specified MIDI event came from
|
||||
virtual QString sourcePortName( const midiEvent & ) const;
|
||||
virtual QString sourcePortName( const MidiEvent & ) const;
|
||||
|
||||
// (un)subscribe given MidiPort to/from destination-port
|
||||
virtual void subscribeReadablePort( MidiPort * _port,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* RemotePlugin.h - base class providing RPC like mechanisms
|
||||
*
|
||||
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -26,7 +26,7 @@
|
||||
#define _REMOTE_PLUGIN_H
|
||||
|
||||
#include "export.h"
|
||||
#include "midi.h"
|
||||
#include "MidiEvent.h"
|
||||
#include "VST_sync_shm.h"
|
||||
|
||||
#include <vector>
|
||||
@@ -724,7 +724,7 @@ public:
|
||||
|
||||
bool process( const sampleFrame * _in_buf, sampleFrame * _out_buf );
|
||||
|
||||
void processMidiEvent( const midiEvent &, const f_cnt_t _offset );
|
||||
void processMidiEvent( const MidiEvent&, const f_cnt_t _offset );
|
||||
|
||||
void updateSampleRate( sample_rate_t _sr )
|
||||
{
|
||||
@@ -820,8 +820,7 @@ public:
|
||||
virtual void process( const sampleFrame * _in_buf,
|
||||
sampleFrame * _out_buf ) = 0;
|
||||
|
||||
virtual void processMidiEvent( const midiEvent &,
|
||||
const f_cnt_t /* _offset */ )
|
||||
virtual void processMidiEvent( const MidiEvent&, const f_cnt_t /* _offset */ )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1120,7 +1119,7 @@ bool RemotePluginClient::processMessage( const message & _m )
|
||||
|
||||
case IdMidiEvent:
|
||||
processMidiEvent(
|
||||
midiEvent( static_cast<MidiEventTypes>(
|
||||
MidiEvent( static_cast<MidiEventTypes>(
|
||||
_m.getInt( 0 ) ),
|
||||
_m.getInt( 1 ),
|
||||
_m.getInt( 2 ),
|
||||
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
typedef QList<QPair<sampleFrame *, f_cnt_t> > bufferList;
|
||||
bufferList m_buffers;
|
||||
f_cnt_t m_framesRecorded;
|
||||
midiTime m_minLength;
|
||||
MidiTime m_minLength;
|
||||
|
||||
track * m_track;
|
||||
bbTrack * m_bbTrack;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
SampleTCO( track * _track );
|
||||
virtual ~SampleTCO();
|
||||
|
||||
virtual void changeLength( const midiTime & _length );
|
||||
virtual void changeLength( const MidiTime & _length );
|
||||
const QString & sampleFile() const;
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
return m_sampleBuffer;
|
||||
}
|
||||
|
||||
midiTime sampleLength() const;
|
||||
MidiTime sampleLength() const;
|
||||
|
||||
virtual trackContentObjectView * createView( trackView * _tv );
|
||||
|
||||
@@ -121,10 +121,10 @@ public:
|
||||
SampleTrack( TrackContainer* tc );
|
||||
virtual ~SampleTrack();
|
||||
|
||||
virtual bool play( const midiTime & _start, const fpp_t _frames,
|
||||
virtual bool play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _frame_base, int _tco_num = -1 );
|
||||
virtual trackView * createView( TrackContainerView* tcv );
|
||||
virtual trackContentObject * createTCO( const midiTime & _pos );
|
||||
virtual trackContentObject * createTCO( const MidiTime & _pos );
|
||||
|
||||
|
||||
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
return( m_scrollArea );
|
||||
}
|
||||
|
||||
inline const midiTime & currentPosition() const
|
||||
inline const MidiTime & currentPosition() const
|
||||
{
|
||||
return( m_currentPosition );
|
||||
}
|
||||
@@ -142,7 +142,7 @@ protected:
|
||||
virtual void undoStep( JournalEntry & _je );
|
||||
virtual void redoStep( JournalEntry & _je );
|
||||
|
||||
midiTime m_currentPosition;
|
||||
MidiTime m_currentPosition;
|
||||
|
||||
|
||||
private:
|
||||
@@ -180,7 +180,7 @@ private:
|
||||
|
||||
|
||||
signals:
|
||||
void positionChanged( const midiTime & _pos );
|
||||
void positionChanged( const MidiTime & _pos );
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
@@ -109,10 +109,10 @@ public:
|
||||
bbTrack( TrackContainer* tc );
|
||||
virtual ~bbTrack();
|
||||
|
||||
virtual bool play( const midiTime & _start, const fpp_t _frames,
|
||||
virtual bool play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _frame_base, int _tco_num = -1 );
|
||||
virtual trackView * createView( TrackContainerView* tcv );
|
||||
virtual trackContentObject * createTCO( const midiTime & _pos );
|
||||
virtual trackContentObject * createTCO( const MidiTime & _pos );
|
||||
|
||||
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
bbTrackContainer();
|
||||
virtual ~bbTrackContainer();
|
||||
|
||||
virtual bool play( midiTime _start, const fpp_t _frames,
|
||||
virtual bool play( MidiTime _start, const fpp_t _frames,
|
||||
const f_cnt_t _frame_base, int _tco_num = -1 );
|
||||
|
||||
virtual void updateAfterTrackAdd();
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "volume.h"
|
||||
#include "panning.h"
|
||||
#include "midi_time.h"
|
||||
#include "MidiTime.h"
|
||||
#include "SerializingObject.h"
|
||||
|
||||
class DetuningHelper;
|
||||
@@ -81,8 +81,8 @@ const float MaxDetuning = 4 * 12.0f;
|
||||
class EXPORT note : public SerializingObject
|
||||
{
|
||||
public:
|
||||
note( const midiTime & _length = midiTime( 0 ),
|
||||
const midiTime & _pos = midiTime( 0 ),
|
||||
note( const MidiTime & _length = MidiTime( 0 ),
|
||||
const MidiTime & _pos = MidiTime( 0 ),
|
||||
int key = DefaultKey,
|
||||
volume_t _volume = DefaultVolume,
|
||||
panning_t _panning = DefaultPanning,
|
||||
@@ -93,8 +93,8 @@ public:
|
||||
// used by GUI
|
||||
inline void setSelected( const bool _selected ){ m_selected = _selected; }
|
||||
inline void setOldKey( const int _oldKey ){ m_oldKey = _oldKey; }
|
||||
inline void setOldPos( const midiTime & _oldPos ){ m_oldPos = _oldPos; }
|
||||
inline void setOldLength( const midiTime & _oldLength )
|
||||
inline void setOldPos( const MidiTime & _oldPos ){ m_oldPos = _oldPos; }
|
||||
inline void setOldLength( const MidiTime & _oldLength )
|
||||
{
|
||||
m_oldLength = _oldLength;
|
||||
}
|
||||
@@ -104,11 +104,11 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void setLength( const midiTime & _length );
|
||||
void setPos( const midiTime & _pos );
|
||||
void setLength( const MidiTime & _length );
|
||||
void setPos( const MidiTime & _pos );
|
||||
void setKey( const int _key );
|
||||
virtual void setVolume( const volume_t _volume = DefaultVolume );
|
||||
void setPanning( const panning_t _panning = DefaultPanning );
|
||||
virtual void setVolume( const volume_t volume = DefaultVolume );
|
||||
virtual void setPanning( const panning_t panning = DefaultPanning );
|
||||
void quantizeLength( const int _q_grid );
|
||||
void quantizePos( const int _q_grid );
|
||||
|
||||
@@ -129,12 +129,12 @@ public:
|
||||
return m_oldKey;
|
||||
}
|
||||
|
||||
inline midiTime oldPos() const
|
||||
inline MidiTime oldPos() const
|
||||
{
|
||||
return m_oldPos;
|
||||
}
|
||||
|
||||
inline midiTime oldLength() const
|
||||
inline MidiTime oldLength() const
|
||||
{
|
||||
return m_oldLength;
|
||||
}
|
||||
@@ -144,23 +144,23 @@ public:
|
||||
return m_isPlaying;
|
||||
}
|
||||
|
||||
inline midiTime endPos() const
|
||||
inline MidiTime endPos() const
|
||||
{
|
||||
const int l = length();
|
||||
return pos() + l;
|
||||
}
|
||||
|
||||
inline const midiTime & length() const
|
||||
inline const MidiTime & length() const
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
|
||||
inline const midiTime & pos() const
|
||||
inline const MidiTime & pos() const
|
||||
{
|
||||
return m_pos;
|
||||
}
|
||||
|
||||
inline midiTime pos( midiTime _base_pos ) const
|
||||
inline MidiTime pos( MidiTime _base_pos ) const
|
||||
{
|
||||
const int bp = _base_pos;
|
||||
return m_pos - bp;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
return classNodeName();
|
||||
}
|
||||
|
||||
static midiTime quantized( const midiTime & _m, const int _q_grid );
|
||||
static MidiTime quantized( const MidiTime & _m, const int _q_grid );
|
||||
|
||||
DetuningHelper * detuning() const
|
||||
{
|
||||
@@ -226,15 +226,15 @@ private:
|
||||
// for piano roll editing
|
||||
bool m_selected;
|
||||
int m_oldKey;
|
||||
midiTime m_oldPos;
|
||||
midiTime m_oldLength;
|
||||
MidiTime m_oldPos;
|
||||
MidiTime m_oldLength;
|
||||
bool m_isPlaying;
|
||||
|
||||
int m_key;
|
||||
volume_t m_volume;
|
||||
panning_t m_panning;
|
||||
midiTime m_length;
|
||||
midiTime m_pos;
|
||||
MidiTime m_length;
|
||||
MidiTime m_pos;
|
||||
DetuningHelper * m_detuning;
|
||||
|
||||
void createDetuning();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* note_play_handle.h - declaration of class notePlayHandle which is needed
|
||||
* by LMMS-Play-Engine
|
||||
*
|
||||
* Copyright (c) 2004-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -52,13 +52,19 @@ public:
|
||||
const f_cnt_t _offset,
|
||||
const f_cnt_t _frames, const note & _n,
|
||||
notePlayHandle * _parent = NULL,
|
||||
const bool _part_of_arp = false );
|
||||
const bool _part_of_arp = false,
|
||||
int midiChannel = -1 );
|
||||
virtual ~notePlayHandle();
|
||||
|
||||
virtual void setVolume( const volume_t _volume = DefaultVolume );
|
||||
virtual void setVolume( const volume_t volume = DefaultVolume );
|
||||
virtual void setPanning( const panning_t panning = DefaultPanning );
|
||||
|
||||
int midiVelocity() const;
|
||||
int midiKey() const;
|
||||
int midiChannel() const
|
||||
{
|
||||
return m_midiChannel;
|
||||
}
|
||||
|
||||
const float & frequency() const
|
||||
{
|
||||
@@ -189,15 +195,15 @@ public:
|
||||
m_bbTrack = _bb_track;
|
||||
}
|
||||
|
||||
void processMidiTime( const midiTime & _time );
|
||||
void processMidiTime( const MidiTime & _time );
|
||||
void resize( const bpm_t _new_tempo );
|
||||
|
||||
void setSongGlobalParentOffset( const midiTime &offset )
|
||||
void setSongGlobalParentOffset( const MidiTime &offset )
|
||||
{
|
||||
m_songGlobalParentOffset = offset;
|
||||
}
|
||||
|
||||
const midiTime &songGlobalParentOffset() const
|
||||
const MidiTime &songGlobalParentOffset() const
|
||||
{
|
||||
return m_songGlobalParentOffset;
|
||||
}
|
||||
@@ -266,13 +272,15 @@ private:
|
||||
bpm_t m_origTempo; // original tempo
|
||||
f_cnt_t m_origFrames; // original m_frames
|
||||
|
||||
int m_origBaseNote;
|
||||
const int m_origBaseNote;
|
||||
|
||||
float m_frequency;
|
||||
float m_unpitchedFrequency;
|
||||
|
||||
BaseDetuning * m_baseDetuning;
|
||||
midiTime m_songGlobalParentOffset;
|
||||
MidiTime m_songGlobalParentOffset;
|
||||
|
||||
const int m_midiChannel;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* panning.h - declaration of some types, concerning the
|
||||
* panning of a note
|
||||
*
|
||||
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "volume.h"
|
||||
#include "templates.h"
|
||||
#include "panning_constants.h"
|
||||
#include "midi.h"
|
||||
#include "Midi.h"
|
||||
|
||||
inline stereoVolumeVector panningToVolumeVector( panning_t _p,
|
||||
float _scale = 1.0f )
|
||||
|
||||
@@ -64,8 +64,8 @@ public:
|
||||
void init();
|
||||
|
||||
|
||||
virtual midiTime length() const;
|
||||
midiTime beatPatternLength() const;
|
||||
virtual MidiTime length() const;
|
||||
MidiTime beatPatternLength() const;
|
||||
|
||||
// note management
|
||||
note * addNote( const note & _new_note, const bool _quant_pos = true );
|
||||
|
||||
@@ -135,8 +135,8 @@ protected slots:
|
||||
void pasteNotes();
|
||||
void deleteSelectedNotes();
|
||||
|
||||
void updatePosition( const midiTime & _t );
|
||||
void updatePositionAccompany( const midiTime & _t );
|
||||
void updatePosition( const MidiTime & _t );
|
||||
void updatePositionAccompany( const MidiTime & _t );
|
||||
|
||||
void zoomingChanged();
|
||||
void quantizeChanged();
|
||||
@@ -203,9 +203,9 @@ private:
|
||||
pianoRoll( const pianoRoll & );
|
||||
virtual ~pianoRoll();
|
||||
|
||||
void autoScroll( const midiTime & _t );
|
||||
void autoScroll( const MidiTime & _t );
|
||||
|
||||
midiTime newNoteLen() const;
|
||||
MidiTime newNoteLen() const;
|
||||
|
||||
void shiftPos(int amount);
|
||||
void shiftSemiTone(int amount);
|
||||
@@ -276,7 +276,7 @@ private:
|
||||
QScrollBar * m_leftRightScroll;
|
||||
QScrollBar * m_topBottomScroll;
|
||||
|
||||
midiTime m_currentPosition;
|
||||
MidiTime m_currentPosition;
|
||||
bool m_recording;
|
||||
QList<note> m_recordingNotes;
|
||||
|
||||
@@ -315,7 +315,7 @@ private:
|
||||
|
||||
// remember these values to use them
|
||||
// for the next note that is set
|
||||
midiTime m_lenOfNewNotes;
|
||||
MidiTime m_lenOfNewNotes;
|
||||
volume_t m_lastNoteVolume;
|
||||
panning_t m_lastNotePanning;
|
||||
|
||||
@@ -345,7 +345,7 @@ private:
|
||||
|
||||
|
||||
signals:
|
||||
void positionChanged( const midiTime & );
|
||||
void positionChanged( const MidiTime & );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -65,11 +65,11 @@ public:
|
||||
} ;
|
||||
|
||||
|
||||
class playPos : public midiTime
|
||||
class playPos : public MidiTime
|
||||
{
|
||||
public:
|
||||
playPos( const int _abs = 0 ) :
|
||||
midiTime( _abs ),
|
||||
MidiTime( _abs ),
|
||||
m_timeLine( NULL ),
|
||||
m_timeLineUpdate( true ),
|
||||
m_currentFrame( 0.0f )
|
||||
|
||||
@@ -84,7 +84,7 @@ private slots:
|
||||
void masterPitchReleased();
|
||||
|
||||
void updateScrollBar( int );
|
||||
void updatePosition( const midiTime & _t );
|
||||
void updatePosition( const MidiTime & _t );
|
||||
|
||||
void zoomingChanged();
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
|
||||
timeLine( int _xoff, int _yoff, float _ppt, song::playPos & _pos,
|
||||
const midiTime & _begin, QWidget * _parent );
|
||||
const MidiTime & _begin, QWidget * _parent );
|
||||
virtual ~timeLine();
|
||||
|
||||
inline song::playPos & pos()
|
||||
@@ -84,23 +84,23 @@ public:
|
||||
return m_loopPoints == LoopPointsEnabled;
|
||||
}
|
||||
|
||||
inline const midiTime & loopBegin() const
|
||||
inline const MidiTime & loopBegin() const
|
||||
{
|
||||
return ( m_loopPos[0] < m_loopPos[1] ) ?
|
||||
m_loopPos[0] : m_loopPos[1];
|
||||
}
|
||||
|
||||
inline const midiTime & loopEnd() const
|
||||
inline const MidiTime & loopEnd() const
|
||||
{
|
||||
return ( m_loopPos[0] > m_loopPos[1] ) ?
|
||||
m_loopPos[0] : m_loopPos[1];
|
||||
}
|
||||
|
||||
inline void savePos( const midiTime & _pos )
|
||||
inline void savePos( const MidiTime & _pos )
|
||||
{
|
||||
m_savedPos = _pos;
|
||||
}
|
||||
inline const midiTime & savedPos() const
|
||||
inline const MidiTime & savedPos() const
|
||||
{
|
||||
return m_savedPos;
|
||||
}
|
||||
@@ -121,18 +121,18 @@ public:
|
||||
return "timeline";
|
||||
}
|
||||
|
||||
inline int markerX( const midiTime & _t ) const
|
||||
inline int markerX( const MidiTime & _t ) const
|
||||
{
|
||||
return m_xOffset + static_cast<int>( ( _t - m_begin ) *
|
||||
m_ppt / midiTime::ticksPerTact() );
|
||||
m_ppt / MidiTime::ticksPerTact() );
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
void updatePosition( const midiTime & );
|
||||
void updatePosition( const MidiTime & );
|
||||
void updatePosition()
|
||||
{
|
||||
updatePosition( midiTime() );
|
||||
updatePosition( MidiTime() );
|
||||
}
|
||||
void toggleAutoScroll( int _n );
|
||||
void toggleLoopPoints( int _n );
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
int m_posMarkerX;
|
||||
float m_ppt;
|
||||
song::playPos & m_pos;
|
||||
const midiTime & m_begin;
|
||||
midiTime m_loopPos[2];
|
||||
const MidiTime & m_begin;
|
||||
MidiTime m_loopPos[2];
|
||||
|
||||
midiTime m_savedPos;
|
||||
MidiTime m_savedPos;
|
||||
|
||||
|
||||
textFloat * m_hint;
|
||||
@@ -183,7 +183,7 @@ private:
|
||||
|
||||
|
||||
signals:
|
||||
void positionChanged( const midiTime & _t );
|
||||
void positionChanged( const MidiTime & _t );
|
||||
void loopPointStateLoaded( int _n );
|
||||
|
||||
} ;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "midi_time.h"
|
||||
#include "MidiTime.h"
|
||||
#include "rubberband.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "AutomatableModel.h"
|
||||
@@ -101,24 +101,24 @@ public:
|
||||
}
|
||||
|
||||
|
||||
inline const midiTime & startPosition() const
|
||||
inline const MidiTime & startPosition() const
|
||||
{
|
||||
return m_startPosition;
|
||||
}
|
||||
|
||||
inline midiTime endPosition() const
|
||||
inline MidiTime endPosition() const
|
||||
{
|
||||
const int sp = m_startPosition;
|
||||
return sp + m_length;
|
||||
}
|
||||
|
||||
inline const midiTime & length() const
|
||||
inline const MidiTime & length() const
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
|
||||
virtual void movePosition( const midiTime & _pos );
|
||||
virtual void changeLength( const midiTime & _length );
|
||||
virtual void movePosition( const MidiTime & _pos );
|
||||
virtual void changeLength( const MidiTime & _length );
|
||||
|
||||
virtual trackContentObjectView * createView( trackView * _tv ) = 0;
|
||||
|
||||
@@ -151,8 +151,8 @@ private:
|
||||
track * m_track;
|
||||
QString m_name;
|
||||
|
||||
midiTime m_startPosition;
|
||||
midiTime m_length;
|
||||
MidiTime m_startPosition;
|
||||
MidiTime m_length;
|
||||
|
||||
BoolModel m_mutedModel;
|
||||
BoolModel m_soloModel;
|
||||
@@ -230,7 +230,7 @@ private:
|
||||
|
||||
textFloat * m_hint;
|
||||
|
||||
midiTime m_oldTime;// used for undo/redo while mouse-button is pressed
|
||||
MidiTime m_oldTime;// used for undo/redo while mouse-button is pressed
|
||||
|
||||
} ;
|
||||
|
||||
@@ -258,11 +258,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
midiTime endPosition( const midiTime & _pos_start );
|
||||
MidiTime endPosition( const MidiTime & _pos_start );
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
void changePosition( const midiTime & _new_pos = midiTime( -1 ) );
|
||||
void changePosition( const MidiTime & _new_pos = MidiTime( -1 ) );
|
||||
|
||||
|
||||
protected:
|
||||
@@ -289,7 +289,7 @@ private:
|
||||
} ;
|
||||
|
||||
track * getTrack();
|
||||
midiTime getPosition( int _mouse_x );
|
||||
MidiTime getPosition( int _mouse_x );
|
||||
|
||||
trackView * m_trackView;
|
||||
|
||||
@@ -382,12 +382,12 @@ public:
|
||||
return m_type;
|
||||
}
|
||||
|
||||
virtual bool play( const midiTime & _start, const fpp_t _frames,
|
||||
virtual bool play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _frame_base, int _tco_num = -1 ) = 0;
|
||||
|
||||
|
||||
virtual trackView * createView( TrackContainerView * _view ) = 0;
|
||||
virtual trackContentObject * createTCO( const midiTime & _pos ) = 0;
|
||||
virtual trackContentObject * createTCO( const MidiTime & _pos ) = 0;
|
||||
|
||||
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent ) = 0;
|
||||
@@ -415,13 +415,13 @@ public:
|
||||
{
|
||||
return( m_trackContentObjects );
|
||||
}
|
||||
void getTCOsInRange( tcoVector & _tco_v, const midiTime & _start,
|
||||
const midiTime & _end );
|
||||
void getTCOsInRange( tcoVector & _tco_v, const MidiTime & _start,
|
||||
const MidiTime & _end );
|
||||
void swapPositionOfTCOs( int _tco_num1, int _tco_num2 );
|
||||
|
||||
|
||||
void insertTact( const midiTime & _pos );
|
||||
void removeTact( const midiTime & _pos );
|
||||
void insertTact( const MidiTime & _pos );
|
||||
void removeTact( const MidiTime & _pos );
|
||||
|
||||
tact_t length() const;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* volume.h - declaration of some constants and types, concerning the volume
|
||||
* of a note
|
||||
*
|
||||
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "lmmsconfig.h"
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "midi.h"
|
||||
#include "Midi.h"
|
||||
|
||||
const volume_t MinVolume = 0;
|
||||
const volume_t MaxVolume = 200;
|
||||
|
||||
Reference in New Issue
Block a user