uFMOD.I_uFMOD
μFMOD (WINMM)

API Reference

static int PlayFile(System::String^ filename,int dwFlags)
DescriptionLoads the given XM song and starts playing it immediately, unless XM_SUSPENDED is specified. It will stop any currently playing song before loading the new one.
Parameters filename
A string that specifies the name of the file.
 
dwFlags
Additional flags, controlling the playback. The following values are defined:
XM_NOLOOP = 8      An XM track plays repeatedly by default. Specify
                   this flag to play it only once.
XM_SUSPENDED = 16  The XM track is loaded in a suspended state,
                   and will not play until the Resume method
                   is called. This is useful for preloading a song
                   or testing an XM track for validity.
Set to zero, if not using any special flags.
 
ReturnsOn success, returns a pointer to an open WINMM output device handle. Returns 0 on failure.
RemarksIf no valid song is specified and there is one currently being played, PlayFile just stops playback.

static int PlayMem(byte* pXM, int length, int dwFlags) // This method requires /unsafe due to pointer usage
DescriptionLoads the XM song contained in the pXM memory buffer and starts playing it immediately, unless XM_SUSPENDED is specified. It will stop any currently playing song before loading the new one.
Parameters pXM
Points to an image of a song in memory.
 
length
Size of the image in bytes.
 
dwFlags
Additional flags, controlling the playback. The following values are defined:
XM_NOLOOP = 8      An XM track plays repeatedly by default. Specify
                   this flag to play it only once.
XM_SUSPENDED = 16  The XM track is loaded in a suspended state,
                   and will not play until the Resume method
                   is called. This is useful for preloading a song
                   or testing an XM track for validity.
Set to zero, if not using any special flags.
 
ReturnsOn success, returns a pointer to an open WINMM output device handle. Returns 0 on failure.
RemarksIf no valid song is specified and there is one currently being played, PlayMem just stops playback.

static int PlayRes(int id, int dwFlags)
DescriptionLoads the given XM resource and starts playing it immediately, unless XM_SUSPENDED is specified. It will stop any currently playing song before loading the new one.
Parameters id
Specifies the ID of the XM resource.
 
dwFlags
Additional flags, controlling the playback. The following values are defined:
XM_NOLOOP = 8      An XM track plays repeatedly by default. Specify
                   this flag to play it only once.
XM_SUSPENDED = 16  The XM track is loaded in a suspended state,
                   and will not play until the Resume method
                   is called. This is useful for preloading a song
                   or testing an XM track for validity.
Set to zero, if not using any special flags.
 
ReturnsOn success, returns a pointer to an open WINMM output device handle. Returns 0 on failure.
RemarksThe resource type must be RCDATA. The resource is loaded from the current module.

If no valid song is specified and there is one currently being played, PlayRes just stops playback.

static void Stop()
DescriptionStops the currently playing song, if any.

static void Pause()
DescriptionPauses the currently playing song, if any.
RemarksWhile paused you can still control the volume (SetVolume) and the pattern order (Jump2Pattern). The RMS volume coefficients (GetStats) will go down to 0 and the progress tracker (GetTime) will "freeze" while the song is paused.

Pause doesn't perform the request immediately. Instead, it signals to pause when playback reaches next chunk of data, which may take up to about 40ms. This way, Pause performs asynchronously and returns very fast. It is not cumulative. So, calling Pause many times in a row has the same effect as calling it once.

If you need synchronous pause/resuming, you can use WINMM waveOutPause/waveOutRestart functions.

static void Resume()
DescriptionResumes the currently paused song, if any.
RemarksResume doesn't perform the request immediately. Instead, it signals to resume when an internal thread gets a time slice, which may take some milliseconds to happen. Usually, calling Sleep(0) immediately after Resume causes it to resume faster. Resume is not cumulative. So, calling it many times in a row has the same effect as calling it once.

If you need synchronous pause/resuming, you can use WINMM waveOutPause/waveOutRestart functions.

static uint GetStats()
DescriptionReturns the current RMS volume coefficients in (L)eft and (R)ight channels.
low-order word: RMS volume in R channel
hi-order word:  RMS volume in L channel
Range from 0 (silence) to 0x7FFF (maximum) on each channel.
RemarksThis function is useful for updating a VU meter. It's recommended to rescale the output to log10 (decibels or dB for short), because human ears track volume changes in a dB scale. You may call GetStats() as often as you like, but take in mind that uFMOD updates both channel RMS volumes every 20-40ms, depending on the output sampling rate. So, calling GetStats about 16 times a second whould be quite enough to track volume changes very closely.

static uint GetRowOrder()
DescriptionReturns the currently playing row and order.
low-order word: row
hi-order word:  order
RemarksThis function is useful for synchronization. uFMOD updates both row and order values every 20-40ms, depending on the output sampling rate. So, calling GetRowOrder about 16 times a second whould be quite enough to track row and order progress very closely.

static uint GetTime()
DescriptionReturns the time in milliseconds since the song was started.
RemarksThis function is useful for synchronizing purposes. In fact, it is more precise than a regular timer in Win32. Multimedia applications can use GetTime to synchronize GFX to sound, for example. An XM player can use this function to update a progress meter.

static System::String^ GetTitle()
DescriptionReturns the current song's title.
RemarksNot every song has a title, so be prepared to get an empty string.

static void SetVolume(uint vol)
DescriptionSets the global volume. The volume scale is linear.
Parameters vol
New volume. Range: from uFMOD_MIN_VOL = 0 (muting) to uFMOD_MAX_VOL = 25 (maximum volume). Any value above uFMOD_MAX_VOL maps to maximum volume.
RemarksuFMOD internally converts the given values to a logarithmic scale (dB).

Maximum volume is set by default. The volume value is preserved across Play* calls. You can set the desired volume level before actually starting to play a song.

You can use WINMM waveOutSetVolume function to control the L and R channels volumes separately. It also has a wider range than SetVolume, sometimes allowing to amplify the sound volume as well, as opposed to SetVolume only being able to attenuate it. The bad things about waveOutSetVolume is that it may produce clicks and it's hardware dependent.

static void Jump2Pattern(uint pat)
DescriptionJumps to the specified pattern index.
Parameters pat
Next zero based pattern index.
RemarksuFMOD doesn't automatically perform Note Off effects before jumping to the target pattern. In other words, the original pattern will remain in the mixer until it fades out. You can use this feature to your advantage. If you don't like it, just insert leading Note Off commands in all patterns intended to be used as Jump2Pattern targets.

if the pattern index lays outside of the bounds of the pattern order table, calling this function jumps to pattern 0, effectively rewinding playback.

You can implement Rewind as a call to Jump2Pattern(0).