On Fri, 23 Oct 1998, Jones, Mark (UK12) wrote:

> On Fri, 31 Jan 97 09:19:04 GMT 
> P J Leonard  wrote....
> 
> >I use the excellent AWETOY program which allows you to load sf2 and
> >sbk banks. It runs under win3.1 or win95. It also acts as a virtual
> >bank manger. If you also get a software midi cable it allows you to
> >tweak the AWE32 effects in real time via the mouse or your midi
> >keyboard. Hopefully, we will be able to implement an linux clone of
> >this program.
> 
> I would be interested in contributing to such a project, cos I , too, find
> AweToy to be indispensible
> Has anyone done any owrk on this, or contacted Geo Pertea (sp?) ????


 I am implementing it now :-) It will be part of my cantor
(cakewalk/cubase clone) program. I am using Qt for the GUI 
stuff but there will be an AwePatchManager class that could
be reused. The main problem is working out what is memory.
Since I think this is impossible I am starting with a clean slate
and wrapping up awelib with something that remembers what I have loaded.
Also unloading arbitary patches does not seem to be possible so I
will use a lazy scheme that waits untill the DRAM is exausted then
reloads all the active patches. Suggestions welcome 



 cheers paul.


#ifndef _AwePatchManager_H
#define _AwePatchManager_H

class AwePatch
{

  // Only allow AwePatchManager to mess with me.
  friend class AwePatchManager;

private:

  AwePatch( const char * file,
            int srcBank,
            int srcPreset,
            int dstBank,
            int dstPreset,
            const char *name);

  ~AwePatch();

public:

  const char * file() { return _file; }
  int srcBank()       { return _srcBank; }
  int srcPreset()     { return _srcPreset; }
  int dstBank()       { return _dstBank; }
  int dstPreset()     { return _dstPreset; }

  // TODO
  int srcKeynote()        { return -1; }
  int dstKeynote()        { return -1; }

  const char *name() const { return _name; }

  const AwePatch *  next() const;


private:

  char * _file;
  int _srcBank;
  int _srcPreset;
  int _dstBank;
  int _dstPreset;
  char *_name;
  AwePatch *  _next;
};


class AwePatchManager
{
public:

  // /dev/seq and awe device are already open etc.
  AwePatchManager(int seqfd,int awedev);
  virtual ~AwePatchManager();

  // Make sure created off the heap
  // Do not delete this the AwePatch

  const AwePatch * loadPatch( const char * file,
                              int srcBank,
                              int srcPreset,
                              int dstBank,
                              int dstPreset,
                              const char *name);

  void              releasePatch(int bank,int preset);

  const AwePatch *  patchAt(int bank,int preset) const ;

  const AwePatch *  patchList() const;
  int               dramLeft() const ;

  virtual void      errorMessage(const char *mess);
  virtual void      warnMessage(const char *mess);
  
protected:

  bool loadPatch(AwePatch *);
  bool reloadPatches();

  bool clearMemory();

  AwePatch * _patchList;
  int        _seqfd;
  int        _awedev;
};



#endif

Reply via email to