home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / midas / examples / mplay.c < prev    next >
C/C++ Source or Header  |  1994-08-06  |  2KB  |  62 lines

  1. /*      MPLAY.C
  2.  *
  3.  * Minimal module player using MIDAS Sound System
  4.  *
  5.  * Copyright 1994 Petteri Kangaslampi and Jarno Paananen
  6.  *
  7.  * This file is part of the MIDAS Sound System, and may only be
  8.  * used, modified and distributed under the terms of the MIDAS
  9.  * Sound System license, LICENSE.TXT. By continuing to use,
  10.  * modify or distribute this file you indicate that you have
  11.  * read the license and understand and accept it fully.
  12. */
  13.  
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <conio.h>
  17. #include "midas.h"
  18.  
  19. char            *usage =
  20. "Usage:\tMPLAY\t<filename> [options]\n\n"
  21. "Options:\n"
  22. "\t-sx\tForce Sound Device x (1 = GUS, 2 = PAS, 3 = WSS, 4 = SB,\n"
  23. "\t\t5 = No Sound)\n"
  24. "\t-pxxx\tForce I/O port xxx (hex) for Sound Device\n"
  25. "\t-ix\tForce IRQ x for Sound Device\n"
  26. "\t-dx\tForce DMA channel x for Sound Device\n"
  27. "\t-mxxxxx\tSet mixing rate to xxxxx Hz\n"
  28. "\t-e\tDisable EMS usage\n"
  29. "\t-t\tDisable ProTracker BPM tempos\n"
  30. "\t-u\tEnable Surround\n"
  31. "\t-oxxx\tForce output mode (8 = 8-bit, 1 = 16-bit, s = stereo, m = mono)\n";
  32.  
  33.  
  34.  
  35. int main(int argc, char *argv[])
  36. {
  37.     mpModule    *mod;
  38.  
  39.     /* argv[0] is the program name and argv[1] the module filename, the
  40.        rest are options which MIDAS should handle */
  41.  
  42.     if  ( argc < 2 )                    /* enough arguments? (at least 2 - */
  43.     {                                   /* program name and module filename */
  44.         puts(usage);                    /* nope, show usage */
  45.         exit(EXIT_SUCCESS);             /* and exit */
  46.     }
  47.  
  48.     midasSetDefaults();                 /* set MIDAS defaults */
  49.     midasParseEnvironment();            /* parse MIDAS environment string */
  50.     midasParseOptions(argc-2, &argv[2]);    /* let MIDAS parse all options */
  51.     midasInit();                        /* initialize MIDAS Sound System */
  52.     mod = midasPlayModule(argv[1], 0);  /* load module and start playing */
  53.  
  54.     puts("Playing - press any key...");
  55.     getch();                            /* wait for a keypress */
  56.  
  57.     midasStopModule(mod);               /* stop playing */
  58.     midasClose();                       /* uninitialize MIDAS */
  59.  
  60.     return 0;
  61. }
  62.