;****** thxplay.library/--overview-- ******************************************
;
;   PURPOSE
;       To provide an interface to the THX2 player.
;
;   OVERVIEW
;       THX2  is  a  'chip' music tracker by Martin Wodok (Dexter/Abyss). It
;       comes with a rather cumbersome binary replayer, so you may play THX2
;       songs  in  your  own  programs.  This  provides an easy and powerful
;       interface to the THX2 player, providing a wide range of functions.
;
;        - Allocation: thxInit(), thxFree()
;        - Playing:    thxPlay(), thxStop(), thxPause(), thxWind()
;        - Volume:     thxGetVolume(), thxSetVolume()
;        - Multisong:  thxGetNumSongs(), thxSetSong()
;        - Sound FX:   thxPlayNote(), thxStopNote(), thxNoteFX()
;        - Misc:       thxSignalEnd(), thxSongEnded(), thxSyncByte(),
;                      thxPlaytime()
;
;       You  need to read a THX song in from disk or 'incbin' it. You should
;       load  it  into  PUBLIC  memory,  however it does not have to be CHIP
;       memory.
;
;       The  music  play  is,  as  you  would  expect, interrupt-driven, and
;       asynchronous. This interface automatically provides fallback support
;       for a VSYNC based replayer if it cannot allocate a CIA timer.
;
;       The  interface is 68000 compatible, optimised versions for the 68020
;       and better are also included.
;
;   NOTE
;       This  interface was initially developed as an Amiga E module. With a
;       little  extra  effort,  it  is  also  available  as a runtime shared
;       library.  Therefore, it operates a simple mechanism in thxInit() and
;       thxFree()  to ensure only one task at any time is using the library.
;       See the notes of thxInit() for more information about this.
;
;       Also note that all examples are given in Amiga E code.
;
;       Synopsis is given as 3 lines: the assembler/register synopsis, the C
;       prototype, and the E synopsis.
;
;   EXAMPLE
;       More thorough examples are included with the distribution.
;       This is an example in Amiga E, using the E module thx-play.m.
;
;       MODULE 'tools/thx-play', 'tools/file'
;       PROC main()
;         DEF mod
;         IF mod := loadfile(arg, 0, MEMF_PUBLIC)
;           IF thxInit(mod)=0
;             thxPlay()
;             REPEAT; WaitTOF(); UNTIL CtrlC() OR thxSongEnded()
;             thxStop()
;
;             thxFree()
;           ENDIF
;           freefile(mod)
;         ENDIF
;       ENDPROC
;
;       Here is the same example, but using the shared thxplay.library.
;       Note that Amiga E forces library functions to have capitalised
;       names, and that we must use OpenLibrary() and CloseLibrary().
;
;       MODULE 'thxplay', 'tools/file'
;       PROC main()
;         DEF mod
;         IF thxplaybase := OpenLibrary('thxplay.library', 5)
;           IF mod := loadfile(arg, 0, MEMF_PUBLIC)
;             IF ThxInit(mod) = 0
;               ThxPlay()
;               REPEAT; WaitTOF(); UNTIL CtrlC() OR ThxSongEnded()
;               ThxStop()
;
;               ThxFree()
;             ENDIF
;             freefile(mod)
;           ENDIF
;           CloseLibrary(thxplaybase)
;         ENDIF
;       ENDPROC
;
;
;****************************************************************************
;
;
	incdir	include:
	include	exec/execbase.i
	include	exec/initializers.i
	include	exec/libraries.i
	include	exec/lists.i
	include	exec/memory.i
	include	exec/nodes.i
	include	exec/resident.i
	include	exec/semaphores.i
	include	exec/types.i
	include	hardware/intbits.i
	include	lvo/exec_lib.i

	incdir	""
	ifd	_LIBRARY_
	include	thxplay.library_rev.i
	include	library.asm
	endc

	include	misc.asm
	include	note.asm
	include	multisong.asm
	include	volume.asm
	include	song.asm
	include	init.asm
	include	interrupt.asm

	include	bin/thx-offsets.i
	ifd	_USE020_
THX	incbin	bin/thx-replayer020.bin
	else
THX	incbin	bin/thx-replayer000.bin
	endc
