Skip to content

Commit

Permalink
Merge pull request #3 from Mindwerks/master
Browse files Browse the repository at this point in the history
Hopefully this works
  • Loading branch information
chrisisonwildcode committed Apr 28, 2014
2 parents 2457d0b + 07320ed commit 07a76a8
Show file tree
Hide file tree
Showing 48 changed files with 5,795 additions and 1,604 deletions.
52 changes: 26 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,36 @@ OPTION(WANT_PLAYER "Build WildMIDI player in addition to the libraries" ON)
OPTION(WANT_STATIC "Build static library in addition to dynamic library" OFF)
OPTION(WANT_ALSA "Include ALSA (Advanced Linux Sound Architecture) support" OFF)
OPTION(WANT_OSS "Include OSS (Open Sound System) support" OFF)
OPTION(WANT_COREAUDIO "Include CoreAudio support (Driver support for Mac OS X" OFF)
#OPTION(WANT_COREAUDIO "Include CoreAudio support (Driver support for Mac OS X" OFF)
OPTION(WANT_OPENAL "Include OpenAL suport (Cross Platform) support" OFF)
IF(UNIX AND NOT APPLE)
SET(WILDMIDI_CFG "/etc/wildmidi/wildmidi.cfg" CACHE STRING "default config location")
ELSE()
SET(WILDMIDI_CFG "wildmidi.cfg" CACHE STRING "default config location")
ENDIF()

# Compiler specific settings
IF(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
# Platform specific defines
IF(UNIX)
# allow 'large' files in 32 bit builds
ADD_DEFINITIONS(
-D_POSIX_C_SOURCE=200809L
-D_BSD_SOURCE=1
-D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGE_FILES
-pedantic
-Wall -W
)
ENDIF()

CHECK_C_COMPILER_FLAG("-std=gnu99" HAVE_STD_GNU99)
CHECK_C_COMPILER_FLAG("-std=c99" HAVE_STD_C99)
IF(HAVE_STD_GNU99)
ADD_DEFINITIONS(-std=gnu99)
ELSEIF(HAVE_STD_C99)
ADD_DEFINITIONS(-std=c99)
ENDIF()
IF(WIN32)
ADD_DEFINITIONS(
-DWIN32_LEAN_AND_MEAN
-D_CRT_SECURE_NO_WARNINGS
)
ENDIF()

IF(CMAKE_COMPILER_IS_MINGW)
# some mingw.org headers are overzealous with __STRICT_ANSI__
# and -std=c99 (not gnu99) defines it
ADD_DEFINITIONS(-U__STRICT_ANSI__)
ENDIF()
# Compiler specific settings
IF(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
ADD_DEFINITIONS(
-Wall -W
)

IF(NOT WIN32 AND NOT CYGWIN)
SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
Expand Down Expand Up @@ -122,34 +119,34 @@ SET(AUDIODRV_OPENAL)

# UNIX-like environments
IF(UNIX AND NOT APPLE)
SET(AUDIO_LIBRARY "")

# Go looking for available sound packages for WildMIDI player
IF(WANT_PLAYER) # Set our preferred output

FIND_PACKAGE(ALSA)
FIND_PACKAGE(OpenAL)
FIND_PACKAGE(OSS)
INCLUDE(FindOpenAL)

IF(WANT_ALSA)
IF(NOT ALSA_FOUND)
MESSAGE(FATAL_ERROR "ALSA required but not found.")
ENDIF()
SET(AUDIODRV_ALSA 1)
SET(AUDIO_LIBRARY ${ALSA_LIBRARY})

ELSEIF(WANT_OSS)
IF(NOT OSS_FOUND)
MESSAGE(FATAL_ERROR "OSS required but not found.")
ENDIF()
# no special header paths
SET(AUDIODRV_OSS 1)
SET(AUDIO_LIBRARY ${OSS_LIBRARY})

ELSEIF(WANT_OPENAL)
IF(NOT OPENAL_FOUND)
MESSAGE(FATAL_ERROR "OpenAL required but not found.")
ENDIF()
SET(AUDIODRV_OPENAL 1)
SET(AUDIO_LIBRARY ${OPENAL_LIBRARY})
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})

ELSE() # Try to auto-detect

Expand All @@ -158,6 +155,7 @@ IF(UNIX AND NOT APPLE)
SET(AUDIODRV_ALSA 1)

ELSEIF(OSS_FOUND)
# no special header paths
SET(AUDIO_LIBRARY ${OSS_LIBRARY})
SET(AUDIODRV_OSS 1)

Expand All @@ -167,6 +165,7 @@ IF(UNIX AND NOT APPLE)

ELSE()
MESSAGE(WARNING "Could not find an audio sub-system!")
SET(AUDIO_LIBRARY "")
ENDIF()

ENDIF()
Expand All @@ -184,7 +183,7 @@ IF(UNIX AND NOT APPLE)
ENDIF(UNIX AND NOT APPLE)

IF (APPLE AND WANT_PLAYER)
INCLUDE(FindOpenAL)
FIND_PACKAGE(OpenAL)

IF(WANT_OPENAL)
IF(NOT OPENAL_FOUND)
Expand All @@ -199,6 +198,7 @@ IF (APPLE AND WANT_PLAYER)

ELSE()
MESSAGE(WARNING "Could not find an audio sub-system!")
SET(AUDIO_LIBRARY "")
ENDIF()

ENDIF()
Expand Down
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ Version: 0.4.0
Licenses: GPLv3+ and LGPLv3
Website: http://www.mindwerks.net/projects/wildmidi

PLATFORMS:
PLAYER AND LIB PLATFORMS:

* Hurd: Debian
* kFreeBSD: Debian, FreeBSD
* Linux: Arch, Debian, Fedora, Ubuntu
* Windows: x32 and x64
* DOS: djgpp

PLAYER SOUND SYSTEMS:

* ALSA
* OSS
* OpenAL
* SB16 (DOS)

BUILD FROM SOURCE:

Expand All @@ -39,11 +47,32 @@ CHANGELOG
* API change: WildMidi_OpenBuffer() and WildMidi_GetOutput() changed
to accept strictly 32bit size parameters, i.e. uint32_t, instead of
unsigned long.
* Support for loading XMI (XMIDI format) files, thanks Ryan Nunn for
releasing his code under the LGPL.
* support for loading MUS (MUS Id format) files, such as from Doom.
* DOS (DJGPP) port, player: Support for Sound Blaster output.
* Build requires cmake-2.8.11 or newer now.

0.3.7
* Plug a memory leak in case of broken midis.

0.3.6
* Fix some portability issues.
* Fix a double-free issue during library shutdown when several midis
were alive.
* Fix the invalid option checking in WildMidi_Init().
* Fix the roundtempo option which had been broken since its invention
in 0.2.3.5 (WM_MO_ROUNDTEMPO: was 0xA000 instead of 0x2000.)
* Fix cfg files without a newline at the end weren't parsed correctly.
* Handle cfg files with mac line-endings.
* Refuse loading suspiciously long files.

0.3.5
* Greatly reduced the heap usage (was a regression introduced in 0.2.3)
* OpenAL support: Fixed audio output on big-endian systems.
* OpenAL support: Fixed audio output on big-endian systems. Fixed audio
skips at song start.
* OSS support: No longer uses mmap mode for better compatibility. This
gains us NetBSD and OpenBSD support.
* Worked around an invalid memory read found by valgrind when playing
Beethoven's Fur Elise.rmi at 44100 Hz using the old MIDIA patch-set
from 1994.
Expand Down
37 changes: 0 additions & 37 deletions cmake/FindALSA.cmake

This file was deleted.

86 changes: 48 additions & 38 deletions cmake/FindOSS.cmake
Original file line number Diff line number Diff line change
@@ -1,57 +1,67 @@
# - Find Oss
# Find Oss headers and libraries.
# - Find OSS
# Find OSS headers and libraries.
#
# OSS_INCLUDE_DIR - where to find soundcard.h, etc.
# OSS_FOUND - True if Oss found.
# OSS_INCLUDE_DIR - where to find soundcard.h, etc.
# OSS_LIBRARY - link library, if any, needed for OSS.
# OSS_FOUND - True if OSS found.


INCLUDE(LibFindMacros)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckCSourceCompiles)

SET(OSS_LIBRARY "")
SET(OSS_INCLUDE_DIR) # system header must suffice
SET(OSS_FOUND)

MESSAGE(STATUS "Looking for OSS...")
CHECK_INCLUDE_FILES(linux/soundcard.h HAVE_LINUX_SOUNDCARD_H)

#CHECK_INCLUDE_FILES(linux/soundcard.h HAVE_LINUX_SOUNDCARD_H) # Linux does provide <sys/soundcard.h>
CHECK_INCLUDE_FILES(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
CHECK_INCLUDE_FILES(machine/soundcard.h HAVE_MACHINE_SOUNDCARD_H)
CHECK_INCLUDE_FILES(soundcard.h HAVE_SOUNDCARD_H) # less common, but exists.

FIND_PATH(LINUX_OSS_INCLUDE_DIR "linux/soundcard.h"
"/usr/include" "/usr/local/include"
)

FIND_PATH(SYS_OSS_INCLUDE_DIR "sys/soundcard.h"
"/usr/include" "/usr/local/include"
)

FIND_PATH(MACHINE_OSS_INCLUDE_DIR "machine/soundcard.h"
"/usr/include" "/usr/local/include"
)

SET(OSS_FOUND FALSE)

IF(LINUX_OSS_INCLUDE_DIR)
SET(OSS_FOUND TRUE)
SET(OSS_INCLUDE_DIR ${LINUX_OSS_INCLUDE_DIR})
# NetBSD and OpenBSD uses ossaudio emulation layer,
# otherwise no link library is needed.
IF(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*|kOpenBSD.*|OpenBSD.*") # AND HAVE_SOUNDCARD_H ???
FIND_LIBRARY(OSSAUDIO_LIBRARIES "ossaudio")
IF(OSSAUDIO_LIBRARIES STREQUAL "OSSAUDIO_LIBRARIES-NOTFOUND")
SET(OSSAUDIO_LIBRARIES)
ELSE()
MESSAGE(STATUS "Found libossaudio: ${OSSAUDIO_LIBRARIES}")
SET(OSS_LIBRARY ${OSSAUDIO_LIBRARIES})
ENDIF()
ELSE()
SET(OSSAUDIO_LIBRARIES)
ENDIF()

IF(SYS_OSS_INCLUDE_DIR)
SET(OSS_FOUND TRUE)
SET(OSS_INCLUDE_DIR ${SYS_OSS_INCLUDE_DIR})
SET(OLD_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
IF(OSSAUDIO_LIBRARIES)
SET(CMAKE_REQUIRED_LIBRARIES ${OSSAUDIO_LIBRARIES})
ENDIF()

IF(MACHINE_OSS_INCLUDE_DIR)
SET(OSS_FOUND TRUE)
SET(OSS_INCLUDE_DIR ${MACHINE_OSS_INCLUDE_DIR})
IF(HAVE_SYS_SOUNDCARD_H)
CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
#include <sys/soundcard.h>
int main() {return SNDCTL_DSP_RESET;}" OSS_FOUND)
ELSEIF(HAVE_MACHINE_SOUNDCARD_H)
CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
#include <machine/soundcard.h>
int main() {return SNDCTL_DSP_RESET;}" OSS_FOUND)
ELSEIF(HAVE_SOUNDCARD_H)
CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
#include <soundcard.h>
int main() {return SNDCTL_DSP_RESET;}" OSS_FOUND)
ENDIF()

SET(CMAKE_REQUIRED_LIBRARIES "${OLD_REQUIRED_LIBRARIES}")

MARK_AS_ADVANCED (
OSS_FOUND
OSS_INCLUDE_DIR
LINUX_OSS_INCLUDE_DIR
SYS_OSS_INCLUDE_DIR
MACHINE_OSS_INCLUDE_DIR
)
OSS_LIBRARY
)

IF(OSS_FOUND)
MESSAGE(STATUS "Found OSS headers.")
ELSE(OSS_FOUND)
FATAL_ERROR(STATUS "Could not find OSS headers!")
ENDIF()
MESSAGE(STATUS "Found OSS.")
ELSE()
MESSAGE(STATUS "Could not find OSS.")
ENDIF()
Loading

0 comments on commit 07a76a8

Please sign in to comment.