View Single Post
 
Old 10-04-2011, 07:39 AM
therealtomlapp therealtomlapp is offline
Freshman
 
Join Date: Jan 2009
Location: New Jersey
Posts: 40
Unhappy

Code:
       With DirectSoundAudioBuffer
            .Volume = AudioVolume
            .Pan = AudioPan
            .Frequency = AudioPlaybackFrequency
            .SetEffects(effects)
            .SetCurrentPosition(0)
            .Play(0, BufferPlayFlags.Default)
        End With
Ok, I added that line to my code. But I was not having any problems with the position, it always played from the beginning. It's just sometimes there will be a long delay before hearing anything. This delay is sometimes as long as 15-20 seconds.

The following code, where I create a new directsound device. Should these lines of code stay where they are (inside Speaktext() so a new directsound device is created every time), or should I put them into the load event (so a new directsound device is created only once, and it is reused). I wasn't sure if maybe i'm getting the delay sometimes because i'm declaring a new directsound device every time, and maybe this is sometimes createing a back log in the system? At the same time I don't know if declaring it at runtime would eventually cause memory issues or not. Of course I don't even know if it's even directx, it could possibly be the speech synthesizer that is causing me the delay.
Code:
        DirectSoundAudioDevice = New DirectSound.Device(myDevices(2).DriverGuid)
        DirectSoundAudioDevice.SetCooperativeLevel(Me, CooperativeLevel.Priority)
Reply With Quote