It turns out that the nosound mikmod driver works perfectly well for our use. :)
authorSam Lantinga <slouken@libsdl.org>
Sun, 21 Aug 2005 21:30:27 +0000
changeset 2777d1be40dca4a
parent 276 00ff1db6f904
child 278 d5d67781b433
It turns out that the nosound mikmod driver works perfectly well for our use. :)
VisualC.zip
mikmod/Makefile.am
mikmod/drv_nos.c
mikmod/drv_sdl.c
mikmod/mdreg.c
mikmod/mikmod.h
music.c
     1.1 Binary file VisualC.zip has changed
     2.1 --- a/mikmod/Makefile.am	Sun Aug 21 20:54:52 2005 +0000
     2.2 +++ b/mikmod/Makefile.am	Sun Aug 21 21:30:27 2005 +0000
     2.3 @@ -3,7 +3,6 @@
     2.4  
     2.5  libmikmod_la_SOURCES =		\
     2.6  	drv_nos.c		\
     2.7 -	drv_sdl.c		\
     2.8  	load_it.c		\
     2.9  	load_mod.c		\
    2.10  	load_s3m.c		\
     3.1 --- a/mikmod/drv_nos.c	Sun Aug 21 20:54:52 2005 +0000
     3.2 +++ b/mikmod/drv_nos.c	Sun Aug 21 21:30:27 2005 +0000
     3.3 @@ -35,6 +35,7 @@
     3.4  #ifdef HAVE_CONFIG_H
     3.5  #include "config.h"
     3.6  #endif
     3.7 +#define SDL_MIXER_ONLY
     3.8  
     3.9  #ifdef HAVE_UNISTD_H
    3.10  #include <unistd.h>
    3.11 @@ -44,7 +45,9 @@
    3.12  
    3.13  #define ZEROLEN 32768
    3.14  
    3.15 +#ifndef SDL_MIXER_ONLY
    3.16  static	SBYTE *zerobuf=NULL;
    3.17 +#endif
    3.18  
    3.19  static BOOL NS_IsThere(void)
    3.20  {
    3.21 @@ -53,20 +56,26 @@
    3.22  
    3.23  static BOOL NS_Init(void)
    3.24  {
    3.25 +#ifndef SDL_MIXER_ONLY
    3.26  	zerobuf=(SBYTE*)_mm_malloc(ZEROLEN);
    3.27 +#endif
    3.28  	return VC_Init();
    3.29  }
    3.30  
    3.31  static void NS_Exit(void)
    3.32  {
    3.33  	VC_Exit();
    3.34 +#ifndef SDL_MIXER_ONLY
    3.35  	_mm_free(zerobuf);
    3.36 +#endif
    3.37  }
    3.38  
    3.39  static void NS_Update(void)
    3.40  {
    3.41 +#ifndef SDL_MIXER_ONLY
    3.42  	if (zerobuf)
    3.43  		VC_WriteBytes(zerobuf,ZEROLEN);
    3.44 +#endif
    3.45  }
    3.46  
    3.47  MIKMODAPI MDRIVER drv_nos={
     4.1 --- a/mikmod/drv_sdl.c	Sun Aug 21 20:54:52 2005 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,79 +0,0 @@
     4.4 -/*
     4.5 -
     4.6 -Name:
     4.7 -DRV_SDL.C
     4.8 -
     4.9 -Description:
    4.10 -Mikmod driver for output using the Simple DirectMedia Layer
    4.11 -
    4.12 -*/
    4.13 -
    4.14 -
    4.15 -#include "mikmod_internals.h"
    4.16 -
    4.17 -
    4.18 -static BOOL SDRV_IsThere(void)
    4.19 -{
    4.20 -    return 1;
    4.21 -}
    4.22 -
    4.23 -
    4.24 -static BOOL SDRV_Init(void)
    4.25 -{
    4.26 -    md_mode |= DMODE_SOFT_MUSIC | DMODE_SOFT_SNDFX;
    4.27 -    return(VC_Init());
    4.28 -}
    4.29 -
    4.30 -
    4.31 -static void SDRV_Exit(void)
    4.32 -{
    4.33 -    VC_Exit();
    4.34 -}
    4.35 -
    4.36 -
    4.37 -static void SDRV_Update(void)
    4.38 -{
    4.39 -    /* does nothing, buffers are updated in the background */
    4.40 -}
    4.41 -
    4.42 -
    4.43 -static BOOL SDRV_Reset(void)
    4.44 -{
    4.45 -    return 0;
    4.46 -}
    4.47 -
    4.48 -
    4.49 -MIKMODAPI MDRIVER drv_sdl =
    4.50 -{   NULL,
    4.51 -    "SDL",
    4.52 -    "MikMod Simple DirectMedia Layer driver v1.1",
    4.53 -    0,255,
    4.54 -    "SDL",
    4.55 -
    4.56 -    NULL,
    4.57 -    SDRV_IsThere,
    4.58 -    VC_SampleLoad,
    4.59 -    VC_SampleUnload,
    4.60 -    VC_SampleSpace,
    4.61 -    VC_SampleLength,
    4.62 -    SDRV_Init,
    4.63 -    SDRV_Exit,
    4.64 -    SDRV_Reset,
    4.65 -    VC_SetNumVoices,
    4.66 -    VC_PlayStart,
    4.67 -    VC_PlayStop,
    4.68 -    SDRV_Update,
    4.69 -    NULL,               /* FIXME: Pause */
    4.70 -    VC_VoiceSetVolume,
    4.71 -    VC_VoiceGetVolume,
    4.72 -    VC_VoiceSetFrequency,
    4.73 -    VC_VoiceGetFrequency,
    4.74 -    VC_VoiceSetPanning,
    4.75 -    VC_VoiceGetPanning,
    4.76 -    VC_VoicePlay,
    4.77 -    VC_VoiceStop,
    4.78 -    VC_VoiceStopped,
    4.79 -    VC_VoiceGetPosition,
    4.80 -    VC_VoiceRealVolume
    4.81 -};
    4.82 -
     5.1 --- a/mikmod/mdreg.c	Sun Aug 21 20:54:52 2005 +0000
     5.2 +++ b/mikmod/mdreg.c	Sun Aug 21 21:30:27 2005 +0000
     5.3 @@ -32,11 +32,8 @@
     5.4  
     5.5  #include "mikmod_internals.h"
     5.6  
     5.7 -MIKMODAPI extern struct MDRIVER drv_sdl;    /* Simple Direct Media */
     5.8 -
     5.9  void _mm_registeralldrivers(void)
    5.10  {
    5.11 -	_mm_registerdriver(&drv_sdl);
    5.12  	_mm_registerdriver(&drv_nos);
    5.13  }
    5.14  
     6.1 --- a/mikmod/mikmod.h	Sun Aug 21 20:54:52 2005 +0000
     6.2 +++ b/mikmod/mikmod.h	Sun Aug 21 21:30:27 2005 +0000
     6.3 @@ -650,8 +650,6 @@
     6.4  MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
     6.5  MIKMODAPI extern struct MDRIVER drv_wav;    /* RIFF WAVE file disk writer [music.wav] */
     6.6  
     6.7 -MIKMODAPI extern struct MDRIVER drv_sdl;    /* SDL_mixer driver */
     6.8 -
     6.9  MIKMODAPI extern struct MDRIVER drv_ultra;  /* Linux Ultrasound driver */
    6.10  
    6.11  MIKMODAPI extern struct MDRIVER drv_AF;     /* Dec Alpha AudioFile */
     7.1 --- a/music.c	Sun Aug 21 20:54:52 2005 +0000
     7.2 +++ b/music.c	Sun Aug 21 21:30:27 2005 +0000
     7.3 @@ -380,23 +380,22 @@
     7.4  		}
     7.5  		md_mode |= DMODE_STEREO;
     7.6  	}
     7.7 -	md_mixfreq	 = mixer->freq;
     7.8 -	md_device	  = 0;
     7.9 -	md_volume	  = 96;
    7.10 +	md_mixfreq = mixer->freq;
    7.11 +	md_device  = 0;
    7.12 +	md_volume  = 96;
    7.13  	md_musicvolume = 128;
    7.14  	md_sndfxvolume = 128;
    7.15 -	md_pansep	  = 128;
    7.16 -	md_reverb	  = 0;
    7.17 -#ifdef LIBMIKMOD_MUSIC
    7.18 -	md_mode |= DMODE_HQMIXER|DMODE_SOFT_MUSIC|DMODE_SURROUND;
    7.19 -#endif
    7.20 +	md_pansep  = 128;
    7.21 +	md_reverb  = 0;
    7.22 +	md_mode    |= DMODE_HQMIXER|DMODE_SOFT_MUSIC|DMODE_SURROUND;
    7.23  #ifdef LIBMIKMOD_MUSIC
    7.24  	list = MikMod_InfoDriver();
    7.25  	if ( list )
    7.26  	  free(list);
    7.27  	else
    7.28 +#else
    7.29 +	MikMod_RegisterDriver(&drv_nos);
    7.30  #endif
    7.31 -	MikMod_RegisterDriver(&drv_nos);
    7.32  #ifdef LIBMIKMOD_MUSIC
    7.33  	list = MikMod_InfoLoader();
    7.34  	if ( list )