home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 February / PCO_0299.ISO / filesbbs / linux / mikmod-3.000 / mikmod-3 / mikmod-3.1.2 / docs / mikmod.info-1 < prev    next >
Encoding:
GNU Info File  |  1998-12-07  |  48.9 KB  |  1,415 lines

  1. This is Info file mikmod.info, produced by Makeinfo version 1.68 from
  2. the input file mikmod.texi.
  3.  
  4.    Copyright (C) 1998 Miodrag Vallat and others -- see file AUTHORS for
  5. complete list.
  6.  
  7.    This library is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU Library General Public License as
  9. published by the Free Software Foundation; either version 2 of the
  10. License, or (at your option) any later version.
  11.  
  12.    This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. Library General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU Library General Public
  18. License along with this library; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. INFO-DIR-SECTION Programming
  22. START-INFO-DIR-ENTRY
  23. * MikMod: (mikmod).            MikMod Sound Library.
  24. END-INFO-DIR-ENTRY
  25.  
  26. 
  27. File: mikmod.info,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
  28.  
  29. MikMod Sound Library
  30. ********************
  31.  
  32.  
  33. This manual documents the MikMod Sound Library, version 3.1.
  34.  
  35. * Menu:
  36.  
  37. * Introduction::          What is MikMod ?
  38. * Tutorial::              Your first steps with MikMod.
  39. * Using the Library::     A thematic presentation of the library.
  40. * Library Reference::     Detailed description of the functions and variables.
  41. * Index::
  42.  
  43. 
  44. File: mikmod.info,  Node: Introduction,  Next: Tutorial,  Prev: Top,  Up: Top
  45.  
  46. Introduction
  47. ************
  48.  
  49.    The MikMod sound library is an excellent way for a programmer to add
  50. music and sound effects to an application. It is a powerful and
  51. flexible library, with a simple and easy-to-learn API.
  52.  
  53.    Besides, the library is very portable and runs under a lot of
  54. Unices, as well as under OS/2. Third party individuals also maintain
  55. ports on other systems, including Windows (using DirectX), and BeOS.
  56.  
  57.    MikMod is able to play a wide range of module formats, as well as
  58. digital sound files. It can take advantage of particular features of
  59. your system, such as sound redirection over the network. And due to its
  60. modular nature, the library can be extended to support more sound or
  61. module formats, as well as new hardware or other sound output
  62. capabilities, as they appear.
  63.  
  64. 
  65. File: mikmod.info,  Node: Tutorial,  Next: Using the Library,  Prev: Introduction,  Up: Top
  66.  
  67. Tutorial
  68. ********
  69.  
  70.    This chapter will describe how to quickly incorporate MikMod's power
  71. into your programs. It doesn't cover everything, but that's a start and
  72. I hope it will help you understand the library's philosophy.
  73.  
  74.    If you have a real tutorial to put here, you're welcome ! Please
  75. send it to me....
  76.  
  77. * Menu:
  78.  
  79. * MikMod Concepts::         A few things you'll need to know.
  80. * A Skeleton Program::      The shortest MikMod program.
  81. * Playing Modules::         How to create a simple module player.
  82. * Playing Sound Effects::   How to play simple sound effects.
  83. * More Sound Effects::      How to play more complex sound effects.
  84.  
  85. 
  86. File: mikmod.info,  Node: MikMod Concepts,  Next: A Skeleton Program,  Prev: Tutorial,  Up: Tutorial
  87.  
  88. MikMod Concepts
  89. ===============
  90.  
  91.    MikMod's sound output is composed of several sound *voices* which are
  92. mixed, either in software or in hardware, depending of your hardware
  93. configuration. Simple sounds, like sound effects, use only one voice,
  94. whereas sound modules, which are complex arrangements of sound effects,
  95. use several voices.
  96.  
  97.    MikMod's functions operate either globally, or at the voice level.
  98. Differences in the handling of sound effects and modules are kept
  99. minimal, at least for the programmer.
  100.  
  101.    The sound playback is done by a *sound driver*. MikMod provides
  102. several sound drivers: different hardware drivers, and some software
  103. drivers to redirect sound in a file, or over the network. You can even
  104. add your own driver, register it to make it known by the library, and
  105. select it.
  106.  
  107. 
  108. File: mikmod.info,  Node: A Skeleton Program,  Next: Playing Modules,  Prev: MikMod Concepts,  Up: Tutorial
  109.  
  110. A Skeleton Program
  111. ==================
  112.  
  113.    To use MikMod in your program, there are a few steps required:
  114.  
  115.    * Include `mikmod.h' in your program.
  116.  
  117.    * Register the MikMod drivers you need.
  118.  
  119.    * Initialize the library with MikMod_Init() before using any other
  120.      MikMod function.
  121.  
  122.    * Give up resources with MikMod_Exit() at the end of your program,
  123.      or before when MikMod is not needed anymore.
  124.  
  125.    * Link your application with the MikMod sound library.
  126.  
  127.    Here's a program which meets all those conditions:
  128.  
  129.      /* MikMod Sound Library example program: a skeleton */
  130.      
  131.      #include <mikmod.h>
  132.      
  133.      main()
  134.      {
  135.          /* register all the drivers */
  136.          MikMod_RegisterAllDrivers();
  137.      
  138.          /* initialize the library */
  139.          MikMod_Init();
  140.      
  141.          /* we could play some sound here... */
  142.      
  143.          /* give up */
  144.          MikMod_Exit();
  145.      }
  146.  
  147.    This program would be compiled with the following command line:(1)
  148. `cc -o example example.c -lmikmod'
  149.  
  150.    Although this programs produces no useful result, many things happen
  151. when you run it. The call to `MikMod_RegisterAllDrivers' registers all
  152. the drivers embedded in the MikMod library. Then, `MikMod_Init' chooses
  153. the more adequate driver and initializes it. The program is now ready
  154. to produce sound.  When sound is not needed any more, `MikMod_Exit' is
  155. used to relinquish memory and let other programs have access to the
  156. sound hardware.
  157.  
  158.    ---------- Footnotes ----------
  159.  
  160.    (1) If MikMod library has been compiled with ALSA and/or EsounD
  161. support, you'll have to add `-lasound' and/or `-lesd' as well.
  162.  
  163. 
  164. File: mikmod.info,  Node: Playing Modules,  Next: Playing Sound Effects,  Prev: A Skeleton Program,  Up: Tutorial
  165.  
  166. Playing Modules
  167. ===============
  168.  
  169.    Our program is not really useful if it doesn't produce sound. Let's
  170. suppose you've got this good old module, "Beyond music", in the file
  171. `beyond_music.mod'. How about playing it ?
  172.  
  173.    To do this, we'll use the following code:
  174.  
  175.      /* MikMod Sound Library example program: a simple module player */
  176.      
  177.      #include <unistd.h>
  178.      #include <mikmod.h>
  179.      
  180.      main()
  181.      {
  182.          MODULE *module;
  183.      
  184.          /* register all the drivers */
  185.          MikMod_RegisterAllDrivers();
  186.      
  187.          /* register all the module loaders */
  188.          MikMod_RegisterAllLoaders();
  189.      
  190.          /* initialize the library */
  191.          md_mode|=DMODE_SOFT_MUSIC;
  192.          if(MikMod_Init()) {
  193.              fprintf(stderr,"Could not initialize sound, reason: %s\n",
  194.                      MikMod_strerror(MikMod_errno));
  195.              return;
  196.          }
  197.      
  198.          /* load module */
  199.          module = Player_Load("beyond_music.mod",64,0);
  200.          if (module) {
  201.              /* start module */
  202.              Player_Start(module);
  203.      
  204.              while(Player_Active()) {
  205.                  /* we're playing */
  206.                  usleep(10000);
  207.                  MikMod_Update();
  208.              }
  209.      
  210.              Player_Stop();
  211.              Player_Free(module);
  212.          } else
  213.              fprintf(stderr,"Could not load module, reason: %s\n",
  214.                      MikMod_strerror(MikMod_errno));
  215.      
  216.          /* give up */
  217.          MikMod_Exit();
  218.      }
  219.  
  220.    What's new here ? First, we've not only registered MikMod's device
  221. driver, but also the module loaders. MikMod comes with a large choice
  222. of module loaders, each one for a different module type. Since *every*
  223. loader is called to determine the type of the module when we try to
  224. load them, you may want to register only a few of them to save time. In
  225. our case, we don't matter, so we happily register every module loader.
  226.  
  227.    Then, there's an extra line before calling `MikMod_Init'. We change
  228. the value of MikMod's variable `md_mode' to tell the library that we
  229. want the module to be processed by the software. In fact, there's no
  230. hardware device able to directly play modules, so all modules must be
  231. handled by software mixing.
  232.  
  233.    We'll ensure that `MikMod_Init' was successful. Note that, in case of
  234. error, MikMod provides the variable `MikMod_errno', an equivalent of
  235. the C library `errno' for MikMod errors, and the function
  236. `MikMod_strerror', an equivalent to `strerror'.
  237.  
  238.    Now onto serious business ! The module is loaded with the
  239. `Player_Load' function, which takes the name of the module file, and
  240. the number of voices afforded to the module. In this case, the module
  241. has only 4 channels, so 4 voices, but complex Impulse Tracker modules
  242. can have a lot of voices (as they can have as many as 256 virtual
  243. channels with new note actions). Since empty voices don't cost time to
  244. be processed, it is safe to use a big value, such as 64 or 128. The
  245. third parameter is the "curiosity" of the loader: if nonzero, the
  246. loader will search for hidden parts in the module. However, only a few
  247. module format can embed hidden or non played parts, so we'll use 0 here.
  248.  
  249.    Now that the module is ready to play, let's play it. We inform the
  250. player that the current module is `module' with `Player_Start'.
  251. Playback starts, but we have to update it on a regular basis. So
  252. there's a loop on the result of the `Player_Active' function, which
  253. will tell us if the module has finished. To update the sound, we simply
  254. call `MikMod_Update'.
  255.  
  256.    After the module has finished, we tell the player its job is done
  257. with `Player_Stop', and we free the module with `Player_Free'.
  258.  
  259. 
  260. File: mikmod.info,  Node: Playing Sound Effects,  Next: More Sound Effects,  Prev: Playing Modules,  Up: Tutorial
  261.  
  262. Playing Sound Effects
  263. =====================
  264.  
  265.    MikMod is not limited to playing modules, it can also play sound
  266. effects, that is, module samples. It's a bit more complex than playing
  267. a module, because the module player does a lot of things for us, but
  268. here we'll get more control over what is actually played by the
  269. program. Let's look at an example:
  270.  
  271.      /* MikMod Sound Library example program: sound effects */
  272.      
  273.      #include <unistd.h>
  274.      #include <mikmod.h>
  275.      
  276.      main()
  277.      {
  278.          int i;
  279.          /* sound effects */
  280.          SAMPLE *sfx1,*sfx2;
  281.          /* voices */
  282.          int v1,v2;
  283.      
  284.          /* register all the drivers */
  285.          MikMod_RegisterAllDrivers();
  286.      
  287.          /* initialize the library */
  288.          md_mode|=DMODE_SOFT_SNDFX;
  289.          if(MikMod_Init()) {
  290.              fprintf(stderr,"Could not initialize sound, reason: %s\n",
  291.                      MikMod_strerror(MikMod_errno));
  292.              return;
  293.          }
  294.      
  295.          /* load samples */
  296.          sfx1 = Sample_Load("first.wav");
  297.          if(!sfx1) {
  298.              MikMod_Exit();
  299.              fprintf(stderr,"Could not load the first sound, reason: %s\n",
  300.                      MikMod_strerror(MikMod_errno));
  301.              return;
  302.          }
  303.          sfx2 = Sample_Load("second.wav");
  304.          if(!sfx2) {
  305.              Sample_Free(sfx1);
  306.              MikMod_Exit();
  307.              fprintf(stderr,"Could not load the second sound, reason: %s\n",
  308.                      MikMod_strerror(MikMod_errno));
  309.              return;
  310.          }
  311.      
  312.          /* reserve 2 voices for sound effects */
  313.          MikMod_SetNumVoices(-1,2);
  314.      
  315.          /* get ready to play */
  316.          MikMod_EnableOutput();
  317.      
  318.          /* play first sample */
  319.          v1=Sample_Play(sfx1,0,0);
  320.          for(i=0;i<5;i++) {
  321.              MikMod_Update();
  322.              usleep(100000);
  323.          }
  324.      
  325.          /* half a second later, play second sample */
  326.          v2=Sample_Play(sfx2,0,0);
  327.          do {
  328.              MikMod_Update();
  329.              usleep(100000);
  330.          } while(!Voice_Stopped(v2));
  331.      
  332.          MikMod_DisableOutput();
  333.      
  334.          Sample_Free(sfx2);
  335.          Sample_Free(sfx1);
  336.      
  337.          MikMod_Exit();
  338.      }
  339.  
  340.    As in the previous example, we begin by registering the sound
  341. drivers and initializing the library. We also ask for software mixing
  342. by modifying the variable `md_mode'(1).
  343.  
  344.    It's time to load our files, with the `Sample_Load' function. Don't
  345. forget to test the return value -- it looks ugly here on such a small
  346. example, but it's a good practice....
  347.  
  348.    Since we want to play two samples, we have to use at least two
  349. voices for this, so we reserve them with a `MikMod_SetNumVoices' call.
  350. The first parameter sets the number of module voices, and the second
  351. parameter the number of sound effect voices. We don't want to set the
  352. number of module voices here (it's part of the module player's duty),
  353. so we use the value `-1' to keep the current value, and we reserve two
  354. sound effect voices.
  355.  
  356.    Now we're ready to play, so we call `MikMod_EnableOutput' to make the
  357. driver ready. Sound effects are played by the `Sample_Play' function.
  358. You just have to specify which sample you want to play, the offset from
  359. which you want to start, and the playback flags. More on this later.
  360. The function returns the number of the voice associated to the sample.
  361.  
  362.    We play the first sample for half a second, then we start to play
  363. the second sample. Since we've reserved two channels, both samples play
  364. simultaneously. We use the `Voice_Stopped' function to stop the
  365. playback: it returns the current status of the voice argument, which is
  366. zero when the sample plays and nonzero when it has finished. So the
  367. `do' loop will stop exactly when the second sample is finished,
  368. regardless of the length of the first sample.
  369.  
  370.    To finish, we get rid of the samples with `Sample_Free'.
  371.  
  372.    ---------- Footnotes ----------
  373.  
  374.    (1) Currently, MikMod's drivers don't have support for hardware
  375. mixing.
  376.  
  377. 
  378. File: mikmod.info,  Node: More Sound Effects,  Prev: Playing Sound Effects,  Up: Tutorial
  379.  
  380. More Sound Effects
  381. ==================
  382.  
  383.    Sound effects have some attributes that can be affected to control
  384. the playback.  These are speed, panning, and volume. Given a voice
  385. number, you can affect these attributes with the `Voice_SetFrequency',
  386. `Voice_SetPanning' and `Voice_SetVolume' functions.
  387.  
  388.    In the previous example, we'll replace the actual sound code,
  389. located between the calls to `MikMod_EnableOutput' and
  390. `MikMod_DisableOutput', with the following code:
  391.  
  392.          Sample_Play(sfx1,0,0);
  393.          for(i=0;i<5;i++) {
  394.              MikMod_Update();
  395.              usleep(100000);
  396.          }
  397.          v2=Sample_Play(sfx2,0,SFX_CRITICAL);
  398.          i=0;
  399.          do {
  400.              MikMod_Update();
  401.              usleep(100000);
  402.              v1=Sample_Play(sfx1,0,0);
  403.              Voice_SetVolume(v1,160);
  404.              Voice_SetFrequency(v1,(sfx1->speed*(100+i))/100);
  405.              Voice_SetPanning(v2,(i++&1)?PAN_LEFT:PAN_RIGHT);
  406.          } while(!Voice_Stopped(v2));
  407.  
  408.    The first thing you'll notice, is the `SFX_CRITICAL' flag used to
  409. play the second sample. Since the `do' loop will add another sample
  410. every 100 milliseconds, and we reserved only two voices, the oldest
  411. voice will be cut each time this is necessary. Doing this would cut the
  412. second sample in the second iteration of the loop. However, since we
  413. flagged this sound as "critical", it won't be cut until it is finished
  414. or we stop it with a `Voice_Stop' call. So the second sample will play
  415. fine, whereas the first sample will be stopped every loop iteration.
  416.  
  417.    Then, we choose to play the first sample a bit lower, with
  418. `Voice_SetVolume'. Volume voices range from 0 (silence) to 256. In this
  419. case we play the sample at 160. To make the sound look weird, we also
  420. change its frequency with `Voice_SetFrequency'. The computation in the
  421. example code makes the frequency more and more high (starting from the
  422. sample frequency and then increasing from 1% each iteration).
  423.  
  424.    And to demonstrate the `Voice_SetPanning' function, we change the
  425. panning of the second sample at each iteration from the left to the
  426. right. The argument can be one of the standard panning `PAN_LEFT',
  427. `PAN_RIGHT', `PAN_MIDDLE' and `PAN_SURROUND'(1), or a numeric value
  428. between 0 (`PAN_LEFT') and 255 (`PAN_RIGHT').
  429.  
  430.    ---------- Footnotes ----------
  431.  
  432.    (1) `PAN_SURROUND' will be mapped to `PAN_MIDDLE' if the library is
  433. initialized without surround sound, that is, if the variable `md_mode'
  434. doesn't have the bit `DMODE_SURROUND' set.
  435.  
  436. 
  437. File: mikmod.info,  Node: Using the Library,  Next: Library Reference,  Prev: Tutorial,  Up: Top
  438.  
  439. Using the Library
  440. *****************
  441.  
  442.    This chapter describes the various parts of the library and their
  443. uses.
  444.  
  445. * Menu:
  446.  
  447. * Library Version::
  448. * Type Definitions::
  449. * Error Handling::
  450. * Library Initialization::
  451. * Samples and Voice Control::
  452. * Modules and Player Control::
  453.  
  454. 
  455. File: mikmod.info,  Node: Library Version,  Next: Type Definitions,  Prev: Using the Library,  Up: Using the Library
  456.  
  457. Library Version
  458. ===============
  459.  
  460.    If your program is dynamically linked with the MikMod library, you
  461. should check which version of the library you're working with.  To do
  462. this, the library defines a few constants and a function to help you
  463. determine if the current library is adequate for your needs or if it
  464. has to be upgraded.
  465.  
  466.    When your program includes `mikmod.h', the following constants are
  467. defined:
  468.    * `LIBMIKMOD_VERSION_MAJOR' is equal to the major version number of
  469.      the library.
  470.  
  471.    * `LIBMIKMOD_VERSION_MINOR' is equal to the minor version number of
  472.      the library.
  473.  
  474.    * `LIBMIKMOD_REVISION' is equal to the revision number of the
  475.      library.
  476.  
  477.    * `LIBMIKMOD_VERSION' is the sum of `LIBMIKMOD_VERSION_MAJOR'
  478.      shifted 16 times, `LIBMIKMOD_VERSION_MINOR' shifted 8 times, and
  479.      `LIBMIKMOD_REVISION'.
  480.  
  481.    So your program can tell with which version of the library it has
  482. been compiled this way:
  483.      printf("Compiled with MikMod Sound Library version %ld.%ld.%ld\n",
  484.             LIBMIKMOD_VERSION_MAJOR,
  485.             LIBMIKMOD_VERSION_MINOR,
  486.             LIBMIKMOD_REVISION);
  487.  
  488.    The library defines the function `MikMod_GetVersion' which returns
  489. the value of LIBMIKMOD_VERSION for the library. If this value is
  490. greater than or equal to the value of LIBMIKMOD_VERSION for your
  491. program, your program will work; otherwise, you'll have to inform the
  492. user that he has to upgrade the library:
  493.  
  494.      {
  495.          long engineversion=MikMod_GetVersion();
  496.      
  497.          if (engineversion<LIBMIKMOD_VERSION) {
  498.              printf("MikMod library version (%ld.%ld.%ld) is too old.\n",
  499.                     (engineversion>>16)&255,
  500.                     (engineversion>>8)&255,
  501.                     (engineversion)&255);
  502.              printf("This programs requires at least version %ld.%ld.%ld\n",
  503.                     LIBMIKMOD_VERSION_MAJOR,
  504.                     LIBMIKMOD_VERSION_MINOR,
  505.                     LIBMIKMOD_REVISION);
  506.              puts("Please upgrade your MikMod library.");
  507.              exit(1);
  508.          }
  509.      }
  510.  
  511. 
  512. File: mikmod.info,  Node: Type Definitions,  Next: Error Handling,  Prev: Library Version,  Up: Using the Library
  513.  
  514. Type Definitions
  515. ================
  516.  
  517.    MikMod defines several data types to deal with modules and sample
  518. data.  These types have the same memory size on every platform MikMod
  519. has been ported to.
  520.  
  521.    These types are:
  522.    * `CHAR' is a printable character. For now it is the same as the
  523.      `char' type, but in the future it may be wide char (Unicode) on
  524.      some platforms.
  525.  
  526.    * `SBYTE' is a signed 8 bit number (can range from -128 to 127).
  527.  
  528.    * `UBYTE' is an unsigned 8 bit number (can range from 0 to 255).
  529.  
  530.    * `SWORD' is a signed 16 bit number (can range from -32768 to 32767).
  531.  
  532.    * `UWORD' is an unsigned 16 bit number (can range from 0 to 65535).
  533.  
  534.    * `SLONG' is a signed 32 bit number (can range from -2.147.483.648 to
  535.      2.147.483.647).
  536.  
  537.    * `ULONG' is an unsigned 32 bit number (can range from 0 to
  538.      4.294.967.296).
  539.  
  540.    * `BOOL' is a boolean value. A value of 0 means false, any other
  541.      value means true.
  542.  
  543. 
  544. File: mikmod.info,  Node: Error Handling,  Next: Library Initialization,  Prev: Type Definitions,  Up: Using the Library
  545.  
  546. Error Handling
  547. ==============
  548.  
  549.    Although MikMod does its best to do its work, there are times where
  550. it can't.  For example, if you're trying to play a corrupted file,
  551. well, it can't.
  552.  
  553.    A lot of MikMod functions return pointers or `BOOL' values. If the
  554. pointer is `NULL' or the `BOOL' is 0 (false), an error has occurred.
  555.  
  556.    MikMod errors are returned in the variable `MikMod_errno'. Each
  557. possible error has a symbolic error code, beginning with `MMERR_'. For
  558. example, if MikMod can't open a file, `MikMod_errno' will receive the
  559. value `MMERR_OPENING_FILE'.
  560.  
  561.    You can get an appropriate error message to display from the function
  562. `MikMod_strerror'.
  563.  
  564.    There is a second error variable named `MikMod_critical'. As its name
  565. suggests, it is only set if the error lets the library in an unstable
  566. state.  This variable can only be set by the functions `MikMod_Init',
  567. `MikMod_SetNumVoices' and `MikMod_EnableOutput'. If one of these
  568. functions return an error and `MikMod_critical' is set, the library is
  569. left in the uninitialized state (i.e. it was not initialized, or
  570. `MikMod_Exit' was called).
  571.  
  572.    If you prefer, you can use a callback function to get notified of
  573. errors. This function must be prototyped as `void MyFunction(void)'.
  574. Then, call `MikMod_RegisterHandler' with your function as argument to
  575. have it notified when an error occurs. There can only be one callback
  576. function registered, but `MikMod_RegisterHandler' will return you the
  577. previous handler, so you can chain handlers if you want to.
  578.  
  579. 
  580. File: mikmod.info,  Node: Library Initialization,  Next: Samples and Voice Control,  Prev: Error Handling,  Up: Using the Library
  581.  
  582. Library Initialization and Core Functions
  583. =========================================
  584.  
  585.    To initialize the library, you must register some sound drivers
  586. first. You can either register all the drivers embedded in the library
  587. for your platform with `MikMod_RegisterAllDrivers', or register only
  588. some of them with `MikMod_RegisterDriver'. If you choose to register
  589. the drivers manually, you must be careful in their order, since
  590. `MikMod_Init' will try them in the order you registered them. The
  591. `MikMod_RegisterAllDrivers' function registers the network drivers
  592. first (for playing sound over the network), then the hardware drivers,
  593. then the disk writers, and in last resort, the nosound driver.
  594. Registering the nosound driver first would not be a very good idea....
  595.  
  596.    You can get some printable information regarding the registered
  597. drivers with `MikMod_InfoDriver'; don't forget to call `free' on the
  598. returned string when you don't need it anymore.
  599.  
  600.    After you've registered your drivers, you can initialize the sound
  601. playback with `MikMod_Init'. If you set the variable `md_device' to
  602. zero, which is its default value, the driver will be autodetected, that
  603. is, the first driver in the list that is available on the system will
  604. be used; otherwise only the driver whose order in the list of the
  605. registered drivers is equal to `md_device' will be tried.  If your
  606. playback settings, in the variables `md_mixfreq' and `md_mode', are not
  607. supported by the device, `MikMod_Init' will fail.
  608.  
  609.    You can then choose the number of voices you need with
  610. `MikMod_SetNumVoices', and activate the playback with
  611. `MikMod_EnableOutput'.
  612.  
  613.    Don't forget to call `MikMod_Update' as often as possible to process
  614. the sound mixing. If necessary, fork a dedicated process to do this.
  615.  
  616.    If you want to change playback settings, most of them can't be
  617. changed on the fly. You'll need to stop the playback and reinitialize
  618. the driver. Use `MikMod_Active' to check if there is still sound
  619. playing; in this case, call `MikMod_DisableOutput' to end playback.
  620. Then, change your settings and call `MikMod_Reset'. You're now ready to
  621. select your number of voices and restart playback.
  622.  
  623.    When your program ends, don't forget to stop playback and call
  624. `MikMod_Exit' to leave the sound hardware in a coherent state.
  625.  
  626. 
  627. File: mikmod.info,  Node: Samples and Voice Control,  Next: Modules and Player Control,  Prev: Library Initialization,  Up: Using the Library
  628.  
  629. Samples and Voice Control
  630. =========================
  631.  
  632.    Currently, MikMod only supports uncompressed mono WAV files as
  633. samples. You can load a sample by calling `Sample_Load' with a
  634. filename, or by calling `Sample_LoadFP' with an open `FILE*' pointer.
  635. These functions return a pointer to a `SAMPLE' structure, or `NULL' in
  636. case of error.
  637.  
  638.    The `SAMPLE' structure has a few interesting fields:
  639.    - `speed' contains the frequency of the sample.
  640.  
  641.    - `volume' contains the volume of the sample, ranging from 0
  642.      (silence) to 64.
  643.  
  644.    - `panning' contains the panning position of the sample.
  645.  
  646.    Altering one of those fields will affect all voices currently
  647. playing the sample. You can achieve the same result on a single voice
  648. with the functions `Voice_SetFrequency', `Voice_SetVolume' and
  649. `Voice_SetPanning'.
  650.  
  651.    You can also make your sample loop by setting the fields `loopstart'
  652. and `loopend' and or'ing `flags' with `SF_LOOP'. To compute your loop
  653. values, the field `length' will be useful. However, you must know that
  654. all the sample length are expressed in samples, i.e. 8 bits for an 8
  655. bit sample, and 16 bit for a 16 bit sample... Test `flags' for the value
  656. `SF_16BITS' to know this.
  657.  
  658.    If the common forward loop isn't enough, you can play with some
  659. other flags: `SF_BIDI' will make your sample loop "ping pong" (back and
  660. forth), and `SF_REVERSE' will make it play backwards.
  661.  
  662.    To play your sample, use the `Sample_Play' function. This function
  663. will return a voice number which enable you to use the `Voice_xx'
  664. functions.
  665.  
  666.    The sample will play until another sample takes over its voice (when
  667. you play more samples than you reserved sound effect voices), unless it
  668. has been flagged as `SFX_CRITICAL'. You can force it to stop with
  669. `Voice_Stop', or you can force another sample to take over this voice
  670. with `Voice_Play'; however `Voice_Play' doesn't let you flag the new
  671. sample as critical.
  672.  
  673.    Non looping samples will free their voice channel as soon as they
  674. are finished; you can know the current playback position of your sample
  675. with `Voice_GetPosition'. If it is zero, either the sample has finished
  676. playing or it is just beginning; use `Voice_Stopped' to know.
  677.  
  678.    When you don't need a sample anymore, don't forget to free its
  679. memory with `Sample_Free'.
  680.  
  681. 
  682. File: mikmod.info,  Node: Modules and Player Control,  Prev: Samples and Voice Control,  Up: Using the Library
  683.  
  684. Modules and Player Control
  685. ==========================
  686.  
  687.    As for the sound drivers, you have to register the module loaders
  688. you want to use for MikMod to be able to load modules. You can either
  689. register all the module loaders with `MikMod_RegisterAllLoaders', or
  690. only a few of them with `MikMod_RegisterLoader'. Be careful if you
  691. choose this solution, as the 15 instrument MOD loader has to be
  692. registered last, since loaders are called in the order they were
  693. register to identify modules, and the detection of this format is not
  694. fully reliable, so other modules might be mistaken as 15 instrument MOD
  695. files.
  696.  
  697.    You can get some printable information regarding the registered
  698. loaders with `MikMod_InfoLoader'; don't forget to call `free' on the
  699. returned string when you don't need it anymore.
  700.  
  701.    Note that, contrary to the sound drivers, you can register module
  702. loaders at any time, it doesn't matter.
  703.  
  704.    For playlists, you might be interested in knowing the module title
  705. first, and `Player_LoadTitle' will give you this information. Don't
  706. forget to `free' the returned text when you don't need it anymore.
  707.  
  708.    You can load a module either with `Player_Load' and the name of the
  709. module, or with `Player_LoadFP' and an open `FILE*' pointer. These
  710. functions also expect a maximal number of voices, and a curiosity flag.
  711. Unless you have excellent reasons not to do so, choose a big limit,
  712. such as 64 or even 128 for complex Impulse Tracker modules. Both
  713. functions return a pointer to an `MODULE' structure, or `NULL' if an
  714. error occurs.
  715.  
  716.    You'll find some useful information in this structure:
  717.    - `numchn' contains the number of module "real" channels.
  718.  
  719.    - `numvoices' contains the number of voices reserved by the player
  720.      for the real channels and the virtual channels (NNA).
  721.  
  722.    - `numpas' and `numpat' contain the number of song positions and
  723.      song patterns.
  724.  
  725.    - `numins' and `numsmp' contain the number of instruments and
  726.      samples.
  727.  
  728.    - `songname' contains the song title.
  729.  
  730.    - `modtype' contains the name of the tracker used to create the song.
  731.  
  732.    - `comment' contains the song comment, if it has one.
  733.  
  734.    - `sngtime' contains the time elapsed in the module, in 2^-10
  735.      seconds (not exactly a millisecond).
  736.  
  737.    - `sngspd' and `bpm' contain the song speed and tempo.
  738.  
  739.    Now that the module is loaded, you need to tell the module player
  740. that you want to play this particular module with `Player_Start' (the
  741. player can only play one module, but you can have several modules in
  742. memory). The playback begins. Should you forget which module is
  743. playing, `Player_GetModule' will return it to you.
  744.  
  745.    You can change the current song position with the functions
  746. `Player_NextPosition', `Player_PrevPosition' and `Player_SetPosition',
  747. the speed with `Player_SetSpeed' and `Player_SetTempo', and the volume
  748. (ranging from 0 to 128) with `Player_SetVolume'.
  749.  
  750.    Playback can be paused or resumed with `Player_TogglePause'. Be sure
  751. to check with `Player_Paused' that it isn't already in the state you
  752. want !
  753.  
  754.    Fine player control is achieved by the functions `Player_Mute',
  755. `Player_UnMute' and `Player_ToggleMute' which can silence or resume a
  756. set of module channels. The function `Player_Muted' will return the
  757. state of a given channel. And if you want even more control, you can
  758. get the voice corresponding to a module channel with
  759. `Player_GetChannelVoice' and act directly on the voice.
  760.  
  761.    Modules play only once, but can loop indefinitely if they are
  762. designed to do so.  You can change this behavior with the `wrap' and
  763. `loop' of the `MODULE' structure; the first one, if set, will make the
  764. module restart when it's finished, and the second one, if set, will
  765. prevent the module from jumping backwards.
  766.  
  767.    You can test if the module is still playing with `Player_Active',
  768. and you can stop it at any time with `Player_Stop'. When the module
  769. isn't needed anymore, get rid of it with `Player_Free'.
  770.  
  771. 
  772. File: mikmod.info,  Node: Library Reference,  Next: Index,  Prev: Using the Library,  Up: Top
  773.  
  774. Library Reference
  775. *****************
  776.  
  777.    This chapter describes in more detail all the functions and
  778. variables provided by the library. *Note Type Definitions:: for the
  779. basic type reference.
  780.  
  781. * Menu:
  782.  
  783. * Variable Reference::
  784. * Structure Reference::
  785. * Error Reference::
  786. * Function Reference::
  787. * Loader Reference::
  788. * Driver Reference::
  789.  
  790. 
  791. File: mikmod.info,  Node: Variable Reference,  Next: Structure Reference,  Prev: Library Reference,  Up: Library Reference
  792.  
  793. Variable Reference
  794. ==================
  795.  
  796. Error Variables
  797. ---------------
  798.  
  799.    The following variables are set by the library to return error
  800. information.
  801.  
  802. `int MikMod_errno'
  803.      When an error occurs, this variable contains the error code.
  804.      *Note Error Reference:: for more information.
  805.  
  806. `BOOL MikMod_critical'
  807.      When an error occurs, this variable informs of the severity of the
  808.      error. Its value has sense only if the value of `MikMod_errno' is
  809.      different from zero.  If the value of `MikMod_critical' is zero,
  810.      the error wasn't fatal and the library is in a stable state.
  811.      However, if it is nonzero, then the library can't be used and has
  812.      reseted itself to the uninitialized state. This often means that
  813.      the mixing parameters you choose were not supported by the driver,
  814.      or that it doesn't has enough voices for your needs if you called
  815.      `MikMod_SetNumVoices'.
  816.  
  817. Sound Settings
  818. --------------
  819.  
  820.    The following variables control the sound output parameters and
  821. their changes take effect immediately.
  822.  
  823. `UBYTE md_musicvolume'
  824.      Volume of the module. Allowed values range from 0 to 128. The
  825.      default value is 128.
  826.  
  827. `UBYTE md_pansep'
  828.      Stereo channels separation. Allowed values range from 0 (no
  829.      separation, thus mono sound) to 128 (full channel separation). The
  830.      default value is 128.
  831.  
  832. `UBYTE md_reverb'
  833.      Amount of sound reverberation. Allowed values range from 0 (no
  834.      reverberation) to 15 (a rough estimate for chaos...). The default
  835.      value is 6.
  836.  
  837. `UBYTE md_sndfxvolume'
  838.      Volume of the sound effects. Allowed values range from 0 to 128.
  839.      The default value is 128.
  840.  
  841. `UBYTE md_volume'
  842.      Overall sound volume. Allowed values range from 0 to 128. The
  843.      default value is 96.
  844.  
  845. Driver Settings
  846. ---------------
  847.  
  848.    The following variables control more in-depth sound output
  849. parameters. Except for some `md_mode' flags, their changes do not have
  850. any effect until you call `MikMod_Init' or `MikMod_Reset'.
  851.  
  852. `UWORD md_device'
  853.      This variable contains the order, in the list of the registered
  854.      drivers, of the sound driver which will be used for sound
  855.      playback. This order is one-based; if this variable is set to
  856.      zero, the driver is autodetected, which means the list is tested
  857.      until a driver is present on the system. The default value is 0,
  858.      thus driver is autodetected.
  859.  
  860. `MDRIVER* md_driver'
  861.      This variable points to the driver which is being used for sound
  862.      playback, and is undefined when the library is uninitialized
  863.      (before `MikMod_Init' and after `MikMod_Exit'). This variable is
  864.      for information only, you should never attempt to change its
  865.      value. Use `md_driver' and `MikMod_Init' (or `MikMod_Reset')
  866.      instead.
  867.  
  868. `UWORD md_mixfreq'
  869.      Sound playback frequency, in hertz. High values yield high sound
  870.      quality, but need more computing power than lower values. The
  871.      default value is 44100 Hz, which is compact disc quality. Other
  872.      common values are 22100 Hz (radio quality), 11025 Hz (phone
  873.      quality), and 8000 Hz (mu-law quality).
  874.  
  875. `UWORD md_mode'
  876.      This variable is a combination of several flags, to select which
  877.      output mode to select.  The following flags have a direct action
  878.      to the sound output (i.e. changes take effect immediately):
  879.     `DMODE_INTERP'
  880.           This flag, if set, enables the interpolated mixers.
  881.           Interpolated mixing gives better sound but takes a bit more
  882.           time than standard mixing. If the library is built with the
  883.           high quality mixer, interpolated mixing is always enabled,
  884.           regardless of this flag.
  885.  
  886.     `DMODE_REVERSE'
  887.           This flag, if set, exchanges the left and right stereo
  888.           channels.
  889.  
  890.     `DMODE_SURROUND'
  891.           This flag, if set, enables the surround mixers. Since
  892.           surround mixing works only for stereo sound, this flag has no
  893.           effect if the sound playback is in mono.
  894.  
  895.      The following flags aren't taken in account until the sound driver
  896.      is changed or reset:
  897.     `DMODE_16BIT'
  898.           This flag, if set, selects 16 bit sound mode. This mode
  899.           yields better sound quality, but needs twice more mixing time.
  900.  
  901.     `DMODE_SOFT_MUSIC'
  902.           This flag, if set, selects software mixing of the module.
  903.           Since no hardware can play modules at the time of writing,
  904.           this flag should always be set.
  905.  
  906.     `DMODE_SOFT_SNDFX'
  907.           This flag, if set, selects software mixing of the sound
  908.           effects. Currently, no MikMod driver supports hardware mixing
  909.           (although some DOS drivers used to do this in the past...),
  910.           so you'd better set this flag.
  911.  
  912.     `DMODE_STEREO'
  913.           This flag, if set, selects stereo sound.
  914.  
  915.      The default value of this variable is `DMODE_STEREO |
  916.      DMODE_SURROUND | DMODE_16BITS | DMODE_SOFT_MUSIC |
  917.      DMODE_SOFT_SNDFX'.
  918.  
  919. 
  920. File: mikmod.info,  Node: Structure Reference,  Next: Error Reference,  Prev: Variable Reference,  Up: Library Reference
  921.  
  922. Structure Reference
  923. ===================
  924.  
  925.    Only the useful fields are described here; if a structure field is
  926. not described, you must assume that it's an internal field which must
  927. not be modified.
  928.  
  929. Drivers
  930. -------
  931.  
  932.    The `MDRIVER' structure is not meant to be used by anything else
  933. than the core of the library, but its first four fields contain useful
  934. information for your programs:
  935. `CHAR* Name'
  936.      Name of the driver, usually never more than 20 characters.
  937.  
  938. `CHAR* Description'
  939.      Description of the driver, usually never more than 50 characters.
  940.  
  941. `UBYTE HardVoiceLimit'
  942.      Maximum number of hardware voices for this driver, 0 if the driver
  943.      has no hardware mixing support.
  944.  
  945. `UBYTE SoftVoiceLimit'
  946.      Maximum number of software voices for this driver, 0 if the driver
  947.      has no software mixing support.
  948.  
  949. Modules
  950. -------
  951.  
  952.    The `MODULE' structure gathers all the necessary information needed
  953. to play a module file, regardless of its initial format.
  954.  
  955. General Module Information
  956. ..........................
  957.  
  958.    The fields described in this section contain general information
  959. about the module and should not be modified.
  960.  
  961. `CHAR* songname'
  962.      Name of the module.
  963.  
  964. `CHAR* modtype'
  965.      Type of the module (which tracker format).
  966.  
  967. `CHAR* comment'
  968.      Either the module comments, or NULL if the module doesn't have
  969.      comments.
  970.  
  971. `UWORD flags'
  972.      Several module flags or'ed together.
  973.     `UF_INST'
  974.           If set, the module has instruments and samples; otherwise, the
  975.           module has only samples.
  976.  
  977.     `UF_LINEAR'
  978.           If set, slide periods are linear; otherwise, they are
  979.           logarithmic.
  980.  
  981.     `UF_NNA'
  982.           If set, module uses new note actions (NNA) and the
  983.           `numvoices' field is valid.
  984.  
  985.     `UF_S3MSLIDES'
  986.           If set, module uses old-S3M style volume slides (slide
  987.           processed every tick); otherwise, it uses the standard style
  988.           (slide processed every tick except the first).
  989.  
  990.     `UF_XMPERIODS'
  991.           If set, module uses XM-type periods; otherwise, it uses Amiga
  992.           periods.
  993.  
  994. `UBYTE numchn'
  995.      The number of channels in the module.
  996.  
  997. `UBYTE numvoices'
  998.      If the module uses NNA, and this variable is not zero, it contains
  999.      the limit of module voices; otherwise, the limit is set to the
  1000.      `maxchan' parameter of the `Player_Loadxx' functions.
  1001.  
  1002. `UWORD numpos'
  1003.      The number of sound positions in the module.
  1004.  
  1005. `UWORD numpat'
  1006.      The number of patterns.
  1007.  
  1008. `UWORD numins'
  1009.      The number of instruments.
  1010.  
  1011. `UWORD numsmp'
  1012.      The number of samples.
  1013.  
  1014. `INSTRUMENT* instruments'
  1015.      Points to an array of instrument structures.
  1016.  
  1017. `SAMPLE* samples'
  1018.      Points to an array of sample structures.
  1019.  
  1020. Playback Settings
  1021. .................
  1022.  
  1023.    The fields described here control the module playback and can be
  1024. modified at any time, unless otherwise specified.
  1025.  
  1026. `UBYTE initspeed'
  1027.      The initial speed of the module (Protracker compatible). Valid
  1028.      range is 1-32.
  1029.  
  1030. `UBYTE inittempo'
  1031.      The initial tempo of the module (Protracker compatible). Valid
  1032.      range is 32-255.
  1033.  
  1034. `UBYTE initvolume'
  1035.      The initial overall volume of the module. Valid range is 0-128.
  1036.  
  1037. `UWORD panning[]'
  1038.      The current channel panning positions. Only the first `numchn'
  1039.      values are defined.
  1040.  
  1041. `UBYTE chanvol[]'
  1042.      The current channel volumes. Only the first `numchn' values are
  1043.      defined.
  1044.  
  1045. `UBYTE bpm'
  1046.      The current tempo of the module. Use `Player_SetTempo' to change
  1047.      its value.
  1048.  
  1049. `UBYTE sngspd'
  1050.      The current speed of the module. Use `Player_SetSpeed' to change
  1051.      its value.
  1052.  
  1053. `UBYTE volume'
  1054.      The current overall volume of the module, in range 0-128. Use
  1055.      `Player_SetVolume' to change its value.
  1056.  
  1057. `BOOL extspd'
  1058.      If zero, Protracker extended speed effect (in-module tempo
  1059.      modification) is not processed. The default value is 1, which
  1060.      causes this effect to be processed.  However, some old modules
  1061.      might not play correctly if this effect is not neutralized.
  1062.  
  1063. `BOOL panflag'
  1064.      If zero, panning effects are not processed. The default value is
  1065.      1, which cause all panning effects to be processed. However, some
  1066.      old modules might not play correctly if panning is not neutralized.
  1067.  
  1068. `BOOL wrap'
  1069.      If nonzero, module wraps to its restart position when it is
  1070.      finished, to play continuously. Default value is zero (play only
  1071.      once).
  1072.  
  1073. `UBYTE reppos'
  1074.      The restart position of the module, when it wraps.
  1075.  
  1076. `BOOL loop'
  1077.      If nonzero, all in-module loops are processed; otherwise, backward
  1078.      loops which decrease the current position are not processed (i.e.
  1079.      only forward loops, and backward loops in the same pattern, are
  1080.      processed). This ensures that the module never loops endlessly.
  1081.      The default value is 1 (all loops are processed).
  1082.  
  1083. `BOOL fadeout'
  1084.      If nonzero, volume fades out during when last position of the
  1085.      module is being played. Default value us zero (no fadeout).
  1086.  
  1087. `UWORD patpos'
  1088.      Current position (row) in the pattern being played. Must not be
  1089.      changed.
  1090.  
  1091. `SWORD sngpos'
  1092.      Current song position. Do not change this variable directly, use
  1093.      `Player_NextPosition', `Player_PrevPosition' or
  1094.      `Player_SetPosition' instead.
  1095.  
  1096. `ULONG sngtime'
  1097.      Elapsed song time, in 2^-10 seconds units (not exactly a
  1098.      millisecond). To convert this value to seconds, divide by 1024.
  1099.  
  1100. Module Instruments
  1101. ------------------
  1102.  
  1103.    Although the `INSTRUMENT' structure is intended for internal use, you
  1104. might need to know its name:
  1105.  
  1106. `CHAR* insname'
  1107.      The instrument text, theoretically its name, but often a message
  1108.      line.
  1109.  
  1110. Samples
  1111. -------
  1112.  
  1113.    The `SAMPLE' structure is used for sound effects and module samples
  1114. as well. You can play with the following fields:
  1115.  
  1116. `SWORD panning'
  1117.      Panning value of the sample. Valid values range from PAN_LEFT (0)
  1118.      to PAN_RIGHT (255), or PAN_SURROUND.
  1119.  
  1120. `ULONG speed'
  1121.      Playing frequency of the sample, it hertz.
  1122.  
  1123. `UBYTE volume'
  1124.      Sample volume. Valid range is 0-64.
  1125.  
  1126. `UWORD flags'
  1127.      Several format flags or'ed together.
  1128.  
  1129.      Format flags:
  1130.     `SF_16BITS'
  1131.           If set, sample data is 16 bit wide; otherwise, it is 8 bit
  1132.           wide.
  1133.  
  1134.     `SF_STEREO'
  1135.           If set, sample data is stereo (two channels); otherwise, it
  1136.           is mono.
  1137.  
  1138.     `SF_SIGNED'
  1139.           If set, sample data is made of signed values; otherwise, it
  1140.           is made of unsigned values.
  1141.  
  1142.     `SF_BIG_ENDIAN'
  1143.           If set, sample data is in big-endian (Motorola) format;
  1144.           otherwise, it is in little-endian (Intel) format.
  1145.  
  1146.     `SF_DELTA'
  1147.           If set, sample is stored as delta values (differences between
  1148.           two consecutive samples); otherwise, sample is stored as
  1149.           sample values.
  1150.  
  1151.     `SF_ITPACKED'
  1152.           If set, sample data is packed with Impulse Tracker's
  1153.           compression method; otherwise, sample is not packed.
  1154.  
  1155.      Playback flags:
  1156.     `SF_LOOP'
  1157.           If set, sample loops forward.
  1158.  
  1159.     `SF_BIDI'
  1160.           If set, sample loops "ping pong" (back and forth).
  1161.  
  1162.     `SF_REVERSE'
  1163.           If set, sample plays backwards.
  1164.  
  1165. `ULONG length'
  1166.      Length of the sample, in *samples*. The length of a sample is 8
  1167.      bits (1 byte) for a 8 bit sample, and 16 bits (2 bytes) for a 16
  1168.      bit sample.
  1169.  
  1170. `ULONG loopstart'
  1171.      Loop starting position, relative to the start of the sample, in
  1172.      samples.
  1173.  
  1174. `ULONG loopend'
  1175.      Loop ending position, relative to the start of the sample, in
  1176.      samples.
  1177.  
  1178. 
  1179. File: mikmod.info,  Node: Error Reference,  Next: Function Reference,  Prev: Structure Reference,  Up: Library Reference
  1180.  
  1181. Error Reference
  1182. ===============
  1183.  
  1184.    The following errors are currently defined:
  1185.  
  1186. General Errors
  1187. --------------
  1188.  
  1189. `MMERR_OPENING_FILE'
  1190.      This error occurs when a file can not be opened, either for read
  1191.      access from a `xx_Loadxx' function, or for write access from the
  1192.      disk writer drivers.
  1193.  
  1194. `MMERR_OUT_OF_MEMORY'
  1195.      This error occurs when there is not enough virtual memory
  1196.      available to complete the operation, or there is enough memory but
  1197.      the calling process would exceed its memory limit. MikMod does not
  1198.      do any resource tuning, your program has to use the `setrlimit'
  1199.      function to do this if it needs to load very huge samples.
  1200.  
  1201. Sample Errors
  1202. -------------
  1203.  
  1204. `MMERR_OUT_OF_HANDLES'
  1205.      This error occurs when your program reaches the limit of loaded
  1206.      samples, currently defined as 384, which should be sufficient for
  1207.      most cases.
  1208.  
  1209. `MMERR_SAMPLE_TOO_BIG'
  1210.      This error occurs when the memory allocation of the sample data
  1211.      yields the error `MMERR_OUT_OF_MEMORY'.
  1212.  
  1213. `MMERR_UNKNOWN_WAVE_TYPE'
  1214.      This error occurs when you're trying to load a sample which format
  1215.      is not recognized.
  1216.  
  1217. Module Errors
  1218. -------------
  1219.  
  1220. `MMERR_ITPACK_INVALID_DATA'
  1221.      This error occurs when a compressed module sample is corrupt.
  1222.  
  1223. `MMERR_LOADING_HEADER'
  1224.      This error occurs when you're trying to load a module which has a
  1225.      corrupted header, or is truncated.
  1226.  
  1227. `MMERR_LOADING_PATTERN'
  1228.      This error occurs when you're trying to load a module which has
  1229.      corrupted pattern data, or is truncated.
  1230.  
  1231. `MMERR_LOADING_SAMPLEINFO'
  1232.      This error occurs when you're trying to load a module which has
  1233.      corrupted sample information, or is truncated.
  1234.  
  1235. `MMERR_LOADING_TRACK'
  1236.      This error occurs when you're trying to load a module which has
  1237.      corrupted track data, or is truncated.
  1238.  
  1239. `MMERR_MED_SYNTHSAMPLES'
  1240.      This error occurs when you're trying to load a MED module which
  1241.      has synthsounds samples, which are currently not supported.
  1242.  
  1243. `MMERR_NOT_A_MODULE'
  1244.      This error occurs when you're trying to load a module which format
  1245.      is not recognized.
  1246.  
  1247. `MMERR_NOT_A_STREAM'
  1248.      This error occurs when you're trying to load a sample with a
  1249.      sample which format is not recognized.
  1250.  
  1251. Driver Errors
  1252. -------------
  1253.  
  1254. Generic Driver Errors
  1255. .....................
  1256.  
  1257. `MMERR_DETECTING_DEVICE'
  1258.      This error occurs when the driver's sound device has not been
  1259.      detected.
  1260.  
  1261. `MMERR_INITIALIZING_MIXER'
  1262.      This error occurs when MikMod's internal software mixer could not
  1263.      be initialized properly.
  1264.  
  1265. `MMERR_INVALID_DEVICE'
  1266.      This error occurs when the driver number (in `md_device') is out
  1267.      of range.
  1268.  
  1269. `MMERR_NON_BLOCK'
  1270.      This error occurs when the driver is unable to set the audio
  1271.      device in non blocking mode.
  1272.  
  1273. `MMERR_OPENING_AUDIO'
  1274.      This error occurs when the driver can not open sound device.
  1275.  
  1276. `MMERR_16BIT_ONLY'
  1277.      This driver occurs when the sound device doesn't support non-16
  1278.      bit linear sound output, which are the requested settings.
  1279.  
  1280. AudioFile Driver Specific Errors
  1281. ................................
  1282.  
  1283. `MMERR_AF_AUDIO_PORT'
  1284.      This error occurs when the AudioFile driver can not find a
  1285.      suitable AudioFile port.
  1286.  
  1287. AIX Driver Specific Errors
  1288. ..........................
  1289.  
  1290. `MMERR_AIX_CONFIG_CONTROL'
  1291.      This error occurs when the "Control" step of the device
  1292.      configuration has failed.
  1293.  
  1294. `MMERR_AIX_CONFIG_INIT'
  1295.      This error occurs when the "Init" step of the device configuration
  1296.      has failed.
  1297.  
  1298. `MMERR_AIX_CONFIG_START'
  1299.      This error occurs when the "Start" step of the device
  1300.      configuration has failed.
  1301.  
  1302. HP-UX Driver Specific Errors
  1303. ............................
  1304.  
  1305. `MMERR_HP_AUDIO_DESC'
  1306.      This error occurs when the HP driver can not get the audio
  1307.      hardware description.
  1308.  
  1309. `MMERR_HP_AUDIO_OUTPUT'
  1310.      This error occurs when the HP driver can not select the audio
  1311.      output.
  1312.  
  1313. `MMERR_HP_BUFFERSIZE'
  1314.      This error occurs when the HP driver can not set the transmission
  1315.      buffer size.
  1316.  
  1317. `MMERR_HP_CHANNELS'
  1318.      This error occurs when the HP driver can not set the requested
  1319.      number of channels.
  1320.  
  1321. `MMERR_HP_GETGAINS'
  1322.      This error occurs when the HP driver can not get the audio gains.
  1323.  
  1324. `MMERR_HP_SETGAINS'
  1325.      This error occurs when the HP driver can not set the audio gains.
  1326.  
  1327. `MMERR_HP_SETSAMPLESIZE'
  1328.      This error occurs when the HP driver can not set the requested
  1329.      sample size.
  1330.  
  1331. `MMERR_HP_SETSPEED'
  1332.      This error occurs when the HP driver can not set the requested
  1333.      sample rate.
  1334.  
  1335. Open Sound System Driver Specific Errors
  1336. ........................................
  1337.  
  1338. `MMERR_OSS_SETFRAGMENT'
  1339.      This error occurs when the OSS driver can not set audio fragment
  1340.      size.
  1341.  
  1342. `MMERR_OSS_SETSAMPLESIZE'
  1343.      This error occurs when the OSS driver can not set the requested
  1344.      sample size.
  1345.  
  1346. `MMERR_OSS_SETSPEED'
  1347.      This error occurs when the OSS driver can not set the requested
  1348.      sample rate.
  1349.  
  1350. `MMERR_OSS_SETSTEREO'
  1351.      This error occurs when the OSS driver can not set the requested
  1352.      number of channels.
  1353.  
  1354. SGI Driver Specific Errors
  1355. ..........................
  1356.  
  1357. `MMERR_SGI_MONO'
  1358.      This error occurs when the hardware only supports stereo sound.
  1359.  
  1360. `MMERR_SGI_SPEED'
  1361.      This error occurs when the hardware does not support the requested
  1362.      sample rate.
  1363.  
  1364. `MMERR_SGI_STEREO'
  1365.      This error occurs when the hardware only supports mono sound.
  1366.  
  1367. `MMERR_SGI_16BIT'
  1368.      This error occurs when the hardware only supports 16 bit sound.
  1369.  
  1370. `MMERR_SGI_8BIT'
  1371.      This error occurs when the hardware only supports 8 bit sound.
  1372.  
  1373. Sun Driver Specific Errors
  1374. ..........................
  1375.  
  1376. `MMERR_SUN_INIT'
  1377.      This error occurs when the sound device initialization failed.
  1378.  
  1379. `MMERR_SUN_16BIT_ULAW'
  1380.      This error occurs when you're trying to use mu-law encoding with
  1381.      16 bit sound.
  1382.  
  1383. OS/2 Driver Specific Errors
  1384. ...........................
  1385.  
  1386. `MMERR_OS2_MIXSETUP'
  1387.      This error occurs when the DART driver can not set the mixing
  1388.      parameters.
  1389.  
  1390. `MMERR_OS2_SEMAPHORE'
  1391.      This error occurs when the MMPM/2 driver can not create the
  1392.      semaphores needed for playback.
  1393.  
  1394. `MMERR_OS2_THREAD'
  1395.      This error occurs when the MMPM/2 driver can not create the thread
  1396.      needed for playback.
  1397.  
  1398. `MMERR_OS2_TIMER'
  1399.      This error occurs when the MMPM/2 driver can not create the timer
  1400.      needed for playback.
  1401.  
  1402. 
  1403. File: mikmod.info,  Node: Function Reference,  Next: Library Core Functions,  Prev: Error Reference,  Up: Library Reference
  1404.  
  1405. Function Reference
  1406. ==================
  1407.  
  1408. * Menu:
  1409.  
  1410. * Library Core Functions::      MikMod_xx functions.
  1411. * Module Player Functions::     Player_xx functions.
  1412. * Sample Functions::            Sample_xx functions.
  1413. * Voice Functions::             Voice_xx functions.
  1414.  
  1415.