Skip to content

Commit

Permalink
updated json schemas and types. timeline running.
Browse files Browse the repository at this point in the history
Co-authored-by: Johan Nyman <[email protected]>
  • Loading branch information
lukejdav and nytamin committed Apr 8, 2024
1 parent 406f8ac commit dea76c6
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 153 deletions.
2 changes: 1 addition & 1 deletion packages/quick-tsr/input/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const input: TSRInput = {
mode: 'full',
fps: 44,

profileBehaviours: {
channelBehaviours: {

Check failure on line 14 in packages/quick-tsr/input/devices.ts

View workflow job for this annotation

GitHub Actions / Lint (quick-tsr)

Delete `⏎↹↹↹↹↹`
// By default, the priority mode for all channels are "highest value takes precedence"
'strobe' : 'invert'

Check failure on line 16 in packages/quick-tsr/input/devices.ts

View workflow job for this annotation

GitHub Actions / Lint (quick-tsr)

Replace `'strobe'·:·'invert'` with `strobe:·'invert',`
Expand Down
27 changes: 16 additions & 11 deletions packages/quick-tsr/input/mappings.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,64 @@
import { DeviceType, Mapping, SomeMappingArtNet } from 'timeline-state-resolver'
import { DeviceType, Mapping, SomeMappingArtnet, MappingArtnetType } from 'timeline-state-resolver'
import { literal } from 'timeline-state-resolver/dist/lib'
import type { TSRInput } from '../src'

export const input: TSRInput = {
mappings: {
dimmer0: literal<Mapping<SomeMappingArtNet>>({
dimmer0: literal<Mapping<SomeMappingArtnet>>({
device: DeviceType.ARTNET,
deviceId: 'universe0',
options: {
mappingType: MappingArtnetType.Channels,
universe: 0,
profileMappings: {
featureChannels: {
// Maps dimmer to channel 1:
"dimmer": 1,

Check failure on line 15 in packages/quick-tsr/input/mappings.ts

View workflow job for this annotation

GitHub Actions / Lint (quick-tsr)

Replace `"dimmer"` with `dimmer`
}

Check failure on line 16 in packages/quick-tsr/input/mappings.ts

View workflow job for this annotation

GitHub Actions / Lint (quick-tsr)

Insert `,`
},
}),
rgb0: literal<Mapping<SomeMappingArtNet>>({
rgb0: literal<Mapping<SomeMappingArtnet>>({
device: DeviceType.ARTNET,
deviceId: 'universe0',
options: {
mappingType: MappingArtnetType.Channels,
universe: 0,
profileMappings: {
featureChannels: {
"dimmer": 6,
"RGB": [7,8,9],
}
},
}),
rgb0_dimmer: literal<Mapping<SomeMappingArtNet>>({
rgb0_dimmer: literal<Mapping<SomeMappingArtnet>>({
device: DeviceType.ARTNET,
deviceId: 'universe0',
options: {
mappingType: MappingArtnetType.Channels,
universe: 0,
profileMappings: {
featureChannels: {
"dimmer": 6,
}
},
}),
dimmerGroup0: literal<Mapping<SomeMappingArtNet>>({
dimmerGroup0: literal<Mapping<SomeMappingArtnet>>({
device: DeviceType.ARTNET,
deviceId: 'universe0',
options: {
mappingType: MappingArtnetType.Channels,
universe: 0,
profileMappings: {
featureChannels: {
// Maps dimmers to channel group:
"dimmers": [11, 12, 13, 14, 15, 16, 17, 18],
}
},
}),

everything: literal<Mapping<SomeMappingArtNet>>({
everything: literal<Mapping<SomeMappingArtnet>>({
device: DeviceType.ARTNET,
deviceId: 'universe0',
options: {
mappingType: MappingArtnetType.Channels,
universe: 0,
profileMappings: {
featureChannels: {
// "everything": ['1-50', '100-512'],
"everything": '1-512'

Expand Down
2 changes: 1 addition & 1 deletion packages/quick-tsr/input/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TSRInput } from '../src'

export const input: TSRInput = {
settings: {
multiThreading: true,
multiThreading: false,
multiThreadedResolver: false,
},
}
171 changes: 98 additions & 73 deletions packages/quick-tsr/input/timeline.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {
DeviceType,
// DeviceType,
// TimelineContentTypeCasparCg,
// TimelineContentCCGMedia,
TimelineContentArtNetAny,
TimelineContentArtNetValues,
TimelineContentTypeArtNet,
TSRTimelineObj,
} from 'timeline-state-resolver'
import { TSRInput } from '../src'
Expand All @@ -13,98 +14,122 @@ export const input: TSRInput = {
timeline: [

literal<TSRTimelineObj<TimelineContentArtNetAny>>({
id: 'artnet0',
id: 'grey',
enable: {
start: Date.now(),
duration: 20 * 1000
},
layer: 'dimmer00',
layer: 'dimmer0',
content: {
deviceType: DeviceType.ARTNET,
type: TimelineContentTypeArtNet.VALUES,
values: {
dimmer: 255
dimmer: 42
}
}
}),
literal<TSRTimelineObj<TimelineContentArtNetValues>>({
id: 'artnet0',
literal<TSRTimelineObj<TimelineContentArtNetAny>>({
id: 'white',
enable: {
start: Date.now(),
start: Date.now() + 1000,
duration: 20 * 1000
},
layer: 'rgb0',
layer: 'dimmer0',
content: {
deviceType: DeviceType.ARTNET,
type: TimelineContentTypeArtNet.VALUES,
values: {
// Sets an RGB value:
// rgb: [ 255, 127, 0 ]

// Defaults to [255, 255, 255] (special case: uses the value for all)
// rgb: 255

// Defaults to [ 127, 255, 0 ] (underfill: extend with zeros)
// rgb: [ 127, 255 ]

// Defaults to [ 127, 255, 209 ] (overfill: just cap and discard the unused values)
// rgb: [ 127, 255, 209, 52 ]
dimmer: 255
}
}
}),
literal<TSRTimelineObj<TimelineContentArtNetValues>>({
id: 'myRGBLight0',
enable: {
start: Date.now(),
duration: 20 * 1000
},
layer: 'rgb0',
content: {
values: {
dimmer: 255,
rgb: [ 255, 127, 0 ]
}
},
// keyframes: [
// {
// id: 'kf0',
// enable: {
// literal<TSRTimelineObj<TimelineContentArtNetAny>>({
// id: 'artnet11',
// enable: {
// start: Date.now(),
// duration: 20 * 1000
// },
// layer: 'rgb0',
// content: {
// deviceType: DeviceType.ARTNET,
// type: TimelineContentTypeArtNet.VALUES,
// values: {
// // Sets an RGB value:
// rgb: [ 255, 127, 0 ]

// // Defaults to [255, 255, 255] (special case: uses the value for all)
// // rgb: 255

// // Defaults to [ 127, 255, 0 ] (underfill: extend with zeros)
// // rgb: [ 127, 255 ]

// // Defaults to [ 127, 255, 209 ] (overfill: just cap and discard the unused values)
// // rgb: [ 127, 255, 209, 52 ]
// }
// }
// }),
// literal<TSRTimelineObj<TimelineContentArtNetAny>>({
// id: 'myRGBLight0',
// enable: {
// start: Date.now(),
// duration: 20 * 1000
// },
// layer: 'rgb0',
// content: {
// deviceType: DeviceType.ARTNET,
// type: TimelineContentTypeArtNet.VALUES,
// values: {
// dimmer: 255,
// rgb: [ 255, 127, 0 ]
// }
// },
// // keyframes: [
// // {
// // id: 'kf0',
// // enable: {

// start: '#myRGBLight0.start + 10',
// },
// content: {
// values: {
// dimmer: 127
// }
// }
// }
// ]
}),
literal<TSRTimelineObj<TimelineContentArtNetValues>>({
id: 'artnet0',
enable: {
start: Date.now(),
duration: 20 * 1000
},
layer: 'rgb0',
content: {

values: {
dimmers: 255
}
// // start: '#myRGBLight0.start + 10',
// // },
// // content: {
// // values: {
// // dimmer: 127
// // }
// // }
// // }
// // ]
// }),
// literal<TSRTimelineObj<TimelineContentArtNetAny>>({
// id: 'artnet_dimmer',
// enable: {
// start: Date.now(),
// duration: 20 * 1000
// },
// layer: 'rgb0',
// content: {
// deviceType: DeviceType.ARTNET,
// type: TimelineContentTypeArtNet.VALUES,
// values: {
// dimmers: 255
// }

// value: [255, 0, 0, 255]
}
}),
// // value: [255, 0, 0, 255]
// }
// }),

literal<TSRTimelineObj<TimelineContentArtNetValues>>({
id: 'whiteout',
enable: {
start: Date.now()
},
layer: 'everything',
content: {
values: {
everything: 255
}
}
}),
// literal<TSRTimelineObj<TimelineContentArtNetAny>>({
// id: 'whiteout',
// enable: {
// start: Date.now()
// },
// layer: 'everything',
// content: {
// deviceType: DeviceType.ARTNET,
// type: TimelineContentTypeArtNet.VALUES,
// values: {
// everything: 255
// }
// }
// }),

// literal<TSRTimelineObj<TimelineContentCCGMedia>>({
// id: 'video0',
Expand Down
44 changes: 24 additions & 20 deletions packages/timeline-state-resolver-types/src/generated/artnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,37 @@

export interface ArtNetOptions {
host: string
mode?: Mode
mode?: 'full' | 'partial'
fps?: number
channelBehavious?: {
[k: string]: unknown
/**
* The key is either a ref to a Feature type OR a unierse:channel, to apply the behavior to. Default behavior is 'Highest'.
*/
channelBehaviours?: {
/**
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` "([a-z]\w*)|(\d+:\d+)".
*/
[k: string]: 'invert' | 'last' | 'highest' | 'lowest'
}
}

export enum Mode {
FULL = 'full',
PARTIAL = 'partial'
}

export interface MappingArtnetUniverse {
export interface MappingArtnetChannels {
universe: number
mappingType: MappingArtnetType.Universe
}

export interface MappingArtnetProfileMappings {
ID: string
channels: string
mappingType: MappingArtnetType.ProfileMappings
[k: string]: unknown
/**
* Maps channel numbers to Features. Values are either a channel (number), multiple channels (number[]), or range of channels eg '1-512'.
*/
featureChannels: {
/**
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` ".*".
*/
[k: string]: number | number[] | string
}
mappingType: MappingArtnetType.Channels
}

export enum MappingArtnetType {
Universe = 'universe',
ProfileMappings = 'profileMappings',
Channels = 'channels',
}

export type SomeMappingArtnet = MappingArtnetUniverse | MappingArtnetProfileMappings
export type SomeMappingArtnet = MappingArtnetChannels
22 changes: 14 additions & 8 deletions packages/timeline-state-resolver-types/src/integrations/artnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ export type ArtNetEasingType =
| 'Bounce'

export enum TimelineContentTypeArtNet {
ARTNET = 'artnet',
VALUES = 'values',
}

export interface TimelineContentArtNet {
export interface TimelineContentArtNetBase {
deviceType: DeviceType.ARTNET
type: TimelineContentTypeArtNet
channel: number
value: number
trasition?: {
duration: number,
type: ArtNetEasingType,
direction: 'In' | 'Out' | 'InOut' | 'None'
}
export interface TimelineContentArtNet extends TimelineContentArtNetBase {
type: TimelineContentTypeArtNet.VALUES

Check failure on line 26 in packages/timeline-state-resolver-types/src/integrations/artnet.ts

View workflow job for this annotation

GitHub Actions / Lint (timeline-state-resolver-types)

Delete `↹`
values: {
[feature: string]: number | number[]
}

Check failure on line 30 in packages/timeline-state-resolver-types/src/integrations/artnet.ts

View workflow job for this annotation

GitHub Actions / Lint (timeline-state-resolver-types)

Delete `↹`
// TODO:
// transition?: {
// duration: number,
// type: ArtNetEasingType,
// direction: 'In' | 'Out' | 'InOut' | 'None'
// }
}

export interface ArtNetDeviceCommand {
Expand Down
Loading

0 comments on commit dea76c6

Please sign in to comment.