Add Null audio backend

Literally doesn't do anything
This commit is contained in:
Clownacy 2020-04-13 18:28:45 +01:00
parent c51a074fad
commit 02f570cec7
2 changed files with 72 additions and 1 deletions

View file

@ -17,7 +17,7 @@ option(FIX_BUGS "Fix various bugs in the game" OFF)
option(DEBUG_SAVE "Re-enable the ability to drag-and-drop save files onto the window" OFF) option(DEBUG_SAVE "Re-enable the ability to drag-and-drop save files onto the window" OFF)
set(BACKEND_RENDERER "SDLTexture" CACHE STRING "Which renderer the game should use: 'OpenGL3' for an OpenGL 3.2 renderer, 'OpenGLES2' for an OpenGL ES 2.0 renderer, 'SDLTexture' for SDL2's hardware-accelerated Texture API, 'SDLSurface' for SDL2's software-rendered Surface API, or 'Software' for a handwritten software renderer") set(BACKEND_RENDERER "SDLTexture" CACHE STRING "Which renderer the game should use: 'OpenGL3' for an OpenGL 3.2 renderer, 'OpenGLES2' for an OpenGL ES 2.0 renderer, 'SDLTexture' for SDL2's hardware-accelerated Texture API, 'SDLSurface' for SDL2's software-rendered Surface API, or 'Software' for a handwritten software renderer")
set(BACKEND_AUDIO "SDL2" CACHE STRING "Which audio backend the game should use: 'SDL2' or 'miniaudio'") set(BACKEND_AUDIO "SDL2" CACHE STRING "Which audio backend the game should use: 'SDL2', 'miniaudio', or 'Null'")
set(BACKEND_PLATFORM "SDL2" CACHE STRING "Which platform backend the game should use: 'SDL2' or 'GLFW3'") set(BACKEND_PLATFORM "SDL2" CACHE STRING "Which platform backend the game should use: 'SDL2' or 'GLFW3'")
option(LTO "Enable link-time optimisation" OFF) option(LTO "Enable link-time optimisation" OFF)
@ -329,6 +329,10 @@ elseif(BACKEND_AUDIO MATCHES "miniaudio")
endif() endif()
target_link_libraries(CSE2 PRIVATE ${CMAKE_DL_LIBS}) target_link_libraries(CSE2 PRIVATE ${CMAKE_DL_LIBS})
elseif(BACKEND_AUDIO MATCHES "Null")
target_sources(CSE2 PRIVATE
"src/Backends/Audio/Null.cpp"
)
else() else()
message(FATAL_ERROR "Invalid BACKEND_AUDIO selected") message(FATAL_ERROR "Invalid BACKEND_AUDIO selected")
endif() endif()

View file

@ -0,0 +1,67 @@
#include "../Audio.h"
#include <stddef.h>
bool AudioBackend_Init(void)
{
return true;
}
void AudioBackend_Deinit(void)
{
}
AudioBackend_Sound* AudioBackend_CreateSound(unsigned int frequency, const unsigned char *samples, size_t length)
{
(void)frequency;
(void)samples;
(void)length;
return NULL;
}
void AudioBackend_DestroySound(AudioBackend_Sound *sound)
{
(void)sound;
}
void AudioBackend_PlaySound(AudioBackend_Sound *sound, bool looping)
{
(void)sound;
(void)looping;
}
void AudioBackend_StopSound(AudioBackend_Sound *sound)
{
(void)sound;
}
void AudioBackend_RewindSound(AudioBackend_Sound *sound)
{
(void)sound;
}
void AudioBackend_SetSoundFrequency(AudioBackend_Sound *sound, unsigned int frequency)
{
(void)sound;
(void)frequency;
}
void AudioBackend_SetSoundVolume(AudioBackend_Sound *sound, long volume)
{
(void)sound;
(void)volume;
}
void AudioBackend_SetSoundPan(AudioBackend_Sound *sound, long pan)
{
(void)sound;
(void)pan;
}
void AudioBackend_SetOrganyaCallback(void (*callback)(void), unsigned int milliseconds)
{
(void)callback;
(void)milliseconds;
}