home *** CD-ROM | disk | FTP | other *** search
- **
- ** $Filename: misc/DeliPlayer.i $
- ** $Release: 2.0 $
- ** $Revision: 1.36$
- ** $Date: 28/12/92$
- **
- ** Definitions and Macros for creating DeliTracker Playermodules
- **
- ** (C) Copyright 1991, 1992 Delirium Softdesign
- ** All Rights Reserved
- **
-
- IFND DELITRACKER_PLAYER_I
- DELITRACKER_PLAYER_I SET 1
-
- IFND EXEC_TYPES_I
- INCLUDE "exec/types.i"
- ENDC
-
- IFND UTILITY_TAGITEM_I
- INCLUDE "utility/tagitem.i"
- ENDC
-
- ;----------------------------------------------------------------------------
- ;
- ; for those who don't have V37 yet!
- ;
- ;TAG_DONE EQU 0
- ;TAG_IGNORE EQU 1
- ;TAG_MORE EQU 2
- ;TAG_SKIP EQU 3
- ;
- ;TAG_USER EQU $80000000
- ;
- ;
- ;ENUM MACRO
- ; IFC '\1',''
- ;EOFFSET SET 0
- ; ENDC
- ; IFNC '\1',''
- ;EOFFSET SET \1
- ; ENDC
- ; ENDM
- ;
- ;EITEM MACRO
- ;\1 EQU EOFFSET
- ;EOFFSET SET EOFFSET+1
- ; ENDM
- ;
- ;----------------------------------------------------------------------------
-
-
- DELIVERSION EQU 14 ; Current Version of DeliTracker
-
- ;---------------------------- Function Offsets ------------------------------
-
- STRUCTURE DeliTrackerPlayer,0
-
- STRUCT dtp_RTS_code,4 ; RTS for security (private !)
- STRUCT dtp_ID,8 ; Identifier (private !)
- APTR dtp_TagArray ; pointer to TagItem array
- LABEL dtp_SIZEOF
-
- * The TagItem ID's (ti_Tag values) for the player interface follow.
-
- DTP_TagBase EQU TAG_USER+"DT"
-
- ENUM DTP_TagBase ; TagBase
-
- EITEM DTP_InternalPlayer ; PRIVATE !!!
- EITEM DTP_CustomPlayer ; player is a customplayer
-
- EITEM DTP_RequestDTVersion ; minimum DeliTracker version needed
- EITEM DTP_RequestV37 ; Player needs at least Kick 2.04
-
- EITEM DTP_PlayerVersion ; actual player version
- EITEM DTP_PlayerName ; name of this player
- EITEM DTP_Creator ; misc string
-
- EITEM DTP_Check1 ; Check Format before loading
- EITEM DTP_Check2 ; Check Format after file is loaded
- EITEM DTP_ExtLoad ; Load additional files
- EITEM DTP_Interrupt ; Interrupt routine
- EITEM DTP_Stop ; Clear Patterncounter
- EITEM DTP_Config ; Config Player
- EITEM DTP_UserConfig ; User-Configroutine
- EITEM DTP_SubSongRange ; Get min&max subsong number
-
- EITEM DTP_InitPlayer ; Initialisize the Player
- EITEM DTP_EndPlayer ; Player clean up
- EITEM DTP_InitSound ; Soundinitialisation routine
- EITEM DTP_EndSound ; End sound
- EITEM DTP_StartInt ; Start interrupt
- EITEM DTP_StopInt ; Stop interrupt
-
- EITEM DTP_Volume ; Set Volume
- EITEM DTP_Balance ; Set Balance
- EITEM DTP_Faster ; Incease playspeed
- EITEM DTP_Slower ; Decrease playspeed
- EITEM DTP_NextPatt ; Jump to next pattern
- EITEM DTP_PrevPatt ; Jump to previous pattern
- EITEM DTP_NextSong ; Play next subsong
- EITEM DTP_PrevSong ; Play previous subsong
-
- ;--- functions in V14 or higher (distributed as Release 1.35) ---
-
- EITEM DTP_SubSongTest ; Test, if given subsong is vaild
-
- *** end of player interface enumeration ***
-
-
- ;--------------------------------- Header -----------------------------------
- ;
- ; Here is the MACRO for creating the header structure. Use this MACRO !!!
- ;
-
- PLAYERHEADER MACRO
- moveq #-1,d0 ; this should return an error
- rts ; in case someone tried to run it
- dc.b 'DELIRIUM' ; identifier
- dc.l \1 ; ^tagitem array
- ENDM
-
-
- ;------ When a subroutine in the player is called, A5 will contain
- ;------ the pointer to the DeliTrackerGlobals, the only exeption is
- ;------ of course the interrupt routine.
- ;------ The interruptroutine is called every 1/50 sec (via timerint).
-
- ;------ When Check is called, supply d0=0 if the format is ok
- ;------ else d0<>0.
-
- ;------ Check 1 is called before loading the complete file,
- ;------ you can check in the first 1024 Bytes of the file,
- ;------ if the file is smaller than 1kB, the remaining space
- ;------ will contain zero.
-
- ;------ Check 2 is called after the complete file is loaded,
- ;------ you can use dtg_ChkSize to determine the lenght of the file.
- ;------ If you supply this tag the file can be crunched.
-
- ;------ ExtLoad: routine for loading additional files (instruments).
- ;------ If successful, you must return d0=0 else d0<>0. In case of an
- ;------ error DeliTracker frees all memory used for this module.
-
- ;------ InitPlayer: Here you should allocate the audio channels.
- ;------ In case the player supports multi-modules, you must set here
- ;------ dtg_SndNum to the minimal subsong number (not necessary if
- ;------ you have supplied a DTP_SubSongRange routine!).
- ;------ If successful, you must return d0=0 else d0<>0.
-
- ;------ EndPlayer: Here you should free the audio channels.
-
- ;------ InitSound: If you want to use the internal interrupt but don't
- ;------ need the default 50 Hz frequency, you can write another
- ;------ timer value into dtg_Timer.
-
- ;------ It is recommended to use DTP_SubSongRange/DTP_SubSongTest
- ;------ instead of DTP_NextSong/DTP_PrevSong.
-
- ;------ Volume usually only copies the values dtg_Volume, dtg_SndLBal
- ;------ and dtg_SndRBal to an internal buffer. The interrupt code has
- ;------ access to this buffer and can set the volume correct.
-
- ;------ Note: the Player can consist of more Hunks. That means you
- ;------ can seperate CHIP DATA form CODE (and you should do this!).
-
-
- ;---------------------------- Global Variables ------------------------------
-
- STRUCTURE DeliTrackerGlobals,0
-
- APTR dtg_AslBase ; librarybase don't CloseLibrary()
-
- ;------ if you use dtg_AslBase, make sure that
- ;------ DTP_RequestDTVersion is at least 13 !
-
- APTR dtg_DOSBase ; librarybase "
- APTR dtg_IntuitionBase ; librarybase "
- APTR dtg_GfxBase ; librarybase "
- APTR dtg_GadToolsBase : librarybase " (NULL for Kick 1.3 and below)
- APTR dtg_ReservedLibraryBase ; reserved for future use
-
- APTR dtg_DirArrayPtr ; Ptr to the directory of the current module
- APTR dtg_FileArrayPtr ; Ptr to the filename of the current module
- APTR dtg_PathArrayPtr ; Ptr to PathArray (e.g used in LoadFile())
-
- APTR dtg_ChkData ; pointer to the module to be checked
- ULONG dtg_ChkSize ; size of the module
-
- UWORD dtg_SndNum ; current sound number
- UWORD dtg_SndVol ; volume (ranging from 0 to 64)
- UWORD dtg_SndLBal ; left volume (ranging from 0 to 64)
- UWORD dtg_SndRBal ; right volume (ranging from 0 to 64)
- UWORD dtg_LED ; filter (0 if the LED is off)
- UWORD dtg_Timer ; timer-value for the CIA-Timers
-
- FPTR dtg_GetListData ;
- FPTR dtg_LoadFile ;
- FPTR dtg_CopyDir ;
- FPTR dtg_CopyFile ;
- FPTR dtg_CopyString ;
- FPTR dtg_AudioAlloc ;
- FPTR dtg_AudioFree ;
- FPTR dtg_StartInt ;
- FPTR dtg_StopInt ;
- FPTR dtg_SongEnd ; save to call from interrupt code !
- FPTR dtg_CutSuffix ;
- FPTR dtg_SetTimer ;
- FPTR dtg_WaitAudioDMA ; do not use !!!
- FPTR dtg_Reserved2 ; do not use !!!
- FPTR dtg_Reserved3 ; do not use !!!
-
- ; There is no dtg_SIZEOF cause ...
-
-
- ;------ GetListData(Num:d0): This function returns the memorylocation
- ;------ of a loaded file in a0 and its size in d0. Num starts with 0
- ;------ (the selected module). Example: GetListData(2) returns the
- ;------ start of the third file loaded (via ExtLoad) in a0 an its size
- ;------ in d0.
-
- ;------ LoadFile(): this function may only be called in the ExtLoad
- ;------ routine. file/pathname must be in dtg_PathArrayPtr then
- ;------ this function will attempt to load the file into CHIPMEM
- ;------ (and DECRUNCH it). If everything went fine, d0 will be zero.
- ;------ If d0 is not zero this indicates an error (e.g. read error,
- ;------ not enough memory, ...).
-
- ;------ CopyDir(): this function copies the pathname at the end
- ;------ of the string in dtg_PathArrayPtr(a5).
-
- ;------ CopyFile(): this function copies the filename at the end
- ;------ of the string in dtg_PathArrayPtr(a5).
-
- ;------ CopyString(Ptr:a0): this function copies the string in a0
- ;------ at the end of the string in dtg_PathArrayPtr(a5).
-
- ;------ AudioAlloc(): this function allocates the audiochannels.
- ;------ If d0=0 all is ok, d0<>0 indicates an error.
-
- ;------ AudioFree(): this function frees the audiochannels allocated
- ;------ with AudioAlloc().
-
- ;------ StartInt(): this function starts the timer-interrupt.
-
- ;------ StopInt(): this function stops the timer-interrupt started
- ;------ with StartInt().
-
- ;------ SongEnd(): signal the songend to DeliTracker
- ;------ This call is guaranteed to preserve all registers.
-
- ;------ SetTimer(): programs the CIA-Timer with the value supplied
- ;------ in dtg_Timer(a5). Only useful, if the internal timer-interrupt
- ;------ is used. This call is guaranteed to preserve all registers.
-
-
- ENDC ; DELITRACKER_PLAYER_I
-
-
-