Commit e0d34168 authored by bret curtis's avatar bret curtis

Imported Upstream version 0.3.3

parent b66d02a6
......@@ -2,12 +2,15 @@
PROJECT(wildmidi)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Version
# WildMIDI Version
SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 3)
SET(VERSION_RELEASE 2)
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}")
SET(SOVERSION 1.0.2)
SET(WILDMIDI_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}")
# Lib Versions
SET(SOVERSION 1)
SET(VERSION 1.0.2)
# Find Macros
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
......@@ -25,7 +28,7 @@ MESSAGE(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
# Set our optoins
OPTION(WANT_PLAYER "Build WildMIDI player in addition to the libraries" ON)
OPTION(WANT_STATIC "Link WildMIDI to the static libwildmidi library" OFF)
OPTION(WANT_STATIC "Build static library in addition to dynamic library" OFF)
OPTION(WANT_ALSA "Include ALSA (Advanced Linux Sound Architecture) support" ON)
OPTION(WANT_OSS "Include OSS (Open Sound System) support" OFF)
OPTION(WANT_COREAUDIO "Include CoreAudio support (Driver support for Mac OS X" OFF)
......@@ -36,11 +39,18 @@ ENDIF(WANT_OSS)
# Compiler specific settings
IF(CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS( -std=c99 -D_POSIX_C_SOURCE=200809L -pedantic -Wall -Wextra -W )
ADD_DEFINITIONS(
-std=c99
-D_POSIX_C_SOURCE=200809L
-pedantic
-fvisibility=hidden
-Wall -Wextra -W
)
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS( -ggdb3 -O0)
ADD_DEFINITIONS( -ggdb3 -O0 )
ELSEIF(CMAKE_BUILD_TYPE STREQUAL "Release")
ADD_DEFINITIONS( -O3)
ADD_DEFINITIONS( -O3 )
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
......@@ -51,13 +61,15 @@ SET(WILDMIDI_CFG "wildmidi.cfg")
IF(NOT WIN32 AND NOT APPLE)
# go looking for available sound packages for WildMIDI player
IF(WANT_PLAYER AND WANT_ALSA)
FIND_PACKAGE(ALSA REQUIRED)
ELSEIF(WANT_PLAYER AND WANT_OSS)
FIND_PACKAGE(OSS REQUIRED)
ELSE(WANT_PLAYER AND WANT_ALSA)
MESSAGE(FATAL_ERROR "You must choose either ALSA or OSS.")
ENDIF(WANT_PLAYER AND WANT_ALSA)
IF(WANT_PLAYER)
IF(WANT_ALSA)
FIND_PACKAGE(ALSA REQUIRED)
ELSEIF(WANT_OSS)
FIND_PACKAGE(OSS REQUIRED)
ELSE(WANT_ALSA)
MESSAGE(FATAL_ERROR "You must choose either ALSA or OSS.")
ENDIF(WANT_ALSA)
ENDIF(WANT_PLAYER)
# find our math lib
FIND_LIBRARY(M_LIBRARY m REQUIRED)
......@@ -98,4 +110,7 @@ ELSE (APPLE)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${wildmidi_BINARY_DIR}")
ENDIF (APPLE)
# Setup up our config file
CONFIGURE_FILE ("${CMAKE_SOURCE_DIR}/include/config.h.cmake" "${CMAKE_SOURCE_DIR}/include/config.h")
ADD_SUBDIRECTORY(src)
For the player see docs/GPLv3.txt
For the player see docs/license/GPLv3.txt
For the library see docs/LGPLv3.txt
For the library see docs/license/LGPLv3.txt
......@@ -23,6 +23,7 @@
GNU Lesser General Public License along with WildMIDI. If not, see
<http://www.gnu.org/licenses/>.
*/
#include "config.h"
#ifndef __COMMON_H
#define __COMMON_H
......@@ -42,20 +43,7 @@
#define SAMPLE_CONVERT_DEBUG(dx)
#endif
// Guspat Envelope Rate Timings
// Row 1 = (4095.0/(x*(1.0/(1.6*14.0)))) / 1000000.0
// Row 2 = (4095.0/(x*((1.0/(1.6*14.0))/8.0)))) / 1000000.0
// Row 3 = (4095.0/(x*((1.0/(1.6*14.0))/64.0))) / 1000000.0
// Row 4 = (4095.0/(x*((1.0/(1.6*14.0))/512.0))) / 1000000.0
static float env_time_table[] = {
0.0f, 0.091728000f, 0.045864000f, 0.030576000f, 0.022932000f, 0.018345600f, 0.015288000f, 0.013104000f, 0.011466000f, 0.010192000f, 0.009172800f, 0.008338909f, 0.007644000f, 0.007056000f, 0.006552000f, 0.006115200f, 0.005733000f, 0.005395765f, 0.005096000f, 0.004827789f, 0.004586400f, 0.004368000f, 0.004169455f, 0.003988174f, 0.003822000f, 0.003669120f, 0.003528000f, 0.003397333f, 0.003276000f, 0.003163034f, 0.003057600f, 0.002958968f, 0.002866500f, 0.002779636f, 0.002697882f, 0.002620800f, 0.002548000f, 0.002479135f, 0.002413895f, 0.002352000f, 0.002293200f, 0.002237268f, 0.002184000f, 0.002133209f, 0.002084727f, 0.002038400f, 0.001994087f, 0.001951660f, 0.001911000f, 0.001872000f, 0.001834560f, 0.001798588f, 0.001764000f, 0.001730717f, 0.001698667f, 0.001667782f, 0.001638000f, 0.001609263f, 0.001581517f, 0.001554712f, 0.001528800f, 0.001503738f, 0.001479484f, 0.001456000f,
0.0f, 0.733824000f, 0.366912000f, 0.244608000f, 0.183456000f, 0.146764800f, 0.122304000f, 0.104832000f, 0.091728000f, 0.081536000f, 0.073382400f, 0.066711273f, 0.061152000f, 0.056448000f, 0.052416000f, 0.048921600f, 0.045864000f, 0.043166118f, 0.040768000f, 0.038622316f, 0.036691200f, 0.034944000f, 0.033355636f, 0.031905391f, 0.030576000f, 0.029352960f, 0.028224000f, 0.027178667f, 0.026208000f, 0.025304276f, 0.024460800f, 0.023671742f, 0.022932000f, 0.022237091f, 0.021583059f, 0.020966400f, 0.020384000f, 0.019833081f, 0.019311158f, 0.018816000f, 0.018345600f, 0.017898146f, 0.017472000f, 0.017065674f, 0.016677818f, 0.016307200f, 0.015952696f, 0.015613277f, 0.015288000f, 0.014976000f, 0.014676480f, 0.014388706f, 0.014112000f, 0.013845736f, 0.013589333f, 0.013342255f, 0.013104000f, 0.012874105f, 0.012652138f, 0.012437695f, 0.012230400f, 0.012029902f, 0.011835871f, 0.011648000f,
0.0f, 5.870592000f, 2.935296000f, 1.956864000f, 1.467648000f, 1.174118400f, 0.978432000f, 0.838656000f, 0.733824000f, 0.652288000f, 0.587059200f, 0.533690182f, 0.489216000f, 0.451584000f, 0.419328000f, 0.391372800f, 0.366912000f, 0.345328941f, 0.326144000f, 0.308978526f, 0.293529600f, 0.279552000f, 0.266845091f, 0.255243130f, 0.244608000f, 0.234823680f, 0.225792000f, 0.217429333f, 0.209664000f, 0.202434207f, 0.195686400f, 0.189373935f, 0.183456000f, 0.177896727f, 0.172664471f, 0.167731200f, 0.163072000f, 0.158664649f, 0.154489263f, 0.150528000f, 0.146764800f, 0.143185171f, 0.139776000f, 0.136525395f, 0.133422545f, 0.130457600f, 0.127621565f, 0.124906213f, 0.122304000f, 0.119808000f, 0.117411840f, 0.115109647f, 0.112896000f, 0.110765887f, 0.108714667f, 0.106738036f, 0.104832000f, 0.102992842f, 0.101217103f, 0.099501559f, 0.097843200f, 0.096239213f, 0.094686968f, 0.093184000f,
0.0f, 46.964736000f, 23.482368000f, 15.654912000f, 11.741184000f, 9.392947200f, 7.827456000f, 6.709248000f, 5.870592000f, 5.218304000f, 4.696473600f, 4.269521455f, 3.913728000f, 3.612672000f, 3.354624000f, 3.130982400f, 2.935296000f, 2.762631529f, 2.609152000f, 2.471828211f, 2.348236800f, 2.236416000f, 2.134760727f, 2.041945043f, 1.956864000f, 1.878589440f, 1.806336000f, 1.739434667f, 1.677312000f, 1.619473655f, 1.565491200f, 1.514991484f, 1.467648000f, 1.423173818f, 1.381315765f, 1.341849600f, 1.304576000f, 1.269317189f, 1.235914105f, 1.204224000f, 1.174118400f, 1.145481366f, 1.118208000f, 1.092203163f, 1.067380364f, 1.043660800f, 1.020972522f, 0.999249702f, 0.978432000f, 0.958464000f, 0.939294720f, 0.920877176f, 0.903168000f, 0.886127094f, 0.869717333f, 0.853904291f, 0.838656000f, 0.823942737f, 0.809736828f, 0.796012475f, 0.782745600f, 0.769913705f, 0.757495742f, 0.745472000f
};
extern unsigned short int WM_SampleRate;
extern unsigned short int WM_SampleRate;
struct _sample {
unsigned long int data_length;
......@@ -95,6 +83,22 @@ struct _patch {
struct _patch *next;
};
/* Set our global defines here */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_LN2
#define M_LN2 0.69314718055994530942
#endif
/* Define this if the GCC __builtin_expect keyword is available */
#ifndef __builtin_expect
#define __builtin_expect(x,c) x
#endif
#ifndef inline
#define inline __inline
#endif
#endif // __COMMON_H
......@@ -13,36 +13,44 @@
#define PACKAGE_NAME "WildMidi"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "WildMidi @VERSION@"
#define PACKAGE_STRING "WildMidi @WILDMIDI_VERSION@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "wildmidi"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@VERSION@"
#define PACKAGE_VERSION "@WILDMIDI_VERSION@"
/* Version number of package */
#define VERSION "@VERSION@"
#define VERSION "@WILDMIDI_VERSION@"
/* Define this to the location of the wildmidi config file */
#define WILDMIDI_CFG "@WILDMIDI_CFG@"
/* Set our global defines here */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/* Define this if the GCC __builtin_expect keyword is available */
#ifndef __builtin_expect
#define __builtin_expect(x,c) x
#endif
#ifndef inline
#define inline __inline
#endif
/* Define our audio drivers */
#cmakedefine HAVE_ALSA_H
#cmakedefine HAVE_LINUX_SOUNDCARD_H
#cmakedefine HAVE_SYS_SOUNDCARD_H
#cmakedefine HAVE_MACHINE_SOUNDCARD_H
\ No newline at end of file
#cmakedefine HAVE_MACHINE_SOUNDCARD_H
/* set some windows magic */
#define WIN32_LEAN_AND_MEAN
/* set our symbol export visiblity */
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define SYMBOL __attribute__ ((dllexport))
#else
#define SYMBOL __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
#endif
#else
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
#define SYMBOL __attribute__ ((visibility ("default")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define SYMBOL __hidden
#elif __GNUC__ >= 4
#define SYMBOL __attribute__ ((visibility ("default")))
#else
#define SYMBOL
#endif
#endif
\ No newline at end of file
......@@ -28,6 +28,8 @@
#ifndef __FILE_IO_H
#define __FILE_IO_H
extern unsigned char * WM_BufferFile (const char *filename, unsigned long int *size);
#include "config.h"
extern unsigned char * WM_BufferFile (const char *filename, unsigned long int *size);
#endif // __FILE_IO_H
#ifndef __GETOPT_LONG_H__
#define __GETOPT_LONG_H__
#include "config.h"
#ifdef __cplusplus
extern "C" {
#endif
......@@ -23,8 +25,8 @@ struct option
#define required_argument 1
#define optional_argument 2
int getopt(int, char**, char*);
int getopt_long(int, char**, char*, const struct option*, int*);
int getopt(int, char**, char*);
int getopt_long(int, char**, char*, const struct option*, int*);
#ifdef __cplusplus
}
......
......@@ -27,6 +27,20 @@
#ifndef __GUS_PAT_H
#define __GUS_PAT_H
extern struct _sample * load_gus_pat (char * filename, int fix_release);
#include "config.h"
// Guspat Envelope Rate Timings
// Row 1 = (4095.0/(x*(1.0/(1.6*14.0)))) / 1000000.0
// Row 2 = (4095.0/(x*((1.0/(1.6*14.0))/8.0)))) / 1000000.0
// Row 3 = (4095.0/(x*((1.0/(1.6*14.0))/64.0))) / 1000000.0
// Row 4 = (4095.0/(x*((1.0/(1.6*14.0))/512.0))) / 1000000.0
static float env_time_table[] = {
0.0f, 0.091728000f, 0.045864000f, 0.030576000f, 0.022932000f, 0.018345600f, 0.015288000f, 0.013104000f, 0.011466000f, 0.010192000f, 0.009172800f, 0.008338909f, 0.007644000f, 0.007056000f, 0.006552000f, 0.006115200f, 0.005733000f, 0.005395765f, 0.005096000f, 0.004827789f, 0.004586400f, 0.004368000f, 0.004169455f, 0.003988174f, 0.003822000f, 0.003669120f, 0.003528000f, 0.003397333f, 0.003276000f, 0.003163034f, 0.003057600f, 0.002958968f, 0.002866500f, 0.002779636f, 0.002697882f, 0.002620800f, 0.002548000f, 0.002479135f, 0.002413895f, 0.002352000f, 0.002293200f, 0.002237268f, 0.002184000f, 0.002133209f, 0.002084727f, 0.002038400f, 0.001994087f, 0.001951660f, 0.001911000f, 0.001872000f, 0.001834560f, 0.001798588f, 0.001764000f, 0.001730717f, 0.001698667f, 0.001667782f, 0.001638000f, 0.001609263f, 0.001581517f, 0.001554712f, 0.001528800f, 0.001503738f, 0.001479484f, 0.001456000f,
0.0f, 0.733824000f, 0.366912000f, 0.244608000f, 0.183456000f, 0.146764800f, 0.122304000f, 0.104832000f, 0.091728000f, 0.081536000f, 0.073382400f, 0.066711273f, 0.061152000f, 0.056448000f, 0.052416000f, 0.048921600f, 0.045864000f, 0.043166118f, 0.040768000f, 0.038622316f, 0.036691200f, 0.034944000f, 0.033355636f, 0.031905391f, 0.030576000f, 0.029352960f, 0.028224000f, 0.027178667f, 0.026208000f, 0.025304276f, 0.024460800f, 0.023671742f, 0.022932000f, 0.022237091f, 0.021583059f, 0.020966400f, 0.020384000f, 0.019833081f, 0.019311158f, 0.018816000f, 0.018345600f, 0.017898146f, 0.017472000f, 0.017065674f, 0.016677818f, 0.016307200f, 0.015952696f, 0.015613277f, 0.015288000f, 0.014976000f, 0.014676480f, 0.014388706f, 0.014112000f, 0.013845736f, 0.013589333f, 0.013342255f, 0.013104000f, 0.012874105f, 0.012652138f, 0.012437695f, 0.012230400f, 0.012029902f, 0.011835871f, 0.011648000f,
0.0f, 5.870592000f, 2.935296000f, 1.956864000f, 1.467648000f, 1.174118400f, 0.978432000f, 0.838656000f, 0.733824000f, 0.652288000f, 0.587059200f, 0.533690182f, 0.489216000f, 0.451584000f, 0.419328000f, 0.391372800f, 0.366912000f, 0.345328941f, 0.326144000f, 0.308978526f, 0.293529600f, 0.279552000f, 0.266845091f, 0.255243130f, 0.244608000f, 0.234823680f, 0.225792000f, 0.217429333f, 0.209664000f, 0.202434207f, 0.195686400f, 0.189373935f, 0.183456000f, 0.177896727f, 0.172664471f, 0.167731200f, 0.163072000f, 0.158664649f, 0.154489263f, 0.150528000f, 0.146764800f, 0.143185171f, 0.139776000f, 0.136525395f, 0.133422545f, 0.130457600f, 0.127621565f, 0.124906213f, 0.122304000f, 0.119808000f, 0.117411840f, 0.115109647f, 0.112896000f, 0.110765887f, 0.108714667f, 0.106738036f, 0.104832000f, 0.102992842f, 0.101217103f, 0.099501559f, 0.097843200f, 0.096239213f, 0.094686968f, 0.093184000f,
0.0f, 46.964736000f, 23.482368000f, 15.654912000f, 11.741184000f, 9.392947200f, 7.827456000f, 6.709248000f, 5.870592000f, 5.218304000f, 4.696473600f, 4.269521455f, 3.913728000f, 3.612672000f, 3.354624000f, 3.130982400f, 2.935296000f, 2.762631529f, 2.609152000f, 2.471828211f, 2.348236800f, 2.236416000f, 2.134760727f, 2.041945043f, 1.956864000f, 1.878589440f, 1.806336000f, 1.739434667f, 1.677312000f, 1.619473655f, 1.565491200f, 1.514991484f, 1.467648000f, 1.423173818f, 1.381315765f, 1.341849600f, 1.304576000f, 1.269317189f, 1.235914105f, 1.204224000f, 1.174118400f, 1.145481366f, 1.118208000f, 1.092203163f, 1.067380364f, 1.043660800f, 1.020972522f, 0.999249702f, 0.978432000f, 0.958464000f, 0.939294720f, 0.920877176f, 0.903168000f, 0.886127094f, 0.869717333f, 0.853904291f, 0.838656000f, 0.823942737f, 0.809736828f, 0.796012475f, 0.782745600f, 0.769913705f, 0.757495742f, 0.745472000f
};
extern struct _sample * load_gus_pat (char * filename, int fix_release);
#endif // __GUS_PAT_H
......@@ -25,7 +25,9 @@
#ifndef __LOCK_H
#define __LOCK_H
extern void WM_Lock (int * wmlock);
extern void WM_Unlock (int *wmlock);
#include "config.h"
extern void WM_Lock (int * wmlock);
extern void WM_Unlock (int *wmlock);
#endif // __LOCK_H
......@@ -27,6 +27,8 @@
#ifndef __REVERB_H
#define __REVERB_H
#include "config.h"
struct _rvb {
/* filter data */
signed long int l_buf_flt_in[8][6][2];
......@@ -49,9 +51,9 @@ struct _rvb {
unsigned long int max_reverb_time;
};
extern void reset_reverb (struct _rvb *rvb);
extern struct _rvb *init_reverb(int rate, float room_x, float room_y, float listen_x, float listen_y);
extern void free_reverb (struct _rvb *rvb);
extern void do_reverb (struct _rvb *rvb, signed long int *buffer, int size);
extern void reset_reverb (struct _rvb *rvb);
extern struct _rvb *init_reverb(int rate, float room_x, float room_y, float listen_x, float listen_y);
extern void free_reverb (struct _rvb *rvb);
extern void do_reverb (struct _rvb *rvb, signed long int *buffer, int size);
#endif // __REVERB_H
......@@ -45,19 +45,19 @@ struct _WM_Info {
typedef void midi;
extern const char * WildMidi_GetString (unsigned short int info);
extern int WildMidi_Init (const char * config_file, unsigned short int rate, unsigned short int options);
extern int WildMidi_MasterVolume (unsigned char master_volume);
extern midi * WildMidi_Open (const char *midifile);
extern midi * WildMidi_OpenBuffer (unsigned char *midibuffer, unsigned long int size);
extern int WildMidi_GetOutput (midi * handle, char * buffer, unsigned long int size);
extern int WildMidi_SetOption (midi * handle, unsigned short int options, unsigned short int setting);
extern struct _WM_Info * WildMidi_GetInfo ( midi * handle );
extern int WildMidi_FastSeek ( midi * handle, unsigned long int *sample_pos);
extern int WildMidi_Close (midi * handle);
extern int WildMidi_Shutdown ( void );
SYMBOL extern const char * WildMidi_GetString (unsigned short int info);
SYMBOL extern int WildMidi_Init (const char * config_file, unsigned short int rate, unsigned short int options);
SYMBOL extern int WildMidi_MasterVolume (unsigned char master_volume);
SYMBOL extern midi * WildMidi_Open (const char *midifile);
SYMBOL extern midi * WildMidi_OpenBuffer (unsigned char *midibuffer, unsigned long int size);
SYMBOL extern int WildMidi_GetOutput (midi * handle, char * buffer, unsigned long int size);
SYMBOL extern int WildMidi_SetOption (midi * handle, unsigned short int options, unsigned short int setting);
SYMBOL extern struct _WM_Info * WildMidi_GetInfo ( midi * handle );
SYMBOL extern int WildMidi_FastSeek ( midi * handle, unsigned long int *sample_pos);
SYMBOL extern int WildMidi_Close (midi * handle);
SYMBOL extern int WildMidi_Shutdown ( void );
#ifdef _WIN32
extern char *strdup(const char *str);
extern char *strdup(const char *str);
#endif
// NOTE: Not Yet Implemented Or Tested Properly
......
......@@ -24,6 +24,8 @@
<http://www.gnu.org/licenses/>.
*/
#include "config.h"
#ifndef __WM_ERROR_H
#define __WM_ERROR_H
......@@ -38,12 +40,12 @@
#define WM_ERR_INVALID_ARG 8
#define WM_ERR_ALR_INIT 9
extern void WM_ERROR_NEW(const char * wmfmt, ...)
extern void WM_ERROR_NEW(const char * wmfmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 1, 2))) // for tracking down formatting issues
#endif
;
extern void WM_ERROR(const char * func, unsigned long int lne, int wmerno,
extern void WM_ERROR(const char * func, unsigned long int lne, int wmerno,
const char * wmfor, int error);
#endif //__WM_ERROR_H
# Setup up our config file
CONFIGURE_FILE ("${CMAKE_SOURCE_DIR}/include/config.h.cmake" "${CMAKE_SOURCE_DIR}/include/config.h")
# Setup our wildmidi library that we link to
SET(wildmidi_library_SRCS
wm_error.c
......@@ -18,104 +15,91 @@ SET(wildmidi_executable_HDRS)
SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}")
SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}")
MESSAGE(STATUS "${CMAKE_BINARY_DIR}")
# actual target:
ADD_LIBRARY(wildmidi_static STATIC
${wildmidi_library_SRCS}
)
INSTALL(TARGETS wildmidi_static DESTINATION lib)
TARGET_LINK_LIBRARIES(wildmidi_static
${ALSA_LIBRARY}
${OSS_LIBRARY}
${M_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
)
IF(WIN32)
# set our library names
IF(WIN32) # windows uses *.lib for both static and dynamic, workaround
SET(LIBRARY_DYN_NAME "wildmidi_dynamic")
SET(LIBRARY_STATIC_NAME "wildmidi_static")
ELSE(WIN32)
SET(LIBRARY_DYN_NAME "wildmidi")
SET(LIBRARY_STATIC_NAME "wildmidi")
ELSE(WIN32) # everyone else uses .a and .so
SET(LIBRARY_DYN_NAME "WildMidi")
SET(LIBRARY_STATIC_NAME "WildMidi")
ENDIF(WIN32)
SET_TARGET_PROPERTIES(wildmidi_static PROPERTIES
OUTPUT_NAME ${LIBRARY_STATIC_NAME} CLEAN_DIRECT_OUTPUT 1
)
# do we want a static library?
IF(WANT_STATIC)
ADD_LIBRARY(wildmidi_static STATIC
${wildmidi_library_SRCS}
)
TARGET_LINK_LIBRARIES(wildmidi_static
${M_LIBRARY}
)
SET_TARGET_PROPERTIES(wildmidi_static PROPERTIES
OUTPUT_NAME ${LIBRARY_STATIC_NAME} CLEAN_DIRECT_OUTPUT 1
)
ENDIF(WANT_STATIC)
# always build our dynamic library
ADD_LIBRARY(wildmidi_dynamic SHARED
${wildmidi_library_SRCS}
)
INSTALL(TARGETS wildmidi_dynamic DESTINATION lib)
INSTALL(FILES ../include/wildmidi_lib.h DESTINATION include)
TARGET_LINK_LIBRARIES(wildmidi_dynamic
${ALSA_LIBRARY}
${OSS_LIBRARY}
${M_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
)
SET_TARGET_PROPERTIES(wildmidi_dynamic PROPERTIES
SOVERSION ${SOVERSION}
SOVERSION ${SOVERSION}
VERSION ${VERSION}
OUTPUT_NAME ${LIBRARY_DYN_NAME} CLEAN_DIRECT_OUTPUT 1
)
# Set our default and then look at the possible locations
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}/lib${LIBRARY_DYN_NAME}.so")
IF(WANT_STATIC)
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}/lib${LIBRARY_STATIC_NAME}.a")
ENDIF(WANT_STATIC)
# MS Visual Studio
IF(MSVC)
SET(GETOPT getopt.c getopt_long.c)
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}\\${CMAKE_BUILD_TYPE}\\${LIBRARY_DYN_NAME}.lib")
IF(WANT_STATIC)
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}\\${CMAKE_BUILD_TYPE}\\${LIBRARY_STATIC_NAME}.lib")
ENDIF(WANT_STATIC)
ELSEIF(CMAKE_GENERATOR STREQUAL "Xcode")
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libwildmidi.dylib")
IF(WANT_STATIC)
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libwildmidi.a")
ENDIF(WANT_STATIC)
ENDIF(MSVC)
# Setup our wildmidi player
SET(wildmidi_executable_SRCS
${GETOPT}
wildmidi.c
)
ADD_EXECUTABLE(wildmidi
${wildmidi_executable_SRCS}
)
ADD_DEPENDENCIES(wildmidi wildmidi_static wildmidi_dynamic)
TARGET_LINK_LIBRARIES(wildmidi
${WILDMIDILIB}
${ALSA_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
# Apple's Xcode
IF(CMAKE_GENERATOR STREQUAL "Xcode")
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib${LIBRARY_DYN_NAME}.dylib")
ELSEIF(APPLE) # Apple's CLI default
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}/lib${LIBRARY_DYN_NAME}.dylib")
ENDIF(CMAKE_GENERATOR STREQUAL "Xcode")
# do we want the wildmidi player?
IF(WANT_PLAYER)
SET(wildmidi_executable_SRCS
${GETOPT}
wildmidi.c
)
ADD_EXECUTABLE(wildmidi
${wildmidi_executable_SRCS}
)
ADD_DEPENDENCIES(wildmidi wildmidi_static wildmidi_dynamic)
TARGET_LINK_LIBRARIES(wildmidi
${WILDMIDILIB}
${ALSA_LIBRARY}
${OSS_LIBRARY}
${M_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
)
ENDIF(WANT_PLAYER)
# add install target:
IF (UNIX AND NOT APPLE)
# set legacy soversion
SET(legacy_target "lib${LIBRARY_DYN_NAME}.so.${SOVERSION}")
SET(legacy_link "lib${LIBRARY_DYN_NAME}.so.1")
EXECUTE_PROCESS(COMMAND ln -sf ${legacy_target} ${legacy_link})
INSTALL(FILES ${CMAKE_BINARY_DIR}/${legacy_link} DESTINATION lib)
# install our libraries
INSTALL(TARGETS wildmidi_static DESTINATION "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
IF(WANT_STATIC)
INSTALL(TARGETS wildmidi_static DESTINATION "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
ENDIF(WANT_STATIC)
INSTALL(TARGETS wildmidi_dynamic DESTINATION "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
# install our player if asked for
......@@ -126,4 +110,4 @@ IF (UNIX AND NOT APPLE)
# install supporting man pages and headers
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/wildmidi_lib.h DESTINATION include)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/docs/man/ DESTINATION share/man)
ENDIF (UNIX AND NOT APPLE)
\ No newline at end of file
ENDIF (UNIX AND NOT APPLE)
......@@ -26,8 +26,6 @@
<http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
......
......@@ -24,8 +24,6 @@
<http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
......
......@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "gus_pat.h"
#include "common.h"
#include "wm_error.h"
......@@ -58,7 +57,7 @@
*/
/* 8bit signed */
int convert_8s(unsigned char *data, struct _sample *gus_sample) {
int convert_8s(unsigned char *data, struct _sample *gus_sample) {
unsigned char *read_data = data;
unsigned char *read_end = data + gus_sample->data_length;
signed short int *write_data = NULL;
......@@ -81,7 +80,7 @@ int convert_8s(unsigned char *data, struct _sample *gus_sample) {
}
/* 8bit signed ping pong */
int convert_8sp(unsigned char *data, struct _sample *gus_sample) {
int convert_8sp(unsigned char *data, struct _sample *gus_sample) {
unsigned long int loop_length = gus_sample->loop_end
- gus_sample->loop_start;
unsigned long int dloop_length = loop_length * 2;
......@@ -133,7 +132,7 @@ int convert_8sp(unsigned char *data, struct _sample *gus_sample) {
}
/* 8bit signed reverse */
int convert_8sr(unsigned char *data, struct _sample *gus_sample) {
int convert_8sr(unsigned char *data, struct _sample *gus_sample) {
unsigned char *read_data = data;
unsigned char *read_end = data + gus_sample->data_length;
signed short int *write_data = NULL;
......@@ -160,7 +159,7 @@ int convert_8sr(unsigned char *data, struct _sample *gus_sample) {
}
/* 8bit signed reverse ping pong */
int convert_8srp(unsigned char *data, struct _sample *gus_sample) {
int convert_8srp(unsigned char *data, struct _sample *gus_sample) {
unsigned long int loop_length = gus_sample->loop_end
- gus_sample->loop_start;
unsigned long int dloop_length = loop_length * 2;
......@@ -211,7 +210,7 @@ int convert_8srp(unsigned char *data, struct _sample *gus_sample) {
}
/* 8bit unsigned */
int convert_8u(unsigned char *data, struct _sample *gus_sample) {
int convert_8u(unsigned char *data, struct _sample *gus_sample) {
unsigned char *read_data = data;
unsigned char *read_end = data + gus_sample->data_length;
signed short int *write_data = NULL;
......@@ -232,7 +231,7 @@ int convert_8u(unsigned char *data, struct _sample *gus_sample) {
}
/* 8bit unsigned ping pong */
int convert_8up(unsigned char *data, struct _sample *gus_sample) {
int convert_8up(unsigned char *data, struct _sample *gus_sample) {
unsigned long int loop_length = gus_sample->loop_end
- gus_sample->loop_start;
unsigned long int dloop_length = loop_length * 2;
......@@ -284,7 +283,7 @@ int convert_8up(unsigned char *data, struct _sample *gus_sample) {
}
/* 8bit unsigned reverse */
int convert_8ur(unsigned char *data, struct _sample *gus_sample) {
int convert_8ur(unsigned char *data, struct _sample *gus_sample) {
unsigned char *read_data = data;
unsigned char *read_end = data + gus_sample->data_length;
signed short int *write_data = NULL;
......@@ -311,7 +310,7 @@ int convert_8ur(unsigned char *data, struct _sample *gus_sample) {
}
/* 8bit unsigned reverse ping pong */
int convert_8urp(unsigned char *data, struct _sample *gus_sample) {
int convert_8urp(unsigned char *data, struct _sample *gus_sample) {
unsigned long int loop_length = gus_sample->loop_end
- gus_sample->loop_start;
unsigned long int dloop_length = loop_length * 2;
......@@ -361,7 +360,7 @@ int convert_8urp(unsigned char *data, struct _sample *gus_sample) {
}
/* 16bit signed */
int convert_16s(unsigned char *data, struct _sample *gus_sample) {
int convert_16s(unsigned char *data, struct _sample *gus_sample) {
unsigned char *read_data = data;
unsigned char *read_end = data + gus_sample->data_length;
signed short int *write_data = NULL;
......@@ -386,7 +385,7 @@ int convert_16s(unsigned char *data, struct _sample *gus_sample) {
}
/* 16bit signed ping pong */
int convert_16sp(unsigned char *data, struct _sample *gus_sample) {
int convert_16sp(unsigned char *data, struct _sample *gus_sample) {
unsigned long int loop_length = gus_sample->loop_end
- gus_sample->loop_start;
unsigned long int dloop_length = loop_length * 2;
......@@ -447,7 +446,7 @@ int convert_16sp(unsigned char *data, struct _sample *gus_sample) {
}
/* 16bit signed reverse */
int convert_16sr(unsigned char *data, struct _sample *gus_sample) {
int convert_16sr(unsigned char *data, struct _sample *gus_sample) {
unsigned char *read_data = data;
unsigned char *read_end = data + gus_sample->data_length;
signed short int *write_data = NULL;
......@@ -478,7 +477,7 @@ int convert_16sr(unsigned char *data, struct _sample *gus_sample) {
}
/* 16bit signed reverse ping pong */
int convert_16srp(unsigned char *data, struct _sample *gus_sample) {
int convert_16srp(unsigned char *data, struct _sample *gus_sample) {
unsigned long int loop_length = gus_sample->loop_end
- gus_sample->loop_start;
unsigned long int dloop_length = loop_length * 2;
......@@ -535,7 +534,7 @@ int convert_16srp(unsigned char *data, struct _sample *gus_sample) {
}
/* 16bit unsigned */
int convert_16u(unsigned char *data, struct _sample *gus_sample) {
int convert_16u(unsigned char *data, struct _sample *gus_sample) {
unsigned char *read_data = data;
unsigned char *read_end = data + gus_sample->data_length;
signed short int *write_data = NULL;
......@@ -560,7 +559,7 @@ int convert_16u(unsigned char *data, struct _sample *gus_sample) {
}
/* 16bit unsigned ping pong */
int convert_16up(unsigned char *data, struct _sample *gus_sample) {
int convert_16up(unsigned char *data, struct _sample *gus_sample) {
unsigned long int loop_length = gus_sample->loop_end
- gus_sample->loop_start;
unsigned long int dloop_length = loop_length * 2;
......@@ -621,7 +620,7 @@ int convert_16up(unsigned char *data, struct _sample *gus_sample) {
}
/* 16bit unsigned reverse */
int convert_16ur(unsigned char *data, struct _sample *gus_sample) {
int convert_16ur(unsigned char *data, struct _sample *gus_sample) {
unsigned char *read_data = data;
unsigned char *read_end = data + gus_sample->data_length;
signed short int *write_data = NULL;
......@@ -652,7 +651,7 @@ int convert_16ur(unsigned char *data, struct _sample *gus_sample) {
}
/* 16bit unsigned reverse ping pong */
int convert_16urp(unsigned char *data, struct _sample *gus_sample) {
int convert_16urp(unsigned char *data, struct _sample *gus_sample) {
unsigned long int loop_length = gus_sample->loop_end
- gus_sample->loop_start;
unsigned long int dloop_length = loop_length * 2;
......
......@@ -24,8 +24,6 @@
<http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include "internal_midi.h"
......
......@@ -29,8 +29,8 @@
#include <unistd.h>
#endif
#include "config.h"
#include "lock.h"
#include "common.h"
/*
WL_Lock(wmlock)
......