[Sc-devel] SendFloatArray from Server to Lang

Click Nilson clicksonnil at gmail.com
Sun Nov 4 14:29:13 PST 2007


Dear all,

I'm not suggesting the below for any 3.1.1 this week, but I am  
starting discussion re: 3.2. This is something that has come up in  
exploring potential machine listening capabilities.

I've been looking into how difficult it is to add the capability to  
the server to send back an array of floats. This would be really  
useful for UGens that extract features which can then play a role in  
compositional decisions language side; ie, find the top N peaks in  
the spectrum, find N timbral features, polyphonic pitch detection,  
extract first N MFCCs etc. I'd really like to be able to send an  
arbitrary number of floats (well, up to packet size allowance) from a  
plugin as an OSC message.

I draft a solution below; I think I know how to implement this. The  
possible gotcha is that dynamically loaded plugins can't pass an  
array of floats via a pointer to the server, because the address  
space is not shared. But I'm hoping that's not actually an issue?

Any comments? Can I go ahead once 3.1.1 is settled?

Nick


Draft of additions required:

SC_Node.cpp
void Node_SendFloatArray(Node* inNode, int arrayID, int size, float*  
values)

SC_World.cpp
void FloatArrayMsg::Perform()

ft->fSendFloatArray = &Node_SendFloatArray;

SC_Prototypes.h
void Node_SendFloatArray(Node* inNode, int arrayID,  int size, float*  
values);

SC_HiddenWorld.h
struct FloatArrayMsg {
	World *mWorld;
	int32 mNodeID;
	int32 mArrayID;
	float* mValues;
	int32 size;
	
	void Perform();
};

typedef MsgFifoNoFree<FloatArrayMsg, 1024> FloatArrayFifo;

And an addition of one more step to:
SC_CoreAudio.cpp
SC_AudioDriver::RunThread()
Shouldn't impact performance in any substantial way.



  


More information about the Sc-devel mailing list