Greetings,
Can anyone tell me how I can access the directX sound functions on a sound loaded with PB LoadSound()? I'd really like to know when a sound has finished playing, and DirectSound provides a GetStatus function for each buffer that will, amoung other things, tell you if the sound is still playing.
It sure would be nice if Fred could add a SoundStatus function (poke poke), but until then is there a way to access that GetStatus function on a PB loaded sound?
Thanks,
Matthew
Using GetStatus() with a PB loaded sound?
-
- User
- Posts: 64
- Joined: Mon Jun 30, 2003 5:36 pm
- Location: Michigan
- Contact:
Re: Using GetStatus() with a PB loaded sound?
I don't know about the sound commands but it may be possible with
the movie commands.
Just to get you an idea:
WaitForCompletion() sets evCode.l to 1, if the FilterGraph finished
rendering all available data. Maybe this helps you.
I can't see any way to access the IDirectSoundBuffer though (in this case,
PlayMovie() uses DirectShow of course)
BTW: Fred, please try this:
I get an "PUSH - invalid operand" error.
the movie commands.
Just to get you an idea:
Code: Select all
Structure MovieStruc
Movie.IGraphBuilder
MediaControl.IMediaControl
MediaEvent.IMediaEventEx
Window.IVideoWindow
Audio.IBasicAudio
Video.IBasicVideo
MediaSeeking.IMediaSeeking
State.l
EndStructure
InitMovie()
*movie.MovieStruc = LoadMovie(0, "D:\WINDOWS\Media\chimes.wav")
*movie\MediaSeeking\GetDuration(@duration.l) ; determine the duration - not necessary here ;)
Debug "Duration: "+Str(duration)
PlayMovie(0, 0)
Repeat
*movie\MediaEvent\WaitForCompletion(10, @evCode.l)
Delay(2)
Until evCode = 1
StopMovie()
MessageRequester("", "done!")
End
rendering all available data. Maybe this helps you.
I can't see any way to access the IDirectSoundBuffer though (in this case,
PlayMovie() uses DirectShow of course)
BTW: Fred, please try this:
Code: Select all
Debug *movie\MediaEvent\WaitForCompletion(10, @evCode.l)
Good programmers don't comment their code. It was hard to write, should be hard to read.
-
- User
- Posts: 64
- Joined: Mon Jun 30, 2003 5:36 pm
- Location: Michigan
- Contact:
I spent some more time thinking about it and while I don't know what you're up to,
maybe this approach suits you better:
(#EC_COMPLETE = $01)
...of course you'd normally check the return-value, ie...
...but that raises the already mentioned "invalid-operand" error...
Well, I only wanted to give you an idea anyway
maybe this approach suits you better:
Code: Select all
*movie\MediaEvent\GetEvent(@evCode.l, @param1.l, @param2.l, 0)
If evCode = #EC_COMPLETE
Debug "done playing"
EndIf
*movie\MediaEvent\FreeEventParams(evCode, param1, param2)
...of course you'd normally check the return-value, ie...
Code: Select all
If *movie\MediaEvent\GetEvent(@evCode.l, @param1.l, @param2.l, 0) = #S_OK
If evCode = #EC_COMPLETE
Debug "done playing"
EndIf
*movie\MediaEvent\FreeEventParams(evCode, param1, param2)
EndIf
Well, I only wanted to give you an idea anyway

Good programmers don't comment their code. It was hard to write, should be hard to read.
-
- Addict
- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact:
-
- Addict
- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact: