Sorry, I let this thread slip away from me...
Quote:
From a philosophical perspective I thought that the motivation behind adding Glk API functions was to enable broadly new capabilities, rather than to make existing features more convenient and accessible.
In this case, I want to make features available *efficiently*. The fact that they can be approximated in VM code at the cost of rapid timer-looping is not a reason to skimp on the Glk API level. If the result is that a future version of Damusix provides the same features, but produces a cleaner compiled game, that's still a win.
Now, Ben's earlier point *is* a concern:
Quote:
The other new API call, lowering the volume over a specified number of milliseconds, poses some difficulties. It's not a feature that SDL_mixer provides. I'd need to use OS timers for that, which would be workable under Windows and Linux but would mean a complete rewrite of the way I handle timers in OS X to avoid clashing with the Glk timer functionality.
That's a significant cost and I don't want to impose it without good reason.
Let me ask this: do you already have a callback that takes buffers of sound output from SDL_mixer and passes them to the OSX sound library? If so, it might be better (and produce a better result) to scale each buffer as it goes by. That way, the volume during a change would change smoothly rather than being stairstepped by any timer at all.
The code to scale a buffer by a linearly-changing factor is very simple -- I've written it a couple of times for other projects. (It would be harder if there were multiple volume changes going on at the same time, but I've explicitly ruled that out.)