6.0.0-rc4Source

QtFM Namespace

The QtFM namespace holds Nt FM: an FM synthesiser for game sound effects. More…

Header#include <QtFM>
CMaketarget_link_libraries(app PRIVATE Nt::FM)
ModuleNt FM C++ Classes

Public Types

Public Functions

QByteArrayrenderToWav(const Patch &patch, int sampleRate = 48000, const PlayOptions &options = {})
voidregisterQmlTypes(const char *uri = "QtFM")

Detailed Description

See also Using Nt FM.

Member Type Documentation

enum QtFM::Category

A kind of sound effect that Patch::generate() makes.

ConstantDescription
QtFM::PickupA coin or pick-up: a short arpeggio.
QtFM::LaserA laser or zap: a falling pitch sweep.
QtFM::ExplosionAn explosion: filtered noise and heavy feedback.
QtFM::PowerUpA power-up: a rising sweep with an arpeggio.
QtFM::HitA hit or punch: a noise burst over a falling thud.
QtFM::JumpA jump: a short rising sweep.
QtFM::BlipA user-interface blip.
QtFM::AlarmAn alarm: a tone warbled by a square LFO.
QtFM::EngineA looping engine hum, for live pitch control.

enum QtFM::ChipType

A Yamaha FM chip that a patch targets. Patch::fitsChip() checks a patch against the chip's limits.

ConstantDescription
QtFM::NoneNo chip: the native engine, without limits.
QtFM::OPL2The YM3812 of the AdLib and Sound Blaster: two operators, four waveforms.
QtFM::OPL3The YMF262 of the Sound Blaster Pro 2 and 16: two or four operators, eight waveforms.
QtFM::OPLLThe YM2413 of MSX-Music: two operators, sine and half-sine.
QtFM::OPN2The YM2612 of the Mega Drive: four operators, sine only.
QtFM::OPMThe YM2151 of arcade boards and the X68000: four operators, sine only.

enum QtFM::InstrumentFormat

A file format of chip instruments that Patch::fromChipInstrument() reads.

ConstantDescription
QtFM::SbiThe Sound Blaster Instrument format of OPL2 instruments (52 bytes).
QtFM::IbkA bank of 128 SBI-like instruments with names, as PatchBank::fromChipBank() reads.

enum QtFM::MusicFormat

A file format of chip music that MusicPlayer::load() reads.

ConstantDescription
QtFM::AutoRecognised by its header: VGM, VGZ, DRO, and otherwise IMF.
QtFM::VgmVideo Game Music logs, gzipped (VGZ) or not, with an OPL2 or OPL3 part.
QtFM::DroDOSBox Raw OPL captures, versions 0.1 and 2.0.
QtFM::Imfid Software Music Format, types 0 and 1, at MusicPlayer::imfRate().

enum QtFM::ParamId

A parameter of a playing voice that VoiceHandle::setParameter() changes. Changes are smoothed over about 5 ms on the audio thread.

ConstantDescription
QtFM::PitchSemitones added to the voice's pitch.
QtFM::GainGain in decibels.
QtFM::PanPan, from -1 (left) to 1 (right).
QtFM::FilterCutoffThe filter cutoff in Hz, replacing the patch's cutoff and sweep.
QtFM::FilterResonanceThe filter resonance, 0 to 1.
QtFM::LfoRateThe LFO rate in Hz.
QtFM::ModulationIndexA factor applied to every modulator, 1 by default.

enum QtFM::SampleFormat

The sample format of an engine's output.

ConstantDescription
QtFM::Float3232-bit floating point samples in [-1, 1].
QtFM::Q1516-bit signed fixed-point samples.

enum QtFM::Waveform

The waveform of an operator.

ConstantDescription
QtFM::SineA sine.
QtFM::HalfSineThe positive half of a sine, then silence (OPL2 waveform 1).
QtFM::AbsSineThe absolute value of a sine (OPL2 waveform 2).
QtFM::QuarterSineThe rising quarters of an absolute sine (OPL2 waveform 3).
QtFM::SquareA square wave.
QtFM::SawA rising sawtooth.
QtFM::TriangleA triangle wave.

Function Documentation

void QtFM::registerQmlTypes(const char *uri = "QtFM")

Registers the Nt FM types under the module uri, version 1.0: FmEngine and FmPatch as singletons, FmSound, FmSoundBank, FmSequence and FmMusic as elements, and FmChip and FmPatchValue for their enumerations and values. Call it before loading documents.

QByteArray QtFM::renderToWav(const Patch &patch, int sampleRate = 48000, const PlayOptions &options = {})

Renders patch at sampleRate with options and returns a WAV file; the same as Engine::renderToWav().