home *** CD-ROM | disk | FTP | other *** search
/ YPA: Your Privacy Assured / YPA.ISO / other_goodies / music / ep154b_1.dms / ep154b_1.adf / EagleplayerDeveloper / Include / misc / DeliPlayer.i next >
Text File  |  1995-01-17  |  8KB  |  261 lines

  1. **
  2. **  $Filename: misc/DeliPlayer.i $
  3. **  $Release: 2.0 $
  4. **  $Revision: 1.36$
  5. **  $Date: 28/12/92$
  6. **
  7. **    Definitions and Macros for creating DeliTracker Playermodules
  8. **
  9. **    (C) Copyright 1991, 1992 Delirium Softdesign
  10. **        All Rights Reserved
  11. **
  12.  
  13.     IFND    DELITRACKER_PLAYER_I
  14. DELITRACKER_PLAYER_I    SET    1
  15.  
  16.     IFND EXEC_TYPES_I
  17.         INCLUDE "exec/types.i"
  18.     ENDC
  19.  
  20.     IFND UTILITY_TAGITEM_I
  21.         INCLUDE "utility/tagitem.i"
  22.     ENDC
  23.  
  24. ;----------------------------------------------------------------------------
  25. ;
  26. ; for those who don't have V37 yet!
  27. ;
  28. ;TAG_DONE    EQU    0
  29. ;TAG_IGNORE    EQU    1
  30. ;TAG_MORE    EQU    2
  31. ;TAG_SKIP    EQU    3
  32. ;
  33. ;TAG_USER    EQU    $80000000
  34. ;
  35. ;
  36. ;ENUM        MACRO
  37. ;        IFC    '\1',''
  38. ;EOFFSET        SET 0
  39. ;        ENDC
  40. ;        IFNC    '\1',''
  41. ;EOFFSET        SET \1
  42. ;        ENDC
  43. ;        ENDM
  44. ;
  45. ;EITEM        MACRO
  46. ;\1        EQU    EOFFSET
  47. ;EOFFSET        SET EOFFSET+1
  48. ;        ENDM
  49. ;
  50. ;----------------------------------------------------------------------------
  51.  
  52.  
  53. DELIVERSION    EQU    14            ; Current Version of DeliTracker
  54.  
  55. ;---------------------------- Function Offsets ------------------------------
  56.  
  57.  STRUCTURE DeliTrackerPlayer,0
  58.  
  59.     STRUCT    dtp_RTS_code,4            ; RTS for security (private !)
  60.     STRUCT    dtp_ID,8            ; Identifier (private !)
  61.     APTR    dtp_TagArray            ; pointer to TagItem array
  62.     LABEL    dtp_SIZEOF
  63.  
  64. * The TagItem ID's (ti_Tag values) for the player interface follow.
  65.  
  66. DTP_TagBase    EQU    TAG_USER+"DT"
  67.  
  68.     ENUM    DTP_TagBase            ; TagBase
  69.  
  70.     EITEM    DTP_InternalPlayer        ; PRIVATE !!!
  71.     EITEM    DTP_CustomPlayer        ; player is a customplayer
  72.  
  73.     EITEM    DTP_RequestDTVersion        ; minimum DeliTracker version needed
  74.     EITEM    DTP_RequestV37            ; Player needs at least Kick 2.04
  75.  
  76.     EITEM    DTP_PlayerVersion        ; actual player version
  77.     EITEM    DTP_PlayerName            ; name of this player
  78.     EITEM    DTP_Creator            ; misc string
  79.  
  80.     EITEM    DTP_Check1            ; Check Format before loading
  81.     EITEM    DTP_Check2            ; Check Format after file is loaded
  82.     EITEM    DTP_ExtLoad            ; Load additional files
  83.     EITEM    DTP_Interrupt            ; Interrupt routine
  84.     EITEM    DTP_Stop            ; Clear Patterncounter
  85.     EITEM    DTP_Config            ; Config Player
  86.     EITEM    DTP_UserConfig            ; User-Configroutine
  87.     EITEM    DTP_SubSongRange        ; Get min&max subsong number
  88.  
  89.     EITEM    DTP_InitPlayer            ; Initialisize the Player
  90.     EITEM    DTP_EndPlayer            ; Player clean up
  91.     EITEM    DTP_InitSound            ; Soundinitialisation routine
  92.     EITEM    DTP_EndSound            ; End sound
  93.     EITEM    DTP_StartInt            ; Start interrupt
  94.     EITEM    DTP_StopInt            ; Stop interrupt
  95.  
  96.     EITEM    DTP_Volume            ; Set Volume
  97.     EITEM    DTP_Balance            ; Set Balance
  98.     EITEM    DTP_Faster            ; Incease playspeed
  99.     EITEM    DTP_Slower            ; Decrease playspeed
  100.     EITEM    DTP_NextPatt            ; Jump to next pattern
  101.     EITEM    DTP_PrevPatt            ; Jump to previous pattern
  102.     EITEM    DTP_NextSong            ; Play next subsong
  103.     EITEM    DTP_PrevSong            ; Play previous subsong
  104.  
  105.     ;--- functions in V14 or higher (distributed as Release 1.35) ---
  106.  
  107.     EITEM    DTP_SubSongTest            ; Test, if given subsong is vaild
  108.  
  109. *** end of player interface enumeration ***
  110.  
  111.  
  112. ;--------------------------------- Header -----------------------------------
  113. ;
  114. ; Here is the MACRO for creating the header structure. Use this MACRO !!!
  115. ;
  116.  
  117. PLAYERHEADER    MACRO
  118.     moveq    #-1,d0            ; this should return an error
  119.     rts                ; in case someone tried to run it
  120.     dc.b    'DELIRIUM'        ; identifier
  121.     dc.l    \1            ; ^tagitem array
  122.     ENDM
  123.  
  124.  
  125.     ;------ When a subroutine in the player is called, A5 will contain
  126.     ;------ the pointer to the DeliTrackerGlobals, the only exeption is
  127.     ;------ of course the interrupt routine.
  128.     ;------ The interruptroutine is called every 1/50 sec (via timerint).
  129.  
  130.     ;------ When Check is called, supply d0=0 if the format is ok
  131.     ;------ else d0<>0.
  132.  
  133.     ;------ Check 1 is called before loading the complete file,
  134.     ;------ you can check in the first 1024 Bytes of the file,
  135.     ;------ if the file is smaller than 1kB, the remaining space
  136.     ;------ will contain zero.
  137.  
  138.     ;------ Check 2 is called after the complete file is loaded,
  139.     ;------ you can use dtg_ChkSize to determine the lenght of the file.
  140.     ;------ If you supply this tag the file can be crunched.
  141.  
  142.     ;------ ExtLoad: routine for loading additional files (instruments).
  143.     ;------    If successful, you must return d0=0 else d0<>0. In case of an
  144.     ;------ error DeliTracker frees all memory used for this module.
  145.  
  146.     ;------    InitPlayer: Here you should allocate the audio channels.
  147.     ;------ In case the player supports multi-modules, you must set here
  148.     ;------ dtg_SndNum to the minimal subsong number (not necessary if
  149.     ;------ you have supplied a DTP_SubSongRange routine!).
  150.     ;------ If successful, you must return d0=0 else d0<>0.
  151.  
  152.     ;------    EndPlayer: Here you should free the audio channels.
  153.  
  154.     ;------ InitSound: If you want to use the internal interrupt but don't
  155.     ;------ need the default 50 Hz frequency, you can write another
  156.     ;------ timer value into dtg_Timer.
  157.  
  158.     ;------ It is recommended to use DTP_SubSongRange/DTP_SubSongTest
  159.     ;------ instead of DTP_NextSong/DTP_PrevSong.
  160.  
  161.     ;------ Volume usually only copies the values dtg_Volume, dtg_SndLBal
  162.     ;------ and dtg_SndRBal to an internal buffer. The interrupt code has
  163.     ;------ access to this buffer and can set the volume correct.
  164.  
  165.     ;------ Note: the Player can consist of more Hunks. That means you
  166.     ;------ can seperate CHIP DATA form CODE (and you should do this!).
  167.  
  168.  
  169. ;---------------------------- Global Variables ------------------------------
  170.  
  171.  STRUCTURE DeliTrackerGlobals,0
  172.  
  173.     APTR    dtg_AslBase        ; librarybase don't CloseLibrary()
  174.  
  175.     ;------ if you use dtg_AslBase, make sure that
  176.         ;------ DTP_RequestDTVersion is at least 13 ! 
  177.  
  178.     APTR    dtg_DOSBase        ; librarybase "
  179.     APTR    dtg_IntuitionBase    ; librarybase "
  180.     APTR    dtg_GfxBase        ; librarybase "
  181.     APTR    dtg_GadToolsBase    : librarybase " (NULL for Kick 1.3 and below)
  182.     APTR    dtg_ReservedLibraryBase    ; reserved for future use
  183.  
  184.     APTR    dtg_DirArrayPtr        ; Ptr to the directory of the current module
  185.     APTR    dtg_FileArrayPtr    ; Ptr to the filename of the current module
  186.     APTR    dtg_PathArrayPtr    ; Ptr to PathArray (e.g used in LoadFile())
  187.  
  188.     APTR    dtg_ChkData        ; pointer to the module to be checked
  189.     ULONG    dtg_ChkSize        ; size of the module
  190.  
  191.     UWORD    dtg_SndNum        ; current sound number
  192.     UWORD    dtg_SndVol        ; volume (ranging from 0 to 64)
  193.     UWORD    dtg_SndLBal        ; left volume (ranging from 0 to 64)
  194.     UWORD    dtg_SndRBal        ; right volume (ranging from 0 to 64)
  195.     UWORD    dtg_LED            ; filter (0 if the LED is off)
  196.     UWORD    dtg_Timer        ; timer-value for the CIA-Timers
  197.  
  198.     FPTR    dtg_GetListData        ;
  199.     FPTR    dtg_LoadFile        ;
  200.     FPTR    dtg_CopyDir        ;
  201.     FPTR    dtg_CopyFile        ;
  202.     FPTR    dtg_CopyString        ;
  203.     FPTR    dtg_AudioAlloc        ;
  204.     FPTR    dtg_AudioFree        ;
  205.     FPTR    dtg_StartInt        ;
  206.     FPTR    dtg_StopInt        ;
  207.     FPTR    dtg_SongEnd        ; save to call from interrupt code !
  208.     FPTR    dtg_CutSuffix        ;
  209.     FPTR    dtg_SetTimer        ;
  210.     FPTR    dtg_WaitAudioDMA    ; do not use !!!
  211.     FPTR    dtg_Reserved2        ; do not use !!!
  212.     FPTR    dtg_Reserved3        ; do not use !!!
  213.  
  214.     ; There is no dtg_SIZEOF cause ...
  215.  
  216.  
  217.     ;------ GetListData(Num:d0): This function returns the memorylocation
  218.     ;------ of a loaded file in a0 and its size in d0. Num starts with 0 
  219.     ;------ (the selected module). Example: GetListData(2) returns the
  220.     ;------ start of the third file loaded (via ExtLoad) in a0 an its size
  221.     ;------ in d0.
  222.  
  223.     ;------ LoadFile(): this function may only be called in the ExtLoad
  224.     ;------ routine. file/pathname must be in dtg_PathArrayPtr then
  225.     ;------ this function will attempt to load the file into CHIPMEM
  226.     ;------ (and DECRUNCH it). If everything went fine, d0 will be zero.
  227.     ;------ If d0 is not zero this indicates an error (e.g. read error,
  228.     ;------ not enough memory, ...).
  229.  
  230.     ;------ CopyDir(): this function copies the pathname at the end
  231.     ;------ of the string in dtg_PathArrayPtr(a5).
  232.  
  233.     ;------ CopyFile(): this function copies the filename at the end
  234.     ;------ of the string in dtg_PathArrayPtr(a5).
  235.  
  236.     ;------ CopyString(Ptr:a0): this function copies the string in a0
  237.     ;------ at the end of the string in dtg_PathArrayPtr(a5).
  238.  
  239.     ;------ AudioAlloc(): this function allocates the audiochannels.
  240.     ;------ If d0=0 all is ok, d0<>0 indicates an error.
  241.  
  242.     ;------ AudioFree(): this function frees the audiochannels allocated
  243.     ;------ with AudioAlloc().
  244.  
  245.     ;------ StartInt(): this function starts the timer-interrupt.
  246.  
  247.     ;------ StopInt(): this function stops the timer-interrupt started
  248.     ;------ with StartInt().
  249.  
  250.     ;------ SongEnd(): signal the songend to DeliTracker
  251.     ;------    This call is guaranteed to preserve all registers.
  252.  
  253.     ;------ SetTimer(): programs the CIA-Timer with the value supplied
  254.     ;------ in dtg_Timer(a5). Only useful, if the internal timer-interrupt
  255.     ;------ is used. This call is guaranteed to preserve all registers.
  256.  
  257.  
  258.     ENDC    ; DELITRACKER_PLAYER_I
  259.  
  260.  
  261.