Skip to content

Commit bfe6172

Browse files
committed
wip(EAV-296): support tally on streamdecks
1 parent c9a455e commit bfe6172

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

packages/input-gateway/src/inputManagerHandler.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,15 @@ export class InputManagerHandler {
646646
.reverse()
647647

648648
if (previewedAdlibs.length > 0) {
649-
tally = tally | Tally.PRESENT
649+
tally =
650+
tally |
651+
Tally.PRESENT |
652+
previewedAdlibs.reduce(
653+
(acc, adlib) =>
654+
// @ts-expect-error: needs new build of core-integration, but we're on release50, which causes some incompatibilities, even though things just work...
655+
acc | (adlib.isCurrent ? Tally.CURRENT : Tally.NONE) | (adlib.isNext ? Tally.NEXT : Tally.NONE),
656+
Tally.NONE
657+
)
650658
contentLayerLongName = previewedAdlibs[0].sourceLayerName?.name
651659
contentLayerShortName = previewedAdlibs[0].sourceLayerName?.abbreviation
652660
contentLabel = previewedAdlibs.map((adlib) => InputManagerHandler.getStringLabel(adlib.label)).join(', ')

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ClassNames, BitmapFeedback } from '../../../feedback'
1+
import { ClassNames, BitmapFeedback, Tally } from '../../../feedback'
22
import { BaseRenderer } from '../base'
33

44
/**
@@ -54,6 +54,11 @@ const COLORS: Record<string, string> = {
5454
[ClassNames.UNKNOWN]: '#4b4b4b',
5555
}
5656

57+
const TALLY_COLORS: Record<string, string> = {
58+
[Tally.CURRENT]: '#ff0000',
59+
[Tally.NEXT]: '#00ff00',
60+
}
61+
5762
export class BaseAdLibRenderer extends BaseRenderer {
5863
private getAdLibColor(classNames: string[] | undefined): string {
5964
if (classNames === undefined) return COLORS[ClassNames.UNKNOWN]
@@ -62,6 +67,13 @@ export class BaseAdLibRenderer extends BaseRenderer {
6267
return COLORS[ClassNames.UNKNOWN]
6368
}
6469

70+
private getTallyColor(tally: Tally | undefined): string | undefined {
71+
if (tally === undefined) return undefined
72+
if (Tally.CURRENT & tally) return TALLY_COLORS[Tally.CURRENT]
73+
if (Tally.NEXT & tally) return TALLY_COLORS[Tally.NEXT]
74+
return undefined
75+
}
76+
6577
private getFontSize(label: string): number {
6678
if (label.length <= 3) {
6779
return 2.5
@@ -86,7 +98,7 @@ export class BaseAdLibRenderer extends BaseRenderer {
8698
spring: true,
8799
fontSize: this.percentToPixels(this.getFontSize(label)),
88100
lineHeight: this.percentToPixels(this.getFontSize(label)),
89-
background: this.getAdLibColor(feedback.classNames),
101+
background: this.getTallyColor(feedback.tally) ?? this.getAdLibColor(feedback.classNames),
90102
textShadowOffset: 1,
91103
lineClamp: 4,
92104
})

packages/input-manager/src/generated/streamdeck.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface StreamdeckStylePreset {
2929
fontWeight?: 'normal' | 'bold'
3030
fontWidth?: 'normal' | 'narrow'
3131
fontStyle?: 'normal' | 'italic'
32-
color?: boolean & string
32+
color?: string
3333
textStrokeColor?: string
3434
textShadowColor?: string
3535
textShadowOffset?: number
@@ -43,7 +43,7 @@ export interface StreamdeckStylePreset {
4343
| 'left bottom'
4444
| 'center bottom'
4545
| 'right bottom'
46-
textTransform?: 'capitalize' | 'uppercase' | 'lowercase'
46+
textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase'
4747
lineClamp?: number
4848
inlineBackground?: string
4949
inlineBackgroundPadding?: string

0 commit comments

Comments
 (0)