Im wondering if it is possible to store an audio *.wav file in memmory so everytime I play it it doesn't have to be loaded?
Is this possible?
Printable View
Im wondering if it is possible to store an audio *.wav file in memmory so everytime I play it it doesn't have to be loaded?
Is this possible?
how do u want to play it? - if you are using direct show / mci / or media player just don't close the file
At the moment i'm just using:
Code:My.Computer.Audio.Play("../../Resources/Test.wav")
well prob not then - i mean audio.play does support a stream - so loading the file into one may be quicker
Kris
Code would be:
vb Code:
Dim s As New System.IO.FileStream("c:\alert.wav", System.IO.FileMode.Open, System.IO.FileAccess.Read) My.Computer.Audio.Play(s, AudioPlayMode.Background)
So make s global / form level variable (etc) and run the play line when u need it
Ok thanks this works when I play the sound once but when I play it a second time I get a System.InvalidOperationException?
I believe you'd need to reset the position in the stream to 0, before attempting to play it again.
Ok problem solved it's now working fine thanks