comparison frontend/mikmodux.c @ 16:e5529b6e3b1c

Inistal commit of the Cheesy Mod Player (tm)
author darius
date Thu, 23 Apr 1998 07:35:49 +0000
parents
children
comparison
equal deleted inserted replaced
15:ca72d2b59bf4 16:e5529b6e3b1c
1 /*
2 * Basic mod player. Just takes the name of the mod to play
3 */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <string.h>
9 #include <fnmatch.h>
10 #include <signal.h>
11 #include "mikmod.h"
12 #include "mikmodux.h"
13 #include "mmio.h"
14
15
16 int
17 main(int argc, char *argv[])
18 {
19 static BOOL
20 cfg_extspd = 1, /* Extended Speed enable */
21 cfg_panning = 1, /* DMP panning enable (8xx effects) */
22 cfg_loop = 0; /* auto song-looping disable */
23 int
24 cfg_maxchn = 64, c;
25
26 UNIMOD *mf = NULL;
27
28 if (argc != 2) {
29 printf("Usage is mikmod <mod name>\n");
30 exit(1);
31 }
32
33 init_mikmod();
34
35 if ((mf = MikMod_LoadSong(argv[1], cfg_maxchn)) != NULL) {
36 mf->extspd = cfg_extspd;
37 mf->panflag = cfg_panning;
38 mf->loop = cfg_loop;
39
40 Player_Start(mf);
41
42 /*
43 * set the number of voices to use.. you could add extra channels
44 * here (e.g. md_numchn=mf->numchn+4; ) to use for your own
45 * soundeffects:
46 */
47
48 while (Player_Active()) { /* if we have a quit signal, exit
49 * loop */
50 MikMod_Update();
51
52 usleep(500);
53 }
54
55 Player_Stop(); /* stop playing */
56 MikMod_FreeSong(mf); /* and free the module */
57 } else {
58 /* didn't work -> exit with errormsg. */
59 printf("MikMod Error\n");
60 }
61
62 MikMod_Exit();
63 }
64
65 void
66 init_mikmod(void)
67 {
68 /*
69 * Initialize soundcard parameters.. you _have_ to do this before calling
70 * MD_Init(), and it's illegal to change them after you've called
71 * MD_Init()
72 */
73
74 md_mixfreq = 44100; /* standard mixing freq */
75 md_dmabufsize = 32768; /* standard dma buf size (max 32000) */
76 md_device = 0; /* standard device: autodetect */
77 md_volume = 96; /* driver volume (max 128) */
78 md_musicvolume = 128; /* music volume (max 128) */
79 md_sndfxvolume = 128; /* sound effects volume (max 128) */
80 md_pansep = 128; /* panning separation (0 = mono, 128 = full
81 * stereo) */
82 /* md_stereodelay = 10; /* Stereo Delay (max 15) */
83 md_reverb = 0; /* Reverb (max 15) */
84 md_mode =
85 DMODE_16BITS |
86 DMODE_STEREO |
87 DMODE_SOFT_MUSIC; /* default mixing mode */
88
89 /* Register the loaders we want to use.. */
90 MikMod_RegisterAllLoaders();
91
92 /* Register the drivers we want to use: */
93 MikMod_RegisterAllDrivers();
94
95 MikMod_RegisterDriver(drv_wav);
96 MikMod_RegisterDriver(drv_raw);
97 MikMod_RegisterDriver(drv_nos);
98
99 MikMod_Init();
100
101 }