afritz1 / OpenTESArena

Open-source re-implementation of The Elder Scrolls: Arena.
MIT License
988 stars 68 forks source link

Starting OpenAL Soft support #13

Closed kcat closed 8 years ago

kcat commented 8 years ago
afritz1 commented 8 years ago

Thanks for all the help you're doing!

Several of those things I hadn't thought of, like using an SDL event with the exit button. That's a good idea. And I thought the frame timing was correct, too, but I guess not! The lower bound there is a wise decision.

I have downloaded the OpenAL Soft components and I believe it's ready to be used.

So the AudioManagerImpl uses init() instead of the default AudioManagerImpl() constructor. Is that because the same object might be changing often in one lifetime? Edit: I read your notes again and it's making more sense now.

And the components folder has files for the virtual file system? Okay.

I don't know if I should keep the MusicNames and SoundNames. I figured it'd be okay to hard-code them because there aren't a huge number of them and it makes it easier to connect them with their filenames. This design makes it hard to add other music or sound files from a text file, though.

kcat commented 8 years ago

So the AudioManagerImpl uses init() instead of the default AudioManagerImpl() constructor. Is that because the same object might be changing often in one lifetime?

It was done that way so the AudioManager could be a flat object in GameState (and thus gets constructed at the beginning of the GameState constructor, before it can get the appropriate constructor parameters). And that was to avoid an extra layer of indirection... having to dereference the pointer to the AudioManager just to get a pointer to deference the AudioManagerImpl to do the call with. This way keeps the implementation pointer in the GameState, like it used to be before it was split into separate AudioManager and AudioManagerImpl classes.

I don't know if I should keep the MusicNames and SoundNames. I figured it'd be okay to hard-code them because there aren't a huge number of them and it makes it easier to connect them with their filenames. This design makes it hard to add other music or sound files from a text file, though.

I'd say it's good enough for now, and when modding becomes enough of a concern to warrant it, we can make the MusicNames and SoundNames variable (with appropriate string name mappings). So for instance, when a new sound is defined from a text file, it takes the next available integer ID and adds a map entry that turns the string into the integer ID (and the string lookup should be done as little as possible, storing integer IDs in whatever needs a sound or music identifier, since string lookups can get expensive). That's my current thinking at least, but we can revisit the idea when it becomes an issue.