Skip to content

Commit

Permalink
Merge pull request #70 from BarRaider/advanced_logic
Browse files Browse the repository at this point in the history
v2.2 - Title support for Microphone action

- Added `Title` support for Microphone action
- Added support for new Stream Deck SDK
  • Loading branch information
BarRaider authored Apr 29, 2023
2 parents 524ee8e + 86c8d70 commit 9114236
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 16 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ VoiceMeeter integration and live feedback for the Elgato Stream Deck device.

**Author's website and contact information:** [https://barraider.com](https://barraider.com)

## New in v2.2
- Added `Title` support for Microphone action

## New in v2.1
- **Advanced Queries Support** - The `Advanced Toggle` action's `Mode1 Check` now supports performing complex queries with `==` and `!=` as well as `AND/OR`.
- Example: `Strip[0].Mute AND Strip[1].Gain==7.5 AND Strip[2].device.name!="Elgato Wave"`
Expand Down
20 changes: 13 additions & 7 deletions VoiceMeeter/Actions/VMGainAdjustDialAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,30 @@ public async override void DialRotate(DialRotatePayload payload)
VMManager.Instance.SetParam(BuildDeviceName(), (float)outputVolume);
}

public async override void DialPress(DialPressPayload payload)

public async override void DialDown(DialPayload payload)
{
Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Pressed");
Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Down");
if (!VMManager.Instance.IsConnected)
{
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Dial Pressed but VM is not connected!");
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Dial Down but VM is not connected!");
await Connection.ShowAlert();
return;
}

if (payload.IsDialPressed)
dialWasRotated = false;
}

public async override void DialUp(DialPayload payload)
{
Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Up");
if (!VMManager.Instance.IsConnected)
{
Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Pressed");
dialWasRotated = false;
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Dial Up but VM is not connected!");
await Connection.ShowAlert();
return;
}

Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Released");
if (dialWasRotated)
{
return;
Expand Down
21 changes: 20 additions & 1 deletion VoiceMeeter/Actions/VMMicrophoneAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public static PluginSettings CreateDefaultSettings()
UserImage1 = String.Empty,
UserImage2 = String.Empty,
MuteHotkey = String.Empty,
UnmuteHotkey = String.Empty
UnmuteHotkey = String.Empty,
TitlePrefix = String.Empty
};

return instance;
Expand Down Expand Up @@ -75,12 +76,16 @@ public static PluginSettings CreateDefaultSettings()
[JsonProperty(PropertyName = "unmuteHotkey")]
public string UnmuteHotkey { get; set; }

[JsonProperty(PropertyName = "titlePrefix")]
public string TitlePrefix { get; set; }

}

#region Private members

private readonly PluginSettings settings;
private bool didSetNotConnected = false;
private bool didSetTitle = false;

#endregion

Expand Down Expand Up @@ -177,6 +182,20 @@ public async override void OnTick()
await Connection.SetImageAsync((String)null);
}

// Set the title
string titlePrefix = settings.TitlePrefix?.Replace(@"\n", "\n");
bool isTitleEmpty = String.IsNullOrEmpty(titlePrefix);
if (!isTitleEmpty || didSetTitle)
{
didSetTitle = true;
await Connection.SetTitleAsync(titlePrefix);

if (isTitleEmpty)
{
didSetTitle = false;
}
}

await Connection.SetImageAsync(GetBase64ImageStatus());
}

Expand Down
18 changes: 12 additions & 6 deletions VoiceMeeter/Actions/VMSettingAdjustDialAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,29 @@ public async override void DialRotate(DialRotatePayload payload)
VMManager.Instance.SetParam(BuildDeviceName(), (float)outputValue);
}

public async override void DialPress(DialPressPayload payload)
public async override void DialDown(DialPayload payload)
{
Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Down");
if (!VMManager.Instance.IsConnected)
{
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Dial Pressed but VM is not connected!");
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Dial Down but VM is not connected!");
await Connection.ShowAlert();
return;
}

if (payload.IsDialPressed)
dialWasRotated = false;
}

public async override void DialUp(DialPayload payload)
{
Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Up");
if (!VMManager.Instance.IsConnected)
{
Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Pressed");
dialWasRotated = false;
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Dial Up but VM is not connected!");
await Connection.ShowAlert();
return;
}

Logger.Instance.LogMessage(TracingLevel.INFO, $"{this.GetType()} Dial Released");
if (dialWasRotated)
{
return;
Expand Down
4 changes: 4 additions & 0 deletions VoiceMeeter/PropertyInspector/VoiceMeeter/Microphone.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<option value="7">7</option>
</select>
</div>
<div class="sdpi-item">
<div class="sdpi-item-label">Title</div>
<input class="sdpi-item-value sdProperty" placeholder="Text on key" value="" id="titlePrefix" oninput="setSettings()">
</div>
<div class="sdpi-item" id="select_single">
<div class="sdpi-item-label">Icon</div>
<select class="sdpi-item-value select sdProperty" id="imageType" oninput="setSettings()">
Expand Down
2 changes: 1 addition & 1 deletion VoiceMeeter/VoiceMeeter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<ItemGroup>
<PackageReference Include="RtMidi.Core" Version="1.0.51" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="StreamDeck-Tools" Version="5.9.1-Beta1" />
<PackageReference Include="StreamDeck-Tools" Version="6.1.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="CommandLine, Version=2.8.0.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
Expand Down
2 changes: 1 addition & 1 deletion VoiceMeeter/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"Name": "VoiceMeeter Integration",
"Icon": "Images/pluginIcon",
"URL": "https://BarRaider.com/",
"Version": "2.1",
"Version": "2.2",
"CodePath": "com.barraider.voicemeeter.exe",
"Category": "VoiceMeeter [BarRaider]",
"CategoryIcon": "Images/categoryIcon",
Expand Down

0 comments on commit 9114236

Please sign in to comment.