medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 21519aab9fb8e53fdcb970f6eae31f268eef3aeb
parent 3eef4511ce3f6906aafb553c691339ab509e35a7
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue Nov 15 00:05:05 +0200

Remove some unused files

Diffstat:
audio.h | 66------------------------------------------------------------------
test_audio.cc | 42------------------------------------------
2 files changed, 0 insertions(+), 108 deletions(-)
diff --git a/audio.h b/audio.h @@ -1,66 +0,0 @@ -#ifndef _AUDIO_H_ -#define _AUDIO_H_ - -#include <glm/glm.hpp> - -#include "intrinsics.h" -#include "assets.h" -#include "memory_arena.h" - -union Volume { - struct { - u16 left; - u16 right; - }; - - u32 combined; -}; - -// TODO: cache friendly layout -struct SoundState { - SoundData data; - - // TODO: make this signed so we can delay sounds? - u32 num_played_samples; - volatile bool stopped; - bool loop; - - Volume volume; - - bool positional; - glm::vec3 position; - - u32 generation; - - SoundState * volatile next; - SoundState * volatile next_free; - volatile bool freelisted; -}; - -struct Sound { - SoundState * state; - u32 generation; -}; - -struct AudioOutputBuffer { - // num_channels? - u32 sample_rate; - u32 num_samples; - - s16 * samples; -}; - -struct PlaySoundOptions { - bool loop; -}; - -void audio_init( MemoryArena * arena ); - -Sound audio_play_sound( MemoryArena * arena, SoundData data, bool loop = false ); -void audio_stop_sound( Sound sound ); - -void audio_set_volume( Sound sound, float left, float right = -1.0f ); - -void audio_mix( MemoryArena * arena, AudioOutputBuffer * buffer ); - -#endif // _AUDIO_H_ diff --git a/test_audio.cc b/test_audio.cc @@ -1,42 +0,0 @@ -#include <unistd.h> -#include <math.h> - -#include "glad.h" - -#include "game.h" -#include "wave.h" -#include "log.h" -#include "audio.h" -#include "platform_thread.h" - -static float t = 0.0f; - -static u8 audio_memory[ megabytes( 64 ) ]; -static MemoryArena audio_arena; -static Thread audio_thread; - -extern "C" GAME_INIT( game_init ) { - memarena_init( &audio_arena, audio_memory, sizeof( audio_memory ) ); - audio_init( &audio_arena ); - - u8 * wave = file_get_contents( "02 - Unbreakable.wav" ); - SoundData sound; - bool ok = wave_decode( &audio_arena, wave, &sound ); - assert( ok ); - - // Sound * sin_wave = make_sin_wave( sound.sample_rate, 200 ); - - audio_play_sound( &audio_arena, sound ); - // audio_play_sound( &audio_arena, *sin_wave, true ); - - // thread_init( &audio_thread, mixer, &audio_arena ); -} - -extern "C" GAME_FRAME( game_frame ) { - t += dt; - - glClearColor( sinf( t ), sinf( t ), sinf( t ), 1 ); - glClear( GL_COLOR_BUFFER_BIT ); - - usleep( 200000 ); -}