2016-12-04 8 views
0

처리 중에 OSC (열린 사운드 컨트롤)로 척 (chunk)에 신호를 보내려면 "Play Amazing Notes"버튼을 만들었지 만 처리 스크립트를 실행하면 이러한 오류 메시지가 표시됩니다 .Chuck과 OSC의 통합 처리

import controlP5.*; 
import oscP5.*; 
import netP5.*; 

OscP5 oscP5; 
NetAddress dest; 
ControlP5 cp5; 

void setup(){ 

    size(200,210,P3D); 
    background(0); 

    createControls(); 

    //setUp Osc sending 
    oscP5 = new OscP5(this,12000); 
    dest = new NetAddress("127.0.0.1",6449); 

} 

void draw(){ 
    background(0); 
    smooth(); 
} 

void createControls(){ 
    cp5 = new ControlP5(this); 

    cp5.addButton("playNote") 
     .setValue(0) 
     .setCaptionLabel("Play Amazing Notes") 
     .setPosition(10,10) 
     .setSize(180,50); 

} 

void playNote(){ 
    println("play Note"); 
    OscMessage msg=new OscMessage("/playNote"); 
    oscP5.send(msg,dest); 
} 

을 그리고 척 코드는 다음과 같습니다 :


ControlP5 2.2.6 infos, comments, questions at http://www.sojamo.de/libraries/controlP5 
play Note 
Dec 04, 2016 11:47:23 PM controlP5.ControlBroadcaster printMethodError 
SEVERE: An error occured while forwarding a Controller event, please check your code at playNote 
java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at controlP5.ControlBroadcaster.invokeMethod(Unknown Source) 
    at controlP5.ControlBroadcaster.callTarget(Unknown Source) 
    at controlP5.ControlBroadcaster.broadcast(Unknown Source) 
    at controlP5.Controller.broadcast(Unknown Source) 
    at controlP5.Button.setValue(Unknown Source) 
    at Kandeze_SendOscMessage.createControls(Kandeze_SendOscMessage.java:51) 
    at Kandeze_SendOscMessage.setup(Kandeze_SendOscMessage.java:34) 
    at processing.core.PApplet.handleDraw(PApplet.java:2387) 
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:871) 
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692) 
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674) 
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443) 
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) 
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) 
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759) 
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81) 
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452) 
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178) 
    at java.util.TimerThread.mainLoop(Timer.java:555) 
    at java.util.TimerThread.run(Timer.java:505) 
Caused by: java.lang.NullPointerException 
    at Kandeze_SendOscMessage.playNote(Kandeze_SendOscMessage.java:61) 
    ... 24 more 
OscP5 0.9.8 infos, comments, questions at http://www.sojamo.de/oscP5 


### [2016/12/4 23:47:23] PROCESS @ OscP5 stopped. 
### [2016/12/4 23:47:23] PROCESS @ UdpClient.openSocket udp socket initialized. 
### [2016/12/4 23:47:24] ERROR @ UdpServer.start() IOException, couldnt create new DatagramSocket @ port 12000 java.net.BindException: Address already in use: Cannot bind 
### [2016/12/4 23:47:24] INFO @ OscP5 is running. you (192.168.0.103) are listening @ port 12000 

내 처리 코드는 다음과 같습니다

Mandolin m=> dac; 

OscIn oin; 
OscMsg msg; 
6448 => oin.port; 

"/playNote" => oin.addAddress; 

while(true){ 

    oin => now; 
    while (oin.recv(msg)) 

    { 
     msg.address @=> string address; 
     if(msg.address=="/playNote") 
     { 
      Math.random2f(48,70) => float note; 

      note => Std.mtof => m.freq; 

      } 

     } 

    } 

답변

0

당신은 전에 OscP5 및 NetAddress를 초기화해야 기음 컨트롤을 reating.

void setup(){ 

    size(200,210,P3D); 
    background(0); 

    //setUp Osc sending 
    oscP5 = new OscP5(this,12000); 
    dest = new NetAddress("127.0.0.1",6448); 

    //create controlls after the OSC setup 
    createControls(); 

} 

다음 오류가 도망 간다 - Btw는

합니다 (CP5 버튼 이벤트 핸들러는 oscP5 객체를 알고있다). 처리 코드 (6449)와 척 코드 (6448)에서 다른 포트를 사용하고 있습니다.

분명히 작동 시키려면 동일해야합니다.

1.0 => m.noteOn;

:

실제로는 noteOn 호출을 필요로하는 척 코드에서 재생 만돌린을 들으려면