home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 5
/
FreshFish_July-August1994.bin
/
bbs
/
mus
/
delitracker-2.01.lha
/
DeliTracker
/
Files
/
developer.lha
/
Developer
/
Examples
/
TestPlayer.s
< prev
Wrap
Text File
|
1994-04-15
|
14KB
|
547 lines
**
** Testplayer.s
**
** A sample player that visually reports DeliTracker's actions
** within external players.
**
** Use the source as a skeleton model for your own players.
** Refer to the sample sources for additional information.
**
** Once assembled, load this player into DeliTracker, and try
** playing the file 'testmodule'. It is only a textfile with
** the word "TEST" at the beginning. Notice now that
** DeliTracker's actions on the module are visible. This should
** aid you in your coding sequences.
**
** Original source by Peter Kunath and Frank Riffel of Delirium.
**
** English, comments, and general banter by Kevin Dackiw.
**
** Have any problems/concerns/ideas? Feel free to contact the
** authors:
**
** Frank Riffel
** Merkstr. 27
** 82405 Wessobrunn
** Germany
**
incdir "includes:"
include "dos/dos.i"
include "intuition/intuition.i"
include "misc/DevpacMacros.i"
include "misc/DeliPlayer.i"
;
;
SECTION Player,Code
;
;
PLAYERHEADER PlayerTagArray ; define start of header
dc.b '$VER: TestPlayer V2.01 (15 Apr 94)',0 ; for OS 2.0 version command
even
PlayerTagArray
dc.l DTP_RequestDTVersion,16 ; define all the tags
dc.l DTP_PlayerVersion,02<<16+01
dc.l DTP_PlayerName,PName ; for the player
dc.l DTP_Creator,CName
dc.l DTP_DeliBase,delibase
dc.l DTP_Check1,Chk ; omit any unused
dc.l DTP_Config,Config ; functions as
dc.l DTP_UserConfig,UserConfig ; needed!
dc.l DTP_SubSongRange,SubSong
dc.l DTP_Process,Begin
dc.l DTP_Priority,0
dc.l DTP_StackSize,4096
dc.l DTP_MsgPort,DeliPort
dc.l DTP_InitPlayer,InitPlay
dc.l DTP_EndPlayer,EndPlay
dc.l DTP_InitSound,InitSnd
dc.l DTP_EndSound,EndSnd
dc.l DTP_StartInt,StartSnd
dc.l DTP_StopInt,StopSnd
dc.l DTP_Volume,Volume
dc.l DTP_Balance,Balance
dc.l DTP_Faster,Faster
dc.l DTP_Slower,Slower
dc.l DTP_PrevPatt,PrevPatt
dc.l DTP_NextPatt,NextPatt
dc.l DTP_PrevSong,PrevSub
dc.l DTP_NextSong,NextSub
dc.l TAG_DONE ; signify end of tags
*-----------------------------------------------------------------------*
;
; Playername / creatorname
;
*-----------------------------------------------------------------------*
PName dc.b 'TestPlayer',0
CName dc.b 'Written by Delirium for Testpurposes',0
even
*-----------------------------------------------------------------------*
;
; Player Task
;
*-----------------------------------------------------------------------*
Begin
move.l delibase,a5 ; get DeliBase
move.l dtg_DOSBase(a5),_DOSBase
move.l dtg_IntuitionBase(a5),_IntuitionBase
bsr About ; display About-Requester
move.l #ConsoleName,d1
move.l #MODE_NEWFILE,d2
CALLDOS Open
move.l d0,d1
beq Quit ; Error
CALLDOS SelectOutput
move.l d0,_OldOutput
lea StartTxt0,a0 ; fetch text
bsr WriteInfoTxt ; output
;--------------------------------------------------------------------------
;
; Mainloop
MainLoop
move.l #SIGBREAKF_CTRL_C,d0 ; quit on CTRL-C
move.l DeliPort,a0
move.b MP_SIGBIT(a0),d1 ; DeliMask holen
bset.l d1,d0
CALLEXEC Wait ; Schlaf gut
btst.l #SIGBREAKB_CTRL_C,d0 ; CTRL-C signal ?
beq.s DeliCollect ; nope !
bsr Exit ; suicide :)
DeliCollect ; collect DeliTracker msg's
move.l DeliPort,a0
CALLEXEC GetMsg
tst.l d0 ; Msg da ?
beq.s CollectDone ; Nein !
move.l d0,-(sp) ; store ^Msg
move.l d0,a0
move.l DTMN_Function(a0),a0 ; get CMD
jsr (a0) ; Befehl ausführen
move.l (sp)+,a1 ; restore ^Msg
move.l d0,DTMN_Result(a1) ; set Result
CALLEXEC ReplyMsg ; return to sender
bra.s DeliCollect
CollectDone
tst.w QuitFlag ; schon Ende ?
bne MainLoop ; noch nicht !
;--------------------------------------------------------------------------
;
; quit Player
Cleanup
lea QuitTxt0,a0 ; fetch text
bra WriteInfoTxt ; output
move.l _OldOutput,d1
CALLDOS SelectOutput
move.l d0,d1
CALLDOS Close
Quit
rts
;--------------------------------------------------------------------------
;
; End Player
Exit
clr.w QuitFlag ; quit Player
rts
;--------------------------------------------------------------------------
;
; About Gesülze
About
sub.l a0,a0
lea AboutReqStruct,a1 ; EasyStruct
sub.l a2,a2
sub.l a3,a3
CALLINT EasyRequestArgs
rts
*-----------------------------------------------------------------------*
;
; Check if the module is a TestPlayer-Module (THIS ROUTINE MUST EXIST!!!)
;
*-----------------------------------------------------------------------*
Chk
move.l delibase,a0 ; ^DeliBase
move.l dtg_ChkData(a0),a0 ; get module base from DT
moveq #0,d0 ; clear register
cmpi.l #'TEST',(a0) ; supported type ?
sne d0 ; no - signal false
rts ; leave
*-----------------------------------------------------------------------*
;
; Initialize the player
;
*-----------------------------------------------------------------------*
InitPlay
lea InitTxt1,a0 ; fetch text
bsr WriteInfoTxt ; output
moveq #0,d0 ; no error
rts
*-----------------------------------------------------------------------*
;
; Clean up the player
;
*-----------------------------------------------------------------------*
EndPlay
lea EndTxt1,a0 ; fetch text
bra WriteInfoTxt ; output
*-----------------------------------------------------------------------*
;
; Initialize the module
;
*-----------------------------------------------------------------------*
InitSnd
lea InitTxt2,a0 ; fetch text
bra WriteInfoTxt ; output
*-----------------------------------------------------------------------*
;
; End sound
;
*-----------------------------------------------------------------------*
EndSnd
lea EndTxt2,a0 ; fetch text
bra WriteInfoTxt ; output
*-----------------------------------------------------------------------*
;
; Start interrupts
;
*-----------------------------------------------------------------------*
StartSnd
lea StartTxt,a0 ; fetch text
bra WriteInfoTxt ; output
*-----------------------------------------------------------------------*
;
; Start interrupts
;
*-----------------------------------------------------------------------*
StopSnd
lea StopTxt,a0 ; fetch text
bra WriteInfoTxt ; output
*-----------------------------------------------------------------------*
;
; IMPORTANT NOTE:
; There is a BIG difference between the »Config« and the
; »UserConfig« Routine !!! The Config routine is immediately
; called after that the Player is loaded. It is used to
; configure player (e.g. load config file and set pathes)!
; The UserConfig routine is only called if the User selects
; the player in the PrefWindow and presses the Config Player
; GADGET. This routine is thought as a method of getting
; informations (playerspecific preferences) from the user
; (e.g. pathes for instruments or maximum memory usage).
; The difference between Config and InitPlayer is that
; Config is called ONCE the player is loaded and that
; InitPlayer is called every time a module is played.
;
*-----------------------------------------------------------------------*
;
; get/set playerspecific preferences (configuration routines)
;
*-----------------------------------------------------------------------*
UserConfig
lea InfoTxt1,a0 ; fetch text
bra WriteInfoTxt ; output
Config
lea InfoTxt2,a0 ; fetch text
bsr WriteInfoTxt ; output
moveq #0,d0 ; no error
rts
*-----------------------------------------------------------------------*
;
; Patterncontrol
;
*-----------------------------------------------------------------------*
NextPatt
lea InfoTxt3,a0 ; fetch text
bra WriteInfoTxt ; output
PrevPatt
lea InfoTxt4,a0 ; fetch text
bra WriteInfoTxt ; output
*-----------------------------------------------------------------------*
;
; Subsongcontrol
;
*-----------------------------------------------------------------------*
SubSong
lea InfoTxt9,a0 ; fetch text
bra WriteInfoTxt ; output
NextSub
lea InfoTxt5,a0 ; fetch text
bra WriteInfoTxt ; output
PrevSub
lea InfoTxt6,a0 ; fetch text
bra WriteInfoTxt ; output
*-----------------------------------------------------------------------*
;
; Speedcontrol
;
*-----------------------------------------------------------------------*
Faster
lea InfoTxt7,a0 ; f