[futurebasic] Re: [FB] re:NewMovieFromHandle

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2002 : Group Archive : Group : All Groups

From: Ian Mann <i.mann@...>
Date: Mon, 04 Nov 2002 07:41:58 +0100
George Wood wrote:

> Thanks for your help, but could you help me with a snippet of code to show
> how to set up and call this fn? It appears to be exactly the same as the 68k
> code without any assembly code. Remember, I am trying to have a long if
> compile with code for 68k and PPC/Carbon so I can compile either for 68k or
> PPC.
> Thanks again,
> George Wood

Hi George, The attached will (probably) play a music file and toggle it on or off
when you click the mouse.

This requires NavServices so for 68K you may need to rework the FILE$ line.

Best Regards Ian
begin globals

dim gMusicFile as FsSpec
dim gMusicFileRefNum as short
dim gMusicMovie as Movie
dim gMusicPlaying as short
end globals

clear local
dim as long @TRPtr
local fn doMouse
long if gMusicPlaying
gMusicPlaying = _False
stopMovie (gMusicMovie)
xelse
gMusicPlaying = _True
StartMovie (gMusicMovie)
end if
end fn

clear local
dim as short OSErr
local fn Startup
OSErr = fn entermovies
window#1
end fn

clear local
dim as str255 a,resname
dim as short OSErr,@dataRefChgd,@resID
local fn getFile
a = FILES$(_FSSpecOpen,"","Select a file", gMusicFile)
gMusicFileRefNum = 0
long if len(a)
OSErr=Fn OpenMovieFile(#@gMusicFile,@gMusicFileRefNum,_FSRdPerm)
Long If OSErr=_noErr
OSErr=Fn
NewMovieFromFile(gMusicMovie,gMusicFileRefNum,resID,resname,_newMovieActive
,dataRefChgd)
OSErr=Fn CloseMovieFile(gMusicFileRefNum)
gotobeginningofmovie(gMusicMovie)
StartMovie (gMusicMovie)
gMusicPlaying = _True
end if
end if

end fn


fn Startup
fn getFile
on mouse  fn doMouse

do
handleevents
if fn ismoviedone (gMusicMovie) <> _True then moviesTask (gMusicMovie,0)
until gFBQuit