forked from Mirrors/openclonk
win32: Unbreak fmod, remove MCI
USE_FMOD define renamed to HAVE_FMOD to bring it in line with HAVE_SDL_MIXER. MCI removed since nobody was using it anyway, and half of its functions were stubs.
parent
4bda27997c
commit
0dc14ae40e
|
@ -327,8 +327,6 @@ set(OC_CLONK_SOURCES
|
|||
src/platform/C4Video.h
|
||||
src/platform/C4VideoPlayback.cpp
|
||||
src/platform/C4VideoPlayback.h
|
||||
src/platform/Midi.cpp
|
||||
src/platform/Midi.h
|
||||
src/platform/OpenURL.cpp
|
||||
src/platform/StdConfig.cpp
|
||||
src/platform/StdConfig.h
|
||||
|
@ -561,7 +559,6 @@ endif()
|
|||
option(USE_SDL_MAINLOOP "Use SDL to create windows etc." ${INITIAL_USE_SDL_MAINLOOP_VALUE})
|
||||
if(WIN32)
|
||||
option(USE_DIRECTX "Enable DirectX support" ON)
|
||||
option(USE_FMOD "Enable FMOD support" ON)
|
||||
if(EXISTS $ENV{DXSDK_DIR})
|
||||
include_directories(SYSTEM $ENV{DXSDK_DIR}/Include)
|
||||
if(${FIND_LIBRARY_USE_LIB64_PATHS})
|
||||
|
@ -572,7 +569,7 @@ if(WIN32)
|
|||
endif()
|
||||
else()
|
||||
SET(USE_DIRECTX OFF)
|
||||
SET(USE_FMOD OFF)
|
||||
SET(HAVE_FMOD OFF)
|
||||
endif()
|
||||
if(UNIX)
|
||||
option(USE_X11 "Use X11 to create windows etc." ON)
|
||||
|
@ -632,7 +629,6 @@ endif()
|
|||
############################################################################
|
||||
# Generate output files
|
||||
############################################################################
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
add_executable(clonk WIN32 MACOSX_BUNDLE
|
||||
${OC_SYSTEM_SOURCES}
|
||||
|
@ -723,12 +719,6 @@ if(USE_DIRECTX)
|
|||
${DIRECT3DX_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
if(USE_FMOD)
|
||||
FINDLIB(FMOD_LIBRARIES fmodvc)
|
||||
target_link_libraries(clonk
|
||||
${FMOD_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
if(USE_GTK)
|
||||
include(FindPkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
|
@ -768,16 +758,35 @@ if (WIN32)
|
|||
target_link_libraries(c4group
|
||||
${WS2_LIBRARIES}
|
||||
)
|
||||
|
||||
if(MSVC_VERSION)
|
||||
FINDLIB(FMOD_LIBRARIES fmodvc)
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
FINDLIB(FMOD_LIBRARIES fmod)
|
||||
endif()
|
||||
if(FMOD_LIBRARIES)
|
||||
set(HAVE_FMOD TRUE)
|
||||
target_link_libraries(clonk
|
||||
${FMOD_LIBRARIES}
|
||||
)
|
||||
else()
|
||||
set(HAVE_FMOD FALSE)
|
||||
endif()
|
||||
endif()
|
||||
include(FindSDL)
|
||||
SET(HAVE_SDL ${SDL_FOUND})
|
||||
if(SDL_FOUND)
|
||||
include_directories(${SDL_INCLUDE_DIR})
|
||||
FINDLIB(SDLMIXER_LIBRARIES SDL_mixer)
|
||||
SET(HAVE_LIBSDL_MIXER ${SDLMIXER})
|
||||
target_link_libraries(clonk
|
||||
${SDL_LIBRARY}
|
||||
${SDLMIXER_LIBRARIES}
|
||||
)
|
||||
if(NOT HAVE_FMOD)
|
||||
include(FindSDL)
|
||||
SET(HAVE_SDL ${SDL_FOUND})
|
||||
if(SDL_FOUND)
|
||||
include_directories(${SDL_INCLUDE_DIR})
|
||||
FINDLIB(SDLMIXER_LIBRARIES SDL_mixer)
|
||||
if(SDLMIXER_LIBRARIES)
|
||||
SET(HAVE_LIBSDL_MIXER ON)
|
||||
endif()
|
||||
target_link_libraries(clonk
|
||||
${SDL_LIBRARY}
|
||||
${SDLMIXER_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
/* Define to 1 if you have SDL_mixer. */
|
||||
#cmakedefine HAVE_LIBSDL_MIXER 1
|
||||
|
||||
/* Define to 1 if FMOD is available */
|
||||
#cmakedefine HAVE_FMOD 1
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#cmakedefine HAVE_LOCALE_H 1
|
||||
|
||||
|
@ -152,9 +155,6 @@
|
|||
/* DirectX graphics */
|
||||
#cmakedefine USE_DIRECTX 1
|
||||
|
||||
/* Wether FMOD shall be used */
|
||||
#cmakedefine USE_FMOD 1
|
||||
|
||||
/* OpenGL graphics */
|
||||
#cmakedefine USE_GL 1
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
// Include all headers for precompilation.
|
||||
// Keep C4Include.h the last include.
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "C4Application.h"
|
||||
#include "C4FullScreen.h"
|
||||
#include "C4Game.h"
|
||||
|
@ -161,7 +164,6 @@
|
|||
#include "platform/C4SoundSystem.h"
|
||||
#include "platform/C4Video.h"
|
||||
#include "platform/C4VideoPlayback.h"
|
||||
#include "platform/Midi.h"
|
||||
#include "platform/StdConfig.h"
|
||||
#include "platform/StdD3D.h"
|
||||
#include "platform/StdD3DShader.h"
|
||||
|
|
|
@ -64,11 +64,6 @@
|
|||
// solidmask debugging
|
||||
//#define SOLIDMASK_DEBUG
|
||||
|
||||
// fmod
|
||||
#if defined USE_FMOD && !defined HAVE_SDL_MIXER
|
||||
#define C4SOUND_USE_FMOD
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
|
|
|
@ -27,10 +27,9 @@
|
|||
#include <C4Application.h>
|
||||
#include <C4Log.h>
|
||||
|
||||
#ifdef USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
#include <fmod_errors.h>
|
||||
#endif
|
||||
#include <Midi.h>
|
||||
|
||||
/* helpers */
|
||||
|
||||
|
@ -60,45 +59,7 @@ bool C4MusicFile::Init(const char *szFile)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* midi */
|
||||
|
||||
#ifdef USE_WINDOWS_MIDI
|
||||
bool C4MusicFileMID::Play(bool loop)
|
||||
{
|
||||
|
||||
// check existance
|
||||
if(!FileExists(FileName))
|
||||
// try extracting it
|
||||
if(!ExtractFile())
|
||||
// doesn't exist - or file is corrupt
|
||||
return false;
|
||||
|
||||
// Play Song
|
||||
PlayMidi(SongExtracted ? Config.AtTempPath(C4CFN_TempMusic2) : FileName, Application.hWindow);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4MusicFileMID::Stop(int fadeout_ms)
|
||||
{
|
||||
// stop song
|
||||
StopMidi();
|
||||
// delete temp file
|
||||
RemTempFile();
|
||||
}
|
||||
|
||||
void C4MusicFileMID::CheckIfPlaying()
|
||||
{
|
||||
// windows will send the message
|
||||
}
|
||||
|
||||
void C4MusicFileMID::SetVolume(int iLevel)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_FMOD
|
||||
#if defined HAVE_FMOD
|
||||
bool C4MusicFileMID::Play(bool loop)
|
||||
{
|
||||
// check existance
|
||||
|
@ -336,9 +297,8 @@ void C4MusicFileOgg::SetVolume(int iLevel)
|
|||
{
|
||||
FSOUND_SetVolume(Channel, (int) ((iLevel * 255) / 100));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
#elif defined HAVE_LIBSDL_MIXER
|
||||
C4MusicFileSDL::C4MusicFileSDL():
|
||||
Data(NULL),
|
||||
Music(NULL)
|
||||
|
|
|
@ -23,10 +23,9 @@
|
|||
#ifndef INC_C4MusicFile
|
||||
#define INC_C4MusicFile
|
||||
|
||||
#ifdef USE_FMOD
|
||||
#if defined HAVE_FMOD
|
||||
#include <fmod.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
#elif defined HAVE_LIBSDL_MIXER
|
||||
#define USE_RWOPS
|
||||
#include <SDL_mixer.h>
|
||||
#undef USE_RWOPS
|
||||
|
@ -61,7 +60,7 @@ protected:
|
|||
bool SongExtracted;
|
||||
|
||||
};
|
||||
#if defined(USE_FMOD) || defined(USE_WINDOWS_MIDI)
|
||||
#if defined HAVE_FMOD
|
||||
class C4MusicFileMID : public C4MusicFile
|
||||
{
|
||||
public:
|
||||
|
@ -71,14 +70,10 @@ class C4MusicFileMID : public C4MusicFile
|
|||
void CheckIfPlaying();
|
||||
//C4MusicFileMID();
|
||||
void SetVolume(int);
|
||||
#ifdef USE_FMOD
|
||||
protected:
|
||||
FMUSIC_MODULE *mod;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef USE_FMOD
|
||||
/* MOD class */
|
||||
|
||||
class C4MusicFileMOD : public C4MusicFile
|
||||
|
@ -132,9 +127,8 @@ protected:
|
|||
|
||||
bool Playing;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
#elif defined HAVE_LIBSDL_MIXER
|
||||
typedef struct _Mix_Music Mix_Music;
|
||||
class C4MusicFileSDL : public C4MusicFile
|
||||
{
|
||||
|
|
|
@ -34,11 +34,9 @@
|
|||
#include <C4Game.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
|
||||
#include <Midi.h>
|
||||
#ifdef USE_FMOD
|
||||
#if defined HAVE_FMOD
|
||||
#include <fmod_errors.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
#elif defined HAVE_LIBSDL_MIXER
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
|
@ -66,7 +64,7 @@ C4MusicSystem::~C4MusicSystem()
|
|||
|
||||
bool C4MusicSystem::InitializeMOD()
|
||||
{
|
||||
#ifdef USE_FMOD
|
||||
#if defined HAVE_FMOD
|
||||
#ifdef _WIN32
|
||||
// Debug code
|
||||
switch(Config.Sound.FMMode)
|
||||
|
@ -98,8 +96,7 @@ bool C4MusicSystem::InitializeMOD()
|
|||
// ok
|
||||
MODInitialized = true;
|
||||
return true;
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
#elif defined HAVE_LIBSDL_MIXER
|
||||
SDL_version compile_version;
|
||||
const SDL_version * link_version;
|
||||
MIX_VERSION(&compile_version);
|
||||
|
@ -126,14 +123,13 @@ bool C4MusicSystem::InitializeMOD()
|
|||
|
||||
void C4MusicSystem::DeinitializeMOD()
|
||||
{
|
||||
#ifdef USE_FMOD
|
||||
#if defined HAVE_FMOD
|
||||
FSOUND_StopSound(FSOUND_ALL); /* to prevent some hangs in FMOD */
|
||||
#ifdef DEBUG
|
||||
Sleep(0);
|
||||
#endif
|
||||
FSOUND_Close();
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
#elif defined HAVE_LIBSDL_MIXER
|
||||
Mix_CloseAudio();
|
||||
SDL_Quit();
|
||||
#endif
|
||||
|
@ -210,7 +206,7 @@ void C4MusicSystem::Load(const char *szFile)
|
|||
if (!szFile || !*szFile) return;
|
||||
C4MusicFile *NewSong=NULL;
|
||||
// get extension
|
||||
#ifdef USE_FMOD
|
||||
#if defined HAVE_FMOD
|
||||
const char *szExt = GetExtension(szFile);
|
||||
// get type
|
||||
switch (GetMusicFileTypeByExtension(GetExtension(szFile)))
|
||||
|
@ -230,8 +226,7 @@ void C4MusicSystem::Load(const char *szFile)
|
|||
NewSong = new C4MusicFileMID;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
#elif defined HAVE_LIBSDL_MIXER
|
||||
if (GetMusicFileTypeByExtension(GetExtension(szFile)) == MUSICTYPE_UNKNOWN) return;
|
||||
NewSong = new C4MusicFileSDL;
|
||||
#endif
|
||||
|
@ -484,7 +479,7 @@ MusicType GetMusicFileTypeByExtension(const char* ext)
|
|||
{
|
||||
if (SEqualNoCase(ext, "mid"))
|
||||
return MUSICTYPE_MID;
|
||||
#if defined USE_FMOD || defined HAVE_LIBSDL_MIXER
|
||||
#if defined HAVE_FMOD || defined HAVE_LIBSDL_MIXER
|
||||
else if (SEqualNoCase(ext, "xm") || SEqualNoCase(ext, "it") || SEqualNoCase(ext, "s3m") || SEqualNoCase(ext, "mod"))
|
||||
return MUSICTYPE_MOD;
|
||||
#ifdef USE_MP3
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
C4SoundEffect::C4SoundEffect():
|
||||
UsageTime (0),
|
||||
Instances (0),
|
||||
#if defined C4SOUND_USE_FMOD || defined HAVE_LIBSDL_MIXER
|
||||
#if defined HAVE_FMOD || defined HAVE_LIBSDL_MIXER
|
||||
pSample (NULL),
|
||||
#endif
|
||||
Static (false),
|
||||
|
@ -52,13 +52,13 @@ C4SoundEffect::~C4SoundEffect()
|
|||
void C4SoundEffect::Clear()
|
||||
{
|
||||
while(FirstInst) RemoveInst(FirstInst);
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
if (pSample) FSOUND_Sample_Free(pSample);
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
if (pSample) Mix_FreeChunk(pSample);
|
||||
#endif
|
||||
#if defined C4SOUND_USE_FMOD || defined HAVE_LIBSDL_MIXER
|
||||
#if defined HAVE_FMOD || defined HAVE_LIBSDL_MIXER
|
||||
pSample = NULL;
|
||||
#endif
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ bool C4SoundEffect::Load(BYTE *pData, size_t iDataLen, bool fStatic, bool fRaw)
|
|||
// Sound check
|
||||
if (!Config.Sound.RXSound) return false;
|
||||
// load directly from memory
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
int32_t iOptions = FSOUND_NORMAL | FSOUND_2D | FSOUND_LOADMEMORY;
|
||||
if (fRaw) iOptions |= FSOUND_LOADRAW;
|
||||
if(!(pSample = FSOUND_Sample_Load(FSOUND_UNMANAGED, (const char *)pData,
|
||||
|
@ -253,7 +253,7 @@ bool C4SoundInstance::CheckStart()
|
|||
|
||||
bool C4SoundInstance::Start()
|
||||
{
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
// Start
|
||||
if((iChannel = FSOUND_PlaySound(FSOUND_FREE, pEffect->pSample)) == -1)
|
||||
return false;
|
||||
|
@ -283,7 +283,7 @@ bool C4SoundInstance::Stop()
|
|||
if(!pEffect) return false;
|
||||
// Stop sound
|
||||
bool fRet = true;
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
if(Playing())
|
||||
fRet = !! FSOUND_StopSound(iChannel);
|
||||
#endif
|
||||
|
@ -301,7 +301,7 @@ bool C4SoundInstance::Stop()
|
|||
bool C4SoundInstance::Playing()
|
||||
{
|
||||
if(!pEffect) return false;
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
if(fLooping) return true;
|
||||
return isStarted() ? FSOUND_GetCurrentSample(iChannel) == pEffect->pSample
|
||||
: timeGetTime() < iStarted + pEffect->Length;
|
||||
|
@ -336,7 +336,7 @@ void C4SoundInstance::Execute()
|
|||
// stop, if started
|
||||
if(isStarted())
|
||||
{
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
FSOUND_StopSound(iChannel);
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
|
@ -352,7 +352,7 @@ void C4SoundInstance::Execute()
|
|||
if(!CheckStart())
|
||||
return;
|
||||
// set volume & panning
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
FSOUND_SetVolume(iChannel, BoundBy(iVol / 100, 0, 255));
|
||||
FSOUND_SetPan(iChannel, BoundBy(256*(iPan+100)/200,0,255));
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <C4Group.h>
|
||||
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
#include <fmod.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
int32_t UsageTime, Instances;
|
||||
int32_t SampleRate, Length;
|
||||
bool Static;
|
||||
#ifdef C4SOUND_USE_FMOD
|
||||
#ifdef HAVE_FMOD
|
||||
FSOUND_SAMPLE *pSample;
|
||||
#endif
|
||||
#ifdef HAVE_LIBSDL_MIXER
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* OpenClonk, http://www.openclonk.org
|
||||
*
|
||||
* Copyright (c) 1998-2000 Matthes Bender
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
/* Play midis using mci */
|
||||
|
||||
#include "C4Include.h"
|
||||
#include <Standard.h>
|
||||
|
||||
#ifdef HAVE_MIDI_H
|
||||
#include <mmsystem.h>
|
||||
#include <midi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
bool PlayMidi(const char *sFileName, HWND appWnd)
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, "open \"%s\" type sequencer alias ITSMYMUSIC", sFileName);
|
||||
if (mciSendString("close all", NULL, 0, NULL) != 0)
|
||||
return false;
|
||||
if (mciSendString(buf, NULL, 0, NULL) != 0)
|
||||
return false;
|
||||
if (mciSendString("play ITSMYMUSIC from 0 notify", NULL, 0, appWnd) != 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PauseMidi()
|
||||
{
|
||||
if (mciSendString("stop ITSMYMUSIC", NULL, 0, NULL) != 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResumeMidi(HWND appWnd)
|
||||
{
|
||||
if (mciSendString("play ITSMYMUSIC notify", NULL, 0, appWnd) != 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StopMidi()
|
||||
{
|
||||
if (mciSendString("close all", NULL, 0, NULL) != 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReplayMidi(HWND appWnd)
|
||||
{
|
||||
if (mciSendString("play ITSMYMUSIC from 0 notify", NULL, 0, appWnd) != 0) return false;
|
||||
return true;
|
||||
}
|
||||
#endif //HAVE_MIDI_H
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* OpenClonk, http://www.openclonk.org
|
||||
*
|
||||
* Copyright (c) 1998-2000 Matthes Bender
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
/* Play midis using mci */
|
||||
/*
|
||||
bool PlayMidi(const char *sFileName, HWND appWnd);
|
||||
bool PauseMidi();
|
||||
bool ResumeMidi(HWND appWnd);
|
||||
bool StopMidi();
|
||||
bool ReplayMidi(HWND appWnd);
|
||||
*/
|
Loading…
Reference in New Issue