Test id machine has a sound card?
BlitzMax Forums/BlitzMax Programming/Test id machine has a sound card?
| ||
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. |
| ||
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. |
| ||
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. |
| ||
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? |
| ||
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. |
| ||
let's hope so ... |
| ||
Do they even sell Mac's without sound capability? Possibly less of an issue than on PC's... |