-
Aug 31st, 2009, 03:02 AM
#1
Thread Starter
Addicted Member
Store Audio In Memmory
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?
-
Aug 31st, 2009, 04:03 AM
#2
Re: Store Audio In Memmory
how do u want to play it? - if you are using direct show / mci / or media player just don't close the file
-
Aug 31st, 2009, 04:05 AM
#3
Thread Starter
Addicted Member
Re: Store Audio In Memmory
At the moment i'm just using:
Code:
My.Computer.Audio.Play("../../Resources/Test.wav")
-
Aug 31st, 2009, 06:54 AM
#4
Re: Store Audio In Memmory
well prob not then - i mean audio.play does support a stream - so loading the file into one may be quicker
Kris
-
Aug 31st, 2009, 07:01 AM
#5
Re: Store Audio In Memmory
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
-
Aug 31st, 2009, 07:55 AM
#6
Thread Starter
Addicted Member
Re: Store Audio In Memmory
Ok thanks this works when I play the sound once but when I play it a second time I get a System.InvalidOperationException?
-
Aug 31st, 2009, 08:24 AM
#7
Re: Store Audio In Memmory
I believe you'd need to reset the position in the stream to 0, before attempting to play it again.
-
Aug 31st, 2009, 11:33 AM
#8
Thread Starter
Addicted Member
Re: Store Audio In Memmory
Ok problem solved it's now working fine thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|