Testing for Sound Capabilities

Testing for Sound Capabilities — Checking whether the library supports sound

Types and Values

Includes

#include <libchimara/glk.h>

Description

Before calling Glk sound functions, you should use the gestalt_Sound2 selector.

Earlier versions of the Glk spec defined separate selectors for various optional capabilities. This has proven to be an unnecessarily confusing strategy, and is no longer used. The gestalt_Sound, gestalt_SoundMusic, gestalt_SoundVolume, and gestalt_SoundNotify selectors still exist, but you should not need to test them; the gestalt_Sound2 selector covers all of them.

Functions

Types and Values

GLK_MODULE_SOUND

#define GLK_MODULE_SOUND

You can perform a preprocessor test for the existence of GLK_MODULE_SOUND. If this is defined, so are all the functions and constants described in this section. If not, not.


GLK_MODULE_SOUND2

#define GLK_MODULE_SOUND2

If you are writing a C program, there is an additional complication. A library which does not support sound may not implement the sound functions at all. Even if you put gestalt tests around your sound calls, you may get link-time errors. If the glk.h file is so old that it does not declare the sound functions and constants, you may even get compile-time errors.

To avoid this, you can perform a preprocessor test for the existence of GLK_MODULE_SOUND2. If this is defined, so are all the functions and constants described in this section. If not, not.