Openmpt is a module-playing engine, capable of replaying wide variety of multichannel music (669, amf, ams, dbm, digi, dmf, dsm, far, gdm, ice, imf, it, itp, j2b, m15, mdl, med, mid, mo3, mod, mptm, mt2, mtm, okt, plm, psm, ptm, s3m, stm, ult, umx, wow, xm). It also loads wav files, and may support wider support for wav files than the stand-alone wav audio source.
SoLoud uses Openmpt through DLL, available from https://lib.openmpt.org/. Note that Openmpt has a more restrictive license than SoLoud, so be sure to check the license.
The midi formats (.mid and .abc) require a library of instruments (patches) to be available. One free set can be downloaded from the SoLoud downloads page.
If the DLL is not available, the SoLoud::
You tell Openmpt to load a file with the load function:
result load(const char *aFilename); // File to load
If loading fails, the function returns an error code.
Openmpt spacedeb; spacedeb.load("spacedeb.mod");
The loadFile() can be used to load audio from a SoLoud::
Alternate way of loading the file is to read from a memory buffer.
result loadMem(unsigned char *aMem, int aLength, bool aCopy, bool aTakeOwnership);
The aTakeOwnership parameter can be used to tell SoLoud to free the pointer once it's done with it. The aCopy parameter is here for compatibility with the other loadMem functions.
Adjusting the looping of a Openmpt sound does not currently have any effect. All music is set to loop by default.
As with any other audio source, you can attach filters to Openmpt audio sources.
You can stop all instances of a Openmpt sound source with stop(). This is equivalent of calling soloud.stopAudioSource() with the sound source.
Set the inaudible behavior of the sound. By default, if a sound is inaudible, it's paused, and will resume when it becomes audible again. With this function you can tell SoLoud to either kill the sound if it becomes inaudible, or to keep ticking the sound even if it's inaudible.
// Keep on talking even if I'm not around gSpeech.setInaudibleBehavior(true, false);
Set the default volume of the instances created from this audio source.
If looping is enabled, the loop point is, by default, the start of the stream. The loop point can be changed, and current loop point can be queried with these functions.
double t = snd.getLoopPoint(); snd.setLoopPoint(t + 1); // skip 1 second more when looping ... snd.setLoopPoint(0); // loop from start
Note that since looping occurs on openmpt's side, this setting currently has no effect.
Inherited 3d audio interfaces
Like all other audio sources, Openmpt inherits the 3d audio interfaces. Please refer to the 3d audio chapter for details on:
Copyright©2013-2020 Jari Komppa