Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import dev.niels.wavelink.impl.model.WaveLinkChannel;
import dev.niels.wavelink.impl.model.WaveLinkImage;
import dev.niels.wavelink.impl.model.WaveLinkMix;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import lombok.extern.log4j.Log4j2;
Expand Down Expand Up @@ -53,6 +54,9 @@ private Optional<BufferedImage> fromChange(CommandWaveLinkChange change) {
case Channel, Mix -> {
return channelImage(change.getId1());
}
case MixMaster -> {
return mixImage(change.getId1());
}
case Output -> {
return Optional.of(outputImage());
}
Expand All @@ -66,6 +70,12 @@ private Optional<BufferedImage> channelImage(@Nullable String id) {
.map(WaveLinkImage::getImage);
}

private Optional<BufferedImage> mixImage(@Nullable String id) {
return Optional.ofNullable(waveLinkService.getMixes().get(id))
.map(WaveLinkMix::image)
.map(WaveLinkImage::getImage);
}

private BufferedImage outputImage() {
return iconService.DEVICE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public Optional<Boolean> resolve(Commands command, String target) {
var mix = channel.findMix(cmd.getId2()).orElseGet(() -> waveLink.getMixFromId(cmd.getId2()));
yield Optional.ofNullable(mix.isMuted());
}
case MixMaster -> Optional.ofNullable(waveLink.getMixFromId(cmd.getId1()).isMuted());
case Output -> {
var output = waveLink.getOutputFromId(cmd.getId1());
yield output.outputs() == null || output.outputs().isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void execute(DialActionParameters context) {
case Input -> service.setInputLevel(getId1(), value);
case Channel -> service.setChannelLevel(getId1(), value);
case Mix -> service.setChannelLevel(getId1(), getId2(), value);
case MixMaster -> service.setMixLevel(getId1(), value);
case Output -> service.setOutputLevel(getId1(), value);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void execute() {
var channel = service.getChannelFromId(getId1());
service.setChannelMute(getId1(), muteType.convert(channel.isMuted()));
}
case Mix -> {
case Mix -> { // Control the channel-mix combo.
if (StringUtils.isBlank(getId2())) {
log.warn("No mix id specified");
return;
Expand All @@ -72,6 +72,15 @@ public void execute() {
var mix = channel.findMix(getId2()).orElseGet(() -> service.getMixFromId(getId2()));
service.setChannelMute(channel, mix, muteType.convert(mix.isMuted()));
}
case MixMaster -> { // Master mix control. Different from normal mix.
if (StringUtils.isBlank(getId1())) {
log.warn("No master mix id specified");
return;
}

var mix = service.getMixFromId(getId1());
service.setMixMute(mix, muteType.convert(mix.isMuted()));
}
case Output -> {
var output = service.getOutputFromId(getId1());
if (!(output.outputs() == null || output.outputs().isEmpty())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.getpcpanel.integration.wavelink.command;

public enum WaveLinkCommandTarget {
Input, Channel, Mix, Output
Input, Channel, Mix, Output, MixMaster
}
8 changes: 8 additions & 0 deletions src/main/java/dev/niels/wavelink/IWaveLinkClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,18 @@ default void addCurrentToChannel(String channelId) {

void setChannelAudioEffect(WaveLinkChannel channel, WaveLinkEffect effect);

default void setMixLevel(String mixId, double value) {
setMixLevel(getMixFromId(mixId), value);
}

default void setMixLevel(WaveLinkMix mix, double value) {
setMix(mix, value, null);
}

default void setMixMute(String mixId, boolean mute) {
setMixMute(getMixFromId(mixId), mute);
}

default void setMixMute(WaveLinkMix mix, boolean mute) {
setMix(mix, null, mute);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/webui/src/app/features/commands/command-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const FIELD_DEFS: FieldDef_[] = [
{
kind: 'select', key: 'commandType', label: 'Target', options: [
{ value: 'Channel', label: 'Channel' }, { value: 'Input', label: 'Input' },
{ value: 'Mix', label: 'Mix' }, { value: 'Output', label: 'Output' },
{ value: 'Mix', label: 'Mix' }, { value: 'MixMaster', label: 'Master Mix' }, { value: 'Output', label: 'Output' },
],
},
{ kind: 'wavelink-target' },
Expand All @@ -301,7 +301,7 @@ const FIELD_DEFS: FieldDef_[] = [
{
kind: 'select', key: 'commandType', label: 'Target', options: [
{ value: 'Channel', label: 'Channel' }, { value: 'Input', label: 'Input' },
{ value: 'Mix', label: 'Mix' }, { value: 'Output', label: 'Output' },
{ value: 'Mix', label: 'Mix' }, { value: 'MixMaster', label: 'Master Mix' }, { value: 'Output', label: 'Output' },
],
},
{ kind: 'wavelink-target' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,15 @@ export class CommandFieldsComponent {
switch (this.val('commandType')) {
case 'Input': return 'wl-inputs';
case 'Output': return 'wl-outputs';
case 'MixMaster': return 'wl-mixes';
default: return 'wl-channels'; // Channel and Mix both pick a channel first
}
}
wlPrimaryLabel(): string {
switch (this.val('commandType')) {
case 'Input': return 'Input';
case 'Output': return 'Output';
case 'MixMaster': return 'Master Mix';
default: return 'Channel';
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webui/src/app/models/generated/backend.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,6 @@ export type SINGLE_SLIDER_MODE = "NONE" | "STATIC" | "STATIC_GRADIENT" | "VOLUME

export type VolumeButton = "mute" | "next" | "prev" | "stop" | "playPause";

export type WaveLinkCommandTarget = "Input" | "Channel" | "Mix" | "Output";
export type WaveLinkCommandTarget = "Input" | "Channel" | "Mix" | "Output" | "MixMaster";

export type WsEventUnion = WsAssignmentChangedEvent | WsButtonEvent | WsDeviceConnectedEvent | WsDeviceDisconnectedEvent | WsDeviceRenamedEvent | WsKnobEvent | WsLightingChangedEvent | WsProfileSwitchedEvent | WsVisualColorsChangedEvent | DeviceSnapshotDto | WsControlSettingChangedEvent | WsNewVersionAvailableEvent;