Code archives/Audio/Sound Card Test

This code has been declared by its author to be Public Domain code.

Download source code

Sound Card Test by semar2002
This simple test, that uses the return code of loadsound against a .WAV file, can check if there's a working sound card on the pc where your Blitz program is running on.

This is useful on system with low specs, because if your Blitz program attempts to play a sound on a system with no sound card, the program will crash badly..

Note that the test works only with a WAV file; if you try LoadSound against another kind of sound file, the test itself will crash !

Hope you find this snippet useful,
Sergio.
First, provide a valid and small .WAV file on the same dir of your program (for example "test.wav");
then, try this test:

If LoadSound("test.wav") = 0 then
    ;NO SOUND CARD or SOUND PROBLEMS
    ;take the necessary action
    ;e.g., set a global sound flag to false and test it before loading/playing any sound/music
Endif

Comments

None.

Code Archives Forum