shithub: cstory

Download patch

ref: 02f570cec77ed77d5623c005640a2ca97c0dea3a
parent: c51a074fad4fba6ccbd51e13205966790bc4834d
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Apr 13 14:28:45 EDT 2020

Add Null audio backend

Literally doesn't do anything

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@
 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_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'")
 
 option(LTO "Enable link-time optimisation" OFF)
@@ -329,6 +329,10 @@
 	endif()
 
 	target_link_libraries(CSE2 PRIVATE ${CMAKE_DL_LIBS})
+elseif(BACKEND_AUDIO MATCHES "Null")
+	target_sources(CSE2 PRIVATE
+		"src/Backends/Audio/Null.cpp"
+	)
 else()
 	message(FATAL_ERROR "Invalid BACKEND_AUDIO selected")
 endif()
--- /dev/null
+++ b/src/Backends/Audio/Null.cpp
@@ -1,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;
+}