[futurebasic] Re: [FB] QT Controller Again

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: AlStaff@...
Date: Sat, 23 Oct 1999 14:16:54 EDT
>I am using the QT demo code in the FB Handbook Samples.
>
>I am only playing music no graphics.
>
>When I pick from the menu option "Load without Controller"
>
>It creates part of a little window in the top right corner (MacOs 8.6)
>How do I get no controller or window to appear?


I attempted to give a simple answer to this earlier. Perhaps you missed it. 
Here's my improved answer. Assuming you're using FB II (I haven't looked at 
the QT demo in FB 3 yet, but I imagine it's very similar), replace FN 
NewMovieWindow with this one (watch for line wrap).


CLEAR LOCAL MODE
DIM boxT%,boxL%,boxB%,boxR%
DIM MCRect;8
DIM fsSpec;0,fsVRefNum%,fsParID&,63 fsName$       'standard file spec record
LOCAL FN NewMovieWindow(MovieBlockPtr&,fsName$,fsVRefNum%,MTop%,MLeft%,Flags%)
WindowNumber% = 0
LONG IF MovieBlockPtr&
'
LONG IF fsName$ = ""
fsName$ =FILES$(1,"MooV",,fsVRefNum%)             'get a QuickTime movie
END IF
'
LONG IF fsName$ <> ""
pBlk& = @paramBlock$                              'pBlock for file spec
& pBlk& + _ioNamePtr  ,@fsName$                   'file name to pBlock
% pBlk& + _ioVRefNum  ,fsVRefNum%                 'vol ref num to pBlock
% pBlk& + _ioFDirIndex,0                          'flag pBlk to use name & 
vRef
OSErr% = FN GETCATINFO(pBlk&)                     'get info on movie file
fsParID& = [pBlk& + _ioFLParID]                   'parent ID is what we needed
'
LONG IF FN OPENMOVIEFILE(fsSpec,MovieResRefNum%,_FSRdPerm) = _NoErr
'
LONG IF FN 
NEWMOVIEFROMFILE(Movie&,MovieResRefNum%,resID%,resName$,1,dataRefChgd%) = 
_noErr
'
DO
MovieBlockPtr& = MovieBlockPtr& + _MovieInfoSize
INC(WindowNumber%)
UNTIL WINDOW(-WindowNumber%) = 0                  'UnUsed Window...
'
CALL GETMOVIEBOX(Movie&,boxT%)                    'get rect for movie
CALL OFFSETRECT(boxT%,-boxL%,-boxT%)              'offset to zero (Z will 
center)

LONG IF (boxB% > boxT%) AND (boxR% > boxL%)       ' check for valid movie box
movieExists% = 1                                  ' has a movie track
XELSE
movieExists% = 0                                  ' no movie track (sound 
track only)
END IF
'
LONG IF Flags% AND 8                              '��� Double Size ���
boxB%=boxB%+boxB%
boxR%=boxR%+boxR%
END IF
'
CALL SETMOVIEBOX(Movie&,boxT%)                    'say this is our rect
LONG IF Flags% AND 1
boxB% = boxB%+16                                  'add to bottom for 
controller
IF movieExists% = 0 THEN boxR% = boxR%+160        ' add to right for 
controller if no movie track
XELSE
IF movieExists% = 0 THEN WindowNumber% = -WindowNumber%
END IF

WINDOW 
WindowNumber%,fsName$,(MLeft%,MTop%)-(boxR%+MLeft%,MTop%+boxB%),5_updateVisRgn
'build the window
CALL GETGWORLD(CGrafPtr&,CurDev&)
CALL SETMOVIEGWORLD(Movie&,CGrafPtr&,0)           'tell QT to use this 
grafport

LONG IF Flags% AND 1
MCRect;8 = CGrafPtr&+_PortRect
MovieCT& = FN NEWMOVIECONTROLLER(Movie&,MCRect,&15)
rslt     = USR MCNEWATTACHEDCONTROLLER(MovieCT&,Movie&,CGrafPtr&,#0)
XELSE
CALL GOTOBEGINNINGOFMOVIE(Movie&)                 'rewind
OsErr = FN PREROLLMOVIE(Movie&,0,&1000)           'rate = 1.0
CALL STARTMOVIE(Movie&)                           'roll 'em
MovieCT& = 0
END IF

MovieBlockPtr&.MovieHndl&       = Movie&
MovieBlockPtr&.MovieController& = MovieCT&
MovieBlockPtr&.MoviePort&       = CGrafPtr&
MovieBlockPtr&.MovieResRefNum%  = MovieResRefNum%
MovieBlockPtr&.MovieFlags%      = Flags%
END IF
'
END IF
'
END IF
'
END IF
'
END FN = WindowNumber%


Al Staffieri Jr.

AlStaff@...
http://members.aol.com/AlStaff/index.html