[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] commands



I have added code that allows two new ways to name commands to the server.

You do not have to put a preceeding slash "/" on command names. "/s_new" or "s_new" will both be understood by the server. Not using a slash is not legal Open Sound Control however, so such messages should only be destined for scsynth. This is a convenience feature, and has no real performance benefit.

All commands now have an integer equivalent. These command numbers are listed at the end of the Server-Command-Reference.rtf file. Integer commands can be obtained with an array access instead of a hash table lookup. This makes it a little faster and might a good choice if message bandwidth is high. It also might be a more convenient way for a simple C program to talk to the server. Integer commands are not legal Open Sound Control either.

All of these are now legal:

s.sendMsg("/s_new", "pink", 2002, 1, 0); // as usual
s.sendMsg("/n_free", 2002);

s.sendMsg("s_new", "pink", 2002, 1, 0); // no forward slash
s.sendMsg("n_free", 2002);

s.sendMsg('s_new', "pink", 2002, 1, 0); // no forward slash. using a 'symbol' instead of a String
s.sendMsg('n_free', 2002);

s.sendMsg(\s_new, \pink, 2002, 1, 0); // no forward slash. using a \symbol instead of a String
s.sendMsg(\n_free, 2002);

s.sendMsg(9, \pink, 2002, 1, 0); // using command numbers
s.sendMsg(11, 2002);



Command numbers are reproduced below :

enum {
	cmd_none = 0,

	cmd_notify = 1,
	cmd_status = 2,
	cmd_quit = 3,
	cmd_cmd = 4,

	cmd_d_recv = 5,
	cmd_d_load = 6,
	cmd_d_loadDir = 7,
	cmd_d_freeAll = 8,

	cmd_s_new = 9,
	cmd_s_trace = 10,

	cmd_n_free = 11,
	cmd_n_run = 12,
	cmd_n_cmd = 13,
	cmd_n_map = 14,
	cmd_n_set = 15,
	cmd_n_setn = 16,
	cmd_n_fill = 17,
	cmd_n_before = 18,
	cmd_n_after = 19,

	cmd_u_cmd = 20,

	cmd_g_new = 21,
	cmd_g_head = 22,
	cmd_g_tail = 23,
	cmd_g_freeAll = 24,
	
	cmd_c_set = 25,
	cmd_c_setn = 26,
	cmd_c_fill = 27,

	cmd_b_alloc = 28,
	cmd_b_allocRead = 29,
	cmd_b_read = 30,
	cmd_b_write = 31,
	cmd_b_free = 32,
	cmd_b_close = 33,
	cmd_b_zero = 34,
	cmd_b_set = 35,
	cmd_b_setn = 36,
	cmd_b_fill = 37,
	cmd_b_gen = 38,
	
	NUMBER_OF_COMMANDS = 39
};


--
--- james mccartney   james@xxxxxxxxxxxxxx   <http://www.audiosynth.com>
SuperCollider - a real time synthesis programming language for the PowerMac.
<ftp://www.audiosynth.com/pub/updates/SC2.2.16.sea.hqx>