Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
5310 lines (5031 sloc) 273 KB
<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on June, 24 2004 by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HEAD>
<TITLE>MikMod sound library: </TITLE>
<META NAME="description" CONTENT="MikMod sound library: ">
<META NAME="keywords" CONTENT="MikMod sound library: ">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC_Top"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1>MikMod sound library</H1>This manual documents the MikMod Sound Library, version 3.2.0.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC1">1. Introduction</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">What is MikMod ?</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC2">2. Tutorial</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Your first steps with MikMod.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC8">3. Using the Library</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">A thematic presentation of the library.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC16">4. Library Reference</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Detailed description of the functions and variables.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC121">5. Index</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<HR SIZE=1>
<A NAME="SEC1"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<A NAME="Introduction"></A>
<H1> 1. Introduction </H1>
<!--docid::SEC1::-->
<P>
The MikMod sound library is an excellent way for a programmer to add music
and sound effects to an application. It is a powerful and flexible library,
with a simple and easy-to-learn API.
</P><P>
Besides, the library is very portable and runs under a lot of Unices, as well
as under OS/2, MacOS and Windows. Third party individuals also maintain ports
on other systems, including MS-DOS, and BeOS.
</P><P>
MikMod is able to play a wide range of module formats, as well as digital sound
files. It can take advantage of particular features of your system, such as
sound redirection over the network. And due to its modular nature, the library
can be extended to support more sound or module formats, as well as new
hardware or other sound output capabilities, as they appear.
</P><P>
<A NAME="Tutorial"></A>
<HR SIZE="6">
<A NAME="SEC2"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC1"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC3"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC1"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 2. Tutorial </H1>
<!--docid::SEC2::-->
<P>
This chapter will describe how to quickly incorporate MikMod's power into
your programs. It doesn't cover everything, but that's a start and I hope
it will help you understand the library philosophy.
</P><P>
If you have a real tutorial to put here, you're welcome ! Please send it to
me<small>....</small>
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC3">2.1 MikMod Concepts</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">A few things you'll need to know.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC4">2.2 A Skeleton Program</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">The shortest MikMod program.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC5">2.3 Playing Modules</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">How to create a simple module player.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC6">2.4 Playing Sound Effects</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">How to play simple sound effects.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC7">2.5 More Sound Effects</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">How to play more complex sound effects.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="MikMod Concepts"></A>
<HR SIZE="6">
<A NAME="SEC3"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC4"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.1 MikMod Concepts </H2>
<!--docid::SEC3::-->
<P>
MikMod's sound output is composed of several sound <EM>voices</EM> which are
mixed, either in software or in hardware, depending of your hardware
configuration. Simple sounds, like sound effects, use only one voice, whereas
sound modules, which are complex arrangements of sound effects, use several
voices.
</P><P>
MikMod's functions operate either globally, or at the voice level. Differences
in the handling of sound effects and modules are kept minimal, at least for
the programmer.
</P><P>
The sound playback is done by a <EM>sound driver</EM>. MikMod provides several
sound drivers: different hardware drivers, and some software drivers to
redirect sound in a file, or over the network. You can even add your own
driver, register it to make it known by the library, and select it (this is
exactly what the module plugin of xmms does).
</P><P>
<A NAME="A Skeleton Program"></A>
<HR SIZE="6">
<A NAME="SEC4"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC3"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC5"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.2 A Skeleton Program </H2>
<!--docid::SEC4::-->
<P>
To use MikMod in your program, there are a few steps required:
</P><P>
<UL>
<LI>Include <TT>`mikmod.h'</TT> in your program.
<LI>Register the MikMod drivers you need.
<LI>Initialize the library with MikMod_Init() before using any other MikMod
function.
<LI>Give up resources with MikMod_Exit() at the end of your program, or before
when MikMod is not needed anymore.
<LI>Link your application with the MikMod sound library.
</UL>
<P>
Here's a program which meets all those conditions:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>/* MikMod Sound Library example program: a skeleton */
#include &#60;mikmod.h&#62;
main()
{
/* register all the drivers */
MikMod_RegisterAllDrivers();
/* initialize the library */
MikMod_Init("");
/* we could play some sound here... */
/* give up */
MikMod_Exit();
}
</pre></td></tr></table></P><P>
This program would be compiled with the following command line:
<CODE>cc -o example example.c `libmikmod-config --cflags` `libmikmod-config --libs`</CODE>
</P><P>
Although this programs produces no useful result, many things happen when you
run it. The call to <CODE>MikMod_RegisterAllDrivers</CODE> registers all the drivers
embedded in the MikMod library. Then, <CODE>MikMod_Init</CODE> chooses the more
adequate driver and initializes it. The program is now ready to produce sound.
When sound is not needed any more, <CODE>MikMod_Exit</CODE> is used to relinquish
memory and let other programs have access to the sound hardware.
</P><P>
<A NAME="Playing Modules"></A>
<HR SIZE="6">
<A NAME="SEC5"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC4"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC6"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.3 Playing Modules </H2>
<!--docid::SEC5::-->
<P>
Our program is not really useful if it doesn't produce sound. Let's suppose
you've got this good old module, "Beyond music", in the file
<TT>`beyond music.mod'</TT>. How about playing it ?
</P><P>
To do this, we'll use the following code:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>/* MikMod Sound Library example program: a simple module player */
#include &#60;unistd.h&#62;
#include &#60;mikmod.h&#62;
main()
{
MODULE *module;
/* register all the drivers */
MikMod_RegisterAllDrivers();
/* register all the module loaders */
MikMod_RegisterAllLoaders();
/* initialize the library */
md_mode |= DMODE_SOFT_MUSIC;
if (MikMod_Init("")) {
fprintf(stderr, "Could not initialize sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return;
}
/* load module */
module = Player_Load("beyond music.mod", 64, 0);
if (module) {
/* start module */
Player_Start(module);
while (Player_Active()) {
/* we're playing */
usleep(10000);
MikMod_Update();
}
Player_Stop();
Player_Free(module);
} else
fprintf(stderr, "Could not load module, reason: %s\n",
MikMod_strerror(MikMod_errno));
/* give up */
MikMod_Exit();
}
</pre></td></tr></table></P><P>
What's new here ? First, we've not only registered MikMod's device driver,
but also the module loaders. MikMod comes with a large choice of module
loaders, each one for a different module type. Since <EM>every</EM> loader is
called to determine the type of the module when we try to load them, you may
want to register only a few of them to save time. In our case, we don't matter,
so we happily register every module loader.
</P><P>
Then, there's an extra line before calling <CODE>MikMod_Init</CODE>. We change the
value of MikMod's variable <CODE>md_mode</CODE> to tell the library that we want the
module to be processed by the software. If you're the happy owner of a GUS-type
card, you could use the specific hardware driver for this card, but in this
case you should not set the <CODE>DMODE_SOFT_MUSIC</CODE> flag.
</P><P>
We'll ensure that <CODE>MikMod_Init</CODE> was successful. Note that, in case of
error, MikMod provides the variable <CODE>MikMod_errno</CODE>, an equivalent of
the C library <CODE>errno</CODE> for MikMod errors, and the function
<CODE>MikMod_strerror</CODE>, an equivalent to <CODE>strerror</CODE>.
</P><P>
Now onto serious business ! The module is loaded with the <CODE>Player_Load</CODE>
function, which takes the name of the module file, and the number of voices
afforded to the module. In this case, the module has only 4 channels, so 4
voices, but complex Impulse Tracker modules can have a lot of voices (as they
can have as many as 256 virtual channels with so-called "new note actions").
Since empty voices don't cost time to be processed, it is safe to use a big
value, such as 64 or 128. The third parameter is the "curiosity" of the
loader: if nonzero, the loader will search for hidden parts in the module.
However, only a few module formats can embed hidden or non played parts, so
we'll use 0 here.
</P><P>
Now that the module is ready to play, let's play it. We inform the player that
the current module is <CODE>module</CODE> with <CODE>Player_Start</CODE>. Playback starts,
but we have to update it on a regular basis. So there's a loop on the result
of the <CODE>Player_Active</CODE> function, which will tell us if the module has
finished. To update the sound, we simply call <CODE>MikMod_Update</CODE>.
</P><P>
After the module has finished, we tell the player its job is done with
<CODE>Player_Stop</CODE>, and we free the module with <CODE>Player_Free</CODE>.
</P><P>
<A NAME="Playing Sound Effects"></A>
<HR SIZE="6">
<A NAME="SEC6"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC5"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC7"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.4 Playing Sound Effects </H2>
<!--docid::SEC6::-->
<P>
MikMod is not limited to playing modules, it can also play sound effects, that
is, module samples. It's a bit more complex than playing a module, because the
module player does a lot of things for us, but here we'll get more control over
what is actually played by the program. Let's look at an example:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>/* MikMod Sound Library example program: sound effects */
#include &#60;unistd.h&#62;
#include &#60;mikmod.h&#62;
main()
{
int i;
/* sound effects */
SAMPLE *sfx1, *sfx2;
/* voices */
int v1, v2;
/* register all the drivers */
MikMod_RegisterAllDrivers();
/* initialize the library */
md_mode |= DMODE_SOFT_SNDFX;
if (MikMod_Init("")) {
fprintf(stderr, "Could not initialize sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return;
}
/* load samples */
sfx1 = Sample_Load("first.wav");
if (!sfx1) {
MikMod_Exit();
fprintf(stderr, "Could not load the first sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return;
}
sfx2 = Sample_Load("second.wav");
if (!sfx2) {
Sample_Free(sfx1);
MikMod_Exit();
fprintf(stderr, "Could not load the second sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return;
}
/* reserve 2 voices for sound effects */
MikMod_SetNumVoices(-1, 2);
/* get ready to play */
MikMod_EnableOutput();
/* play first sample */
v1 = Sample_Play(sfx1, 0, 0);
for(i = 0; i &#60; 5; i++) {
MikMod_Update();
usleep(100000);
}
/* half a second later, play second sample */
v2 = Sample_Play(sfx2, 0, 0);
do {
MikMod_Update();
usleep(100000);
} while (!Voice_Stopped(v2));
MikMod_DisableOutput();
Sample_Free(sfx2);
Sample_Free(sfx1);
MikMod_Exit();
}
</pre></td></tr></table></P><P>
As in the previous example, we begin by registering the sound drivers and
initializing the library. We also ask for software mixing by modifying the
variable <CODE>md_mode</CODE>.
</P><P>
It's time to load our files, with the <CODE>Sample_Load</CODE> function. Don't forget
to test the return value -- it looks ugly here on such a small example, but
it's a good practice<small>....</small>
</P><P>
Since we want to play two samples, we have to use at least two voices for this,
so we reserve them with a <CODE>MikMod_SetNumVoices</CODE> call. The first parameter
sets the number of module voices, and the second parameter the number of sound
effect voices. We don't want to set the number of module voices here (it's part
of the module player's duty), so we use the value <CODE>-1</CODE> to keep the current
value, and we reserve two sound effect voices.
</P><P>
Now we're ready to play, so we call <CODE>MikMod_EnableOutput</CODE> to make the
driver ready. Sound effects are played by the <CODE>Sample_Play</CODE> function.
You just have to specify which sample you want to play, the offset from which
you want to start, and the playback flags. More on this later. The function
returns the number of the voice associated to the sample.
</P><P>
We play the first sample for half a second, then we start to play the second
sample. Since we've reserved two channels, both samples play simultaneously. We
use the <CODE>Voice_Stopped</CODE> function to stop the playback: it returns the
current status of the voice argument, which is zero when the sample plays and
nonzero when it has finished. So the <CODE>do</CODE> loop will stop exactly when
the second sample is finished, regardless of the length of the first sample.
</P><P>
To finish, we get rid of the samples with <CODE>Sample_Free</CODE>.
</P><P>
<A NAME="More Sound Effects"></A>
<HR SIZE="6">
<A NAME="SEC7"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC6"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.5 More Sound Effects </H2>
<!--docid::SEC7::-->
<P>
Sound effects have some attributes that can be affected to control the playback.
These are speed, panning, and volume. Given a voice number, you can affect these
attributes with the <CODE>Voice_SetFrequency</CODE>, <CODE>Voice_SetPanning</CODE> and
<CODE>Voice_SetVolume</CODE> functions.
</P><P>
In the previous example, we'll replace the actual sound code, located between
the calls to <CODE>MikMod_EnableOutput</CODE> and <CODE>MikMod_DisableOutput</CODE>, with
the following code:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre> Sample_Play(sfx1, 0, 0);
for(i = 0; i &#60; 5; i++) {
MikMod_Update();
usleep(100000);
}
v2 = Sample_Play(sfx2, 0, SFX_CRITICAL);
i = 0;
do {
MikMod_Update();
usleep(100000);
v1 = Sample_Play(sfx1, 0, 0);
Voice_SetVolume(v1, 160);
Voice_SetFrequency(v1, (sfx1-&#62;speed * (100 + i)) / 100);
Voice_SetPanning(v2, (i++ &#38; 1) ? PAN_LEFT : PAN_RIGHT);
} while (!Voice_Stopped(v2));
</pre></td></tr></table></P><P>
The first thing you'll notice, is the <CODE>SFX_CRITICAL</CODE> flag used to play the
second sample. Since the <CODE>do</CODE> loop will add another sample every 100
milliseconds, and we reserved only two voices, the oldest voice will be
cut each time this is necessary. Doing this would cut the second sample in the
second iteration of the loop. However, since we flagged this sound as
"critical", it won't be cut until it is finished or we stop it with a
<CODE>Voice_Stop</CODE> call. So the second sample will play fine, whereas the first
sample will be stopped every loop iteration.
</P><P>
Then, we choose to play the first sample a bit lower, with
<CODE>Voice_SetVolume</CODE>. Volume voices range from 0 (silence) to 256. In
this case we play the sample at 160. To make the sound look weird, we also
change its frequency with <CODE>Voice_SetFrequency</CODE>. The computation in the
example code makes the frequency more and more high (starting from the sample
frequency and then increasing from 1% each iteration).
</P><P>
And to demonstrate the <CODE>Voice_SetPanning</CODE> function, we change the panning
of the second sample at each iteration from the left to the right. The argument
can be one of the standard panning <CODE>PAN_LEFT</CODE>, <CODE>PAN_RIGHT</CODE>,
<CODE>PAN_CENTER</CODE> and <CODE>PAN_SURROUND</CODE><A NAME="DOCF1" HREF="mikmod.html#FOOT1">(1)</A>, or a numeric value between 0 (<CODE>PAN_LEFT</CODE>) and
255 (<CODE>PAN_RIGHT</CODE>).
</P><P>
<A NAME="Using the Library"></A>
<HR SIZE="6">
<A NAME="SEC8"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC7"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC9"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC2"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 3. Using the Library </H1>
<!--docid::SEC8::-->
<P>
This chapter describes the various parts of the library and their uses.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC9">3.1 Library Version</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC10">3.2 Type Definitions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC11">3.3 Error Handling</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC12">3.4 Library Initialization and Core Functions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC13">3.5 Samples and Voice Control</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC14">3.6 Modules and Player Control</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC15">3.7 Loading Data from Memory</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Library Version"></A>
<HR SIZE="6">
<A NAME="SEC9"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC10"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.1 Library Version </H2>
<!--docid::SEC9::-->
<P>
If your program is dynamically linked with the MikMod library, you should check
which version of the library you're working with.
To do this, the library defines a few constants and a function to help you
determine if the current library is adequate for your needs or if it has to
be upgraded.
</P><P>
When your program includes <CODE>mikmod.h</CODE>, the following constants are
defined:
<UL>
<LI><CODE>LIBMIKMOD_VERSION_MAJOR</CODE> is equal to the major version number of
the library.
<LI><CODE>LIBMIKMOD_VERSION_MINOR</CODE> is equal to the minor version number of
the library.
<LI><CODE>LIBMIKMOD_REVISION</CODE> is equal to the revision number of the library.
<LI><CODE>LIBMIKMOD_VERSION</CODE> is the sum of <CODE>LIBMIKMOD_VERSION_MAJOR</CODE> shifted 16 times, <CODE>LIBMIKMOD_VERSION_MINOR</CODE> shifted 8 times, and
<CODE>LIBMIKMOD_REVISION</CODE>.
</UL>
<P>
So your program can tell with which version of the library it has been compiled
this way:
<TABLE><tr><td>&nbsp;</td><td class=example><pre>printf("Compiled with MikMod Sound Library version %ld.%ld.%ld\n",
LIBMIKMOD_VERSION_MAJOR,
LIBMIKMOD_VERSION_MINOR,
LIBMIKMOD_REVISION);
</pre></td></tr></table></P><P>
The library defines the function <CODE>MikMod_GetVersion</CODE> which returns the
value of LIBMIKMOD_VERSION for the library. If this value is greater than or
equal to the value of LIBMIKMOD_VERSION for your program, your program will
work; otherwise, you'll have to inform the user that he has to upgrade the
library:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>{
long engineversion = MikMod_GetVersion();
if (engineversion &#60; LIBMIKMOD_VERSION) {
printf("MikMod library version (%ld.%ld.%ld) is too old.\n",
(engineversion &#62;&#62; 16) &#38; 255,
(engineversion &#62;&#62; 8) &#38; 255,
(engineversion) &#38; 255);
printf("This programs requires at least version %ld.%ld.%ld\n",
LIBMIKMOD_VERSION_MAJOR,
LIBMIKMOD_VERSION_MINOR,
LIBMIKMOD_REVISION);
puts("Please upgrade your MikMod library.");
exit(1);
}
}
</pre></td></tr></table></P><P>
<A NAME="Type Definitions"></A>
<HR SIZE="6">
<A NAME="SEC10"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC9"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC11"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.2 Type Definitions </H2>
<!--docid::SEC10::-->
<P>
MikMod defines several data types to deal with modules and sample data.
These types have the same memory size on every platform MikMod has been ported
to.
</P><P>
These types are:
<UL>
<LI><CODE>CHAR</CODE> is a printable character. For now it is the same as the
<CODE>char</CODE> type, but in the future it may be wide char (Unicode) on some
platforms.
<LI><CODE>SBYTE</CODE> is a signed 8 bit number (can range from -128 to 127).
<LI><CODE>UBYTE</CODE> is an unsigned 8 bit number (can range from 0 to 255).
<LI><CODE>SWORD</CODE> is a signed 16 bit number (can range from -32768 to 32767).
<LI><CODE>UWORD</CODE> is an unsigned 16 bit number (can range from 0 to 65535).
<LI><CODE>SLONG</CODE> is a signed 32 bit number (can range from -2.147.483.648 to
2.147.483.647).
<LI><CODE>ULONG</CODE> is an unsigned 32 bit number (can range from 0 to
4.294.967.296).
<LI><CODE>BOOL</CODE> is a boolean value. A value of 0 means false, any other value
means true.
</UL>
<P>
<A NAME="Error Handling"></A>
<HR SIZE="6">
<A NAME="SEC11"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC10"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC12"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.3 Error Handling </H2>
<!--docid::SEC11::-->
<P>
Although MikMod does its best to do its work, there are times where it can't.
For example, if you're trying to play a corrupted file, well, it can't.
</P><P>
A lot of MikMod functions return pointers or <CODE>BOOL</CODE> values. If the pointer
is <CODE>NULL</CODE> or the <CODE>BOOL</CODE> is 0 (false), an error has occurred.
</P><P>
MikMod errors are returned in the variable <CODE>MikMod_errno</CODE>. Each possible
error has a symbolic error code, beginning with <CODE>MMERR_</CODE>. For example, if
MikMod can't open a file, <CODE>MikMod_errno</CODE> will receive the value
<CODE>MMERR_OPENING_FILE</CODE>.
</P><P>
You can get an appropriate error message to display from the function
<CODE>MikMod_strerror</CODE>.
</P><P>
There is a second error variable named <CODE>MikMod_critical</CODE>. As its name
suggests, it is only set if the error lets the library in an unstable state.
This variable can only be set by the functions <CODE>MikMod_Init</CODE>,
<CODE>MikMod_SetNumVoices</CODE> and <CODE>MikMod_EnableOutput</CODE>. If one of these
functions return an error and <CODE>MikMod_critical</CODE> is set, the library is left
in the uninitialized state (i.e. it was not initialized, or <CODE>MikMod_Exit</CODE>
was called).
</P><P>
If you prefer, you can use a callback function to get notified of errors. This
function must be prototyped as <CODE>void MyFunction(void)</CODE>. Then, call
<CODE>MikMod_RegisterHandler</CODE> with your function as argument to have it notified
when an error occurs. There can only be one callback function registered, but
<CODE>MikMod_RegisterHandler</CODE> will return you the previous handler, so you can
chain handlers if you want to.
</P><P>
<A NAME="Library Initialization"></A>
<HR SIZE="6">
<A NAME="SEC12"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC11"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC13"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.4 Library Initialization and Core Functions </H2>
<!--docid::SEC12::-->
<P>
To initialize the library, you must register some sound drivers first. You can
either register all the drivers embedded in the library for your platform with
<CODE>MikMod_RegisterAllDrivers</CODE>, or register only some of them with
<CODE>MikMod_RegisterDriver</CODE>. If you choose to register the drivers manually,
you must be careful in their order, since <CODE>MikMod_Init</CODE> will try them in
the order you registered them. The <CODE>MikMod_RegisterAllDrivers</CODE> function
registers the network drivers first (for playing sound over the network), then
the hardware drivers, then the disk writers, and in last resort, the nosound
driver. Registering the nosound driver first would not be a very good
idea<small>....</small>
</P><P>
You can get some printable information regarding the registered drivers with
<CODE>MikMod_InfoDriver</CODE>; don't forget to call <CODE>free</CODE> on the returned
string when you don't need it anymore.
</P><P>
After you've registered your drivers, you can initialize the sound playback
with <CODE>MikMod_Init</CODE>, passing specific information to the driver if
necessary. If you set the variable <CODE>md_device</CODE> to zero, which
is its default value, the driver will be autodetected, that is, the first driver
in the list that is available on the system will be used; otherwise only
the driver whose order in the list of the registered drivers is equal to
<CODE>md_device</CODE> will be tried. If your playback settings, in the variables
<CODE>md_mixfreq</CODE> and <CODE>md_mode</CODE>, are not supported by the device,
<CODE>MikMod_Init</CODE> will fail.
</P><P>
You can then choose the number of voices you need with
<CODE>MikMod_SetNumVoices</CODE>, and activate the playback with
<CODE>MikMod_EnableOutput</CODE>.
</P><P>
Don't forget to call <CODE>MikMod_Update</CODE> as often as possible to process the
sound mixing. If necessary, fork a dedicated process to do this, or if the
library is thread-safe on your system, use a dedicated thread.
</P><P>
If you want to change playback settings, most of them can't be changed on the
fly. You'll need to stop the playback and reinitialize the driver. Use
<CODE>MikMod_Active</CODE> to check if there is still sound playing; in this case,
call <CODE>MikMod_DisableOutput</CODE> to end playback. Then, change your settings
and call <CODE>MikMod_Reset</CODE>. You're now ready to select your number of voices
and restart playback.
</P><P>
When your program ends, don't forget to stop playback and call
<CODE>MikMod_Exit</CODE> to leave the sound hardware in a coherent state.
</P><P>
On systems that have pthreads, libmikmod is thread-safe<A NAME="DOCF2" HREF="mikmod.html#FOOT2">(2)</A>. You can check this in your programs with the
<CODE>MikMod_InitThreads</CODE> function. If this function returns 1, the library is
thread-safe.
</P><P>
The main benefit of thread-safety is that <CODE>MikMod_Update</CODE> can be called
from a separate thread, which often makes application design easier. However,
several libmikmod global variables are accessible from all your threads, so
when more than one thread need to access libmikmod variables, you'll have to
protect these access with the <CODE>MikMod_Lock</CODE> and <CODE>MikMod_Unlock</CODE>
functions. If libmikmod is not thread-safe, these functions are no-ops.
</P><P>
<A NAME="Samples and Voice Control"></A>
<HR SIZE="6">
<A NAME="SEC13"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC12"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC14"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.5 Samples and Voice Control </H2>
<!--docid::SEC13::-->
<P>
Currently, MikMod only supports uncompressed mono WAV files as samples. You can
load a sample by calling <CODE>Sample_Load</CODE> with a filename, or by calling
<CODE>Sample_LoadFP</CODE> with an open <CODE>FILE*</CODE> pointer. These functions return
a pointer to a <CODE>SAMPLE</CODE> structure, or <CODE>NULL</CODE> in case of error.
</P><P>
The <CODE>SAMPLE</CODE> structure has a few interesting fields:
<UL>
<LI><CODE>speed</CODE> contains the default frequency of the sample.
<LI><CODE>volume</CODE> contains the default volume of the sample, ranging from 0 (silence)
to 64.
<LI><CODE>panning</CODE> contains the default panning position of the sample.
</UL>
<P>
Altering one of those fields will affect all voices currently playing the
sample. You can achieve the same result on a single voice with the functions
<CODE>Voice_SetFrequency</CODE>, <CODE>Voice_SetVolume</CODE> and <CODE>Voice_SetPanning</CODE>.
Since the same sample can be played with different frequency, volume and panning
parameters on each voice, you can get voice specific information with
<CODE>Voice_GetFrequency</CODE>, <CODE>Voice_GetVolume</CODE> and <CODE>Voice_GetPanning</CODE>.
</P><P>
You can also make your sample loop by setting the fields <CODE>loopstart</CODE> and
<CODE>loopend</CODE> and or'ing <CODE>flags</CODE> with <CODE>SF_LOOP</CODE>. To compute your loop
values, the field <CODE>length</CODE> will be useful. However, you must know that
all the sample length are expressed in samples, i.e. 8 bits for an 8 bit sample,
and 16 bit for a 16 bit sample<small>...</small> Test <CODE>flags</CODE> for the value
<CODE>SF_16BITS</CODE> to know this.
</P><P>
Speaking of flags, if you're curious and want to know the original format of the
sample on disk (since libmikmod does some work on the sample data internally),
refer to the <CODE>inflags</CODE> field.
</P><P>
If the common forward loop isn't enough, you can play with some other flags:
<CODE>SF_BIDI</CODE> will make your sample loop "ping pong" (back and forth), and
<CODE>SF_REVERSE</CODE> will make it play backwards.
</P><P>
To play your sample, use the <CODE>Sample_Play</CODE> function. This function
will return a voice number which enable you to use the <CODE>Voice_xx</CODE>
functions.
</P><P>
The sample will play until another sample takes over its voice (when you play
more samples than you reserved sound effect voices), unless it has been flagged
as <CODE>SFX_CRITICAL</CODE>. You can force it to stop with <CODE>Voice_Stop</CODE>, or you
can force another sample to take over this voice with <CODE>Voice_Play</CODE>;
however <CODE>Voice_Play</CODE> doesn't let you flag the new sample as critical.
</P><P>
Non looping samples will free their voice channel as soon as they are finished;
you can know the current playback position of your sample with
<CODE>Voice_GetPosition</CODE>. If it is zero, either the sample has finished playing
or it is just beginning; use <CODE>Voice_Stopped</CODE> to know.
</P><P>
When you don't need a sample anymore, don't forget to free its memory with
<CODE>Sample_Free</CODE>.
</P><P>
<A NAME="Modules and Player Control"></A>
<HR SIZE="6">
<A NAME="SEC14"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC13"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC15"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.6 Modules and Player Control </H2>
<!--docid::SEC14::-->
<P>
As for the sound drivers, you have to register the module loaders you want to
use for MikMod to be able to load modules. You can either register all the
module loaders with <CODE>MikMod_RegisterAllLoaders</CODE>, or only a few of them with
<CODE>MikMod_RegisterLoader</CODE>. Be careful if you choose this solution, as the
15 instrument MOD loader has to be registered last, since loaders are called in
the order they were register to identify modules, and the detection of this
format is not fully reliable, so other modules might be mistaken as 15
instrument MOD files.
</P><P>
You can get some printable information regarding the registered loaders with
<CODE>MikMod_InfoLoader</CODE>; don't forget to call <CODE>free</CODE> on the returned
string when you don't need it anymore.
</P><P>
Note that, contrary to the sound drivers, you can register module loaders at
any time, it doesn't matter.
</P><P>
For playlists, you might be interested in knowing the module title first, and
<CODE>Player_LoadTitle</CODE> will give you this information. Don't forget to
<CODE>free</CODE> the returned text when you don't need it anymore.
</P><P>
You can load a module either with <CODE>Player_Load</CODE> and the name of the
module, or with <CODE>Player_LoadFP</CODE> and an open <CODE>FILE*</CODE> pointer. These
functions also expect a maximal number of voices, and a curiosity flag. Unless
you have excellent reasons not to do so, choose a big limit, such as 64 or even
128 for complex Impulse Tracker modules. Both functions return a pointer to an
<CODE>MODULE</CODE> structure, or <CODE>NULL</CODE> if an error occurs.
</P><P>
You'll find some useful information in this structure:
<UL>
<LI><CODE>numchn</CODE> contains the number of module "real" channels.
<LI><CODE>numvoices</CODE> contains the number of voices reserved by the player for
the real channels and the virtual channels (NNA).
<LI><CODE>numpas</CODE> and <CODE>numpat</CODE> contain the number of song positions and
song patterns.
<LI><CODE>numins</CODE> and <CODE>numsmp</CODE> contain the number of instruments and
samples.
<LI><CODE>songname</CODE> contains the song title.
<LI><CODE>modtype</CODE> contains the name of the tracker used to create the song.
<LI><CODE>comment</CODE> contains the song comment, if it has one.
<LI><CODE>sngtime</CODE> contains the time elapsed in the module, in
<EM>2^-10</EM> seconds (not exactly a millisecond).
<LI><CODE>sngspd</CODE> and <CODE>bpm</CODE> contain the song speed and tempo.
<LI><CODE>realchn</CODE> contains the actual number of active channels.
<LI><CODE>totalchn</CODE> contains the actual number of active virtual channels,
i.e. the sum of <CODE>realchn</CODE> and the number of NNA virtual channels.
</UL>
<P>
Now that the module is loaded, you need to tell the module player that you want
to play this particular module with <CODE>Player_Start</CODE> (the player can only
play one module, but you can have several modules in memory). The playback
begins. Should you forget which module is playing, <CODE>Player_GetModule</CODE> will
return it to you.
</P><P>
You can change the current song position with the functions
<CODE>Player_NextPosition</CODE>, <CODE>Player_PrevPosition</CODE> and
<CODE>Player_SetPosition</CODE>, the speed with <CODE>Player_SetSpeed</CODE> and
<CODE>Player_SetTempo</CODE>, and the volume (ranging from 0 to 128) with
<CODE>Player_SetVolume</CODE>.
</P><P>
Playback can be paused or resumed with <CODE>Player_TogglePause</CODE>. Be sure to
check with <CODE>Player_Paused</CODE> that it isn't already in the state you want !
</P><P>
Fine player control is achieved by the functions <CODE>Player_Mute</CODE>,
<CODE>Player_UnMute</CODE> and <CODE>Player_ToggleMute</CODE> which can silence or resume
a set of module channels. The function <CODE>Player_Muted</CODE> will return the
state of a given channel. And if you want even more control, you can get the
voice corresponding to a module channel with <CODE>Player_GetChannelVoice</CODE> and
act directly on the voice.
</P><P>
Modules play only once, but can loop indefinitely if they are designed to do so.
You can change this behavior with the <CODE>wrap</CODE> and <CODE>loop</CODE> of the
<CODE>MODULE</CODE> structure; the first one, if set, will make the module restart
when it's finished, and the second one, if set, will prevent the module from
jumping backwards.
</P><P>
You can test if the module is still playing with <CODE>Player_Active</CODE>, and you
can stop it at any time with <CODE>Player_Stop</CODE>. When the module isn't needed
anymore, get rid of it with <CODE>Player_Free</CODE>.
</P><P>
<A NAME="Loading Data from Memory"></A>
<HR SIZE="6">
<A NAME="SEC15"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC14"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.7 Loading Data from Memory </H2>
<!--docid::SEC15::-->
<P>
If you need to load modules or sound effects from other places than plain
files, you can use the <CODE>MREADER</CODE> and <CODE>MWRITER</CODE> objects to achieve
this.
</P><P>
The <CODE>MREADER</CODE> and <CODE>MWRITER</CODE> structures contain a list of function
pointers, which emulate the behaviour of a regular <CODE>FILE *</CODE> object. In
fact, all functions which take filenames or <CODE>FILE *</CODE> as arguments are only
wrappers to a real function which takes an <CODE>MREADER</CODE> or an <CODE>MWRITER</CODE>
argument.
</P><P>
So, if you need to load a module from memory, or for a multi-file archive, for
example, all you need is to build an adequate <CODE>MREADER</CODE> object, and use
<CODE>Player_LoadGeneric</CODE> instead of <CODE>Player_Load</CODE> or
<CODE>Player_LoadFP</CODE>. For samples, use <CODE>Sample_LoadGeneric</CODE> instead of
<CODE>Sample_Load</CODE> or <CODE>Sample_LoadFP</CODE>.
</P><P>
<A NAME="Library Reference"></A>
<HR SIZE="6">
<A NAME="SEC16"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC15"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC17"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC8"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 4. Library Reference </H1>
<!--docid::SEC16::-->
<P>
This chapter describes in more detail all the functions and variables provided
by the library. See section <A HREF="mikmod.html#SEC10">3.2 Type Definitions</A>, for the basic type reference.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC17">4.1 Variable Reference</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC21">4.2 Structure Reference</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC30">4.3 Error Reference</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC50">4.4 Function Reference</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC113">4.5 Loader Reference</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC116">4.6 Driver Reference</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Variable Reference"></A>
<HR SIZE="6">
<A NAME="SEC17"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC18"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.1 Variable Reference </H2>
<!--docid::SEC17::-->
<P>
<HR SIZE="6">
<A NAME="SEC18"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC17"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC19"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.1.1 Error Variables </H3>
<!--docid::SEC18::-->
The following variables are set by the library to return error information.
<P>
<DL COMPACT>
<A NAME="IDX1"></A>
<DT><CODE>int MikMod_errno</CODE>
<DD>When an error occurs, this variable contains the error code.
See section <A HREF="mikmod.html#SEC30">4.3 Error Reference</A>, for more information.
<A NAME="IDX2"></A>
<DT><CODE>BOOL MikMod_critical</CODE>
<DD>When an error occurs, this variable informs of the severity of the error. Its
value has sense only if the value of <CODE>MikMod_errno</CODE> is different from zero.
If the value of <CODE>MikMod_critical</CODE> is zero, the error wasn't fatal and the
library is in a stable state. However, if it is nonzero, then the library can't
be used and has reseted itself to the uninitialized state. This often means
that the mixing parameters you choose were not supported by the driver, or that
it doesn't has enough voices for your needs if you called
<CODE>MikMod_SetNumVoices</CODE>.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC19"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC18"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC20"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC20"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.1.2 Sound Settings </H3>
<!--docid::SEC19::-->
The following variables control the sound output parameters and their changes
take effect immediately.
<P>
<DL COMPACT>
<A NAME="IDX3"></A>
<DT><CODE>UBYTE md_musicvolume</CODE>
<DD>Volume of the module. Allowed values range from
0 to 128. The default value is 128.
<A NAME="IDX4"></A>
<DT><CODE>UBYTE md_pansep</CODE>
<DD>Stereo channels separation. Allowed values range
from 0 (no separation, thus mono sound) to 128 (full channel separation). The
default value is 128.
<A NAME="IDX5"></A>
<DT><CODE>UBYTE md_reverb</CODE>
<DD>Amount of sound reverberation. Allowed values range
from 0 (no reverberation) to 15 (a rough estimate for chaos<small>...</small>). The
default value is 0.
<A NAME="IDX6"></A>
<DT><CODE>UBYTE md_sndfxvolume</CODE>
<DD>Volume of the sound effects. Allowed values range
from 0 to 128. The default value is 128.
<A NAME="IDX7"></A>
<DT><CODE>UBYTE md_volume</CODE>
<DD>Overall sound volume. Allowed values range from 0
to 128. The default value is 128.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC20"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC19"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC21"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.1.3 Driver Settings </H3>
<!--docid::SEC20::-->
The following variables control more in-depth sound output parameters. Except
for some <CODE>md_mode</CODE> flags, their changes do not have any effect until you
call <CODE>MikMod_Init</CODE> or <CODE>MikMod_Reset</CODE>.
<P>
<DL COMPACT>
<A NAME="IDX8"></A>
<DT><CODE>UWORD md_device</CODE>
<DD>This variable contains the order, in the list of the registered drivers, of the
sound driver which will be used for sound playback. This order is one-based; if
this variable is set to zero, the driver is autodetected, which means the list
is tested until a driver is present on the system. The default value is 0, thus
driver is autodetected.
<A NAME="IDX9"></A>
<DT><CODE>MDRIVER* md_driver</CODE>
<DD>This variable points to the driver which is being used for sound playback, and
is undefined when the library is uninitialized (before <CODE>MikMod_Init</CODE> and
after <CODE>MikMod_Exit</CODE>). This variable is for information only, you should
never attempt to change its value. Use <CODE>md_driver</CODE> and <CODE>MikMod_Init</CODE>
(or <CODE>MikMod_Reset</CODE>) instead.
<A NAME="IDX10"></A>
<DT><CODE>UWORD md_mixfreq</CODE>
<DD>Sound playback frequency, in hertz. High values
yield high sound quality, but need more computing power than lower values. The
default value is 44100 Hz, which is compact disc quality. Other common values
are 22100 Hz (radio quality), 11025 Hz (phone quality), and 8000 Hz (mu-law
quality).
<A NAME="IDX11"></A>
<DT><CODE>UWORD md_mode</CODE>
<DD>This variable is a combination of several flags, to select which output mode
to select.
The following flags have a direct action to the sound output (i.e. changes take
effect immediately):
<DL COMPACT>
<DT><SAMP>`DMODE_INTERP'</SAMP>
<DD>This flag, if set, enables the interpolated mixers. Interpolated mixing gives
better sound but takes a bit more time than standard mixing. If the library
is built with the high quality mixer, interpolated mixing is always enabled,
regardless of this flag.
<DT><SAMP>`DMODE_REVERSE'</SAMP>
<DD>This flag, if set, exchanges the left and right stereo channels.
<DT><SAMP>`DMODE_SURROUND'</SAMP>
<DD>This flag, if set, enables the surround mixers. Since surround mixing works
only for stereo sound, this flag has no effect if the sound playback is in
mono.
</DL>
<P>
<BR>The following flags aren't taken in account until the sound driver is changed
or reset:
<DL COMPACT>
<DT><SAMP>`DMODE_16BIT'</SAMP>
<DD>This flag, if set, selects 16 bit sound mode. This mode yields better sound
quality, but needs twice more mixing time.
<DT><SAMP>`DMODE_HQMIXER'</SAMP>
<DD>This flag, if set, selects the high-quality software mixer. This mode yields
better sound quality, but needs more mixing time. Of course, this flag has no
effect if no <CODE>DMODE_SOFT_xx</CODE> flag is set.
<DT><SAMP>`DMODE_SOFT_MUSIC'</SAMP>
<DD>This flag, if set, selects software mixing of the module.
<DT><SAMP>`DMODE_SOFT_SNDFX'</SAMP>
<DD>This flag, if set, selects software mixing of the sound effects.
<DT><SAMP>`DMODE_STEREO'</SAMP>
<DD>This flag, if set, selects stereo sound.
</DL>
<P>
<BR>The default value of this variable is <SAMP>`DMODE_STEREO | DMODE_SURROUND |
DMODE_16BITS | DMODE_SOFT_MUSIC | DMODE_SOFT_SNDFX'</SAMP>.
</DL>
<P>
<A NAME="Structure Reference"></A>
<HR SIZE="6">
<A NAME="SEC21"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC20"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC22"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC17"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC30"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.2 Structure Reference </H2>
<!--docid::SEC21::-->
<P>
Only the useful fields are described here; if a structure field is not
described, you must assume that it's an internal field which must not be
modified.
</P><P>
<HR SIZE="6">
<A NAME="SEC22"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC21"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC23"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.2.1 Drivers </H3>
<!--docid::SEC22::-->
<P>
The <CODE>MDRIVER</CODE> structure is not meant to be used by anything else than the
core of the library, but its first four fields contain useful information for
your programs:
<DL COMPACT>
<DT><CODE>CHAR* Name</CODE>
<DD>Name of the driver, usually never more than 20 characters.
<DT><CODE>CHAR* Description</CODE>
<DD>Description of the driver, usually never more than 50 characters.
<DT><CODE>UBYTE HardVoiceLimit</CODE>
<DD>Maximum number of hardware voices for this driver, 0 if the driver has no
hardware mixing support.
<DT><CODE>UBYTE SoftVoiceLimit</CODE>
<DD>Maximum number of software voices for this driver, 0 if the driver has no
software mixing support.
<DT><CODE>CHAR* Alias</CODE>
<DD>A short name for the driver, without spaces, usually never more than 10
characters.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC23"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC22"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC24"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC26"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC26"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.2.2 Modules </H3>
<!--docid::SEC23::-->
<P>
The <CODE>MODULE</CODE> structure gathers all the necessary information needed to
play a module file, regardless of its initial format.
</P><P>
<HR SIZE="6">
<A NAME="SEC24"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC23"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC25"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.2.2.1 General Module Information </H4>
<!--docid::SEC24::-->
<P>
The fields described in this section contain general information about the
module and should not be modified.
</P><P>
<DL COMPACT>
<DT><CODE>CHAR* songname</CODE>
<DD>Name of the module.
<DT><CODE>CHAR* modtype</CODE>
<DD>Type of the module (which tracker format).
<DT><CODE>CHAR* comment</CODE>
<DD>Either the module comments, or NULL if the module doesn't have comments.
</DL>
<P>
<DL COMPACT>
<DT><CODE>UWORD flags</CODE>
<DD>Several module flags or'ed together.
<DL COMPACT>
<DT><SAMP>`UF_ARPMEM'</SAMP>
<DD>If set, arpeggio effects have memory.
<DT><SAMP>`UF_BGSLIDES'</SAMP>
<DD>If set, volume slide effects continue until a new note or a new effect is played.
<DT><SAMP>`UF_HIGHBPM'</SAMP>
<DD>If set, the module is allowed to have its tempo value (bpm) over 255.
<DT><SAMP>`UF_INST'</SAMP>
<DD>If set, the module has instruments and samples; otherwise, the
module has only samples.
<DT><SAMP>`UF_LINEAR'</SAMP>
<DD>If set, slide periods are linear; otherwise, they are logarithmic.
<DT><SAMP>`UF_NNA'</SAMP>
<DD>If set, module uses new note actions (NNA) and the <CODE>numvoices</CODE> field is
valid.
<DT><SAMP>`UF_NOWRAP'</SAMP>
<DD>If set, pattern break on the last pattern does not continue to the first
pattern.
<DT><SAMP>`UF_S3MSLIDES'</SAMP>
<DD>If set, module uses old-S3M style volume slides (slides processed every tick);
otherwise, it uses the standard style (slides processed every tick except the
first).
<DT><SAMP>`UF_XMPERIODS'</SAMP>
<DD>If set, module uses XM-type periods; otherwise, it uses Amiga periods.
<DT><SAMP>`UF_FT2QUIRKS'</SAMP>
<DD>If set, module player will reproduce some FastTracker 2 quirks during playback.
<DT><SAMP>`UF_PANNING'</SAMP>
<DD>If set, module use panning commands.
</DL>
<DT><CODE>UBYTE numchn</CODE>
<DD>The number of channels in the module.
<DT><CODE>UBYTE numvoices</CODE>
<DD>If the module uses NNA, and this variable is not zero, it contains the limit
of module voices; otherwise, the limit is set to the <CODE>maxchan</CODE> parameter
of the <CODE>Player_Loadxx</CODE> functions.
<DT><CODE>UWORD numpos</CODE>
<DD>The number of sound positions in the module.
<DT><CODE>UWORD numpat</CODE>
<DD>The number of patterns.
<DT><CODE>UWORD numins</CODE>
<DD>The number of instruments.
<DT><CODE>UWORD numsmp</CODE>
<DD>The number of samples.
</DL>
<P>
<DL COMPACT>
<DT><CODE>INSTRUMENT* instruments</CODE>
<DD>Points to an array of instrument structures.
<DT><CODE>SAMPLE* samples</CODE>
<DD>Points to an array of sample structures.
</DL>
<P>
<DL COMPACT>
<DT><CODE>UBYTE realchn</CODE>
<DD>During playback, this variable contains the number of active channels (not
counting NNA channels).
<DT><CODE>UBYTE totalchn</CODE>
<DD>During playback, this variable contains the total number of channels (including
NNA channels).
<DT><CODE>ULONG sngtime</CODE>
<DD>Elapsed song time, in <EM>2^-10</EM> seconds units (not exactly a
millisecond). To convert this value to seconds, divide by 1024, not 1000 !
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC25"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC24"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC26"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.2.2.2 Playback Settings </H4>
<!--docid::SEC25::-->
<P>
The fields described here control the module playback and can be modified at
any time, unless otherwise specified.
</P><P>
<DL COMPACT>
<DT><CODE>UBYTE initspeed</CODE>
<DD>The initial speed of the module (Protracker compatible). Valid range is 1-32.
<DT><CODE>UBYTE inittempo</CODE>
<DD>The initial tempo of the module (Protracker compatible). Valid range is
32-255.
<DT><CODE>UBYTE initvolume</CODE>
<DD>The initial overall volume of the module. Valid range is 0-128.
<DT><CODE>UWORD panning[]</CODE>
<DD>The current channel panning positions. Only the first <CODE>numchn</CODE> values are
defined.
<DT><CODE>UBYTE chanvol[]</CODE>
<DD>The current channel volumes. Only the first <CODE>numchn</CODE> values are defined.
<DT><CODE>UWORD bpm</CODE>
<DD>The current tempo of the module. Use <CODE>Player_SetTempo</CODE> to change its value.
<DT><CODE>UBYTE sngspd</CODE>
<DD>The current speed of the module. Use <CODE>Player_SetSpeed</CODE> to change its value.
<DT><CODE>UBYTE volume</CODE>
<DD>The current overall volume of the module, in range 0-128. Use
<CODE>Player_SetVolume</CODE> to change its value.
</DL>
<P>
<DL COMPACT>
<DT><CODE>BOOL extspd</CODE>
<DD>If zero, Protracker extended speed effect (in-module tempo modification) is
not processed. The default value is 1, which causes this effect to be processed.
However, some old modules might not play correctly if this effect is not
neutralized.
<DT><CODE>BOOL panflag</CODE>
<DD>If zero, panning effects are not processed. The default value is 1, which cause
all panning effects to be processed. However, some old modules might not play
correctly if panning is not neutralized.
<DT><CODE>BOOL wrap</CODE>
<DD>If nonzero, module wraps to its restart position when it is finished, to
play continuously. Default value is zero (play only once).
<DT><CODE>UBYTE reppos</CODE>
<DD>The restart position of the module, when it wraps.
<DT><CODE>BOOL loop</CODE>
<DD>If nonzero, all in-module loops are processed; otherwise, backward loops which
decrease the current position are not processed (i.e. only forward loops, and
backward loops in the same pattern, are processed). This ensures that the module
never loops endlessly. The default value is 1 (all loops are processed).
<DT><CODE>BOOL fadeout</CODE>
<DD>If nonzero, volume fades out during when last position of the module is being
played. Default value us zero (no fadeout).
</DL>
<P>
<DL COMPACT>
<DT><CODE>UWORD patpos</CODE>
<DD>Current position (row) in the pattern being played. Must not be changed.
<DT><CODE>SWORD sngpos</CODE>
<DD>Current song position. Do not change this variable directly, use
<CODE>Player_NextPosition</CODE>, <CODE>Player_PrevPosition</CODE> or
<CODE>Player_SetPosition</CODE> instead.
</DL>
<P>
<DL COMPACT>
<DT><CODE>SWORD relspd</CODE>
<DD>Relative playback speed. The value of this variable is added to the module
tempo to define the actual playback speed. The default value is 0, which make
modules play at their intended speed.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC26"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC25"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC27"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC27"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.2.3 Module Instruments </H3>
<!--docid::SEC26::-->
<P>
Although the <CODE>INSTRUMENT</CODE> structure is intended for internal use, you
might need to know its name:
</P><P>
<DL COMPACT>
<DT><CODE>CHAR* insname</CODE>
<DD>The instrument text, theoretically its name, but often a message line.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC27"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC26"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC28"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC28"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.2.4 Samples </H3>
<!--docid::SEC27::-->
<P>
The <CODE>SAMPLE</CODE> structure is used for sound effects and module samples as
well. You can play with the following fields:
</P><P>
<DL COMPACT>
<DT><CODE>SWORD panning</CODE>
<DD>Panning value of the sample. Valid values range from PAN_LEFT (0) to
PAN_RIGHT (255), or PAN_SURROUND.
<DT><CODE>ULONG speed</CODE>
<DD>Playing frequency of the sample, it hertz.
<DT><CODE>UBYTE volume</CODE>
<DD>Sample volume. Valid range is 0-64.
<DT><CODE>UWORD flags</CODE>
<DD>Several format flags or'ed together describing the format of the sample in
memory.
<P>
Format flags:
<DL COMPACT>
<DT><SAMP>`SF_16BITS'</SAMP>
<DD>If set, sample data is 16 bit wide; otherwise, it is 8 bit wide.
<DT><SAMP>`SF_BIG_ENDIAN'</SAMP>
<DD>If set, sample data is in big--endian (Motorola) format; otherwise, it is in
little--endian (Intel) format.
<DT><SAMP>`SF_DELTA'</SAMP>
<DD>If set, sample is stored as delta values (differences between two consecutive
samples); otherwise, sample is stored as sample values.
<DT><SAMP>`SF_ITPACKED'</SAMP>
<DD>If set, sample data is packed with Impulse Tracker's compression method;
otherwise, sample is not packed.
<DT><SAMP>`SF_SIGNED'</SAMP>
<DD>If set, sample data is made of signed values; otherwise, it is made of
unsigned values.
<DT><SAMP>`SF_STEREO'</SAMP>
<DD>If set, sample data is stereo (two channels); otherwise, it is mono.
</DL>
<P>
<BR>Playback flags:
<DL COMPACT>
<DT><SAMP>`SF_BIDI'</SAMP>
<DD>If set, sample loops "ping pong" (back and forth).
<DT><SAMP>`SF_LOOP'</SAMP>
<DD>If set, sample loops forward.
<DT><SAMP>`SF_REVERSE'</SAMP>
<DD>If set, sample plays backwards.
</DL>
<DT><CODE>UWORD inflags</CODE>
<DD>Same as "flags", but describing the format of the sample on disk.
<DT><CODE>ULONG length</CODE>
<DD>Length of the sample, in <EM>samples</EM>. The length of a sample is 8 bits
(1 byte) for a 8 bit sample, and 16 bits (2 bytes) for a 16 bit sample.
<DT><CODE>ULONG loopstart</CODE>
<DD>Loop starting position, relative to the start of the sample, in samples.
<DT><CODE>ULONG loopend</CODE>
<DD>Loop ending position, relative to the start of the sample, in samples.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC28"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC27"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC29"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC29"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.2.5 MREADER </H3>
<!--docid::SEC28::-->
<P>
The <CODE>MREADER</CODE> contains the following function pointers:
</P><P>
<DL COMPACT>
<DT><CODE>BOOL (*Seek)(struct MREADER*, long offset, int whence)</CODE>
<DD>This function should have the same behaviour as <CODE>fseek</CODE>, with offset 0
meaning the start of the object (module, sample) being loaded.
<DT><CODE>long (*Tell)(struct MREADER*)</CODE>
<DD>This function should have the same behaviour as <CODE>ftell</CODE>, with offset 0
meaning the start of the object being loaded.
<DT><CODE>BOOL (*Read)(struct MREADER*, void *dest, size_t length)</CODE>
<DD>This function should copy <CODE>length</CODE> bytes of data into <CODE>dest</CODE>, and
return zero if an error occured, and any nonzero value otherwise. Note that an
end-of-file condition will not be considered as an error in this case.
<DT><CODE>int (*Get)(struct MREADER*)</CODE>
<DD>This function should have the same behaviour as <CODE>fgetc</CODE>.
<DT><CODE>BOOL (*Eof)(struct MREADER*)</CODE>
<DD>This function should have the same behaviour as <CODE>feof</CODE>.
</DL>
<P>
For an example of how to build an <CODE>MREADER</CODE> object, please refer to the
<CODE>MFILEREADER</CODE> object in file <CODE>mmio/mmio.c</CODE> in the library sources.
</P><P>
<HR SIZE="6">
<A NAME="SEC29"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC28"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC30"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.2.6 MWRITER </H3>
<!--docid::SEC29::-->
<P>
The <CODE>MREADER</CODE> contains the following function pointers:
</P><P>
<DL COMPACT>
<DT><CODE>BOOL (*Seek)(struct MWRITER*, long offset, int whence);</CODE>
<DD>This function should have the same behaviour as <CODE>fseek</CODE>, with offset 0
meaning the start of the object being written.
<DT><CODE>long (*Tell)(struct MWRITER*);</CODE>
<DD>This function should have the same behaviour as <CODE>ftell</CODE>, with offset 0
meaning the start of the object being written.
<DT><CODE>BOOL (*Write)(struct MWRITER*, void *dest, size_t length);</CODE>
<DD>This function should copy <CODE>length</CODE> bytes of data from <CODE>dest</CODE>, and
return zero if an error occured, and any nonzero value otherwise.
<DT><CODE>BOOL (*Put)(struct MWRITER*, int data);</CODE>
<DD>This function should have the same behaviour as <CODE>fputc</CODE>.
</DL>
<P>
For an example of how to build an <CODE>MWRITER</CODE> object, please refer to the
<CODE>MFILEWRITER</CODE> object in file <CODE>mmio/mmio.c</CODE> in the library sources.
</P><P>
<A NAME="Error Reference"></A>
<HR SIZE="6">
<A NAME="SEC30"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC29"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC31"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC21"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC50"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.3 Error Reference </H2>
<!--docid::SEC30::-->
<P>
The following errors are currently defined:
</P><P>
<HR SIZE="6">
<A NAME="SEC31"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC30"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC32"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.1 General Errors </H3>
<!--docid::SEC31::-->
<DL COMPACT>
<DT><SAMP>`MMERR_DYNAMIC_LINKING'</SAMP>
<DD>This error occurs when a specific driver was requested, but the support shared
library couldn't be loaded. Currently, the only drivers which can yield this
error are the ALSA, EsounD and Ultra drivers.
<DT><SAMP>`MMERR_OPENING_FILE'</SAMP>
<DD>This error occurs when a file can not be opened, either for read access from a
<CODE>xx_Loadxx</CODE> function, or for write access from the disk writer drivers.
<DT><SAMP>`MMERR_OUT_OF_MEMORY'</SAMP>
<DD>This error occurs when there is not enough virtual memory available to complete
the operation, or there is enough memory but the calling process would exceed
its memory limit. MikMod does not do any resource tuning, your program has to
use the <CODE>setrlimit</CODE> function to do this if it needs to load very huge
samples.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC32"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC31"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC33"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC33"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.2 Sample Errors </H3>
<!--docid::SEC32::-->
<DL COMPACT>
<DT><SAMP>`MMERR_SAMPLE_TOO_BIG'</SAMP>
<DD>This error occurs when the memory allocation of the sample data yields the
error <CODE>MMERR_OUT_OF_MEMORY</CODE>.
<DT><SAMP>`MMERR_OUT_OF_HANDLES'</SAMP>
<DD>This error occurs when your program reaches the limit of loaded samples,
currently defined as 384, which should be sufficient for most cases.
<DT><SAMP>`MMERR_UNKNOWN_WAVE_TYPE'</SAMP>
<DD>This error occurs when you're trying to load a sample which format is not
recognized.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC33"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC32"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC34"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC34"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.3 Module Errors </H3>
<!--docid::SEC33::-->
<DL COMPACT>
<DT><SAMP>`MMERR_ITPACK_INVALID_DATA'</SAMP>
<DD>This error occurs when a compressed module sample is corrupt.
<DT><SAMP>`MMERR_LOADING_HEADER'</SAMP>
<DD>This error occurs when you're trying to load a module which has a corrupted
header, or is truncated.
<DT><SAMP>`MMERR_LOADING_PATTERN'</SAMP>
<DD>This error occurs when you're trying to load a module which has corrupted
pattern data, or is truncated.
<DT><SAMP>`MMERR_LOADING_SAMPLEINFO'</SAMP>
<DD>This error occurs when you're trying to load a module which has corrupted
sample information, or is truncated.
<DT><SAMP>`MMERR_LOADING_TRACK'</SAMP>
<DD>This error occurs when you're trying to load a module which has corrupted
track data, or is truncated.
<DT><SAMP>`MMERR_MED_SYNTHSAMPLES'</SAMP>
<DD>This error occurs when you're trying to load a MED module which has synthsounds
samples, which are currently not supported.<A NAME="DOCF3" HREF="mikmod.html#FOOT3">(3)</A>
<DT><SAMP>`MMERR_NOT_A_MODULE'</SAMP>
<DD>This error occurs when you're trying to load a module which format is not
recognized.
<DT><SAMP>`MMERR_NOT_A_STREAM'</SAMP>
<DD>This error occurs when you're trying to load a sample with a sample which format
is not recognized.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC34"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC33"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC35"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC47"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC47"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.4 Driver Errors </H3>
<!--docid::SEC34::-->
<HR SIZE="6">
<A NAME="SEC35"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC34"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC36"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.1 Generic Driver Errors </H4>
<!--docid::SEC35::-->
<DL COMPACT>
<DT><SAMP>`MMERR_16BIT_ONLY'</SAMP>
<DD>This error occurs when the sound device doesn't support non-16 bit linear
sound output, which are the requested settings.
<DT><SAMP>`MMERR_8BIT_ONLY'</SAMP>
<DD>This error occurs when the sound device doesn't support non-8 bit linear
sound output, which are the requested settings.
<DT><SAMP>`MMERR_DETECTING_DEVICE'</SAMP>
<DD>This error occurs when the driver's sound device has not been detected.
<DT><SAMP>`MMERR_INITIALIZING_MIXER'</SAMP>
<DD>This error occurs when MikMod's internal software mixer could not be initialized
properly.
<DT><SAMP>`MMERR_INVALID_DEVICE'</SAMP>
<DD>This error occurs when the driver number (in <CODE>md_device</CODE>) is out of range.
<DT><SAMP>`MMERR_NON_BLOCK'</SAMP>
<DD>This error occurs when the driver is unable to set the audio device in non
blocking mode.
<DT><SAMP>`MMERR_OPENING_AUDIO'</SAMP>
<DD>This error occurs when the driver can not open sound device.
<DT><SAMP>`MMERR_STEREO_ONLY'</SAMP>
<DD>This error occurs when the sound device doesn't support mono sound output, which
is the requested setting.
<DT><SAMP>`MMERR_ULAW'</SAMP>
<DD>This error occurs when the sound device only supports uLaw output (which
implies mono, 8 bit, and 8000 Hz sampling rate), which isn't the requested
setting.
</DL>
<HR SIZE="6">
<A NAME="SEC36"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC35"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC37"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC37"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.2 AudioFile Driver Specific Error </H4>
<!--docid::SEC36::-->
<DL COMPACT>
<DT><SAMP>`MMERR_AF_AUDIO_PORT'</SAMP>
<DD>This error occurs when the AudioFile driver can not find a suitable AudioFile
port.
</DL>
<HR SIZE="6">
<A NAME="SEC37"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC36"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC38"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC38"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.3 AIX Driver Specific Errors </H4>
<!--docid::SEC37::-->
<DL COMPACT>
<DT><SAMP>`MMERR_AIX_CONFIG_CONTROL'</SAMP>
<DD>This error occurs when the "Control" step of the device configuration has
failed.
<DT><SAMP>`MMERR_AIX_CONFIG_INIT'</SAMP>
<DD>This error occurs when the "Init" step of the device configuration has failed.
<DT><SAMP>`MMERR_AIX_CONFIG_START'</SAMP>
<DD>This error occurs when the "Start" step of the device configuration has failed.
</DL>
<HR SIZE="6">
<A NAME="SEC38"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC37"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC39"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC39"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.4 Ultra Driver Specific Errors </H4>
<!--docid::SEC38::-->
<DL COMPACT>
<DT><SAMP>`MMERR_GUS_RESET'</SAMP>
<DD>This error occurs when the sound device couldn't be reset.
<DT><SAMP>`MMERR_GUS_SETTINGS'</SAMP>
<DD>This error occurs because the sound device only works in 16 bit linear stereo
sound at 44100 Hz, which is not the requested settings.
<DT><SAMP>`MMERR_GUS_TIMER'</SAMP>
<DD>This error occurs when the ultra driver could not setup the playback timer.
</DL>
<HR SIZE="6">
<A NAME="SEC39"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC38"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC40"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.5 HP-UX Driver Specific Errors </H4>
<!--docid::SEC39::-->
<DL COMPACT>
<DT><SAMP>`MMERR_HP_AUDIO_DESC'</SAMP>
<DD>This error occurs when the HP driver can not get the audio hardware description.
<DT><SAMP>`MMERR_HP_AUDIO_OUTPUT'</SAMP>
<DD>This error occurs when the HP driver can not select the audio output.
<DT><SAMP>`MMERR_HP_BUFFERSIZE'</SAMP>
<DD>This error occurs when the HP driver can not set the transmission buffer size.
<DT><SAMP>`MMERR_HP_CHANNELS'</SAMP>
<DD>This error occurs when the HP driver can not set the requested number of
channels.
<DT><SAMP>`MMERR_HP_SETSAMPLESIZE'</SAMP>
<DD>This error occurs when the HP driver can not set the requested sample size.
<DT><SAMP>`MMERR_HP_SETSPEED'</SAMP>
<DD>This error occurs when the HP driver can not set the requested sample rate.
</DL>
<HR SIZE="6">
<A NAME="SEC40"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC39"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC41"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC41"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.6 Open Sound System Driver Specific Errors </H4>
<!--docid::SEC40::-->
<DL COMPACT>
<DT><SAMP>`MMERR_OSS_SETFRAGMENT'</SAMP>
<DD>This error occurs when the OSS driver can not set audio fragment size.
<DT><SAMP>`MMERR_OSS_SETSAMPLESIZE'</SAMP>
<DD>This error occurs when the OSS driver can not set the requested sample size.
<DT><SAMP>`MMERR_OSS_SETSPEED'</SAMP>
<DD>This error occurs when the OSS driver can not set the requested sample rate.
<DT><SAMP>`MMERR_OSS_SETSTEREO'</SAMP>
<DD>This error occurs when the OSS driver can not set the requested number of
channels.
</DL>
<HR SIZE="6">
<A NAME="SEC41"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC40"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC42"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC42"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.7 SGI Driver Specific Errors </H4>
<!--docid::SEC41::-->
<DL COMPACT>
<DT><SAMP>`MMERR_SGI_MONO'</SAMP>
<DD>This error occurs when the hardware only supports stereo sound.
<DT><SAMP>`MMERR_SGI_SPEED'</SAMP>
<DD>This error occurs when the hardware does not support the requested sample rate.
<DT><SAMP>`MMERR_SGI_STEREO'</SAMP>
<DD>This error occurs when the hardware only supports mono sound.
<DT><SAMP>`MMERR_SGI_16BIT'</SAMP>
<DD>This error occurs when the hardware only supports 16 bit sound.
<DT><SAMP>`MMERR_SGI_8BIT'</SAMP>
<DD>This error occurs when the hardware only supports 8 bit sound.
</DL>
<HR SIZE="6">
<A NAME="SEC42"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC41"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC43"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC43"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.8 Sun Driver Specific Error </H4>
<!--docid::SEC42::-->
<DL COMPACT>
<DT><SAMP>`MMERR_SUN_INIT'</SAMP>
<DD>This error occurs when the sound device initialization failed.
</DL>
<HR SIZE="6">
<A NAME="SEC43"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC42"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC44"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.9 OS/2 Driver Specific Errors </H4>
<!--docid::SEC43::-->
<DL COMPACT>
<DT><SAMP>`MMERR_OS2_MIXSETUP'</SAMP>
<DD>This error occurs when the DART driver can not set the mixing parameters.
<DT><SAMP>`MMERR_OS2_SEMAPHORE'</SAMP>
<DD>This error occurs when the MMPM/2 driver can not create the semaphores needed
for playback.
<DT><SAMP>`MMERR_OS2_THREAD'</SAMP>
<DD>This error occurs when the MMPM/2 driver can not create the thread needed for
playback.
<DT><SAMP>`MMERR_OS2_TIMER'</SAMP>
<DD>This error occurs when the MMPM/2 driver can not create the timer needed for
playback.
</DL>
<HR SIZE="6">
<A NAME="SEC44"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC43"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC45"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC36"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.10 DirectX Driver Specific Errors </H4>
<!--docid::SEC44::-->
<DL COMPACT>
<DT><SAMP>`MMERR_DS_BUFFER'</SAMP>
<DD>This error occurs when the DirectX driver can not allocate the playback buffers.
<DT><SAMP>`MMERR_DS_EVENT'</SAMP>
<DD>This error occurs when the DirectX driver can not register the playback event.
<DT><SAMP>`MMERR_DS_FORMAT'</SAMP>
<DD>This error occurs when the DirectX driver can not set the playback format.
<DT><SAMP>`MMERR_DS_NOTIFY'</SAMP>
<DD>This error occurs when the DirectX driver can not register the playback
callback.
<DT><SAMP>`MMERR_DS_PRIORITY'</SAMP>
<DD>This error occurs when the DirectX driver can not set the playback priority.
<DT><SAMP>`MMERR_DS_THREAD'</SAMP>
<DD>This error occurs when the DirectX driver can not create the playback thread.
<DT><SAMP>`MMERR_DS_UPDATE'</SAMP>
<DD>This error occurs when the DirectX driver can not initialize the playback
thread.
</DL>
<HR SIZE="6">
<A NAME="SEC45"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC44"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC46"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC36"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.11 Windows Multimedia API Driver Specific Errors </H4>
<!--docid::SEC45::-->
<DL COMPACT>
<DT><SAMP>`MMERR_WINMM_ALLOCATED'</SAMP>
<DD>This error occurs when the playback resource is already allocated by another
application.
<DT><SAMP>`MMERR_WINMM_DEVICEID'</SAMP>
<DD>This error occurs when the Multimedia API Driver is given an invalid audio
device identificator.
<DT><SAMP>`MMERR_WINMM_FORMAT'</SAMP>
<DD>This error occurs when the playback output format is not supported by the audio
device.
<DT><SAMP>`MMERR_WINMM_HANDLE'</SAMP>
<DD>This error occurs when the Multimedia API Driver is given an invalid handle.
<DT><SAMP>`MMERR_WINMM_UNKNOWN'</SAMP>
<DD>This error should not occur ! If you get this error, please contact the
libmikmod development mailing list.
</DL>
<HR SIZE="6">
<A NAME="SEC46"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC45"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC47"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC36"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.3.4.12 MacOS Driver Specific Errors </H4>
<!--docid::SEC46::-->
<DL COMPACT>
<DT><SAMP>`MMERR_MAC_SPEED'</SAMP>
<DD>This error occurs when the playback speed is not supported by the audio device.
<DT><SAMP>`MMERR_MAC_START'</SAMP>
<DD>This error occurs when the MacOS driver can not start playback.
</DL>
<HR SIZE="6">
<A NAME="SEC47"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC46"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC48"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC48"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.5 MaxOS X Driver Specific Errors </H3>
<!--docid::SEC47::-->
<DL COMPACT>
<DT><SAMP>`MMERR_OSX_UNKNOWN_DEVICE'</SAMP>
<DD>This error occurs if the default audio output device is not an audio device! If
this happens, please contact the maintainer.
<DT><SAMP>`MMERR_OSX_BAD_PROPERTY'</SAMP>
<DD>This error occurs...
<DT><SAMP>`MMERR_OSX_UNSUPPORTED_FORMAT'</SAMP>
<DD>This error occurs when the detected audio device does not support
the required format (Linear PCM).
<DT><SAMP>`MMERR_OSX_SET_STEREO'</SAMP>
<DD>This error occurs...
<DT><SAMP>`MMERR_OSX_BUFFER_ALLOC'</SAMP>
<DD>This error occurs if the driver fails to allocate the audio buffers.
<DT><SAMP>`MMERR_OSX_ADD_IO_PROC'</SAMP>
<DD>This error occurs if the driver fails to add its Audio IO Proc.
<DT><SAMP>`MMERR_OSX_DEVICE_START'</SAMP>
<DD>This error occurs if the driver fails to start the audio IO Proc.
<DT><SAMP>`MMERR_OSX_PTHREAD'</SAMP>
<DD>This error occurs if the initialization of the mutex fails.
</DL>
<HR SIZE="6">
<A NAME="SEC48"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC47"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC49"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC49"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.6 Dos "Windows Sound System" Driver Specific Errors </H3>
<!--docid::SEC48::-->
<DL COMPACT>
<DT><SAMP>`MMERR_DOSWSS_STARTDMA'</SAMP>
<DD>This error occurs if the driver failed to start the cyclic DMA transfer.
</DL>
<HR SIZE="6">
<A NAME="SEC49"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC48"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC50"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.7 Dos "SoundBlaster" Driver Specific Errors </H3>
<!--docid::SEC49::-->
<DL COMPACT>
<DT><SAMP>`MMERR_DOSSB_STARTDMA'</SAMP>
<DD>This error occurs if the driver failed to start the cyclic DMA transfer.
</DL>
<P>
<A NAME="Function Reference"></A>
<HR SIZE="6">
<A NAME="SEC50"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC49"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC51"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC30"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC16"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.4 Function Reference </H2>
<!--docid::SEC50::-->
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC51">4.4.1 Library Core Functions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">MikMod_xx functions.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC73">4.4.2 Module Player Functions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Player_xx functions.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC96">4.4.3 Sample Functions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Sample_xx functions.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="mikmod.html#SEC101">4.4.4 Voice Functions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Voice_xx functions.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Library Core Functions"></A>
<HR SIZE="6">
<A NAME="SEC51"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC50"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC52"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC30"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC50"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC73"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.4.1 Library Core Functions </H3>
<!--docid::SEC51::-->
<P>
<HR SIZE="6">
<A NAME="SEC52"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC51"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC53"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC30"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC50"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.4.1.1 MikMod_Active </H4>
<!--docid::SEC52::-->
<CODE>BOOL MikMod_Active(void)</CODE>
<DL COMPACT>
<DT><I>Description</I>
<DD>This function returns whether sound output is enabled or not.
<DT><I>Result</I>
<DD><DT><I>0</I>
<DD>Sound output is disabled.
<DT><I>1</I>
<DD>Sound output is enabled.
<DT><I>Notes</I>
<DD>Calls to <CODE>MikMod_Update</CODE> will be ignored when sound output is disabled.
<DT><I>See also</I>
<DD><CODE>MikMod_DisableOutput</CODE>, <CODE>MikMod_EnableOutput</CODE>.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC53"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC52"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC54"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC54"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC50"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC121">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H4> 4.4.1.2 MikMod_DisableOutput </H4>
<!--docid::SEC53::-->
<CODE>void MikMod_DisableOutput(void)</CODE>
<DL COMPACT>
<DT><I>Description</I>
<DD>This function stops the sound mixing.
<DT><I>Notes</I>
<DD>Calls to <CODE>MikMod_Update</CODE> will be ignored when sound output is disabled.
<DT><I>See also</I>
<DD><CODE>MikMod_Active</CODE>, <CODE>MikMod_EnableOutput</CODE>.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC54"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC53"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC55"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC55"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC50"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="mikmod.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF=&quo