11
22import type { CompanionActionDefinition , CompanionActionDefinitions , DropdownChoice } from "@companion-module/base"
3- import { ChannelSelector } from "presonus-studiolive-api"
3+ import type { ChannelSelector } from "presonus-studiolive-api"
44import type Instance from ".."
55import { generateTransitionPeriodOption } from "../util/actionsUtils"
66import { extractChannelSelector , generateChannelSelectOption , generateMixSelectOption } from "../util/channelUtils"
@@ -19,11 +19,12 @@ const withChannelSelector = function (fn: (
1919 } ) satisfies CompanionActionDefinition [ 'callback' ]
2020}
2121
22+ export type GeneratedChannelActions = ReturnType < typeof generateActions_channels >
2223export default function generateActions_channels ( this : Instance , channels : DropdownChoice [ ] , mixes : DropdownChoice [ ] ) {
2324 const channelSelectOptions = generateChannelSelectOption ( channels )
2425 const mixSelectOptions = generateMixSelectOption ( mixes , "Mix Target" )
2526
26- const map = {
27+ const actions = {
2728 mute : {
2829 name : 'Mute channel' ,
2930 options : [
@@ -61,7 +62,7 @@ export default function generateActions_channels(this: Instance, channels: Dropd
6162 mixSelectOptions ,
6263 generateTransitionPeriodOption ( 200 )
6364 ] , callback : withChannelSelector ( ( action , context , channel ) => {
64- let currentLevel = this . client . getLevel ( channel )
65+ const currentLevel = this . client . getLevel ( channel )
6566 this . client . setChannelVolumeLinear ( channel , 0 , < number > action . options . transition ) . then ( ( ) => {
6667 this . client . mute ( channel )
6768 this . client . setChannelVolumeLinear ( channel , currentLevel )
@@ -76,7 +77,7 @@ export default function generateActions_channels(this: Instance, channels: Dropd
7677 mixSelectOptions ,
7778 generateTransitionPeriodOption ( 200 )
7879 ] , callback : withChannelSelector ( ( action , context , channel ) => {
79- let currentLevel = this . client . getLevel ( channel )
80+ const currentLevel = this . client . getLevel ( channel )
8081
8182 this . client . setChannelVolumeLinear ( channel , 0 , 0 ) . then ( ( ) => {
8283 this . client . unmute ( channel )
@@ -92,11 +93,11 @@ export default function generateActions_channels(this: Instance, channels: Dropd
9293 mixSelectOptions ,
9394 generateTransitionPeriodOption ( 200 )
9495 ] , callback : withChannelSelector ( ( action , context , channel ) => {
95- const fn = this . client . getMute ( channel ) ? map . unmute_smooth : map . mute_smooth
96+ const fn = this . client . getMute ( channel ) ? actions . unmute_smooth : actions . mute_smooth
9697 fn . callback ( action , context )
9798 } ) ,
9899 }
99100 } satisfies CompanionActionDefinitions
100101
101- return map
102+ return actions
102103}
0 commit comments