Compagnie Gaspard Buma
enfr

News

Workshop lubyk

Workshop interne avec l’équipe de l’EPFL-ECAL-lab pour évaluer lubyk. Si tout va bien, on aura quelques démos à mettre en ligne…

Prochain spectacle

Nous travaillons actuellement sur le spectacle des bateaux pour nulle part prévu pour janvier 2013.

Moving to C++

After an “easy” implementation in Ruby that was too erratic, a messy implementation in “C” that was hard to customize, we are moving to a sophisticated and fast “C++” implementation.

I have finally implemented something that seems to work and is easy to customize. You just write the code that makes sense and not huge wrappers.

For me, a “metro” class should be as simple as :

class Metro : public Node
{
public:
  bool init(Params& p)
  {
    mSpeed = p.get("speed", 0.5); // 120bmp default
    make_inlet<Metro,&Metro::set_tempo>("set tempo");
    make_outlet<Metro,&Metro::tic>("send a tic");
    return true;
  }

  void set_tempo(float value)
  { if (value) mSpeed = 1.0/value; }

  float tic()
  {
    bang_me_at(gLogicalTime + mSpeed);
    return BANG;
  }
private:
  float mSpeed;
}

extern 'C' { // each object is a bundle (dynamic library)
void init()
{
  Node::declare<Metro>("metro");
}
}

This might not look very simple to you, but it is really not verbose. The only complicated parts are related to how we have to declare the inlets and outlets.

  • If you want to play with the code, it’s here : c++ rubyk
  • If you just want to browse it, here’s the trac browser

We can now start to implement the network (many nodes working together). I feel like the most difficult part is done though, since all the complicated details to connect two nodes that know nothing of each other is done.