Potential libmikmod linkage improvements: avoiding mikmod.h conflicts; building against libmikmod 3.2.x; last bit of custom code gone from internal mikmod
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2340 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
uqm_CFILES="drv_nos.c drv_openal.c load_mod.c mdreg.c mdriver.c mloader.c
|
uqm_CFILES="drv_nos.c load_mod.c mdreg.c mdriver.c mloader.c
|
||||||
mlreg.c mlutil.c mmalloc.c mmerror.c mmio.c mplayer.c munitrk.c
|
mlreg.c mlutil.c mmalloc.c mmerror.c mmio.c mplayer.c munitrk.c
|
||||||
mwav.c npertab.c sloader.c virtch.c virtch2.c virtch_common.c"
|
mwav.c npertab.c sloader.c virtch.c virtch2.c virtch_common.c"
|
||||||
|
|||||||
@@ -28,11 +28,8 @@
|
|||||||
|
|
||||||
#include "mikmod_internals.h"
|
#include "mikmod_internals.h"
|
||||||
|
|
||||||
MIKMODAPI extern struct MDRIVER drv_openal;
|
|
||||||
|
|
||||||
void _mm_registeralldrivers(void)
|
void _mm_registeralldrivers(void)
|
||||||
{
|
{
|
||||||
_mm_registerdriver(&drv_openal);
|
|
||||||
_mm_registerdriver(&drv_nos);
|
_mm_registerdriver(&drv_nos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,16 @@
|
|||||||
#include "endian_uqm.h"
|
#include "endian_uqm.h"
|
||||||
#include "uio.h"
|
#include "uio.h"
|
||||||
#include "decoder.h"
|
#include "decoder.h"
|
||||||
#include "mikmod/mikmod.h"
|
|
||||||
#include "mikmod/drv_openal.h"
|
|
||||||
#include "libs/sound/audiocore.h"
|
#include "libs/sound/audiocore.h"
|
||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
#include "modaud.h"
|
#include "modaud.h"
|
||||||
|
|
||||||
|
#ifdef USE_EXTERNAL_MIKMOD
|
||||||
|
# include "mikmod.h"
|
||||||
|
#else
|
||||||
|
# include "mikmod/mikmod.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define THIS_PTR TFB_SoundDecoder* This
|
#define THIS_PTR TFB_SoundDecoder* This
|
||||||
|
|
||||||
static const char* moda_GetName (void);
|
static const char* moda_GetName (void);
|
||||||
@@ -74,6 +78,101 @@ typedef struct tfb_modsounddecoder
|
|||||||
|
|
||||||
} TFB_ModSoundDecoder;
|
} TFB_ModSoundDecoder;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// MikMod Output driver
|
||||||
|
// we provide our own so that we can use MikMod as
|
||||||
|
// generic decoder
|
||||||
|
|
||||||
|
static void* buffer;
|
||||||
|
static ULONG bufsize;
|
||||||
|
static ULONG written;
|
||||||
|
|
||||||
|
ULONG*
|
||||||
|
moda_mmout_SetOutputBuffer (void* buf, ULONG size)
|
||||||
|
{
|
||||||
|
buffer = buf;
|
||||||
|
bufsize = size;
|
||||||
|
written = 0;
|
||||||
|
return &written;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
moda_mmout_IsThere (void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
moda_mmout_Init (void)
|
||||||
|
{
|
||||||
|
md_mode |= DMODE_SOFT_MUSIC | DMODE_SOFT_SNDFX;
|
||||||
|
return VC_Init ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
moda_mmout_Exit (void)
|
||||||
|
{
|
||||||
|
VC_Exit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
moda_mmout_Update (void)
|
||||||
|
{
|
||||||
|
written = 0;
|
||||||
|
if (!buffer || bufsize == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
written = VC_WriteBytes (buffer, bufsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
moda_mmout_Reset (void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MDRIVER moda_mmout_drv =
|
||||||
|
{ NULL,
|
||||||
|
"Mem Buffer", // Name
|
||||||
|
"Mem Buffer driver v1.1", // Version
|
||||||
|
0, 255, // Voice limits
|
||||||
|
"membuf", // Alias
|
||||||
|
|
||||||
|
// The minimum mikmod version we support is 3.1.8
|
||||||
|
#if (LIBMIKMOD_VERSION_MAJOR > 3) || \
|
||||||
|
((LIBMIKMOD_VERSION_MAJOR == 3) && (LIBMIKMOD_VERSION_MINOR >= 2))
|
||||||
|
NULL, // Cmdline help
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
moda_mmout_IsThere,
|
||||||
|
VC_SampleLoad,
|
||||||
|
VC_SampleUnload,
|
||||||
|
VC_SampleSpace,
|
||||||
|
VC_SampleLength,
|
||||||
|
moda_mmout_Init,
|
||||||
|
moda_mmout_Exit,
|
||||||
|
moda_mmout_Reset,
|
||||||
|
VC_SetNumVoices,
|
||||||
|
VC_PlayStart,
|
||||||
|
VC_PlayStop,
|
||||||
|
moda_mmout_Update,
|
||||||
|
NULL, /* FIXME: Pause */
|
||||||
|
VC_VoiceSetVolume,
|
||||||
|
VC_VoiceGetVolume,
|
||||||
|
VC_VoiceSetFrequency,
|
||||||
|
VC_VoiceGetFrequency,
|
||||||
|
VC_VoiceSetPanning,
|
||||||
|
VC_VoiceGetPanning,
|
||||||
|
VC_VoicePlay,
|
||||||
|
VC_VoiceStop,
|
||||||
|
VC_VoiceStopped,
|
||||||
|
VC_VoiceGetPosition,
|
||||||
|
VC_VoiceRealVolume
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static const TFB_DecoderFormats* moda_formats = NULL;
|
static const TFB_DecoderFormats* moda_formats = NULL;
|
||||||
|
|
||||||
// MikMod READER interface
|
// MikMod READER interface
|
||||||
@@ -149,7 +248,7 @@ moda_GetName (void)
|
|||||||
static bool
|
static bool
|
||||||
moda_InitModule (int flags, const TFB_DecoderFormats* fmts)
|
moda_InitModule (int flags, const TFB_DecoderFormats* fmts)
|
||||||
{
|
{
|
||||||
MikMod_RegisterDriver (&drv_openal);
|
MikMod_RegisterDriver (&moda_mmout_drv);
|
||||||
MikMod_RegisterAllLoaders ();
|
MikMod_RegisterAllLoaders ();
|
||||||
|
|
||||||
if (flags & audio_QUALITY_HIGH)
|
if (flags & audio_QUALITY_HIGH)
|
||||||
@@ -293,7 +392,7 @@ moda_Decode (THIS_PTR, void* buf, sint32 bufsize)
|
|||||||
if (!Player_Active())
|
if (!Player_Active())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
poutsize = ALDRV_SetOutputBuffer (buf, bufsize);
|
poutsize = moda_mmout_SetOutputBuffer (buf, bufsize);
|
||||||
MikMod_Update ();
|
MikMod_Update ();
|
||||||
|
|
||||||
return *poutsize;
|
return *poutsize;
|
||||||
|
|||||||
Reference in New Issue
Block a user