TABLE OF CONTENTS

ahxplay.library/AHX_DecodeFrame
ahxplay.library/AHX_GetAttr
ahxplay.library/AHX_InitSubsong
ahxplay.library/AHX_LoadTagList
ahxplay.library/AHX_Seek
ahxplay.library/AHX_SetAttrsA
ahxplay.library/AHX_Test
ahxplay.library/AHX_Unload

ahxplay.library/AHX_DecodeFrame

NAME
        AHX_DecodeFrame -- Decode one frame of a tune.

SYNOPSIS
        Length = AHX_DecodeFrame( AHX, Buffer1, Buffer2, BufferModulo, BitsPerSample )

        ULONG AHX_DecoceFrame( APTR, BYTE *, BYTE *, LONG, LONG );

FUNCTION
        Decodes one frame from a tune to sample buffers. Sample buffers
        must be able to store at least Frequency/50 samples each.
        BufferModulo specifies an offset (in bytes) for a next sample.

        When decoding in mono both Buffer1 and Buffer2 can be same.

INPUTS
        AHX - pointer to an AHX handle
        Buffer1 - pointer to the first sample buffer
        Buffer2 - pointer to the second sample buffer
        BufferModulo - offset to the next sample
        BitsPerSample - choose 16 for now

RESULT
        Length - Number of decoded samples per channel

EXAMPLE
        /* Decode one frame of 16bit stereo data */
        BYTE buffer[48000/50*sizeof(WORD)*2];

        AHX_SetAttrs(AHX, AHXPLAY_Frequency, 48000, TAG_DONE);
        AHX_Decode(AHX, &buffer, &buffer + sizeof(WORD), 4, 16);

        /* Decode one frame of 16bit mono data */
        BYTE buffer[48000/50*sizeof(WORD)];

        AHX_SetAttrs(AHX, AHXPLAY_Frequency, 48000, AHXPLAY_ForceMono, TRUE, TAG_DONE);
        AHX_Decode(AHX, &buffer, &buffer, 2, 16);


ahxplay.library/AHX_GetAttr

NAME
        AHX_GetAttr -- Inquire AHX tune information

SYNOPSIS
        success = AHX_GetAttr( AttrID, AHX, StoragePtr )

        ULONG AHX_GetAttr( ULONG, APTR, ULONG * );

FUNCTION
        Inquires AHX tune information.

INPUTS
        AttrID - an attribute to get.
        AHX - pointer to an AHX handle
        StoragePtr - the address of the storage variable

RESULT
        success - returns 0 if the attribute was not supported, non-zero
            if StoragePtr contains meaningful data.

SEE ALSO
        AHX_LoadTagList(), AHX_SetAttrsA()


ahxplay.library/AHX_InitSubsong

NAME
        AHX_InitSubsong -- Initialize chosen subsong.

SYNOPSIS
        success = AHX_InitSubsong( AHX, SongNumber )

        ULONG AHX_InitSubsong( APTR, ULONG );

FUNCTION
        Initializes chosen subsong and moves decoding to start from this
        subsong. If subsong number doesn't exist this function does
        nothing.

INPUTS
        AHX - pointer to an AHX handle
        SongNumber - number of new song. Choose 0 for the default song.

RESULT
        success - non-zero for success and 0 if song didn't exist.


ahxplay.library/AHX_LoadTagList

NAME
        AHX_LoadTagList -- Initialize an AHX tune.
        AHX_LoadTags -- Varargs stub for AHX_LoadTagList.

SYNOPSIS
        AHX = AHX_LoadTagList( Tune, Length, TagItems )

        APTR AHX_LoadTagList( APTR, ULONG, CONST struct TagItem * );

        AHX = AHX_LoadTags( Tune, Length, Tag1, ... )

        APTR AHX_LoadTags( APTR, ULONG, ULONG, ... );

FUNCTION
        Initialize an AHX tune for decoding and returns an AHX handler
        for future references.

INPUTS
        Tune - pointer to start of complete AHX song data
        Length - size of tune in bytes
        TagList - pointer to an array of TagItem structurres, terminated
            by the value TAG_END. See AHX_SetAttrsA() for tag values.

RESULT
        AHX - a handle for future references or NULL if an error occurred

NOTES
        This function calls AHX_InitSubsong(ahx, 0) before returning. Thus
        you can start decoding immediately.

SEE ALSO
        AHX_Unload(), AHX_SetAttrsA(), AHX_GetAttr(), AHX_InitSubsong()


ahxplay.library/AHX_Seek

NAME
        AHX_Seek -- Change decoding position.

SYNOPSIS
        newposition = AHX_Seek( AHX, Position )

        ULONG AHX_Seek( APTR, ULONG );

FUNCTION
        Changes decoding position in the current subsong to start from
        position specified in seconds. Position is always relative to
        the start of current song and there is no upper limit for the
        position.

INPUTS
        AHX - pointer to an AHX handle.
        Position - new position (granularity is in seconds)

RESULT
        newposition - new decoding position in seconds


ahxplay.library/AHX_SetAttrsA

NAME
        AHX_SetAttrsA -- Specify attribute values for an AHX tune.
        AHX_SetAttrs -- Varargs stub for AHX_SetAttrsA().

SYNOPSIS
        AHX_SetAttrsA( AHX, TagList )

        VOID AHX_SetAttrsA( APTR, CONST struct TagItem * );

        AHX_SetAttrs( AHX, Tag1, ... )

        VOID AHX_SetAttrs( APTR, ULONG, ... );

FUNCTION
        Set playback attributes for an AHX tune.

INPUTS
        AHX - pointer to an AHX handle
        TagList - pointer to an array of TagItem structurres, terminated
            by the value TAG_END. Valid tags are:

        AHXPLAY_Frequency (defaults to 44100)
            Set decoding frequency.

        AHXPLAY_ForceMono (defaults to FALSE)
            Force mono decoding. When set both channels contain same
            sample data.

RESULT

SEE ALSO
        AHX_LoadTagList(), AHX_GetAttr()


ahxplay.library/AHX_Test

NAME
        AHX_Test -- Test if valid AHX tune.

SYNOPSIS
        success = AHX_Test( Buffer, Length, FileSize )

        ULONG AHX_Test( UBYTE *, ULONG, ULONG );

FUNCTION
        Test if the buffer contains valid AHX information. If the tune
        information is valid non-zero result code is returned. You must
        provide at least 64 first bytes of an AHX tune for analysis.

INPUTS
        Buffer - pointer to the AHX header snapshot.
        Length - length of the AHX header snapshot.
        FileSize - length of the AHX tune in total.

RESULT
        success  - non-zero if valid AHX header


ahxplay.library/AHX_Unload

NAME
        AHX_Unload -- Unload the AHX tune from memory

SYNOPSIS
        AHX_Unload( AHX )

        VOID AHX_Unload( APTR );

FUNCTION
        Unloads the AHX tune and frees associated memory.

        It is safe to pass a NULL instead of a handle.

INPUTS
        AHX - pointer to an AHX handle

RESULT