kieranhj / pop-beeb

Prince of Persia port to BBC Master
46 stars 3 forks source link

Add audio controls and ideally volume control #128

Closed kieranhj closed 6 years ago

kieranhj commented 6 years ago

Sound on/off and music on/off controls are not implemented. It would be nice if these could actually be full, half, quarter, off controls (shift volume register) but that is sprinkles.

simondotm commented 6 years ago

4 levels should be doable, just a bit of fancy bit checking and shifting. Will take a look when I'm free

simondotm commented 6 years ago

Ok I've implemented a volume control, but space is tight in Hazel so need to optimize it a bit.

simondotm commented 6 years ago

Wow, this has turned out far more complex than I realized. Not withstanding the amount of optimizing I've done to squeeze more free bytes out of hazel to fit extra code in, the SN volume is attenuated, so I suspect it needs proper maths than my simple LUT approach to work properly.

kieranhj commented 6 years ago

It was definitely just a nice to have Simon - if it’s a complete pain just on/off controls would suffice!! I know you like a challenge though. :)

simondotm commented 6 years ago

Ha - I'm like a dog with a bone now. It must and it will work!! 🥇

simondotm commented 6 years ago

Ok I got it working. It basically sounds ok from full to half volume, but any lower than that and the music quality starts to degrade since there's not enough precision in the 4-bit volume ramp. It does work tho! First beeb game evah with a volume control! :D Gonna tidy up code and check in shortly.

simondotm commented 6 years ago

Volume control checked in. Needs some more sprinkles but works. CTRL+3 and CTRL+4

kieranhj commented 6 years ago

Volume control sounds sweeeet!

I need to decide what to do with sound on/off and music on/off controls. I can look at music off, it shouldn't interfere with the game but would need to check the cutscenes.

For sound on/off I think we should just use the volume controls instead. Thinking CTRL-cursor up and CTRL-cursor down?

I'm guessing that you want a nice status message with the volume value?

simondotm commented 6 years ago

Status message would be good if not too much hassle. Leave the music on/off with me. I'll do it in a way that wont affect cutscenes.

kieranhj commented 6 years ago

Cool. I'll handle the dirty status message system...

kieranhj commented 6 years ago

Feel free to remove the musicon and soundon variables or just leave them if they are harmless and you don't want to change too much!

kieranhj commented 6 years ago

Have added volume message in a branch. Will check in later today.

inversephase commented 6 years ago

need to try this out...

simondotm commented 6 years ago

Almost there with music & sfx toggles. Desperately clawing back bytes in Hazel again! BTW I remapped volume up/down to CTRL+cursor key up/down.

kieranhj commented 6 years ago

Volume message now in master.

simondotm commented 6 years ago

All merged into master. Can now toggle music and sound effects on/off with cursor left/right keys respectively.

simondotm commented 6 years ago

Oh btw, it doesnt affect logic at all. So if you mute music it is still actually playing, you just cant hear it! :)