Audacity 3.2.0
Public Member Functions | Public Attributes | Private Attributes | List of all members
internal::ConnectionProxy Class Referencefinal

Host's proxy object between connection points. More...

#include <ConnectionProxy.h>

Inheritance diagram for internal::ConnectionProxy:
[legend]
Collaboration diagram for internal::ConnectionProxy:
[legend]

Public Member Functions

 ConnectionProxy (Steinberg::Vst::IConnectionPoint *source)
 
virtual ~ConnectionProxy ()
 
Steinberg::tresult PLUGIN_API connect (IConnectionPoint *other) override
 
Steinberg::tresult PLUGIN_API disconnect (IConnectionPoint *other) override
 
Steinberg::tresult PLUGIN_API notify (Steinberg::Vst::IMessage *message) override
 

Public Attributes

 DECLARE_FUNKNOWN_METHODS
 

Private Attributes

std::thread::id mThreadId
 
Steinberg::IPtr< Steinberg::Vst::IConnectionPoint > mSource
 
Steinberg::IPtr< Steinberg::Vst::IConnectionPoint > mTarget
 

Detailed Description

Host's proxy object between connection points.

Though it's not necessary to place proxy, it's recommended to do so. Right now the only "useful" task performed by this proxy is ensuring that messages are sent on the same thread on which proxy object itself was created

Definition at line 24 of file ConnectionProxy.h.

Constructor & Destructor Documentation

◆ ConnectionProxy()

internal::ConnectionProxy::ConnectionProxy ( Steinberg::Vst::IConnectionPoint *  source)

Definition at line 15 of file ConnectionProxy.cpp.

16 : mSource(source)
17{
18 mThreadId = std::this_thread::get_id();
19 FUNKNOWN_CTOR;
20}
Steinberg::IPtr< Steinberg::Vst::IConnectionPoint > mSource

References mThreadId.

◆ ~ConnectionProxy()

internal::ConnectionProxy::~ConnectionProxy ( )
virtual

Definition at line 21 of file ConnectionProxy.cpp.

22{
23 FUNKNOWN_DTOR;
24}

Member Function Documentation

◆ connect()

Steinberg::tresult internal::ConnectionProxy::connect ( IConnectionPoint *  other)
override

Definition at line 26 of file ConnectionProxy.cpp.

27{
28 if(other == nullptr)
29 return Steinberg::kInvalidArgument;
30 if(mTarget.get() != nullptr)
31 return Steinberg::kResultFalse;
32
33 //Looks a bit awkward, but the source can send messages to
34 //the target during connection
35 mTarget = other;
36 auto result = mSource->connect(this);
37 if(result != Steinberg::kResultOk)
38 mTarget = nullptr;
39 return result;
40}
Steinberg::IPtr< Steinberg::Vst::IConnectionPoint > mTarget

◆ disconnect()

Steinberg::tresult internal::ConnectionProxy::disconnect ( IConnectionPoint *  other)
override

Definition at line 42 of file ConnectionProxy.cpp.

43{
44 if(other == nullptr)
45 return Steinberg::kInvalidArgument;
46 if(other != mTarget.get())
47 return Steinberg::kResultFalse;
48
49 auto result = mSource->disconnect(this);
50 if(result == Steinberg::kResultOk)
51 mTarget = nullptr;
52 return result;
53}

◆ notify()

Steinberg::tresult internal::ConnectionProxy::notify ( Steinberg::Vst::IMessage *  message)
override

Definition at line 55 of file ConnectionProxy.cpp.

56{
57 if(mTarget.get() == nullptr ||
58 std::this_thread::get_id() != mThreadId)
59 return Steinberg::kResultFalse;
60
61 return mTarget->notify(message);
62}

Member Data Documentation

◆ DECLARE_FUNKNOWN_METHODS

internal::ConnectionProxy::DECLARE_FUNKNOWN_METHODS

Definition at line 32 of file ConnectionProxy.h.

◆ mSource

Steinberg::IPtr<Steinberg::Vst::IConnectionPoint> internal::ConnectionProxy::mSource
private

Definition at line 28 of file ConnectionProxy.h.

◆ mTarget

Steinberg::IPtr<Steinberg::Vst::IConnectionPoint> internal::ConnectionProxy::mTarget
private

Definition at line 29 of file ConnectionProxy.h.

◆ mThreadId

std::thread::id internal::ConnectionProxy::mThreadId
private

Definition at line 26 of file ConnectionProxy.h.

Referenced by ConnectionProxy().


The documentation for this class was generated from the following files: