Mega Code Archive

 
Categories / Delphi / Multimedia
 

How to disable audio when your application is running

Title: How to disable audio when your application is running. Question: I needed to manage the volume and I found a very useful resource on the Net, but it was very hard to use, so I tryed this and it works. Answer: You have to include the MMSystem unit to your form, then add in the TFormX this: MyVolume : Array[ 0..10 ] Of LongInt; mDevs : Integer; Then use this for get the informations: in TFormX creation put this: Var I : Integer; Begin mDevs := auxGetNumDevs; For I := 0 To mDevs Do auxGetVolume( I, Addr( MyVolume[ I ] ) ); auxSetVolume( I, LongInt( 9000 ) * 65536 + LongInt( 9000 ) ); End; ... And in the TFormX close this: Var I : Integer; Begin For I := 0 To mDevs Do auxSetVolute( I, MyVolume[ I ] ); ...