// xappmsg.h
// Author : Dominique Lorre
// $Id: xappmsg.h 1.1 1997/09/17 08:09:28 dlorre Exp dlorre $

#if !defined( CLASS_XAPPMSG_H )
#define CLASS_XAPPMSG_H

#if !defined( EXEC_TYPES_H )
#include <exec/types.h>
#endif

#if !defined( EXEC_PORTS_H )
#include <exec/ports.h>
#endif

#if !defined( UTILITY_HOOKS_H )
#include <utility/hooks.h>
#endif

#if !defined( UTILITY_TAGITEM_H )
#include <utility/tagitem.h>
#endif

#define XAPPNAMELENGTH  40
#define XAPPPORTNAME    "Euterpe.xapp"

#define XAPP_TagBase    (TAG_USER+100)
#define XAPP_Name       (XAPP_TagBase+1)
#define XAPP_PortName   (XAPP_TagBase+2)
#define XAPP_Type       (XAPP_TagBase+3)
#define XAPP_Handle     (XAPP_TagBase+4)

#define FX_TagBase      (TAG_USER+200)
#define FX_Hook         (FX_TagBase+1)

#define BANK_TagBase    (TAG_USER+300)
#define BANK_MidiBuffer (BANK_TagBase+1)
#define BANK_MidiLength (BANK_TagBase+2)

enum XAppAction {
    XAPPACT_ADD,            // Add the xapp
    XAPPACT_INIT,           // The xapp has successfully initialized it's Port
    XAPPACT_FAILURE,        // The xapp has failed somewhere in it's initialization
    XAPPACT_REMOVE,         // Remove the xapp
    XAPPACT_SHOW,           // Show the xapp window
    XAPPACT_HIDE,           // Hide the xapp window
    XAPPACT_SENDMIDI,       // Send midi to an output
    XAPPACT_RECVMIDI        // Receive midi from an input
};

enum XAppType {
    XAPPTYP_UNKWNOWN,          // Default value if not set by the xapp
    XAPPTYP_BANKEDITOR,        // Independent application using Euterpe's IO
    XAPPTYP_EFFECTSPROCESSOR   // Effect controlled by Euterpe
};

struct XAppMsg {
    struct Message  xm_Message ;
    enum XAppAction xm_Action ;
    struct TagItem* xm_Tags ;
    APTR            xm_Result ;
} ;

struct FXNode 
{
    struct MinNode      x_Node ;
    union {
        UBYTE           x_Data[4] ;
        ULONG           x_Msg ;
    };
    LONG    x_Pos ;     // Position in Sequencer
    LONG    x_Len ;     // Length of a NoteOn
};

#define FXNODEB_INUSE   0
#define FXNODEB_ALLOC   1

#define FXNODEF_INUSE   (1 << FXNODEB_INUSE)
#define FXNODEF_ALLOC   (1 << FXNODEB_ALLOC)

struct FXParams
{
    struct FXNode   *fp_Array ;
    struct MinList  *fp_List ;
    LONG            fp_Size ;
    LONG            fp_Pos ;
};

#endif