Test id machine has a sound card?

BlitzMax Forums/BlitzMax Programming/Test id machine has a sound card?

Grey Alien(Posted 2006) [#1]
Does anyone know an easy way to test if a PC has a soundcard? The reason I ask is in BlitzPlus if you loaded a sound but there was no soundcard, the variable was null. then if you tried to play it, it would crash. So I had a little test which was like this:

	SoundClick = LoadSound(SoundPath+"click3.wav")
	;disable sound and music?
	If Not SoundClick Then
		IniMusic = 0
		IniSound = 0
		IniMusicVolume = 0
		IniSoundVolume = 0
		NoSoundCard = 1
	Else


Does anyone know if the same thing works in Max? I can't test it because I no longer have access to a PC without sound!

Also it would be neater if instead of trying to load the sound, you could just test for sound capability by querying some BlitxMax or API variable or something.


Yan(Posted 2006) [#2]
Max has a 'Null' sound driver, so if you try to play a sound on a non soundified PC then it wont error out (that's why you had trouble figuring out TSound).

If you really must check, however...
If TFreeAudioAudioDriver(audio_driver) Then Print "Yay...Sound!"
Should do the trick, assuming you're using FreeAudio of course.


Grey Alien(Posted 2006) [#3]
Yes I am using the build in Max sound, and COOL that code works. If I disable sound in device manager it doesn't print anything.

It's very good that Max won't cause an error on no sound PCs, just another level of boring checking code removed, which is nice.

Thanks.


Grey Alien(Posted 2006) [#4]
Just had a thought. I was asking the question from a PC point of view, is Blitz Max safe on Macs with no soundcard too?


Yan(Posted 2006) [#5]
Well, that code actually checks that FreeAudio has initialised correctly and has replaced the null driver. As FreeAudio is cross platform, it *should* be exactly the same on MAC/Linux/Win32.


Grey Alien(Posted 2006) [#6]
let's hope so ...


xlsior(Posted 2006) [#7]
Do they even sell Mac's without sound capability?
Possibly less of an issue than on PC's...