Restored from previous forum. Originally posted by Tron.
But if you need PlayMovie to play mp3-sound in the background, and PlayMovie needs a Window, why not make a Window in full Desktop size, with no border and use OpenWindowedScreen?
OpenWindowedScreen can be as big as the Window is and you can choose the resolution of it (it can be less or bigger than the actual desktop resolution).
Thanks for the input Franco!
My only concern with the OpenWindowedScreen is the speed. I haven't done any testing, but maybe you know from experience. Is OpenWindowedScreen as fast the OpenScreen drawing surface? They seem to both be using DirectX so this may not be an issue.
Hey, you got me thinking when you brought up the OpenWindowedScreen. Through some more trial and error I found out a way to play an MP3 and utilize the OpenScreen function.
The problem I had originally was that I was calling the InitSprite function before the InitMovie function. I also found a way I can make the MP3 window invisible using the #BP_Window_Invisible flag.
Here is some sample code:
{Test MP3 and OpenScreen}
If InitMovie() = 0
MessageRequester("Error", "Can't initialize movie playback !", 0)
End
EndIf
mp3.s = "test.mp3" ;substitute your MP3 file here
If LoadMovie(0, mp3.s)
;Window dimensions don't matter since the window is invisible
OpenWindow(0, 0, 0, 20, 30, #PB_Window_Invisible, "my mp3")
PlayMovie(0, 0)
Else
MessageRequester("Error", "Can't load the movie...", 0)
EndIf
;I just put this in to make sure the window was invisible, you can remove it.
MessageRequester("Pause", "For Affect...", 0)
If InitSprite() = 0 Or InitKeyboard() = 0
MessageRequester("Error", "Can't open DirectX 7 Or later", 0)
End
EndIf
If OpenScreen(640, 480, 32, "Drawing Surface")
image.s = "image.bmp" ;substitute your BMP image.
If LoadSprite(0, image.s, 0)
Repeat
FlipBuffers()
ClearScreen(0,0,0)
DisplaySprite(0, 0, 0)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Else
MessageRequester("Error", "Can't load Sprite!", 0)
EndIf
FreeSprite(0)
CloseScreen()
Else
MessageRequester("Error", "Can't open a 640*480 - 32 bit screen !", 0)
EndIf
End
---------------------------------
It seems to be working good, now I just need to do some further testing. Like switching to a different MP3, and so on...
Thanks again,
Tron
"Honesty is the best policy, but insanity is a much better defense."