简体   繁体   English

如何使用 Java 将 OSC 发送到 QLab?

[英]How to send OSC to QLab with Java?

I am trying to send OSC (Open Sound Control) to Figure 53's QLab.我正在尝试将 OSC(打开声音控制)发送到 Figure 53 的 QLab。 So far I have come up with this code.到目前为止,我已经想出了这段代码。

import com.illposed.osc.transport.udp.OSCPortOut;

import com.illposed.osc.OSCMessage;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class controller {
    public static void main(String[] args) throws UnknownHostException, IOException {
        OSCPortOut sender = new OSCPortOut(InetAddress.getByName("10.67.192.113"), 53000);
        OSCMessage msg = new OSCMessage("/cue/1");
         try {
            sender.send(msg);
         } catch (Exception e) {
             e.printStackTrace();
         }
    }
}

I have successfully added Illposed's JavaOSC library to my code, but then it says I need SLF4J, and when I try to add slf4j-api-1.7.30.jar it says Failed to load class "org.slf4j.impl.StaticLoggerBinder".我已经成功地将 Illposed 的 JavaOSC 库添加到我的代码中,但是它说我需要 SLF4J,当我尝试添加slf4j-api-1.7.30.jar时,它说Failed to load class "org.slf4j.impl.StaticLoggerBinder". When I try to run the above code with both libraries SLF4J and JavaOSC.当我尝试使用库 SLF4J 和 JavaOSC 运行上述代码时。

You will need to use Maven to handle the dependencies JavaOSC needs.您将需要使用 Maven 来处理 JavaOSC 需要的依赖项。

Here's a good tutorial for Eclipse.这是 Eclipse 的一个很好的教程。 Just use a simple project, you do not need to do archetype selection.只需使用一个简单的项目,您无需进行原型选择。

Then add the following at the end of your new projects pom.xml file, before </project> but after everything else.然后在新项目 pom.xml 文件的末尾添加以下内容,在</project>之前但在其他所有内容之后。

`<dependency>`
    <groupId>com.illposed.osc</groupId>
    <artifactId>javaosc-core</artifactId>
    <version>0.7</version>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM