import { CmdList , CmdSet } from './commands' ; import { ChanLayer } from '../chanLayer' ; import { Channel } from '../channel' ; export class MixerCmds implements CmdList { private readonly channels : Array < Channel > ; constructor ( channels ) { this . channels = channels ; } list ( ) { return { group : 'MIXER' , entries : [ { cmd : 'ANCHOR' , fn : this . anchor . bind ( this ) } , { cmd : 'FILL' , fn : this . fill . bind ( this ) } , { cmd : 'ROTATION' , fn : this . rotation . bind ( this ) } , { cmd : 'VOLUME' , fn : this . volume . bind ( this ) } ] } ; } /**
     * Changes the anchor point of the specified layer, or returns the current values if no arguments are given.
     */ async anchor ( chanLay , params ) { if ( ! chanLay . valid ) return Promise . resolve ( false ) ; return this . channels [ chanLay . channel - 1 ] . anchor ( chanLay . layer , params ) ; } /**
     * Scales/positions the video stream on the specified layer.
     * The concept is quite simple; it comes from the ancient DVE machines like ADO.
     * Imagine that the screen has a size of 1x1 (not in pixel, but in an abstract measure).
     * Then the coordinates of a full size picture is 0 0 1 1, which means
     *   left edge is at coordinate 0, top edge at coordinate 0,
     *   width full size = 1, height full size = 1.
     * If you want to crop the picture on the left side (for wipe left to right), you set the
     * left edge to full right => 1 and the width to 0. So this give you the start-coordinates of 1 0 0 1.
     * End coordinates of any wipe are always the full picture 0 0 1 1.
     */ async fill ( chanLay , params ) { if ( ! chanLay . valid ) return Promise . resolve ( false ) ; return this . channels [ chanLay . channel - 1 ] . fill ( chanLay . layer , params ) ; } /**
     * Returns or modifies the angle of which a layer is rotated by (clockwise degrees) around the point specified by MIXER ANCHOR.
     */ async rotation ( chanLay , params ) { if ( ! chanLay . valid ) return Promise . resolve ( false ) ; return this . channels [ chanLay . channel - 1 ] . rotation ( chanLay . layer , params ) ; } async volume ( chanLay , params ) { if ( ! chanLay . valid ) return Promise . resolve ( false ) ; return this . channels [ chanLay . channel - 1 ] . volume ( chanLay . layer , params ) ; } }