removed libmodplug

This commit is contained in:
nehalmistry 2004-04-26 03:12:00 +00:00
parent 4e062958b2
commit ef672a905d
6 changed files with 6 additions and 149 deletions

View file

@ -37,7 +37,7 @@ CROSSDIR = /usr/local/cross
INCLUDE_DIRS = src/include src/movie/vp31/include
MODULES = src/action src/ai src/beos src/stratagus src/editor src/game src/libmodplug src/map \
MODULES = src/action src/ai src/beos src/stratagus src/editor src/game src/map \
src/missile src/movie src/movie/vp31 src/network src/pathfinder src/sound src/ui src/unit \
src/video etlib

View file

@ -52,7 +52,7 @@ OBJDIR=@OBJDIR@
IFLAGS= -I$(TOPDIR)/src/include $(XIFLAGS) -I$(TOPDIR)/src/movie/vp31/include
CFLAGS=@EXTRA_CFLAGS@ @PROFILE_CFLAGS@ @DEBUG_CFLAGS@ $(IFLAGS) \
-DUSE_LIBMODPLUG -DUSE_HP_FOR_XP -DMAP_REGIONS \
-DUSE_HP_FOR_XP -DMAP_REGIONS \
@PROFILE_CFLAGS@ @DEBUG_CFLAGS@ @VIDEO_CFLAGS@ @BZ2_CFLAGS@ \
@OGG_CFLAGS@ @MAD_CFLAGS@ @FLAC_CFLAGS@ @CDAUDIO_CFLAGS@ \
@LUA_CFLAGS@ $(CCL) $(VERSION) $(COMP_CFLAGS) @PLATFORM@ \

View file

@ -194,7 +194,6 @@ IFLAGS= -I$(TOPDIR)/src/include $(XIFLAGS) -I$(TOPDIR)/src/movie/vp31/include
## USE_TILECACHE Faster tile drawing, costs memory.
## USE_SMART_TILECACHE Faster tile drawing, slow with hardware video memory.
## USE_HP_FOR_XP Use hit-points for XP calculations.
## USE_LIBMODPLUG Use modplug audio player support.
## USE_SDLCD Use the SDL cd player support.
## USE_LIBCDA Use the LIBCDA cd player support.
## USE_FLAC Use flac audio player support.

View file

@ -40,10 +40,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef USE_LIBMODPLUG
#include "../libmodplug/modplug.h"
#endif
#ifdef USE_SDL
#include "SDL.h"
#endif
@ -67,7 +63,7 @@
-- Variables
----------------------------------------------------------------------------*/
#if defined(USE_OGG) || defined(USE_FLAC) || defined(USE_MAD) || defined(USE_LIBMODPLUG)
#if defined(USE_OGG) || defined(USE_FLAC) || defined(USE_MAD)
global Sample* MusicSample; /// Music samples
#endif
@ -90,7 +86,7 @@ global void StopMusic(void)
{
if (PlayingMusic) {
PlayingMusic = 0; // Callback!
#if defined(USE_OGG) || defined(USE_FLAC) || defined(USE_MAD) || defined(USE_LIBMODPLUG)
#if defined(USE_OGG) || defined(USE_FLAC) || defined(USE_MAD)
if (MusicSample) {
#ifdef USE_SDL
SDL_LockAudio();
@ -106,125 +102,6 @@ global void StopMusic(void)
}
}
#ifdef USE_LIBMODPLUG
/**
** Read next samples from libmodplug object.
**
** @param o pointer to object.
** @param buf buffer to fill.
** @param len length of buffer in bytes.
**
** @return Number of bytes filled.
*/
local int ModRead(Sample* o, void* buf, int len)
{
return ModPlug_Read(o->User, buf, len);
}
/**
** Free the sample of libmodplug object.
**
** @param o pointer to object.
*/
local void ModFree(Sample* o)
{
ModPlug_Unload(o->User);
free(o);
}
/**
** Libmodplug object type structure.
*/
local const SampleType ModSampleType = {
ModRead,
ModFree,
};
/**
** Load a mod file.
**
** @param name A possible mod file.
** @param flags Load flags.
**
** @return Sample to mix the mod, if the file is a mod.
**
** @todo If CL supports file size query, loading can be done
** faster, perhaps we can rewrite modplug to support
** streaming.
*/
local Sample* LoadMod(const char* name,int flags __attribute__((unused)))
{
ModPlug_Settings settings;
ModPlugFile* modfile;
Sample* sample;
CLFile* f;
char* buffer;
int size;
int i;
int ticks;
int n;
ticks = GetTicks();
DebugLevel0Fn("Trying `%s'\n" _C_ name);
if (!(f = CLopen(name,CL_OPEN_READ))) {
printf("Can't open file `%s'\n", name);
return NULL;
}
// Load complete file into memory, with realloc = slow
size = 0;
n = 16384;
buffer = malloc(n);
while ((i = CLread(f, buffer + size, n)) == n) {
size += n;
if (n < 1024 * 1024) {
n <<= 1;
} else {
n = 2 * 1024 * 1024;
}
buffer = realloc(buffer, size + n);
}
size += i;
buffer = realloc(buffer, size);
CLclose(f);
StopMusic(); // stop music before new music
ModPlug_GetSettings(&settings); // Conversion settings
settings.mFrequency = SoundFrequency;
#ifdef USE_LIBMODPLUG32
settings.mBits = 32;
#else
settings.mBits = 16;
#endif
settings.mLoopCount = 0; // Disable looping
ModPlug_SetSettings(&settings);
modfile = ModPlug_Load(buffer, size);
free(buffer);
if (modfile) {
DebugLevel0Fn("Started ticks %ld\n" _C_ GetTicks() - ticks);
sample = malloc(sizeof(*sample));
sample->Type = &ModSampleType;
sample->User = modfile;
sample->Channels = 2;
#ifdef USE_LIBMODPLUG32
sample->SampleSize = 32;
#else
sample->SampleSize = 16;
#endif
sample->Frequency = SoundFrequency;
sample->Length = 0;
return sample;
}
return NULL;
}
#endif
/**
** FIXME: docu
*/
@ -330,7 +207,7 @@ global void PlaySectionMusic(PlaySectionType section)
global int PlayMusic(const char* name)
{
char buffer[PATH_MAX];
#if defined(USE_OGG) || defined(USE_FLAC) || defined(USE_MAD) || defined(USE_LIBMODPLUG)
#if defined(USE_OGG) || defined(USE_FLAC) || defined(USE_MAD)
Sample* sample;
#endif
@ -395,13 +272,6 @@ global int PlayMusic(const char* name)
PlayingMusic = 1;
return 1;
}
#endif
#ifdef USE_LIBMODPLUG
if ((sample = LoadMod(name, PlayAudioStream))) {
MusicSample = sample;
PlayingMusic = 1;
return 1;
}
#endif
return 0;
}

View file

@ -38,11 +38,6 @@
#include <stdio.h>
#include "stratagus.h"
#if !defined(USE_LIBMODPLUG) && !defined(noUSE_LIBMODPLUG)
#define USE_LIBMODPLUG /// Include lib modplug support
#endif
#define _USE_LIBMODPLUG32 /// Test with 32bit resolution
#include <stdlib.h>
#include <string.h>
#ifndef _MSC_VER
@ -66,10 +61,6 @@
#include "cdaudio.h"
#include "script.h"
#ifdef USE_LIBMODPLUG
#include "../libmodplug/modplug.h"
#endif
#ifdef USE_GLIB
#include <glib.h>
#else
@ -120,7 +111,7 @@ SDL_mutex * MusicTerminatedMutex;
-- Functions
----------------------------------------------------------------------------*/
#if defined(USE_OGG) || defined(USE_FLAC) || defined(USE_MAD) || defined(USE_LIBMODPLUG) || defined(USE_CDDA)
#if defined(USE_OGG) || defined(USE_FLAC) || defined(USE_MAD) || defined(USE_CDDA)
/**

View file

@ -727,9 +727,6 @@ local void PrintHeader(void)
// vvv---- looks weird, but is needed for GNU brain damage
fprintf(stdout, "%s\n written by Lutz Sammer, Fabrice Rossi, Vladi Shabanski, Patrice Fortier,\n Jon Gabrielson, Andreas Arens, Nehal Mistry, Jimmy Salmon and others.\n"
"\t(http://Stratagus.Org)"
#ifdef USE_LIBMODPLUG
"\n libmodplug Copyright by Kenton Varda & Olivier Lapique."
#endif
"\n VP3 codec Copyright by On2 Technologies Inc."
#ifdef USE_SDL
"\n SDL Copyright by Sam Lantinga."