next up previous contents
Next: Setting things up Up: Using ox_wrappers Previous: Overview

class OX_Machine

ox_wrappers.h declares a base class called OX_Machine, from which you'll derive a new class that implements your machine. Here is its definition:

class OX_Machine {
 public: 
  OX_Machine(machine* m) {};        
  ~OX_Machine() {};
  static int initialize(machine_type* t) {};   
  static void describe(char* dest, int which, param value) {}; 
  void update(int track, int which, param value) {};           
  int work(int block_size) {}; 
  void track(int change) {};

  machine* m; 
  samp *lin, *rin, *lout, *rout; 
};

It's not hard to see that the member functions are just like the ox_* callbacks, but with the ``machine*'' pointer removed from the argument lists.2.1 ox_create and ox_destroy are now the constructor2.2 and destructor, respectively.

The frequently-accessed i/o buffer pointers rin, lin, lout, rout are members of the class, so they can be accessed in member functions without any explicit dereferencing.

Instead of state objects, you can simply add data members to your derived class.



David O'Toole
2000-07-19