Fork me on GitHub

SoLoud::Modplug

The SoLoud::Modplug is a module-playing engine, capable of replaying wide variety of multichannel music (669, abc, amf, ams, dbm, dmf, dsm, far, it, j2b, mdl, med, mid, mod, mt2, mtm, okt, pat, psm, ptm, s3m, stm, ult, umx, xm). It also loads wav files, and may support wider support for wav files than the stand-alone wav audio source.

Due to its size, it's possible to compile SoLoud without the modplug support.

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. By default, the patches are loaded from pat/ directory.

Modplug.load()

You tell modplug 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.


SoLoud::Modplug spacedeb;
spacedeb.load("spacedeb.mod");

Modplug.loadFile()

The loadFile() can be used to load audio from a SoLoud::File object. This is useful for integrating with virtual filesystems / packfiles, such as PhysFS.

Modplug.loadMem()

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.

Modplug.setLooping()

Adjusting the looping of a modplug sound does not currently have any effect. All music is set to loop by default.

Modplug.setFilter()

As with any other audio source, you can attach filters to Modplug audio sources.


gMusic.setFilter(0, &gLofi);

Modplug.stop()

You can stop all instances of a modplug sound source with stop(). This is equivalent of calling soloud.stopAudioSource() with the sound source.


gMusic.stop();

Modplug.setInaudibleBehavior()

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);

Modplug.setVolume()

Set the default volume of the instances created from this audio source.


gTinyVoice.setVolume(0.1);
   

Inherited 3d audio interfaces

Like all other audio sources, Modplug inherits the 3d audio interfaces. Please refer to the 3d audio chapter for details on:

Copyright©2013-2015 Jari Komppa