MIDI2LR 6.3.0.1
MIDI2LR is an application that interfaces MIDI controllers with Lightroom 6+/CC Classic. It processes MIDI input into develop parameter updates and photo actions, and sends MIDI output when parameters are changed for motorized feedback (on controllers that have motorized faders). A listing of available LightRoom commands is in the Wiki. Assistance on the code and design is welcome.
Loading...
Searching...
No Matches
LrIpcOutShared Class Reference

Public Member Functions

 LrIpcOutShared (asio::io_context &io_context)
 LrIpcOutShared (asio::io_context &io_context)

Static Private Member Functions

static void SendOut (std::shared_ptr< LrIpcOutShared > lr_ipc_out_shared)
static void SendOut (std::shared_ptr< LrIpcOutShared > lr_ipc_out_shared)

Private Attributes

rsj::ConcurrentQueue< std::string > command_
friend LrIpcOut
std::shared_ptr< std::atomic< bool > > owner_alive_ {std::make_shared<std::atomic<bool>>(true)}
asio::ip::tcp::socket socket_

Constructor & Destructor Documentation

◆ LrIpcOutShared() [1/2]

LrIpcOutShared::LrIpcOutShared ( asio::io_context & io_context)
inlineexplicit
55 : socket_ {asio::make_strand(io_context)}
56 {
57 }
asio::ip::tcp::socket socket_
Definition LR_IPC_Out.cpp:46

◆ LrIpcOutShared() [2/2]

LrIpcOutShared::LrIpcOutShared ( asio::io_context & io_context)
inlineexplicit
55 : socket_ {asio::make_strand(io_context)}
56 {
57 }

Member Function Documentation

◆ SendOut() [1/2]

void LrIpcOutShared::SendOut ( std::shared_ptr< LrIpcOutShared > lr_ipc_out_shared)
staticprivate
278{
279 try {
280 auto command_copy {std::make_shared<std::string>(lr_ipc_out_shared->command_.pop())};
281 if (*command_copy == kTerminate) [[unlikely]] { return; }
282 if (command_copy->empty() || command_copy->back() != '\n') [[unlikely]] {
283 command_copy->push_back('\n');
284 } // ReSharper disable once CppLambdaCaptureNeverUsed
285 asio::async_write(lr_ipc_out_shared->socket_, asio::buffer(*command_copy),
286 [command_copy, lr_ipc_out_shared](const asio::error_code& error, std::size_t) mutable {
287 // check owner token before re-arming
288 const auto alive {lr_ipc_out_shared->owner_alive_};
289 if (!alive || !alive->load(std::memory_order_acquire)) { return; }
290
291 if (!error) [[likely]] { SendOut(std::move(lr_ipc_out_shared)); }
292 else {
293 rsj::Log(fmt::format("LR_IPC_Out Write: {}.", error.message()),
294 std::source_location::current());
295 }
296 });
297 }
298 catch (const std::exception& e) {
299 rsj::ExceptionResponse(e, std::source_location::current());
300 throw;
301 }
302}
rsj::ConcurrentQueue< std::string > command_
Definition LR_IPC_Out.cpp:47
static void SendOut(std::shared_ptr< LrIpcOutShared > lr_ipc_out_shared)
Definition LR_IPC_Out.cpp:277
T pop()
Definition Concurrency.h:190
void ExceptionResponse(gsl::czstring id, gsl::czstring fu, const std::exception &e) noexcept
void Log(const juce::String &info, const std::source_location &location=std::source_location::current()) noexcept
Definition Misc.cpp:112

◆ SendOut() [2/2]

void LrIpcOutShared::SendOut ( std::shared_ptr< LrIpcOutShared > lr_ipc_out_shared)
staticprivate

Member Data Documentation

◆ command_

rsj::ConcurrentQueue< std::string > LrIpcOutShared::command_
private

◆ LrIpcOut

LrIpcOut
private

◆ owner_alive_

std::shared_ptr< std::atomic< bool > > LrIpcOutShared::owner_alive_ {std::make_shared<std::atomic<bool>>(true)}
private
51{std::make_shared<std::atomic<bool>>(true)};

◆ socket_

asio::ip::tcp::socket LrIpcOutShared::socket_
private

The documentation for this class was generated from the following file:
  • C:/Users/rsjaf/source/repos/MIDI2LR/src/application/LR_IPC_Out.cpp