mirror of
https://github.com/love2d/love.git
synced 2026-08-21 13:09:56 +02:00
Remove unused GME sound decoder backend.
This commit is contained in:
@@ -893,8 +893,6 @@ set(LOVE_SRC_MODULE_SOUND_ROOT
|
||||
set(LOVE_SRC_MODULE_SOUND_LULLABY
|
||||
src/modules/sound/lullaby/FLACDecoder.cpp
|
||||
src/modules/sound/lullaby/FLACDecoder.h
|
||||
src/modules/sound/lullaby/GmeDecoder.cpp
|
||||
src/modules/sound/lullaby/GmeDecoder.h
|
||||
src/modules/sound/lullaby/ModPlugDecoder.cpp
|
||||
src/modules/sound/lullaby/ModPlugDecoder.h
|
||||
src/modules/sound/lullaby/MP3Decoder.h
|
||||
|
||||
@@ -54,9 +54,6 @@ with_clean_luaversion=`printf ${with_luaversion} | sed 's/\.//g'`
|
||||
# Generated sources for enabling/disabling modules
|
||||
m4_include([configure-modules-pre.ac])
|
||||
|
||||
# Other features that can be enabled/disabled
|
||||
AC_ARG_ENABLE([gme], AC_HELP_STRING([--enable-gme], [Enable GME support, for more chiptuney goodness]), [], [enable_gme=no])
|
||||
|
||||
# Dependencies we always use
|
||||
ACLOVE_DEP_LUA
|
||||
ACLOVE_DEP_SDL2
|
||||
@@ -72,7 +69,6 @@ AS_VAR_IF([enable_module_sound], [yes], [
|
||||
ACLOVE_DEP_VORBISFILE
|
||||
], [])
|
||||
AS_VAR_IF([enable_module_video], [yes], [ACLOVE_DEP_THEORA], [])
|
||||
AS_VAR_IF([enable_gme], [yes], [ACLOVE_DEP_GME], [])
|
||||
|
||||
# Add flags for optional libraries
|
||||
AC_ARG_ENABLE([library-enet], [ --disable-library-enet Turn off library enet], [], [enable_library_enet=yes])
|
||||
|
||||
@@ -35,11 +35,6 @@ AC_DEFUN([ACLOVE_DEP_MPG123], [
|
||||
AC_SUBST([FILE_OFFSET],[-D_FILE_OFFSET_BITS=64]),
|
||||
AC_SUBST([FILE_OFFSET],[]))])
|
||||
|
||||
AC_DEFUN([ACLOVE_DEP_GME], [
|
||||
AC_SEARCH_LIBS([gme_open_data], [gme], [], [LOVE_MSG_ERROR([gme])])
|
||||
AC_DEFINE([LOVE_SUPPORT_GME], [], [Enable gme])
|
||||
AC_CHECK_HEADER([gme/gme.h], [includes="$includes -I/usr/include/gme"], [])])
|
||||
|
||||
# For enet
|
||||
AC_DEFUN([ACLOVE_SOCKLEN_T], [
|
||||
AC_CHECK_TYPE([socklen_t], [AC_DEFINE([HAS_SOCKLEN_T], [1], [Define if socklen_t exists.] )], ,
|
||||
|
||||
@@ -526,9 +526,6 @@
|
||||
FA0B7E8B1A95902C000E1D17 /* FLACDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C821A95902C000E1D17 /* FLACDecoder.cpp */; };
|
||||
FA0B7E8C1A95902C000E1D17 /* FLACDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C821A95902C000E1D17 /* FLACDecoder.cpp */; };
|
||||
FA0B7E8D1A95902C000E1D17 /* FLACDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C831A95902C000E1D17 /* FLACDecoder.h */; };
|
||||
FA0B7E8E1A95902C000E1D17 /* GmeDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C841A95902C000E1D17 /* GmeDecoder.cpp */; };
|
||||
FA0B7E8F1A95902C000E1D17 /* GmeDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C841A95902C000E1D17 /* GmeDecoder.cpp */; };
|
||||
FA0B7E901A95902C000E1D17 /* GmeDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C851A95902C000E1D17 /* GmeDecoder.h */; };
|
||||
FA0B7E911A95902C000E1D17 /* ModPlugDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C861A95902C000E1D17 /* ModPlugDecoder.cpp */; };
|
||||
FA0B7E921A95902C000E1D17 /* ModPlugDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7C861A95902C000E1D17 /* ModPlugDecoder.cpp */; };
|
||||
FA0B7E931A95902C000E1D17 /* ModPlugDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7C871A95902C000E1D17 /* ModPlugDecoder.h */; };
|
||||
@@ -1699,8 +1696,6 @@
|
||||
FA0B7C801A95902C000E1D17 /* Decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decoder.cpp; sourceTree = "<group>"; };
|
||||
FA0B7C821A95902C000E1D17 /* FLACDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FLACDecoder.cpp; sourceTree = "<group>"; };
|
||||
FA0B7C831A95902C000E1D17 /* FLACDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLACDecoder.h; sourceTree = "<group>"; };
|
||||
FA0B7C841A95902C000E1D17 /* GmeDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GmeDecoder.cpp; sourceTree = "<group>"; };
|
||||
FA0B7C851A95902C000E1D17 /* GmeDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GmeDecoder.h; sourceTree = "<group>"; };
|
||||
FA0B7C861A95902C000E1D17 /* ModPlugDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModPlugDecoder.cpp; sourceTree = "<group>"; };
|
||||
FA0B7C871A95902C000E1D17 /* ModPlugDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModPlugDecoder.h; sourceTree = "<group>"; };
|
||||
FA0B7C8A1A95902C000E1D17 /* Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sound.cpp; sourceTree = "<group>"; };
|
||||
@@ -3199,8 +3194,6 @@
|
||||
FA0B7C7F1A95902C000E1D17 /* CoreAudioDecoder.h */,
|
||||
FA0B7C821A95902C000E1D17 /* FLACDecoder.cpp */,
|
||||
FA0B7C831A95902C000E1D17 /* FLACDecoder.h */,
|
||||
FA0B7C841A95902C000E1D17 /* GmeDecoder.cpp */,
|
||||
FA0B7C851A95902C000E1D17 /* GmeDecoder.h */,
|
||||
FA0B7C861A95902C000E1D17 /* ModPlugDecoder.cpp */,
|
||||
FA0B7C871A95902C000E1D17 /* ModPlugDecoder.h */,
|
||||
FA522D4B23F9FE370059EE3C /* MP3Decoder.cpp */,
|
||||
@@ -4023,7 +4016,6 @@
|
||||
FAF140871E20934C00F898D2 /* parseVersions.h in Headers */,
|
||||
FA0B7AC61A958EA3000E1D17 /* types.h in Headers */,
|
||||
FA0B7DBD1A95902C000E1D17 /* Joystick.h in Headers */,
|
||||
FA0B7E901A95902C000E1D17 /* GmeDecoder.h in Headers */,
|
||||
FA0B7D0E1A95902C000E1D17 /* wrap_Filesystem.h in Headers */,
|
||||
FA0B7EE41A95902D000E1D17 /* Window.h in Headers */,
|
||||
FA0B7CFC1A95902C000E1D17 /* Filesystem.h in Headers */,
|
||||
@@ -4517,7 +4509,6 @@
|
||||
FADF54081E3D78F700012CC0 /* Video.cpp in Sources */,
|
||||
FA9D8DD81DEF8411002CD881 /* Data.cpp in Sources */,
|
||||
FABDA9992552448300B5C523 /* b2_contact_manager.cpp in Sources */,
|
||||
FA0B7E8F1A95902C000E1D17 /* GmeDecoder.cpp in Sources */,
|
||||
FADF542B1E3DAADA00012CC0 /* wrap_Mesh.cpp in Sources */,
|
||||
FA0B7CD71A95902C000E1D17 /* Audio.cpp in Sources */,
|
||||
FA0B7AC01A958EA3000E1D17 /* host.c in Sources */,
|
||||
@@ -4940,7 +4931,6 @@
|
||||
FABDA9982552448300B5C523 /* b2_contact_manager.cpp in Sources */,
|
||||
FADF542A1E3DAADA00012CC0 /* wrap_Mesh.cpp in Sources */,
|
||||
FA0B7D2B1A95902C000E1D17 /* wrap_Rasterizer.cpp in Sources */,
|
||||
FA0B7E8E1A95902C000E1D17 /* GmeDecoder.cpp in Sources */,
|
||||
FA0B7CD61A95902C000E1D17 /* Audio.cpp in Sources */,
|
||||
FA3C5E421F8C368C0003C579 /* ShaderStage.cpp in Sources */,
|
||||
FA0B7EAF1A95902C000E1D17 /* System.cpp in Sources */,
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2022 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#include "common/config.h"
|
||||
|
||||
#ifdef LOVE_SUPPORT_GME
|
||||
|
||||
#include "common/Exception.h"
|
||||
#include "GmeDecoder.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
{
|
||||
namespace lullaby
|
||||
{
|
||||
|
||||
GmeDecoder::GmeDecoder(Data *data, int bufferSize)
|
||||
: Decoder(data, bufferSize)
|
||||
, emu(0)
|
||||
, num_tracks(0)
|
||||
, cur_track(0)
|
||||
{
|
||||
void *d = data->getData();
|
||||
int s = data->getSize();
|
||||
|
||||
if (gme_open_data(d, s, &emu, sampleRate) != 0)
|
||||
throw love::Exception("Could not open game music file");
|
||||
|
||||
num_tracks = gme_track_count(emu);
|
||||
|
||||
try
|
||||
{
|
||||
if (num_tracks <= 0)
|
||||
throw love::Exception("Game music file has no tracks");
|
||||
|
||||
if (gme_start_track(emu, cur_track) != 0)
|
||||
throw love::Exception("Could not start game music playback");
|
||||
}
|
||||
catch (love::Exception &)
|
||||
{
|
||||
gme_delete(emu);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
GmeDecoder::~GmeDecoder()
|
||||
{
|
||||
if (emu)
|
||||
gme_delete(emu);
|
||||
}
|
||||
|
||||
bool GmeDecoder::accepts(const std::string &ext)
|
||||
{
|
||||
static const std::string supported[] =
|
||||
{
|
||||
"ay", "gbs", "gym", "hes", "kss", "nsf",
|
||||
"nsfe", "sap", "spc", "vgm", "vgz",
|
||||
};
|
||||
|
||||
for (const auto& s : supported)
|
||||
{
|
||||
if (s.compare(ext) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
love::sound::Decoder *GmeDecoder::clone()
|
||||
{
|
||||
return new GmeDecoder(data.get(), bufferSize);
|
||||
}
|
||||
|
||||
int GmeDecoder::decode()
|
||||
{
|
||||
short *sbuf = static_cast<short*>(buffer);
|
||||
int size = bufferSize / sizeof(short);
|
||||
|
||||
if (gme_play(emu, size, sbuf) != 0)
|
||||
throw love::Exception("Error while decoding game music");
|
||||
|
||||
if (!eof && gme_track_ended(emu))
|
||||
{
|
||||
// Start the next track if this one ended.
|
||||
if (cur_track < num_tracks - 1)
|
||||
gme_start_track(emu, ++cur_track);
|
||||
else
|
||||
eof = true;
|
||||
}
|
||||
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
bool GmeDecoder::seek(double s)
|
||||
{
|
||||
return gme_seek(emu, static_cast<long>(s * 1000.0)) != 0;
|
||||
}
|
||||
|
||||
bool GmeDecoder::rewind()
|
||||
{
|
||||
// If we're in the first track, rewind.
|
||||
if (cur_track == 0)
|
||||
return gme_seek(emu, 0) == 0;
|
||||
else
|
||||
{
|
||||
// Otherwise, start from the first track again.
|
||||
cur_track = 0;
|
||||
return gme_start_track(emu, cur_track) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool GmeDecoder::isSeekable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int GmeDecoder::getChannelCount() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
int GmeDecoder::getBitDepth() const
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
double GmeDecoder::getDuration()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // lullaby
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_SUPPORT_GME
|
||||
@@ -1,73 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2022 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_SOUND_LULLABY_GME_DECODER_H
|
||||
#define LOVE_SOUND_LULLABY_GME_DECODER_H
|
||||
|
||||
#ifdef LOVE_SUPPORT_GME
|
||||
|
||||
// LOVE
|
||||
#include "common/Data.h"
|
||||
#include "sound/Decoder.h"
|
||||
|
||||
#ifdef LOVE_APPLE_USE_FRAMEWORKS
|
||||
#include <Game_Music_Emu/gme.h>
|
||||
#else
|
||||
#include <gme.h>
|
||||
#endif
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
{
|
||||
namespace lullaby
|
||||
{
|
||||
|
||||
class GmeDecoder : public Decoder
|
||||
{
|
||||
public:
|
||||
|
||||
GmeDecoder(Data *data, int bufferSize);
|
||||
virtual ~GmeDecoder();
|
||||
|
||||
static bool accepts(const std::string &ext);
|
||||
|
||||
love::sound::Decoder *clone();
|
||||
int decode();
|
||||
bool seek(double s);
|
||||
bool rewind();
|
||||
bool isSeekable();
|
||||
int getChannelCount() const;
|
||||
int getBitDepth() const;
|
||||
double getDuration();
|
||||
|
||||
private:
|
||||
Music_Emu *emu;
|
||||
int num_tracks;
|
||||
int cur_track;
|
||||
}; // Decoder
|
||||
|
||||
} // lullaby
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_SUPPORT_GME
|
||||
|
||||
#endif // LOVE_SOUND_LULLABY_GME_DECODER_H
|
||||
Reference in New Issue
Block a user