Ejemplo n.º 1
0
void InitOSCAddrSpace(SynthState *v1, SynthState *v2) {
    Boolean result;
    OSCcontainer OSCTopLevelContainer, sine1, sine2;
    struct OSCAddressSpaceMemoryTuner t;
    struct OSCContainerQueryResponseInfoStruct cqinfo;
    struct OSCMethodQueryResponseInfoStruct QueryResponseInfo;

    /* Address space */

    t.initNumContainers = 20;
    t.initNumMethods = 20;
    t.InitTimeMemoryAllocator = MyInitTimeMalloc;
    t.RealTimeMemoryAllocator = MyRealTimeMalloc;

    OSCTopLevelContainer = OSCInitAddressSpace(&t);

    OSCInitContainerQueryResponseInfo(&cqinfo);
    sine1 = OSCNewContainer("sine1", OSCTopLevelContainer, &cqinfo);
    sine2 = OSCNewContainer("sine2", OSCTopLevelContainer, &cqinfo);

    OSCInitMethodQueryResponseInfo(&QueryResponseInfo);
    OSCNewMethod("f", sine1, FreqMethod, v1, &QueryResponseInfo);
    OSCNewMethod("f", sine2, FreqMethod, v2, &QueryResponseInfo);
    OSCNewMethod("a", sine1, GainMethod, v1, &QueryResponseInfo);
    OSCNewMethod("a", sine2, GainMethod, v2, &QueryResponseInfo);
    OSCNewMethod("g", sine1, GainMethod, v1, &QueryResponseInfo);
    OSCNewMethod("g", sine2, GainMethod, v2, &QueryResponseInfo);
    OSCNewMethod("quit", OSCTopLevelContainer, QuitMethod, 0, &QueryResponseInfo);
    OSCNewMethod("echo", OSCTopLevelContainer, EchoMethod, 0, &QueryResponseInfo);
    OSCNewMethod("scale", OSCTopLevelContainer, ScaleMethod, 0, &QueryResponseInfo);
    OSCNewMethod("allmystrings", OSCTopLevelContainer, AllMyStringsMethod, 0, &QueryResponseInfo);
}
Ejemplo n.º 2
0
void main() {
    Boolean result;
    struct OSCAddressSpaceMemoryTuner t;
    struct OSCReceiveMemoryTuner rt;

    t.initNumContainers = 20;
    t.initNumMethods = 20;
    t.InitTimeMemoryAllocator = MyInitTimeMalloc;
    t.RealTimeMemoryAllocator = MyRealTimeMalloc;

    OSCTopLevelContainer = OSCInitAddressSpace(&t);


    rt.InitTimeMemoryAllocator = MyInitTimeMalloc;
    rt.RealTimeMemoryAllocator = MyRealTimeMalloc;
    rt.receiveBufferSize = 1000;
    rt.numReceiveBuffers = 10;
    rt.numQueuedObjects = 50;
    rt.numCallbackListNodes = 100;

    result = OSCInitReceive(&rt);

    if (result == FALSE) {
	printf("OSCInitReceive returned FALSE!\n");
	return;
    }

    SetUpAddrSpace();

    TestEmptyCase();

    PretendToGetPacket();

    printf("Test completed successfully!\n");
}