/*
 * Created by cmhg vsn 5.43 [18 Mar 2014]
 */

#ifndef __cmhg_Header_h
#define __cmhg_Header_h

#ifndef __kernel_h
#include "kernel.h"
#endif

#define CMHG_VERSION 543

#define Module_Title                     "TimPlayer"
#define Module_Help                      "TimPlayer"
#define Module_VersionString             "1.28"
#define Module_VersionNumber             128
#ifndef Module_Date
#define Module_Date                      "01 Sep 2021"
#endif


/*
 * Initialisation code
 * ===================
 *
 * Return NULL if your initialisation succeeds; otherwise return a pointer
 * to an error block. cmd_tail points to the string of arguments with which
 * the module is invoked (may be "", and is control-terminated, not zero
 * terminated).
 * podule_base is 0 unless the code has been invoked from a podule.
 * pw is the 'R12' value established by module initialisation. You may
 * assume nothing about its value (in fact it points to some RMA space
 * claimed and used by the module veneers). All you may do is pass it back
 * for your module veneers via an intermediary such as SWI OS_CallEvery
 * (use _swix() to issue the SWI call).
 */
_kernel_oserror *Module_Initialize(const char *cmd_tail, int podule_base, void *pw);


/*
 * Finalisation code
 * =================
 *
 * Return NULL if your finalisation succeeds. Otherwise return a pointer to
 * an error block if your finalisation handler does not wish to die (e.g.
 * toolbox modules return a 'Task(s) active' error).
 * fatal, podule and pw are the values of R10, R11 and R12 (respectively)
 * on entry to the finalisation code.
 */
_kernel_oserror *Module_Finalize(int fatal, int podule, void *pw);


/*
 * Service call handler
 * ====================
 *
 * Return values should be poked directly into r->r[n]; the right
 * value/register to use depends on the service number (see the relevant
 * RISC OS Programmer's Reference Manual section for details).
 * pw is the private word (the 'R12' value).
 */
void Module_Service(int service_number, _kernel_swi_regs *r, void *pw);


/*
 * SWI handler code
 * ================
 *
 * swi_offset contains the offset of the SWI into your SWI chunk.
 * r points to the registers passed to the SWI.
 *
 * Return NULL if the SWI is handled successfully; otherwise return
 * a pointer to an error block which describes the error.
 * The veneer code sets the 'V' bit if the returned value is non-NULL.
 * The special value error_BAD_SWI may be returned if you do not
 * implement a SWI; the veneer will arrange for the appropriate
 * standard internationalised error 'SWI value out of range for
 * module TimPlayer' to be returned.
 * The handler may update any of its input registers (R0-R9).
 * pw is the private word pointer ('R12') value passed into the
 * SWI handler entry veneer.
 */
#define TimPlayer_00                    0x051380
#ifndef TimPlayer_Version
#define TimPlayer_Version               0x051380
#define TimPlayer_Configure             0x051381
#define TimPlayer_SongLoad              0x051382
#define TimPlayer_SongUnload            0x051383
#define TimPlayer_SongNew               0x051384
#define TimPlayer_SongLoad2             0x051385
#define TimPlayer_SongDecompress        0x051386
#define TimPlayer_Convert               0x051387
#define TimPlayer_SongPlay              0x051388
#define TimPlayer_SongPause             0x051389
#define TimPlayer_SongStop              0x05138a
#define TimPlayer_SongPosition          0x05138b
#define TimPlayer_SongVolume            0x05138c
#define TimPlayer_SongStatus            0x05138d
#define TimPlayer_SongConfigure         0x05138e
#define TimPlayer_SongPlayRange         0x05138f
#define TimPlayer_SongInfo              0x051390
#define TimPlayer_SongTexts             0x051391
#define TimPlayer_SongInitialSettings   0x051392
#define TimPlayer_ChannelInitialSettings  0x051393
#define TimPlayer_SongPlayInfo          0x051394
#define TimPlayer_SongSectionInfo       0x051395
#define TimPlayer_Reserved16            0x051396
#define TimPlayer_Reserved17            0x051397
#define TimPlayer_PatternInfo           0x051398
#define TimPlayer_RowInfo               0x051399
#define TimPlayer_Reserved1A            0x05139a
#define TimPlayer_Reserved1B            0x05139b
#define TimPlayer_Reserved1C            0x05139c
#define TimPlayer_Reserved1D            0x05139d
#define TimPlayer_Reserved1E            0x05139e
#define TimPlayer_FXStatus              0x05139f
#define TimPlayer_SampleInfo            0x0513a0
#define TimPlayer_SampleMisc            0x0513a1
#define TimPlayer_SampleLoops           0x0513a2
#define TimPlayer_SampleVibrato         0x0513a3
#define TimPlayer_Reserved24            0x0513a4
#define TimPlayer_Reserved25            0x0513a5
#define TimPlayer_Reserved26            0x0513a6
#define TimPlayer_InstVibrato           0x0513a7
#define TimPlayer_InstInfo              0x0513a8
#define TimPlayer_InstVolume            0x0513a9
#define TimPlayer_InstPanning           0x0513aa
#define TimPlayer_InstFilter            0x0513ab
#define TimPlayer_InstVolumeEnvelope    0x0513ac
#define TimPlayer_InstPanningEnvelope   0x0513ad
#define TimPlayer_InstPitchEnvelope     0x0513ae
#define TimPlayer_InstFilterEnvelope    0x0513af
#define TimPlayer_FXRegister            0x0513b0
#define TimPlayer_FXUnregister          0x0513b1
#define TimPlayer_FXGlobalSettings      0x0513b2
#define TimPlayer_FXChannelSettings     0x0513b3
#define TimPlayer_FXNoteSettings        0x0513b4
#define TimPlayer_FXPlaySample          0x0513b5
#define TimPlayer_FXPlayInstrument      0x0513b6
#define TimPlayer_FXNoteAction          0x0513b7
#define TimPlayer_SongParams            0x0513b8
#define TimPlayer_ChannelParams         0x0513b9
#define TimPlayer_VChannelParams        0x0513ba
#define TimPlayer_ChannelStatus         0x0513bb
#define TimPlayer_FXChannelParams       0x0513bc
#define TimPlayer_FXVChannelParams      0x0513bd
#define TimPlayer_ChannelVariable       0x0513be
#define TimPlayer_MixingInfo            0x0513bf
#endif

#define error_BAD_SWI ((_kernel_oserror *) -1)

_kernel_oserror *Module_Swis(int swi_offset, _kernel_swi_regs *r, void *pw);

#endif
