Giter Site home page Giter Site logo

trextern's Introduction

TRextern

A tiny framework for building max and pure data externals in a single project.

Instructions

Run generate.py to create new projects, e.g. python generate.py Name -o Output/Dir. The single *.cpp file in the resulting directory is your external base class. Signal [~] objects should be named NAME_tilde.

Example output

class hello_world : public TRextern {
public:
  void  setup( int argc, t_atom *argv ) override;
  void  exit() override;
  
  void  bangReceived  ( InletRef inlet ) override;
  void  floatReceived ( InletRef inlet, t_sample value ) override;
  void  symbolReceived( InletRef inlet, t_symbol* symbol ) override;
};

//------------------------------------------------------------------------------
void hello_world::setup( int argc, t_atom *argv ) {
  switch( argc ){
    default:
    case 3:
      post("Arg 3: %f", atom_getfloat(argv+2));
    case 2:
      post("Arg 2: %f", atom_getfloat(argv+1));
    case 1:
      post("Arg 1: %f", atom_getfloat(argv));
      break;
    case 0:
      break;
  }
  
  // Set up all inlets and outlets here
  addInletBang("Bang Inlet");
  addInletFloat("Float Inlet");
  
  std::cout << "Hello World" << std::endl;
}

//------------------------------------------------------------------------------
void hello_world::exit() {
  // Free any resources
}

//------------------------------------------------------------------------------
void hello_world::bangReceived( InletRef inlet ) {
  post("Bang received from: %s", inlet->getId().c_str());
}

//------------------------------------------------------------------------------
void hello_world::floatReceived( InletRef inlet, t_sample value ) {
  post("Float %f received from: %s", value, inlet->getId().c_str());
}

//------------------------------------------------------------------------------
void hello_world::symbolReceived( InletRef inlet, t_symbol* symbol ) {
  post("Symbol %s received from %s", symbol->s_name, inlet->getId().c_str());
}

TODO

Windows support. Tested on MacOS (Pd/Max) and Linux (Pd).

trextern's People

Contributors

ragnaringi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.