Skip to content

Commit a597912

Browse files
committed
fix: AudioMonitorType
1 parent 0031592 commit a597912

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

src/main/java/net/twasi/obsremotejava/OBSCommunicator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ public void getAudioMonitorType(String sourceName, Callback callback) {
771771
callbacks.put(GetAudioMonitorTypeResponse.class, callback);
772772
}
773773

774-
public void setAudioMonitorType(String sourceName, String monitorType, Callback callback) {
774+
public void setAudioMonitorType(String sourceName, GetAudioMonitorTypeResponse.MonitorType monitorType, Callback callback) {
775775
SetAudioMonitorTypeRequest request = new SetAudioMonitorTypeRequest(this, sourceName, monitorType);
776776

777777
session.getRemote().sendStringByFuture(this.gson.toJson(request));

src/main/java/net/twasi/obsremotejava/OBSRemoteController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import net.twasi.obsremotejava.callbacks.*;
44
import net.twasi.obsremotejava.events.responses.*;
55
import net.twasi.obsremotejava.objects.throwables.OBSResponseError;
6+
import net.twasi.obsremotejava.requests.GetAudioMonitorType.GetAudioMonitorTypeResponse;
67
import net.twasi.obsremotejava.requests.GetCurrentProfile.GetCurrentProfileResponse;
78
import net.twasi.obsremotejava.requests.GetCurrentScene.GetCurrentSceneResponse;
89
import net.twasi.obsremotejava.requests.GetPreviewScene.GetPreviewSceneResponse;
@@ -413,7 +414,7 @@ public void getAudioMonitorType(String sourceName, Callback callback) {
413414
communicator.getAudioMonitorType(sourceName, callback);
414415
}
415416

416-
public void setAudioMonitorType(String sourceName, String monitorType, Callback callback) {
417+
public void setAudioMonitorType(String sourceName, GetAudioMonitorTypeResponse.MonitorType monitorType, Callback callback) {
417418
communicator.setAudioMonitorType(sourceName, monitorType, callback);
418419
}
419420

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
package net.twasi.obsremotejava.requests.GetAudioMonitorType;
22

3+
import com.google.gson.annotations.SerializedName;
34
import net.twasi.obsremotejava.requests.ResponseBase;
45

56
public class GetAudioMonitorTypeResponse extends ResponseBase {
6-
public static final String MONITOR_TYPE_NONE = "none";
7-
public static final String MONITOR_TYPE_MONITOR_ONLY = "monitorOnly";
8-
public static final String MONITOR_TYPE_MONITOR_AND_OUTPUT = "monitorAndOutput";
7+
public enum MonitorType {
8+
@SerializedName("none")
9+
NONE,
10+
@SerializedName("monitorOnly")
11+
MONITOR_ONLY,
12+
@SerializedName("monitorAndOutput")
13+
MONITOR_AND_OUTPUT
14+
}
915

10-
private String monitorType;
16+
private MonitorType monitorType;
1117

12-
public String getMonitorType() {
18+
public MonitorType getMonitorType() {
1319
return this.monitorType;
1420
}
1521
}

src/main/java/net/twasi/obsremotejava/requests/SetAudioMonitorType/SetAudioMonitorTypeRequest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
import net.twasi.obsremotejava.OBSCommunicator;
44
import net.twasi.obsremotejava.requests.BaseRequest;
5+
import net.twasi.obsremotejava.requests.GetAudioMonitorType.GetAudioMonitorTypeResponse;
56
import net.twasi.obsremotejava.requests.RequestType;
67

78
public class SetAudioMonitorTypeRequest extends BaseRequest {
89
private String sourceName;
9-
private String monitorType;
10+
private GetAudioMonitorTypeResponse.MonitorType monitorType;
1011

11-
public SetAudioMonitorTypeRequest(OBSCommunicator com, String sourceName, String monitorType) {
12+
public SetAudioMonitorTypeRequest(OBSCommunicator com, String sourceName, GetAudioMonitorTypeResponse.MonitorType monitorType) {
1213
super(RequestType.SetAudioMonitorType);
1314

1415
this.monitorType = monitorType;

0 commit comments

Comments
 (0)