-
Notifications
You must be signed in to change notification settings - Fork 0
/
DownstreamKey.cs
1030 lines (917 loc) · 36.4 KB
/
DownstreamKey.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//-----------------------------------------------------------------------------
// <copyright file="DownstreamKey.cs">
// Copyright (c) 2023 Jeff Varga
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// </copyright>
//-----------------------------------------------------------------------------
namespace BlackmagicAtemWrapper.Keyers
{
using System;
using System.Runtime.InteropServices;
using BlackmagicAtemWrapper.utility;
using BMDSwitcherAPI;
/// <summary>
/// The DownstreamKey class is used for managing the settings of a downstream key.
/// </summary>
/// <remarks>Blackmagic Switcher SDK - 5.2.19</remarks>
public class DownstreamKey : IBMDSwitcherDownstreamKeyCallback
{
/// <summary>
/// Internal reference to the raw <seealso cref="IBMDSwitcherDownstreamKey"/>
/// </summary>
private readonly IBMDSwitcherDownstreamKey InternalDownstreamKeyReference;
/// <summary>
/// Initializes a new instance of the <see cref="DownstreamKey" /> class.
/// </summary>
/// <param name="downstreamKey">The native <seealso cref="IBMDSwitcherDownstreamKey"/> from the BMDSwitcherAPI.</param>
public DownstreamKey(IBMDSwitcherDownstreamKey downstreamKey)
{
this.InternalDownstreamKeyReference = downstreamKey;
this.InternalDownstreamKeyReference.AddCallback(this);
}
/// <summary>
/// Finalizes an instance of the <see cref="DownstreamKey"/> class.
/// </summary>
~DownstreamKey()
{
this.InternalDownstreamKeyReference.RemoveCallback(this);
_ = Marshal.ReleaseComObject(this.InternalDownstreamKeyReference);
}
#region Events
/// <summary>
/// A delegate to handle events from <see cref="DownstreamKey"/>.
/// </summary>
/// <param name="sender">The <see cref="DownstreamKey"/> that received the event.</param>
public delegate void DownstreamKeyEventHandler(object sender);
/// <summary>
/// The <see cref="InputCut"/> source changed.
/// </summary>
public event DownstreamKeyEventHandler OnInputCutChanged;
/// <summary>
/// The <see cref="InputFill"/> source changed.
/// </summary>
public event DownstreamKeyEventHandler OnInputFillChanged;
/// <summary>
/// The <see cref="Tie"/> flag changed.
/// </summary>
public event DownstreamKeyEventHandler OnTieChanged;
/// <summary>
/// The <see cref="Rate"/> value changed.
/// </summary>
public event DownstreamKeyEventHandler OnRateChanged;
/// <summary>
/// The <see cref="OnAir"/> flag changed.
/// </summary>
public event DownstreamKeyEventHandler OnOnAirChanged;
/// <summary>
/// The <see cref="IsTransitioning"/> flag changed.
/// </summary>
public event DownstreamKeyEventHandler OnIsTransitioningChanged;
/// <summary>
/// The <see cref="IsAutoTransitioning"/> flag changed.
/// </summary>
public event DownstreamKeyEventHandler OnIsAutoTransitioningChanged;
/// <summary>
/// The <see cref="IsTransitionTowardsOnAir"/> flag changed.
/// </summary>
public event DownstreamKeyEventHandler OnIsTransitionTowardsOnAIrChanged;
/// <summary>
/// The <see cref="FramesRemaining"/> value changed.
/// </summary>
public event DownstreamKeyEventHandler OnFramesRemainingChanged;
/// <summary>
/// The <see cref="PreMultiplied"/> flag changed.
/// </summary>
public event DownstreamKeyEventHandler OnPreMultipliedChanged;
/// <summary>
/// The <see cref="Clip"/> value changed.
/// </summary>
public event DownstreamKeyEventHandler OnClipChanged;
/// <summary>
/// The <see cref="Gain"/> value changed.
/// </summary>
public event DownstreamKeyEventHandler OnGainChanged;
/// <summary>
/// The <see cref="IsInverse"/> flag changed.
/// </summary>
public event DownstreamKeyEventHandler OnInverseChanged;
/// <summary>
/// The <see cref="IsMasked"/> flag changed.
/// </summary>
public event DownstreamKeyEventHandler OnMaskedChanged;
/// <summary>
/// The <see cref="MaskTop"/> value changed.
/// </summary>
public event DownstreamKeyEventHandler OnMaskTopChanged;
/// <summary>
/// The <see cref="MaskBottom"/> value changed.
/// </summary>
public event DownstreamKeyEventHandler OnMaskBottomChanged;
/// <summary>
/// The <see cref="MaskLeft"/> value changed.
/// </summary>
public event DownstreamKeyEventHandler OnMaskLeftChanged;
/// <summary>
/// The <see cref="MaskRight"/> value changed.
/// </summary>
public event DownstreamKeyEventHandler OnMaskRightChanged;
#endregion
#region Properties
/// <summary>
/// Gets or sets the current cut input source.
/// </summary>
public long InputCut
{
get { return this.GetInputCut(); }
set { this.SetInputCut(value); }
}
/// <summary>
/// Gets or sets the current fill input source.
/// </summary>
public long InputFill
{
get { return this.GetInputFill(); }
set { this.SetInputFill(value); }
}
/// <summary>
/// Gets the availability of fill inputs for this downstream key.
/// </summary>
public _BMDSwitcherInputAvailability FillInputAvailabilityMask
{
get { return this.GetFillInputAvailabilityMask(); }
}
/// <summary>
/// Gets the availability of cut inputs for this downstream key.
/// </summary>
public _BMDSwitcherInputAvailability CutInputAvailabilityMask
{
get { return this.GetCutInputAvailabilityMask(); }
}
/// <summary>
/// Gets or sets a value indicating whether the tie flag is enabled.
/// </summary>
public bool Tie
{
get { return this.GetTie(); }
set { this.SetTie(value); }
}
/// <summary>
/// Gets or sets the transition rate value.
/// </summary>
public uint Rate
{
get { return this.GetRate(); }
set { this.SetRate(value); }
}
/// <summary>
/// Gets or sets a value indicating whether the on-air flag is enabled.
/// </summary>
public bool OnAir
{
get { return this.GetOnAir(); }
set { this.SetOnAir(OnAir); }
}
/// <summary>
/// Gets a value indicating whether this downstream key is transitioning or not.
/// </summary>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.15</remarks>
public bool IsTransitioning
{
get
{
this.InternalDownstreamKeyReference.IsTransitioning(out int isTransitioning);
return Convert.ToBoolean(IsTransitioning);
}
}
/// <summary>
/// The IsAutoTransitioning method returns whether this downstream key is auto-transitioning or not.
/// </summary>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.16</remarks>
public bool IsAutoTransitioning
{
get
{
this.InternalDownstreamKeyReference.IsAutoTransitioning(out int isAutoTransitioning);
return Convert.ToBoolean(isAutoTransitioning);
}
}
/// <summary>
/// Gets a value indicating whether this downstream key is transitioning towards or away from on-air.
/// </summary>
public bool IsTransitionTowardsOnAir
{
get
{
this.InternalDownstreamKeyReference.IsTransitionTowardsOnAir(out int isTransitionTowardsOnAir);
return Convert.ToBoolean(IsTransitionTowardsOnAir);
}
}
/// <summary>
/// Gets the number of frames remaining in the transition.
/// </summary>
public uint FramesRemaining
{
get { return this.GetFramesRemaining(); }
}
/// <summary>
/// Gets or sets a value indicating the state of the pre-multiplied flag.
/// </summary>
public bool PreMultiplied
{
get { return this.GetPreMultiplied(); }
set { this.SetPreMultiplied(value); }
}
/// <summary>
/// Gets or sets the clip value.
/// </summary>
public double Clip
{
get { return this.GetClip(); }
set { this.SetClip(value); }
}
/// <summary>
/// Gets or sets the current gain value.
/// </summary>
public double Gain
{
get { return this.GetGain(); }
set { this.SetGain(value); }
}
/// <summary>
/// Gets or sets a value indicating whether the inverse flag is set.
/// </summary>
public bool IsInverse
{
get { return this.GetInverse(); }
set { this.SetInverse(value); }
}
/// <summary>
/// Gets or set a value indicating whether masking is enabled or not.
/// </summary>
public bool IsMasked
{
get { return this.GetMasked(); }
set { this.SetMasked(value); }
}
/// <summary>
/// Gets or sets the current mask top value.
/// </summary>
public double MaskTop
{
get { return this.GetMaskTop(); }
set { this.SetMaskTop(value); }
}
/// <summary>
/// Gets or sets the current mask bottom value.
/// </summary>
public double MaskBottom
{
get { return this.GetMaskBottom(); }
set { this.SetMaskBottom(value); }
}
/// <summary>
/// Gets or sets the current mask left value.
/// </summary>
public double MaskLeft
{
get { return this.GetMaskLeft(); }
set { this.SetMaskLeft(value); }
}
/// <summary>
/// Gets or sets the current mask right value.
/// </summary>
public double MaskRight
{
get { return this.GetMaskRight(); }
set { this.SetMaskRight(value); }
}
#endregion
#region IBMDSwitcherDownstreamKey
/// <summary>
/// The GetInputCut method returns the selected cut input source.
/// </summary>
/// <returns>BMDSwitcherInputId of the selected cut input source.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.1</remarks>
public long GetInputCut()
{
this.InternalDownstreamKeyReference.GetInputCut(out long input);
return input;
}
/// <summary>
/// The SetInputCut method sets the cut input source.
/// </summary>
/// <param name="input">The desired cut input source’s BMDSwitcherInputId.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.2</remarks>
public void SetInputCut(long input)
{
try
{
this.InternalDownstreamKeyReference.SetInputCut(input);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetInputFill method returns the selected fill input source.
/// </summary>
/// <returns>BMDSwitcherInputId of the selected fill input source.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.3</remarks>
public long GetInputFill()
{
this.InternalDownstreamKeyReference.GetInputFill(out long input);
return input;
}
/// <summary>
/// The SetInputFill method sets the fill input source.
/// </summary>
/// <param name="input">The desired fill input source’s BMDSwitcherInputId.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.4</remarks>
public void SetInputFill(long input)
{
try
{
this.InternalDownstreamKeyReference.SetInputFill(input);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetFillInputAvailabilityMask method returns the corresponding BMDSwitcherInputAvailability bit mask value for fill inputs available to this downstream key.The input availability property of an IBMDSwitcherInput can be bitwise-ANDed with this mask value. If the result of the bitwise-AND is equal to the mask value then this input is available for use as a fill input for this downstream key.
/// </summary>
/// <returns>BMDSwitcherInputAvailability bit mask.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.5</remarks>
public _BMDSwitcherInputAvailability GetFillInputAvailabilityMask()
{
this.InternalDownstreamKeyReference.GetFillInputAvailabilityMask(out _BMDSwitcherInputAvailability mask);
return mask;
}
/// <summary>
/// The GetCutInputAvailabilityMask method returns the corresponding BMDSwitcherInputAvailability bit mask value for cut inputs available to this downstream key.The input availability property of an IBMDSwitcherInput can be bitwise-ANDed with this mask value. If the result of the bitwise-AND is equal to the mask value then this input is available for use as a cut input for this downstream key.
/// </summary>
/// <returns>BMDSwitcherInputAvailability bit mask.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.6</remarks>
public _BMDSwitcherInputAvailability GetCutInputAvailabilityMask()
{
this.InternalDownstreamKeyReference.GetCutInputAvailabilityMask(out _BMDSwitcherInputAvailability mask);
return mask;
}
/// <summary>
/// The GetTie method gets the current tie flag.
/// </summary>
/// <returns>Boolean tie flag.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.7</remarks>
public bool GetTie()
{
this.InternalDownstreamKeyReference.GetTie(out int tie);
return Convert.ToBoolean(tie);
}
/// <summary>
/// The SetTie method sets the tie flag.
/// </summary>
/// <param name="tie">The desired tie flag.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.8</remarks>
public void SetTie(bool tie)
{
try
{
this.InternalDownstreamKeyReference.SetTie(Convert.ToInt32(tie));
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetRate method gets the current rate value.
/// </summary>
/// <returns>The current rate value in frames.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.9</remarks>
public uint GetRate()
{
this.InternalDownstreamKeyReference.GetRate(out uint frames);
return frames;
}
/// <summary>
/// The SetRate method sets the rate value.
/// </summary>
/// <param name="rate">The desired rate value in frames.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.10</remarks>
public void SetRate(uint rate)
{
try
{
this.InternalDownstreamKeyReference.SetRate(rate);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetOnAir method returns the on-air flag.
/// </summary>
/// <returns>Boolean on-air flag.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.11</remarks>
public bool GetOnAir()
{
this.InternalDownstreamKeyReference.GetOnAir(out int onAir);
return Convert.ToBoolean(onAir);
}
/// <summary>
/// The SetOnAir method sets the on-air flag.
/// </summary>
/// <param name="onAir">The desired on-air flag.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.12</remarks>
public void SetOnAir(bool onAir)
{
try
{
this.InternalDownstreamKeyReference.SetOnAir(Convert.ToInt32(onAir));
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// Use the PerformAutoTransition method to start an auto-transition.
/// </summary>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.13</remarks>
public void PerformAutoTransition()
{
try
{
this.InternalDownstreamKeyReference.PerformAutoTransition();
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The PerformAutoTransitionInDirection method performs an auto-transition in the specified direction, either towards on-air or away from on-air.
/// </summary>
/// <param name="towardsOnAir">The desired direction.</param>
/// <exception cref="FailedException">Failure.</exception>
public void PerformAutoTransitionInDirection(bool towardsOnAir)
{
try
{
this.InternalDownstreamKeyReference.PerformAutoTransitionInDirection(Convert.ToInt32(towardsOnAir));
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetFramesRemaining method gets the number of frames remaining in the transition.
/// </summary>
/// <returns>Number of frames remaining in the transition.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.18</remarks>
public uint GetFramesRemaining()
{
this.InternalDownstreamKeyReference.GetFramesRemaining(out uint framesRemaining);
return framesRemaining;
}
/// <summary>
/// The GetPreMultiplied method returns the current pre-multiplied flag.
/// </summary>
/// <returns>The current pre-multiplied flag.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.19</remarks>
public bool GetPreMultiplied()
{
this.InternalDownstreamKeyReference.GetPreMultiplied(out int preMultiplied);
return Convert.ToBoolean(preMultiplied);
}
/// <summary>
/// The SetPreMultiplied method sets the pre-multiplied flag. Note that clip, gain and inverse controls are not used when pre-multiplied flag is set to true.
/// </summary>
/// <param name="preMultiplied">The desired pre-multiplied flag.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.20</remarks>
public void SetPreMultiplied(bool preMultiplied)
{
try
{
this.InternalDownstreamKeyReference.SetPreMultiplied(Convert.ToInt32(preMultiplied));
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetClip method returns the current clip value.
/// </summary>
/// <returns>The current clip value.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.21</remarks>
public double GetClip()
{
this.InternalDownstreamKeyReference.GetClip(out double clip);
return clip;
}
/// <summary>
/// The SetClip method sets the clip value.
/// </summary>
/// <param name="clip">The desired clip value.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.22</remarks>
public void SetClip(double clip)
{
try
{
this.InternalDownstreamKeyReference.SetClip(clip);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetGain method returns the current gain value.
/// </summary>
/// <returns>The current gain value.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.23</remarks>
public double GetGain()
{
this.InternalDownstreamKeyReference.GetGain(out double gain);
return gain;
}
/// <summary>
/// The SetGain method sets the gain value.
/// </summary>
/// <param name="gain">The desired gain value.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.24</remarks>
public void SetGain(double gain)
{
try
{
this.InternalDownstreamKeyReference.SetGain(gain);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetInverse method returns the current inverse flag.
/// </summary>
/// <returns>The current inverse flag.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.25</remarks>
public bool GetInverse()
{
this.InternalDownstreamKeyReference.GetInverse(out int inverse);
return Convert.ToBoolean(inverse);
}
/// <summary>
/// The SetInverse method sets the inverse flag.
/// </summary>
/// <param name="inverse">The desired inverse flag.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.26</remarks>
public void SetInverse(bool inverse)
{
try
{
this.InternalDownstreamKeyReference.SetInverse(Convert.ToInt32(inverse));
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetMasked method returns whether masking is enabled or not.
/// </summary>
/// <returns>Boolean flag of whether masking is enabled.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.27</remarks>
public bool GetMasked()
{
this.InternalDownstreamKeyReference.GetMasked(out int maskEnabled);
return Convert.ToBoolean(maskEnabled);
}
/// <summary>
/// Use SetMasked method to enable or disable masking.
/// </summary>
/// <param name="maskEnabled">The desired masked value.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.28</remarks>
public void SetMasked(bool maskEnabled)
{
try
{
this.InternalDownstreamKeyReference.SetMasked(Convert.ToInt32(maskEnabled));
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetMaskTop method returns the current mask top value.
/// </summary>
/// <returns>The current mask top value.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.29/remarks>
public double GetMaskTop()
{
this.InternalDownstreamKeyReference.GetMaskTop(out double maskTop);
return maskTop;
}
/// <summary>
/// The SetMaskTop method sets the mask top value.
/// </summary>
/// <param name="maskTop">The desired mask top value.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.30</remarks>
public void SetMaskTop(double maskTop)
{
try
{
this.InternalDownstreamKeyReference.SetMaskTop(maskTop);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetMaskBottom method returns the current mask bottom value.
/// </summary>
/// <returns>The current mask bottom value.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.31</remarks>
public double GetMaskBottom()
{
this.InternalDownstreamKeyReference.GetMaskBottom(out double maskBottom);
return maskBottom;
}
/// <summary>
/// The SetMaskBottom method sets the mask bottom value.
/// </summary>
/// <param name="maskBottom">The desired mask bottom value.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.32</remarks>
public void SetMaskBottom(double maskBottom)
{
try
{
this.InternalDownstreamKeyReference.SetMaskBottom(maskBottom);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetMaskLeft method returns the current mask left value
/// </summary>
/// <returns>The current mask left value.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.33</remarks>
public double GetMaskLeft()
{
this.InternalDownstreamKeyReference.GetMaskLeft(out double maskLeft);
return maskLeft;
}
/// <summary>
/// The SetMaskLeft method sets the mask left value.
/// </summary>
/// <param name="maskLeft">The desired mask left value.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.34</remarks>
public void SetMaskLeft(double maskLeft)
{
try
{
this.InternalDownstreamKeyReference.SetMaskLeft(maskLeft);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The GetMaskRight method returns the current mask right value.
/// </summary>
/// <returns>The current mask right value.</returns>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.35</remarks>
public double GetMaskRight()
{
this.InternalDownstreamKeyReference.GetMaskRight(out double maskRight);
return maskRight;
}
/// <summary>
/// The SetMaskRight method sets the mask right value.
/// </summary>
/// <param name="maskRight">The desired mask right value.</param>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.36</remarks>
public void SetMaskRight(double maskRight)
{
try
{
this.InternalDownstreamKeyReference.SetMaskRight(maskRight);
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
/// <summary>
/// The ResetMask method resets the mask settings to default values.
/// </summary>
/// <exception cref="FailedException">Failure.</exception>
/// <remarks>Blackmagic Switcher SDK - 5.2.19.37</remarks>
public void ResetMask()
{
try
{
this.InternalDownstreamKeyReference.ResetMask();
return;
}
catch (COMException e)
{
if (FailedException.IsFailedException(e.ErrorCode))
{
throw new FailedException(e);
}
throw;
}
}
#endregion
/// <summary>
/// <para>The Notify method is called when IBMDSwitcherDownstreamKey events occur, such as property changes.</para>
/// <para>This method is called from a separate thread created by the switcher SDK so care should be exercised when interacting with other threads. Callbacks should be processed as quickly as possible to avoid delaying other callbacks or affecting the connection to the switcher.</para>
/// </summary>
/// <param name="eventType">BMDSwitcherDownstreamKeyEventType that describes the type of event that has occurred.</param>
/// <remarks>Blackmagic Switcher SDK - 5.2.20.1</remarks>
void IBMDSwitcherDownstreamKeyCallback.Notify(_BMDSwitcherDownstreamKeyEventType eventType)
{
switch (eventType)
{
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeInputCutChanged:
this.OnInputCutChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeInputFillChanged:
this.OnInputFillChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeTieChanged:
this.OnTieChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeRateChanged:
this.OnRateChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeOnAirChanged:
this.OnOnAirChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeIsTransitioningChanged:
this.OnIsTransitioningChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeIsAutoTransitioningChanged:
this.OnIsAutoTransitioningChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeIsTransitionTowardsOnAirChanged:
this.OnIsTransitionTowardsOnAIrChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeFramesRemainingChanged:
this.OnFramesRemainingChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypePreMultipliedChanged:
this.OnPreMultipliedChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeClipChanged:
this.OnClipChanged?.Invoke(this);
break;
case _BMDSwitcherDownstreamKeyEventType.bmdSwitcherDownstreamKeyEventTypeGainChanged:
this.OnGainChanged?.Invoke(this);
break;