ogg playback working!!!

This commit is contained in:
Eric Wasylishen 2011-01-16 20:53:50 -07:00
parent 37dd875795
commit e14fc05aab
7 changed files with 26 additions and 26 deletions

View File

@ -106,9 +106,8 @@
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 */; };
66A5473512E3D14B00FFA7D5 /* libogg.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 66A5473412E3D14B00FFA7D5 /* libogg.dylib */; };
66A5473712E3D15F00FFA7D5 /* libvorbis.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 66A5473612E3D15F00FFA7D5 /* libvorbis.dylib */; };
66A5473912E3D17100FFA7D5 /* libvorbisfile.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 66A5473812E3D17100FFA7D5 /* libvorbisfile.dylib */; };
66A5487A12E3EA6900FFA7D5 /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66A5487912E3EA6900FFA7D5 /* Ogg.framework */; };
66A5487C12E3EA6E00FFA7D5 /* Vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66A5487B12E3EA6E00FFA7D5 /* Vorbis.framework */; };
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 */
@ -287,9 +286,8 @@
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; };
66A5473412E3D14B00FFA7D5 /* libogg.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libogg.dylib; path = /usr/local/lib/libogg.dylib; sourceTree = "<absolute>"; };
66A5473612E3D15F00FFA7D5 /* libvorbis.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbis.dylib; path = /usr/local/lib/libvorbis.dylib; sourceTree = "<absolute>"; };
66A5473812E3D17100FFA7D5 /* libvorbisfile.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbisfile.dylib; path = /usr/local/lib/libvorbisfile.dylib; sourceTree = "<absolute>"; };
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; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* QuakeSpasm.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QuakeSpasm.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@ -304,9 +302,8 @@
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
002F3C0109D093BD00EBEB88 /* OpenGL.framework in Frameworks */,
48348943120595B1004184BC /* Sparkle.framework in Frameworks */,
66A5473512E3D14B00FFA7D5 /* libogg.dylib in Frameworks */,
66A5473712E3D15F00FFA7D5 /* libvorbis.dylib in Frameworks */,
66A5473912E3D17100FFA7D5 /* libvorbisfile.dylib in Frameworks */,
66A5487A12E3EA6900FFA7D5 /* Ogg.framework in Frameworks */,
66A5487C12E3EA6E00FFA7D5 /* Vorbis.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -353,9 +350,8 @@
19C28FACFE9D520D11CA2CBB /* Products */,
4830B79D0D464CAE00EF4498 /* Changelog.txt */,
4830B79E0D464CAE00EF4498 /* Todo.txt */,
66A5473412E3D14B00FFA7D5 /* libogg.dylib */,
66A5473612E3D15F00FFA7D5 /* libvorbis.dylib */,
66A5473812E3D17100FFA7D5 /* libvorbisfile.dylib */,
66A5487912E3EA6900FFA7D5 /* Ogg.framework */,
66A5487B12E3EA6E00FFA7D5 /* Vorbis.framework */,
);
name = QuakeSpasm;
sourceTree = "<group>";
@ -831,8 +827,6 @@
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -844,13 +838,13 @@
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
HEADER_SEARCH_PATHS = (
/usr/local/include,
/Library/Frameworks/SDL.framework/Headers,
/Library/Frameworks/SDL_net.framework/Headers,
"$(HEADER_SEARCH_PATHS)",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
OTHER_CFLAGS = "-DUSE_CODEC_VORBIS";
PRODUCT_NAME = QuakeSpasm;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;

View File

@ -87,6 +87,7 @@ void CDAudio_PlayNamed(const char *name, qboolean looping)
playing = true;
// FIXME: make backend play
S_Base_StartBackgroundTrack(playTrackName, NULL);
}
void CDAudio_Play(byte track, qboolean looping)
@ -105,7 +106,8 @@ void CDAudio_Stop(void)
return;
// FIXME: stop backend
S_Base_StopBackgroundTrack();
wasPlaying = false;
playing = false;
}

View File

@ -88,7 +88,7 @@ static snd_codec_t *S_FindCodecForFile(const char *filename)
int handle;
if (Sys_FileOpenRead(fn, &handle) > 0)
{
Sys_FileClose(handle);
COM_CloseFile(handle);
return codec;
}
@ -216,7 +216,7 @@ snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec)
int length;
// Try to open the file
length = Sys_FileOpenRead(filename, &hnd);
length = COM_OpenFile(filename, &hnd);
if(hnd == -1)
{
Con_Printf("Can't read sound file %s\n", filename);
@ -227,7 +227,7 @@ snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec)
stream = Z_Malloc(sizeof(snd_stream_t));
if(!stream)
{
Sys_FileClose(hnd);
COM_CloseFile(hnd);
return NULL;
}
@ -245,7 +245,7 @@ S_CodecUtilClose
*/
void S_CodecUtilClose(snd_stream_t **stream)
{
Sys_FileClose((*stream)->file);
COM_CloseFile((*stream)->file);
Z_Free(*stream);
*stream = NULL;
}

View File

@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// FIXME:
#define USE_CODEC_VORBIS
// OGG support is enabled by this define
#ifdef USE_CODEC_VORBIS

View File

@ -215,7 +215,7 @@ void *S_WAV_CodecLoad(const char *filename, snd_info_t *info)
// Read the RIFF header
if(!S_ReadRIFFHeader(file, info))
{
Sys_FileClose(file);
COM_CloseFile(file);
Con_Printf( "ERROR: Incorrect/unsupported format in \"%s\"\n",
filename);
return NULL;
@ -225,7 +225,7 @@ void *S_WAV_CodecLoad(const char *filename, snd_info_t *info)
buffer = Z_Malloc(info->size);
if(!buffer)
{
Sys_FileClose(file);
COM_CloseFile(file);
Con_Printf( "ERROR: Out of memory reading \"%s\"\n",
filename);
return NULL;
@ -236,7 +236,7 @@ void *S_WAV_CodecLoad(const char *filename, snd_info_t *info)
S_ByteSwapRawSamples(info->samples, info->width, info->channels, (byte *)buffer);
// Close and return
Sys_FileClose(file);
COM_CloseFile(file);
return buffer;
}

View File

@ -143,6 +143,8 @@ void S_Init (void)
return;
}
S_CodecInit();
Cvar_RegisterVariable(&nosound, NULL);
Cvar_RegisterVariable(&sfxvolume, NULL);
Cvar_RegisterVariable(&precache, NULL);
@ -1010,7 +1012,7 @@ void S_Base_StartBackgroundTrack( const char *intro, const char *loop ){
}
if(s_backgroundStream->info.channels != 2 || s_backgroundStream->info.rate != 22050) {
Con_Printf( "WARNING: music file %s is not 22k stereo\n", intro );
Con_Printf( "WARNING: music file %s is %d channels and %d Hz\n", intro, s_backgroundStream->info.channels, s_backgroundStream->info.rate );
}
}

View File

@ -140,6 +140,10 @@ void SNDDMA_BlockSound(void);
/* unblocks the output upon window focus gain */
void SNDDMA_UnblockSound(void);
void S_Base_StopBackgroundTrack( void );
void S_Base_StartBackgroundTrack( const char *intro, const char *loop );
void S_UpdateBackgroundTrack( void );
// ====================================================================
// User-setable variables
// ====================================================================