Skip to content

Commit

Permalink
OSC also emit unsynced variables
Browse files Browse the repository at this point in the history
Co-Authored-By: jellejurre <jelle@jilles.com>
  • Loading branch information
lyuma and jellejurre committed Sep 25, 2024
1 parent 462a998 commit 6a7806c
Showing 1 changed file with 15 additions and 30 deletions.
45 changes: 15 additions & 30 deletions Runtime/Scripts/LyumaAv3Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3115,31 +3115,25 @@ public void GetOSCDataInto(List<A3ESimpleOSC.OSCMessage> messages) {
DataToShoveIntoOSCAnyway.Clear();
if (OSCConfigurationFile.SendRecvAllParamsNotInJSON) {
foreach (var b in Bools) {
if (b.synced) {
messages.Add(new A3ESimpleOSC.OSCMessage {
arguments = new object[1] {(object)(int)((bool)b.value ? 1 : 0)},
path = "/avatar/parameters/" + b.name,
time = new Vector2Int(-1,-1),
});
}
messages.Add(new A3ESimpleOSC.OSCMessage {
arguments = new object[1] {(object)(int)((bool)b.value ? 1 : 0)},
path = "/avatar/parameters/" + b.name,
time = new Vector2Int(-1,-1),
});
}
foreach (var i in Ints) {
if (i.synced) {
messages.Add(new A3ESimpleOSC.OSCMessage {
arguments = new object[1] {(object)(int)i.value},
path = "/avatar/parameters/" + i.name,
time = new Vector2Int(-1,-1),
});
}
messages.Add(new A3ESimpleOSC.OSCMessage {
arguments = new object[1] {(object)(int)i.value},
path = "/avatar/parameters/" + i.name,
time = new Vector2Int(-1,-1),
});
}
foreach (var f in Floats) {
if (f.synced) {
messages.Add(new A3ESimpleOSC.OSCMessage {
arguments = new object[1] {(object)(float)f.value},
path = "/avatar/parameters/" + f.name,
time = new Vector2Int(-1,-1),
});
}
messages.Add(new A3ESimpleOSC.OSCMessage {
arguments = new object[1] {(object)(float)f.value},
path = "/avatar/parameters/" + f.name,
time = new Vector2Int(-1,-1),
});
}
} else {
foreach (var prop in OSCConfigurationFile.OSCJsonConfig.parameters) {
Expand All @@ -3148,21 +3142,12 @@ public void GetOSCDataInto(List<A3ESimpleOSC.OSCMessage> messages) {
float outputf = 0.0f;
string typ = "?";
if (BoolToIndex.TryGetValue(prop.name, out var bidx)) {
if (!Bools[bidx].synced) {
continue;
}
outputf = Bools[bidx].value ? 1.0f : 0.0f;
typ = "bool";
} else if (IntToIndex.TryGetValue(prop.name, out var iidx)) {
if (!Ints[iidx].synced) {
continue;
}
outputf = (float)Ints[iidx].value;
typ = "int";
} else if (FloatToIndex.TryGetValue(prop.name, out var fidx)) {
if (!Floats[fidx].synced) {
continue;
}
outputf = Floats[fidx].value;
typ = "float";
} else {
Expand Down

0 comments on commit 6a7806c

Please sign in to comment.