|
LMMS
|
#include <Lb302.h>
Public Slots | |
| void | filterChanged () |
| void | decayChanged () |
| Adjusts m_fs 's Lb302FilterKnobState::envdecay for both sampling rate and s_envInc. | |
| void | db24Toggled () |
Private Types | |
| enum class | VcoShape { Sawtooth , Triangle , Square , RoundSquare , Moog , Sine , Exponential , WhiteNoise , BLSawtooth , BLSquare , BLTriangle , BLMoog } |
| enum class | VcaMode { Attack , Decay , Idle , NeverPlayed } |
Private Member Functions | |
| void | processNote (NotePlayHandle *nph) |
| void | process (SampleFrame *outbuf, const f_cnt_t size) |
| void | recalcFilter () |
| Lb302Filter & | vcf () |
| Helper to get current vcf. | |
Private Attributes | |
| FloatModel | m_vcfCutKnob |
| FloatModel | m_vcfResKnob |
| FloatModel | m_vcfModKnob |
| FloatModel | m_vcfDecKnob |
| FloatModel | m_vcoDetuneKnob |
| FloatModel | m_distKnob |
| IntModel | m_waveShape |
| FloatModel | m_slideDecKnob |
| BoolModel | m_slideToggle |
| BoolModel | m_accentToggle |
| BoolModel | m_deadToggle |
| BoolModel | m_db24Toggle |
| float | m_vcoInc = 0.f |
| Sample increment for the frequency. Creates Sawtooth. | |
| float | m_vcoK = 0.f |
| Raw oscillator sample [-0.5, 0.5]. | |
| float | m_vcoC = 0.f |
| Raw oscillator sample [-0.5, 0.5]. | |
| bool | m_newFreq = false |
| float | m_trueFreq = 0.f |
| float | m_slide = 0.f |
| Current value of slide exponential curve. Nonzero=sliding. | |
| float | m_slideInc = 0.f |
| Slide base to use in next node. Nonzero=slide next note. | |
| float | m_slideBase = 0.f |
| The base m_vcoInc while sliding. | |
| VcoShape | m_vcoShape = VcoShape::BLSawtooth |
| Lb302FilterKnobState | m_fs = {} |
| std::array< std::unique_ptr< Lb302Filter >, 2 > | m_vcfs |
| Filters (just keep both loaded and switch). | |
| f_cnt_t | m_vcfEnvPos = s_envInc |
| Update counter. Updates when >= s_envInc. | |
| f_cnt_t | m_releaseFrame = 0 |
| float | m_vca = 0.f |
| Amplifier coefficient. | |
| float | m_noteVolume = 1.f |
| The per-note volume (velocity) of the most recent note, within [0, 1]. | |
| panning_t | m_notePan = DefaultPanning |
| The per-note panning of the most recent note. | |
| VcaMode | m_vcaMode = VcaMode::NeverPlayed |
| NotePlayHandle * | m_playingNote = nullptr |
| std::array< NotePlayHandle *, s_maxPendingNotes > | m_notes {} |
| Backing array for the multiple-producer single-consumer realtime-safe ring buffer queue for note events. | |
| std::atomic_size_t | m_notesReadSeq {0} |
| Sequence number indicating complete dequeue operations. | |
| std::atomic_size_t | m_notesWriteCommitted {0} |
| Sequence number indicating complete enqueue operations. | |
| std::atomic_size_t | m_notesWriteClaimed {0} |
| Sequence number indicating in-progress enqueue operations. | |
Static Private Attributes | |
| static constexpr float | s_distRatio = 4.f |
| static constexpr f_cnt_t | s_envInc = 64 |
| Envelope Recalculation period | |
| static constexpr float | s_vcaAttack = 1.f - 0.96406088f |
| Amplitude attack. | |
| static constexpr float | s_vcaInitial = 0.5f |
| Initial amplifier coefficient. | |
| static constexpr std::size_t | s_maxPendingNotes = 128 |
| The maximum number of note events Lb302 can process per audio buffer. | |
| static constexpr std::size_t | s_maxNoteEnqueueRetries = s_maxPendingNotes |
| The maximum number of retries permitted per enqueue operation before a note is dropped. | |
| static constexpr std::size_t | s_notesBufMask = s_maxPendingNotes - 1 |
| Bitmask used to wrap arbitrary indicies within the bounds of m_notes. | |
Friends | |
| class | gui::Lb302SynthView |
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 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 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) |
|
strongprivate |
|
strongprivate |
| lmms::Lb302Synth::Lb302Synth | ( | InstrumentTrack * | instrumentTrack | ) |
|
slot |
|
slot |
Adjusts m_fs 's Lb302FilterKnobState::envdecay for both sampling rate and s_envInc.
|
overridevirtual |
Reimplemented from lmms::Instrument.
|
slot |
|
overridevirtual |
Create a view for the model.
Implements lmms::Plugin.
Implements lmms::SerializingObject.
|
overridevirtual |
Implements lmms::SerializingObject.
|
overridevirtual |
Reimplemented from lmms::Instrument.
|
overridevirtual |
Reimplemented from lmms::Instrument.
|
private |
|
private |
Start a new note.
|
private |
|
overridevirtual |
Implements lmms::SerializingObject.
|
inlineprivate |
Helper to get current vcf.
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The per-note panning of the most recent note.
|
private |
Backing array for the multiple-producer single-consumer realtime-safe ring buffer queue for note events.
This is used to implement monophony, since multiple LMMS threads can independently send note events to an instance of Lb302.
|
private |
Sequence number indicating complete dequeue operations.
As notes are dequeued, this sequence number is incremented. It can be used as an index into m_notes if bitwise-AND'd with s_notesBufMask.
The difference between this sequence number and m_notesReadSeq is the number of currently vacant indicies in m_notes that are available to be written to, and can never exceed s_maxPendingNotes.
|
private |
Sequence number indicating in-progress enqueue operations.
As note enqueue operations begin, this sequence number is incremented. It can be used as an index into m_notes if bitwise-AND'd with s_notesBufMask.
The difference between this sequence number and m_notesReadSeq is the number of currently occupied indicies in m_notes (even those not yet written to), and can never exceed s_maxPendingNotes.
|
private |
Sequence number indicating complete enqueue operations.
As note enqueue operations complete, this sequence number is incremented. It can be used as an index into m_notes if bitwise-AND'd with s_notesBufMask.
The difference between this sequence number and m_notesReadSeq is the number of currently enqueued notes ready to be dequeued, and can never exceed s_maxPendingNotes. It should always be less than or equal to m_notesWriteClaimed.
|
private |
The per-note volume (velocity) of the most recent note, within [0, 1].
|
private |
|
private |
|
private |
Current value of slide exponential curve. Nonzero=sliding.
|
private |
|
private |
Slide base to use in next node. Nonzero=slide next note.
|
private |
|
private |
|
private |
Amplifier coefficient.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Filters (just keep both loaded and switch).
|
private |
Raw oscillator sample [-0.5, 0.5].
|
private |
|
private |
Sample increment for the frequency. Creates Sawtooth.
|
private |
Raw oscillator sample [-0.5, 0.5].
|
private |
|
private |
|
staticconstexprprivate |
|
staticconstexprprivate |
Envelope Recalculation period
|
staticconstexprprivate |
The maximum number of retries permitted per enqueue operation before a note is dropped.
Enqueue operations may fail during high contention as multiple threads attempt to reserve the next spot in the ringbuffer using atomic CAS operations, or when there are already s_maxPendingNotes enqueued notes in the ringbuffer. This constant determines the maximum number of times an enqueue operation is allowed to retry under either of these circumstances before it gives up and drops the note.
This limit should never be met under normal operation and is a failsafe for catastrophic performance situations to prevent hanging in spinlocks.
|
staticconstexprprivate |
The maximum number of note events Lb302 can process per audio buffer.
This value was arbitrarily chosen based off of stress tests with LMMS's buffer size set to its maximum value (4096 samples) to maximize the ratio of enqueue operations to dequeue operations per buffer. It may be adjusted as needed, but it must always be a power of 2.
|
staticconstexprprivate |
Bitmask used to wrap arbitrary indicies within the bounds of m_notes.
|
staticconstexprprivate |
Initial amplifier coefficient.