2 Copyright (C) 1998 BJ Eirich (aka vecna)
\r
3 This program is free software; you can redistribute it and/or
\r
4 modify it under the terms of the GNU General Public License
\r
5 as published by the Free Software Foundation; either version 2
\r
6 of the License, or (at your option) any later version.
\r
7 This program is distributed in the hope that it will be useful,
\r
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
10 See the GNU General Public Lic
\r
11 See the GNU General Public License for more details.
\r
12 You should have received a copy of the GNU General Public License
\r
13 along with this program; if not, write to the Free Software
\r
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
20 // ================================= Data ====================================
\r
27 // ================================= Code ====================================
\r
29 void PlaySound(int, int, int);
\r
37 void InitMusicSystem()
\r
39 memset(playing, 0, 60);
\r
40 ML_RegisterLoader(&load_mod);
\r
41 ML_RegisterLoader(&load_s3m);
\r
42 ML_RegisterLoader(&load_uni);
\r
43 ML_RegisterLoader(&load_xm);
\r
45 MD_RegisterDriver(&drv_nos);
\r
46 // MD_RegisterDriver(&drv_ss);
\r
47 MD_RegisterDriver(&drv_sb);
\r
48 MD_RegisterDriver(&drv_gus);
\r
50 MD_RegisterPlayer(tickhandler);
\r
53 printf("Driver error: %s.\n",myerr);
\r
58 void PlayMusic(char *fname)
\r
61 if (!strcmp(fname,playing)) return;
\r
67 memcpy(playing, fname, strlen(fname));
\r
68 if (!(mf=ML_LoadFN(fname))) err(myerr);
\r
70 md_numchn=mf->numchn+2;
\r
71 mp_loop=1; mp_volume=100;
\r
79 if (MP_Ready()) return;
\r
84 int CacheSound(char *fname)
\r
86 if (!(sfx[nsfx]=MW_LoadWavFN(fname)))
\r
87 err("WAV [%s] load error: %s", fname, myerr);
\r
91 void FreeAllSounds()
\r
95 for (i=0; i<nsfx; i++)
\r
100 void PlaySound(int index, int vol, int pan)
\r
102 static int switcher=1;
\r
105 if (index >= nsfx) return;
\r
107 chanl=md_numchn-1-switcher;
\r
108 MD_VoiceSetVolume(chanl, vol);
\r
109 MD_VoiceSetPanning(chanl, pan);
\r
110 MD_VoiceSetFrequency(chanl, sfx[index]->c2spd);
\r
111 MD_VoicePlay(chanl, sfx[index]->handle, 0, sfx[index]->length,
\r
112 0, 0, sfx[index]->flags);
\r