mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
All kneel, king FLAC is here.
FLAC source from git commit 0920bc1ffb07f038b317e7e8056509fe0e4b680e, patched by me. Windows libFLAC.a built using i686-MinGW-w64 and x86_64-MinGW-w64. HUGE thanks to rhoenie for building the Mac fat library (ppc, i686, x86_86). git-svn-id: https://svn.eduke32.com/eduke32@3335 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
95dd57154e
commit
3933471e4b
24 changed files with 8167 additions and 94 deletions
|
@ -189,7 +189,7 @@ ifeq ($(SUBPLATFORM),LINUX)
|
|||
OURCOMMONFLAGS += -fno-pic
|
||||
endif
|
||||
OURASFLAGS += -f elf
|
||||
LIBS += -lvorbisfile -lvorbis -logg
|
||||
LIBS += -lFLAC -lvorbisfile -lvorbis -logg
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),WII)
|
||||
|
@ -215,7 +215,7 @@ ifeq ($(PLATFORM),DARWIN)
|
|||
OURCOMMONFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \
|
||||
-I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
|
||||
|
||||
LIBS += -lvorbisfile -lvorbis -logg -lm \
|
||||
LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lm \
|
||||
-Wl,-framework,SDL -Wl,-framework,SDL_mixer Apple/lib/libSDLmain.a \
|
||||
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
|
||||
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
|
||||
|
@ -227,7 +227,7 @@ ifeq ($(PLATFORM),DARWIN)
|
|||
GAMEOBJS+=$(OBJ)/SDLMain.$o
|
||||
else
|
||||
OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
|
||||
LIBS += -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \
|
||||
LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \
|
||||
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
|
||||
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
|
||||
-Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
|
||||
|
@ -244,7 +244,7 @@ endif
|
|||
ifeq ($(PLATFORM),WINDOWS)
|
||||
OURCOMMONFLAGS += -fno-pic -DUNDERSCORES
|
||||
OURASFLAGS+= -DUNDERSCORES -f win32
|
||||
LIBS += -lvorbisfile -lvorbis -logg
|
||||
LIBS += -lFLAC -lvorbisfile -lvorbis -logg
|
||||
LIBDIRS += -L$(abspath $(JAUDIOLIBDIR)/third-party/Windows/lib$(WINLIB))
|
||||
GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o
|
||||
EDITOROBJS+= $(OBJ)/buildres.$o
|
||||
|
|
|
@ -5,6 +5,7 @@ http://wiki.eduke32.com/wiki/Building_EDuke32_on_Windows
|
|||
|
||||
Download the latest sources from:
|
||||
https://www.xiph.org/downloads/
|
||||
http://git.xiph.org/?p=flac.git;a=summary
|
||||
http://zlib.net/
|
||||
http://www.libpng.org/pub/png/libpng.html
|
||||
http://www.webmproject.org/code/
|
||||
|
@ -13,7 +14,7 @@ http://www.libsdl.org/projects/SDL_mixer/
|
|||
|
||||
The build output listed as "Desired Results" is what EDuke32 needs to function.
|
||||
|
||||
The desired results for each library in some cases may need to be installed to the compiler. "x depends on the results of y to compile" means that the build output of x must be added to the compiler in this way. Copy files listed in each category to the appropriate destinations:
|
||||
The desired results for each library in some cases may need to be installed to the compiler. "x depends on the results of y to compile" means that the build output of x must be added to the compiler in this way. Copy files listed in each category to the appropriate destinations. Unless otherwise noted, do NOT copy the ".dll.a" file or else the final product may depend on external DLLs (which you may actually want).
|
||||
|
||||
For MinGW (MinGW32):
|
||||
from the compiler root (ex. C:\MinGW\)
|
||||
|
@ -47,6 +48,14 @@ Desired Results:
|
|||
- libraries: libvorbis.a libvorbisfile.a
|
||||
libvorbis depends on the results of libogg to compile.
|
||||
|
||||
libFLAC:
|
||||
To build:
|
||||
[make -f Makefile.lite libFLAC]
|
||||
Desired Results:
|
||||
- headers: FLAC\all.h FLAC\assert.h FLAC\callback.h FLAC\export.h FLAC\format.h FLAC\metadata.h FLAC\ordinals.h FLAC\stream_decoder.h FLAC\stream_encoder.h
|
||||
- libraries: libFLAC.a
|
||||
libFLAC depends on the results of libogg to compile.
|
||||
|
||||
|
||||
zlib:
|
||||
You may want to change -O3 to -O2 in win32\Makefile.gcc for stability and possibly performance benefits.
|
||||
|
@ -73,7 +82,7 @@ Desired Results:
|
|||
libvpx:
|
||||
Download the binary of yasm (http://yasm.tortall.net/) for your host system architecture. Both builds target both architectures.
|
||||
The build environment needs pr.exe (https://mingw-lib.googlecode.com/files/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2).
|
||||
If the configure scripts do not recognize your 64-bit compiler, you may need to apply the included patch "libvpx with MinGW-w64.patch".
|
||||
If the configure scripts do not recognize your 64-bit compiler, you may need to [git apply "libvpx with MinGW-w64.patch"].
|
||||
To build:
|
||||
[sh ./configure --disable-vp8-encoder --disable-multithread --disable-spatial-resampling --as=yasm && make]
|
||||
Desired Results:
|
||||
|
|
|
@ -8193,30 +8193,37 @@ static void G_ShowDebugHelp(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static char *S_OggifyFilename(char *destname, char *OGGname, const char *origname)
|
||||
static char *S_OggifyFilename(char *outputname, char *newname, const char *origname)
|
||||
{
|
||||
if (!origname)
|
||||
return destname;
|
||||
return outputname;
|
||||
|
||||
destname = (char *)Brealloc(destname, Bstrlen(OGGname) + Bstrlen(origname) + 1);
|
||||
outputname = (char *)Brealloc(outputname, Bstrlen(newname) + Bstrlen(origname) + 1);
|
||||
|
||||
if (!destname)
|
||||
if (!outputname)
|
||||
return NULL;
|
||||
|
||||
Bstrcpy(destname, *OGGname ? OGGname : origname);
|
||||
Bstrcpy(outputname, *newname ? newname : origname);
|
||||
|
||||
if (*OGGname && OGGname[Bstrlen(OGGname)-1] == '/')
|
||||
// a special case for specifying a prefix directory
|
||||
if (*newname && newname[Bstrlen(newname)-1] == '/')
|
||||
{
|
||||
while (*origname == '/')
|
||||
origname++;
|
||||
Bstrcat(destname, origname);
|
||||
Bstrcat(outputname, origname);
|
||||
}
|
||||
|
||||
if ((OGGname = Bstrchr(destname, '.')))
|
||||
Bstrcpy(OGGname, ".ogg");
|
||||
else Bstrcat(destname, ".ogg");
|
||||
#if 0
|
||||
// XXX: I don't see why we were previously clobbering the extension regardless of what it is.
|
||||
if ((newname = Bstrchr(outputname, '.')))
|
||||
Bstrcpy(newname, ".ogg");
|
||||
else Bstrcat(outputname, ".ogg");
|
||||
#endif
|
||||
|
||||
return destname;
|
||||
if (Bstrchr(outputname, '.') == NULL)
|
||||
Bstrcat(outputname, ".ogg");
|
||||
|
||||
return outputname;
|
||||
}
|
||||
|
||||
static int32_t S_DefineSound(int32_t ID,char *name)
|
||||
|
|
|
@ -9,7 +9,7 @@ INC=include
|
|||
# for BUILD_ECHOFLAGS:
|
||||
OURCOMMONFLAGS=$(BASECOMMONFLAGS) $(BUILDCOMMONFLAGS) -I$(INC) -I$(SRC)
|
||||
ifneq ($(PLATFORM),WII)
|
||||
OURCOMMONFLAGS+= -DHAVE_VORBIS
|
||||
OURCOMMONFLAGS+= -DHAVE_VORBIS -DHAVE_FLAC
|
||||
endif
|
||||
ifneq ($(RELEASE),0)
|
||||
# Debugging disabled
|
||||
|
@ -43,6 +43,7 @@ OBJECTS=$(OBJ)/drivers.o \
|
|||
$(OBJ)/mixst.o \
|
||||
$(OBJ)/pitch.o \
|
||||
$(OBJ)/vorbis.o \
|
||||
$(OBJ)/flac.o \
|
||||
$(OBJ)/driver_nosound.o
|
||||
|
||||
ifeq ($(PLATFORM),DARWIN)
|
||||
|
|
|
@ -98,7 +98,8 @@ typedef enum
|
|||
VOC,
|
||||
DemandFeed,
|
||||
WAV,
|
||||
Vorbis
|
||||
Vorbis,
|
||||
FLAC
|
||||
} wavedata;
|
||||
|
||||
typedef enum
|
||||
|
@ -238,6 +239,7 @@ void MV_SetVoiceMixMode( VoiceNode *voice );
|
|||
void MV_SetVoiceVolume ( VoiceNode *voice, int32_t vol, int32_t left, int32_t right );
|
||||
|
||||
void MV_ReleaseVorbisVoice( VoiceNode * voice );
|
||||
void MV_ReleaseFLACVoice( VoiceNode * voice );
|
||||
|
||||
// implemented in mix.c
|
||||
void ClearBuffer_DW( void *ptr, unsigned data, int32_t length );
|
||||
|
@ -310,6 +312,13 @@ extern const int16_t *MV_RightVolume;
|
|||
extern int32_t MV_SampleSize;
|
||||
extern int32_t MV_RightChannelOffset;
|
||||
|
||||
#define loopStartTagCount 2
|
||||
extern const char *loopStartTags[loopStartTagCount];
|
||||
#define loopEndTagCount 2
|
||||
extern const char *loopEndTags[loopEndTagCount];
|
||||
#define loopLengthTagCount 2
|
||||
extern const char *loopLengthTags[loopLengthTagCount];
|
||||
|
||||
#if defined __POWERPC__ || defined GEKKO
|
||||
# define BIGENDIAN
|
||||
#endif
|
||||
|
|
701
polymer/eduke32/source/jaudiolib/src/flac.c
Normal file
701
polymer/eduke32/source/jaudiolib/src/flac.c
Normal file
|
@ -0,0 +1,701 @@
|
|||
/*
|
||||
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* FLAC source support for MultiVoc
|
||||
*/
|
||||
|
||||
#ifdef HAVE_FLAC
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <FLAC/all.h>
|
||||
#else
|
||||
# include "FLAC/all.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include "pitch.h"
|
||||
#include "multivoc.h"
|
||||
#include "_multivc.h"
|
||||
|
||||
|
||||
#ifndef min
|
||||
#define min(x,y) ((x) < (y) ? (x) : (y))
|
||||
#endif
|
||||
#ifndef max
|
||||
#define max(x,y) ((x) > (y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
# if defined(_MSC_VER)
|
||||
# define strcasecmp _stricmp
|
||||
# define strncasecmp _strnicmp
|
||||
# elif defined(__QNX__)
|
||||
# define strcasecmp stricmp
|
||||
# define strncasecmp strnicmp
|
||||
# endif
|
||||
|
||||
typedef struct {
|
||||
void * ptr;
|
||||
size_t length;
|
||||
size_t pos;
|
||||
|
||||
FLAC__StreamDecoder* stream;
|
||||
FLAC__uint64 sample_pos;
|
||||
|
||||
char *block;
|
||||
size_t blocksize;
|
||||
|
||||
VoiceNode *owner;
|
||||
} flac_data;
|
||||
|
||||
// callbacks, round 1
|
||||
|
||||
static size_t read_flac(void * ptr, size_t size, size_t nmemb, FLAC__IOHandle datasource)
|
||||
{
|
||||
flac_data * flac = (flac_data *) datasource;
|
||||
size_t nread = 0;
|
||||
size_t bytes;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if (flac->length == flac->pos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (; nmemb > 0; nmemb--, nread++) {
|
||||
bytes = flac->length - flac->pos;
|
||||
if (size < bytes) {
|
||||
bytes = size;
|
||||
}
|
||||
|
||||
memcpy(ptr, (uint8_t *)flac->ptr + flac->pos, bytes);
|
||||
flac->pos += bytes;
|
||||
ptr = (uint8_t *)ptr + bytes;
|
||||
|
||||
if (flac->length == flac->pos) {
|
||||
nread++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
static size_t write_flac(const void * ptr, size_t size, size_t nmemb, FLAC__IOHandle datasource)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ptr);
|
||||
UNREFERENCED_PARAMETER(size);
|
||||
UNREFERENCED_PARAMETER(nmemb);
|
||||
UNREFERENCED_PARAMETER(datasource);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t seek_flac(FLAC__IOHandle datasource, FLAC__int64 offset, int32_t whence)
|
||||
{
|
||||
flac_data * flac = (flac_data *) datasource;
|
||||
|
||||
switch (whence) {
|
||||
case SEEK_SET: flac->pos = 0; break;
|
||||
case SEEK_CUR: break;
|
||||
case SEEK_END: flac->pos = flac->length; break;
|
||||
}
|
||||
|
||||
flac->pos += offset;
|
||||
|
||||
if (flac->pos > flac->length) {
|
||||
flac->pos = flac->length;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static FLAC__int64 tell_flac(FLAC__IOHandle datasource)
|
||||
{
|
||||
flac_data * flac = (flac_data *) datasource;
|
||||
|
||||
return flac->pos;
|
||||
}
|
||||
|
||||
static FLAC__int64 length_flac(FLAC__IOHandle datasource)
|
||||
{
|
||||
flac_data * flac = (flac_data *) datasource;
|
||||
|
||||
return flac->length;
|
||||
}
|
||||
|
||||
static int32_t eof_flac(FLAC__IOHandle datasource)
|
||||
{
|
||||
flac_data * flac = (flac_data *) datasource;
|
||||
|
||||
return (flac->pos == flac->length);
|
||||
}
|
||||
|
||||
static int32_t close_flac(FLAC__IOHandle datasource)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(datasource);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static FLAC__IOCallbacks flac_callbacks = {
|
||||
read_flac,
|
||||
write_flac,
|
||||
seek_flac,
|
||||
tell_flac,
|
||||
eof_flac,
|
||||
close_flac,
|
||||
};
|
||||
|
||||
|
||||
// callbacks, round 2
|
||||
|
||||
FLAC__StreamDecoderReadStatus read_flac_stream(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(decoder);
|
||||
if(*bytes > 0) {
|
||||
*bytes = read_flac(buffer, sizeof(FLAC__byte), *bytes, client_data);
|
||||
if(errno)
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
|
||||
else if(*bytes == 0)
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
|
||||
else
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
||||
}
|
||||
else
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderSeekStatus seek_flac_stream(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(decoder);
|
||||
if(seek_flac(client_data, absolute_byte_offset, SEEK_SET) < 0)
|
||||
return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
|
||||
else
|
||||
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderTellStatus tell_flac_stream(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(decoder);
|
||||
*absolute_byte_offset = tell_flac(client_data);
|
||||
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderLengthStatus length_flac_stream(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(decoder);
|
||||
*stream_length = length_flac(client_data);
|
||||
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
|
||||
}
|
||||
|
||||
FLAC__bool eof_flac_stream(const FLAC__StreamDecoder *decoder, void *client_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(decoder);
|
||||
return eof_flac(client_data);
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderWriteStatus write_flac_stream(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *const ibuffer[], void *client_data)
|
||||
{
|
||||
flac_data * fd = (flac_data *) client_data;
|
||||
VoiceNode *voice = fd->owner;
|
||||
const FLAC__uint64 samples = frame->header.blocksize;
|
||||
|
||||
UNREFERENCED_PARAMETER(decoder);
|
||||
|
||||
voice->channels = frame->header.channels;
|
||||
voice->bits = frame->header.bits_per_sample;
|
||||
voice->SamplingRate = frame->header.sample_rate;
|
||||
|
||||
voice->length = ((samples * (voice->bits/8))/2)<<voice->bits;
|
||||
voice->position = 0;
|
||||
voice->BlockLength = 0;
|
||||
voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
|
||||
voice->FixedPointBufferSize = ( voice->RateScale * MV_MIXBUFFERSIZE ) - voice->RateScale;
|
||||
MV_SetVoiceMixMode( voice );
|
||||
|
||||
if (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER)
|
||||
fd->sample_pos = frame->header.number.frame_number;
|
||||
else if (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER)
|
||||
fd->sample_pos = frame->header.number.sample_number;
|
||||
|
||||
{
|
||||
const size_t size = samples * voice->channels * (voice->bits/8);
|
||||
if (size > fd->blocksize)
|
||||
{
|
||||
fd->blocksize = size;
|
||||
fd->block = (char*)realloc(fd->block, sizeof(char) * size);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fd->block)
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||
|
||||
voice->sound = fd->block;
|
||||
|
||||
{
|
||||
char *obuffer = fd->block;
|
||||
FLAC__uint64 sample;
|
||||
uint8_t channel;
|
||||
|
||||
// this loop is adapted from code in ov_read_filter() in vorbisfile.c in libvorbis
|
||||
for(sample=0; sample < samples; ++sample)
|
||||
for(channel=0; channel < frame->header.channels; ++channel)
|
||||
{
|
||||
int8_t byte;
|
||||
FLAC__int32 val=ibuffer[channel][sample];
|
||||
if(val>(1<<(voice->bits-1))-1)
|
||||
val=(1<<(voice->bits-1))-1;
|
||||
else if(val<-(1<<(voice->bits-1)))
|
||||
val=-(1<<(voice->bits-1));
|
||||
#ifdef BIGENDIAN
|
||||
for (byte = voice->bits-8; byte >=0; byte -= 8)
|
||||
#else
|
||||
for (byte = 0; byte < voice->bits; byte += 8)
|
||||
#endif
|
||||
*obuffer++=((val>>byte)&0x000000FF);
|
||||
}
|
||||
}
|
||||
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
void error_flac_stream(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
|
||||
{
|
||||
// flac_data * fd = (flac_data *) client_data;
|
||||
UNREFERENCED_PARAMETER(client_data);
|
||||
UNREFERENCED_PARAMETER(decoder);
|
||||
MV_Printf("%s\n", FLAC__StreamDecoderErrorStatusString[status]);
|
||||
// FLAC__stream_decoder_flush(fd->stream);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MV_GetNextFLACBlock
|
||||
|
||||
Controls playback of FLAC data
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
static playbackstatus MV_GetNextFLACBlock
|
||||
(
|
||||
VoiceNode *voice
|
||||
)
|
||||
|
||||
{
|
||||
flac_data * fd = (flac_data *) voice->extra;
|
||||
FLAC__StreamDecoderState decode_state;
|
||||
// FLAC__bool decode_status;
|
||||
|
||||
voice->Playing = TRUE;
|
||||
|
||||
if ((FLAC__uint64)(uintptr_t)voice->LoopEnd > 0 && fd->sample_pos >= (FLAC__uint64)(uintptr_t)voice->LoopEnd)
|
||||
if (!FLAC__stream_decoder_seek_absolute(fd->stream, (FLAC__uint64)(uintptr_t)voice->LoopStart))
|
||||
MV_Printf("MV_GetNextFLACBlock FLAC__stream_decoder_seek_absolute: LOOP_START %ul, LOOP_END %ul\n",
|
||||
(FLAC__uint64)(uintptr_t)voice->LoopStart, (FLAC__uint64)(uintptr_t)voice->LoopEnd);
|
||||
|
||||
/*decode_status =*/ FLAC__stream_decoder_process_single(fd->stream);
|
||||
decode_state = FLAC__stream_decoder_get_state(fd->stream);
|
||||
|
||||
/*
|
||||
if (!decode_status)
|
||||
{
|
||||
MV_Printf("MV_GetNextFLACBlock: %s\n", FLAC__StreamDecoderStateString[decode_state]);
|
||||
voice->Playing = FALSE;
|
||||
return NoMoreData;
|
||||
}
|
||||
*/
|
||||
|
||||
if (decode_state == FLAC__STREAM_DECODER_SEEK_ERROR)
|
||||
{
|
||||
FLAC__stream_decoder_flush(fd->stream);
|
||||
decode_state = FLAC__stream_decoder_get_state(fd->stream);
|
||||
}
|
||||
|
||||
if (decode_state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
{
|
||||
if (voice->LoopSize > 0)
|
||||
{
|
||||
if (!FLAC__stream_decoder_seek_absolute(fd->stream, (FLAC__uint64)(uintptr_t)voice->LoopStart))
|
||||
MV_Printf("MV_GetNextFLACBlock FLAC__stream_decoder_seek_absolute: LOOP_START %ul\n",
|
||||
(FLAC__uint64)(uintptr_t)voice->LoopStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
voice->Playing = FALSE;
|
||||
return NoMoreData;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// unnecessary: duplicated in write_flac_stream()
|
||||
voice->channels = FLAC__stream_decoder_get_channels(fd->stream);
|
||||
voice->bits = FLAC__stream_decoder_get_bits_per_sample(fd->stream);
|
||||
voice->SamplingRate = FLAC__stream_decoder_get_sample_rate(fd->stream);
|
||||
voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
|
||||
voice->FixedPointBufferSize = ( voice->RateScale * MV_MIXBUFFERSIZE ) - voice->RateScale;
|
||||
MV_SetVoiceMixMode( voice );
|
||||
#endif
|
||||
|
||||
return( KeepPlaying );
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MV_PlayFLAC3D
|
||||
|
||||
Begin playback of sound data at specified angle and distance
|
||||
from listener.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayFLAC3D
|
||||
(
|
||||
char *ptr,
|
||||
uint32_t ptrlength,
|
||||
int32_t pitchoffset,
|
||||
int32_t angle,
|
||||
int32_t distance,
|
||||
int32_t priority,
|
||||
uint32_t callbackval
|
||||
)
|
||||
|
||||
{
|
||||
int32_t left;
|
||||
int32_t right;
|
||||
int32_t mid;
|
||||
int32_t volume;
|
||||
int32_t status;
|
||||
|
||||
if ( !MV_Installed )
|
||||
{
|
||||
MV_SetErrorCode( MV_NotInstalled );
|
||||
return( MV_Error );
|
||||
}
|
||||
|
||||
if ( distance < 0 )
|
||||
{
|
||||
distance = -distance;
|
||||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
|
||||
volume = MIX_VOLUME( distance );
|
||||
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
left = MV_PanTable[ angle ][ volume ].left;
|
||||
right = MV_PanTable[ angle ][ volume ].right;
|
||||
mid = max( 0, 255 - distance );
|
||||
|
||||
status = MV_PlayFLAC( ptr, ptrlength, pitchoffset, mid, left, right, priority,
|
||||
callbackval );
|
||||
|
||||
return( status );
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MV_PlayFLAC
|
||||
|
||||
Begin playback of sound data with the given sound levels and
|
||||
priority.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayFLAC
|
||||
(
|
||||
char *ptr,
|
||||
uint32_t ptrlength,
|
||||
int32_t pitchoffset,
|
||||
int32_t vol,
|
||||
int32_t left,
|
||||
int32_t right,
|
||||
int32_t priority,
|
||||
uint32_t callbackval
|
||||
)
|
||||
|
||||
{
|
||||
int32_t status;
|
||||
|
||||
status = MV_PlayLoopedFLAC( ptr, ptrlength, -1, -1, pitchoffset, vol, left, right,
|
||||
priority, callbackval );
|
||||
|
||||
return( status );
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MV_PlayLoopedFLAC
|
||||
|
||||
Begin playback of sound data with the given sound levels and
|
||||
priority.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayLoopedFLAC
|
||||
(
|
||||
char *ptr,
|
||||
uint32_t ptrlength,
|
||||
int32_t loopstart,
|
||||
int32_t loopend,
|
||||
int32_t pitchoffset,
|
||||
int32_t vol,
|
||||
int32_t left,
|
||||
int32_t right,
|
||||
int32_t priority,
|
||||
uint32_t callbackval
|
||||
)
|
||||
|
||||
{
|
||||
VoiceNode *voice;
|
||||
flac_data * fd = 0;
|
||||
FLAC__Metadata_Chain* metadata_chain;
|
||||
|
||||
if ( !MV_Installed )
|
||||
{
|
||||
MV_SetErrorCode( MV_NotInstalled );
|
||||
return( MV_Error );
|
||||
}
|
||||
|
||||
fd = (flac_data *) malloc( sizeof(flac_data) );
|
||||
if (!fd) {
|
||||
MV_SetErrorCode( MV_InvalidFLACFile );
|
||||
return MV_Error;
|
||||
}
|
||||
|
||||
memset(fd, 0, sizeof(flac_data));
|
||||
fd->ptr = ptr;
|
||||
fd->pos = 0;
|
||||
fd->blocksize = 0;
|
||||
fd->length = ptrlength;
|
||||
|
||||
fd->block = NULL;
|
||||
|
||||
fd->stream = FLAC__stream_decoder_new();
|
||||
fd->sample_pos = 0;
|
||||
|
||||
FLAC__stream_decoder_set_metadata_ignore_all(fd->stream);
|
||||
|
||||
if (FLAC__stream_decoder_init_stream(fd->stream,
|
||||
read_flac_stream,
|
||||
seek_flac_stream,
|
||||
tell_flac_stream,
|
||||
length_flac_stream,
|
||||
eof_flac_stream,
|
||||
write_flac_stream,
|
||||
/*metadata_flac_stream*/ NULL,
|
||||
error_flac_stream,
|
||||
(void*) fd) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
|
||||
MV_Printf("MV_PlayLoopedFLAC: %s\n", FLAC__stream_decoder_get_resolved_state_string(fd->stream));
|
||||
MV_SetErrorCode( MV_InvalidFLACFile );
|
||||
return MV_Error;
|
||||
}
|
||||
|
||||
// Request a voice from the voice pool
|
||||
voice = MV_AllocVoice( priority );
|
||||
if ( voice == NULL )
|
||||
{
|
||||
FLAC__stream_decoder_finish(fd->stream);
|
||||
FLAC__stream_decoder_delete(fd->stream);
|
||||
free(fd);
|
||||
MV_SetErrorCode( MV_NoVoices );
|
||||
return( MV_Error );
|
||||
}
|
||||
|
||||
fd->owner = voice;
|
||||
|
||||
voice->wavetype = FLAC;
|
||||
voice->extra = (void*)fd;
|
||||
voice->GetSound = MV_GetNextFLACBlock;
|
||||
voice->NextBlock = fd->block;
|
||||
voice->DemandFeed = NULL;
|
||||
voice->LoopCount = 0;
|
||||
voice->BlockLength = 0;
|
||||
voice->PitchScale = PITCH_GetScale( pitchoffset );
|
||||
voice->next = NULL;
|
||||
voice->prev = NULL;
|
||||
voice->priority = priority;
|
||||
voice->callbackval = callbackval;
|
||||
|
||||
voice->Playing = TRUE;
|
||||
voice->Paused = FALSE;
|
||||
|
||||
voice->LoopStart = (char *) (intptr_t)(loopstart >= 0 ? loopstart : 0);
|
||||
voice->LoopEnd = (char *) (intptr_t)(loopstart >= 0 && loopend > 0 ? loopend : 0);
|
||||
voice->LoopSize = (loopstart >= 0 ? 1 : 0);
|
||||
|
||||
// parse metadata
|
||||
// loop parsing designed with multiple repetitions in mind
|
||||
// In retrospect, it may be possible to MV_GetVorbisCommentLoops(voice, (vorbis_comment *) tags->data.vorbis_comment)
|
||||
// but libvorbisfile may be confused by the signedness of char* vs FLAC__byte* and this code does not depend on HAVE_VORBIS.
|
||||
metadata_chain = FLAC__metadata_chain_new();
|
||||
if (metadata_chain != NULL)
|
||||
{
|
||||
if (FLAC__metadata_chain_read_with_callbacks(metadata_chain, fd, flac_callbacks))
|
||||
{
|
||||
FLAC__Metadata_Iterator* metadata_iterator = FLAC__metadata_iterator_new();
|
||||
if (metadata_iterator != NULL)
|
||||
{
|
||||
char *vc_loopstart = NULL;
|
||||
char *vc_loopend = NULL;
|
||||
char *vc_looplength = NULL;
|
||||
|
||||
FLAC__metadata_iterator_init(metadata_iterator, metadata_chain);
|
||||
|
||||
do
|
||||
{
|
||||
FLAC__StreamMetadata *tags = FLAC__metadata_iterator_get_block(metadata_iterator);
|
||||
|
||||
if (tags->type == FLAC__METADATA_TYPE_STREAMINFO)
|
||||
{
|
||||
const FLAC__StreamMetadata_StreamInfo *info = &tags->data.stream_info;
|
||||
|
||||
if (info->channels != 1 && info->channels != 2) {
|
||||
FLAC__metadata_object_delete(tags);
|
||||
FLAC__metadata_iterator_delete(metadata_iterator);
|
||||
// FLAC__metadata_chain_delete(metadata_chain);
|
||||
FLAC__stream_decoder_finish(fd->stream);
|
||||
FLAC__stream_decoder_delete(fd->stream);
|
||||
free(fd);
|
||||
MV_SetErrorCode( MV_InvalidFLACFile );
|
||||
return MV_Error;
|
||||
}
|
||||
|
||||
voice->channels = info->channels;
|
||||
voice->bits = info->bits_per_sample;
|
||||
voice->SamplingRate = info->sample_rate;
|
||||
}
|
||||
|
||||
// load loop tags from metadata
|
||||
if (tags->type == FLAC__METADATA_TYPE_VORBIS_COMMENT && loopstart < 1)
|
||||
{
|
||||
FLAC__uint32 comment;
|
||||
uint8_t loopTagCount;
|
||||
for (comment = 0; comment < tags->data.vorbis_comment.num_comments; ++comment)
|
||||
{
|
||||
const char *entry = (const char *) tags->data.vorbis_comment.comments[comment].entry;
|
||||
if (entry != NULL && entry[0] != '\0')
|
||||
{
|
||||
const char *value = strchr(entry,'=');
|
||||
const size_t field = value-entry;
|
||||
value += 1;
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < loopStartTagCount && vc_loopstart == NULL; ++loopTagCount)
|
||||
if (strncasecmp(entry, loopStartTags[loopTagCount], field) == 0)
|
||||
vc_loopstart = strdup(value);
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < loopEndTagCount && vc_loopend == NULL; ++loopTagCount)
|
||||
if (strncasecmp(entry, loopEndTags[loopTagCount], field) == 0)
|
||||
vc_loopend = strdup(value);
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < loopLengthTagCount && vc_looplength == NULL; ++loopTagCount)
|
||||
if (strncasecmp(entry, loopLengthTags[loopTagCount], field) == 0)
|
||||
vc_looplength = strdup(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__metadata_object_delete(tags); // If it wasn't for this I would assign pointers instead of strdup().
|
||||
}
|
||||
while (FLAC__metadata_iterator_next(metadata_iterator));
|
||||
|
||||
if (loopstart < 1)
|
||||
{
|
||||
if (vc_loopstart != NULL)
|
||||
{
|
||||
{
|
||||
const FLAC__int64 flac_loopstart = atol(vc_loopstart);
|
||||
if (flac_loopstart >= 0) // a loop starting at 0 is valid
|
||||
{
|
||||
voice->LoopStart = (const char *) (intptr_t) flac_loopstart;
|
||||
voice->LoopSize = 1;
|
||||
}
|
||||
}
|
||||
free(vc_loopstart);
|
||||
}
|
||||
if (vc_loopend != NULL)
|
||||
{
|
||||
if (voice->LoopSize > 0)
|
||||
{
|
||||
const FLAC__int64 flac_loopend = atol(vc_loopend);
|
||||
if (flac_loopend > 0) // a loop ending at 0 is invalid
|
||||
voice->LoopEnd = (const char *) (intptr_t) flac_loopend;
|
||||
}
|
||||
free(vc_loopend);
|
||||
}
|
||||
if (vc_looplength != NULL)
|
||||
{
|
||||
if (voice->LoopSize > 0 && voice->LoopEnd == 0)
|
||||
{
|
||||
const FLAC__int64 flac_looplength = atol(vc_looplength);
|
||||
if (flac_looplength > 0) // a loop of length 0 is invalid
|
||||
voice->LoopEnd = (const char *) ((intptr_t) flac_looplength + (intptr_t) voice->LoopStart);
|
||||
}
|
||||
free(vc_looplength);
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__metadata_iterator_delete(metadata_iterator);
|
||||
}
|
||||
else
|
||||
MV_Printf("Error allocating FLAC__Metadata_Iterator!\n");
|
||||
}
|
||||
else
|
||||
MV_Printf("%s\n", FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(metadata_chain)]);
|
||||
|
||||
// FLAC__metadata_chain_delete(metadata_chain); // when run with GDB, this throws SIGTRAP about freed heap memory being modified
|
||||
}
|
||||
else
|
||||
MV_Printf("Error allocating FLAC__Metadata_Chain!\n");
|
||||
|
||||
voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
|
||||
voice->FixedPointBufferSize = ( voice->RateScale * MV_MIXBUFFERSIZE ) -
|
||||
voice->RateScale;
|
||||
MV_SetVoiceMixMode( voice );
|
||||
|
||||
MV_SetVoiceVolume( voice, vol, left, right );
|
||||
MV_PlayVoice( voice );
|
||||
|
||||
return( voice->handle );
|
||||
}
|
||||
|
||||
|
||||
void MV_ReleaseFLACVoice( VoiceNode * voice )
|
||||
{
|
||||
flac_data * fd = (flac_data *) voice->extra;
|
||||
|
||||
if (voice->wavetype != FLAC) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fd->stream != NULL)
|
||||
{
|
||||
FLAC__stream_decoder_finish(fd->stream);
|
||||
FLAC__stream_decoder_delete(fd->stream);
|
||||
}
|
||||
if (fd->block != NULL)
|
||||
free(fd->block);
|
||||
free(fd);
|
||||
|
||||
voice->extra = 0;
|
||||
}
|
||||
|
||||
#endif //HAVE_FLAC
|
|
@ -937,6 +937,11 @@ int32_t FX_PlayAuto(char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol
|
|||
case 'O'+('g'<<8)+('g'<<16)+('S'<<24):
|
||||
handle = MV_PlayVorbis(ptr, length, pitchoffset, vol, left, right, priority, callbackval);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_FLAC
|
||||
case 'f'+('L'<<8)+('a'<<16)+('C'<<24):
|
||||
handle = MV_PlayFLAC(ptr, length, pitchoffset, vol, left, right, priority, callbackval);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
switch (LITTLE32(*(int32_t *)(ptr + 8)))
|
||||
|
@ -994,6 +999,11 @@ int32_t FX_PlayLoopedAuto(char *ptr, uint32_t length, int32_t loopstart, int32_t
|
|||
case 'O'+('g'<<8)+('g'<<16)+('S'<<24):
|
||||
handle = MV_PlayLoopedVorbis(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_FLAC
|
||||
case 'f'+('L'<<8)+('a'<<16)+('C'<<24):
|
||||
handle = MV_PlayLoopedFLAC(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
switch (LITTLE32(*(int32_t *)(ptr + 8)))
|
||||
|
@ -1037,6 +1047,11 @@ int32_t FX_PlayAuto3D(char *ptr, uint32_t length, int32_t pitchoffset, int32_t a
|
|||
case 'O'+('g'<<8)+('g'<<16)+('S'<<24): // OggS
|
||||
handle = MV_PlayVorbis3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_FLAC
|
||||
case 'f'+('L'<<8)+('a'<<16)+('C'<<24): // fLaC
|
||||
handle = MV_PlayFLAC3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
switch (LITTLE32(*(int32_t *)(ptr + 8)))
|
||||
|
|
|
@ -215,6 +215,9 @@ const char *MV_ErrorString(int32_t ErrorNumber)
|
|||
case MV_InvalidVorbisFile :
|
||||
return "Invalid OggVorbis file passed in to Multivoc.";
|
||||
|
||||
case MV_InvalidFLACFile :
|
||||
return "Invalid FLAC file passed in to Multivoc.";
|
||||
|
||||
case MV_InvalidMixMode :
|
||||
return "Invalid mix mode request in Multivoc.";
|
||||
|
||||
|
@ -338,6 +341,10 @@ static void MV_StopVoice(VoiceNode *voice)
|
|||
if (voice->wavetype == Vorbis)
|
||||
MV_ReleaseVorbisVoice(voice);
|
||||
#endif
|
||||
#ifdef HAVE_FLAC
|
||||
if (voice->wavetype == FLAC)
|
||||
MV_ReleaseFLACVoice(voice);
|
||||
#endif
|
||||
|
||||
voice->handle = 0;
|
||||
}
|
||||
|
@ -461,6 +468,10 @@ static void MV_ServiceVoc(void)
|
|||
#ifdef HAVE_VORBIS
|
||||
if (voice->wavetype == Vorbis)
|
||||
MV_ReleaseVorbisVoice(voice);
|
||||
#endif
|
||||
#ifdef HAVE_FLAC
|
||||
if (voice->wavetype == FLAC)
|
||||
MV_ReleaseFLACVoice(voice);
|
||||
#endif
|
||||
voice->handle = 0;
|
||||
|
||||
|
@ -2733,4 +2744,18 @@ void MV_SetPrintf(void (*function)(const char *, ...))
|
|||
}
|
||||
|
||||
|
||||
const char *loopStartTags[loopStartTagCount] = {
|
||||
"LOOP_START",
|
||||
"LOOPSTART"
|
||||
};
|
||||
const char *loopEndTags[loopEndTagCount] = {
|
||||
"LOOP_END",
|
||||
"LOOPEND"
|
||||
};
|
||||
const char *loopLengthTags[loopLengthTagCount] = {
|
||||
"LOOP_LENGTH",
|
||||
"LOOPLENGTH"
|
||||
};
|
||||
|
||||
|
||||
// vim:ts=3:expandtab:
|
||||
|
|
|
@ -53,6 +53,7 @@ enum MV_Errors
|
|||
MV_InvalidVOCFile,
|
||||
MV_InvalidWAVFile,
|
||||
MV_InvalidVorbisFile,
|
||||
MV_InvalidFLACFile,
|
||||
MV_InvalidMixMode,
|
||||
MV_NullRecordFunction
|
||||
};
|
||||
|
@ -109,6 +110,13 @@ int32_t MV_PlayVorbis( char *ptr, uint32_t length, int32_t pitchoffset, int32_
|
|||
int32_t MV_PlayLoopedVorbis( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend,
|
||||
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,
|
||||
uint32_t callbackval );
|
||||
int32_t MV_PlayFLAC3D( char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, uint32_t callbackval );
|
||||
int32_t MV_PlayFLAC( char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
|
||||
int32_t priority, uint32_t callbackval );
|
||||
int32_t MV_PlayLoopedFLAC( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend,
|
||||
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,
|
||||
uint32_t callbackval );
|
||||
//void MV_CreateVolumeTable( int32_t index, int32_t volume, int32_t MaxVolume );
|
||||
void MV_SetVolume( int32_t volume );
|
||||
int32_t MV_GetVolume( void );
|
||||
|
|
|
@ -24,14 +24,6 @@
|
|||
|
||||
#ifdef HAVE_VORBIS
|
||||
|
||||
#define OV_EXCLUDE_STATIC_CALLBACKS
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <vorbis/vorbisfile.h>
|
||||
#else
|
||||
# include "vorbis/vorbisfile.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -43,6 +35,14 @@
|
|||
#include "multivoc.h"
|
||||
#include "_multivc.h"
|
||||
|
||||
#define OV_EXCLUDE_STATIC_CALLBACKS
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <vorbis/vorbisfile.h>
|
||||
#else
|
||||
# include "vorbis/vorbisfile.h"
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(x,y) ((x) < (y) ? (x) : (y))
|
||||
#endif
|
||||
|
@ -63,6 +63,65 @@ typedef struct {
|
|||
int32_t lastbitstream;
|
||||
} vorbis_data;
|
||||
|
||||
// designed with multiple calls in mind
|
||||
static void MV_GetVorbisCommentLoops(VoiceNode *voice, vorbis_comment *vc)
|
||||
{
|
||||
uint8_t loopTagCount;
|
||||
|
||||
if (vc == NULL)
|
||||
return;
|
||||
|
||||
{
|
||||
char *vc_loopstart = NULL;
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < loopStartTagCount && vc_loopstart == NULL; ++loopTagCount)
|
||||
vc_loopstart = vorbis_comment_query(vc, loopStartTags[loopTagCount], 0);
|
||||
|
||||
if (vc_loopstart != NULL)
|
||||
{
|
||||
const ogg_int64_t ov_loopstart = atol(vc_loopstart);
|
||||
if (ov_loopstart >= 0) // a loop starting at 0 is valid
|
||||
{
|
||||
voice->LoopStart = (const char *) (intptr_t) ov_loopstart;
|
||||
voice->LoopSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (voice->LoopSize > 0)
|
||||
{
|
||||
{
|
||||
char *vc_loopend = NULL;
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < loopEndTagCount && vc_loopend == NULL; ++loopTagCount)
|
||||
vc_loopend = vorbis_comment_query(vc, loopEndTags[loopTagCount], 0);
|
||||
|
||||
if (vc_loopend != NULL)
|
||||
{
|
||||
const ogg_int64_t ov_loopend = atol(vc_loopend);
|
||||
if (ov_loopend > 0) // a loop ending at 0 is invalid
|
||||
voice->LoopEnd = (const char *) (intptr_t) ov_loopend;
|
||||
}
|
||||
}
|
||||
|
||||
if (voice->LoopEnd == 0)
|
||||
{
|
||||
char *vc_looplength = NULL;
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < loopLengthTagCount && vc_looplength == NULL; ++loopTagCount)
|
||||
vc_looplength = vorbis_comment_query(vc, loopLengthTags[loopTagCount], 0);
|
||||
|
||||
if (vc_looplength != NULL)
|
||||
{
|
||||
const ogg_int64_t ov_looplength = atol(vc_looplength);
|
||||
if (ov_looplength > 0) // a loop of length 0 is invalid
|
||||
voice->LoopEnd = (const char *) ((intptr_t) ov_looplength + (intptr_t) voice->LoopStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// callbacks
|
||||
|
||||
static size_t read_vorbis(void * ptr, size_t size, size_t nmemb, void * datasource)
|
||||
{
|
||||
|
@ -219,7 +278,7 @@ static playbackstatus MV_GetNextVorbisBlock
|
|||
voice->position = 0;
|
||||
voice->sound = vd->block;
|
||||
voice->BlockLength = 0;
|
||||
voice->length = bytesread << 16;
|
||||
voice->length = bytesread << 16; // ???: Should the literal 16 be voice->bits?
|
||||
|
||||
return( KeepPlaying );
|
||||
}
|
||||
|
@ -406,69 +465,7 @@ int32_t MV_PlayLoopedVorbis
|
|||
|
||||
// load loop tags from metadata
|
||||
if (loopstart < 1)
|
||||
{
|
||||
vorbis_comment * vc = ov_comment(&vd->vf, 0);
|
||||
if (vc != NULL)
|
||||
{
|
||||
int loopTagCount;
|
||||
|
||||
static const char *loopStartTags[] = {
|
||||
"LOOP_START",
|
||||
"LOOPSTART"
|
||||
};
|
||||
|
||||
char *vc_loopstart = NULL;
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < 2 && vc_loopstart == NULL; ++loopTagCount)
|
||||
vc_loopstart = vorbis_comment_query(vc, loopStartTags[loopTagCount], 0);
|
||||
|
||||
if (vc_loopstart != NULL)
|
||||
{
|
||||
ogg_int64_t ov_loopstart = atol(vc_loopstart);
|
||||
if (ov_loopstart >= 0) // a loop starting at 0 is valid
|
||||
{
|
||||
static const char *loopEndTags[] = {
|
||||
"LOOP_END",
|
||||
"LOOPEND"
|
||||
};
|
||||
|
||||
char *vc_loopend = NULL;
|
||||
|
||||
voice->LoopStart = (char *) (intptr_t) ov_loopstart;
|
||||
voice->LoopSize = 1;
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < 2 && vc_loopend == NULL; ++loopTagCount)
|
||||
vc_loopend = vorbis_comment_query(vc, loopEndTags[loopTagCount], 0);
|
||||
|
||||
if (vc_loopend != NULL)
|
||||
{
|
||||
ogg_int64_t ov_loopend = atol(vc_loopend);
|
||||
if (ov_loopend > 0) // a loop ending at 0 is invalid
|
||||
voice->LoopEnd = (char *) (intptr_t) ov_loopend;
|
||||
}
|
||||
else
|
||||
{
|
||||
static const char *loopLengthTags[] = {
|
||||
"LOOP_LENGTH",
|
||||
"LOOPLENGTH"
|
||||
};
|
||||
|
||||
char *vc_looplength = NULL;
|
||||
|
||||
for (loopTagCount = 0; loopTagCount < 2 && vc_looplength == NULL; ++loopTagCount)
|
||||
vc_looplength = vorbis_comment_query(vc, loopLengthTags[loopTagCount], 0);
|
||||
|
||||
if (vc_looplength != NULL)
|
||||
{
|
||||
ogg_int64_t ov_looplength = atol(vc_looplength);
|
||||
if (ov_looplength > 0) // a loop of length 0 is invalid
|
||||
voice->LoopEnd = (char *) (intptr_t) (ov_looplength + ov_loopstart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MV_GetVorbisCommentLoops(voice, ov_comment(&vd->vf, 0));
|
||||
|
||||
voice->Playing = TRUE;
|
||||
voice->Paused = FALSE;
|
||||
|
@ -485,7 +482,6 @@ int32_t MV_PlayLoopedVorbis
|
|||
return( voice->handle );
|
||||
}
|
||||
|
||||
|
||||
void MV_ReleaseVorbisVoice( VoiceNode * voice )
|
||||
{
|
||||
vorbis_data * vd = (vorbis_data *) voice->extra;
|
||||
|
|
BIN
polymer/eduke32/source/jaudiolib/third-party/Apple/lib/libFLAC.a
vendored
Normal file
BIN
polymer/eduke32/source/jaudiolib/third-party/Apple/lib/libFLAC.a
vendored
Normal file
Binary file not shown.
BIN
polymer/eduke32/source/jaudiolib/third-party/Windows/lib/32/libFLAC.a
vendored
Normal file
BIN
polymer/eduke32/source/jaudiolib/third-party/Windows/lib/32/libFLAC.a
vendored
Normal file
Binary file not shown.
BIN
polymer/eduke32/source/jaudiolib/third-party/Windows/lib/64/libFLAC.a
vendored
Normal file
BIN
polymer/eduke32/source/jaudiolib/third-party/Windows/lib/64/libFLAC.a
vendored
Normal file
Binary file not shown.
370
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/all.h
vendored
Normal file
370
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/all.h
vendored
Normal file
|
@ -0,0 +1,370 @@
|
|||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__ALL_H
|
||||
#define FLAC__ALL_H
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "callback.h"
|
||||
#include "format.h"
|
||||
#include "metadata.h"
|
||||
#include "ordinals.h"
|
||||
#include "stream_decoder.h"
|
||||
#include "stream_encoder.h"
|
||||
|
||||
/** \mainpage
|
||||
*
|
||||
* \section intro Introduction
|
||||
*
|
||||
* This is the documentation for the FLAC C and C++ APIs. It is
|
||||
* highly interconnected; this introduction should give you a top
|
||||
* level idea of the structure and how to find the information you
|
||||
* need. As a prerequisite you should have at least a basic
|
||||
* knowledge of the FLAC format, documented
|
||||
* <A HREF="../format.html">here</A>.
|
||||
*
|
||||
* \section c_api FLAC C API
|
||||
*
|
||||
* The FLAC C API is the interface to libFLAC, a set of structures
|
||||
* describing the components of FLAC streams, and functions for
|
||||
* encoding and decoding streams, as well as manipulating FLAC
|
||||
* metadata in files. The public include files will be installed
|
||||
* in your include area (for example /usr/include/FLAC/...).
|
||||
*
|
||||
* By writing a little code and linking against libFLAC, it is
|
||||
* relatively easy to add FLAC support to another program. The
|
||||
* library is licensed under <A HREF="../license.html">Xiph's BSD license</A>.
|
||||
* Complete source code of libFLAC as well as the command-line
|
||||
* encoder and plugins is available and is a useful source of
|
||||
* examples.
|
||||
*
|
||||
* Aside from encoders and decoders, libFLAC provides a powerful
|
||||
* metadata interface for manipulating metadata in FLAC files. It
|
||||
* allows the user to add, delete, and modify FLAC metadata blocks
|
||||
* and it can automatically take advantage of PADDING blocks to avoid
|
||||
* rewriting the entire FLAC file when changing the size of the
|
||||
* metadata.
|
||||
*
|
||||
* libFLAC usually only requires the standard C library and C math
|
||||
* library. In particular, threading is not used so there is no
|
||||
* dependency on a thread library. However, libFLAC does not use
|
||||
* global variables and should be thread-safe.
|
||||
*
|
||||
* libFLAC also supports encoding to and decoding from Ogg FLAC.
|
||||
* However the metadata editing interfaces currently have limited
|
||||
* read-only support for Ogg FLAC files.
|
||||
*
|
||||
* \section cpp_api FLAC C++ API
|
||||
*
|
||||
* The FLAC C++ API is a set of classes that encapsulate the
|
||||
* structures and functions in libFLAC. They provide slightly more
|
||||
* functionality with respect to metadata but are otherwise
|
||||
* equivalent. For the most part, they share the same usage as
|
||||
* their counterparts in libFLAC, and the FLAC C API documentation
|
||||
* can be used as a supplement. The public include files
|
||||
* for the C++ API will be installed in your include area (for
|
||||
* example /usr/include/FLAC++/...).
|
||||
*
|
||||
* libFLAC++ is also licensed under
|
||||
* <A HREF="../license.html">Xiph's BSD license</A>.
|
||||
*
|
||||
* \section getting_started Getting Started
|
||||
*
|
||||
* A good starting point for learning the API is to browse through
|
||||
* the <A HREF="modules.html">modules</A>. Modules are logical
|
||||
* groupings of related functions or classes, which correspond roughly
|
||||
* to header files or sections of header files. Each module includes a
|
||||
* detailed description of the general usage of its functions or
|
||||
* classes.
|
||||
*
|
||||
* From there you can go on to look at the documentation of
|
||||
* individual functions. You can see different views of the individual
|
||||
* functions through the links in top bar across this page.
|
||||
*
|
||||
* If you prefer a more hands-on approach, you can jump right to some
|
||||
* <A HREF="../documentation_example_code.html">example code</A>.
|
||||
*
|
||||
* \section porting_guide Porting Guide
|
||||
*
|
||||
* Starting with FLAC 1.1.3 a \link porting Porting Guide \endlink
|
||||
* has been introduced which gives detailed instructions on how to
|
||||
* port your code to newer versions of FLAC.
|
||||
*
|
||||
* \section embedded_developers Embedded Developers
|
||||
*
|
||||
* libFLAC has grown larger over time as more functionality has been
|
||||
* included, but much of it may be unnecessary for a particular embedded
|
||||
* implementation. Unused parts may be pruned by some simple editing of
|
||||
* src/libFLAC/Makefile.am. In general, the decoders, encoders, and
|
||||
* metadata interface are all independent from each other.
|
||||
*
|
||||
* It is easiest to just describe the dependencies:
|
||||
*
|
||||
* - All modules depend on the \link flac_format Format \endlink module.
|
||||
* - The decoders and encoders depend on the bitbuffer.
|
||||
* - The decoder is independent of the encoder. The encoder uses the
|
||||
* decoder because of the verify feature, but this can be removed if
|
||||
* not needed.
|
||||
* - Parts of the metadata interface require the stream decoder (but not
|
||||
* the encoder).
|
||||
* - Ogg support is selectable through the compile time macro
|
||||
* \c FLAC__HAS_OGG.
|
||||
*
|
||||
* For example, if your application only requires the stream decoder, no
|
||||
* encoder, and no metadata interface, you can remove the stream encoder
|
||||
* and the metadata interface, which will greatly reduce the size of the
|
||||
* library.
|
||||
*
|
||||
* Also, there are several places in the libFLAC code with comments marked
|
||||
* with "OPT:" where a #define can be changed to enable code that might be
|
||||
* faster on a specific platform. Experimenting with these can yield faster
|
||||
* binaries.
|
||||
*/
|
||||
|
||||
/** \defgroup porting Porting Guide for New Versions
|
||||
*
|
||||
* This module describes differences in the library interfaces from
|
||||
* version to version. It assists in the porting of code that uses
|
||||
* the libraries to newer versions of FLAC.
|
||||
*
|
||||
* One simple facility for making porting easier that has been added
|
||||
* in FLAC 1.1.3 is a set of \c #defines in \c export.h of each
|
||||
* library's includes (e.g. \c include/FLAC/export.h). The
|
||||
* \c #defines mirror the libraries'
|
||||
* <A HREF="http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning">libtool version numbers</A>,
|
||||
* e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT,
|
||||
* \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE.
|
||||
* These can be used to support multiple versions of an API during the
|
||||
* transition phase, e.g.
|
||||
*
|
||||
* \code
|
||||
* #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
|
||||
* legacy code
|
||||
* #else
|
||||
* new code
|
||||
* #endif
|
||||
* \endcode
|
||||
*
|
||||
* The the source will work for multiple versions and the legacy code can
|
||||
* easily be removed when the transition is complete.
|
||||
*
|
||||
* Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in
|
||||
* include/FLAC/export.h), which can be used to determine whether or not
|
||||
* the library has been compiled with support for Ogg FLAC. This is
|
||||
* simpler than trying to call an Ogg init function and catching the
|
||||
* error.
|
||||
*/
|
||||
|
||||
/** \defgroup porting_1_1_2_to_1_1_3 Porting from FLAC 1.1.2 to 1.1.3
|
||||
* \ingroup porting
|
||||
*
|
||||
* \brief
|
||||
* This module describes porting from FLAC 1.1.2 to FLAC 1.1.3.
|
||||
*
|
||||
* The main change between the APIs in 1.1.2 and 1.1.3 is that they have
|
||||
* been simplified. First, libOggFLAC has been merged into libFLAC and
|
||||
* libOggFLAC++ has been merged into libFLAC++. Second, both the three
|
||||
* decoding layers and three encoding layers have been merged into a
|
||||
* single stream decoder and stream encoder. That is, the functionality
|
||||
* of FLAC__SeekableStreamDecoder and FLAC__FileDecoder has been merged
|
||||
* into FLAC__StreamDecoder, and FLAC__SeekableStreamEncoder and
|
||||
* FLAC__FileEncoder into FLAC__StreamEncoder. Only the
|
||||
* FLAC__StreamDecoder and FLAC__StreamEncoder remain. What this means
|
||||
* is there is now a single API that can be used to encode or decode
|
||||
* streams to/from native FLAC or Ogg FLAC and the single API can work
|
||||
* on both seekable and non-seekable streams.
|
||||
*
|
||||
* Instead of creating an encoder or decoder of a certain layer, now the
|
||||
* client will always create a FLAC__StreamEncoder or
|
||||
* FLAC__StreamDecoder. The old layers are now differentiated by the
|
||||
* initialization function. For example, for the decoder,
|
||||
* FLAC__stream_decoder_init() has been replaced by
|
||||
* FLAC__stream_decoder_init_stream(). This init function takes
|
||||
* callbacks for the I/O, and the seeking callbacks are optional. This
|
||||
* allows the client to use the same object for seekable and
|
||||
* non-seekable streams. For decoding a FLAC file directly, the client
|
||||
* can use FLAC__stream_decoder_init_file() and pass just a filename
|
||||
* and fewer callbacks; most of the other callbacks are supplied
|
||||
* internally. For situations where fopen()ing by filename is not
|
||||
* possible (e.g. Unicode filenames on Windows) the client can instead
|
||||
* open the file itself and supply the FILE* to
|
||||
* FLAC__stream_decoder_init_FILE(). The init functions now returns a
|
||||
* FLAC__StreamDecoderInitStatus instead of FLAC__StreamDecoderState.
|
||||
* Since the callbacks and client data are now passed to the init
|
||||
* function, the FLAC__stream_decoder_set_*_callback() functions and
|
||||
* FLAC__stream_decoder_set_client_data() are no longer needed. The
|
||||
* rest of the calls to the decoder are the same as before.
|
||||
*
|
||||
* There are counterpart init functions for Ogg FLAC, e.g.
|
||||
* FLAC__stream_decoder_init_ogg_stream(). All the rest of the calls
|
||||
* and callbacks are the same as for native FLAC.
|
||||
*
|
||||
* As an example, in FLAC 1.1.2 a seekable stream decoder would have
|
||||
* been set up like so:
|
||||
*
|
||||
* \code
|
||||
* FLAC__SeekableStreamDecoder *decoder = FLAC__seekable_stream_decoder_new();
|
||||
* if(decoder == NULL) do_something;
|
||||
* FLAC__seekable_stream_decoder_set_md5_checking(decoder, true);
|
||||
* [... other settings ...]
|
||||
* FLAC__seekable_stream_decoder_set_read_callback(decoder, my_read_callback);
|
||||
* FLAC__seekable_stream_decoder_set_seek_callback(decoder, my_seek_callback);
|
||||
* FLAC__seekable_stream_decoder_set_tell_callback(decoder, my_tell_callback);
|
||||
* FLAC__seekable_stream_decoder_set_length_callback(decoder, my_length_callback);
|
||||
* FLAC__seekable_stream_decoder_set_eof_callback(decoder, my_eof_callback);
|
||||
* FLAC__seekable_stream_decoder_set_write_callback(decoder, my_write_callback);
|
||||
* FLAC__seekable_stream_decoder_set_metadata_callback(decoder, my_metadata_callback);
|
||||
* FLAC__seekable_stream_decoder_set_error_callback(decoder, my_error_callback);
|
||||
* FLAC__seekable_stream_decoder_set_client_data(decoder, my_client_data);
|
||||
* if(FLAC__seekable_stream_decoder_init(decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) do_something;
|
||||
* \endcode
|
||||
*
|
||||
* In FLAC 1.1.3 it is like this:
|
||||
*
|
||||
* \code
|
||||
* FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new();
|
||||
* if(decoder == NULL) do_something;
|
||||
* FLAC__stream_decoder_set_md5_checking(decoder, true);
|
||||
* [... other settings ...]
|
||||
* if(FLAC__stream_decoder_init_stream(
|
||||
* decoder,
|
||||
* my_read_callback,
|
||||
* my_seek_callback, // or NULL
|
||||
* my_tell_callback, // or NULL
|
||||
* my_length_callback, // or NULL
|
||||
* my_eof_callback, // or NULL
|
||||
* my_write_callback,
|
||||
* my_metadata_callback, // or NULL
|
||||
* my_error_callback,
|
||||
* my_client_data
|
||||
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
|
||||
* \endcode
|
||||
*
|
||||
* or you could do;
|
||||
*
|
||||
* \code
|
||||
* [...]
|
||||
* FILE *file = fopen("somefile.flac","rb");
|
||||
* if(file == NULL) do_somthing;
|
||||
* if(FLAC__stream_decoder_init_FILE(
|
||||
* decoder,
|
||||
* file,
|
||||
* my_write_callback,
|
||||
* my_metadata_callback, // or NULL
|
||||
* my_error_callback,
|
||||
* my_client_data
|
||||
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
|
||||
* \endcode
|
||||
*
|
||||
* or just:
|
||||
*
|
||||
* \code
|
||||
* [...]
|
||||
* if(FLAC__stream_decoder_init_file(
|
||||
* decoder,
|
||||
* "somefile.flac",
|
||||
* my_write_callback,
|
||||
* my_metadata_callback, // or NULL
|
||||
* my_error_callback,
|
||||
* my_client_data
|
||||
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
|
||||
* \endcode
|
||||
*
|
||||
* Another small change to the decoder is in how it handles unparseable
|
||||
* streams. Before, when the decoder found an unparseable stream
|
||||
* (reserved for when the decoder encounters a stream from a future
|
||||
* encoder that it can't parse), it changed the state to
|
||||
* \c FLAC__STREAM_DECODER_UNPARSEABLE_STREAM. Now the decoder instead
|
||||
* drops sync and calls the error callback with a new error code
|
||||
* \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM. This is
|
||||
* more robust. If your error callback does not discriminate on the the
|
||||
* error state, your code does not need to be changed.
|
||||
*
|
||||
* The encoder now has a new setting:
|
||||
* FLAC__stream_encoder_set_apodization(). This is for setting the
|
||||
* method used to window the data before LPC analysis. You only need to
|
||||
* add a call to this function if the default is not suitable. There
|
||||
* are also two new convenience functions that may be useful:
|
||||
* FLAC__metadata_object_cuesheet_calculate_cddb_id() and
|
||||
* FLAC__metadata_get_cuesheet().
|
||||
*
|
||||
* The \a bytes parameter to FLAC__StreamDecoderReadCallback,
|
||||
* FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback
|
||||
* is now \c size_t instead of \c unsigned.
|
||||
*/
|
||||
|
||||
/** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4
|
||||
* \ingroup porting
|
||||
*
|
||||
* \brief
|
||||
* This module describes porting from FLAC 1.1.3 to FLAC 1.1.4.
|
||||
*
|
||||
* There were no changes to any of the interfaces from 1.1.3 to 1.1.4.
|
||||
* There was a slight change in the implementation of
|
||||
* FLAC__stream_encoder_set_metadata(); the function now makes a copy
|
||||
* of the \a metadata array of pointers so the client no longer needs
|
||||
* to maintain it after the call. The objects themselves that are
|
||||
* pointed to by the array are still not copied though and must be
|
||||
* maintained until the call to FLAC__stream_encoder_finish().
|
||||
*/
|
||||
|
||||
/** \defgroup porting_1_1_4_to_1_2_0 Porting from FLAC 1.1.4 to 1.2.0
|
||||
* \ingroup porting
|
||||
*
|
||||
* \brief
|
||||
* This module describes porting from FLAC 1.1.4 to FLAC 1.2.0.
|
||||
*
|
||||
* There were only very minor changes to the interfaces from 1.1.4 to 1.2.0.
|
||||
* In libFLAC, \c FLAC__format_sample_rate_is_subset() was added.
|
||||
* In libFLAC++, \c FLAC::Decoder::Stream::get_decode_position() was added.
|
||||
*
|
||||
* Finally, value of the constant \c FLAC__FRAME_HEADER_RESERVED_LEN
|
||||
* has changed to reflect the conversion of one of the reserved bits
|
||||
* into active use. It used to be \c 2 and now is \c 1. However the
|
||||
* FLAC frame header length has not changed, so to skip the proper
|
||||
* number of bits, use \c FLAC__FRAME_HEADER_RESERVED_LEN +
|
||||
* \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN
|
||||
*/
|
||||
|
||||
/** \defgroup flac FLAC C API
|
||||
*
|
||||
* The FLAC C API is the interface to libFLAC, a set of structures
|
||||
* describing the components of FLAC streams, and functions for
|
||||
* encoding and decoding streams, as well as manipulating FLAC
|
||||
* metadata in files.
|
||||
*
|
||||
* You should start with the format components as all other modules
|
||||
* are dependent on it.
|
||||
*/
|
||||
|
||||
#endif
|
45
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/assert.h
vendored
Normal file
45
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/assert.h
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__ASSERT_H
|
||||
#define FLAC__ASSERT_H
|
||||
|
||||
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */
|
||||
#ifdef DEBUG
|
||||
#include <assert.h>
|
||||
#define FLAC__ASSERT(x) assert(x)
|
||||
#define FLAC__ASSERT_DECLARATION(x) x
|
||||
#else
|
||||
#define FLAC__ASSERT(x)
|
||||
#define FLAC__ASSERT_DECLARATION(x)
|
||||
#endif
|
||||
|
||||
#endif
|
184
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/callback.h
vendored
Normal file
184
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/callback.h
vendored
Normal file
|
@ -0,0 +1,184 @@
|
|||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2004,2005,2006,2007,2008,2009 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__CALLBACK_H
|
||||
#define FLAC__CALLBACK_H
|
||||
|
||||
#include "ordinals.h"
|
||||
#include <stdlib.h> /* for size_t */
|
||||
|
||||
/** \file include/FLAC/callback.h
|
||||
*
|
||||
* \brief
|
||||
* This module defines the structures for describing I/O callbacks
|
||||
* to the other FLAC interfaces.
|
||||
*
|
||||
* See the detailed documentation for callbacks in the
|
||||
* \link flac_callbacks callbacks \endlink module.
|
||||
*/
|
||||
|
||||
/** \defgroup flac_callbacks FLAC/callback.h: I/O callback structures
|
||||
* \ingroup flac
|
||||
*
|
||||
* \brief
|
||||
* This module defines the structures for describing I/O callbacks
|
||||
* to the other FLAC interfaces.
|
||||
*
|
||||
* The purpose of the I/O callback functions is to create a common way
|
||||
* for the metadata interfaces to handle I/O.
|
||||
*
|
||||
* Originally the metadata interfaces required filenames as the way of
|
||||
* specifying FLAC files to operate on. This is problematic in some
|
||||
* environments so there is an additional option to specify a set of
|
||||
* callbacks for doing I/O on the FLAC file, instead of the filename.
|
||||
*
|
||||
* In addition to the callbacks, a FLAC__IOHandle type is defined as an
|
||||
* opaque structure for a data source.
|
||||
*
|
||||
* The callback function prototypes are similar (but not identical) to the
|
||||
* stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use
|
||||
* stdio streams to implement the callbacks, you can pass fread, fwrite, and
|
||||
* fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or
|
||||
* FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle
|
||||
* is required. \warning You generally CANNOT directly use fseek or ftell
|
||||
* for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems
|
||||
* these use 32-bit offsets and FLAC requires 64-bit offsets to deal with
|
||||
* large files. You will have to find an equivalent function (e.g. ftello),
|
||||
* or write a wrapper. The same is true for feof() since this is usually
|
||||
* implemented as a macro, not as a function whose address can be taken.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** This is the opaque handle type used by the callbacks. Typically
|
||||
* this is a \c FILE* or address of a file descriptor.
|
||||
*/
|
||||
typedef void* FLAC__IOHandle;
|
||||
|
||||
/** Signature for the read callback.
|
||||
* The signature and semantics match POSIX fread() implementations
|
||||
* and can generally be used interchangeably.
|
||||
*
|
||||
* \param ptr The address of the read buffer.
|
||||
* \param size The size of the records to be read.
|
||||
* \param nmemb The number of records to be read.
|
||||
* \param handle The handle to the data source.
|
||||
* \retval size_t
|
||||
* The number of records read.
|
||||
*/
|
||||
typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
|
||||
|
||||
/** Signature for the write callback.
|
||||
* The signature and semantics match POSIX fwrite() implementations
|
||||
* and can generally be used interchangeably.
|
||||
*
|
||||
* \param ptr The address of the write buffer.
|
||||
* \param size The size of the records to be written.
|
||||
* \param nmemb The number of records to be written.
|
||||
* \param handle The handle to the data source.
|
||||
* \retval size_t
|
||||
* The number of records written.
|
||||
*/
|
||||
typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
|
||||
|
||||
/** Signature for the seek callback.
|
||||
* The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
|
||||
* EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
|
||||
* and 32-bits wide.
|
||||
*
|
||||
* \param handle The handle to the data source.
|
||||
* \param offset The new position, relative to \a whence
|
||||
* \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
|
||||
* \retval int
|
||||
* \c 0 on success, \c -1 on error.
|
||||
*/
|
||||
typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence);
|
||||
|
||||
/** Signature for the tell callback.
|
||||
* The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
|
||||
* EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
|
||||
* and 32-bits wide.
|
||||
*
|
||||
* \param handle The handle to the data source.
|
||||
* \retval FLAC__int64
|
||||
* The current position on success, \c -1 on error.
|
||||
*/
|
||||
typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle);
|
||||
|
||||
/** Signature for the EOF callback.
|
||||
* The signature and semantics mostly match POSIX feof() but WATCHOUT:
|
||||
* on many systems, feof() is a macro, so in this case a wrapper function
|
||||
* must be provided instead.
|
||||
*
|
||||
* \param handle The handle to the data source.
|
||||
* \retval int
|
||||
* \c 0 if not at end of file, nonzero if at end of file.
|
||||
*/
|
||||
typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle);
|
||||
|
||||
/** Signature for the close callback.
|
||||
* The signature and semantics match POSIX fclose() implementations
|
||||
* and can generally be used interchangeably.
|
||||
*
|
||||
* \param handle The handle to the data source.
|
||||
* \retval int
|
||||
* \c 0 on success, \c EOF on error.
|
||||
*/
|
||||
typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
|
||||
|
||||
/** A structure for holding a set of callbacks.
|
||||
* Each FLAC interface that requires a FLAC__IOCallbacks structure will
|
||||
* describe which of the callbacks are required. The ones that are not
|
||||
* required may be set to NULL.
|
||||
*
|
||||
* If the seek requirement for an interface is optional, you can signify that
|
||||
* a data sorce is not seekable by setting the \a seek field to \c NULL.
|
||||
*/
|
||||
typedef struct {
|
||||
FLAC__IOCallback_Read read;
|
||||
FLAC__IOCallback_Write write;
|
||||
FLAC__IOCallback_Seek seek;
|
||||
FLAC__IOCallback_Tell tell;
|
||||
FLAC__IOCallback_Eof eof;
|
||||
FLAC__IOCallback_Close close;
|
||||
} FLAC__IOCallbacks;
|
||||
|
||||
/* \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
96
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/export.h
vendored
Normal file
96
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/export.h
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__EXPORT_H
|
||||
#define FLAC__EXPORT_H
|
||||
|
||||
/** \file include/FLAC/export.h
|
||||
*
|
||||
* \brief
|
||||
* This module contains #defines and symbols for exporting function
|
||||
* calls, and providing version information and compiled-in features.
|
||||
*
|
||||
* See the \link flac_export export \endlink module.
|
||||
*/
|
||||
|
||||
/** \defgroup flac_export FLAC/export.h: export symbols
|
||||
* \ingroup flac
|
||||
*
|
||||
* \brief
|
||||
* This module contains #defines and symbols for exporting function
|
||||
* calls, and providing version information and compiled-in features.
|
||||
*
|
||||
* If you are compiling with MSVC and will link to the static library
|
||||
* (libFLAC.lib) you should define FLAC__NO_DLL in your project to
|
||||
* make sure the symbols are exported properly.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
#if defined(FLAC__NO_DLL)
|
||||
#define FLAC_API
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#ifdef FLAC_API_EXPORTS
|
||||
#define FLAC_API _declspec(dllexport)
|
||||
#else
|
||||
#define FLAC_API _declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#elif defined(FLAC__USE_VISIBILITY_ATTR)
|
||||
#define FLAC_API __attribute__ ((visibility ("default")))
|
||||
|
||||
#else
|
||||
#define FLAC_API
|
||||
|
||||
#endif
|
||||
|
||||
/** These #defines will mirror the libtool-based library version number, see
|
||||
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
|
||||
*/
|
||||
#define FLAC_API_VERSION_CURRENT 11
|
||||
#define FLAC_API_VERSION_REVISION 0 /**< see above */
|
||||
#define FLAC_API_VERSION_AGE 3 /**< see above */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
|
||||
extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* \} */
|
||||
|
||||
#endif
|
1022
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/format.h
vendored
Normal file
1022
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/format.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
2181
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/metadata.h
vendored
Normal file
2181
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/metadata.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
66
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/ordinals.h
vendored
Normal file
66
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/ordinals.h
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__ORDINALS_H
|
||||
#define FLAC__ORDINALS_H
|
||||
|
||||
/* If your compiler does not provide <stdint.h> you should provide a replacement
|
||||
* which hss suitable replacements for the following intX_T and uintX_t types.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int8_t FLAC__int8;
|
||||
typedef uint8_t FLAC__uint8;
|
||||
|
||||
typedef int16_t FLAC__int16;
|
||||
typedef int32_t FLAC__int32;
|
||||
typedef int64_t FLAC__int64;
|
||||
typedef uint16_t FLAC__uint16;
|
||||
typedef uint32_t FLAC__uint32;
|
||||
typedef uint64_t FLAC__uint64;
|
||||
|
||||
typedef int FLAC__bool;
|
||||
|
||||
typedef FLAC__uint8 FLAC__byte;
|
||||
|
||||
#ifdef true
|
||||
#undef true
|
||||
#endif
|
||||
#ifdef false
|
||||
#undef false
|
||||
#endif
|
||||
#ifndef __cplusplus
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
#endif
|
1559
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/stream_decoder.h
vendored
Normal file
1559
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/stream_decoder.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
1768
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/stream_encoder.h
vendored
Normal file
1768
polymer/eduke32/source/jaudiolib/third-party/common/include/FLAC/stream_encoder.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1754,6 +1754,7 @@ static void realloc_and_copy_musicfn(int32_t level_number, const char *levnamebu
|
|||
}
|
||||
|
||||
// levnamebuf should have at least size BMAX_PATH
|
||||
// FIXME: This function should be rolled into a loop, testing .flac, then .ogg, then .mid.
|
||||
void G_SetupFilenameBasedMusic(char *levnamebuf, const char *boardfilename, int32_t level_number)
|
||||
{
|
||||
char *p;
|
||||
|
@ -1789,6 +1790,7 @@ void G_SetupFilenameBasedMusic(char *levnamebuf, const char *boardfilename, int3
|
|||
Bmemcpy(p+1, "mid", 4);
|
||||
fil = kopen4loadfrommod(levnamebuf,0);
|
||||
|
||||
// XXX: should pull in a "default user map" song entry, probably E1L8 (which would need to not get clobbered)
|
||||
if (fil == -1)
|
||||
Bstrcpy(levnamebuf, "dethtoll.mid");
|
||||
else kclose(fil);
|
||||
|
|
|
@ -202,7 +202,7 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
if (MapInfo[sel].alt_musicfn != NULL)
|
||||
alt = fn = MapInfo[sel].alt_musicfn;
|
||||
|
||||
testfn = (char *) Bmalloc(strlen(fn) + 5);
|
||||
testfn = (char *) Bmalloc(strlen(fn) + 6);
|
||||
strcpy(testfn, fn);
|
||||
extension = strrchr(testfn, '.');
|
||||
|
||||
|
@ -211,8 +211,17 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
if (extension && !Bstrcasecmp(extension, ".mid"))
|
||||
{
|
||||
// we've been asked to load a .mid file, but first let's see
|
||||
// if there's an ogg with the same base name lying around
|
||||
// if there's a flac or an ogg with the same base name lying around
|
||||
strcpy(extension, ".flac");
|
||||
extension[5] = '\0';
|
||||
fp = kopen4loadfrommod(testfn, 0);
|
||||
if (fp >= 0)
|
||||
{
|
||||
Bfree(testfn);
|
||||
break;
|
||||
}
|
||||
strcpy(extension, ".ogg");
|
||||
extension[4] = '\0';
|
||||
fp = kopen4loadfrommod(testfn, 0);
|
||||
if (fp >= 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue