This is re-usable library derived from Elgato's CPU plugin, targetting MacOS and Windows. Linux is also tested in case Elgato expand support in the future.
It is currently based on a version from 2019-05-27. This is:
This library has been bundled with and used by several plugins for since January 2019:
<format>
(polyfilling with fmt) and <filesystem>
(polyfilling with ghc::filesystem
)ESDBasePlugin::DidReceiveGlobalSettings()
ESDBasePlugin::DidReceiveSettings()
ESDBasePlugin::SystemDidWakeUp()
ESDConnectionManager::GetGlobalSettings()
ESDConnectionManager::SetGlobalSettings()
ESDUtilities::GetFileName()
ESDAction
, representing an individual kind of actionESDPlugin
, an ESDBasePlugin
subclass for managing instances of
ESDAction
ESDActionWithExternalState
, representing kinds of actions that
reflect external state, such as hardware state, or state of other
applications like OBS.main()
function; instead, provides
esd_main(int argc, char** argv, ESDBasePlugin* plugin)
; this
gives you more flexibility, and no longer requires your plugin to be defined
as MyStreamDeckPlugin
ESDBasePlugin
methodESDLogger
class, replacing DebugPrint()
ESDLog()
macro for things that should always be logged, including in
release buildsESDDebug()
macro, which is an alias for ESDLog()
in debug builds, and
does nothing in release buildnlohmann::json
is no longer aliased in header filesStreamDeckSDK.cmake
from
the latest releaseinclude()
it in your projectStreamDeckSDK
static library is now available in your project; depending on it
will also make nlohmann/json, websocketpp, and asio available in your project,
including header files.For example:
include("StreamDeckSDK.cmake")
add_executable(
myplugin
MyStreamDeckPlugin.cpp
main.cpp
)
target_link_libraries(myplugin StreamDeckSDK)
To update, replace StreamDeckSDK.cmake
with the newer version and address any
incompatibilities.
This is strongly discouraged; however if it seems necessary:
add_subdirectory('StreamDeckCPPSDK/Vendor')
add_subdirectory('StreamDeckCPPSDK/StreamDeckSDK')
StreamDeckSDK
, asio
, json
, and
websocketpp
targets.A small example is included.
To build, open Windows Terminal, cmd.exe, Apple Terminal, or iTerm, then:
mkdir example/build
cd example/build
cmake ..
cmake --build . --parallel --config Debug
cmake --install . --config Debug
When creating your
manifest.json
, CMakeLists.txt
, and all .cpp and .h files to include your new plugin name and IDs. Your plugin should not contain com.fredemmott
in any file.StreamDeckSDK.cmake
file with the one from
the latest releaseFirst, you need to add a main function; this is usually very short, and looks something like:
#include "MyStreamDeckPlugin.h"
#include <StreamDeckSDK/ESDMain.h>
#include <StreamDeckSDK/ESDLogger.h>
int main(int argc, const char** argv) {
return esd_main(argc, argv, new MyStreamDeckPlugin());
}
You will then need to do several smaller changes:
#include "../Common/Foo.h"
with #include <StreamDeckSDK/Foo.h>
pch.h
DebugPrint()
, replace with #include <StreamDeckSDK/ESDDebug.h>
and call ESDDebug()
instead - or ESDLog()
if you want it in the log files
in release buildsstd::format
-style format strings#include <nlohmann/json.hpp>
when neededusing json = nlohmann::json;
, or replace json
with nlohmann::json
For example, the CPU plugin was ported by:
Additionally, using CMake makes it easy to automatically build on both platforms using GitHub actions.
I make this for my own use, and I share this in the hope others find it useful; I'm not able to commit to support, bug fixes, or feature development.
If you have found a bug or have a feature request, please check GitHub issues to see if it has already been reported, and create a new issue if not.
Support may be available from the community via Discord.
I am not able to respond to 1:1 requests for help via any means, including GitHub, Discord, Twitter, Reddit, or email.
The source code for this project is MIT-licensed.