From 2cf57a4abcb4bb552cb805c74c19b1ad21fba411 Mon Sep 17 00:00:00 2001 From: talha Date: Mon, 3 Feb 2025 11:44:41 +0500 Subject: Added miniaudio --- source/main.cpp | 18 ++++++++++++++++-- source/memory/arena.h | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/main.cpp b/source/main.cpp index 0fcfab5..ca9e71a 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,8 +1,10 @@ #include #include -#define STB_IMAGE_IMPLEMENTATION -#include "stb_image.h" +#define MINIAUDIO_IMPLEMENTATION +#include "miniaudio.h" + +#include #include #include FT_FREETYPE_H @@ -1122,6 +1124,17 @@ int main(int argc, char* argv[]) FrameTimer timer = frametimer(); + // @section: audio + ma_result result; + ma_engine engine; + + result = ma_engine_init(NULL, &engine); + if (result != MA_SUCCESS) { + return -1; + } + + ma_engine_play_sound(&engine, "assets/audio/winds_of_stories.mp3", NULL); + while (game_running) { controller.jump = 0; @@ -1670,6 +1683,7 @@ int main(int argc, char* argv[]) enforce_frame_rate(&timer, 60); } + ma_engine_uninit(&engine); free(level_mem); free(batch_memory); free(renderer.ui_text.transforms); diff --git a/source/memory/arena.h b/source/memory/arena.h index 83ff277..ce167f9 100644 --- a/source/memory/arena.h +++ b/source/memory/arena.h @@ -1,5 +1,7 @@ #pragma once +#include + #ifndef ALIGNMENT #define ALIGNMENT (2*sizeof(void*)) #endif -- cgit v1.2.3