LMMS
Loading...
Searching...
No Matches
lmms::InstrumentTrack Class Reference

#include <InstrumentTrack.h>

Inheritance diagram for lmms::InstrumentTrack:
lmms::Track lmms::MidiEventProcessor lmms::Model lmms::JournallingObject lmms::SerializingObject

Signals

void instrumentChanged ()
void midiNoteOn (const lmms::Note &)
void midiNoteOff (const lmms::Note &)
void newNote ()
void endNote ()
Signals inherited from lmms::Track
void destroyedTrack ()
void nameChanged ()
void clipAdded (lmms::Clip *)
void colorChanged ()
void dataChanged ()
Signals inherited from lmms::Model
void dataChanged ()
void dataUnchanged ()
void propertiesChanged ()

Public Member Functions

 InstrumentTrack (TrackContainer *tc)
 ~InstrumentTrack () override
void processAudioBuffer (SampleFrame *_buf, const f_cnt_t _frames, NotePlayHandle *_n)
MidiEvent applyMasterKey (const MidiEvent &event)
void processInEvent (const MidiEvent &event, const TimePos &time=TimePos(), f_cnt_t offset=0) override
void processOutEvent (const MidiEvent &event, const TimePos &time=TimePos(), f_cnt_t offset=0) override
void silenceAllNotes (bool removeIPH=false)
bool isSustainPedalPressed () const
f_cnt_t beatLen (NotePlayHandle *_n) const
void playNote (NotePlayHandle *_n, SampleFrame *_working_buffer)
QString instrumentName () const
const Instrumentinstrument () const
Instrumentinstrument ()
void deleteNotePluginData (NotePlayHandle *_n)
void setName (const QString &_new_name) override
int masterKey (int _midi_key) const
int midiPitch () const
int midiPitchRange () const
 Returns current range for pitch bend in semitones.
bool play (const TimePos &_start, const f_cnt_t _frames, const f_cnt_t _frame_base, int _clip_num=-1) override
gui::TrackViewcreateView (gui::TrackContainerView *tcv) override
ClipcreateClip (const TimePos &pos) override
void saveTrackSpecificSettings (QDomDocument &doc, QDomElement &parent, bool presetMode) override
void loadTrackSpecificSettings (const QDomElement &_this) override
InstrumentloadInstrument (const QString &_instrument_name, const Plugin::Descriptor::SubPluginFeatures::Key *key=nullptr, bool keyFromDnd=false)
AudioBusHandleaudioBusHandle ()
MidiPortmidiPort ()
const IntModelbaseNoteModel () const
IntModelbaseNoteModel ()
IntModelfirstKeyModel ()
IntModellastKeyModel ()
bool keyRangeImport () const
bool isKeyMapped (int key) const
 Check if there is a valid mapping for the given key and it is within defined of range.
int firstKey () const
 Return first mapped key, based on currently selected keymap or user selection.
int lastKey () const
 Return last mapped key, based on currently selected keymap or user selection.
int baseNote () const
 Return base key number, based on currently selected keymap or user selection.
float baseFreq () const
 Return frequency assigned to the base key, based on currently selected keymap.
PianopianoModel ()
Microtunermicrotuner ()
bool isArpeggioEnabled () const
FloatModelpitchModel ()
FloatModelvolumeModel ()
FloatModelpanningModel ()
IntModelpitchRangeModel ()
IntModelmixerChannelModel ()
BoolModeluseMasterPitchModel ()
void setPreviewMode (const bool)
bool isPreviewMode () const
void replaceInstrument (DataFile dataFile)
void autoAssignMidiDevice (bool)
 Automatically assign a midi controller to this track, based on the midiautoassign setting.
Public Member Functions inherited from lmms::Track
 Track (Type type, TrackContainer *tc)
 Create a new (empty) track object.
 ~Track () override
 Destroy this track.
Trackclone ()
 Clone a track from this track.
Type type () const
void savePreset (QDomDocument &doc, QDomElement &element)
void loadPreset (const QDomElement &element)
void saveSettings (QDomDocument &doc, QDomElement &element) override
void loadSettings (const QDomElement &element) override
ClipaddClip (Clip *clip)
 Add another Clip into this track.
void removeClip (Clip *clip)
 Remove a given Clip from this track.
void deleteClips ()
 Remove all Clips from this track.
int numOfClips ()
 Return the number of clips we contain.
auto getClip (std::size_t clipNum) -> Clip *
 Get a Clip by number.
int getClipNum (const Clip *clip)
 Determine the given Clip's number in our array.
const clipVectorgetClips () const
void getClipsInRange (clipVector &clipV, const TimePos &start, const TimePos &end)
 Retrieve a list of clips that fall within a period.
void swapPositionOfClips (int clipNum1, int clipNum2)
 Swap the position of two clips.
void createClipsForPattern (int pattern)
void insertBar (const TimePos &pos)
 Move all the clips after a certain time later by one bar.
void removeBar (const TimePos &pos)
 Move all the clips after a certain time earlier by one bar.
bar_t length () const
 Return the length of the entire track in bars.
TrackContainertrackContainer () const
virtual const QString & name () const
QString displayName () const override
int getHeight ()
void setHeight (int height)
void lock ()
void unlock ()
bool tryLock ()
auto color () const -> const std::optional< QColor > &
void setColor (const std::optional< QColor > &color)
bool isMutedBeforeSolo () const
BoolModelgetMutedModel ()
Public Member Functions inherited from lmms::Model
 Model (Model *parent, QString displayName=QString(), bool defaultConstructed=false)
 ~Model () override=default
bool isDefaultConstructed () const
ModelparentModel () const
virtual void setDisplayName (const QString &displayName)
virtual QString fullDisplayName () const
Public Member Functions inherited from lmms::JournallingObject
 JournallingObject ()
 ~JournallingObject () override
jo_id_t id () const
void saveJournallingState (const bool newState)
void restoreJournallingState ()
void addJournalCheckPoint ()
QDomElement saveState (QDomDocument &_doc, QDomElement &_parent) override
void restoreState (const QDomElement &_this) override
bool isJournalling () const
void setJournalling (const bool _sr)
bool testAndSetJournalling (const bool newState)
bool isJournallingStateStackEmpty () const
Public Member Functions inherited from lmms::SerializingObject
 SerializingObject ()
virtual ~SerializingObject ()
void setHook (SerializingObjectHook *_hook)
SerializingObjectHookhook ()
Public Member Functions inherited from lmms::MidiEventProcessor
 MidiEventProcessor ()=default
virtual ~MidiEventProcessor ()=default

Static Public Member Functions

static void removeMidiPortNode (DataFile &dataFile)
Static Public Member Functions inherited from lmms::Track
static Trackcreate (Type tt, TrackContainer *tc)
 Create a track based on the given track type and container.
static Trackcreate (const QDomElement &element, TrackContainer *tc)
 Create a track inside TrackContainer from track type in a QDomElement and restore state from XML.

Protected Slots

void updateBaseNote ()
void updatePitch ()
void updatePitchRange ()
void updateMixerChannel ()

Protected Member Functions

QString nodeName () const override
QString getSavedInstrumentName (const QDomElement &thisElement) const
Protected Member Functions inherited from lmms::JournallingObject
void changeID (jo_id_t _id)

Private Member Functions

 mapPropertyFromModel (int, getVolume, setVolume, m_volumeModel)
void processCCEvent (int controller)

Private Attributes

MidiPort m_midiPort
NotePlayHandlem_notes [NumKeys]
NotePlayHandleList m_sustainedNotes
int m_runningMidiNotes [NumKeys]
QMutex m_midiNotesMutex
bool m_sustainPedalPressed
bool m_silentBuffersProcessed
bool m_previewMode
IntModel m_baseNoteModel
 The "A4" or "440 Hz" key (default 69).
IntModel m_firstKeyModel
 First key the instrument reacts to.
IntModel m_lastKeyModel
 Last key the instrument reacts to.
bool m_hasAutoMidiDev
NotePlayHandleList m_processHandles
FloatModel m_volumeModel
FloatModel m_panningModel
AudioBusHandle m_audioBusHandle
FloatModel m_pitchModel
IntModel m_pitchRangeModel
IntModel m_mixerChannelModel
BoolModel m_useMasterPitchModel
Instrumentm_instrument
InstrumentSoundShaping m_soundShaping
InstrumentFunctionArpeggio m_arpeggio
InstrumentFunctionNoteStacking m_noteStacking
Piano m_piano
Microtuner m_microtuner
std::unique_ptr< BoolModelm_midiCCEnable
std::unique_ptr< FloatModelm_midiCCModel [MidiControllerCount]

Static Private Attributes

static InstrumentTracks_autoAssignedTrack = nullptr

Friends

class gui::InstrumentTrackView
class gui::InstrumentTrackWindow
class NotePlayHandle
class gui::InstrumentTuningView
class gui::MidiCCRackView

Additional Inherited Members

Public Types inherited from lmms::Track
enum class  Type {
  Instrument , Pattern , Sample , Event ,
  Video , Automation , HiddenAutomation , Count
}
using clipVector = std::vector<Clip*>
Public Slots inherited from lmms::Track
void setMutedBeforeSolo (const bool muted)
void toggleSolo ()
 Invert the track's solo state.
Protected Attributes inherited from lmms::Track
BoolModel m_mutedModel
BoolModel m_soloModel

Constructor & Destructor Documentation

◆ InstrumentTrack()

lmms::InstrumentTrack::InstrumentTrack ( TrackContainer * tc)

◆ ~InstrumentTrack()

lmms::InstrumentTrack::~InstrumentTrack ( )
override

Member Function Documentation

◆ applyMasterKey()

MidiEvent lmms::InstrumentTrack::applyMasterKey ( const MidiEvent & event)

◆ audioBusHandle()

AudioBusHandle * lmms::InstrumentTrack::audioBusHandle ( )
inline

◆ autoAssignMidiDevice()

void lmms::InstrumentTrack::autoAssignMidiDevice ( bool assign)

Automatically assign a midi controller to this track, based on the midiautoassign setting.

Parameters
assignset to true to connect the midi device, set to false to disconnect

◆ baseFreq()

float lmms::InstrumentTrack::baseFreq ( ) const

Return frequency assigned to the base key, based on currently selected keymap.

Returns
Frequency in Hz

◆ baseNote()

int lmms::InstrumentTrack::baseNote ( ) const

Return base key number, based on currently selected keymap or user selection.

Returns
Number ranging from 0 to NumKeys -1

◆ baseNoteModel() [1/2]

IntModel * lmms::InstrumentTrack::baseNoteModel ( )
inline

◆ baseNoteModel() [2/2]

const IntModel * lmms::InstrumentTrack::baseNoteModel ( ) const
inline

◆ beatLen()

f_cnt_t lmms::InstrumentTrack::beatLen ( NotePlayHandle * _n) const

◆ createClip()

Clip * lmms::InstrumentTrack::createClip ( const TimePos & pos)
overridevirtual

Implements lmms::Track.

◆ createView()

gui::TrackView * lmms::InstrumentTrack::createView ( gui::TrackContainerView * tcv)
overridevirtual

Implements lmms::Track.

◆ deleteNotePluginData()

void lmms::InstrumentTrack::deleteNotePluginData ( NotePlayHandle * _n)

◆ endNote

void lmms::InstrumentTrack::endNote ( )
signal

◆ firstKey()

int lmms::InstrumentTrack::firstKey ( ) const

Return first mapped key, based on currently selected keymap or user selection.

Returns
Number ranging from 0 to NumKeys -1

◆ firstKeyModel()

IntModel * lmms::InstrumentTrack::firstKeyModel ( )
inline

◆ getSavedInstrumentName()

QString lmms::InstrumentTrack::getSavedInstrumentName ( const QDomElement & thisElement) const
protected

◆ instrument() [1/2]

Instrument * lmms::InstrumentTrack::instrument ( )
inline

◆ instrument() [2/2]

const Instrument * lmms::InstrumentTrack::instrument ( ) const
inline

◆ instrumentChanged

void lmms::InstrumentTrack::instrumentChanged ( )
signal

◆ instrumentName()

QString lmms::InstrumentTrack::instrumentName ( ) const

◆ isArpeggioEnabled()

bool lmms::InstrumentTrack::isArpeggioEnabled ( ) const
inline

◆ isKeyMapped()

bool lmms::InstrumentTrack::isKeyMapped ( int key) const

Check if there is a valid mapping for the given key and it is within defined of range.

◆ isPreviewMode()

bool lmms::InstrumentTrack::isPreviewMode ( ) const
inline

◆ isSustainPedalPressed()

bool lmms::InstrumentTrack::isSustainPedalPressed ( ) const
inline

◆ keyRangeImport()

bool lmms::InstrumentTrack::keyRangeImport ( ) const

◆ lastKey()

int lmms::InstrumentTrack::lastKey ( ) const

Return last mapped key, based on currently selected keymap or user selection.

Returns
Number ranging from 0 to NumKeys -1

◆ lastKeyModel()

IntModel * lmms::InstrumentTrack::lastKeyModel ( )
inline

◆ loadInstrument()

Instrument * lmms::InstrumentTrack::loadInstrument ( const QString & _instrument_name,
const Plugin::Descriptor::SubPluginFeatures::Key * key = nullptr,
bool keyFromDnd = false )

◆ loadTrackSpecificSettings()

void lmms::InstrumentTrack::loadTrackSpecificSettings ( const QDomElement & _this)
overridevirtual

Implements lmms::Track.

◆ mapPropertyFromModel()

lmms::InstrumentTrack::mapPropertyFromModel ( int ,
getVolume ,
setVolume ,
m_volumeModel  )
private

◆ masterKey()

int lmms::InstrumentTrack::masterKey ( int _midi_key) const

◆ microtuner()

Microtuner * lmms::InstrumentTrack::microtuner ( )
inline

◆ midiNoteOff

void lmms::InstrumentTrack::midiNoteOff ( const lmms::Note & )
signal

◆ midiNoteOn

void lmms::InstrumentTrack::midiNoteOn ( const lmms::Note & )
signal

◆ midiPitch()

int lmms::InstrumentTrack::midiPitch ( ) const
inline

◆ midiPitchRange()

int lmms::InstrumentTrack::midiPitchRange ( ) const
inline

Returns current range for pitch bend in semitones.

◆ midiPort()

MidiPort * lmms::InstrumentTrack::midiPort ( )
inline

◆ mixerChannelModel()

IntModel * lmms::InstrumentTrack::mixerChannelModel ( )
inline

◆ newNote

void lmms::InstrumentTrack::newNote ( )
signal

◆ nodeName()

QString lmms::InstrumentTrack::nodeName ( void ) const
inlineoverrideprotectedvirtual

◆ panningModel()

FloatModel * lmms::InstrumentTrack::panningModel ( )
inline

◆ pianoModel()

Piano * lmms::InstrumentTrack::pianoModel ( )
inline

◆ pitchModel()

FloatModel * lmms::InstrumentTrack::pitchModel ( )
inline

◆ pitchRangeModel()

IntModel * lmms::InstrumentTrack::pitchRangeModel ( )
inline

◆ play()

bool lmms::InstrumentTrack::play ( const TimePos & _start,
const f_cnt_t _frames,
const f_cnt_t _frame_base,
int _clip_num = -1 )
overridevirtual

Implements lmms::Track.

◆ playNote()

void lmms::InstrumentTrack::playNote ( NotePlayHandle * _n,
SampleFrame * _working_buffer )

◆ processAudioBuffer()

void lmms::InstrumentTrack::processAudioBuffer ( SampleFrame * _buf,
const f_cnt_t _frames,
NotePlayHandle * _n )

◆ processCCEvent()

void lmms::InstrumentTrack::processCCEvent ( int controller)
private

◆ processInEvent()

void lmms::InstrumentTrack::processInEvent ( const MidiEvent & event,
const TimePos & time = TimePos(),
f_cnt_t offset = 0 )
overridevirtual

◆ processOutEvent()

void lmms::InstrumentTrack::processOutEvent ( const MidiEvent & event,
const TimePos & time = TimePos(),
f_cnt_t offset = 0 )
overridevirtual

◆ removeMidiPortNode()

void lmms::InstrumentTrack::removeMidiPortNode ( DataFile & dataFile)
static

◆ replaceInstrument()

void lmms::InstrumentTrack::replaceInstrument ( DataFile dataFile)

◆ saveTrackSpecificSettings()

void lmms::InstrumentTrack::saveTrackSpecificSettings ( QDomDocument & doc,
QDomElement & parent,
bool presetMode )
overridevirtual

Implements lmms::Track.

◆ setName()

void lmms::InstrumentTrack::setName ( const QString & _new_name)
overridevirtual

Reimplemented from lmms::Track.

◆ setPreviewMode()

void lmms::InstrumentTrack::setPreviewMode ( const bool value)

◆ silenceAllNotes()

void lmms::InstrumentTrack::silenceAllNotes ( bool removeIPH = false)

◆ updateBaseNote

void lmms::InstrumentTrack::updateBaseNote ( )
protectedslot

◆ updateMixerChannel

void lmms::InstrumentTrack::updateMixerChannel ( )
protectedslot

◆ updatePitch

void lmms::InstrumentTrack::updatePitch ( )
protectedslot

◆ updatePitchRange

void lmms::InstrumentTrack::updatePitchRange ( )
protectedslot

◆ useMasterPitchModel()

BoolModel * lmms::InstrumentTrack::useMasterPitchModel ( )
inline

◆ volumeModel()

FloatModel * lmms::InstrumentTrack::volumeModel ( )
inline

◆ gui::InstrumentTrackView

friend class gui::InstrumentTrackView
friend

◆ gui::InstrumentTrackWindow

friend class gui::InstrumentTrackWindow
friend

◆ gui::InstrumentTuningView

friend class gui::InstrumentTuningView
friend

◆ gui::MidiCCRackView

friend class gui::MidiCCRackView
friend

◆ NotePlayHandle

friend class NotePlayHandle
friend

Member Data Documentation

◆ m_arpeggio

InstrumentFunctionArpeggio lmms::InstrumentTrack::m_arpeggio
private

◆ m_audioBusHandle

AudioBusHandle lmms::InstrumentTrack::m_audioBusHandle
private

◆ m_baseNoteModel

IntModel lmms::InstrumentTrack::m_baseNoteModel
private

The "A4" or "440 Hz" key (default 69).

◆ m_firstKeyModel

IntModel lmms::InstrumentTrack::m_firstKeyModel
private

First key the instrument reacts to.

◆ m_hasAutoMidiDev

bool lmms::InstrumentTrack::m_hasAutoMidiDev
private

◆ m_instrument

Instrument* lmms::InstrumentTrack::m_instrument
private

◆ m_lastKeyModel

IntModel lmms::InstrumentTrack::m_lastKeyModel
private

Last key the instrument reacts to.

◆ m_microtuner

Microtuner lmms::InstrumentTrack::m_microtuner
private

◆ m_midiCCEnable

std::unique_ptr<BoolModel> lmms::InstrumentTrack::m_midiCCEnable
private

◆ m_midiCCModel

std::unique_ptr<FloatModel> lmms::InstrumentTrack::m_midiCCModel[MidiControllerCount]
private

◆ m_midiNotesMutex

QMutex lmms::InstrumentTrack::m_midiNotesMutex
private

◆ m_midiPort

MidiPort lmms::InstrumentTrack::m_midiPort
private

◆ m_mixerChannelModel

IntModel lmms::InstrumentTrack::m_mixerChannelModel
private

◆ m_notes

NotePlayHandle* lmms::InstrumentTrack::m_notes[NumKeys]
private

◆ m_noteStacking

InstrumentFunctionNoteStacking lmms::InstrumentTrack::m_noteStacking
private

◆ m_panningModel

FloatModel lmms::InstrumentTrack::m_panningModel
private

◆ m_piano

Piano lmms::InstrumentTrack::m_piano
private

◆ m_pitchModel

FloatModel lmms::InstrumentTrack::m_pitchModel
private

◆ m_pitchRangeModel

IntModel lmms::InstrumentTrack::m_pitchRangeModel
private

◆ m_previewMode

bool lmms::InstrumentTrack::m_previewMode
private

◆ m_processHandles

NotePlayHandleList lmms::InstrumentTrack::m_processHandles
private

◆ m_runningMidiNotes

int lmms::InstrumentTrack::m_runningMidiNotes[NumKeys]
private

◆ m_silentBuffersProcessed

bool lmms::InstrumentTrack::m_silentBuffersProcessed
private

◆ m_soundShaping

InstrumentSoundShaping lmms::InstrumentTrack::m_soundShaping
private

◆ m_sustainedNotes

NotePlayHandleList lmms::InstrumentTrack::m_sustainedNotes
private

◆ m_sustainPedalPressed

bool lmms::InstrumentTrack::m_sustainPedalPressed
private

◆ m_useMasterPitchModel

BoolModel lmms::InstrumentTrack::m_useMasterPitchModel
private

◆ m_volumeModel

FloatModel lmms::InstrumentTrack::m_volumeModel
private

◆ s_autoAssignedTrack

InstrumentTrack * lmms::InstrumentTrack::s_autoAssignedTrack = nullptr
staticprivate

The documentation for this class was generated from the following files: