Author: Tomas Rutkauskas
Is there a way to detect a sound device (personally, I want to detect a sound card)
to know if such a device is present on the computer my application is running?
Answer:
Solve 1:
1 { ... }2 if WaveOutGetNumDevs > 0 then3 ShowMessage('Wave-Device present')
4 else5 ShowMessage('No Wave-Device present');
6 { ... }
Solve 2:
7 function IsSoundCardInstalled: Boolean;
8 type9 SCFunc = function: UInt; stdcall;
10 var11 LibInst: LongInt;
12 EntryPoint: SCFunc;
13 begin14 Result := False;
15 LibInst := LoadLibrary(PChar('winmm.dll'));
16 try17 if LibInst <> 0 then18 begin19 EntryPoint := GetProcAddress(LibInst, 'waveOutGetNumDevs');
20 if (EntryPoint <> 0) then21 Result := True;
22 end;
23 finally24 if (LibInst <> 0) then25 FreeLibrary(LibInst);
26 end;
end;