Skip to content

Commit 946eaec

Browse files
committed
feat: add support for tally-state pseudo-classes
1 parent 15d2011 commit 946eaec

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

packages/input-gateway/src/inputManagerHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ export class InputManagerHandler {
648648
previewedAdlibs.reduce(
649649
(acc, adlib) =>
650650
// @ts-expect-error: needs new build of core-integration, but we're on release50, which causes some incompatibilities, even though things just work...
651-
acc | (adlib.isCurrent ? Tally.CURRENT : Tally.NONE) | (adlib.isNext ? Tally.NEXT : Tally.NONE),
651+
acc | (adlib.isCurrent ? Tally.ACTIVE : Tally.NONE) | (adlib.isNext ? Tally.NEXT : Tally.NONE),
652652
Tally.NONE
653653
)
654654
contentLayerLongName = previewedAdlibs[0].sourceLayerName?.name

packages/input-manager/src/feedback/bitmap/typeRenderers/adlib/base.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ const COLORS: Record<string, string> = {
5555
}
5656

5757
const TALLY_COLORS: Record<string, string> = {
58-
[Tally.CURRENT]: '#ff0000',
58+
[Tally.ACTIVE]: '#ff0000',
5959
[Tally.NEXT]: '#00ff00',
60+
[Tally.OTHER]: '#ffff00',
6061
}
6162

6263
export class BaseAdLibRenderer extends BaseRenderer {
@@ -69,8 +70,9 @@ export class BaseAdLibRenderer extends BaseRenderer {
6970

7071
private getTallyColor(tally: Tally | undefined): string | undefined {
7172
if (tally === undefined) return undefined
72-
if (Tally.CURRENT & tally) return TALLY_COLORS[Tally.CURRENT]
73+
if (Tally.ACTIVE & tally) return TALLY_COLORS[Tally.ACTIVE]
7374
if (Tally.NEXT & tally) return TALLY_COLORS[Tally.NEXT]
75+
if (Tally.OTHER & tally) return TALLY_COLORS[Tally.OTHER]
7476
return undefined
7577
}
7678

packages/input-manager/src/integrations/streamdeck/device.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { StreamDeckTcp } from '@elgato-stream-deck/tcp'
77
import { Logger } from '../../logger'
88
import { FeedbackStore } from '../../devices/feedbackStore'
99
import { assertNever, DEFAULT_ANALOG_RATE_LIMIT, Symbols } from '../../lib'
10-
import { BitmapFeedback, Feedback, SomeFeedback } from '../../feedback/feedback'
10+
import { BitmapFeedback, Feedback, SomeFeedback, Tally } from '../../feedback/feedback'
1111
import { getBitmap } from '../../feedback/bitmap'
1212
import { StreamDeckDeviceOptions, StreamdeckStylePreset } from '../../generated'
1313

@@ -272,9 +272,36 @@ export class StreamDeckDeviceHandler {
272272

273273
// Find the first match
274274
for (const name of styleClassNames) {
275-
const stylePreset = Object.values<StreamdeckStylePreset>(this.config.stylePresets).find(
275+
let stylePreset = Object.values<StreamdeckStylePreset>(this.config.stylePresets).find(
276276
(preset) => preset.id === name
277277
)
278+
if (feedback.tally) {
279+
if (feedback.tally & Tally.ACTIVE) {
280+
stylePreset =
281+
stylePreset ||
282+
Object.values<StreamdeckStylePreset>(this.config.stylePresets).find(
283+
(preset) => preset.id === `${name}:active`
284+
)
285+
} else if (feedback.tally & Tally.NEXT) {
286+
stylePreset =
287+
stylePreset ||
288+
Object.values<StreamdeckStylePreset>(this.config.stylePresets).find(
289+
(preset) => preset.id === `${name}:next`
290+
)
291+
} else if (feedback.tally & Tally.OTHER) {
292+
stylePreset =
293+
stylePreset ||
294+
Object.values<StreamdeckStylePreset>(this.config.stylePresets).find(
295+
(preset) => preset.id === `${name}:other`
296+
)
297+
} else if (feedback.tally & Tally.PRESENT) {
298+
stylePreset =
299+
stylePreset ||
300+
Object.values<StreamdeckStylePreset>(this.config.stylePresets).find(
301+
(preset) => preset.id === `${name}:present`
302+
)
303+
}
304+
}
278305

279306
if (stylePreset) {
280307
return {

0 commit comments

Comments
 (0)