lmms
Cross-platform music production software
Loading...
Searching...
No Matches
lmms::Instrument Class Reference

#include <Instrument.h>

Inheritance diagram for lmms::Instrument:
lmms::Plugin lmms::Model lmms::JournallingObject lmms::SerializingObject lmms::AudioFileProcessor lmms::BitInvader lmms::CarlaInstrument lmms::DummyInstrument lmms::FreeBoyInstrument lmms::GigInstrument lmms::KickerInstrument lmms::Lb302Synth lmms::Lv2Instrument lmms::MalletsInstrument lmms::MonstroInstrument lmms::NesInstrument lmms::OpulenzInstrument lmms::OrganicInstrument lmms::PatmanInstrument lmms::Sf2Instrument lmms::SfxrInstrument lmms::SidInstrument lmms::SlicerT lmms::TripleOscillator lmms::VestigeInstrument lmms::Vibed lmms::WatsynInstrument lmms::Xpressive lmms::ZynAddSubFxInstrument

Public Types

enum class  Flag { NoFlags = 0x00 , IsSingleStreamed = 0x01 , IsMidiBased = 0x02 , IsNotBendable = 0x04 }
using Flags = lmms::Flags<Flag>
Public Types inherited from lmms::Plugin
enum class  Type {
  Instrument , Effect , ImportFilter , ExportFilter ,
  Tool , Library , Other , Undefined = 255
}
using DescriptorList = QList<Descriptor*>

Public Member Functions

 Instrument (InstrumentTrack *_instrument_track, const Descriptor *_descriptor, const Descriptor::SubPluginFeatures::Key *key=nullptr, Flags flags=Flag::NoFlags)
 ~Instrument () override=default
virtual bool hasNoteInput () const
virtual void play (SampleFrame *_working_buffer)
virtual void playNote (NotePlayHandle *, SampleFrame *)
virtual void deleteNotePluginData (NotePlayHandle *_note_to_play)
virtual auto midiPatch () const -> std::optional< MidiPatch >
 For applicable instruments: Provides host with current MIDI bank and program.
virtual auto childModel (std::string_view modelName) -> AutomatableModel *
virtual f_cnt_t beatLen (NotePlayHandle *_n) const
virtual float desiredReleaseTimeMs () const
f_cnt_t desiredReleaseFrames () const
sample_rate_t getSampleRate () const
bool isSingleStreamed () const
bool isMidiBased () const
bool isBendable () const
virtual bool handleMidiEvent (const MidiEvent &, const TimePos &=TimePos(), f_cnt_t offset=0)
QString fullDisplayName () const override
virtual bool isFromTrack (const Track *_track) const
InstrumentTrack * instrumentTrack () const
Public Member Functions inherited from lmms::Plugin
 Plugin (const Descriptor *descriptor, Model *parent, const Descriptor::SubPluginFeatures::Key *key=nullptr)
 Constructor of a plugin.
 ~Plugin () override=default
QString displayName () const override
 Return display-name out of sub plugin or descriptor.
const PixmapLoader * logo () const
 Return logo out of sub plugin or descriptor.
Type type () const
 Return plugin type.
const Descriptor * descriptor () const
 Return plugin Descriptor.
const Descriptor::SubPluginFeatures::Key & key () const
virtual void loadFile (const QString &file)
gui::PluginView * createView (QWidget *parent)
 Create a view for the model.
Public Member Functions inherited from lmms::Model
 Model (Model *parent, QString displayName=QString(), bool defaultConstructed=false)
 ~Model () override=default
bool isDefaultConstructed () const
Model * parentModel () const
virtual void setDisplayName (const QString &displayName)
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 ()
virtual QString nodeName () const =0
void setHook (SerializingObjectHook *_hook)
SerializingObjectHook * hook ()

Static Public Member Functions

static Instrument * instantiate (const QString &_plugin_name, InstrumentTrack *_instrument_track, const Plugin::Descriptor::SubPluginFeatures::Key *key, bool keyFromDnd=false)
Static Public Member Functions inherited from lmms::Plugin
static Plugin * instantiateWithKey (const QString &pluginName, Model *parent, const Descriptor::SubPluginFeatures::Key *key, bool keyFromDnd=false)
static Plugin * instantiate (const QString &pluginName, Model *parent, void *data)

Protected Member Functions

void applyFadeIn (SampleFrame *buf, NotePlayHandle *n)
void applyRelease (SampleFrame *buf, const NotePlayHandle *_n)
float computeReleaseTimeMsByFrameCount (f_cnt_t frames) const
Protected Member Functions inherited from lmms::Plugin
virtual gui::PluginView * instantiateView (QWidget *)=0
 Create a view for the model.
void collectErrorForUI (QString errMsg)
Protected Member Functions inherited from lmms::JournallingObject
void changeID (jo_id_t _id)
Protected Member Functions inherited from lmms::SerializingObject
virtual void saveSettings (QDomDocument &doc, QDomElement &element)=0
virtual void loadSettings (const QDomElement &element)=0

Private Attributes

InstrumentTrack * m_instrumentTrack
Flags m_flags

Additional Inherited Members

Signals inherited from lmms::Model
void dataChanged ()
void dataUnchanged ()
void propertiesChanged ()

Member Typedef Documentation

◆ Flags

Member Enumeration Documentation

◆ Flag

enum class lmms::Instrument::Flag
strong
Enumerator
NoFlags 
IsSingleStreamed 
IsMidiBased 

Instrument provides a single audio stream for all notes

IsNotBendable 

Instrument is controlled by MIDI events rather than NotePlayHandles

Constructor & Destructor Documentation

◆ Instrument()

lmms::Instrument::Instrument ( InstrumentTrack * _instrument_track,
const Descriptor * _descriptor,
const Descriptor::SubPluginFeatures::Key * key = nullptr,
Flags flags = Flag::NoFlags )

◆ ~Instrument()

lmms::Instrument::~Instrument ( )
overridedefault

Member Function Documentation

◆ applyFadeIn()

void lmms::Instrument::applyFadeIn ( SampleFrame * buf,
NotePlayHandle * n )
protected

◆ applyRelease()

void lmms::Instrument::applyRelease ( SampleFrame * buf,
const NotePlayHandle * _n )
protected

◆ beatLen()

f_cnt_t lmms::Instrument::beatLen ( NotePlayHandle * _n) const
virtual

Reimplemented in lmms::AudioFileProcessor.

◆ childModel()

virtual auto lmms::Instrument::childModel ( std::string_view modelName) -> AutomatableModel *
inlinevirtual

Called if external source needs to change something but we cannot reference the class header. Should return nullptr if the model is not found.

Reimplemented in lmms::GigInstrument, and lmms::Sf2Instrument.

◆ computeReleaseTimeMsByFrameCount()

float lmms::Instrument::computeReleaseTimeMsByFrameCount ( f_cnt_t frames) const
protected

◆ deleteNotePluginData()

◆ desiredReleaseFrames()

f_cnt_t lmms::Instrument::desiredReleaseFrames ( ) const
inline

◆ desiredReleaseTimeMs()

◆ fullDisplayName()

QString lmms::Instrument::fullDisplayName ( ) const
overridevirtual

Reimplemented from lmms::Model.

◆ getSampleRate()

sample_rate_t lmms::Instrument::getSampleRate ( ) const

◆ handleMidiEvent()

virtual bool lmms::Instrument::handleMidiEvent ( const MidiEvent & ,
const TimePos & = TimePos(),
f_cnt_t offset = 0 )
inlinevirtual

◆ hasNoteInput()

virtual bool lmms::Instrument::hasNoteInput ( ) const
inlinevirtual

Reimplemented in lmms::Lv2Instrument.

◆ instantiate()

Instrument * lmms::Instrument::instantiate ( const QString & _plugin_name,
InstrumentTrack * _instrument_track,
const Plugin::Descriptor::SubPluginFeatures::Key * key,
bool keyFromDnd = false )
static

instantiate instrument-plugin with given name or return NULL on failure

◆ instrumentTrack()

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

◆ isBendable()

bool lmms::Instrument::isBendable ( ) const
inline

◆ isFromTrack()

bool lmms::Instrument::isFromTrack ( const Track * _track) const
virtual

◆ isMidiBased()

bool lmms::Instrument::isMidiBased ( ) const
inline

◆ isSingleStreamed()

bool lmms::Instrument::isSingleStreamed ( ) const
inline

◆ midiPatch()

virtual auto lmms::Instrument::midiPatch ( ) const -> std::optional< MidiPatch >
inlinevirtual

For applicable instruments: Provides host with current MIDI bank and program.

Reimplemented in lmms::GigInstrument, and lmms::Sf2Instrument.

◆ play()

◆ playNote()

Member Data Documentation

◆ m_flags

Flags lmms::Instrument::m_flags
private

◆ m_instrumentTrack

InstrumentTrack* lmms::Instrument::m_instrumentTrack
private

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