U64Dev.h 2.43 KB

#ifndef _AE_U64Dev_h
#define _AE_U64Dev_h

#include "Assets.h"
#include "GioMgr.h"
#include "AudioApp.h"


#define  DEF_BANK_PER_BANKFILE  16
#define  DEF_INST_PER_BANK      128
#define  DEF_SND_PER_INST       32
#define  DEF_BOOK_SIZE          128

typedef struct {
    int     dataType;
    u8      *startAddr;
    u8      *endAddr;
    AEAsset *refAsset;
    int     maxArray;
    
} U64Block;

typedef struct 
{
    u8     *romStart;
    int    size;
} smplBlock;


class U64Device
{
  protected:
    List     *usedBlocks;
    List     *freeBlocks;

    List     *usedSmpl;
    List     *freeSmpl;

    int      u64State;

    u8       *codeEnd;

    u8       *bmemStart;
    u8       *bmemEnd;
    u8       *bmemCur;

    u8       *smemStart;
    u8       *smemEnd;
    u8       *smemCur;

    GioMgr   *theGioMgr;

    
    void _AssembleBook(AEBook *book, ALADPCMBook *buf);
    void _AssembleLoop(AELoop *loop, ALADPCMloop *buf);
    void _AssembleWavet(AEWavet *wavet, ALWaveTable *buf);
    void _AssembleEnvlp(AEEnvlp *envlp, ALEnvelope *buf);
    void _AssembleKeymap(AEKeymap *keymap, ALKeyMap *buf);
    void _AssembleSound(AESound *sound, ALSound *buf);
    void _AssembleInst(AEInst *inst, ALInstrument *buf);
    void _AssembleBank(AEBank *bank, ALBank *buf);
    void _AssembleBankFile(AEBankFile *bankfile, ALBankFile *buf);
    
    
  public:
    U64Device();
    ~U64Device();

// Init and create items should report success or failure
    int     InitDevice(AudioConfig *audCnfg);
    int     StartDevice(AEBankFile *bankf, int bankNum);
    int     SendMidiBlock(CommPckt *cp);

    int     UpdateSmplMem(int flags);
    int     UpdateAssets(int flags);

    int     AllocSmplMem(AEWavet *wavet, int len);
    void    DeallocSmplMem(AEWavet *wavet);
    int     AllocHdwr(AEAsset* refAsset, int assetClass);
    void    DeallocHdwr(AEAsset* refAsset);

    void    UpdateBook(AEBook *book);
    void    UpdateLoop(AELoop *loop);
    void    UpdateWavet(AEWavet *wavet);
    void    UpdateKeymap(AEKeymap *keymap);
    void    UpdateEnvlp(AEEnvlp *envlp);
    void    UpdateSound(AESound *sound);
    void    UpdateInst(AEInst *inst);
    void    UpdateBank(AEBank *bank);
    void    UpdateBankList(AEBankFile *bankF);
    
    void    UpdateInstVol(AEInst *inst);
    void    UpdateInstPan(AEInst *inst);
    void    UpdateInstPriority(AEInst *inst);
    void    UpdateInstBendRange(AEInst *inst);
    void    UpdateFXParam(int paramID, int paramVal);
};



#endif