Swiftpack.co - Package - Dev1an/Swift-Atem

Swift 4.1 Platforms: macOS & Linux

Atem network protocol implementation

Implementation of BlackMagicDesign's ATEM communication protocol in Swift. It is written on top of Apple's new networking library NIO and implements both sides of the protocol: the control panel and the switcher side. This means that you can not only use it to control atem switchers but also to connect to your control panels without the need for a switcher. Opening a whole new world of applications for the Atem control panels. An example can be found at Atem-Simulator

Tested platforms

  • macOS 10.13.4 on a MacBook Pro retina 15" late 2013
  • Raspbian GNU/Linux 9 stretch on a Raspberry Pi model 3 B

Installation

When starting a new project: create a Swift package via SPM

# Shell
> swift package init # --type empty|library|executable|system-module

Then add this library to the package description's dependencies

.package(url: "https://github.com/Dev1an/Swift-Atem", from: "0.1.0")

And resolve this new dependency

# Shell
> swift package resolve

Finally import the Atem module in your code

import Atem

You are now ready to create atem controllers and switchers 😎 !

Usage

After looking at the following examples, study the API reference for more details.

Controller

This example shows how to create a controller that connects to a swicther at ip address 10.1.0.67 and print a message whenever the preview bus changes.

try Controller(ipAddress: "10.1.0.67") { handler in
    handler.when{ (change: PreviewBusChanged) in
        print(change) // prints: 'Preview bus changed to input(x)'
    }
}

Switcher

The following example shows how to emulate the basic functionality of an atem switcher. It will forward incoming messages containing transition and preview & program bus changes to the connected controller.

try Switcher { handler in
    handler.when { (change: ChangePreviewBus) in
        return [PreviewBusChanged(to: change.previewBus, mixEffect: change.mixEffect)]
    }
    handler.when{ (change: ChangeProgramBus) in
        return [ProgramBusChanged(to: change.programBus, mixEffect: change.mixEffect)]
    }
    handler.when { (change: ChangeTransitionPosition) in
        return [
            TransitionPositionChanged(
                to: change.position,
                remainingFrames: 250 - UInt8(change.position/40),
                mixEffect: change.mixEffect
            )
        ]
    }
}

Github

link
Stars: 3
Help us keep the lights on

Dependencies

Used By

Total:

Releases

0.2.0 - Dec 12, 2018

Add compatibility for the ATEM Software Control 7.5.2 release

0.1.1 - May 31, 2018

0.1.0 - May 31, 2018

Additions:

  • More detailed readme a6824651c41e65658655da76ec1d38e9278e6e75
  • New TallyLight Type 456dca2455f4be88d0ed34fbe5a83d8dd49a6d15
  • New Messages: a4e9366fa08c2c88add0ed429184d904f8e0634b
    • LockRequest
    • LockPositionRequest
    • LockChange
    • LockObtained
    • InitiationComplete
    • SourceTallies

Fixes:

  • Simulator now sends responses to all clients f882724e2c7ef3f48138c1ce43234fdddc5104d4
  • Fix mediaPlayerKey decoding and conform to Hashable 986991df6bdfecc4d7d39c349e72dc31243721cb
  • Remove printing 3bafcf225f005efcb7bf4daf7e43b41a4f0e9fd6

0.0.1 - May 27, 2018