Microsoft DirectX 8.0 (Visual Basic)

Step 4: Close Down

To exit an audio application cleanly, you must perform three main steps:

The following procedure from the sample application closes down DirectX Audio:

Private Sub Form_Unload(Cancel As Integer)
    If Not (seg Is Nothing) Then 
        dmp.StopEx dmp.GetDefaultAudioPath, 0, 0
    End If
    Set seg = Nothing
    dmp.CloseDown
    Set dmp = Nothing
    Set dml = Nothing
    Set dx = Nothing
End Sub