Hi All!
Right… got a couple of questions…
Firstly, what’s the best way to change the brightness (or gamma) of
an SDL app? I’d like to give my players the option to adjust the
brightness via a menu option. I’ve tried SDL_SetGamma()… but it
gave really sTrAngE rEsuLtS.
AFAIK, SDL_SetGamma() relies on h/w support, and has no effect unless
there actually is h/w gamma support.
Now, any reasonably modern RAMDAC supports gamma tables, and most
drivers on most platforms seem to implement the related features in
the common APIs. If anything at all happens, you probably have
working gamma support.
So, what does “sTrAngE rEsuLtS” mean, exactly?
Note that you should normally use the same value for all three
arguments. The separate R, G and B controls are meant for finetuning
the “dynamic” color balance. Probably not worth messing with unless
you’re working on a color calibration tool.
Also note that you can implement brightness/contrast controls and
other stuff using this feature as well. The “real” interface is
SDL_SetGammaRamp(), which allows you to program the translation
tables directly.
Also… and I guess this might be one for Sam or some SDL Mixer
Gurus… When opening the mixer, there is a choice of 1 or 2 (third
parameter in Mix_OpenAudio) for either Mono or Stereo. Is it
possible to change these at run time…? I’d also like to give the
players the ability to change between Mono and Stereo output.
Generally, you have to reopen the device to change this. Your average
sound card has a single CODEC and a single DMA channel for output,
and switching between mono/stereo means you have to reinitialize the
card. Some professional studio sound interfaces have N DAC channels
hardwired to N mono outputs, but only a few studio oriented driver
architectures let you open/close mono channels independently without
restrictions, so it doesn’t really make a difference to your average
user.
The point is that that sort of stuff is very non-portable and most
probably way beyond the scope of SDL and SDL_mixer.
Anyway, you shouldn’t really have to restart SDL_mixer and reload all
sounds and music etc - but that depends on the implementation. I
don’t know if SDL_mixer can reinit with different audio I/O
parameters, or if not, how hard it would be to add such a feature.
As to the sound card/driver side, a close/open cycle is generally very
fast. It might cause a click, and at worst, a short moment of
silence, but switching at run time is not a problem for normal
applications.
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
— http://olofson.net — http://www.reologica.se —On Thursday 16 October 2003 17.07, Stephen Sweeney wrote: