hailiang194 / NeoSekaiEngine

Sekai Game engine - my 2D game engine built base on what I know about game development. This game engine can run on Windows, Linux and Web platform
MIT License
0 stars 0 forks source link

Implement sound #15

Open hailiang194 opened 3 weeks ago

hailiang194 commented 3 weeks ago

It's impossible that game have no sound. Now it's time to implement it As what I see, raylib already has the sound function. Let's investigate it. https://www.raylib.com/cheatsheet/cheatsheet.html#paudio

Audio device (manage the device)

This one allow us to initialize audio device and also set the volume of the app. To initialize and initialize, we have to do it at the start and close the game. All so we need a method to get and set volume for the app.

This one can be loaded from file or sound wave, but we just use file. This one is able to play, resume and pause also set volume, pitch and pan

We need some thing to manage all of the sound and sound base class. The management class store all the sound and be able to unload all of them when the game is end. Sound base class must be able to play, pause and resume. Also they must be able to set volume, pitch and pan.

This one can be loaded from file or memory, but we just use file. This one is able to play, resume and pause also set volume, pitch and pan

We need some thing to manage all of the sound and music base class. The management class store all the music and be able to unload all of them when the game is end. Music base class must be able to play, pause, resume and seek. Also they must be able to set volume, pitch and pan.

hailiang194 commented 3 weeks ago

As what I investigated, we need:

hailiang194 commented 3 weeks ago

As what I investigated, we need:

  • Audio management(Thing used to control configuration of audio)
  • Sound base data(Which is used to store information about a sound)
  • Sound behavior(Play, Pause, Resume, etc.) Also, I saw that raylib has Music and Audio stream. Should we also implement them?

OK, So let see. We need thing to manage:

hailiang194 commented 3 weeks ago

As what I investigated, we need:

  • Audio management(Thing used to control configuration of audio)
  • Sound base data(Which is used to store information about a sound)
  • Sound behavior(Play, Pause, Resume, etc.) Also, I saw that raylib has Music and Audio stream. Should we also implement them?

OK, So let see. We need thing to manage:

  • Audio device
  • Sound
  • MusicStream
  • AudioStream Audio device, really clean but what the diffent between Sound, MusicStream and AudioStream. Let's investigate them

I saw a really clear answer here https://www.reddit.com/r/raylib/comments/1awj78f/music_vs_sound_vs_audio/

So basically, Sound is thing stay in RAM, MusicStream is stay in disk and audio is an audio buffer we can managed.