mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
fix last commit
This commit is contained in:
parent
819fe3f5cf
commit
d92093dc9a
12
src/Audio.c
12
src/Audio.c
@ -100,7 +100,7 @@ void Audio_Open(AudioHandle* handle, int buffers) {
|
|||||||
Logger_Abort("No free audio contexts");
|
Logger_Abort("No free audio contexts");
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnCode Audio_Free(AudioHandle handle) {
|
ReturnCode Audio_Close(AudioHandle handle) {
|
||||||
struct AudioFormat fmt = { 0 };
|
struct AudioFormat fmt = { 0 };
|
||||||
struct AudioContext* ctx;
|
struct AudioContext* ctx;
|
||||||
ReturnCode res;
|
ReturnCode res;
|
||||||
@ -274,7 +274,7 @@ void Audio_Open(AudioHandle* handle, int buffers) {
|
|||||||
Logger_Abort("No free audio contexts");
|
Logger_Abort("No free audio contexts");
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnCode Audio_Free(AudioHandle handle) {
|
ReturnCode Audio_Close(AudioHandle handle) {
|
||||||
struct AudioFormat fmt = { 0 };
|
struct AudioFormat fmt = { 0 };
|
||||||
struct AudioContext* ctx;
|
struct AudioContext* ctx;
|
||||||
ALenum err;
|
ALenum err;
|
||||||
@ -403,11 +403,11 @@ struct AudioFormat* Audio_GetFormat(AudioHandle handle) {
|
|||||||
return &Audio_Contexts[handle].Format;
|
return &Audio_Contexts[handle].Format;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnCode Audio_StopAndFree(AudioHandle handle) {
|
ReturnCode Audio_StopAndClose(AudioHandle handle) {
|
||||||
bool finished;
|
bool finished;
|
||||||
Audio_Stop(handle);
|
Audio_Stop(handle);
|
||||||
Audio_IsFinished(handle, &finished); /* unqueue buffers */
|
Audio_IsFinished(handle, &finished); /* unqueue buffers */
|
||||||
return Audio_Free(handle);
|
return Audio_Close(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -678,7 +678,7 @@ static void Sounds_FreeOutputs(struct SoundOutput* outputs) {
|
|||||||
for (i = 0; i < AUDIO_MAX_HANDLES; i++) {
|
for (i = 0; i < AUDIO_MAX_HANDLES; i++) {
|
||||||
if (outputs[i].Handle == HANDLE_INV) continue;
|
if (outputs[i].Handle == HANDLE_INV) continue;
|
||||||
|
|
||||||
Audio_StopAndFree(outputs[i].Handle);
|
Audio_StopAndClose(outputs[i].Handle);
|
||||||
outputs[i].Handle = HANDLE_INV;
|
outputs[i].Handle = HANDLE_INV;
|
||||||
|
|
||||||
Mem_Free(outputs[i].Buffer);
|
Mem_Free(outputs[i].Buffer);
|
||||||
@ -855,7 +855,7 @@ static void Music_RunLoop(void) {
|
|||||||
Chat_AddRaw("&cDisabling music");
|
Chat_AddRaw("&cDisabling music");
|
||||||
Audio_MusicVolume = 0;
|
Audio_MusicVolume = 0;
|
||||||
}
|
}
|
||||||
Audio_StopAndFree(music_out);
|
Audio_StopAndClose(music_out);
|
||||||
|
|
||||||
if (music_joining) return;
|
if (music_joining) return;
|
||||||
Thread_Detach(music_thread);
|
Thread_Detach(music_thread);
|
||||||
|
@ -25,13 +25,13 @@ struct AudioFormat { uint16_t Channels, BitsPerSample; int SampleRate; };
|
|||||||
#define AudioFormat_Eq(a, b) ((a)->Channels == (b)->Channels && (a)->BitsPerSample == (b)->BitsPerSample && (a)->SampleRate == (b)->SampleRate)
|
#define AudioFormat_Eq(a, b) ((a)->Channels == (b)->Channels && (a)->BitsPerSample == (b)->BitsPerSample && (a)->SampleRate == (b)->SampleRate)
|
||||||
typedef int AudioHandle;
|
typedef int AudioHandle;
|
||||||
|
|
||||||
/* Allocates an audio context. */
|
/* Acquires an audio context. */
|
||||||
void Audio_Open(AudioHandle* handle, int buffers);
|
void Audio_Open(AudioHandle* handle, int buffers);
|
||||||
/* Frees an allocated audio context. */
|
/* Frees an allocated audio context. */
|
||||||
/* NOTE: Audio_StopAndFree should be used, because this method can fail if audio is playing. */
|
/* NOTE: Audio_StopAndClose should be used, because this method can fail if audio is playing. */
|
||||||
ReturnCode Audio_Free(AudioHandle handle);
|
ReturnCode Audio_Close(AudioHandle handle);
|
||||||
/* Stops playing audio, unqueues buffers, then frees the audio context. */
|
/* Stops playing audio, unqueues buffers, then frees the audio context. */
|
||||||
ReturnCode Audio_StopAndFree(AudioHandle handle);
|
ReturnCode Audio_StopAndClose(AudioHandle handle);
|
||||||
/* Returns the format audio is played in. */
|
/* Returns the format audio is played in. */
|
||||||
struct AudioFormat* Audio_GetFormat(AudioHandle handle);
|
struct AudioFormat* Audio_GetFormat(AudioHandle handle);
|
||||||
/* Sets the format audio to play is in. */
|
/* Sets the format audio to play is in. */
|
||||||
|
@ -370,6 +370,9 @@ static void Game_LoadOptions(void) {
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined CC_BUILD_WEB
|
||||||
|
static void Game_LoadPlugins(void) { }
|
||||||
|
#else
|
||||||
static void Game_LoadPlugin(const String* path, void* obj) {
|
static void Game_LoadPlugin(const String* path, void* obj) {
|
||||||
#if defined CC_BUILD_WIN
|
#if defined CC_BUILD_WIN
|
||||||
const static String ext = String_FromConst(".dll");
|
const static String ext = String_FromConst(".dll");
|
||||||
@ -414,6 +417,7 @@ static void Game_LoadPlugins(void) {
|
|||||||
res = Directory_Enum(&dir, NULL, Game_LoadPlugin);
|
res = Directory_Enum(&dir, NULL, Game_LoadPlugin);
|
||||||
if (res) Logger_Warn(res, "enumerating plugins directory");
|
if (res) Logger_Warn(res, "enumerating plugins directory");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Game_Free(void* obj);
|
void Game_Free(void* obj);
|
||||||
static void Game_Load(void) {
|
static void Game_Load(void) {
|
||||||
|
@ -692,12 +692,12 @@ void* Thread_Start(Thread_StartFunc* func, bool detach) { (*func)(); return NULL
|
|||||||
void Thread_Detach(void* handle) { }
|
void Thread_Detach(void* handle) { }
|
||||||
void Thread_Join(void* handle) { }
|
void Thread_Join(void* handle) { }
|
||||||
|
|
||||||
void* Mutex_Create(void) { }
|
void* Mutex_Create(void) { return NULL; }
|
||||||
void Mutex_Free(void* handle) { }
|
void Mutex_Free(void* handle) { }
|
||||||
void Mutex_Lock(void* handle) { }
|
void Mutex_Lock(void* handle) { }
|
||||||
void Mutex_Unlock(void* handle) { }
|
void Mutex_Unlock(void* handle) { }
|
||||||
|
|
||||||
void* Waitable_Create(void) { }
|
void* Waitable_Create(void) { eeturn NULL; }
|
||||||
void Waitable_Free(void* handle) { }
|
void Waitable_Free(void* handle) { }
|
||||||
void Waitable_Signal(void* handle) { }
|
void Waitable_Signal(void* handle) { }
|
||||||
void Waitable_Wait(void* handle) { }
|
void Waitable_Wait(void* handle) { }
|
||||||
@ -1486,6 +1486,20 @@ ReturnCode DynamicLib_Get(void* lib, const char* name, void** symbol) {
|
|||||||
bool DynamicLib_DescribeError(ReturnCode res, String* dst) {
|
bool DynamicLib_DescribeError(ReturnCode res, String* dst) {
|
||||||
return Platform_DescribeError(res, dst);
|
return Platform_DescribeError(res, dst);
|
||||||
}
|
}
|
||||||
|
#elif defined CC_BUILD_WEB
|
||||||
|
ReturnCode Process_GetExePath(String* path) { return ReturnCode_NotSupported; }
|
||||||
|
ReturnCode Process_Start(const String* path, const String* args) { return ReturnCode_NotSupported; }
|
||||||
|
|
||||||
|
ReturnCode Process_StartOpen(const String* args) {
|
||||||
|
char str[600];
|
||||||
|
Platform_ConvertString(str, args);
|
||||||
|
EM_ASM_({ window.open(UTF8ToString($0)); }, str);
|
||||||
|
}
|
||||||
|
void Process_Exit(ReturnCode code) { exit(code); }
|
||||||
|
|
||||||
|
ReturnCode DynamicLib_Load(const String* path, void** lib) { return ReturnCode_NotSupported; }
|
||||||
|
ReturnCode DynamicLib_Get(void* lib, const char* name, void** symbol) { return ReturnCode_NotSupported; }
|
||||||
|
bool DynamicLib_DescribeError(ReturnCode res, String* dst) { return false; }
|
||||||
#elif defined CC_BUILD_POSIX
|
#elif defined CC_BUILD_POSIX
|
||||||
ReturnCode Process_Start(const String* path, const String* args) {
|
ReturnCode Process_Start(const String* path, const String* args) {
|
||||||
char str[600], raw[600];
|
char str[600], raw[600];
|
||||||
@ -1542,14 +1556,7 @@ bool DynamicLib_DescribeError(ReturnCode res, String* dst) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Opening browser and retrieving exe path is not standardised at all */
|
/* Opening browser and retrieving exe path is not standardised at all */
|
||||||
#if defined CC_BUILD_WEB
|
#if defined CC_BUILD_OSX
|
||||||
ReturnCode Process_StartOpen(const String* args) {
|
|
||||||
char str[600];
|
|
||||||
Platform_ConvertString(str, args);
|
|
||||||
EM_ASM_({ window.open(UTF8ToString($0)); }, str);
|
|
||||||
}
|
|
||||||
ReturnCode Process_GetExePath(String* path) { return ReturnCode_NotSupported; }
|
|
||||||
#elif defined CC_BUILD_OSX
|
|
||||||
ReturnCode Process_StartOpen(const String* args) {
|
ReturnCode Process_StartOpen(const String* args) {
|
||||||
const static String path = String_FromConst("/usr/bin/open");
|
const static String path = String_FromConst("/usr/bin/open");
|
||||||
return Process_Start(&path, args);
|
return Process_Start(&path, args);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user