Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory leak with playing Wave files

Status
Not open for further replies.

tedsmith

Programmer
Nov 23, 2000
1,762
AU
I get a slight memory leak using the MMControl or using the Wave API calls. Just setting up a simple form to play a 2k beep looses available physical memory bit by bit.
With the MMControl, I used the standard as per the example, stoping and closing the MMControl. I even set the MMControl to a variable and set it to nothing each time it ends using the Sub Done and it still looses memory. About 4k each time I play the beep. Eventually the computer freezes up as though the stack or something has run out even though there is plenty or ram and resources left. I tried it on 3 different computers and get the same result.
With the API calls I cant seem to find one that does the same as closing the MMControl.
The VB Beep control doesnt do it even when I set the default wave file to the same beep.wav in the control panel!
Is there a better third party audio activeX control?
Any suggestions?
 
Hi,
Try using DirectX.

'*** GLOBAL VARIABLES ***
Public Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

'*** SOUND VARIABLES ***
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_LOOP = &H8


'*** FORM VARIABLES ***
DICE_SND = GETDIR & "\" & "DICE.WAV"
Call sndPlaySound(ByVal DICE_SND, SND_ASYNC)


I hope this helps!
Brett
Please visit my websites!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top