X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=audio.h;h=4b57a7998a13d4705284bc961c2dcf858f12b571;hb=4eccfd7252f8ff165670842df537441afae5458b;hp=498acc35f616680b65d5950522bf99f37f543ccd;hpb=cb16ccb05a796178c879ea8d5091663d215a5217;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/audio.h b/audio.h index 498acc3..4b57a79 100644 --- a/audio.h +++ b/audio.h @@ -1,55 +1,58 @@ -#ifndef AUDIO_H -#define AUDIO_H +/* + * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved + */ -#include "common.h" +#pragma once -sfx_vol_control audio_vol_all = { .val = 1.0f, .name = "All" }; +#include "vg/vg_engine.h" +#include "vg/vg_audio.h" +#include "vg/vg_audio_dsp.h" +#include "world.h" -sfx_set audio_board = -{ - .sources = "sound/skate.ogg\0" - "sound/wheel.ogg\0" - "sound/slide.ogg\0" -}; - -sfx_system audio_player0 = -{ - .vol = 0.0f, - .ch = 1, - .vol_src = &audio_vol_all, - .name = "Player0", - .flags = SFX_FLAG_REPEAT | SFX_FLAG_PERSISTENT -}; +struct air_synth_data { + f32 speed; -sfx_system audio_player1 = -{ - .vol = 0.0f, - .ch = 1, - .vol_src = &audio_vol_all, - .name = "Player1", - .flags = SFX_FLAG_REPEAT | SFX_FLAG_PERSISTENT -}; + /* internal */ + f32 t; + struct dsp_biquad lpf; + SDL_SpinLock sl; -sfx_system audio_player2 = -{ - .vol = 0.0f, - .ch = 1, - .vol_src = &audio_vol_all, - .name = "Player2", - .flags = SFX_FLAG_REPEAT | SFX_FLAG_PERSISTENT -}; - -static void audio_init(void) -{ - sfx_set_init( &audio_board, NULL ); - sfx_set_play( &audio_board, &audio_player0, 0 ); - sfx_set_play( &audio_board, &audio_player1, 1 ); - sfx_set_play( &audio_board, &audio_player2, 2 ); + /* not used in locking */ + audio_channel *channel; } - -static void audio_free(void) +extern air_audio_data; + +void audio_init(void); +void audio_free(void); +void audio_ambient_sprite_play( v3f co, audio_clip *clip ); +void audio_ambient_sprites_update( world_instance *world, v3f co ); + +/* TODO(ASSETS): + * Have these as asignable ID's and not a bunch of different arrays. + */ +extern audio_clip audio_board[]; +extern audio_clip audio_taps[]; +extern audio_clip audio_flips[]; +extern audio_clip audio_hits[]; +extern audio_clip audio_splash; +extern audio_clip audio_jumps[]; +extern audio_clip audio_footsteps[]; +extern audio_clip audio_footsteps_grass[]; +extern audio_clip audio_footsteps_wood[]; +extern audio_clip audio_lands[]; +extern audio_clip audio_water[]; +extern audio_clip audio_grass[]; +extern audio_clip audio_ambience[]; +extern audio_clip audio_gate_pass; +extern audio_clip audio_gate_lap; +extern audio_clip audio_gate_ambient; +extern audio_clip audio_rewind[]; +extern audio_clip audio_ui[]; +extern audio_clip audio_challenge[]; + +enum audio_sprite_type { - sfx_set_free( &audio_board ); -} - -#endif /* AUDIO_H */ + k_audio_sprite_type_none, + k_audio_sprite_type_grass, + k_audio_sprite_type_water +};