int lua_pdcontext_send_message(lua_State * L) { PdSynth * self = SynthBinding<PdSynth>::checkto(L, 1); const char * name = luaL_checkstring(L, 2); switch (lua_type(L, 3)) { case LUA_TNONE: case LUA_TNIL: zg_send_message(self->pd(), name, "b"); break; case LUA_TBOOLEAN: case LUA_TNUMBER: zg_send_message(self->pd(), name, "f", (float)lua_tonumber(L, 3)); break; case LUA_TSTRING: zg_send_message(self->pd(), name, "s", lua_tostring(L, 3)); break; case LUA_TTABLE: case LUA_TFUNCTION: case LUA_TUSERDATA: case LUA_TTHREAD: case LUA_TLIGHTUSERDATA: luaL_error(L, "cannot send message of type %s", lua_typename(L, lua_type(L, 3))); break; } return 0; }
void ofxZenGarden::sendBang(string messageName) { if(!running) return; zg_send_message(context, messageName.c_str(), "b"); //PdMessage *message = graph->scheduleExternalMessage((char*)messageName.c_str()); //message->setMessage(1, BANG); }
void ofxZenGarden::sendFloat(string messageName, float value) { if(!running) return; zg_send_message(context, messageName.c_str(), "f", value); //PdMessage *message = graph->scheduleExternalMessage((char*)messageName.c_str()); //message->setMessage(1, FLOAT, value); }