-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use 0.f->1.f for volume instead of decibels #1460
base: master
Are you sure you want to change the base?
Conversation
This PR also 'reinterprets' the 4 bytes used in the vanilla config for volume. Originally they were an int32_t, they are now a float. |
src/OpenLoco/Config.h
Outdated
@@ -88,7 +88,7 @@ namespace OpenLoco::Config | |||
ObjectHeader preferredCurrency; // 0x7C | |||
uint8_t enabledMusic[29]; // 0x50AF40, 0x8C | |||
uint8_t pad_A9[0xCC - 0xA9]; // 0xA9 | |||
int32_t volume; // 0x50AF80, 0xCC | |||
float volume; // 0x50AF80, 0xCC // originally int32_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsure if this kind of abuse is allowed...if it isn't I'll just deprecate it and add a float volume in NewConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's switch over to NewConfig instead, yeah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger that, I think NewConfig is better anyways since all the settings for other channel volume sliders will live there too, so it unified those settings when I make that PR
I disagree that this should be changed. Decibels is the easier to understand units and we have to keep in decibels for interop reasons. |
OpenRCT2 uses percentages for its volume configs, so it's not without precedent. I think there's merit in both, but admittedly the negative decibels had me puzzled for a bit as well, until I read up on it. |
Sure master volumes in terms of percentage but i don't want to change the actual maths under the hood. Or if you do then it needs very careful thought as everything has been structured around integer maths. |
I didn't realise this was such a contentious topic! I disagree that decibels are beneficial to having in a game audio engine, even in a r/e project such as OpenLoco:
I have a few small fixes to make to this branch still, then you can review it both in code and with your ears :) |
I won't be working on this specific branch any more since it's outdated and I wanted to restart the implementation, but in my new branch I've thought this over again and how about this middle ground - we leave the core audio mixing/engine in dB as duncan would like, and we continue to call this |
Expressing in-game volumes in terms of decibels is messy, error-prone, and non-intuitive. Representing volumes internally as a floating-point number between 0-1 inclusive simplifies the code, makes it easy to understand that '0.5f' means half volume, and follows modern standards for how games, game engines, and audio libraries represent volume.
Incidentally, this PR will make it much easier to implement additional volume sliders for the other audio channels in future (I know this because I started implementing volume sliders first before realising this change was necessary).