Skip to content

Commit

Permalink
Rearrange PacketSender slightly.
Browse files Browse the repository at this point in the history
Doesn't seem to work yet, still investigating.
  • Loading branch information
Provismet committed Sep 30, 2023
1 parent 767efe3 commit c40b664
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions src/main/java/com/provismet/vmcmc/vmc/PacketSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.illposed.osc.OSCMessage;
Expand All @@ -15,16 +14,8 @@ public class PacketSender {

public static void initPort (int port) {
try {
portOut = new OSCPortOut(new InetSocketAddress(InetAddress.getLocalHost(), port));
}
catch (IOException e) {
ClientVMC.LOGGER.error("Failed to create port:", e);
}
}

public static void initPort () {
try {
portOut = new OSCPortOut();
portOut = new OSCPortOut(InetAddress.getLocalHost(), port);
ClientVMC.LOGGER.info("Created VMC socket at port: " + port);
}
catch (IOException e) {
ClientVMC.LOGGER.error("Failed to create port:", e);
Expand All @@ -36,16 +27,14 @@ public static boolean isValid () {
}

public static void sendBlendShape (String name, float value) {
List<Object> args = new ArrayList<>(2);
args.add(value);
args.add(name);
List<Object> args = Arrays.asList(name, value);
OSCMessage message = new OSCMessage("/VMC/Ext/Blend/Val", args);

try {
portOut.send(message);
}
catch (Exception e) {

ClientVMC.LOGGER.error("Failed to send message: ", e);
}
}

Expand Down

0 comments on commit c40b664

Please sign in to comment.