From: <man...@us...> - 2013-12-09 15:30:38
|
Revision: 3424 http://sourceforge.net/p/modplug/code/3424 Author: manxorist Date: 2013-12-09 15:30:28 +0000 (Mon, 09 Dec 2013) Log Message: ----------- [Imp] libopenmpt-modplug: Optionally emulate v0.8.7 style API. [New] libopenmpt build: Add stub make install-modplug target. [Fix] libopenmpt build: Fix libopenmpt_modplug linking. Modified Paths: -------------- trunk/OpenMPT/Makefile trunk/OpenMPT/libopenmpt/libopenmpt_modplug.c Added Paths: ----------- trunk/OpenMPT/include/modplug/include/libmodplug/modplug_0.8.7.h Property Changed: ---------------- trunk/OpenMPT/include/modplug/include/libmodplug/ Modified: trunk/OpenMPT/Makefile =================================================================== --- trunk/OpenMPT/Makefile 2013-12-09 13:37:01 UTC (rev 3423) +++ trunk/OpenMPT/Makefile 2013-12-09 15:30:28 UTC (rev 3424) @@ -447,6 +447,14 @@ #$(INSTALL_DATA_DIR) bin/docs/cpp/man $(DESTDIR)$(PREFIX)/share/doc/man endif +.PHONY: install-modplug +install-modplug: $(OUTPUTS) +ifeq ($(SHARED_LIB),1) + $(INSTALL_DATA) bin/libopenmpt_modplug.so $(DESTDIR)$(PREFIX)/lib/libmodplug.so + $(INSTALL_DATA) bin/libopenmpt_modplug.so $(DESTDIR)$(PREFIX)/lib/libmodplug.so.0 + $(INSTALL_DATA) bin/libopenmpt_modplug.so $(DESTDIR)$(PREFIX)/lib/libmodplug.so.0.0.0 +endif + .PHONY: dist dist: bin/dist.tar @@ -539,7 +547,7 @@ bin/libopenmpt_modplug.so: $(LIBOPENMPT_MODPLUG_OBJECTS) $(OUTPUT_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) -shared $(LDFLAGS_LIBOPENMPT) $^ $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ + $(SILENT)$(LINK.cc) -shared $(LDFLAGS_LIBOPENMPT) $(LIBOPENMPT_MODPLUG_OBJECTS) $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ bin/openmpt123.1: bin/openmpt123$(EXESUFFIX) $(INFO) [HELP2MAN] $@ Index: trunk/OpenMPT/include/modplug/include/libmodplug =================================================================== --- trunk/OpenMPT/include/modplug/include/libmodplug 2013-12-09 13:37:01 UTC (rev 3423) +++ trunk/OpenMPT/include/modplug/include/libmodplug 2013-12-09 15:30:28 UTC (rev 3424) Property changes on: trunk/OpenMPT/include/modplug/include/libmodplug ___________________________________________________________________ Modified: svn:ignore ## -1 +1 ## -* + Added: trunk/OpenMPT/include/modplug/include/libmodplug/modplug_0.8.7.h =================================================================== --- trunk/OpenMPT/include/modplug/include/libmodplug/modplug_0.8.7.h (rev 0) +++ trunk/OpenMPT/include/modplug/include/libmodplug/modplug_0.8.7.h 2013-12-09 15:30:28 UTC (rev 3424) @@ -0,0 +1,168 @@ +/* + * This source code is public domain. + * + * Authors: Kenton Varda <tem...@ga...> (C interface wrapper) + */ + +#ifndef MODPLUG_H__INCLUDED +#define MODPLUG_H__INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +struct _ModPlugFile; +typedef struct _ModPlugFile ModPlugFile; + +struct _ModPlugNote { + unsigned char Note; + unsigned char Instrument; + unsigned char VolumeEffect; + unsigned char Effect; + unsigned char Volume; + unsigned char Parameter; +}; +typedef struct _ModPlugNote ModPlugNote; + +typedef void (*ModPlugMixerProc)(int*, unsigned long, unsigned long); + +/* Load a mod file. [data] should point to a block of memory containing the complete + * file, and [size] should be the size of that block. + * Return the loaded mod file on success, or NULL on failure. */ +ModPlugFile* ModPlug_Load(const void* data, int size); +/* Unload a mod file. */ +void ModPlug_Unload(ModPlugFile* file); + +/* Read sample data into the buffer. Returns the number of bytes read. If the end + * of the mod has been reached, zero is returned. */ +int ModPlug_Read(ModPlugFile* file, void* buffer, int size); + +/* Get the name of the mod. The returned buffer is stored within the ModPlugFile + * structure and will remain valid until you unload the file. */ +const char* ModPlug_GetName(ModPlugFile* file); + +/* Get the length of the mod, in milliseconds. Note that this result is not always + * accurate, especially in the case of mods with loops. */ +int ModPlug_GetLength(ModPlugFile* file); + +/* Seek to a particular position in the song. Note that seeking and MODs don't mix very + * well. Some mods will be missing instruments for a short time after a seek, as ModPlug + * does not scan the sequence backwards to find out which instruments were supposed to be + * playing at that time. (Doing so would be difficult and not very reliable.) Also, + * note that seeking is not very exact in some mods -- especially those for which + * ModPlug_GetLength() does not report the full length. */ +void ModPlug_Seek(ModPlugFile* file, int millisecond); + +enum _ModPlug_Flags +{ + MODPLUG_ENABLE_OVERSAMPLING = 1 << 0, /* Enable oversampling (*highly* recommended) */ + MODPLUG_ENABLE_NOISE_REDUCTION = 1 << 1, /* Enable noise reduction */ + MODPLUG_ENABLE_REVERB = 1 << 2, /* Enable reverb */ + MODPLUG_ENABLE_MEGABASS = 1 << 3, /* Enable megabass */ + MODPLUG_ENABLE_SURROUND = 1 << 4 /* Enable surround sound. */ +}; + +enum _ModPlug_ResamplingMode +{ + MODPLUG_RESAMPLE_NEAREST = 0, /* No interpolation (very fast, extremely bad sound quality) */ + MODPLUG_RESAMPLE_LINEAR = 1, /* Linear interpolation (fast, good quality) */ + MODPLUG_RESAMPLE_SPLINE = 2, /* Cubic spline interpolation (high quality) */ + MODPLUG_RESAMPLE_FIR = 3 /* 8-tap fir filter (extremely high quality) */ +}; + +typedef struct _ModPlug_Settings +{ + int mFlags; /* One or more of the MODPLUG_ENABLE_* flags above, bitwise-OR'ed */ + + /* Note that ModPlug always decodes sound at 44100kHz, 32 bit, stereo and then + * down-mixes to the settings you choose. */ + int mChannels; /* Number of channels - 1 for mono or 2 for stereo */ + int mBits; /* Bits per sample - 8, 16, or 32 */ + int mFrequency; /* Sampling rate - 11025, 22050, or 44100 */ + int mResamplingMode; /* One of MODPLUG_RESAMPLE_*, above */ + + int mReverbDepth; /* Reverb level 0(quiet)-100(loud) */ + int mReverbDelay; /* Reverb delay in ms, usually 40-200ms */ + int mBassAmount; /* XBass level 0(quiet)-100(loud) */ + int mBassRange; /* XBass cutoff in Hz 10-100 */ + int mSurroundDepth; /* Surround level 0(quiet)-100(heavy) */ + int mSurroundDelay; /* Surround delay in ms, usually 5-40ms */ + int mLoopCount; /* Number of times to loop. Zero prevents looping. + -1 loops forever. */ +} ModPlug_Settings; + +/* Get and set the mod decoder settings. All options, except for channels, bits-per-sample, + * sampling rate, and loop count, will take effect immediately. Those options which don't + * take effect immediately will take effect the next time you load a mod. */ +void ModPlug_GetSettings(ModPlug_Settings* settings); +void ModPlug_SetSettings(const ModPlug_Settings* settings); + +/* New ModPlug API Functions */ +/* NOTE: Master Volume (1-512) */ +unsigned int ModPlug_GetMasterVolume(ModPlugFile* file) ; +void ModPlug_SetMasterVolume(ModPlugFile* file,unsigned int cvol) ; + +int ModPlug_GetCurrentSpeed(ModPlugFile* file); +int ModPlug_GetCurrentTempo(ModPlugFile* file); +int ModPlug_GetCurrentOrder(ModPlugFile* file); +int ModPlug_GetCurrentPattern(ModPlugFile* file); +int ModPlug_GetCurrentRow(ModPlugFile* file); +int ModPlug_GetPlayingChannels(ModPlugFile* file); + +void ModPlug_SeekOrder(ModPlugFile* file,int order); +int ModPlug_GetModuleType(ModPlugFile* file); +char* ModPlug_GetMessage(ModPlugFile* file); + + +#ifndef MODPLUG_NO_FILESAVE +/* + * EXPERIMENTAL Export Functions + */ +/*Export to a Scream Tracker 3 S3M module. EXPERIMENTAL (only works on Little-Endian platforms)*/ +char ModPlug_ExportS3M(ModPlugFile* file, const char* filepath); + +/*Export to a Extended Module (XM). EXPERIMENTAL (only works on Little-Endian platforms)*/ +char ModPlug_ExportXM(ModPlugFile* file, const char* filepath); + +/*Export to a Amiga MOD file. EXPERIMENTAL.*/ +char ModPlug_ExportMOD(ModPlugFile* file, const char* filepath); + +/*Export to a Impulse Tracker IT file. Should work OK in Little-Endian & Big-Endian platforms :-) */ +char ModPlug_ExportIT(ModPlugFile* file, const char* filepath); +#endif // MODPLUG_NO_FILESAVE + +unsigned int ModPlug_NumInstruments(ModPlugFile* file); +unsigned int ModPlug_NumSamples(ModPlugFile* file); +unsigned int ModPlug_NumPatterns(ModPlugFile* file); +unsigned int ModPlug_NumChannels(ModPlugFile* file); +unsigned int ModPlug_SampleName(ModPlugFile* file, unsigned int qual, char* buff); +unsigned int ModPlug_InstrumentName(ModPlugFile* file, unsigned int qual, char* buff); + +/* + * Retrieve pattern note-data + */ +ModPlugNote* ModPlug_GetPattern(ModPlugFile* file, int pattern, unsigned int* numrows); + +/* + * ================= + * Mixer callback + * ================= + * + * Use this callback if you want to 'modify' the mixed data of LibModPlug. + * + * void proc(int* buffer,unsigned long channels,unsigned long nsamples) ; + * + * 'buffer': A buffer of mixed samples + * 'channels': N. of channels in the buffer + * 'nsamples': N. of samples in the buffeer (without taking care of n.channels) + * + * (Samples are signed 32-bit integers) + */ +void ModPlug_InitMixerCallback(ModPlugFile* file,ModPlugMixerProc proc) ; +void ModPlug_UnloadMixerCallback(ModPlugFile* file) ; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif Property changes on: trunk/OpenMPT/include/modplug/include/libmodplug/modplug_0.8.7.h ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-chdr \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/OpenMPT/libopenmpt/libopenmpt_modplug.c =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_modplug.c 2013-12-09 13:37:01 UTC (rev 3423) +++ trunk/OpenMPT/libopenmpt/libopenmpt_modplug.c 2013-12-09 15:30:28 UTC (rev 3424) @@ -28,13 +28,20 @@ #include <stdlib.h> #include <string.h> +/* define to emulate 0.8.7 API/ABI instead of 0.8.8 API/ABI */ +/* #define LIBOPENMPT_MODPLUG_0_8_7 */ + #ifdef _MSC_VER /* msvc errors when seeing dllexport declarations after prototypes have been declared in modplug.h */ #define LIBOPENMPT_MODPLUG_API #else /* !_MSC_VER */ #define LIBOPENMPT_MODPLUG_API LIBOPENMPT_API_HELPER_EXPORT #endif /* _MSC_VER */ +#ifdef LIBOPENMPT_MODPLUG_0_8_7 +#include "libmodplug/modplug_0.8.7.h" +#else #include "libmodplug/modplug.h" +#endif /* from libmodplug/sndfile.h */ /* header is not c clean */ @@ -87,9 +94,10 @@ 16, 44100, MODPLUG_RESAMPLE_LINEAR, +#ifndef LIBOPENMPT_MODPLUG_0_8_7 128, 256, - +#endif 0, 0, 0, @@ -133,7 +141,9 @@ openmpt_module_set_repeat_count(file->mod,file->settings.mLoopCount); file->name = openmpt_module_get_metadata(file->mod,"title"); file->message = openmpt_module_get_metadata(file->mod,"message"); +#ifndef LIBOPENMPT_MODPLUG_0_8_7 openmpt_module_set_render_param(file->mod,OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT,file->settings.mStereoSeparation*100/128); +#endif openmpt_module_set_render_param(file->mod,OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH,modplugresamplingmode_to_filterlength(file->settings.mResamplingMode)); return file; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |