QtFM Namespace
The QtFM namespace holds Nt FM: an FM synthesiser for game sound effects. More…
| Header | #include <QtFM> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::FM) |
| Module | Nt FM C++ Classes |
Public Types
| enum | SampleFormat |
| enum | ChipType |
| enum | Category |
| enum | InstrumentFormat |
| enum | MusicFormat |
| enum | Waveform |
| enum | ParamId |
Public Functions
| QByteArray | renderToWav(const Patch &patch, int sampleRate = 48000, const PlayOptions &options = {}) |
| void | registerQmlTypes(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.
| Constant | Description |
|---|---|
QtFM::Pickup | A coin or pick-up: a short arpeggio. |
QtFM::Laser | A laser or zap: a falling pitch sweep. |
QtFM::Explosion | An explosion: filtered noise and heavy feedback. |
QtFM::PowerUp | A power-up: a rising sweep with an arpeggio. |
QtFM::Hit | A hit or punch: a noise burst over a falling thud. |
QtFM::Jump | A jump: a short rising sweep. |
QtFM::Blip | A user-interface blip. |
QtFM::Alarm | An alarm: a tone warbled by a square LFO. |
QtFM::Engine | A 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.
| Constant | Description |
|---|---|
QtFM::None | No chip: the native engine, without limits. |
QtFM::OPL2 | The YM3812 of the AdLib and Sound Blaster: two operators, four waveforms. |
QtFM::OPL3 | The YMF262 of the Sound Blaster Pro 2 and 16: two or four operators, eight waveforms. |
QtFM::OPLL | The YM2413 of MSX-Music: two operators, sine and half-sine. |
QtFM::OPN2 | The YM2612 of the Mega Drive: four operators, sine only. |
QtFM::OPM | The YM2151 of arcade boards and the X68000: four operators, sine only. |
enum QtFM::InstrumentFormat
A file format of chip instruments that Patch::fromChipInstrument() reads.
| Constant | Description |
|---|---|
QtFM::Sbi | The Sound Blaster Instrument format of OPL2 instruments (52 bytes). |
QtFM::Ibk | A 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.
| Constant | Description |
|---|---|
QtFM::Auto | Recognised by its header: VGM, VGZ, DRO, and otherwise IMF. |
QtFM::Vgm | Video Game Music logs, gzipped (VGZ) or not, with an OPL2 or OPL3 part. |
QtFM::Dro | DOSBox Raw OPL captures, versions 0.1 and 2.0. |
QtFM::Imf | id 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.
| Constant | Description |
|---|---|
QtFM::Pitch | Semitones added to the voice's pitch. |
QtFM::Gain | Gain in decibels. |
QtFM::Pan | Pan, from -1 (left) to 1 (right). |
QtFM::FilterCutoff | The filter cutoff in Hz, replacing the patch's cutoff and sweep. |
QtFM::FilterResonance | The filter resonance, 0 to 1. |
QtFM::LfoRate | The LFO rate in Hz. |
QtFM::ModulationIndex | A factor applied to every modulator, 1 by default. |
enum QtFM::SampleFormat
The sample format of an engine's output.
| Constant | Description |
|---|---|
QtFM::Float32 | 32-bit floating point samples in [-1, 1]. |
QtFM::Q15 | 16-bit signed fixed-point samples. |
enum QtFM::Waveform
The waveform of an operator.
| Constant | Description |
|---|---|
QtFM::Sine | A sine. |
QtFM::HalfSine | The positive half of a sine, then silence (OPL2 waveform 1). |
QtFM::AbsSine | The absolute value of a sine (OPL2 waveform 2). |
QtFM::QuarterSine | The rising quarters of an absolute sine (OPL2 waveform 3). |
QtFM::Square | A square wave. |
QtFM::Saw | A rising sawtooth. |
QtFM::Triangle | A 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().