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

#include <OpulenZ.h>

Inheritance diagram for lmms::OpulenzInstrument:
lmms::Instrument lmms::Plugin lmms::Model lmms::JournallingObject lmms::SerializingObject

Public Member Functions

 OpulenzInstrument (InstrumentTrack *insTrack)
 ~OpulenzInstrument () override
QString nodeName () const override
gui::PluginViewinstantiateView (QWidget *_parent) override
 Create a view for the model.
bool handleMidiEvent (const MidiEvent &event, const TimePos &time, f_cnt_t offset=0) override
void play (SampleFrame *_working_buffer) override
void saveSettings (QDomDocument &_doc, QDomElement &_this) override
void loadSettings (const QDomElement &_this) override
void loadDefaultPatch ()
 Load default patch.
void loadPatch (const unsigned char inst[14])
 Load a patch into the emulator.
void tuneEqual (int center, float Hz)
void loadFile (const QString &file) override
 Load an SBI file into the knob models.
Public Member Functions inherited from lmms::Instrument
 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 playNote (NotePlayHandle *, SampleFrame *)
virtual void deleteNotePluginData (NotePlayHandle *_note_to_play)
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
QString fullDisplayName () const override
virtual bool isFromTrack (const Track *_track) const
InstrumentTrackinstrumentTrack () const
Public Member Functions inherited from lmms::Plugin
 Plugin (const Descriptor *descriptor, Model *parent, const Descriptor::SubPluginFeatures::Key *key=nullptr)
 ~Plugin () override=default
QString displayName () const override
 Return display-name out of sub plugin or descriptor.
const PixmapLoaderlogo () const
 Return logo out of sub plugin or descriptor.
Type type () const
 Return plugin type.
const Descriptordescriptor () const
 Return plugin Descriptor.
const Descriptor::SubPluginFeatures::Keykey () const
virtual AutomatableModelchildModel (const QString &modelName)
gui::PluginViewcreateView (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
ModelparentModel () 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 ()
void setHook (SerializingObjectHook *_hook)
SerializingObjectHookhook ()

Public Attributes

IntModel m_patchModel
FloatModel m_feedbackModel
BoolModel m_fmModel
BoolModel m_vibDepthModel
BoolModel m_tremDepthModel
OpulenzOperatorModels m_op1
OpulenzOperatorModels m_op2

Private Slots

void updatePatch ()
 Update patch from the models to the chip emulation.
void reloadEmulator ()
 Samplerate changes when choosing oversampling, so this is more or less mandatory.
void loadGMPatch ()
 Load one of the default patches.

Private Member Functions

int popVoice ()
 Pop least recently used voice.
int pushVoice (int v)
 Push voice into first free slot.
int Hz2fnum (float Hz)
 Find suitable F number in lowest possible block.
void writeVoice (int voice, int reg, int val)
void setVoiceVelocity (int voice, int vel)
 Can only be called by code protected by the holy mutex!

Private Attributes

CopltheEmulator
QString storedname
f_cnt_t frameCount
short * renderbuffer
int voiceNote [OPL2_VOICES]
int voiceLRU [OPL2_VOICES]
 Least recently used voices.
int velocities [128]
int fnums [128]
int pitchbend
int pitchBendRange
int RPNcoarse
int RPNfine

Static Private Attributes

static QMutex s_emulatorMutex
static constexpr auto OpAdd
 (Weird) offsets for voice parameters

Additional Inherited Members

Public Types inherited from lmms::Instrument
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*>
Signals inherited from lmms::Model
void dataChanged ()
void dataUnchanged ()
void propertiesChanged ()
Static Public Member Functions inherited from lmms::Instrument
static Instrumentinstantiate (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 PlugininstantiateWithKey (const QString &pluginName, Model *parent, const Descriptor::SubPluginFeatures::Key *key, bool keyFromDnd=false)
static Plugininstantiate (const QString &pluginName, Model *parent, void *data)
Protected Member Functions inherited from lmms::Instrument
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
void collectErrorForUI (QString errMsg)
Protected Member Functions inherited from lmms::JournallingObject
void changeID (jo_id_t _id)

Constructor & Destructor Documentation

◆ OpulenzInstrument()

lmms::OpulenzInstrument::OpulenzInstrument ( InstrumentTrack * insTrack)

◆ ~OpulenzInstrument()

lmms::OpulenzInstrument::~OpulenzInstrument ( )
override

Member Function Documentation

◆ handleMidiEvent()

bool lmms::OpulenzInstrument::handleMidiEvent ( const MidiEvent & event,
const TimePos & time,
f_cnt_t offset = 0 )
overridevirtual

Reimplemented from lmms::Instrument.

◆ Hz2fnum()

int lmms::OpulenzInstrument::Hz2fnum ( float Hz)
private

Find suitable F number in lowest possible block.

◆ instantiateView()

gui::PluginView * lmms::OpulenzInstrument::instantiateView ( QWidget * )
overridevirtual

Create a view for the model.

Implements lmms::Plugin.

◆ loadDefaultPatch()

void lmms::OpulenzInstrument::loadDefaultPatch ( )

Load default patch.

◆ loadFile()

void lmms::OpulenzInstrument::loadFile ( const QString & file)
overridevirtual

Load an SBI file into the knob models.

Reimplemented from lmms::Plugin.

◆ loadGMPatch

void lmms::OpulenzInstrument::loadGMPatch ( )
privateslot

Load one of the default patches.

◆ loadPatch()

void lmms::OpulenzInstrument::loadPatch ( const unsigned char inst[14])

Load a patch into the emulator.

◆ loadSettings()

void lmms::OpulenzInstrument::loadSettings ( const QDomElement & _this)
overridevirtual

◆ nodeName()

QString lmms::OpulenzInstrument::nodeName ( void ) const
overridevirtual

◆ play()

void lmms::OpulenzInstrument::play ( SampleFrame * _working_buffer)
overridevirtual

Reimplemented from lmms::Instrument.

◆ popVoice()

int lmms::OpulenzInstrument::popVoice ( )
private

Pop least recently used voice.

◆ pushVoice()

int lmms::OpulenzInstrument::pushVoice ( int v)
private

Push voice into first free slot.

◆ reloadEmulator

void lmms::OpulenzInstrument::reloadEmulator ( )
privateslot

Samplerate changes when choosing oversampling, so this is more or less mandatory.

◆ saveSettings()

void lmms::OpulenzInstrument::saveSettings ( QDomDocument & _doc,
QDomElement & _this )
overridevirtual

◆ setVoiceVelocity()

void lmms::OpulenzInstrument::setVoiceVelocity ( int voice,
int vel )
private

Can only be called by code protected by the holy mutex!

◆ tuneEqual()

void lmms::OpulenzInstrument::tuneEqual ( int center,
float Hz )

◆ updatePatch

void lmms::OpulenzInstrument::updatePatch ( )
privateslot

Update patch from the models to the chip emulation.

◆ writeVoice()

void lmms::OpulenzInstrument::writeVoice ( int voice,
int reg,
int val )
private

Write data to a specific voice's register, according to the OpAdd table. Can only be called by code protected by the holy mutex!

Member Data Documentation

◆ fnums

int lmms::OpulenzInstrument::fnums[128]
private

◆ frameCount

f_cnt_t lmms::OpulenzInstrument::frameCount
private

◆ m_feedbackModel

FloatModel lmms::OpulenzInstrument::m_feedbackModel

◆ m_fmModel

BoolModel lmms::OpulenzInstrument::m_fmModel

◆ m_op1

OpulenzOperatorModels lmms::OpulenzInstrument::m_op1

◆ m_op2

OpulenzOperatorModels lmms::OpulenzInstrument::m_op2

◆ m_patchModel

IntModel lmms::OpulenzInstrument::m_patchModel

◆ m_tremDepthModel

BoolModel lmms::OpulenzInstrument::m_tremDepthModel

◆ m_vibDepthModel

BoolModel lmms::OpulenzInstrument::m_vibDepthModel

◆ OpAdd

auto lmms::OpulenzInstrument::OpAdd
staticconstexprprivate
Initial value:
= std::array<unsigned int, OPL2_VOICES>{
0x00, 0x01, 0x02, 0x08, 0x09, 0x0A, 0x10, 0x11, 0x12
}

(Weird) offsets for voice parameters

◆ pitchbend

int lmms::OpulenzInstrument::pitchbend
private

◆ pitchBendRange

int lmms::OpulenzInstrument::pitchBendRange
private

◆ renderbuffer

short* lmms::OpulenzInstrument::renderbuffer
private

◆ RPNcoarse

int lmms::OpulenzInstrument::RPNcoarse
private

◆ RPNfine

int lmms::OpulenzInstrument::RPNfine
private

◆ s_emulatorMutex

QMutex lmms::OpulenzInstrument::s_emulatorMutex
staticprivate

Mutex for the emulator code. "I'd much rather do without a mutex, but it looks like the emulator code isn't really ready for threads"

◆ storedname

QString lmms::OpulenzInstrument::storedname
private

◆ theEmulator

Copl* lmms::OpulenzInstrument::theEmulator
private

◆ velocities

int lmms::OpulenzInstrument::velocities[128]
private

◆ voiceLRU

int lmms::OpulenzInstrument::voiceLRU[OPL2_VOICES]
private

Least recently used voices.

◆ voiceNote

int lmms::OpulenzInstrument::voiceNote[OPL2_VOICES]
private

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