mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Refactor audio logic a bit
This commit is contained in:
parent
e4fa7264ba
commit
d9320945ea
18
src/Audio.c
18
src/Audio.c
@ -20,15 +20,15 @@
|
|||||||
|
|
||||||
int Audio_SoundsVolume, Audio_MusicVolume;
|
int Audio_SoundsVolume, Audio_MusicVolume;
|
||||||
|
|
||||||
|
const char* const Sound_Names[SOUND_COUNT] = {
|
||||||
|
"none", "wood", "gravel", "grass", "stone",
|
||||||
|
"metal", "glass", "cloth", "sand", "snow",
|
||||||
|
};
|
||||||
|
|
||||||
const cc_string Sounds_ZipPathMC = String_FromConst("audio/default.zip");
|
const cc_string Sounds_ZipPathMC = String_FromConst("audio/default.zip");
|
||||||
const cc_string Sounds_ZipPathCC = String_FromConst("audio/classicube.zip");
|
const cc_string Sounds_ZipPathCC = String_FromConst("audio/classicube.zip");
|
||||||
static const cc_string audio_dir = String_FromConst("audio");
|
static const cc_string audio_dir = String_FromConst("audio");
|
||||||
|
|
||||||
struct Sound {
|
|
||||||
int channels, sampleRate;
|
|
||||||
struct AudioChunk chunk;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*--------------------------------------------------------Sounds-----------------------------------------------------------*
|
*--------------------------------------------------------Sounds-----------------------------------------------------------*
|
||||||
@ -46,14 +46,6 @@ static void Sounds_Start(void) {
|
|||||||
void Audio_PlayDigSound(cc_uint8 type) { }
|
void Audio_PlayDigSound(cc_uint8 type) { }
|
||||||
void Audio_PlayStepSound(cc_uint8 type) { }
|
void Audio_PlayStepSound(cc_uint8 type) { }
|
||||||
#else
|
#else
|
||||||
#define AUDIO_MAX_SOUNDS 10
|
|
||||||
|
|
||||||
struct SoundGroup {
|
|
||||||
int count;
|
|
||||||
struct Sound sounds[AUDIO_MAX_SOUNDS];
|
|
||||||
};
|
|
||||||
struct Soundboard { struct SoundGroup groups[SOUND_COUNT]; };
|
|
||||||
|
|
||||||
static struct Soundboard digBoard, stepBoard;
|
static struct Soundboard digBoard, stepBoard;
|
||||||
static RNGState sounds_rnd;
|
static RNGState sounds_rnd;
|
||||||
|
|
||||||
|
24
src/Audio.h
24
src/Audio.h
@ -78,7 +78,7 @@ cc_result Audio_Play(struct AudioContext* ctx);
|
|||||||
/* Returns the number of buffers being played or queued */
|
/* Returns the number of buffers being played or queued */
|
||||||
/* (e.g. if inUse is 0, no audio buffers are being played or queued) */
|
/* (e.g. if inUse is 0, no audio buffers are being played or queued) */
|
||||||
cc_result Audio_Poll(struct AudioContext* ctx, int* inUse);
|
cc_result Audio_Poll(struct AudioContext* ctx, int* inUse);
|
||||||
cc_result Audio_Pause(struct AudioContext* ctx); /* Only implemented with OpenSL ES backend */
|
cc_result Audio_Pause(struct AudioContext* ctx);
|
||||||
|
|
||||||
/* Outputs more detailed information about errors with audio. */
|
/* Outputs more detailed information about errors with audio. */
|
||||||
cc_bool Audio_DescribeError(cc_result res, cc_string* dst);
|
cc_bool Audio_DescribeError(cc_result res, cc_string* dst);
|
||||||
@ -93,5 +93,27 @@ void Audio_Warn(cc_result res, const char* action);
|
|||||||
cc_result AudioPool_Play(struct AudioData* data);
|
cc_result AudioPool_Play(struct AudioData* data);
|
||||||
void AudioPool_Close(void);
|
void AudioPool_Close(void);
|
||||||
|
|
||||||
|
|
||||||
|
/*########################################################################################################################*
|
||||||
|
*---------------------------------------------------------Sounds---------------------------------------------------------*
|
||||||
|
*#########################################################################################################################*/
|
||||||
|
enum SoundType {
|
||||||
|
SOUND_NONE, SOUND_WOOD, SOUND_GRAVEL, SOUND_GRASS,
|
||||||
|
SOUND_STONE, SOUND_METAL, SOUND_GLASS, SOUND_CLOTH,
|
||||||
|
SOUND_SAND, SOUND_SNOW, SOUND_COUNT
|
||||||
|
};
|
||||||
|
extern const char* const Sound_Names[SOUND_COUNT];
|
||||||
|
|
||||||
|
#define AUDIO_MAX_SOUNDS 10
|
||||||
|
struct Sound {
|
||||||
|
int channels, sampleRate;
|
||||||
|
struct AudioChunk chunk;
|
||||||
|
};
|
||||||
|
struct SoundGroup {
|
||||||
|
int count;
|
||||||
|
struct Sound sounds[AUDIO_MAX_SOUNDS];
|
||||||
|
};
|
||||||
|
struct Soundboard { struct SoundGroup groups[SOUND_COUNT]; };
|
||||||
|
|
||||||
CC_END_HEADER
|
CC_END_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,6 +10,7 @@ struct AudioContext {
|
|||||||
int sampleRate;
|
int sampleRate;
|
||||||
cc_bool stereo;
|
cc_bool stereo;
|
||||||
};
|
};
|
||||||
|
#define AUDIO_OVERRIDE_ALLOC
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
static int channelIDs;
|
static int channelIDs;
|
||||||
|
@ -19,6 +19,7 @@ struct AudioContext {
|
|||||||
struct AudioBuffer bufs[AUDIO_MAX_BUFFERS];
|
struct AudioBuffer bufs[AUDIO_MAX_BUFFERS];
|
||||||
int count, sampleRate;
|
int count, sampleRate;
|
||||||
};
|
};
|
||||||
|
#define AUDIO_OVERRIDE_ALLOC
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
cc_bool AudioBackend_Init(void) {
|
cc_bool AudioBackend_Init(void) {
|
||||||
|
@ -19,6 +19,7 @@ struct AudioContext {
|
|||||||
int channels, sampleRate, volume;
|
int channels, sampleRate, volume;
|
||||||
cc_bool makeAvailable;
|
cc_bool makeAvailable;
|
||||||
};
|
};
|
||||||
|
#define AUDIO_OVERRIDE_ALLOC
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
cc_bool AudioBackend_Init(void) {
|
cc_bool AudioBackend_Init(void) {
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#if CC_AUD_BACKEND == CC_AUD_BACKEND_NULL
|
#if CC_AUD_BACKEND == CC_AUD_BACKEND_NULL
|
||||||
struct AudioContext { int count; };
|
struct AudioContext { int count; };
|
||||||
|
|
||||||
|
#define AUDIO_OVERRIDE_ALLOC
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
cc_bool AudioBackend_Init(void) { return false; }
|
cc_bool AudioBackend_Init(void) { return false; }
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <kai.h>
|
#include <kai.h>
|
||||||
|
|
||||||
#define AUDIO_COMMON_ALLOC
|
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
struct AudioContext {
|
struct AudioContext {
|
||||||
@ -187,13 +186,5 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
*dst = String_FromReadonly("Unknown Error");
|
*dst = String_FromReadonly("Unknown Error");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Audio_AllocChunks(cc_uint32 size, struct AudioChunk* chunks, int numChunks) {
|
|
||||||
return AudioBase_AllocChunks(size, chunks, numChunks);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
|
||||||
AudioBase_FreeChunks(chunks, numChunks);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -37,8 +37,9 @@ static void (APIENTRY *_alGenSources)(ALsizei n, ALuint* sources);
|
|||||||
static void (APIENTRY *_alDeleteSources)(ALsizei n, const ALuint* sources);
|
static void (APIENTRY *_alDeleteSources)(ALsizei n, const ALuint* sources);
|
||||||
static void (APIENTRY *_alGetSourcei)(ALuint source, ALenum param, ALint* value);
|
static void (APIENTRY *_alGetSourcei)(ALuint source, ALenum param, ALint* value);
|
||||||
static void (APIENTRY *_alSourcef)(ALuint source, ALenum param, float value);
|
static void (APIENTRY *_alSourcef)(ALuint source, ALenum param, float value);
|
||||||
static void (APIENTRY *_alSourcePlay)(ALuint source);
|
static void (APIENTRY *_alSourcePlay) (ALuint source);
|
||||||
static void (APIENTRY *_alSourceStop)(ALuint source);
|
static void (APIENTRY *_alSourcePause)(ALuint source);
|
||||||
|
static void (APIENTRY *_alSourceStop) (ALuint source);
|
||||||
static void (APIENTRY *_alSourceQueueBuffers)(ALuint source, ALsizei nb, const ALuint* buffers);
|
static void (APIENTRY *_alSourceQueueBuffers)(ALuint source, ALsizei nb, const ALuint* buffers);
|
||||||
static void (APIENTRY *_alSourceUnqueueBuffers)(ALuint source, ALsizei nb, ALuint* buffers);
|
static void (APIENTRY *_alSourceUnqueueBuffers)(ALuint source, ALsizei nb, ALuint* buffers);
|
||||||
static void (APIENTRY *_alGenBuffers)(ALsizei n, ALuint* buffers);
|
static void (APIENTRY *_alGenBuffers)(ALsizei n, ALuint* buffers);
|
||||||
@ -95,7 +96,8 @@ static cc_bool LoadALFuncs(void) {
|
|||||||
DynamicLib_ReqSym(alSourcePlay), DynamicLib_ReqSym(alSourceStop),
|
DynamicLib_ReqSym(alSourcePlay), DynamicLib_ReqSym(alSourceStop),
|
||||||
DynamicLib_ReqSym(alSourceQueueBuffers), DynamicLib_ReqSym(alSourceUnqueueBuffers),
|
DynamicLib_ReqSym(alSourceQueueBuffers), DynamicLib_ReqSym(alSourceUnqueueBuffers),
|
||||||
DynamicLib_ReqSym(alGenBuffers), DynamicLib_ReqSym(alDeleteBuffers),
|
DynamicLib_ReqSym(alGenBuffers), DynamicLib_ReqSym(alDeleteBuffers),
|
||||||
DynamicLib_ReqSym(alBufferData), DynamicLib_ReqSym(alDistanceModel)
|
DynamicLib_ReqSym(alBufferData), DynamicLib_ReqSym(alDistanceModel),
|
||||||
|
DynamicLib_OptSym(alSourcePlay)
|
||||||
};
|
};
|
||||||
void* lib;
|
void* lib;
|
||||||
|
|
||||||
@ -226,6 +228,13 @@ cc_result Audio_Play(struct AudioContext* ctx) {
|
|||||||
return _alGetError();
|
return _alGetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Audio_Pause(struct AudioContext* ctx) {
|
||||||
|
if (!_alSourcePause) return ERR_NOT_SUPPORTED;
|
||||||
|
|
||||||
|
_alSourcePause(ctx->source);
|
||||||
|
return _alGetError();
|
||||||
|
}
|
||||||
|
|
||||||
cc_result Audio_Poll(struct AudioContext* ctx, int* inUse) {
|
cc_result Audio_Poll(struct AudioContext* ctx, int* inUse) {
|
||||||
ALint processed = 0;
|
ALint processed = 0;
|
||||||
ALuint buffer;
|
ALuint buffer;
|
||||||
@ -270,13 +279,5 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
if (err) String_AppendConst(dst, err);
|
if (err) String_AppendConst(dst, err);
|
||||||
return err != NULL;
|
return err != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Audio_AllocChunks(cc_uint32 size, struct AudioChunk* chunks, int numChunks) {
|
|
||||||
return AudioBase_AllocChunks(size, chunks, numChunks);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
|
||||||
AudioBase_FreeChunks(chunks, numChunks);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <SLES/OpenSLES.h>
|
#include <SLES/OpenSLES.h>
|
||||||
#include <SLES/OpenSLES_Android.h>
|
#include <SLES/OpenSLES_Android.h>
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
|
|
||||||
static SLObjectItf slEngineObject;
|
static SLObjectItf slEngineObject;
|
||||||
static SLEngineItf slEngineEngine;
|
static SLEngineItf slEngineEngine;
|
||||||
static SLObjectItf slOutputObject;
|
static SLObjectItf slOutputObject;
|
||||||
@ -18,7 +19,6 @@ struct AudioContext {
|
|||||||
SLVolumeItf playerVolume;
|
SLVolumeItf playerVolume;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AUDIO_COMMON_ALLOC
|
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
static SLresult (SLAPIENTRY *_slCreateEngine)(SLObjectItf* engine, SLuint32 numOptions, const SLEngineOption* engineOptions,
|
static SLresult (SLAPIENTRY *_slCreateEngine)(SLObjectItf* engine, SLuint32 numOptions, const SLEngineOption* engineOptions,
|
||||||
@ -254,13 +254,5 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
if (err) String_AppendConst(dst, err);
|
if (err) String_AppendConst(dst, err);
|
||||||
return err != NULL;
|
return err != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Audio_AllocChunks(cc_uint32 size, struct AudioChunk* chunks, int numChunks) {
|
|
||||||
return AudioBase_AllocChunks(size, chunks, numChunks);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
|
||||||
AudioBase_FreeChunks(chunks, numChunks);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ struct AudioContext {
|
|||||||
AudioDriverWaveBuf bufs[AUDIO_MAX_BUFFERS];
|
AudioDriverWaveBuf bufs[AUDIO_MAX_BUFFERS];
|
||||||
int channels, sampleRate;
|
int channels, sampleRate;
|
||||||
};
|
};
|
||||||
|
#define AUDIO_OVERRIDE_ALLOC
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
static int channelIDs;
|
static int channelIDs;
|
||||||
|
@ -361,18 +361,10 @@ cc_result Audio_SetFormat(struct AudioContext* ctx, int channels, int sampleRate
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Audio_AllocChunks(cc_uint32 size, struct AudioChunk* chunks, int numChunks) {
|
|
||||||
return AudioBase_AllocChunks(size, chunks, numChunks);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
|
||||||
AudioBase_FreeChunks(chunks, numChunks);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cc_bool Audio_FastPlay(struct AudioContext* ctx, struct AudioData* data) {
|
static cc_bool Audio_FastPlay(struct AudioContext* ctx, struct AudioData* data) {
|
||||||
int channels = data->channels;
|
int channels = data->channels;
|
||||||
int sampleRate = Audio_AdjustSampleRate(data->sampleRate, data->rate);
|
int sampleRate = Audio_AdjustSampleRate(data->sampleRate, data->rate);
|
||||||
return !ctx->channels || (ctx->channels == channels && ctx->sampleRate == sampleRate);
|
return !ctx->channels || (ctx->channels == channels && ctx->sampleRate == sampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#if defined CC_BUILD_WEBAUDIO
|
#if defined CC_BUILD_WEBAUDIO
|
||||||
struct AudioContext { int contextID, count, rate; void* data; };
|
struct AudioContext { int contextID, count, rate; void* data; };
|
||||||
|
|
||||||
#define AUDIO_COMMON_ALLOC
|
#define AUDIO_OVERRIDE_ALLOC
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
extern int interop_InitAudio(void);
|
extern int interop_InitAudio(void);
|
||||||
@ -69,13 +69,5 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
String_AppendUtf8(dst, buffer, len);
|
String_AppendUtf8(dst, buffer, len);
|
||||||
return len > 0;
|
return len > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Audio_AllocChunks(cc_uint32 size, struct AudioChunk* chunks, int numChunks) {
|
|
||||||
return AudioBase_AllocChunks(size, chunks, numChunks);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
|
||||||
AudioBase_FreeChunks(chunks, numChunks);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ static cc_bool ax_inited;
|
|||||||
|
|
||||||
struct AudioContext { int count; };
|
struct AudioContext { int count; };
|
||||||
|
|
||||||
#define AUDIO_COMMON_ALLOC
|
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
cc_bool AudioBackend_Init(void) {
|
cc_bool AudioBackend_Init(void) {
|
||||||
@ -64,13 +63,5 @@ static cc_bool Audio_FastPlay(struct AudioContext* ctx, struct AudioData* data)
|
|||||||
cc_bool Audio_DescribeError(cc_result res, cc_string* dst) {
|
cc_bool Audio_DescribeError(cc_result res, cc_string* dst) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Audio_AllocChunks(cc_uint32 size, struct AudioChunk* chunks, int numChunks) {
|
|
||||||
return AudioBase_AllocChunks(size, chunks, numChunks);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
|
||||||
AudioBase_FreeChunks(chunks, numChunks);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ struct AudioContext {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define AUDIO_COMMON_VOLUME
|
#define AUDIO_COMMON_VOLUME
|
||||||
#define AUDIO_COMMON_ALLOC
|
|
||||||
#include "_AudioBase.h"
|
#include "_AudioBase.h"
|
||||||
|
|
||||||
cc_bool AudioBackend_Init(void) { return true; }
|
cc_bool AudioBackend_Init(void) { return true; }
|
||||||
@ -159,13 +158,5 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
String_AppendConst(dst, buffer);
|
String_AppendConst(dst, buffer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Audio_AllocChunks(cc_uint32 size, struct AudioChunk* chunks, int numChunks) {
|
|
||||||
return AudioBase_AllocChunks(size, chunks, numChunks);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
|
||||||
AudioBase_FreeChunks(chunks, numChunks);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -8,14 +8,10 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Picking.h"
|
#include "Picking.h"
|
||||||
#include "Lighting.h"
|
#include "Lighting.h"
|
||||||
|
#include "Audio.h"
|
||||||
|
|
||||||
struct _BlockLists Blocks;
|
struct _BlockLists Blocks;
|
||||||
|
|
||||||
const char* const Sound_Names[SOUND_COUNT] = {
|
|
||||||
"none", "wood", "gravel", "grass", "stone",
|
|
||||||
"metal", "glass", "cloth", "sand", "snow",
|
|
||||||
};
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*---------------------------------------------------Default properties----------------------------------------------------*
|
*---------------------------------------------------Default properties----------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
|
@ -13,13 +13,6 @@ CC_BEGIN_HEADER
|
|||||||
struct IGameComponent;
|
struct IGameComponent;
|
||||||
extern struct IGameComponent Blocks_Component;
|
extern struct IGameComponent Blocks_Component;
|
||||||
|
|
||||||
enum SoundType {
|
|
||||||
SOUND_NONE, SOUND_WOOD, SOUND_GRAVEL, SOUND_GRASS,
|
|
||||||
SOUND_STONE, SOUND_METAL, SOUND_GLASS, SOUND_CLOTH,
|
|
||||||
SOUND_SAND, SOUND_SNOW, SOUND_COUNT
|
|
||||||
};
|
|
||||||
extern const char* const Sound_Names[SOUND_COUNT];
|
|
||||||
|
|
||||||
/* Describes how a block is rendered in the world. */
|
/* Describes how a block is rendered in the world. */
|
||||||
enum DrawType {
|
enum DrawType {
|
||||||
DRAW_OPAQUE, /* Completely covers blocks behind (e.g. dirt). */
|
DRAW_OPAQUE, /* Completely covers blocks behind (e.g. dirt). */
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
|
#include "Audio.h"
|
||||||
|
|
||||||
/* Data for a resizable queue, used for liquid physic tick entries. */
|
/* Data for a resizable queue, used for liquid physic tick entries. */
|
||||||
struct TickQueue {
|
struct TickQueue {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "TexturePack.h"
|
#include "TexturePack.h"
|
||||||
#include "Options.h"
|
#include "Options.h"
|
||||||
#include "Drawer2D.h"
|
#include "Drawer2D.h"
|
||||||
|
#include "Audio.h"
|
||||||
|
|
||||||
#define COMMANDS_PREFIX "/client"
|
#define COMMANDS_PREFIX "/client"
|
||||||
#define COMMANDS_PREFIX_SPACE "/client "
|
#define COMMANDS_PREFIX_SPACE "/client "
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "TexturePack.h"
|
#include "TexturePack.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "Audio.h"
|
||||||
|
|
||||||
#ifdef CC_BUILD_FILESYSTEM
|
#ifdef CC_BUILD_FILESYSTEM
|
||||||
static struct LocationUpdate* spawn_point;
|
static struct LocationUpdate* spawn_point;
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "HeldBlockRenderer.h"
|
#include "HeldBlockRenderer.h"
|
||||||
#include "Options.h"
|
#include "Options.h"
|
||||||
#include "Screens.h"
|
#include "Screens.h"
|
||||||
|
#include "Audio.h"
|
||||||
|
|
||||||
struct _ProtocolData Protocol;
|
struct _ProtocolData Protocol;
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ static cc_bool AudioBase_AdjustSound(struct AudioContext* ctx, int i, struct Aud
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AUDIO_COMMON_ALLOC
|
#ifndef AUDIO_OVERRIDE_ALLOC
|
||||||
static cc_result AudioBase_AllocChunks(int size, struct AudioChunk* chunks, int numChunks) {
|
cc_result Audio_AllocChunks(cc_uint32 size, struct AudioChunk* chunks, int numChunks) {
|
||||||
cc_uint8* dst = (cc_uint8*)Mem_TryAlloc(numChunks, size);
|
cc_uint8* dst = (cc_uint8*)Mem_TryAlloc(numChunks, size);
|
||||||
int i;
|
int i;
|
||||||
if (!dst) return ERR_OUT_OF_MEMORY;
|
if (!dst) return ERR_OUT_OF_MEMORY;
|
||||||
@ -98,7 +98,7 @@ static cc_result AudioBase_AllocChunks(int size, struct AudioChunk* chunks, int
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AudioBase_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) {
|
||||||
Mem_Free(chunks[0].data);
|
Mem_Free(chunks[0].data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user