How to setup and use OpenAL for game audio in C++ (Using Visual Studio) tutorial

  Рет қаралды 8,594

enigma tutorials

enigma tutorials

Күн бұрын

Пікірлер: 24
@nizd3128
@nizd3128 4 жыл бұрын
Thank you that was a great tutorial, cheers.
@abigailalcocer7228
@abigailalcocer7228 Жыл бұрын
Hello, thank you for this video. I wanted to try it, but I get the following error " 'WavAudioFormat': identifier not found". Could you help me and explain me how to correct it? Please.
@DangeroustuberMusic
@DangeroustuberMusic 3 жыл бұрын
Thank you i have added this to my application without much trouble. The only issue is that the while(sourceState == AL_PLAYING) overrides my glfw code where i say "on esc key press" exit the window. Need to find a way to include that in the while statement maybe?
@enigma_dev
@enigma_dev 3 жыл бұрын
The while(sourceState == AL_PLAYING) was just to keep my little demo from closing before the audio was playing. You most likely don't need to worry about that while loop if you're using glfw to manage a window. You just want to make sure your window stays open long enough for your sound to finish playing (ie don't exit it). It appears the audio playing happens in a background thread or something. All I need to do is play the source and then I can go on processing whatever else I want to do.
@alejandrocastillollorens3990
@alejandrocastillollorens3990 3 жыл бұрын
thanks for the video
@Micha-mj7vg
@Micha-mj7vg 3 жыл бұрын
How did you compile the open al library with Win32? it shows me only one option: x64
@enigma_dev
@enigma_dev 3 жыл бұрын
Hm, it looks like cmake might use x64 by default now? I'm a cmake noob, so not sure how to do this from command line, but I see an option in the CMake GUI app. 1-Open up CMakeGui Application. 2-Set "Where is the source code:" text box to the OpenAL-Soft folder that you downloaded the git repository into. 3-Set the "Where to build the binaries:" text box to the OpenAL-Soft/Build folder. 4-Now, when you Click the "Configure" button, a popup should appear. 5-In the configure popup, set the "Optional platform for generator" to Win32 from the drop down. I see an options x64, win32, ARM, ARM64. 6-Click finish after selecting 7-After configuration, click generate. 8-Open visual studio and see there is a win32 option. note: for me I got an error when trying to select a specific version of visual studio; and then I did not get the configure popup anymore. I had to go to File->ClearCache to have it let me have the configure popup again. (I found the one that would work by using the cmd line in the video. that is: cd build; cmake ..;
@mikep2852
@mikep2852 2 жыл бұрын
@@enigma_dev fyi for future readers I had this same issue with every single library I've tried to build using Visual Studio 2022. I couldn't work out the cmakeGui but in the end I used visual studio 2017 and 'cmake -G"Visual Studio 15 2017" ..' on the comand line which has worked fine.
@Amar-lv1yw
@Amar-lv1yw 2 жыл бұрын
How would you do it with mp3 files? Loading the wav files takes long since they are way larger.
@enigma_dev
@enigma_dev 2 жыл бұрын
It should be the mostly same process, but you need something to decode mp3 to pcm data. At the end I recommended dr_wav lib and gave a github link. Looking at the github author's repositories, there appears to be a dr_mp3. Adding a link of it to the description. I have not personally tried dr_mp3 though.
@Amar-lv1yw
@Amar-lv1yw 2 жыл бұрын
@@enigma_dev would you be interested to make a tutorial on that? Im not an expert on Audio files but i really need it for my game.
@enigma_dev
@enigma_dev 2 жыл бұрын
@@Amar-lv1yw Perhaps one day, but currently strapped for time at work and I would have to refresh myself on how all that works. So likely won't be in the near future. However, glancing through the code it appears to be nearly identical to drwav. Check out the section of this video that explains using drwav instead of AudioFile. That's at 15:25 To get drmp3 working, I think you need only to swap out places of "drwav" with "drmp3". that is, `drwav_open_file_and_read_pcm_frames_s16` becomes `drmp3_open_file_and_read_pcm_frames_s16` `drwav_int16` becomes `drmp3_int16` `drwav_free` becomes `drmp3_free` `#include ` becomes `#include ` Hope that helps. Sorry I can't do more right now.
@Amar-lv1yw
@Amar-lv1yw 2 жыл бұрын
@@enigma_dev Thanks, I will try that
@Amar-lv1yw
@Amar-lv1yw 2 жыл бұрын
@@enigma_dev I have tried that now, but it doesn't work. `drwav_open_file_and_read_pcm_frames_s16` and `drmp3_open_file_and_read_pcm_frames_s16` don't work the same way because I assume that data is stored differently.
@tristanhegseth1186
@tristanhegseth1186 4 жыл бұрын
Here is what the GNU General Public License states about modified release Does the GPL require that source code of modified versions be posted to the public? (#GPLRequireSourcePostedPublic) The GPL does not require you to release your modified version, or any part of it. You are free to make modifications and use them privately, without ever releasing them. This applies to organizations (including companies), too; an organization can make a modified version and use it internally without ever releasing it outside the organization. But if you release the modified version to the public in some way, the GPL requires you to make the modified source code available to the program's users, under the GPL. Thus, the GPL gives permission to release the modified program in certain ways, and not in other ways; but the decision of whether to release it is up to you. So you would have to make the code open source if releasing as a game
@KennyTutorials
@KennyTutorials 2 жыл бұрын
cmake command not found even i install the cmake
@enigma_dev
@enigma_dev 2 жыл бұрын
Hm, I'm not sure why that is. When you install cmake, I think there might be an option to add cmake to your path variable. You need cmake in your path to call the .exe from the command line in any folder. I googled "cmake command not found windows" and the first statc overflow result shows how to add it to path. It is the second answer with 14 upvotes at time of writing. Not sure I can give a direct link in youtube without getting flagged. I believe the easiest way to reinstall cmake and make sure you check the option to modify/add it to the system PATH environment variable.
@KennyTutorials
@KennyTutorials 2 жыл бұрын
@@enigma_dev Thank you for such a detailed answer. Yes, I remembered that I just didn't add cmake to the environment variables. I'm just not a fan of cmake, I use premake5 to build all the libraries. I have already found a faster way to build OpenAL on Windows is vcpkg. He just downloaded, compiled and assembled the entire library for me.
@developerdeveloper67
@developerdeveloper67 Жыл бұрын
Like bruh, this is hard... to get some mere sounds playing in c++.
@huyvole9724
@huyvole9724 3 жыл бұрын
you need tutorial for us
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 723 М.
ПРЯМОЙ ЭФИР. Золотой мяч France Football 2024
4:41:06
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 40 МЛН
the balloon deflated while it was flying #tiktok
00:19
Анастасия Тарасова
Рет қаралды 34 МЛН
НИКИТА ПОДСТАВИЛ ДЖОНИ 😡
01:00
HOOOTDOGS
Рет қаралды 3 МЛН
find memory errors quickly. (-fsanitize, addresssanitizer)
9:44
Jacob Sorber
Рет қаралды 18 М.
Technical Devlog: Implementing Audio into my Game Engine
17:17
ThinMatrix
Рет қаралды 95 М.
Audio File Formats - MP3, AAC, WAV, FLAC
6:17
Techquickie
Рет қаралды 1,4 МЛН
I Created a Game Engine Just to Optimise This
4:50
Vercidium
Рет қаралды 1,1 МЛН
The Last Piece of the Puzzle - Adding AUDIO to a Game Engine
13:05
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Become a shell wizard in ~12 mins
12:25
CODE IS EVERYTHING
Рет қаралды 256 М.
ПРЯМОЙ ЭФИР. Золотой мяч France Football 2024
4:41:06