/* Copyright (C) 2000 LordHavoc, Ender This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //mod.c #include "quakedef.h" int num_sfxorig; #ifdef WITH_FMOD #include "fmod/fmod_errors.h" #include "fmod/fmod.h" #ifdef GLQUAKE FMUSIC_MODULE *mod = NULL; int modplaying = 0; void MOD_stop (void) { if (modplaying) { FMUSIC_FreeSong (mod); } modplaying = 0; } void MOD_play (void) { char modname[256], *buffer; int mark; strcpy (modname, Cmd_Argv(1)); if (modplaying) MOD_stop (); if (strlen(modname) < 3) { Con_Print ("Format: PlayMod "); return; } mark = Hunk_LowMark (); if (!(buffer = (char *)COM_LoadHunkFile(modname))) { Con_Printf ("Couldn't find: %s\n",Cmd_Argv(1)); return; } // mod = FMUSIC_LoadSongMemory (buffer, com_filesize); Hunk_FreeToLowMark (mark); if (!mod) { Con_Printf ("%s\n", FMOD_ErrorString(FSOUND_GetError())); return; } modplaying = 1; FMUSIC_PlaySong (mod); } void MOD_init (void) { FSOUND_SetBufferSize (300); if (!FSOUND_Init(11025, 32, 0)) { Con_Printf ("%s\n", FMOD_ErrorString(FSOUND_GetError())); return; } FSOUND_SetMixer (FSOUND_MIXER_AUTODETECT); switch (FSOUND_GetMixer()) { case FSOUND_MIXER_BLENDMODE: Con_DPrintf ("FSOUND_MIXER_BLENDMODE\n"); break; case FSOUND_MIXER_MMXP5: Con_DPrintf ("FSOUND_MIXER_MMXP5\n"); break; case FSOUND_MIXER_MMXP6: Con_DPrintf ("FSOUND_MIXER_MMXP6\n"); break; case FSOUND_MIXER_QUALITY_FPU: Con_DPrintf ("FSOUND_MIXER_QUALITY_FPU\n"); break; case FSOUND_MIXER_QUALITY_MMXP5: Con_DPrintf ("FSOUND_MIXER_QUALITY_MMXP5\n"); break; case FSOUND_MIXER_QUALITY_MMXP6: Con_DPrintf ("FSOUND_MIXER_QUALITY_MMXP6\n"); break; }; Cmd_AddCommand ("stopmod", MOD_stop); Cmd_AddCommand ("playmod", MOD_play); }; void MOD_done (void) { FSOUND_Close (); }; #endif #endif