- 2
- 3 162
suman
เข้าร่วมเมื่อ 17 ส.ค. 2023
Writing an AUDIO ENGINE FROM SCRATCH in C++ with OpenAL | kee Devlog 2
I talk about the C++ audio engine I made for my rhythm game using OpenAL in this devlog.
Links:
• .wav loader - pastebin.com/43MtGBGW
• full audio-engine source code - github.com/sumandas27/kee_audio_engine
Songs used (in order)
• massobeats - honey jam
• massobeats - lavendar
• massobeats - lucid
• elijah who - freak no more
Links:
• .wav loader - pastebin.com/43MtGBGW
• full audio-engine source code - github.com/sumandas27/kee_audio_engine
Songs used (in order)
• massobeats - honey jam
• massobeats - lavendar
• massobeats - lucid
• elijah who - freak no more
มุมมอง: 2 840
วีดีโอ
Making a RHYTHM GAME using the WHOLE KEYBOARD | Kee Devlog 1
มุมมอง 327ปีที่แล้ว
First devlog featuring the rhythm game I've been working on for the past couple of months. Links for learning OpenGL: • LearnOpenGL: learnopengl.com/ • TheCherno's OpenGL tutorial playlist: th-cam.com/play/PLlrATfBNZ98foTJPJ_Ev03o2oq3-GGOS2.html music used (in order) • elijah who - thing for you • elijah who - i'm in love • elijah who - but all i wanted was you • elijah who - don't i make it lo...
Long time no see 👀
Thanks for the insights. Not sure how efficient the multithreaded structure is if your poll rate is around 200 times per second and it locks the entirety of the audio manager data for the poll update via mutex. Like if you have a game engine type of update loop at some 120 tps that needs to access audio you will have to synchronize with the audio loop every single time. Just the amount of potential interlocking is insane and I don't know how to fix any of it. Because with an update rate of 60Hz you get around 16 ms of potential latency if you poll in the same thread, while with a separate thread you get ridiculous amounts of resource fighting which will impact not just the audio but the main thread as well, which is even worse.
A partial solution would be to have more fine-grained locks and double buffer queues for commands towards the Audio engine that the main thread will write to and the audio thread will process only when needed, but this still doesn't solve the issue of accessing the audio resources concurrently, since pretty much ALL of them need to be locked during the audio update call.
*Writing an Audio Engine from Scratch in C++ with OpenAL* * *0:40** OpenAL Introduction:* Explains the reasons for switching from SDL_mixer to OpenAL, emphasizing its lightweight nature, similarity to OpenGL, and targeted functionality. * *1:51** OpenAL Core Concepts:* Introduces the three main OpenAL objects: Listener (single audio perspective), Sources (emit audio), and Buffers (store audio data), and how they interact in 3D space. * *2:41** Singleton Class Implementation:* Describes the use of a Singleton class to manage OpenAL initialization and shutdown, ensuring a single audio engine instance. * *2:56** WAV Loading:* Outlines the process of loading WAV files, either individually or using a directory iterator to load all files within a folder. * *3:30** Sound Effect Playback:* Explains the steps to play a sound effect using OpenAL: creating a source, configuring it, attaching a buffer, and initiating playback. * *3:40** Sound Effect Cleanup:* Discusses the need to clean up sources and buffers after sound effects finish playing, using state polling within a loop to determine when to release resources. * *4:01** Multithreading for Sound Management:* Introduces the concept of multithreading to handle sound effect cleanup in the background, preventing blocking of the main game loop. * *5:03** Thread-Safe Implementation:* Highlights the importance of thread safety in multithreaded audio engines to avoid data corruption. Discusses the use of atomic operations and mutexes to ensure safe concurrent access to shared data. * *6:38** Music Streaming:* Explains the need for streaming music from disk instead of loading entire files into memory, emphasizing the efficiency gains for large music files. * *7:29** Music Playback Control:* Describes the implementation of playback controls (pause, play, stop) and seeking to specific points within a music track. * *8:05** Data Alignment Considerations:* Emphasizes the importance of maintaining proper data alignment when seeking within music files to avoid audio distortion. * *8:28** Multithreading for Music Management:* Mentions the use of multithreading for managing active music players, similar to the approach used for sound effects. * *8:44** Level Editor Plans:* Outlines the next steps in the game's development, focusing on a level editor with tap/hold functionality and custom decoration systems. I used gemini-1.5-pro-exp-0827 on rocketrecap dot com to summarize the transcript. Cost (if I didn't use the free tier): $0.02 Input tokens: 14575 Output tokens: 502
imma be honest using openAL is not making your own audio engine from scratch but ok
how else would you do it then
@mazazaza11 you can also just call it abstration layer lmao
will there be more devlogs??? this is really cool
Great stuff, very educational. Keep it up! 🔥
solid video, shame you havent uploaded since
Here before this is big lol, keep the grindset my friend u have heaps of potential
Cool video man. It may be a good idea to also add some type of frequency up-rate or down-rate function option in case players in the future want to have a mod specific to speeding up charts without losing audio quality.
Doing this right now but with WASAPI. Also awesome video, instant sub
OMG what's going on, I was looking for this type of content *-* how did you learn all of this? Btw you're great man.
The idea is amazing but i hate the input xd
Can't believe how similar this is to Pulsus lol. That's so amazing
Typing Tempo meets Pulsus
I've thought of this idea but I stopped at just a thought because I didn't know how I could make a rhythm game where you need to be fast work with many buttons. If you can solve this problem you'll have a promising game!
This video is a reupload of my previous channel's video here: th-cam.com/video/QVguluYZ8yE/w-d-xo.html That channel got hacked unfortunately :( All new videos will be posted on this channel though! Stay tuned :)