From dc494fad2e8b7ddca42372e1ce892ff952d0645e Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 01:14:28 -0700 Subject: [PATCH 01/18] Upadte Xcode project to use embedded copy of Ogg Vorbis --- MacOSX/QuakeSpasm.xcodeproj/project.pbxproj | 267 +++++++++++++++++++- 1 file changed, 259 insertions(+), 8 deletions(-) diff --git a/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj b/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj index 093a4bb2..9e414eee 100644 --- a/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj +++ b/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj @@ -105,10 +105,33 @@ 66A5470D12E3CF8100FFA7D5 /* snd_codec.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5470A12E3CF8100FFA7D5 /* snd_codec.c */; }; 66A5470E12E3CF8100FFA7D5 /* snd_codec_wav.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5470B12E3CF8100FFA7D5 /* snd_codec_wav.c */; }; 66A5470F12E3CF8100FFA7D5 /* snd_codec_ogg.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5470C12E3CF8100FFA7D5 /* snd_codec_ogg.c */; }; - 66A5487A12E3EA6900FFA7D5 /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66A5487912E3EA6900FFA7D5 /* Ogg.framework */; }; - 66A5487C12E3EA6E00FFA7D5 /* Vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66A5487B12E3EA6E00FFA7D5 /* Vorbis.framework */; }; 66A54A4F12E429B800FFA7D5 /* snd_resample.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A54A4E12E429B800FFA7D5 /* snd_resample.c */; }; 66A54ECE12E4ECA800FFA7D5 /* resample.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A54ECD12E4ECA800FFA7D5 /* resample.c */; }; + 66A5568712E6D46D00FFA7D5 /* analysis.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5563812E6D46D00FFA7D5 /* analysis.c */; }; + 66A5568812E6D46D00FFA7D5 /* bitrate.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5563A12E6D46D00FFA7D5 /* bitrate.c */; }; + 66A5568912E6D46D00FFA7D5 /* bitwise.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5563C12E6D46D00FFA7D5 /* bitwise.c */; }; + 66A5568A12E6D46D00FFA7D5 /* block.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5563D12E6D46D00FFA7D5 /* block.c */; }; + 66A5568B12E6D46D00FFA7D5 /* codebook.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5564612E6D46D00FFA7D5 /* codebook.c */; }; + 66A5568C12E6D46D00FFA7D5 /* COPYING in Resources */ = {isa = PBXBuildFile; fileRef = 66A5564912E6D46D00FFA7D5 /* COPYING */; }; + 66A5568D12E6D46D00FFA7D5 /* envelope.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5564A12E6D46D00FFA7D5 /* envelope.c */; }; + 66A5568E12E6D46D00FFA7D5 /* floor0.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5564C12E6D46D00FFA7D5 /* floor0.c */; }; + 66A5568F12E6D46D00FFA7D5 /* floor1.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5564D12E6D46D00FFA7D5 /* floor1.c */; }; + 66A5569012E6D46D00FFA7D5 /* framing.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5564E12E6D46D00FFA7D5 /* framing.c */; }; + 66A5569112E6D46D00FFA7D5 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5565012E6D46D00FFA7D5 /* info.c */; }; + 66A5569212E6D46D00FFA7D5 /* lookup.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5565112E6D46D00FFA7D5 /* lookup.c */; }; + 66A5569312E6D46D00FFA7D5 /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5565412E6D46D00FFA7D5 /* lpc.c */; }; + 66A5569412E6D46D00FFA7D5 /* lsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5565612E6D46D00FFA7D5 /* lsp.c */; }; + 66A5569512E6D46D00FFA7D5 /* mapping0.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5565812E6D46D00FFA7D5 /* mapping0.c */; }; + 66A5569612E6D46D00FFA7D5 /* mdct.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5565A12E6D46D00FFA7D5 /* mdct.c */; }; + 66A5569712E6D46D00FFA7D5 /* psy.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5567512E6D46D00FFA7D5 /* psy.c */; }; + 66A5569812E6D46D00FFA7D5 /* README in Resources */ = {isa = PBXBuildFile; fileRef = 66A5567712E6D46D00FFA7D5 /* README */; }; + 66A5569912E6D46D00FFA7D5 /* registry.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5567812E6D46D00FFA7D5 /* registry.c */; }; + 66A5569A12E6D46D00FFA7D5 /* res0.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5567A12E6D46D00FFA7D5 /* res0.c */; }; + 66A5569B12E6D46D00FFA7D5 /* sharedbook.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5567C12E6D46D00FFA7D5 /* sharedbook.c */; }; + 66A5569C12E6D46D00FFA7D5 /* smallft.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5567D12E6D46D00FFA7D5 /* smallft.c */; }; + 66A5569D12E6D46D00FFA7D5 /* synthesis.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5567F12E6D46D00FFA7D5 /* synthesis.c */; }; + 66A5569E12E6D46D00FFA7D5 /* vorbisfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5568412E6D46D00FFA7D5 /* vorbisfile.c */; }; + 66A5569F12E6D46D00FFA7D5 /* window.c in Sources */ = {isa = PBXBuildFile; fileRef = 66A5568512E6D46D00FFA7D5 /* window.c */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; /* End PBXBuildFile section */ @@ -286,11 +309,81 @@ 66A5470A12E3CF8100FFA7D5 /* snd_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_codec.c; path = ../Quake/snd_codec.c; sourceTree = SOURCE_ROOT; }; 66A5470B12E3CF8100FFA7D5 /* snd_codec_wav.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_codec_wav.c; path = ../Quake/snd_codec_wav.c; sourceTree = SOURCE_ROOT; }; 66A5470C12E3CF8100FFA7D5 /* snd_codec_ogg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_codec_ogg.c; path = ../Quake/snd_codec_ogg.c; sourceTree = SOURCE_ROOT; }; - 66A5487912E3EA6900FFA7D5 /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = Library/Frameworks/Ogg.framework; sourceTree = SDKROOT; }; - 66A5487B12E3EA6E00FFA7D5 /* Vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Vorbis.framework; path = Library/Frameworks/Vorbis.framework; sourceTree = SDKROOT; }; 66A54A4E12E429B800FFA7D5 /* snd_resample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_resample.c; path = ../Quake/snd_resample.c; sourceTree = SOURCE_ROOT; }; 66A54ECD12E4ECA800FFA7D5 /* resample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = resample.c; path = ../Quake/resample.c; sourceTree = SOURCE_ROOT; }; 66A54ED012E4ECFB00FFA7D5 /* speex_resampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = speex_resampler.h; path = ../Quake/speex_resampler.h; sourceTree = SOURCE_ROOT; }; + 66A5563812E6D46D00FFA7D5 /* analysis.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = analysis.c; sourceTree = ""; }; + 66A5563912E6D46D00FFA7D5 /* backends.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = backends.h; sourceTree = ""; }; + 66A5563A12E6D46D00FFA7D5 /* bitrate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitrate.c; sourceTree = ""; }; + 66A5563B12E6D46D00FFA7D5 /* bitrate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitrate.h; sourceTree = ""; }; + 66A5563C12E6D46D00FFA7D5 /* bitwise.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitwise.c; sourceTree = ""; }; + 66A5563D12E6D46D00FFA7D5 /* block.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = block.c; sourceTree = ""; }; + 66A5564012E6D46D00FFA7D5 /* res_books_51.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = res_books_51.h; sourceTree = ""; }; + 66A5564112E6D46D00FFA7D5 /* res_books_stereo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = res_books_stereo.h; sourceTree = ""; }; + 66A5564312E6D46D00FFA7D5 /* floor_books.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = floor_books.h; sourceTree = ""; }; + 66A5564512E6D46D00FFA7D5 /* res_books_uncoupled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = res_books_uncoupled.h; sourceTree = ""; }; + 66A5564612E6D46D00FFA7D5 /* codebook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = codebook.c; sourceTree = ""; }; + 66A5564712E6D46D00FFA7D5 /* codebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = codebook.h; sourceTree = ""; }; + 66A5564812E6D46D00FFA7D5 /* codec_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = codec_internal.h; sourceTree = ""; }; + 66A5564912E6D46D00FFA7D5 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = ""; }; + 66A5564A12E6D46D00FFA7D5 /* envelope.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = envelope.c; sourceTree = ""; }; + 66A5564B12E6D46D00FFA7D5 /* envelope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = envelope.h; sourceTree = ""; }; + 66A5564C12E6D46D00FFA7D5 /* floor0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = floor0.c; sourceTree = ""; }; + 66A5564D12E6D46D00FFA7D5 /* floor1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = floor1.c; sourceTree = ""; }; + 66A5564E12E6D46D00FFA7D5 /* framing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = framing.c; sourceTree = ""; }; + 66A5564F12E6D46D00FFA7D5 /* highlevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = highlevel.h; sourceTree = ""; }; + 66A5565012E6D46D00FFA7D5 /* info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = info.c; sourceTree = ""; }; + 66A5565112E6D46D00FFA7D5 /* lookup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lookup.c; sourceTree = ""; }; + 66A5565212E6D46D00FFA7D5 /* lookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lookup.h; sourceTree = ""; }; + 66A5565312E6D46D00FFA7D5 /* lookup_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lookup_data.h; sourceTree = ""; }; + 66A5565412E6D46D00FFA7D5 /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = ""; }; + 66A5565512E6D46D00FFA7D5 /* lpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpc.h; sourceTree = ""; }; + 66A5565612E6D46D00FFA7D5 /* lsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lsp.c; sourceTree = ""; }; + 66A5565712E6D46D00FFA7D5 /* lsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lsp.h; sourceTree = ""; }; + 66A5565812E6D46D00FFA7D5 /* mapping0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mapping0.c; sourceTree = ""; }; + 66A5565912E6D46D00FFA7D5 /* masking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = masking.h; sourceTree = ""; }; + 66A5565A12E6D46D00FFA7D5 /* mdct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mdct.c; sourceTree = ""; }; + 66A5565B12E6D46D00FFA7D5 /* mdct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mdct.h; sourceTree = ""; }; + 66A5565C12E6D46D00FFA7D5 /* misc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = misc.h; sourceTree = ""; }; + 66A5565E12E6D46D00FFA7D5 /* floor_all.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = floor_all.h; sourceTree = ""; }; + 66A5565F12E6D46D00FFA7D5 /* psych_11.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = psych_11.h; sourceTree = ""; }; + 66A5566012E6D46D00FFA7D5 /* psych_16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = psych_16.h; sourceTree = ""; }; + 66A5566112E6D46D00FFA7D5 /* psych_44.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = psych_44.h; sourceTree = ""; }; + 66A5566212E6D46D00FFA7D5 /* psych_8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = psych_8.h; sourceTree = ""; }; + 66A5566312E6D46D00FFA7D5 /* residue_16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = residue_16.h; sourceTree = ""; }; + 66A5566412E6D46D00FFA7D5 /* residue_44.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = residue_44.h; sourceTree = ""; }; + 66A5566512E6D46D00FFA7D5 /* residue_44p51.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = residue_44p51.h; sourceTree = ""; }; + 66A5566612E6D46D00FFA7D5 /* residue_44u.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = residue_44u.h; sourceTree = ""; }; + 66A5566712E6D46D00FFA7D5 /* residue_8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = residue_8.h; sourceTree = ""; }; + 66A5566812E6D46D00FFA7D5 /* setup_11.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_11.h; sourceTree = ""; }; + 66A5566912E6D46D00FFA7D5 /* setup_16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_16.h; sourceTree = ""; }; + 66A5566A12E6D46D00FFA7D5 /* setup_22.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_22.h; sourceTree = ""; }; + 66A5566B12E6D46D00FFA7D5 /* setup_32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_32.h; sourceTree = ""; }; + 66A5566C12E6D46D00FFA7D5 /* setup_44.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_44.h; sourceTree = ""; }; + 66A5566D12E6D46D00FFA7D5 /* setup_44p51.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_44p51.h; sourceTree = ""; }; + 66A5566E12E6D46D00FFA7D5 /* setup_44u.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_44u.h; sourceTree = ""; }; + 66A5566F12E6D46D00FFA7D5 /* setup_8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_8.h; sourceTree = ""; }; + 66A5567012E6D46D00FFA7D5 /* setup_X.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup_X.h; sourceTree = ""; }; + 66A5567212E6D46D00FFA7D5 /* ogg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ogg.h; sourceTree = ""; }; + 66A5567312E6D46D00FFA7D5 /* os_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = os_types.h; sourceTree = ""; }; + 66A5567412E6D46D00FFA7D5 /* os.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = os.h; sourceTree = ""; }; + 66A5567512E6D46D00FFA7D5 /* psy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psy.c; sourceTree = ""; }; + 66A5567612E6D46D00FFA7D5 /* psy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = psy.h; sourceTree = ""; }; + 66A5567712E6D46D00FFA7D5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + 66A5567812E6D46D00FFA7D5 /* registry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = registry.c; sourceTree = ""; }; + 66A5567912E6D46D00FFA7D5 /* registry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = registry.h; sourceTree = ""; }; + 66A5567A12E6D46D00FFA7D5 /* res0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = res0.c; sourceTree = ""; }; + 66A5567B12E6D46D00FFA7D5 /* scales.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scales.h; sourceTree = ""; }; + 66A5567C12E6D46D00FFA7D5 /* sharedbook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sharedbook.c; sourceTree = ""; }; + 66A5567D12E6D46D00FFA7D5 /* smallft.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smallft.c; sourceTree = ""; }; + 66A5567E12E6D46D00FFA7D5 /* smallft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smallft.h; sourceTree = ""; }; + 66A5567F12E6D46D00FFA7D5 /* synthesis.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = synthesis.c; sourceTree = ""; }; + 66A5568112E6D46D00FFA7D5 /* codec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = codec.h; sourceTree = ""; }; + 66A5568212E6D46D00FFA7D5 /* vorbisenc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vorbisenc.h; sourceTree = ""; }; + 66A5568312E6D46D00FFA7D5 /* vorbisfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vorbisfile.h; sourceTree = ""; }; + 66A5568412E6D46D00FFA7D5 /* vorbisfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vorbisfile.c; sourceTree = ""; }; + 66A5568512E6D46D00FFA7D5 /* window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = window.c; sourceTree = ""; }; + 66A5568612E6D46D00FFA7D5 /* window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = window.h; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* QuakeSpasm.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QuakeSpasm.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -305,8 +398,6 @@ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 002F3C0109D093BD00EBEB88 /* OpenGL.framework in Frameworks */, 48348943120595B1004184BC /* Sparkle.framework in Frameworks */, - 66A5487A12E3EA6900FFA7D5 /* Ogg.framework in Frameworks */, - 66A5487C12E3EA6E00FFA7D5 /* Vorbis.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -347,14 +438,13 @@ children = ( 48243B060D33ED0A00C29F8F /* MacOSX */, 483A77D80D2EE8C500CB2E4C /* Quake */, + 66A5563712E6D46D00FFA7D5 /* OggVorbis */, 29B97317FDCFA39411CA2CEA /* Resources */, 4890A5EA1205D6ED00452753 /* Sparkle */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, 4830B79D0D464CAE00EF4498 /* Changelog.txt */, 4830B79E0D464CAE00EF4498 /* Todo.txt */, - 66A5487912E3EA6900FFA7D5 /* Ogg.framework */, - 66A5487B12E3EA6E00FFA7D5 /* Vorbis.framework */, ); name = QuakeSpasm; sourceTree = ""; @@ -618,6 +708,142 @@ name = Sparkle; sourceTree = ""; }; + 66A5563712E6D46D00FFA7D5 /* OggVorbis */ = { + isa = PBXGroup; + children = ( + 66A5563812E6D46D00FFA7D5 /* analysis.c */, + 66A5563912E6D46D00FFA7D5 /* backends.h */, + 66A5563A12E6D46D00FFA7D5 /* bitrate.c */, + 66A5563B12E6D46D00FFA7D5 /* bitrate.h */, + 66A5563C12E6D46D00FFA7D5 /* bitwise.c */, + 66A5563D12E6D46D00FFA7D5 /* block.c */, + 66A5563E12E6D46D00FFA7D5 /* books */, + 66A5564612E6D46D00FFA7D5 /* codebook.c */, + 66A5564712E6D46D00FFA7D5 /* codebook.h */, + 66A5564812E6D46D00FFA7D5 /* codec_internal.h */, + 66A5564912E6D46D00FFA7D5 /* COPYING */, + 66A5564A12E6D46D00FFA7D5 /* envelope.c */, + 66A5564B12E6D46D00FFA7D5 /* envelope.h */, + 66A5564C12E6D46D00FFA7D5 /* floor0.c */, + 66A5564D12E6D46D00FFA7D5 /* floor1.c */, + 66A5564E12E6D46D00FFA7D5 /* framing.c */, + 66A5564F12E6D46D00FFA7D5 /* highlevel.h */, + 66A5565012E6D46D00FFA7D5 /* info.c */, + 66A5565112E6D46D00FFA7D5 /* lookup.c */, + 66A5565212E6D46D00FFA7D5 /* lookup.h */, + 66A5565312E6D46D00FFA7D5 /* lookup_data.h */, + 66A5565412E6D46D00FFA7D5 /* lpc.c */, + 66A5565512E6D46D00FFA7D5 /* lpc.h */, + 66A5565612E6D46D00FFA7D5 /* lsp.c */, + 66A5565712E6D46D00FFA7D5 /* lsp.h */, + 66A5565812E6D46D00FFA7D5 /* mapping0.c */, + 66A5565912E6D46D00FFA7D5 /* masking.h */, + 66A5565A12E6D46D00FFA7D5 /* mdct.c */, + 66A5565B12E6D46D00FFA7D5 /* mdct.h */, + 66A5565C12E6D46D00FFA7D5 /* misc.h */, + 66A5565D12E6D46D00FFA7D5 /* modes */, + 66A5567112E6D46D00FFA7D5 /* ogg */, + 66A5567412E6D46D00FFA7D5 /* os.h */, + 66A5567512E6D46D00FFA7D5 /* psy.c */, + 66A5567612E6D46D00FFA7D5 /* psy.h */, + 66A5567712E6D46D00FFA7D5 /* README */, + 66A5567812E6D46D00FFA7D5 /* registry.c */, + 66A5567912E6D46D00FFA7D5 /* registry.h */, + 66A5567A12E6D46D00FFA7D5 /* res0.c */, + 66A5567B12E6D46D00FFA7D5 /* scales.h */, + 66A5567C12E6D46D00FFA7D5 /* sharedbook.c */, + 66A5567D12E6D46D00FFA7D5 /* smallft.c */, + 66A5567E12E6D46D00FFA7D5 /* smallft.h */, + 66A5567F12E6D46D00FFA7D5 /* synthesis.c */, + 66A5568012E6D46D00FFA7D5 /* vorbis */, + 66A5568412E6D46D00FFA7D5 /* vorbisfile.c */, + 66A5568512E6D46D00FFA7D5 /* window.c */, + 66A5568612E6D46D00FFA7D5 /* window.h */, + ); + name = OggVorbis; + path = ../OggVorbis; + sourceTree = SOURCE_ROOT; + }; + 66A5563E12E6D46D00FFA7D5 /* books */ = { + isa = PBXGroup; + children = ( + 66A5563F12E6D46D00FFA7D5 /* coupled */, + 66A5564212E6D46D00FFA7D5 /* floor */, + 66A5564412E6D46D00FFA7D5 /* uncoupled */, + ); + path = books; + sourceTree = ""; + }; + 66A5563F12E6D46D00FFA7D5 /* coupled */ = { + isa = PBXGroup; + children = ( + 66A5564012E6D46D00FFA7D5 /* res_books_51.h */, + 66A5564112E6D46D00FFA7D5 /* res_books_stereo.h */, + ); + path = coupled; + sourceTree = ""; + }; + 66A5564212E6D46D00FFA7D5 /* floor */ = { + isa = PBXGroup; + children = ( + 66A5564312E6D46D00FFA7D5 /* floor_books.h */, + ); + path = floor; + sourceTree = ""; + }; + 66A5564412E6D46D00FFA7D5 /* uncoupled */ = { + isa = PBXGroup; + children = ( + 66A5564512E6D46D00FFA7D5 /* res_books_uncoupled.h */, + ); + path = uncoupled; + sourceTree = ""; + }; + 66A5565D12E6D46D00FFA7D5 /* modes */ = { + isa = PBXGroup; + children = ( + 66A5565E12E6D46D00FFA7D5 /* floor_all.h */, + 66A5565F12E6D46D00FFA7D5 /* psych_11.h */, + 66A5566012E6D46D00FFA7D5 /* psych_16.h */, + 66A5566112E6D46D00FFA7D5 /* psych_44.h */, + 66A5566212E6D46D00FFA7D5 /* psych_8.h */, + 66A5566312E6D46D00FFA7D5 /* residue_16.h */, + 66A5566412E6D46D00FFA7D5 /* residue_44.h */, + 66A5566512E6D46D00FFA7D5 /* residue_44p51.h */, + 66A5566612E6D46D00FFA7D5 /* residue_44u.h */, + 66A5566712E6D46D00FFA7D5 /* residue_8.h */, + 66A5566812E6D46D00FFA7D5 /* setup_11.h */, + 66A5566912E6D46D00FFA7D5 /* setup_16.h */, + 66A5566A12E6D46D00FFA7D5 /* setup_22.h */, + 66A5566B12E6D46D00FFA7D5 /* setup_32.h */, + 66A5566C12E6D46D00FFA7D5 /* setup_44.h */, + 66A5566D12E6D46D00FFA7D5 /* setup_44p51.h */, + 66A5566E12E6D46D00FFA7D5 /* setup_44u.h */, + 66A5566F12E6D46D00FFA7D5 /* setup_8.h */, + 66A5567012E6D46D00FFA7D5 /* setup_X.h */, + ); + path = modes; + sourceTree = ""; + }; + 66A5567112E6D46D00FFA7D5 /* ogg */ = { + isa = PBXGroup; + children = ( + 66A5567212E6D46D00FFA7D5 /* ogg.h */, + 66A5567312E6D46D00FFA7D5 /* os_types.h */, + ); + path = ogg; + sourceTree = ""; + }; + 66A5568012E6D46D00FFA7D5 /* vorbis */ = { + isa = PBXGroup; + children = ( + 66A5568112E6D46D00FFA7D5 /* codec.h */, + 66A5568212E6D46D00FFA7D5 /* vorbisenc.h */, + 66A5568312E6D46D00FFA7D5 /* vorbisfile.h */, + ); + path = vorbis; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -674,6 +900,8 @@ 48B9E7880D340B1E0001CACF /* Launcher.nib in Resources */, 484AA4B40D3FF6C0005D917A /* QuakeSpasm.icns in Resources */, 48FA25B712437EAB00667668 /* dsa_pub.pem in Resources */, + 66A5568C12E6D46D00FFA7D5 /* COPYING in Resources */, + 66A5569812E6D46D00FFA7D5 /* README in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -776,6 +1004,29 @@ 66A5470F12E3CF8100FFA7D5 /* snd_codec_ogg.c in Sources */, 66A54A4F12E429B800FFA7D5 /* snd_resample.c in Sources */, 66A54ECE12E4ECA800FFA7D5 /* resample.c in Sources */, + 66A5568712E6D46D00FFA7D5 /* analysis.c in Sources */, + 66A5568812E6D46D00FFA7D5 /* bitrate.c in Sources */, + 66A5568912E6D46D00FFA7D5 /* bitwise.c in Sources */, + 66A5568A12E6D46D00FFA7D5 /* block.c in Sources */, + 66A5568B12E6D46D00FFA7D5 /* codebook.c in Sources */, + 66A5568D12E6D46D00FFA7D5 /* envelope.c in Sources */, + 66A5568E12E6D46D00FFA7D5 /* floor0.c in Sources */, + 66A5568F12E6D46D00FFA7D5 /* floor1.c in Sources */, + 66A5569012E6D46D00FFA7D5 /* framing.c in Sources */, + 66A5569112E6D46D00FFA7D5 /* info.c in Sources */, + 66A5569212E6D46D00FFA7D5 /* lookup.c in Sources */, + 66A5569312E6D46D00FFA7D5 /* lpc.c in Sources */, + 66A5569412E6D46D00FFA7D5 /* lsp.c in Sources */, + 66A5569512E6D46D00FFA7D5 /* mapping0.c in Sources */, + 66A5569612E6D46D00FFA7D5 /* mdct.c in Sources */, + 66A5569712E6D46D00FFA7D5 /* psy.c in Sources */, + 66A5569912E6D46D00FFA7D5 /* registry.c in Sources */, + 66A5569A12E6D46D00FFA7D5 /* res0.c in Sources */, + 66A5569B12E6D46D00FFA7D5 /* sharedbook.c in Sources */, + 66A5569C12E6D46D00FFA7D5 /* smallft.c in Sources */, + 66A5569D12E6D46D00FFA7D5 /* synthesis.c in Sources */, + 66A5569E12E6D46D00FFA7D5 /* vorbisfile.c in Sources */, + 66A5569F12E6D46D00FFA7D5 /* window.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; From a0f74edc778e535c0ad345915147c202a47d8802 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 01:19:09 -0700 Subject: [PATCH 02/18] Update copyright notices --- Quake/cd_shared.c | 3 ++- Quake/snd_dma.c | 1 + Quake/snd_resample.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Quake/cd_shared.c b/Quake/cd_shared.c index 306742e7..d239096f 100644 --- a/Quake/cd_shared.c +++ b/Quake/cd_shared.c @@ -2,7 +2,8 @@ cd_shared.c Copyright (C) 1996-1997 Id Software, Inc. - + Copyright (C) 2011 Eric Wasylishen + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 diff --git a/Quake/snd_dma.c b/Quake/snd_dma.c index 872abae2..201e5001 100644 --- a/Quake/snd_dma.c +++ b/Quake/snd_dma.c @@ -956,6 +956,7 @@ void S_Update_(void) =============================================================================== background music functions + from ioquake3 =============================================================================== */ diff --git a/Quake/snd_resample.c b/Quake/snd_resample.c index 70484475..40d71d9f 100644 --- a/Quake/snd_resample.c +++ b/Quake/snd_resample.c @@ -1,3 +1,23 @@ +/* + Copyright (C) 2011 Eric Wasylishen + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + #include "quakedef.h" #include "sound.h" #include "speex_resampler.h" From f2de795e5e2c70d1859bb56664cdd83d7dc73844 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 13:13:09 -0700 Subject: [PATCH 03/18] Cleanup/refactor of resampling code. Use resampler for background music. Should work with 8 or 16 bit output. --- Quake/snd_dma.c | 91 ++++++++++----------------- Quake/snd_mem.c | 19 +++++- Quake/snd_resample.c | 146 +++++++++++++++++++++++-------------------- Quake/sound.h | 22 +++---- 4 files changed, 141 insertions(+), 137 deletions(-) diff --git a/Quake/snd_dma.c b/Quake/snd_dma.c index 201e5001..a6de813a 100644 --- a/Quake/snd_dma.c +++ b/Quake/snd_dma.c @@ -71,7 +71,7 @@ qboolean sound_started = false; int s_rawend[MAX_RAW_STREAMS]; portable_samplepair_t s_rawsamples[MAX_RAW_STREAMS][MAX_RAW_SAMPLES]; - +static void *s_rawresampler[MAX_RAW_STREAMS]; cvar_t bgmvolume = {"bgmvolume", "1", true}; cvar_t sfxvolume = {"volume", "0.7", true}; @@ -221,6 +221,13 @@ void S_Shutdown (void) SNDDMA_Shutdown(); shm = NULL; + + int i; + for (i = 0; ispeed; + void *resampled = Snd_Resample(resampler, + rate, width, samples, s_channels, data, + shm->speed, 2, &resampledNumSamples); + + // old: //Con_Printf ("%i < %i < %i\n", soundtime, s_paintedtime, s_rawend[stream]); - if (s_channels == 2 && width == 2) + + if (s_channels == 2) { - if (scale == 1.0) - { // optimized case - for (i=0 ; i= samples) - break; - dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1); - s_rawend[stream]++; - rawsamples[dst].left = ((short *)data)[src*2] * intVolume; - rawsamples[dst].right = ((short *)data)[src*2+1] * intVolume; - } - } - } - else if (s_channels == 1 && width == 2) - { - for (i=0 ; ; i++) - { - src = i*scale; - if (src >= samples) - break; dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1); s_rawend[stream]++; - rawsamples[dst].left = ((short *)data)[src] * intVolume; - rawsamples[dst].right = ((short *)data)[src] * intVolume; + rawsamples[dst].left = ((short *)data)[i*2] * intVolume; + rawsamples[dst].right = ((short *)data)[i*2+1] * intVolume; } } - else if (s_channels == 2 && width == 1) + else if (s_channels == 1) { - intVolume *= 256; - - for (i=0 ; ; i++) + for (i=0 ; i= samples) - break; dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1); s_rawend[stream]++; - rawsamples[dst].left = ((char *)data)[src*2] * intVolume; - rawsamples[dst].right = ((char *)data)[src*2+1] * intVolume; + rawsamples[dst].left = ((short *)data)[i] * intVolume; + rawsamples[dst].right = ((short *)data)[i] * intVolume; } } - else if (s_channels == 1 && width == 1) + else { - intVolume *= 256; - - for (i=0 ; ; i++) - { - src = i*scale; - if (src >= samples) - break; - dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1); - s_rawend[stream]++; - rawsamples[dst].left = (((byte *)data)[src]-128) * intVolume; - rawsamples[dst].right = (((byte *)data)[src]-128) * intVolume; - } + Con_Printf( "S_Base_RawSamples: unsupported number of channels %d\n", s_channels ); } + if ( s_rawend[stream] > soundtime + MAX_RAW_SAMPLES ) { Con_DPrintf( "S_Base_RawSamples: overflowed %i > %i\n", s_rawend[stream], soundtime ); diff --git a/Quake/snd_mem.c b/Quake/snd_mem.c index aecf6b55..c389d80d 100644 --- a/Quake/snd_mem.c +++ b/Quake/snd_mem.c @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "snd_codec.h" +static void *resampler = NULL; + /* ============== S_LoadSound @@ -62,9 +64,22 @@ sfxcache_t *S_LoadSound (sfx_t *s) return NULL; } + // set up the resampler + if (resampler == NULL) + { + resampler = Snd_ResamplerInit(); + } + else + { + Snd_ResamplerReset(resampler); + } + int resampledNumSamples; - void *resampled = Snd_Resample(info.rate, info.width, info.samples, info.channels, data, shm->speed, shm->samplebits/8, &resampledNumSamples); + void *resampled = Snd_Resample(resampler, + info.rate, info.width, info.samples, info.channels, data, + shm->speed, shm->samplebits/8, &resampledNumSamples); + // FIXME: remove if (info.rate == shm->speed && info.width == shm->samplebits/8) { if (resampledNumSamples != info.samples) exit(5); @@ -73,6 +88,8 @@ sfxcache_t *S_LoadSound (sfx_t *s) len = resampledNumSamples * (shm->samplebits/8) * info.channels; + // set up the sample struct + sc = (sfxcache_t *) Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name); if (!sc) return NULL; diff --git a/Quake/snd_resample.c b/Quake/snd_resample.c index 40d71d9f..6bbd4c4a 100644 --- a/Quake/snd_resample.c +++ b/Quake/snd_resample.c @@ -22,15 +22,51 @@ #include "sound.h" #include "speex_resampler.h" -void *Snd_Resample(int inrate, int inwidth, int innumsamples, int channels, const void *indata, - int outrate, int outwidth, int *outnumsamples) +#define Snd_ResamplerQuality 0 + +struct resampler { + int channels; + SpeexResamplerState *st; +}; + +void *Snd_ResamplerInit() { + struct resampler *data = malloc(sizeof(struct resampler *)); + data->channels = 1; + data->st = speex_resampler_init(1, 44100, 44100, Snd_ResamplerQuality, NULL); + return data; +} + +void Snd_ResamplerClose(void *handle) +{ + struct resampler *data = (struct resampler *)handle; + speex_resampler_destroy(data->st); + free(data); +} + +void Snd_ResamplerReset(void *handle) +{ + struct resampler *data = (struct resampler *)handle; + speex_resampler_reset_mem(data->st); +} + +void *Snd_Resample(void *handle, + int inrate, int inwidth, int innumsamples, int channels, const void *indata, + int outrate, int outwidth, int *outnumsamples) +{ + // check params + if ( !(inwidth == 1 || inwidth == 2) || !(outwidth == 1 || outwidth == 2) ) + { + Sys_Error("Snd_ResampleStream only supports 1 or 2 bytes per sample"); + } + const float frac = ((float)inrate) / ((float)outrate); const int maxsamples = (innumsamples / frac) + 10; - short *outdata = malloc(maxsamples * channels * outwidth); - - // Convert input to 16-bit if necessary short *in16bit; + short *out16bit = malloc(maxsamples * channels * 2); + + // Convert input to 16-bit if necessary + if (inwidth == 2) { in16bit = (short*)indata; @@ -42,65 +78,44 @@ void *Snd_Resample(int inrate, int inwidth, int innumsamples, int channels, cons for (i=0; ist, &old_inrate, &old_outrate); + if (data->channels != channels) { - st = speex_resampler_init(channels, inrate, outrate, 0, NULL); + speex_resampler_destroy(data->st); + data->st = speex_resampler_init(channels, inrate, outrate, Snd_ResamplerQuality, NULL); + data->channels = channels; } else { - speex_resampler_reset_mem(st); + speex_resampler_set_rate(data->st, inrate, outrate); } - speex_resampler_set_rate(st, inrate, outrate); - - *outnumsamples = 0; + unsigned int consumedtotal = 0; unsigned int outputtotal = 0; - unsigned int loops = 0; - unsigned int consumed, output; + while (consumedtotal < innumsamples) { - int roomToConsume, roomToOutput; - - consumed = innumsamples - consumedtotal; - output = maxsamples - outputtotal; - - roomToConsume = consumed; - roomToOutput = output; - - speex_resampler_process_interleaved_int(st, in16bit + consumedtotal, &consumed, outdata + outputtotal, &output); + unsigned int consumed = innumsamples - consumedtotal; + unsigned int output = maxsamples - outputtotal; + speex_resampler_process_interleaved_int(data->st, in16bit + consumedtotal, &consumed, out16bit + outputtotal, &output); consumedtotal += consumed; outputtotal += output; - - loops++; - if (loops > 100) - { - Con_Printf("Infinite loop\n"); - } } *outnumsamples = outputtotal; @@ -109,37 +124,34 @@ void *Snd_Resample(int inrate, int inwidth, int innumsamples, int channels, cons { Con_Printf("Output %d, predicted %d\n", *outnumsamples, (innumsamples / frac)); } - //speex_resampler_destroy(resampler); } - // Check for clipping. - { - int i; - for (i=0; i<*outnumsamples; i++) - { - short sample = outdata[i]; - - if (sample == 32767) - { - //Con_Printf("16-bit clipping\n"); - } - } - } + + // Prepare to return if (in16bit != indata) { free(in16bit); } - if(outwidth != 2) exit(5); - + void *outdata; + if (outwidth == 2) + { + outdata = out16bit; + } + else // (outputwidth == 1) + { + int i; + int len = (*outnumsamples) * channels; + outdata = malloc(len); + for (i = 0; i> 8); + ((unsigned char *)outdata)[i] = u8sample; + } + free(out16bit); + } + return outdata; -} - -void *Snd_ResamplerInit(int inrate, int inwidth, int outrate, int outwidth, int channels) { return NULL; } - -void Snd_ResamplerClose(void *resampler) {} - -void Snd_ResampleStream(void *resampler, - int *innumsamples, void *indata, - int *outnumsamples, void *outdata) {} +} \ No newline at end of file diff --git a/Quake/sound.h b/Quake/sound.h index 73c63400..ba22b0c6 100644 --- a/Quake/sound.h +++ b/Quake/sound.h @@ -151,23 +151,21 @@ qboolean S_BackgroundTrackIsPlaying( void ); qboolean S_BackgroundTrackIsPaused( void ); qboolean S_BackgroundTrackIsLooping( void ); -/* resamples a whole file. return value must be freed with free() */ -void *Snd_Resample(int inrate, int inwidth, int innumsamples, int channels, const void *indata, - int outrate, int outwidth, int *outnumsamples); - -/* creates a new stream resampler for the specified rates and number of channels. returns a handle */ -void *Snd_ResamplerInit(int inrate, int inwidth, int outrate, int outwidth, int channels); +/* creates a new stream resampler. returns a handle */ +void *Snd_ResamplerInit(); /* closes a resampler handle */ void Snd_ResamplerClose(void *resampler); -/* performs resampling on samples in the given channel. numinsamples takes - the number of samples to process, and returns the number actually processed. - */ -void Snd_ResampleStream(void *resampler, - int *innumsamples, void *indata, - int *outnumsamples, void *outdata); +/* prepare resampler for processing an unrelated sound */ +void Snd_ResamplerReset(void *resampler); +/* performs resampling on samples in the given channel. + return value must be freed with free() + */ +void *Snd_Resample(void *resampler, + int inrate, int inwidth, int innumsamples, int channels, const void *indata, + int outrate, int outwidth, int *outnumsamples); // ==================================================================== // User-setable variables From 4ad3c2d0ee2f52f8c50ef15e2b0444b25fce3a46 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 13:50:44 -0700 Subject: [PATCH 04/18] Remove unused function --- Quake/snd_dma.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/Quake/snd_dma.c b/Quake/snd_dma.c index a6de813a..cdd46452 100644 --- a/Quake/snd_dma.c +++ b/Quake/snd_dma.c @@ -78,7 +78,7 @@ cvar_t sfxvolume = {"volume", "0.7", true}; cvar_t nosound = {"nosound", "0"}; cvar_t precache = {"precache", "1"}; -cvar_t loadas8bit = {"loadas8bit", "0"}; +cvar_t loadas8bit = {"loadas8bit", "1"}; cvar_t bgmbuffer = {"bgmbuffer", "4096"}; cvar_t ambient_level = {"ambient_level", "0.3"}; cvar_t ambient_fade = {"ambient_fade", "100"}; @@ -588,31 +588,6 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) //============================================================================= -/* - ================= - S_ByteSwapRawSamples - - If raw data has been loaded in little endien binary form, this must be done. - If raw data was calculated, as with ADPCM, this should not be called. - ================= - */ -void S_ByteSwapRawSamples( int samples, int width, int s_channels, const byte *data ) { - int i; - - if ( width != 2 ) { - return; - } - if ( LittleShort( 256 ) == 256 ) { - return; - } - - if ( s_channels == 2 ) { - samples <<= 1; - } - for ( i = 0 ; i < samples ; i++ ) { - ((short *)data)[i] = LittleShort( ((short *)data)[i] ); - } -} /* ============ From 30825d4d0abc9cc78e2a8f980d48dc7947ece43b Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 14:02:28 -0700 Subject: [PATCH 05/18] fix last commit --- Quake/snd_dma.c | 11 +++++------ Quake/snd_mix.c | 11 ++++------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Quake/snd_dma.c b/Quake/snd_dma.c index cdd46452..05035f52 100644 --- a/Quake/snd_dma.c +++ b/Quake/snd_dma.c @@ -598,8 +598,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) */ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_channels, const byte *data, float volume ) { int i; - int src, dst; - float scale; + int dst; int intVolume; portable_samplepair_t *rawsamples; void *resampler; @@ -642,8 +641,8 @@ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_chan { dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1); s_rawend[stream]++; - rawsamples[dst].left = ((short *)data)[i*2] * intVolume; - rawsamples[dst].right = ((short *)data)[i*2+1] * intVolume; + rawsamples[dst].left = ((short *)resampled)[i*2] * intVolume; + rawsamples[dst].right = ((short *)resampled)[i*2+1] * intVolume; } } else if (s_channels == 1) @@ -652,8 +651,8 @@ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_chan { dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1); s_rawend[stream]++; - rawsamples[dst].left = ((short *)data)[i] * intVolume; - rawsamples[dst].right = ((short *)data)[i] * intVolume; + rawsamples[dst].left = ((short *)resampled)[i] * intVolume; + rawsamples[dst].right = ((short *)resampled)[i] * intVolume; } } else diff --git a/Quake/snd_mix.c b/Quake/snd_mix.c index 2eda8bb7..4f6512dd 100644 --- a/Quake/snd_mix.c +++ b/Quake/snd_mix.c @@ -259,7 +259,6 @@ void SND_InitScaletable (void) void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) { int data; - int *lscale, *rscale; unsigned char *sfx; int i; @@ -268,15 +267,13 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) if (ch->rightvol > 255) ch->rightvol = 255; - lscale = snd_scaletable[ch->leftvol >> 3]; - rscale = snd_scaletable[ch->rightvol >> 3]; - sfx = (unsigned char *) ((signed char *)sc->data + ch->pos); + sfx = (unsigned char *) ((unsigned char *)sc->data + ch->pos); for (i = 0; i < count; i++) { - data = sfx[i]; - paintbuffer[i].left += lscale[data] * snd_vol; - paintbuffer[i].right += rscale[data] * snd_vol; + data = (sfx[i] - 128) * snd_vol; + paintbuffer[i].left += data * ch->leftvol; + paintbuffer[i].right += data * ch->rightvol; } ch->pos += count; From 396ff706ed3e01e2be1ccf2259dc20dc70a91e6f Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 14:02:42 -0700 Subject: [PATCH 06/18] remove some unneeded stuff --- Quake/snd_dma.c | 2 -- Quake/snd_mix.c | 28 ---------------------------- Quake/sound.h | 3 --- 3 files changed, 33 deletions(-) diff --git a/Quake/snd_dma.c b/Quake/snd_dma.c index 05035f52..fca9a868 100644 --- a/Quake/snd_dma.c +++ b/Quake/snd_dma.c @@ -182,8 +182,6 @@ void S_Init (void) Con_Printf ("loading all sounds as 8bit\n"); } - SND_InitScaletable (); - known_sfx = (sfx_t *) Hunk_AllocName (MAX_SFX*sizeof(sfx_t), "sfx_t"); num_sfx = 0; diff --git a/Quake/snd_mix.c b/Quake/snd_mix.c index 4f6512dd..3aa70c86 100644 --- a/Quake/snd_mix.c +++ b/Quake/snd_mix.c @@ -237,24 +237,6 @@ void S_PaintChannels (int endtime) } } -void SND_InitScaletable (void) -{ - int i, j; - - for (i = 0; i < 32; i++) - { - for (j = 0; j < 256; j++) - /* When compiling with gcc-4.1.0 at optimisations O1 and - higher, the tricky signed char type conversion is not - guaranteed. Therefore we explicity calculate the signed - value from the index as required. From Kevin Shanahan. - See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26719 - */ - // snd_scaletable[i][j] = ((signed char)j) * i * 8; - snd_scaletable[i][j] = ((j < 128) ? j : j - 0xff) * i * 8; - } -} - void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) { @@ -298,21 +280,11 @@ void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count) for (i = 0; i < count; i++) { - if ((ch->pos + i) >= sc->length) - { - Con_Printf("Overran Sample!\n"); - } - data = sfx[i]; left = (data * leftvol) >> 8; right = (data * rightvol) >> 8; paintbuffer[i].left += left; paintbuffer[i].right += right; - - if (paintbuffer[i].left > (1 << 24)) - { - Con_Printf("Clipping!\n"); - } } ch->pos += count; diff --git a/Quake/sound.h b/Quake/sound.h index ba22b0c6..239f69ee 100644 --- a/Quake/sound.h +++ b/Quake/sound.h @@ -215,9 +215,6 @@ extern int snd_blocked; void S_LocalSound (const char *s); sfxcache_t *S_LoadSound (sfx_t *s); -wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength); - -void SND_InitScaletable (void); void S_AmbientOff (void); void S_AmbientOn (void); From e052ab19a2760fc136f7c8fd6fd8faf548ba4035 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 14:44:48 -0700 Subject: [PATCH 07/18] Undo some debugging code --- Quake/snd_dma.c | 2 +- Quake/snd_resample.c | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Quake/snd_dma.c b/Quake/snd_dma.c index fca9a868..70c7de48 100644 --- a/Quake/snd_dma.c +++ b/Quake/snd_dma.c @@ -78,7 +78,7 @@ cvar_t sfxvolume = {"volume", "0.7", true}; cvar_t nosound = {"nosound", "0"}; cvar_t precache = {"precache", "1"}; -cvar_t loadas8bit = {"loadas8bit", "1"}; +cvar_t loadas8bit = {"loadas8bit", "0"}; cvar_t bgmbuffer = {"bgmbuffer", "4096"}; cvar_t ambient_level = {"ambient_level", "0.3"}; cvar_t ambient_fade = {"ambient_fade", "100"}; diff --git a/Quake/snd_resample.c b/Quake/snd_resample.c index 6bbd4c4a..25510011 100644 --- a/Quake/snd_resample.c +++ b/Quake/snd_resample.c @@ -93,7 +93,7 @@ void *Snd_Resample(void *handle, { struct resampler *data = (struct resampler *)handle; - int old_inrate, old_outrate; + unsigned int old_inrate, old_outrate; speex_resampler_get_rate(data->st, &old_inrate, &old_outrate); if (data->channels != channels) { @@ -119,11 +119,6 @@ void *Snd_Resample(void *handle, } *outnumsamples = outputtotal; - - if (*outnumsamples != (innumsamples / frac)) - { - Con_Printf("Output %d, predicted %d\n", *outnumsamples, (innumsamples / frac)); - } } From f908623606b90ae1fea2a2bfd1e9e951ec59d0e6 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 15:09:59 -0700 Subject: [PATCH 08/18] Mark OGGs as non looping --- Quake/snd_codec_ogg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Quake/snd_codec_ogg.c b/Quake/snd_codec_ogg.c index ad336f3d..3b573ea2 100644 --- a/Quake/snd_codec_ogg.c +++ b/Quake/snd_codec_ogg.c @@ -446,7 +446,8 @@ void *S_OGG_CodecLoad(const char *filename, snd_info_t *info) info->samples = stream->info.samples; info->size = stream->info.size; info->dataofs = stream->info.dataofs; - + info->loopstart = -1; + // allocate a buffer // this buffer must be free-ed by the caller of this function buffer = Z_Malloc(info->size); From fa8a6f88f2b002f68ca8a70081985cc5829a0aae Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 15:10:12 -0700 Subject: [PATCH 09/18] Allow playing oggs using 'play soundname' --- Quake/snd_dma.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Quake/snd_dma.c b/Quake/snd_dma.c index 70c7de48..5706bf2b 100644 --- a/Quake/snd_dma.c +++ b/Quake/snd_dma.c @@ -1148,13 +1148,7 @@ void S_Play (void) i = 1; while (i < Cmd_Argc()) { - if (!Q_strrchr(Cmd_Argv(i), '.')) - { - Q_strcpy(name, Cmd_Argv(i)); - Q_strcat(name, ".wav"); - } - else - Q_strcpy(name, Cmd_Argv(i)); + Q_strcpy(name, Cmd_Argv(i)); sfx = S_PrecacheSound(name); S_StartSound(hash++, 0, sfx, listener_origin, 1.0, 1.0); i++; From 1276aa62cd8cff5b7e979135cc3267b68a37d846 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 15:50:46 -0700 Subject: [PATCH 10/18] Warn when a CD track can't be played --- Quake/cd_shared.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Quake/cd_shared.c b/Quake/cd_shared.c index d239096f..7874ac6c 100644 --- a/Quake/cd_shared.c +++ b/Quake/cd_shared.c @@ -118,6 +118,10 @@ void CDAudio_PlayNamed(const char *name, qboolean looping) { usingBackend = true; } + else + { + Con_Printf( "WARNING: Unable to play music track %d\n", track ); + } return; } From 01556256fa76e14e665584694c2c66529a140604 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 16:04:03 -0700 Subject: [PATCH 11/18] Fix the OGG codec code to deal with OGGs in pak files --- Quake/snd_codec.c | 2 ++ Quake/snd_codec.h | 1 + Quake/snd_codec_ogg.c | 8 ++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Quake/snd_codec.c b/Quake/snd_codec.c index 015f9968..9de55fd0 100644 --- a/Quake/snd_codec.c +++ b/Quake/snd_codec.c @@ -226,6 +226,8 @@ snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec) stream->codec = codec; stream->file = hnd; stream->length = length; + stream->startpos = Sys_FileTell(hnd); + return stream; } diff --git a/Quake/snd_codec.h b/Quake/snd_codec.h index f4bc1205..d28eeea6 100644 --- a/Quake/snd_codec.h +++ b/Quake/snd_codec.h @@ -44,6 +44,7 @@ typedef struct snd_stream_s snd_info_t info; int length; int pos; + int startpos; void *ptr; } snd_stream_t; diff --git a/Quake/snd_codec_ogg.c b/Quake/snd_codec_ogg.c index 3b573ea2..339df583 100644 --- a/Quake/snd_codec_ogg.c +++ b/Quake/snd_codec_ogg.c @@ -127,7 +127,7 @@ int S_OGG_Callback_seek(void *datasource, ogg_int64_t offset, int whence) { // set the file position in the actual file with the Q3 function errno = 0; - Sys_FileSeek(stream->file, (long) offset); + Sys_FileSeek(stream->file, (long) stream->startpos + (long) offset); // something has gone wrong, so we return here if(errno != 0) @@ -144,7 +144,7 @@ int S_OGG_Callback_seek(void *datasource, ogg_int64_t offset, int whence) { // set the file position in the actual file with the Q3 function errno = 0; - Sys_FileSeek(stream->file, (long) stream->pos + (long) offset); + Sys_FileSeek(stream->file, (long) stream->startpos + (long) stream->pos + (long) offset); // something has gone wrong, so we return here if(errno != 0) @@ -164,7 +164,7 @@ int S_OGG_Callback_seek(void *datasource, ogg_int64_t offset, int whence) // set the file position in the actual file with the Q3 function errno = 0; - Sys_FileSeek(stream->file, (long) stream->length + (long) offset); + Sys_FileSeek(stream->file, (long) stream->startpos + (long) stream->length + (long) offset); // something has gone wrong, so we return here if(errno != 0) @@ -214,7 +214,7 @@ long S_OGG_Callback_tell(void *datasource) // snd_stream_t in the generic pointer stream = (snd_stream_t *) datasource; - return (long) Sys_FileTell(stream->file); + return (long) Sys_FileTell(stream->file) - (long) stream->startpos; } // the callback structure From 6f44bebff8e7debf7d28694563cb75004c0a8d12 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 23:09:43 -0700 Subject: [PATCH 12/18] Take away choices for music track and standardize on music/cdtracks/track01.ogg. We can only support one search location so that mods can override tracks. --- Quake/cd_shared.c | 70 ++++++++++------------------------------------- 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/Quake/cd_shared.c b/Quake/cd_shared.c index 7874ac6c..37fd890f 100644 --- a/Quake/cd_shared.c +++ b/Quake/cd_shared.c @@ -52,14 +52,10 @@ static void CDAudio_FinishedCallback(void *userdata) CDAudio_Next(); } -static qboolean CDAudio_TryPlayNamed(const char *name, qboolean looping) -{ - qboolean success = S_Base_StartBackgroundTrack(name, looping, CDAudio_FinishedCallback, NULL); - return success; -} - void CDAudio_PlayNamed(const char *name, qboolean looping) { + char filename[MAX_QPATH]; + if (!enabled) return; @@ -80,37 +76,11 @@ void CDAudio_PlayNamed(const char *name, qboolean looping) { track = remap[track]; } - q_snprintf(playTrackName, sizeof(playTrackName), "%03d", track); - } - else - { - q_snprintf(playTrackName, sizeof(playTrackName), "%s", name); - } + q_snprintf(playTrackName, sizeof(playTrackName), "%02d", track); + + q_snprintf(filename, sizeof(filename), "music/cdtracks/track%02u", track); + if (S_Base_StartBackgroundTrack(filename, looping, CDAudio_FinishedCallback, NULL)) return; - // First try to play a music file (path code from Darkplaces) - - char filename[MAX_QPATH]; - - if (track > 0) // We were given a numbered track - { - q_snprintf(filename, sizeof(filename), "sound/cdtracks/track%03u", track); - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "sound/cdtracks/track%02u", track); - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "music/cdtracks/track%03u", track);// added by motorsep - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "music/cdtracks/track%02u", track);// added by motorsep - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "music/track%03u", track);// added by motorsep - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "music/track%02u", track);// added by motorsep - if (CDAudio_TryPlayNamed(filename, looping)) return; - // No music file, so try using the hardware CD player CDAudioBackend_Play(track, looping); @@ -124,25 +94,15 @@ void CDAudio_PlayNamed(const char *name, qboolean looping) } return; } - - // We were given a named track - - q_snprintf(filename, sizeof(filename), "%s", playTrackName); - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "sound/%s", playTrackName); - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "sound/cdtracks/%s", playTrackName); - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "music/%s", playTrackName); - if (CDAudio_TryPlayNamed(filename, looping)) return; - - q_snprintf(filename, sizeof(filename), "music/cdtracks/%s", playTrackName); - if (CDAudio_TryPlayNamed(filename, looping)) return; - - Con_Printf("WARNING: Couldn't find music track \"%s\"\n", playTrackName); + else + { + q_snprintf(playTrackName, sizeof(playTrackName), "%s", name); + + q_snprintf(filename, sizeof(filename), "music/cdtracks/%s", playTrackName); + if (S_Base_StartBackgroundTrack(filename, looping, CDAudio_FinishedCallback, NULL)) return; + + Con_Printf("WARNING: Couldn't find music track \"%s\"\n", playTrackName); + } } void CDAudio_Play(byte track, qboolean looping) From 109bfc1ccfc1f18223b405fc763a0f4e88cbb4a0 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 23:12:56 -0700 Subject: [PATCH 13/18] fix wrong malloc size --- Quake/snd_resample.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Quake/snd_resample.c b/Quake/snd_resample.c index 25510011..21559c18 100644 --- a/Quake/snd_resample.c +++ b/Quake/snd_resample.c @@ -31,7 +31,7 @@ struct resampler { void *Snd_ResamplerInit() { - struct resampler *data = malloc(sizeof(struct resampler *)); + struct resampler *data = malloc(sizeof(struct resampler)); data->channels = 1; data->st = speex_resampler_init(1, 44100, 44100, Snd_ResamplerQuality, NULL); return data; From be88ebbf15a733d3d8cd0cc98c98b139498dec7a Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 19 Jan 2011 23:18:37 -0700 Subject: [PATCH 14/18] Remove debug check --- Quake/snd_mem.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Quake/snd_mem.c b/Quake/snd_mem.c index c389d80d..62b564ea 100644 --- a/Quake/snd_mem.c +++ b/Quake/snd_mem.c @@ -79,13 +79,6 @@ sfxcache_t *S_LoadSound (sfx_t *s) info.rate, info.width, info.samples, info.channels, data, shm->speed, shm->samplebits/8, &resampledNumSamples); - // FIXME: remove - if (info.rate == shm->speed && info.width == shm->samplebits/8) - { - if (resampledNumSamples != info.samples) exit(5); - if (0 != memcmp(data, resampled, (info.width * info.samples * info.channels))) exit(6); - } - len = resampledNumSamples * (shm->samplebits/8) * info.channels; // set up the sample struct From 946fb4aefd923542fc10ddf0edef070df032fc35 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 20 Jan 2011 12:27:02 -0700 Subject: [PATCH 15/18] Get rid of the USE_CODEC_VORBIS ifdef; we always want vorbis. --- Quake/cd_shared.c | 6 +++--- Quake/snd_codec.c | 2 -- Quake/snd_codec.h | 2 -- Quake/snd_codec_ogg.c | 5 ----- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Quake/cd_shared.c b/Quake/cd_shared.c index 37fd890f..0590346f 100644 --- a/Quake/cd_shared.c +++ b/Quake/cd_shared.c @@ -76,9 +76,9 @@ void CDAudio_PlayNamed(const char *name, qboolean looping) { track = remap[track]; } - q_snprintf(playTrackName, sizeof(playTrackName), "%02d", track); + q_snprintf(playTrackName, sizeof(playTrackName), "%03d", track); - q_snprintf(filename, sizeof(filename), "music/cdtracks/track%02u", track); + q_snprintf(filename, sizeof(filename), "sound/cdtracks/track%03u", track); if (S_Base_StartBackgroundTrack(filename, looping, CDAudio_FinishedCallback, NULL)) return; // No music file, so try using the hardware CD player @@ -98,7 +98,7 @@ void CDAudio_PlayNamed(const char *name, qboolean looping) { q_snprintf(playTrackName, sizeof(playTrackName), "%s", name); - q_snprintf(filename, sizeof(filename), "music/cdtracks/%s", playTrackName); + q_snprintf(filename, sizeof(filename), "sound/cdtracks/%s", playTrackName); if (S_Base_StartBackgroundTrack(filename, looping, CDAudio_FinishedCallback, NULL)) return; Con_Printf("WARNING: Couldn't find music track \"%s\"\n", playTrackName); diff --git a/Quake/snd_codec.c b/Quake/snd_codec.c index 9de55fd0..78011778 100644 --- a/Quake/snd_codec.c +++ b/Quake/snd_codec.c @@ -110,9 +110,7 @@ void S_CodecInit() { codecs = NULL; S_CodecRegister(&wav_codec); -#ifdef USE_CODEC_VORBIS S_CodecRegister(&ogg_codec); -#endif } /* diff --git a/Quake/snd_codec.h b/Quake/snd_codec.h index d28eeea6..85d8df0c 100644 --- a/Quake/snd_codec.h +++ b/Quake/snd_codec.h @@ -86,12 +86,10 @@ void S_WAV_CodecCloseStream(snd_stream_t *stream); int S_WAV_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer); // Ogg Vorbis codec -#ifdef USE_CODEC_VORBIS extern snd_codec_t ogg_codec; void *S_OGG_CodecLoad(const char *filename, snd_info_t *info); snd_stream_t *S_OGG_CodecOpenStream(const char *filename); void S_OGG_CodecCloseStream(snd_stream_t *stream); int S_OGG_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer); -#endif // USE_CODEC_VORBIS #endif // !_SND_CODEC_H_ diff --git a/Quake/snd_codec_ogg.c b/Quake/snd_codec_ogg.c index 339df583..1e3babb7 100644 --- a/Quake/snd_codec_ogg.c +++ b/Quake/snd_codec_ogg.c @@ -23,9 +23,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// OGG support is enabled by this define -#ifdef USE_CODEC_VORBIS - // includes for the Q3 sound system #include "quakedef.h" #include "snd_codec.h" @@ -474,5 +471,3 @@ void *S_OGG_CodecLoad(const char *filename, snd_info_t *info) return buffer; } - -#endif // USE_CODEC_VORBIS From 57f67bc79894468fbaaff3b7624d5cfa4bec5594 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 20 Jan 2011 12:32:01 -0700 Subject: [PATCH 16/18] Edit warning message --- Quake/cd_shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Quake/cd_shared.c b/Quake/cd_shared.c index 0590346f..69ddda54 100644 --- a/Quake/cd_shared.c +++ b/Quake/cd_shared.c @@ -101,7 +101,7 @@ void CDAudio_PlayNamed(const char *name, qboolean looping) q_snprintf(filename, sizeof(filename), "sound/cdtracks/%s", playTrackName); if (S_Base_StartBackgroundTrack(filename, looping, CDAudio_FinishedCallback, NULL)) return; - Con_Printf("WARNING: Couldn't find music track \"%s\"\n", playTrackName); + Con_Printf("WARNING: Unable to play music track \"%s\"\n", filename); } } From 143fbe8ea89bded3fda2e67575f184999c6c9e57 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 20 Jan 2011 13:03:40 -0700 Subject: [PATCH 17/18] Hack to play allow playing named cd tracks from the worldspawn sounds key --- Quake/cd_shared.c | 39 +++++++++++++++++++++++++++++++++++++++ Quake/cdaudio.h | 1 + Quake/cl_parse.c | 3 ++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Quake/cd_shared.c b/Quake/cd_shared.c index 69ddda54..40f47af1 100644 --- a/Quake/cd_shared.c +++ b/Quake/cd_shared.c @@ -47,6 +47,45 @@ static qboolean CDAudio_IsNumberedTrack(const char *trackName) return true; } +void CDAudio_NewMap () +{ + // hack copied from gl_fog.c:Fog_ParseWorldspawn() + char key[128], value[4096]; + const char *data; + + data = COM_Parse(cl.worldmodel->entities); + if (!data) + return; // error + if (com_token[0] != '{') + return; // error + while (1) + { + data = COM_Parse(data); + if (!data) + return; // error + if (com_token[0] == '}') + break; // end of worldspawn + if (com_token[0] == '_') + strcpy(key, com_token + 1); + else + strcpy(key, com_token); + while (key[strlen(key)-1] == ' ') // remove trailing spaces + key[strlen(key)-1] = 0; + data = COM_Parse(data); + if (!data) + return; // error + strcpy(value, com_token); + + if (!strcmp("sounds", key)) + { + if (!CDAudio_IsNumberedTrack(value)) + { + CDAudio_PlayNamed(value, true); + } + } + } +} + static void CDAudio_FinishedCallback(void *userdata) { CDAudio_Next(); diff --git a/Quake/cdaudio.h b/Quake/cdaudio.h index 411c6028..35fb0276 100644 --- a/Quake/cdaudio.h +++ b/Quake/cdaudio.h @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __CDAUDIO_H #define __CDAUDIO_H +void CDAudio_NewMap (); int CDAudio_Init(void); void CDAudio_PlayNamed(const char *name, qboolean looping); void CDAudio_Play(byte track, qboolean looping); diff --git a/Quake/cl_parse.c b/Quake/cl_parse.c index 1d14c159..560df095 100644 --- a/Quake/cl_parse.c +++ b/Quake/cl_parse.c @@ -373,7 +373,8 @@ void CL_ParseServerInfo (void) cl_entities[0].model = cl.worldmodel = cl.model_precache[1]; R_NewMap (); - + CDAudio_NewMap (); + //johnfitz -- clear out string; we don't consider identical //messages to be duplicates if the map has changed in between con_lastcenterstring[0] = 0; From 13a6d072f8ada482e87d623a16179fdfc3032fed Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 20 Jan 2011 13:37:34 -0700 Subject: [PATCH 18/18] Update linux makefile --- Quake/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Quake/Makefile b/Quake/Makefile index 62db1e9c..0052e8ef 100644 --- a/Quake/Makefile +++ b/Quake/Makefile @@ -132,7 +132,8 @@ DEFAULT_TARGET := quakespasm # objects # ---------------------------------------------------------------------------- -COMOBJ_SND := snd_dma.o snd_mix.o snd_mem.o +OBJ_OGGVORBIS := $(patsubst %.c,%.o,$(wildcard ../OggVorbis/*.c)) +COMOBJ_SND := cd_shared.o snd_dma.o snd_mix.o snd_mem.o snd_resample.o resample.o snd_codec.o snd_codec_wav.o snd_codec_ogg.o SYSOBJ_SND := snd_sdl.o SYSOBJ_CDA := cd_sdl.o SYSOBJ_INPUT := in_sdl.o @@ -168,6 +169,7 @@ GLOBJS = \ gl_model.o OBJS := \ + $(OBJ_OGGVORBIS) \ $(GLOBJS) \ $(SYSOBJ_INPUT) \ $(COMOBJ_SND) \