SDL_mixer: Added support for playing FLAC files using dr_flac

From a56330b65a66d03c9664539468cc6a90d73f42ae Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 20 May 2022 21:59:41 -0700
Subject: [PATCH] Added support for playing FLAC files using dr_flac

---
 Android.mk                                    |    15 +-
 CHANGES.txt                                   |     2 +
 Makefile.os2                                  |     2 +-
 README.txt                                    |     4 +-
 Xcode/SDL_mixer.xcodeproj/project.pbxproj     |    54 +-
 Xcode/config.xcconfig                         |     5 -
 .../playmus/playmus.xcodeproj/project.pbxproj |    34 -
 .../playwave.xcodeproj/project.pbxproj        |    34 -
 configure                                     |    66 +-
 configure.ac                                  |    17 +-
 src/codecs/dr_flac.h                          | 12374 ++++++++++++++++
 src/codecs/mp3utils.h                         |     2 -
 src/codecs/music_drflac.c                     |   281 +
 src/codecs/music_drflac.h                     |    28 +
 src/music.c                                   |     6 +-
 src/music.h                                   |     1 +
 16 files changed, 12789 insertions(+), 136 deletions(-)
 create mode 100644 src/codecs/dr_flac.h
 create mode 100644 src/codecs/music_drflac.c
 create mode 100644 src/codecs/music_drflac.h

diff --git a/Android.mk b/Android.mk
index 990e9d70..0ff50ef8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -4,8 +4,11 @@ SDL_MIXER_LOCAL_PATH := $(call my-dir)
 # Enable this if you want to support loading WAV music
 SUPPORT_WAV ?= true
 
+# Enable this if you want to support loading FLAC music via dr_flac
+SUPPORT_FLAC_DRFLAC ?= true
+
 # Enable this if you want to support loading FLAC music with libFLAC
-SUPPORT_FLAC ?= false
+SUPPORT_FLAC_LIBFLAC ?= false
 FLAC_LIBRARY_PATH := external/flac
 
 # Enable this if you want to support loading OGG Vorbis music via Tremor
@@ -30,7 +33,7 @@ TIMIDITY_LIBRARY_PATH := src/codecs/timidity
 
 
 # Build the library
-ifeq ($(SUPPORT_FLAC),true)
+ifeq ($(SUPPORT_FLAC_LIBFLAC),true)
     include $(SDL_MIXER_LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/Android.mk
 endif
 
@@ -84,9 +87,13 @@ ifeq ($(SUPPORT_WAV),true)
     LOCAL_CFLAGS += -DMUSIC_WAV
 endif
 
-ifeq ($(SUPPORT_FLAC),true)
+ifeq ($(SUPPORT_FLAC_DRFLAC),true)
+    LOCAL_CFLAGS += -DMUSIC_FLAC_DRFLAC
+endif
+
+ifeq ($(SUPPORT_FLAC_LIBFLAC),true)
     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/include
-    LOCAL_CFLAGS += -DMUSIC_FLAC
+    LOCAL_CFLAGS += -DMUSIC_FLAC_LIBFLAC
     LOCAL_STATIC_LIBRARIES += libFLAC
 endif
 
diff --git a/CHANGES.txt b/CHANGES.txt
index d2b2b196..b8878913 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.0.5:
+Sam Lantinga - Fri May 20 21:59:13 PDT 2022
+ * Added support for playing FLAC files using dr_flac
 Sam Lantinga - Fri May 20 20:50:29 PDT 2022
  * Added support for playing MP3 files using dr_mp3
 Mykola Rubets - Tue May 17 12:59:35 2022
diff --git a/Makefile.os2 b/Makefile.os2
index de9ddc91..ddd602dd 100644
--- a/Makefile.os2
+++ b/Makefile.os2
@@ -104,7 +104,7 @@ LIBS+= ogg.lib
 !endif
 
 !ifeq USE_FLAC yes
-CFLAGS+= -DMUSIC_FLAC
+CFLAGS+= -DMUSIC_FLAC_LIBFLAC
 LIBS+= FLAC.lib
 !endif
 
diff --git a/README.txt b/README.txt
index db1c6a78..e419cb93 100644
--- a/README.txt
+++ b/README.txt
@@ -5,7 +5,7 @@ The latest version of this library is available from:
 http://www.libsdl.org/projects/SDL_mixer/
 
 Due to popular demand, here is a simple multi-channel audio mixer.
-It supports 8 channels of 16 bit stereo audio, plus a single channel of music. It can load MP3, VOC, and WAV format audio. It can also load FLAC, MIDI, MOD, Ogg, and Opus audio, depending on build options (see the note below for details.)
+It supports 8 channels of 16 bit stereo audio, plus a single channel of music. It can load FLAC, MP3, VOC, and WAV format audio. It can also load MIDI, MOD, Ogg, and Opus audio, depending on build options (see the note below for details.)
 
 See the header file SDL_mixer.h and the examples playwave.c and playmus.c
 for documentation on this mixer library.
@@ -22,7 +22,7 @@ and unpack them in /usr/local/lib under UNIX, and C:\ under Win32.
 This library is under the zlib license, see the file "LICENSE.txt" for details.
 
 Note:
-Support for FLAC, software MIDI, MOD, Ogg, and Opus are not included by default because of the size of the decode libraries, but you can get them by running external/download.sh
+Support for software MIDI, MOD, Ogg, and Opus are not included by default because of the size of the decode libraries, but you can get them by running external/download.sh
 - When building with CMake, you can enable the appropriate SUPPORT_* options defined in CMakeLists.txt.
 - When building with configure/make, you can build and install them normally and the configure script will detect and use them.
 - When building with Visual Studio, you will need to build the libraries and then add the appropriate LOAD_* preprocessor define to the Visual Studio project.
diff --git a/Xcode/SDL_mixer.xcodeproj/project.pbxproj b/Xcode/SDL_mixer.xcodeproj/project.pbxproj
index 0f30f9db..cab41b2d 100644
--- a/Xcode/SDL_mixer.xcodeproj/project.pbxproj
+++ b/Xcode/SDL_mixer.xcodeproj/project.pbxproj
@@ -54,6 +54,14 @@
 		F37A8D2E2838924900C38E95 /* music_drmp3.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D2B2838924900C38E95 /* music_drmp3.h */; };
 		F37A8D2F2838924900C38E95 /* music_drmp3.c in Sources */ = {isa = PBXBuildFile; fileRef = F37A8D2C2838924900C38E95 /* music_drmp3.c */; };
 		F37A8D302838924900C38E95 /* music_drmp3.c in Sources */ = {isa = PBXBuildFile; fileRef = F37A8D2C2838924900C38E95 /* music_drmp3.c */; };
+		F37A8D4A2838A23400C38E95 /* music_drflac.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D412838A23400C38E95 /* music_drflac.h */; };
+		F37A8D4B2838A23400C38E95 /* music_drflac.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D412838A23400C38E95 /* music_drflac.h */; };
+		F37A8D4C2838A23400C38E95 /* dr_mp3.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D472838A23400C38E95 /* dr_mp3.h */; };
+		F37A8D4D2838A23400C38E95 /* dr_mp3.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D472838A23400C38E95 /* dr_mp3.h */; };
+		F37A8D4E2838A23400C38E95 /* dr_flac.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D482838A23400C38E95 /* dr_flac.h */; };
+		F37A8D4F2838A23400C38E95 /* dr_flac.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D482838A23400C38E95 /* dr_flac.h */; };
+		F37A8D502838A23400C38E95 /* music_drflac.c in Sources */ = {isa = PBXBuildFile; fileRef = F37A8D492838A23400C38E95 /* music_drflac.c */; };
+		F37A8D512838A23400C38E95 /* music_drflac.c in Sources */ = {isa = PBXBuildFile; fileRef = F37A8D492838A23400C38E95 /* music_drflac.c */; };
 		F3823337273195CC00F7F527 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 639008C62385A822009019FA /* utils.c */; };
 		F3823338273195CF00F7F527 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 639008C72385A822009019FA /* utils.h */; };
 		F3823339273195D200F7F527 /* effect_position.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405D01F9607C100EDAF53 /* effect_position.c */; };
@@ -131,13 +139,6 @@
 			remoteGlobalIDString = F3968D85281FBB1900661875;
 			remoteInfo = libmodplug;
 		};
-		F3F70ECA281F5ABA005AA27D /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = F3F70EC6281F5ABA005AA27D /* FLAC.xcodeproj */;
-			proxyType = 2;
-			remoteGlobalIDString = F3F70E67281F442C005AA27D;
-			remoteInfo = FLAC;
-		};
 		F3F70F9F281F6DCA005AA27D /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = F3F70F9A281F6DCA005AA27D /* vorbis.xcodeproj */;
@@ -196,6 +197,10 @@
 		BE1FA95807AF96B3004B6283 /* Create DMG */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Create DMG"; sourceTree = BUILT_PRODUCTS_DIR; };
 		F37A8D2B2838924900C38E95 /* music_drmp3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_drmp3.h; sourceTree = "<group>"; };
 		F37A8D2C2838924900C38E95 /* music_drmp3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_drmp3.c; sourceTree = "<group>"; };
+		F37A8D412838A23400C38E95 /* music_drflac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_drflac.h; sourceTree = "<group>"; };
+		F37A8D472838A23400C38E95 /* dr_mp3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dr_mp3.h; sourceTree = "<group>"; };
+		F37A8D482838A23400C38E95 /* dr_flac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dr_flac.h; sourceTree = "<group>"; };
+		F37A8D492838A23400C38E95 /* music_drflac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_drflac.c; sourceTree = "<group>"; };
 		F3968B90281F817E00661875 /* opus.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = opus.xcodeproj; path = opus/opus.xcodeproj; sourceTree = "<group>"; };
 		F3968D71281FB5E100661875 /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = "<group>"; };
 		F3968D72281FB66200661875 /* tremor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = tremor.xcodeproj; path = tremor/tremor.xcodeproj; sourceTree = "<group>"; };
@@ -204,7 +209,6 @@
 		F3D87C0A281DFAD4005DA540 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
 		F3D87C0C281DFADB005DA540 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
 		F3D87C0E281DFB02005DA540 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = macOS/SDL2.framework; sourceTree = "<group>"; };
-		F3F70EC6281F5ABA005AA27D /* FLAC.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = FLAC.xcodeproj; path = FLAC/FLAC.xcodeproj; sourceTree = "<group>"; };
 		F3F70F9A281F6DCA005AA27D /* vorbis.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = vorbis.xcodeproj; path = vorbis/vorbis.xcodeproj; sourceTree = "<group>"; };
 		F51BFB0101F724BE01D3D55B /* native_midi.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = native_midi.h; sourceTree = "<group>"; };
 		F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
@@ -258,7 +262,6 @@
 			isa = PBXGroup;
 			children = (
 				F3968D71281FB5E100661875 /* config.xcconfig */,
-				F3F70EC6281F5ABA005AA27D /* FLAC.xcodeproj */,
 				F3968DEA281FBFE100661875 /* libmodplug.xcodeproj */,
 				F3968B90281F817E00661875 /* opus.xcodeproj */,
 				F3968D72281FB66200661875 /* tremor.xcodeproj */,
@@ -293,6 +296,8 @@
 		6398B0BB238528360024EEA1 /* codecs */ = {
 			isa = PBXGroup;
 			children = (
+				F37A8D482838A23400C38E95 /* dr_flac.h */,
+				F37A8D472838A23400C38E95 /* dr_mp3.h */,
 				AAE405BE1F9607BF00EDAF53 /* load_aiff.c */,
 				AAE405D21F9607C100EDAF53 /* load_aiff.h */,
 				AAE405CC1F9607C000EDAF53 /* load_voc.c */,
@@ -301,6 +306,8 @@
 				639197F0239FE66700F1D8F8 /* mp3utils.h */,
 				AAE405DE1F9607C300EDAF53 /* music_cmd.c */,
 				AAE405DB1F9607C200EDAF53 /* music_cmd.h */,
+				F37A8D492838A23400C38E95 /* music_drflac.c */,
+				F37A8D412838A23400C38E95 /* music_drflac.h */,
 				F37A8D2C2838924900C38E95 /* music_drmp3.c */,
 				F37A8D2B2838924900C38E95 /* music_drmp3.h */,
 				AAE405D41F9607C100EDAF53 /* music_flac.c */,
@@ -383,14 +390,6 @@
 			name = Products;
 			sourceTree = "<group>";
 		};
-		F3F70EC7281F5ABA005AA27D /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				F3F70ECB281F5ABA005AA27D /* FLAC.framework */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
 		F3F70F9B281F6DCA005AA27D /* Products */ = {
 			isa = PBXGroup;
 			children = (
@@ -437,12 +436,14 @@
 				AAE405E31F9607C300EDAF53 /* music_fluidsynth.h in Headers */,
 				AAE405F31F9607C300EDAF53 /* music_mikmod.h in Headers */,
 				AAE405F61F9607C300EDAF53 /* load_aiff.h in Headers */,
+				F37A8D4E2838A23400C38E95 /* dr_flac.h in Headers */,
 				AAE405E71F9607C300EDAF53 /* load_voc.h in Headers */,
 				AAE405EC1F9607C300EDAF53 /* music_wav.h in Headers */,
 				F37A8D2D2838924900C38E95 /* music_drmp3.h in Headers */,
 				AAE406011F9607C300EDAF53 /* music_mad.h in Headers */,
 				AAE405E91F9607C300EDAF53 /* music_modplug.h in Headers */,
 				AAE405FE1F9607C300EDAF53 /* music_nativemidi.h in Headers */,
+				F37A8D4A2838A23400C38E95 /* music_drflac.h in Headers */,
 				AAE405E41F9607C300EDAF53 /* mixer.h in Headers */,
 				AAE405FF1F9607C300EDAF53 /* music_cmd.h in Headers */,
 				AAE405EB1F9607C300EDAF53 /* music_flac.h in Headers */,
@@ -452,6 +453,7 @@
 				AAE405E61F9607C300EDAF53 /* music.h in Headers */,
 				F382335F2731963800F7F527 /* native_midi.h in Headers */,
 				BE1FA8CD07AF96B2004B6283 /* SDL_mixer.h in Headers */,
+				F37A8D4C2838A23400C38E95 /* dr_mp3.h in Headers */,
 				AAE405F51F9607C300EDAF53 /* music_ogg.h in Headers */,
 				630FBD8520D5211F009867AB /* music_opus.h in Headers */,
 				639008C92385A822009019FA /* utils.h in Headers */,
@@ -464,13 +466,16 @@
 			buildActionMask = 2147483647;
 			files = (
 				F3823346273195F300F7F527 /* music_flac.h in Headers */,
+				F37A8D4D2838A23400C38E95 /* dr_mp3.h in Headers */,
 				F382333E273195DF00F7F527 /* mixer.h in Headers */,
 				F382335A2731962600F7F527 /* load_aiff.h in Headers */,
 				F3823348273195F800F7F527 /* music_fluidsynth.h in Headers */,
+				F37A8D4B2838A23400C38E95 /* music_drflac.h in Headers */,
 				F382333C273195DA00F7F527 /* effects_internal.h in Headers */,
 				F382334E2731960700F7F527 /* music_modplug.h in Headers */,
 				F3823340273195E400F7F527 /* music.h in Headers */,
 				F38233522731961400F7F527 /* music_nativemidi.h in Headers */,
+				F37A8D4F2838A23400C38E95 /* dr_flac.h in Headers */,
 				F382334C2731960200F7F527 /* music_mikmod.h in Headers */,
 				F382334A273195FD00F7F527 /* music_mad.h in Headers */,
 				F3823338273195CF00F7F527 /* utils.h in Headers */,
@@ -568,10 +573,6 @@
 			productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
 			projectDirPath = "";
 			projectReferences = (
-				{
-					ProductGroup = F3F70EC7281F5ABA005AA27D /* Products */;
-					ProjectRef = F3F70EC6281F5ABA005AA27D /* FLAC.xcodeproj */;
-				},
 				{
 					ProductGroup = F3968DEB281FBFE100661875 /* Products */;
 					ProjectRef = F3968DEA281FBFE100661875 /* libmodplug.xcodeproj */;
@@ -620,13 +621,6 @@
 			remoteRef = F3968DEE281FBFE100661875 /* PBXContainerItemProxy */;
 			sourceTree = BUILT_PRODUCTS_DIR;
 		};
-		F3F70ECB281F5ABA005AA27D /* FLAC.framework */ = {
-			isa = PBXReferenceProxy;
-			fileType = wrapper.framework;
-			path = FLAC.framework;
-			remoteRef = F3F70ECA281F5ABA005AA27D /* PBXContainerItemProxy */;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
 		F3F70FA0281F6DCA005AA27D /* vorbis.framework */ = {
 			isa = PBXReferenceProxy;
 			fileType = wrapper.framework;
@@ -705,6 +699,7 @@
 				AAE405F21F9607C300EDAF53 /* effects_internal.c in Sources */,
 				AAE406021F9607C300EDAF53 /* music_cmd.c in Sources */,
 				AAE405FB1F9607C300EDAF53 /* music_timidity.c in Sources */,
+				F37A8D502838A23400C38E95 /* music_drflac.c in Sources */,
 				AAE405F11F9607C300EDAF53 /* music.c in Sources */,
 				AAE405F91F9607C300EDAF53 /* music_nativemidi.c in Sources */,
 				AAE406031F9607C300EDAF53 /* music_mpg123.c in Sources */,
@@ -735,6 +730,7 @@
 				F382334D2731960400F7F527 /* music_modplug.c in Sources */,
 				F382333F273195E100F7F527 /* music.c in Sources */,
 				F382334B2731960000F7F527 /* music_mikmod.c in Sources */,
+				F37A8D512838A23400C38E95 /* music_drflac.c in Sources */,
 				F3823341273195E600F7F527 /* mp3utils.c in Sources */,
 				F3823343273195EB00F7F527 /* music_cmd.c in Sources */,
 				F382335E2731963000F7F527 /* music_opus.c in Sources */,
@@ -845,6 +841,7 @@
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_NO_COMMON_BLOCKS = YES;
 				GCC_PREPROCESSOR_DEFINITIONS = (
+					MUSIC_FLAC_DRFLAC,
 					MUSIC_MP3_DRMP3,
 					MUSIC_WAV,
 					"$(CONFIG_PREPROCESSOR_DEFINITIONS)",
@@ -892,6 +889,7 @@
 				GCC_NO_COMMON_BLOCKS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = (
+					MUSIC_FLAC_DRFLAC,
 					MUSIC_MP3_DRMP3,
 					MUSIC_WAV,
 					"$(CONFIG_PREPROCESSOR_DEFINITIONS)",
diff --git a/Xcode/config.xcconfig b/Xcode/config.xcconfig
index e754a63f..71317d29 100644
--- a/Xcode/config.xcconfig
+++ b/Xcode/config.xcconfig
@@ -6,11 +6,6 @@
 // Configuration settings file format documentation can be found at:
 // https://help.apple.com/xcode/#/dev745c5c974
 
-// Uncomment these lines to enable FLAC support
-// If you do this, you should run external/download.sh to download the decode libraries and add FLAC.framework to your application bundle.
-//CONFIG_PREPROCESSOR_DEFINITIONS = $(inherited) MUSIC_FLAC
-//CONFIG_FRAMEWORK_LDFLAGS = $(inherited) -weak_framework FLAC
-
 // Uncomment these lines to enable native MIDI support on OSX
 //CONFIG_PREPROCESSOR_DEFINITIONS[sdk=mac*] = $(inherited) MUSIC_MID_NATIVE
 
diff --git a/Xcode/playmus/playmus.xcodeproj/project.pbxproj b/Xcode/playmus/playmus.xcodeproj/project.pbxproj
index e07b7a9c..3d25b3da 100644
--- a/Xcode/playmus/playmus.xcodeproj/project.pbxproj
+++ b/Xcode/playmus/playmus.xcodeproj/project.pbxproj
@@ -12,19 +12,16 @@
 		F3968EC3282039BC00661875 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EC2282039BC00661875 /* SDL2.framework */; };
 		F3968ECE28203E7300661875 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EBE2820392700661875 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ECF28203F3100661875 /* SDL2_mixer.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3ED80D4281D9ED600C33C5B /* SDL2_mixer.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		F3968ED028203F5800661875 /* FLAC.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E98282038D200661875 /* FLAC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ED128203F5800661875 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E9E282038D700661875 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ED328203F5800661875 /* ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EBC2820390500661875 /* ogg.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ED428203F5800661875 /* opus.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EAA282038E000661875 /* opus.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ED628203F5800661875 /* vorbis.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EB6282038FB00661875 /* vorbis.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EEF2820409F00661875 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EC0282039AC00661875 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		F3968EF0282040B300661875 /* FLAC.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E98282038D200661875 /* FLAC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF1282040B300661875 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E9E282038D700661875 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF3282040B300661875 /* ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EBC2820390500661875 /* ogg.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF4282040B300661875 /* opus.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EAA282038E000661875 /* opus.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF5282040B300661875 /* tremor.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EB0282038F600661875 /* tremor.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF6282040B300661875 /* vorbis.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EB6282038FB00661875 /* vorbis.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		F3968F0E2820428F00661875 /* FLAC.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E98282038D200661875 /* FLAC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968F0F2820428F00661875 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E9E282038D700661875 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968F112820428F00661875 /* ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EBC2820390500661875 /* ogg.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968F122820428F00661875 /* opus.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EAA282038E000661875 /* opus.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -43,13 +40,6 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
-		F3968E97282038D200661875 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = F3968E93282038D200661875 /* FLAC.xcodeproj */;
-			proxyType = 2;
-			remoteGlobalIDString = F3F70E67281F442C005AA27D;
-			remoteInfo = FLAC;
-		};
 		F3968E9D282038D700661875 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = F3968E99282038D700661875 /* libmodplug.xcodeproj */;
@@ -117,7 +107,6 @@
 			files = (
 				F3968F142820428F00661875 /* SDL2.framework in Copy Frameworks */,
 				F39CD44B281DC6C8006CF638 /* SDL2_mixer.framework in Copy Frameworks */,
-				F3968F0E2820428F00661875 /* FLAC.framework in Copy Frameworks */,
 				F3968F0F2820428F00661875 /* libmodplug.framework in Copy Frameworks */,
 				F3968F112820428F00661875 /* ogg.framework in Copy Frameworks */,
 				F3968F122820428F00661875 /* opus.framework in Copy Frameworks */,
@@ -134,7 +123,6 @@
 			files = (
 				F3968ECE28203E7300661875 /* SDL2.framework in Copy Frameworks */,
 				F3968ECF28203F3100661875 /* SDL2_mixer.framework in Copy Frameworks */,
-				F3968ED028203F5800661875 /* FLAC.framework in Copy Frameworks */,
 				F3968ED128203F5800661875 /* libmodplug.framework in Copy Frameworks */,
 				F3968ED328203F5800661875 /* ogg.framework in Copy Frameworks */,
 				F3968ED428203F5800661875 /* opus.framework in Copy Frameworks */,
@@ -151,7 +139,6 @@
 			files = (
 				F3968EEF2820409F00661875 /* SDL2.framework in Copy Frameworks */,
 				F3ED80FF281DA63000C33C5B /* SDL2_mixer.framework in Copy Frameworks */,
-				F3968EF0282040B300661875 /* FLAC.framework in Copy Frameworks */,
 				F3968EF1282040B300661875 /* libmodplug.framework in Copy Frameworks */,
 				F3968EF3282040B300661875 /* ogg.framework in Copy Frameworks */,
 				F3968EF4282040B300661875 /* opus.framework in Copy Frameworks */,
@@ -164,7 +151,6 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
-		F3968E93282038D200661875 /* FLAC.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = FLAC.xcodeproj; path = ../FLAC/FLAC.xcodeproj; sourceTree = "<group>"; };
 		F3968E99282038D700661875 /* libmodplug.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libmodplug.xcodeproj; path = ../libmodplug/libmodplug.xcodeproj; sourceTree = "<group>"; };
 		F3968EA5282038E000661875 /* opus.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = opus.xcodeproj; path = ../opus/opus.xcodeproj; sourceTree = "<group>"; };
 		F3968EAB282038F600661875 /* tremor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = tremor.xcodeproj; path = ../tremor/tremor.xcodeproj; sourceTree = "<group>"; };
@@ -213,14 +199,6 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-		F3968E94282038D200661875 /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				F3968E98282038D200661875 /* FLAC.framework */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
 		F3968E9A282038D700661875 /* Products */ = {
 			isa = PBXGroup;
 			children = (
@@ -298,7 +276,6 @@
 		F3ED80A6281D9E8800C33C5B = {
 			isa = PBXGroup;
 			children = (
-				F3968E93282038D200661875 /* FLAC.xcodeproj */,
 				F3968E99282038D700661875 /* libmodplug.xcodeproj */,
 				F3968EB72820390500661875 /* ogg.xcodeproj */,
 				F3968EA5282038E000661875 /* opus.xcodeproj */,
@@ -436,10 +413,6 @@
 			productRefGroup = F3ED80B4281D9E8900C33C5B /* Products */;
 			projectDirPath = "";
 			projectReferences = (
-				{
-					ProductGroup = F3968E94282038D200661875 /* Products */;
-					ProjectRef = F3968E93282038D200661875 /* FLAC.xcodeproj */;
-				},
 				{
 					ProductGroup = F3968E9A282038D700661875 /* Products */;
 					ProjectRef = F3968E99282038D700661875 /* libmodplug.xcodeproj */;
@@ -475,13 +448,6 @@
 /* End PBXProject section */
 
 /* Begin PBXReferenceProxy section */
-		F3968E98282038D200661875 /* FLAC.framework */ = {
-			isa = PBXReferenceProxy;
-			fileType = wrapper.framework;
-			path = FLAC.framework;
-			remoteRef = F3968E97282038D200661875 /* PBXContainerItemProxy */;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
 		F3968E9E282038D700661875 /* libmodplug.framework */ = {
 			isa = PBXReferenceProxy;
 			fileType = wrapper.framework;
diff --git a/Xcode/playwave/playwave.xcodeproj/project.pbxproj b/Xcode/playwave/playwave.xcodeproj/project.pbxproj
index 29751519..5151f08b 100644
--- a/Xcode/playwave/playwave.xcodeproj/project.pbxproj
+++ b/Xcode/playwave/playwave.xcodeproj/project.pbxproj
@@ -12,19 +12,16 @@
 		F3968EC3282039BC00661875 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EC2282039BC00661875 /* SDL2.framework */; };
 		F3968ECE28203E7300661875 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EBE2820392700661875 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ECF28203F3100661875 /* SDL2_mixer.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3ED80D4281D9ED600C33C5B /* SDL2_mixer.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		F3968ED028203F5800661875 /* FLAC.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E98282038D200661875 /* FLAC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ED128203F5800661875 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E9E282038D700661875 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ED328203F5800661875 /* ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EBC2820390500661875 /* ogg.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ED428203F5800661875 /* opus.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EAA282038E000661875 /* opus.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968ED628203F5800661875 /* vorbis.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EB6282038FB00661875 /* vorbis.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EEF2820409F00661875 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EC0282039AC00661875 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		F3968EF0282040B300661875 /* FLAC.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E98282038D200661875 /* FLAC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF1282040B300661875 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E9E282038D700661875 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF3282040B300661875 /* ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EBC2820390500661875 /* ogg.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF4282040B300661875 /* opus.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EAA282038E000661875 /* opus.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF5282040B300661875 /* tremor.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EB0282038F600661875 /* tremor.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968EF6282040B300661875 /* vorbis.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EB6282038FB00661875 /* vorbis.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		F3968F0E2820428F00661875 /* FLAC.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E98282038D200661875 /* FLAC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968F0F2820428F00661875 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968E9E282038D700661875 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968F112820428F00661875 /* ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EBC2820390500661875 /* ogg.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F3968F122820428F00661875 /* opus.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F3968EAA282038E000661875 /* opus.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -43,13 +40,6 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
-		F3968E97282038D200661875 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = F3968E93282038D200661875 /* FLAC.xcodeproj */;
-			proxyType = 2;
-			remoteGlobalIDString = F3F70E67281F442C005AA27D;
-			remoteInfo = FLAC;
-		};
 		F3968E9D282038D700661875 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = F3968E99282038D700661875 /* libmodplug.xcodeproj */;
@@ -117,7 +107,6 @@
 			files = (
 				F3968F142820428F00661875 /* SDL2.framework in Copy Frameworks */,
 				F39CD44B281DC6C8006CF638 /* SDL2_mixer.framework in C

(Patch may be truncated, please check the link at the top of this post.)