完善AudioEngine <-> VstHost 流程
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ cmake-build-*/
|
||||
/build
|
||||
/.vs
|
||||
*.DotSettings.user
|
||||
.aider*
|
||||
|
||||
@@ -26,6 +26,9 @@ include(cmake_script/detect_os.cmake)
|
||||
include(cmake_script/plugin_host_register.cmake)
|
||||
include(cmake_script/configure_glfw_native.cmake)
|
||||
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
|
||||
# 使用自定义函数来配置项目的编译选项。
|
||||
# @param STANDARD: 指定C++语言标准,此处为 C++23。
|
||||
# @param INTERFACE_TARGET: 创建一个名为 config_target 的 INTERFACE 目标,
|
||||
@@ -72,3 +75,4 @@ add_subdirectory(src/misc)
|
||||
add_subdirectory(src/vst2_host)
|
||||
add_subdirectory(src/vst3_host)
|
||||
add_subdirectory(src/engine)
|
||||
add_subdirectory(tests)
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// Generated by the gRPC C++ plugin.
|
||||
// If you make any local change, they will be lost.
|
||||
// source: common/domain.proto
|
||||
|
||||
#include "common/domain.pb.h"
|
||||
#include "common/domain.grpc.pb.h"
|
||||
|
||||
#include <functional>
|
||||
#include <grpcpp/support/async_stream.h>
|
||||
#include <grpcpp/support/async_unary_call.h>
|
||||
#include <grpcpp/impl/channel_interface.h>
|
||||
#include <grpcpp/impl/client_unary_call.h>
|
||||
#include <grpcpp/support/client_callback.h>
|
||||
#include <grpcpp/support/message_allocator.h>
|
||||
#include <grpcpp/support/method_handler.h>
|
||||
#include <grpcpp/impl/rpc_service_method.h>
|
||||
#include <grpcpp/support/server_callback.h>
|
||||
#include <grpcpp/impl/server_callback_handlers.h>
|
||||
#include <grpcpp/server_context.h>
|
||||
#include <grpcpp/impl/service_type.h>
|
||||
#include <grpcpp/support/sync_stream.h>
|
||||
namespace daw {
|
||||
namespace common {
|
||||
|
||||
} // namespace daw
|
||||
} // namespace common
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// Generated by the gRPC C++ plugin.
|
||||
// If you make any local change, they will be lost.
|
||||
// source: common/domain.proto
|
||||
#ifndef GRPC_common_2fdomain_2eproto__INCLUDED
|
||||
#define GRPC_common_2fdomain_2eproto__INCLUDED
|
||||
|
||||
#include "common/domain.pb.h"
|
||||
|
||||
#include <functional>
|
||||
#include <grpcpp/generic/async_generic_service.h>
|
||||
#include <grpcpp/support/async_stream.h>
|
||||
#include <grpcpp/support/async_unary_call.h>
|
||||
#include <grpcpp/support/client_callback.h>
|
||||
#include <grpcpp/client_context.h>
|
||||
#include <grpcpp/completion_queue.h>
|
||||
#include <grpcpp/support/message_allocator.h>
|
||||
#include <grpcpp/support/method_handler.h>
|
||||
#include <grpcpp/impl/proto_utils.h>
|
||||
#include <grpcpp/impl/rpc_method.h>
|
||||
#include <grpcpp/support/server_callback.h>
|
||||
#include <grpcpp/impl/server_callback_handlers.h>
|
||||
#include <grpcpp/server_context.h>
|
||||
#include <grpcpp/impl/service_type.h>
|
||||
#include <grpcpp/support/status.h>
|
||||
#include <grpcpp/support/stub_options.h>
|
||||
#include <grpcpp/support/sync_stream.h>
|
||||
#include <grpcpp/ports_def.inc>
|
||||
|
||||
namespace daw {
|
||||
namespace common {
|
||||
|
||||
} // namespace common
|
||||
} // namespace daw
|
||||
|
||||
|
||||
#include <grpcpp/ports_undef.inc>
|
||||
#endif // GRPC_common_2fdomain_2eproto__INCLUDED
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,649 +0,0 @@
|
||||
// Generated by the gRPC C++ plugin.
|
||||
// If you make any local change, they will be lost.
|
||||
// source: ctrl/frontend_to_engine.proto
|
||||
|
||||
#include "ctrl/frontend_to_engine.pb.h"
|
||||
#include "ctrl/frontend_to_engine.grpc.pb.h"
|
||||
|
||||
#include <functional>
|
||||
#include <grpcpp/support/async_stream.h>
|
||||
#include <grpcpp/support/async_unary_call.h>
|
||||
#include <grpcpp/impl/channel_interface.h>
|
||||
#include <grpcpp/impl/client_unary_call.h>
|
||||
#include <grpcpp/support/client_callback.h>
|
||||
#include <grpcpp/support/message_allocator.h>
|
||||
#include <grpcpp/support/method_handler.h>
|
||||
#include <grpcpp/impl/rpc_service_method.h>
|
||||
#include <grpcpp/support/server_callback.h>
|
||||
#include <grpcpp/impl/server_callback_handlers.h>
|
||||
#include <grpcpp/server_context.h>
|
||||
#include <grpcpp/impl/service_type.h>
|
||||
#include <grpcpp/support/sync_stream.h>
|
||||
namespace daw {
|
||||
namespace api {
|
||||
|
||||
static const char* TransportService_method_names[] = {
|
||||
"/daw.api.TransportService/Play",
|
||||
"/daw.api.TransportService/Pause",
|
||||
"/daw.api.TransportService/Stop",
|
||||
"/daw.api.TransportService/SetTempo",
|
||||
};
|
||||
|
||||
std::unique_ptr< TransportService::Stub> TransportService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
|
||||
(void)options;
|
||||
std::unique_ptr< TransportService::Stub> stub(new TransportService::Stub(channel, options));
|
||||
return stub;
|
||||
}
|
||||
|
||||
TransportService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options)
|
||||
: channel_(channel), rpcmethod_Play_(TransportService_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_Pause_(TransportService_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_Stop_(TransportService_method_names[2], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_SetTempo_(TransportService_method_names[3], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
{}
|
||||
|
||||
::grpc::Status TransportService::Stub::Play(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Play_, context, request, response);
|
||||
}
|
||||
|
||||
void TransportService::Stub::async::Play(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Play_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void TransportService::Stub::async::Play(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Play_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TransportService::Stub::PrepareAsyncPlayRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Play_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TransportService::Stub::AsyncPlayRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncPlayRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status TransportService::Stub::Pause(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Pause_, context, request, response);
|
||||
}
|
||||
|
||||
void TransportService::Stub::async::Pause(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Pause_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void TransportService::Stub::async::Pause(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Pause_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TransportService::Stub::PrepareAsyncPauseRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Pause_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TransportService::Stub::AsyncPauseRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncPauseRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status TransportService::Stub::Stop(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Stop_, context, request, response);
|
||||
}
|
||||
|
||||
void TransportService::Stub::async::Stop(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Stop_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void TransportService::Stub::async::Stop(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Stop_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TransportService::Stub::PrepareAsyncStopRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Stop_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TransportService::Stub::AsyncStopRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncStopRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status TransportService::Stub::SetTempo(::grpc::ClientContext* context, const ::daw::api::SetTempoRequest& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::SetTempoRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_SetTempo_, context, request, response);
|
||||
}
|
||||
|
||||
void TransportService::Stub::async::SetTempo(::grpc::ClientContext* context, const ::daw::api::SetTempoRequest* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::SetTempoRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SetTempo_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void TransportService::Stub::async::SetTempo(::grpc::ClientContext* context, const ::daw::api::SetTempoRequest* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SetTempo_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TransportService::Stub::PrepareAsyncSetTempoRaw(::grpc::ClientContext* context, const ::daw::api::SetTempoRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::SetTempoRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_SetTempo_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TransportService::Stub::AsyncSetTempoRaw(::grpc::ClientContext* context, const ::daw::api::SetTempoRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncSetTempoRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
TransportService::Service::Service() {
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
TransportService_method_names[0],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< TransportService::Service, ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](TransportService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::google::protobuf::Empty* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->Play(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
TransportService_method_names[1],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< TransportService::Service, ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](TransportService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::google::protobuf::Empty* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->Pause(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
TransportService_method_names[2],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< TransportService::Service, ::google::protobuf::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](TransportService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::google::protobuf::Empty* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->Stop(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
TransportService_method_names[3],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< TransportService::Service, ::daw::api::SetTempoRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](TransportService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::SetTempoRequest* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->SetTempo(ctx, req, resp);
|
||||
}, this)));
|
||||
}
|
||||
|
||||
TransportService::Service::~Service() {
|
||||
}
|
||||
|
||||
::grpc::Status TransportService::Service::Play(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status TransportService::Service::Pause(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status TransportService::Service::Stop(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status TransportService::Service::SetTempo(::grpc::ServerContext* context, const ::daw::api::SetTempoRequest* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
|
||||
static const char* ProjectService_method_names[] = {
|
||||
"/daw.api.ProjectService/NewProject",
|
||||
"/daw.api.ProjectService/LoadProject",
|
||||
"/daw.api.ProjectService/SaveProject",
|
||||
};
|
||||
|
||||
std::unique_ptr< ProjectService::Stub> ProjectService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
|
||||
(void)options;
|
||||
std::unique_ptr< ProjectService::Stub> stub(new ProjectService::Stub(channel, options));
|
||||
return stub;
|
||||
}
|
||||
|
||||
ProjectService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options)
|
||||
: channel_(channel), rpcmethod_NewProject_(ProjectService_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_LoadProject_(ProjectService_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_SaveProject_(ProjectService_method_names[2], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
{}
|
||||
|
||||
::grpc::Status ProjectService::Stub::NewProject(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::daw::api::ProjectState* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::google::protobuf::Empty, ::daw::api::ProjectState, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_NewProject_, context, request, response);
|
||||
}
|
||||
|
||||
void ProjectService::Stub::async::NewProject(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::daw::api::ProjectState* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::google::protobuf::Empty, ::daw::api::ProjectState, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_NewProject_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void ProjectService::Stub::async::NewProject(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::daw::api::ProjectState* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_NewProject_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::ProjectState>* ProjectService::Stub::PrepareAsyncNewProjectRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::ProjectState, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_NewProject_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::ProjectState>* ProjectService::Stub::AsyncNewProjectRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncNewProjectRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status ProjectService::Stub::LoadProject(::grpc::ClientContext* context, const ::daw::api::LoadProjectRequest& request, ::daw::api::ProjectState* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::LoadProjectRequest, ::daw::api::ProjectState, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_LoadProject_, context, request, response);
|
||||
}
|
||||
|
||||
void ProjectService::Stub::async::LoadProject(::grpc::ClientContext* context, const ::daw::api::LoadProjectRequest* request, ::daw::api::ProjectState* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::LoadProjectRequest, ::daw::api::ProjectState, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_LoadProject_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void ProjectService::Stub::async::LoadProject(::grpc::ClientContext* context, const ::daw::api::LoadProjectRequest* request, ::daw::api::ProjectState* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_LoadProject_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::ProjectState>* ProjectService::Stub::PrepareAsyncLoadProjectRaw(::grpc::ClientContext* context, const ::daw::api::LoadProjectRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::ProjectState, ::daw::api::LoadProjectRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_LoadProject_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::ProjectState>* ProjectService::Stub::AsyncLoadProjectRaw(::grpc::ClientContext* context, const ::daw::api::LoadProjectRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncLoadProjectRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status ProjectService::Stub::SaveProject(::grpc::ClientContext* context, const ::daw::api::SaveProjectRequest& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::SaveProjectRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_SaveProject_, context, request, response);
|
||||
}
|
||||
|
||||
void ProjectService::Stub::async::SaveProject(::grpc::ClientContext* context, const ::daw::api::SaveProjectRequest* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::SaveProjectRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SaveProject_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void ProjectService::Stub::async::SaveProject(::grpc::ClientContext* context, const ::daw::api::SaveProjectRequest* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SaveProject_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* ProjectService::Stub::PrepareAsyncSaveProjectRaw(::grpc::ClientContext* context, const ::daw::api::SaveProjectRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::SaveProjectRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_SaveProject_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* ProjectService::Stub::AsyncSaveProjectRaw(::grpc::ClientContext* context, const ::daw::api::SaveProjectRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncSaveProjectRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
ProjectService::Service::Service() {
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
ProjectService_method_names[0],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< ProjectService::Service, ::google::protobuf::Empty, ::daw::api::ProjectState, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](ProjectService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::google::protobuf::Empty* req,
|
||||
::daw::api::ProjectState* resp) {
|
||||
return service->NewProject(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
ProjectService_method_names[1],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< ProjectService::Service, ::daw::api::LoadProjectRequest, ::daw::api::ProjectState, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](ProjectService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::LoadProjectRequest* req,
|
||||
::daw::api::ProjectState* resp) {
|
||||
return service->LoadProject(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
ProjectService_method_names[2],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< ProjectService::Service, ::daw::api::SaveProjectRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](ProjectService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::SaveProjectRequest* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->SaveProject(ctx, req, resp);
|
||||
}, this)));
|
||||
}
|
||||
|
||||
ProjectService::Service::~Service() {
|
||||
}
|
||||
|
||||
::grpc::Status ProjectService::Service::NewProject(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::daw::api::ProjectState* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status ProjectService::Service::LoadProject(::grpc::ServerContext* context, const ::daw::api::LoadProjectRequest* request, ::daw::api::ProjectState* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status ProjectService::Service::SaveProject(::grpc::ServerContext* context, const ::daw::api::SaveProjectRequest* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
|
||||
static const char* TrackService_method_names[] = {
|
||||
"/daw.api.TrackService/AddTrack",
|
||||
"/daw.api.TrackService/RemoveTrack",
|
||||
"/daw.api.TrackService/SetTrackVolume",
|
||||
"/daw.api.TrackService/SetTrackPan",
|
||||
};
|
||||
|
||||
std::unique_ptr< TrackService::Stub> TrackService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
|
||||
(void)options;
|
||||
std::unique_ptr< TrackService::Stub> stub(new TrackService::Stub(channel, options));
|
||||
return stub;
|
||||
}
|
||||
|
||||
TrackService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options)
|
||||
: channel_(channel), rpcmethod_AddTrack_(TrackService_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_RemoveTrack_(TrackService_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_SetTrackVolume_(TrackService_method_names[2], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_SetTrackPan_(TrackService_method_names[3], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
{}
|
||||
|
||||
::grpc::Status TrackService::Stub::AddTrack(::grpc::ClientContext* context, const ::daw::api::AddTrackRequest& request, ::daw::api::TrackInfo* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::AddTrackRequest, ::daw::api::TrackInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_AddTrack_, context, request, response);
|
||||
}
|
||||
|
||||
void TrackService::Stub::async::AddTrack(::grpc::ClientContext* context, const ::daw::api::AddTrackRequest* request, ::daw::api::TrackInfo* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::AddTrackRequest, ::daw::api::TrackInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_AddTrack_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void TrackService::Stub::async::AddTrack(::grpc::ClientContext* context, const ::daw::api::AddTrackRequest* request, ::daw::api::TrackInfo* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_AddTrack_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::TrackInfo>* TrackService::Stub::PrepareAsyncAddTrackRaw(::grpc::ClientContext* context, const ::daw::api::AddTrackRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::TrackInfo, ::daw::api::AddTrackRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_AddTrack_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::TrackInfo>* TrackService::Stub::AsyncAddTrackRaw(::grpc::ClientContext* context, const ::daw::api::AddTrackRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncAddTrackRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status TrackService::Stub::RemoveTrack(::grpc::ClientContext* context, const ::daw::api::TrackIdRequest& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::TrackIdRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_RemoveTrack_, context, request, response);
|
||||
}
|
||||
|
||||
void TrackService::Stub::async::RemoveTrack(::grpc::ClientContext* context, const ::daw::api::TrackIdRequest* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::TrackIdRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RemoveTrack_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void TrackService::Stub::async::RemoveTrack(::grpc::ClientContext* context, const ::daw::api::TrackIdRequest* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RemoveTrack_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TrackService::Stub::PrepareAsyncRemoveTrackRaw(::grpc::ClientContext* context, const ::daw::api::TrackIdRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::TrackIdRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_RemoveTrack_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TrackService::Stub::AsyncRemoveTrackRaw(::grpc::ClientContext* context, const ::daw::api::TrackIdRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncRemoveTrackRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status TrackService::Stub::SetTrackVolume(::grpc::ClientContext* context, const ::daw::api::SetTrackVolumeRequest& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::SetTrackVolumeRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_SetTrackVolume_, context, request, response);
|
||||
}
|
||||
|
||||
void TrackService::Stub::async::SetTrackVolume(::grpc::ClientContext* context, const ::daw::api::SetTrackVolumeRequest* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::SetTrackVolumeRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SetTrackVolume_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void TrackService::Stub::async::SetTrackVolume(::grpc::ClientContext* context, const ::daw::api::SetTrackVolumeRequest* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SetTrackVolume_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TrackService::Stub::PrepareAsyncSetTrackVolumeRaw(::grpc::ClientContext* context, const ::daw::api::SetTrackVolumeRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::SetTrackVolumeRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_SetTrackVolume_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TrackService::Stub::AsyncSetTrackVolumeRaw(::grpc::ClientContext* context, const ::daw::api::SetTrackVolumeRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncSetTrackVolumeRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status TrackService::Stub::SetTrackPan(::grpc::ClientContext* context, const ::daw::api::SetTrackPanRequest& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::SetTrackPanRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_SetTrackPan_, context, request, response);
|
||||
}
|
||||
|
||||
void TrackService::Stub::async::SetTrackPan(::grpc::ClientContext* context, const ::daw::api::SetTrackPanRequest* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::SetTrackPanRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SetTrackPan_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void TrackService::Stub::async::SetTrackPan(::grpc::ClientContext* context, const ::daw::api::SetTrackPanRequest* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SetTrackPan_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TrackService::Stub::PrepareAsyncSetTrackPanRaw(::grpc::ClientContext* context, const ::daw::api::SetTrackPanRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::SetTrackPanRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_SetTrackPan_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* TrackService::Stub::AsyncSetTrackPanRaw(::grpc::ClientContext* context, const ::daw::api::SetTrackPanRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncSetTrackPanRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
TrackService::Service::Service() {
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
TrackService_method_names[0],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< TrackService::Service, ::daw::api::AddTrackRequest, ::daw::api::TrackInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](TrackService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::AddTrackRequest* req,
|
||||
::daw::api::TrackInfo* resp) {
|
||||
return service->AddTrack(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
TrackService_method_names[1],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< TrackService::Service, ::daw::api::TrackIdRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](TrackService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::TrackIdRequest* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->RemoveTrack(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
TrackService_method_names[2],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< TrackService::Service, ::daw::api::SetTrackVolumeRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](TrackService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::SetTrackVolumeRequest* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->SetTrackVolume(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
TrackService_method_names[3],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< TrackService::Service, ::daw::api::SetTrackPanRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](TrackService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::SetTrackPanRequest* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->SetTrackPan(ctx, req, resp);
|
||||
}, this)));
|
||||
}
|
||||
|
||||
TrackService::Service::~Service() {
|
||||
}
|
||||
|
||||
::grpc::Status TrackService::Service::AddTrack(::grpc::ServerContext* context, const ::daw::api::AddTrackRequest* request, ::daw::api::TrackInfo* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status TrackService::Service::RemoveTrack(::grpc::ServerContext* context, const ::daw::api::TrackIdRequest* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status TrackService::Service::SetTrackVolume(::grpc::ServerContext* context, const ::daw::api::SetTrackVolumeRequest* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status TrackService::Service::SetTrackPan(::grpc::ServerContext* context, const ::daw::api::SetTrackPanRequest* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
|
||||
static const char* PluginService_method_names[] = {
|
||||
"/daw.api.PluginService/LoadPlugin",
|
||||
"/daw.api.PluginService/SetPluginParameter",
|
||||
};
|
||||
|
||||
std::unique_ptr< PluginService::Stub> PluginService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
|
||||
(void)options;
|
||||
std::unique_ptr< PluginService::Stub> stub(new PluginService::Stub(channel, options));
|
||||
return stub;
|
||||
}
|
||||
|
||||
PluginService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options)
|
||||
: channel_(channel), rpcmethod_LoadPlugin_(PluginService_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_SetPluginParameter_(PluginService_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
{}
|
||||
|
||||
::grpc::Status PluginService::Stub::LoadPlugin(::grpc::ClientContext* context, const ::daw::api::LoadPluginRequest& request, ::daw::api::PluginInfo* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::LoadPluginRequest, ::daw::api::PluginInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_LoadPlugin_, context, request, response);
|
||||
}
|
||||
|
||||
void PluginService::Stub::async::LoadPlugin(::grpc::ClientContext* context, const ::daw::api::LoadPluginRequest* request, ::daw::api::PluginInfo* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::LoadPluginRequest, ::daw::api::PluginInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_LoadPlugin_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void PluginService::Stub::async::LoadPlugin(::grpc::ClientContext* context, const ::daw::api::LoadPluginRequest* request, ::daw::api::PluginInfo* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_LoadPlugin_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::PluginInfo>* PluginService::Stub::PrepareAsyncLoadPluginRaw(::grpc::ClientContext* context, const ::daw::api::LoadPluginRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::PluginInfo, ::daw::api::LoadPluginRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_LoadPlugin_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::PluginInfo>* PluginService::Stub::AsyncLoadPluginRaw(::grpc::ClientContext* context, const ::daw::api::LoadPluginRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncLoadPluginRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
::grpc::Status PluginService::Stub::SetPluginParameter(::grpc::ClientContext* context, const ::daw::api::SetPluginParameterRequest& request, ::daw::api::StatusResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::daw::api::SetPluginParameterRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_SetPluginParameter_, context, request, response);
|
||||
}
|
||||
|
||||
void PluginService::Stub::async::SetPluginParameter(::grpc::ClientContext* context, const ::daw::api::SetPluginParameterRequest* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::daw::api::SetPluginParameterRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SetPluginParameter_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void PluginService::Stub::async::SetPluginParameter(::grpc::ClientContext* context, const ::daw::api::SetPluginParameterRequest* request, ::daw::api::StatusResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_SetPluginParameter_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* PluginService::Stub::PrepareAsyncSetPluginParameterRaw(::grpc::ClientContext* context, const ::daw::api::SetPluginParameterRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::SetPluginParameterRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_SetPluginParameter_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::daw::api::StatusResponse>* PluginService::Stub::AsyncSetPluginParameterRaw(::grpc::ClientContext* context, const ::daw::api::SetPluginParameterRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncSetPluginParameterRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
PluginService::Service::Service() {
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
PluginService_method_names[0],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< PluginService::Service, ::daw::api::LoadPluginRequest, ::daw::api::PluginInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](PluginService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::LoadPluginRequest* req,
|
||||
::daw::api::PluginInfo* resp) {
|
||||
return service->LoadPlugin(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
PluginService_method_names[1],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< PluginService::Service, ::daw::api::SetPluginParameterRequest, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](PluginService::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::daw::api::SetPluginParameterRequest* req,
|
||||
::daw::api::StatusResponse* resp) {
|
||||
return service->SetPluginParameter(ctx, req, resp);
|
||||
}, this)));
|
||||
}
|
||||
|
||||
PluginService::Service::~Service() {
|
||||
}
|
||||
|
||||
::grpc::Status PluginService::Service::LoadPlugin(::grpc::ServerContext* context, const ::daw::api::LoadPluginRequest* request, ::daw::api::PluginInfo* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status PluginService::Service::SetPluginParameter(::grpc::ServerContext* context, const ::daw::api::SetPluginParameterRequest* request, ::daw::api::StatusResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
|
||||
} // namespace daw
|
||||
} // namespace api
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
// Generated by the gRPC C++ plugin.
|
||||
// If you make any local change, they will be lost.
|
||||
// source: rt/rt_envelope.proto
|
||||
|
||||
#include "rt/rt_envelope.pb.h"
|
||||
#include "rt/rt_envelope.grpc.pb.h"
|
||||
|
||||
#include <functional>
|
||||
#include <grpcpp/support/async_stream.h>
|
||||
#include <grpcpp/support/async_unary_call.h>
|
||||
#include <grpcpp/impl/channel_interface.h>
|
||||
#include <grpcpp/impl/client_unary_call.h>
|
||||
#include <grpcpp/support/client_callback.h>
|
||||
#include <grpcpp/support/message_allocator.h>
|
||||
#include <grpcpp/support/method_handler.h>
|
||||
#include <grpcpp/impl/rpc_service_method.h>
|
||||
#include <grpcpp/support/server_callback.h>
|
||||
#include <grpcpp/impl/server_callback_handlers.h>
|
||||
#include <grpcpp/server_context.h>
|
||||
#include <grpcpp/impl/service_type.h>
|
||||
#include <grpcpp/support/sync_stream.h>
|
||||
namespace daw {
|
||||
namespace rt {
|
||||
|
||||
} // namespace daw
|
||||
} // namespace rt
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// Generated by the gRPC C++ plugin.
|
||||
// If you make any local change, they will be lost.
|
||||
// source: rt/rt_envelope.proto
|
||||
#ifndef GRPC_rt_2frt_5fenvelope_2eproto__INCLUDED
|
||||
#define GRPC_rt_2frt_5fenvelope_2eproto__INCLUDED
|
||||
|
||||
#include "rt/rt_envelope.pb.h"
|
||||
|
||||
#include <functional>
|
||||
#include <grpcpp/generic/async_generic_service.h>
|
||||
#include <grpcpp/support/async_stream.h>
|
||||
#include <grpcpp/support/async_unary_call.h>
|
||||
#include <grpcpp/support/client_callback.h>
|
||||
#include <grpcpp/client_context.h>
|
||||
#include <grpcpp/completion_queue.h>
|
||||
#include <grpcpp/support/message_allocator.h>
|
||||
#include <grpcpp/support/method_handler.h>
|
||||
#include <grpcpp/impl/proto_utils.h>
|
||||
#include <grpcpp/impl/rpc_method.h>
|
||||
#include <grpcpp/support/server_callback.h>
|
||||
#include <grpcpp/impl/server_callback_handlers.h>
|
||||
#include <grpcpp/server_context.h>
|
||||
#include <grpcpp/impl/service_type.h>
|
||||
#include <grpcpp/support/status.h>
|
||||
#include <grpcpp/support/stub_options.h>
|
||||
#include <grpcpp/support/sync_stream.h>
|
||||
#include <grpcpp/ports_def.inc>
|
||||
|
||||
namespace daw {
|
||||
namespace rt {
|
||||
|
||||
} // namespace rt
|
||||
} // namespace daw
|
||||
|
||||
|
||||
#include <grpcpp/ports_undef.inc>
|
||||
#endif // GRPC_rt_2frt_5fenvelope_2eproto__INCLUDED
|
||||
@@ -1,630 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// NO CHECKED-IN PROTOBUF GENCODE
|
||||
// source: rt/rt_envelope.proto
|
||||
// Protobuf C++ Version: 5.29.3
|
||||
|
||||
#include "rt/rt_envelope.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
#include "google/protobuf/io/coded_stream.h"
|
||||
#include "google/protobuf/generated_message_tctable_impl.h"
|
||||
#include "google/protobuf/extension_set.h"
|
||||
#include "google/protobuf/generated_message_util.h"
|
||||
#include "google/protobuf/wire_format_lite.h"
|
||||
#include "google/protobuf/descriptor.h"
|
||||
#include "google/protobuf/generated_message_reflection.h"
|
||||
#include "google/protobuf/reflection_ops.h"
|
||||
#include "google/protobuf/wire_format.h"
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
// Must be included last.
|
||||
#include "google/protobuf/port_def.inc"
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
namespace _pb = ::google::protobuf;
|
||||
namespace _pbi = ::google::protobuf::internal;
|
||||
namespace _fl = ::google::protobuf::internal::field_layout;
|
||||
namespace daw {
|
||||
namespace rt {
|
||||
|
||||
inline constexpr RTEnvelope::Impl_::Impl_(
|
||||
::_pbi::ConstantInitialized) noexcept
|
||||
: seq_{::uint64_t{0u}},
|
||||
timestamp_us_{::uint64_t{0u}},
|
||||
payload_{},
|
||||
_cached_size_{0},
|
||||
_oneof_case_{} {}
|
||||
|
||||
template <typename>
|
||||
PROTOBUF_CONSTEXPR RTEnvelope::RTEnvelope(::_pbi::ConstantInitialized)
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
: ::google::protobuf::Message(_class_data_.base()),
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
: ::google::protobuf::Message(),
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
_impl_(::_pbi::ConstantInitialized()) {
|
||||
}
|
||||
struct RTEnvelopeDefaultTypeInternal {
|
||||
PROTOBUF_CONSTEXPR RTEnvelopeDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {}
|
||||
~RTEnvelopeDefaultTypeInternal() {}
|
||||
union {
|
||||
RTEnvelope _instance;
|
||||
};
|
||||
};
|
||||
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 RTEnvelopeDefaultTypeInternal _RTEnvelope_default_instance_;
|
||||
} // namespace rt
|
||||
} // namespace daw
|
||||
static constexpr const ::_pb::EnumDescriptor**
|
||||
file_level_enum_descriptors_rt_2frt_5fenvelope_2eproto = nullptr;
|
||||
static constexpr const ::_pb::ServiceDescriptor**
|
||||
file_level_service_descriptors_rt_2frt_5fenvelope_2eproto = nullptr;
|
||||
const ::uint32_t
|
||||
TableStruct_rt_2frt_5fenvelope_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
|
||||
protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::daw::rt::RTEnvelope, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
PROTOBUF_FIELD_OFFSET(::daw::rt::RTEnvelope, _impl_._oneof_case_[0]),
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
~0u, // no _split_
|
||||
~0u, // no sizeof(Split)
|
||||
PROTOBUF_FIELD_OFFSET(::daw::rt::RTEnvelope, _impl_.seq_),
|
||||
PROTOBUF_FIELD_OFFSET(::daw::rt::RTEnvelope, _impl_.timestamp_us_),
|
||||
::_pbi::kInvalidFieldOffsetTag,
|
||||
::_pbi::kInvalidFieldOffsetTag,
|
||||
::_pbi::kInvalidFieldOffsetTag,
|
||||
PROTOBUF_FIELD_OFFSET(::daw::rt::RTEnvelope, _impl_.payload_),
|
||||
};
|
||||
|
||||
static const ::_pbi::MigrationSchema
|
||||
schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{0, -1, -1, sizeof(::daw::rt::RTEnvelope)},
|
||||
};
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::daw::rt::_RTEnvelope_default_instance_._instance,
|
||||
};
|
||||
const char descriptor_table_protodef_rt_2frt_5fenvelope_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
|
||||
protodesc_cold) = {
|
||||
"\n\024rt/rt_envelope.proto\022\006daw.rt\032\023common/d"
|
||||
"omain.proto\"\310\001\n\nRTEnvelope\022\013\n\003seq\030\001 \001(\004\022"
|
||||
"\024\n\014timestamp_us\030\002 \001(\004\0223\n\014param_change\030\n "
|
||||
"\001(\0132\033.daw.common.ParameterChangeH\000\022%\n\004mi"
|
||||
"di\030\013 \001(\0132\025.daw.common.MidiEventH\000\0220\n\nbuf"
|
||||
"fer_ref\030\014 \001(\0132\032.daw.common.AudioBufferRe"
|
||||
"fH\000B\t\n\007payloadb\006proto3"
|
||||
};
|
||||
static const ::_pbi::DescriptorTable* const descriptor_table_rt_2frt_5fenvelope_2eproto_deps[1] =
|
||||
{
|
||||
&::descriptor_table_common_2fdomain_2eproto,
|
||||
};
|
||||
static ::absl::once_flag descriptor_table_rt_2frt_5fenvelope_2eproto_once;
|
||||
PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_rt_2frt_5fenvelope_2eproto = {
|
||||
false,
|
||||
false,
|
||||
262,
|
||||
descriptor_table_protodef_rt_2frt_5fenvelope_2eproto,
|
||||
"rt/rt_envelope.proto",
|
||||
&descriptor_table_rt_2frt_5fenvelope_2eproto_once,
|
||||
descriptor_table_rt_2frt_5fenvelope_2eproto_deps,
|
||||
1,
|
||||
1,
|
||||
schemas,
|
||||
file_default_instances,
|
||||
TableStruct_rt_2frt_5fenvelope_2eproto::offsets,
|
||||
file_level_enum_descriptors_rt_2frt_5fenvelope_2eproto,
|
||||
file_level_service_descriptors_rt_2frt_5fenvelope_2eproto,
|
||||
};
|
||||
namespace daw {
|
||||
namespace rt {
|
||||
// ===================================================================
|
||||
|
||||
class RTEnvelope::_Internal {
|
||||
public:
|
||||
static constexpr ::int32_t kOneofCaseOffset =
|
||||
PROTOBUF_FIELD_OFFSET(::daw::rt::RTEnvelope, _impl_._oneof_case_);
|
||||
};
|
||||
|
||||
void RTEnvelope::set_allocated_param_change(::daw::common::ParameterChange* param_change) {
|
||||
::google::protobuf::Arena* message_arena = GetArena();
|
||||
clear_payload();
|
||||
if (param_change) {
|
||||
::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(param_change)->GetArena();
|
||||
if (message_arena != submessage_arena) {
|
||||
param_change = ::google::protobuf::internal::GetOwnedMessage(message_arena, param_change, submessage_arena);
|
||||
}
|
||||
set_has_param_change();
|
||||
_impl_.payload_.param_change_ = param_change;
|
||||
}
|
||||
// @@protoc_insertion_point(field_set_allocated:daw.rt.RTEnvelope.param_change)
|
||||
}
|
||||
void RTEnvelope::clear_param_change() {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
if (payload_case() == kParamChange) {
|
||||
if (GetArena() == nullptr) {
|
||||
delete _impl_.payload_.param_change_;
|
||||
} else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) {
|
||||
::google::protobuf::internal::MaybePoisonAfterClear(_impl_.payload_.param_change_);
|
||||
}
|
||||
clear_has_payload();
|
||||
}
|
||||
}
|
||||
void RTEnvelope::set_allocated_midi(::daw::common::MidiEvent* midi) {
|
||||
::google::protobuf::Arena* message_arena = GetArena();
|
||||
clear_payload();
|
||||
if (midi) {
|
||||
::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(midi)->GetArena();
|
||||
if (message_arena != submessage_arena) {
|
||||
midi = ::google::protobuf::internal::GetOwnedMessage(message_arena, midi, submessage_arena);
|
||||
}
|
||||
set_has_midi();
|
||||
_impl_.payload_.midi_ = midi;
|
||||
}
|
||||
// @@protoc_insertion_point(field_set_allocated:daw.rt.RTEnvelope.midi)
|
||||
}
|
||||
void RTEnvelope::clear_midi() {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
if (payload_case() == kMidi) {
|
||||
if (GetArena() == nullptr) {
|
||||
delete _impl_.payload_.midi_;
|
||||
} else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) {
|
||||
::google::protobuf::internal::MaybePoisonAfterClear(_impl_.payload_.midi_);
|
||||
}
|
||||
clear_has_payload();
|
||||
}
|
||||
}
|
||||
void RTEnvelope::set_allocated_buffer_ref(::daw::common::AudioBufferRef* buffer_ref) {
|
||||
::google::protobuf::Arena* message_arena = GetArena();
|
||||
clear_payload();
|
||||
if (buffer_ref) {
|
||||
::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(buffer_ref)->GetArena();
|
||||
if (message_arena != submessage_arena) {
|
||||
buffer_ref = ::google::protobuf::internal::GetOwnedMessage(message_arena, buffer_ref, submessage_arena);
|
||||
}
|
||||
set_has_buffer_ref();
|
||||
_impl_.payload_.buffer_ref_ = buffer_ref;
|
||||
}
|
||||
// @@protoc_insertion_point(field_set_allocated:daw.rt.RTEnvelope.buffer_ref)
|
||||
}
|
||||
void RTEnvelope::clear_buffer_ref() {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
if (payload_case() == kBufferRef) {
|
||||
if (GetArena() == nullptr) {
|
||||
delete _impl_.payload_.buffer_ref_;
|
||||
} else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) {
|
||||
::google::protobuf::internal::MaybePoisonAfterClear(_impl_.payload_.buffer_ref_);
|
||||
}
|
||||
clear_has_payload();
|
||||
}
|
||||
}
|
||||
RTEnvelope::RTEnvelope(::google::protobuf::Arena* arena)
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
: ::google::protobuf::Message(arena, _class_data_.base()) {
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
: ::google::protobuf::Message(arena) {
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
SharedCtor(arena);
|
||||
// @@protoc_insertion_point(arena_constructor:daw.rt.RTEnvelope)
|
||||
}
|
||||
inline PROTOBUF_NDEBUG_INLINE RTEnvelope::Impl_::Impl_(
|
||||
::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena,
|
||||
const Impl_& from, const ::daw::rt::RTEnvelope& from_msg)
|
||||
: payload_{},
|
||||
_cached_size_{0},
|
||||
_oneof_case_{from._oneof_case_[0]} {}
|
||||
|
||||
RTEnvelope::RTEnvelope(
|
||||
::google::protobuf::Arena* arena,
|
||||
const RTEnvelope& from)
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
: ::google::protobuf::Message(arena, _class_data_.base()) {
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
: ::google::protobuf::Message(arena) {
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
RTEnvelope* const _this = this;
|
||||
(void)_this;
|
||||
_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
|
||||
from._internal_metadata_);
|
||||
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from);
|
||||
::memcpy(reinterpret_cast<char *>(&_impl_) +
|
||||
offsetof(Impl_, seq_),
|
||||
reinterpret_cast<const char *>(&from._impl_) +
|
||||
offsetof(Impl_, seq_),
|
||||
offsetof(Impl_, timestamp_us_) -
|
||||
offsetof(Impl_, seq_) +
|
||||
sizeof(Impl_::timestamp_us_));
|
||||
switch (payload_case()) {
|
||||
case PAYLOAD_NOT_SET:
|
||||
break;
|
||||
case kParamChange:
|
||||
_impl_.payload_.param_change_ = ::google::protobuf::Message::CopyConstruct<::daw::common::ParameterChange>(arena, *from._impl_.payload_.param_change_);
|
||||
break;
|
||||
case kMidi:
|
||||
_impl_.payload_.midi_ = ::google::protobuf::Message::CopyConstruct<::daw::common::MidiEvent>(arena, *from._impl_.payload_.midi_);
|
||||
break;
|
||||
case kBufferRef:
|
||||
_impl_.payload_.buffer_ref_ = ::google::protobuf::Message::CopyConstruct<::daw::common::AudioBufferRef>(arena, *from._impl_.payload_.buffer_ref_);
|
||||
break;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(copy_constructor:daw.rt.RTEnvelope)
|
||||
}
|
||||
inline PROTOBUF_NDEBUG_INLINE RTEnvelope::Impl_::Impl_(
|
||||
::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* arena)
|
||||
: payload_{},
|
||||
_cached_size_{0},
|
||||
_oneof_case_{} {}
|
||||
|
||||
inline void RTEnvelope::SharedCtor(::_pb::Arena* arena) {
|
||||
new (&_impl_) Impl_(internal_visibility(), arena);
|
||||
::memset(reinterpret_cast<char *>(&_impl_) +
|
||||
offsetof(Impl_, seq_),
|
||||
0,
|
||||
offsetof(Impl_, timestamp_us_) -
|
||||
offsetof(Impl_, seq_) +
|
||||
sizeof(Impl_::timestamp_us_));
|
||||
}
|
||||
RTEnvelope::~RTEnvelope() {
|
||||
// @@protoc_insertion_point(destructor:daw.rt.RTEnvelope)
|
||||
SharedDtor(*this);
|
||||
}
|
||||
inline void RTEnvelope::SharedDtor(MessageLite& self) {
|
||||
RTEnvelope& this_ = static_cast<RTEnvelope&>(self);
|
||||
this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>();
|
||||
ABSL_DCHECK(this_.GetArena() == nullptr);
|
||||
if (this_.has_payload()) {
|
||||
this_.clear_payload();
|
||||
}
|
||||
this_._impl_.~Impl_();
|
||||
}
|
||||
|
||||
void RTEnvelope::clear_payload() {
|
||||
// @@protoc_insertion_point(one_of_clear_start:daw.rt.RTEnvelope)
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
switch (payload_case()) {
|
||||
case kParamChange: {
|
||||
if (GetArena() == nullptr) {
|
||||
delete _impl_.payload_.param_change_;
|
||||
} else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) {
|
||||
::google::protobuf::internal::MaybePoisonAfterClear(_impl_.payload_.param_change_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kMidi: {
|
||||
if (GetArena() == nullptr) {
|
||||
delete _impl_.payload_.midi_;
|
||||
} else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) {
|
||||
::google::protobuf::internal::MaybePoisonAfterClear(_impl_.payload_.midi_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kBufferRef: {
|
||||
if (GetArena() == nullptr) {
|
||||
delete _impl_.payload_.buffer_ref_;
|
||||
} else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) {
|
||||
::google::protobuf::internal::MaybePoisonAfterClear(_impl_.payload_.buffer_ref_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PAYLOAD_NOT_SET: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
_impl_._oneof_case_[0] = PAYLOAD_NOT_SET;
|
||||
}
|
||||
|
||||
|
||||
inline void* RTEnvelope::PlacementNew_(const void*, void* mem,
|
||||
::google::protobuf::Arena* arena) {
|
||||
return ::new (mem) RTEnvelope(arena);
|
||||
}
|
||||
constexpr auto RTEnvelope::InternalNewImpl_() {
|
||||
return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(RTEnvelope),
|
||||
alignof(RTEnvelope));
|
||||
}
|
||||
PROTOBUF_CONSTINIT
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
|
||||
const ::google::protobuf::internal::ClassDataFull RTEnvelope::_class_data_ = {
|
||||
::google::protobuf::internal::ClassData{
|
||||
&_RTEnvelope_default_instance_._instance,
|
||||
&_table_.header,
|
||||
nullptr, // OnDemandRegisterArenaDtor
|
||||
nullptr, // IsInitialized
|
||||
&RTEnvelope::MergeImpl,
|
||||
::google::protobuf::Message::GetNewImpl<RTEnvelope>(),
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
&RTEnvelope::SharedDtor,
|
||||
::google::protobuf::Message::GetClearImpl<RTEnvelope>(), &RTEnvelope::ByteSizeLong,
|
||||
&RTEnvelope::_InternalSerialize,
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_._cached_size_),
|
||||
false,
|
||||
},
|
||||
&RTEnvelope::kDescriptorMethods,
|
||||
&descriptor_table_rt_2frt_5fenvelope_2eproto,
|
||||
nullptr, // tracker
|
||||
};
|
||||
const ::google::protobuf::internal::ClassData* RTEnvelope::GetClassData() const {
|
||||
::google::protobuf::internal::PrefetchToLocalCache(&_class_data_);
|
||||
::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table);
|
||||
return _class_data_.base();
|
||||
}
|
||||
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
|
||||
const ::_pbi::TcParseTable<1, 5, 3, 0, 2> RTEnvelope::_table_ = {
|
||||
{
|
||||
0, // no _has_bits_
|
||||
0, // no _extensions_
|
||||
12, 8, // max_field_number, fast_idx_mask
|
||||
offsetof(decltype(_table_), field_lookup_table),
|
||||
4294963708, // skipmap
|
||||
offsetof(decltype(_table_), field_entries),
|
||||
5, // num_field_entries
|
||||
3, // num_aux_entries
|
||||
offsetof(decltype(_table_), aux_entries),
|
||||
_class_data_.base(),
|
||||
nullptr, // post_loop_handler
|
||||
::_pbi::TcParser::GenericFallback, // fallback
|
||||
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE
|
||||
::_pbi::TcParser::GetTable<::daw::rt::RTEnvelope>(), // to_prefetch
|
||||
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
||||
}, {{
|
||||
// uint64 timestamp_us = 2;
|
||||
{::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(RTEnvelope, _impl_.timestamp_us_), 63>(),
|
||||
{16, 63, 0, PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.timestamp_us_)}},
|
||||
// uint64 seq = 1;
|
||||
{::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(RTEnvelope, _impl_.seq_), 63>(),
|
||||
{8, 63, 0, PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.seq_)}},
|
||||
}}, {{
|
||||
65535, 65535
|
||||
}}, {{
|
||||
// uint64 seq = 1;
|
||||
{PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.seq_), 0, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
|
||||
// uint64 timestamp_us = 2;
|
||||
{PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.timestamp_us_), 0, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
|
||||
// .daw.common.ParameterChange param_change = 10;
|
||||
{PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.payload_.param_change_), _Internal::kOneofCaseOffset + 0, 0,
|
||||
(0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)},
|
||||
// .daw.common.MidiEvent midi = 11;
|
||||
{PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.payload_.midi_), _Internal::kOneofCaseOffset + 0, 1,
|
||||
(0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)},
|
||||
// .daw.common.AudioBufferRef buffer_ref = 12;
|
||||
{PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.payload_.buffer_ref_), _Internal::kOneofCaseOffset + 0, 2,
|
||||
(0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)},
|
||||
}}, {{
|
||||
{::_pbi::TcParser::GetTable<::daw::common::ParameterChange>()},
|
||||
{::_pbi::TcParser::GetTable<::daw::common::MidiEvent>()},
|
||||
{::_pbi::TcParser::GetTable<::daw::common::AudioBufferRef>()},
|
||||
}}, {{
|
||||
}},
|
||||
};
|
||||
|
||||
PROTOBUF_NOINLINE void RTEnvelope::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:daw.rt.RTEnvelope)
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
::uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
::memset(&_impl_.seq_, 0, static_cast<::size_t>(
|
||||
reinterpret_cast<char*>(&_impl_.timestamp_us_) -
|
||||
reinterpret_cast<char*>(&_impl_.seq_)) + sizeof(_impl_.timestamp_us_));
|
||||
clear_payload();
|
||||
_internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
::uint8_t* RTEnvelope::_InternalSerialize(
|
||||
const MessageLite& base, ::uint8_t* target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* stream) {
|
||||
const RTEnvelope& this_ = static_cast<const RTEnvelope&>(base);
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
::uint8_t* RTEnvelope::_InternalSerialize(
|
||||
::uint8_t* target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* stream) const {
|
||||
const RTEnvelope& this_ = *this;
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
// @@protoc_insertion_point(serialize_to_array_start:daw.rt.RTEnvelope)
|
||||
::uint32_t cached_has_bits = 0;
|
||||
(void)cached_has_bits;
|
||||
|
||||
// uint64 seq = 1;
|
||||
if (this_._internal_seq() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(
|
||||
1, this_._internal_seq(), target);
|
||||
}
|
||||
|
||||
// uint64 timestamp_us = 2;
|
||||
if (this_._internal_timestamp_us() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(
|
||||
2, this_._internal_timestamp_us(), target);
|
||||
}
|
||||
|
||||
switch (this_.payload_case()) {
|
||||
case kParamChange: {
|
||||
target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage(
|
||||
10, *this_._impl_.payload_.param_change_, this_._impl_.payload_.param_change_->GetCachedSize(), target,
|
||||
stream);
|
||||
break;
|
||||
}
|
||||
case kMidi: {
|
||||
target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage(
|
||||
11, *this_._impl_.payload_.midi_, this_._impl_.payload_.midi_->GetCachedSize(), target,
|
||||
stream);
|
||||
break;
|
||||
}
|
||||
case kBufferRef: {
|
||||
target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage(
|
||||
12, *this_._impl_.payload_.buffer_ref_, this_._impl_.payload_.buffer_ref_->GetCachedSize(), target,
|
||||
stream);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) {
|
||||
target =
|
||||
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:daw.rt.RTEnvelope)
|
||||
return target;
|
||||
}
|
||||
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
::size_t RTEnvelope::ByteSizeLong(const MessageLite& base) {
|
||||
const RTEnvelope& this_ = static_cast<const RTEnvelope&>(base);
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
::size_t RTEnvelope::ByteSizeLong() const {
|
||||
const RTEnvelope& this_ = *this;
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
// @@protoc_insertion_point(message_byte_size_start:daw.rt.RTEnvelope)
|
||||
::size_t total_size = 0;
|
||||
|
||||
::uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void)cached_has_bits;
|
||||
|
||||
::_pbi::Prefetch5LinesFrom7Lines(&this_);
|
||||
{
|
||||
// uint64 seq = 1;
|
||||
if (this_._internal_seq() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(
|
||||
this_._internal_seq());
|
||||
}
|
||||
// uint64 timestamp_us = 2;
|
||||
if (this_._internal_timestamp_us() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(
|
||||
this_._internal_timestamp_us());
|
||||
}
|
||||
}
|
||||
switch (this_.payload_case()) {
|
||||
// .daw.common.ParameterChange param_change = 10;
|
||||
case kParamChange: {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.payload_.param_change_);
|
||||
break;
|
||||
}
|
||||
// .daw.common.MidiEvent midi = 11;
|
||||
case kMidi: {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.payload_.midi_);
|
||||
break;
|
||||
}
|
||||
// .daw.common.AudioBufferRef buffer_ref = 12;
|
||||
case kBufferRef: {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.payload_.buffer_ref_);
|
||||
break;
|
||||
}
|
||||
case PAYLOAD_NOT_SET: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this_.MaybeComputeUnknownFieldsSize(total_size,
|
||||
&this_._impl_._cached_size_);
|
||||
}
|
||||
|
||||
void RTEnvelope::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) {
|
||||
auto* const _this = static_cast<RTEnvelope*>(&to_msg);
|
||||
auto& from = static_cast<const RTEnvelope&>(from_msg);
|
||||
::google::protobuf::Arena* arena = _this->GetArena();
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:daw.rt.RTEnvelope)
|
||||
ABSL_DCHECK_NE(&from, _this);
|
||||
::uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_seq() != 0) {
|
||||
_this->_impl_.seq_ = from._impl_.seq_;
|
||||
}
|
||||
if (from._internal_timestamp_us() != 0) {
|
||||
_this->_impl_.timestamp_us_ = from._impl_.timestamp_us_;
|
||||
}
|
||||
if (const uint32_t oneof_from_case = from._impl_._oneof_case_[0]) {
|
||||
const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0];
|
||||
const bool oneof_needs_init = oneof_to_case != oneof_from_case;
|
||||
if (oneof_needs_init) {
|
||||
if (oneof_to_case != 0) {
|
||||
_this->clear_payload();
|
||||
}
|
||||
_this->_impl_._oneof_case_[0] = oneof_from_case;
|
||||
}
|
||||
|
||||
switch (oneof_from_case) {
|
||||
case kParamChange: {
|
||||
if (oneof_needs_init) {
|
||||
_this->_impl_.payload_.param_change_ =
|
||||
::google::protobuf::Message::CopyConstruct<::daw::common::ParameterChange>(arena, *from._impl_.payload_.param_change_);
|
||||
} else {
|
||||
_this->_impl_.payload_.param_change_->MergeFrom(from._internal_param_change());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kMidi: {
|
||||
if (oneof_needs_init) {
|
||||
_this->_impl_.payload_.midi_ =
|
||||
::google::protobuf::Message::CopyConstruct<::daw::common::MidiEvent>(arena, *from._impl_.payload_.midi_);
|
||||
} else {
|
||||
_this->_impl_.payload_.midi_->MergeFrom(from._internal_midi());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kBufferRef: {
|
||||
if (oneof_needs_init) {
|
||||
_this->_impl_.payload_.buffer_ref_ =
|
||||
::google::protobuf::Message::CopyConstruct<::daw::common::AudioBufferRef>(arena, *from._impl_.payload_.buffer_ref_);
|
||||
} else {
|
||||
_this->_impl_.payload_.buffer_ref_->MergeFrom(from._internal_buffer_ref());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PAYLOAD_NOT_SET:
|
||||
break;
|
||||
}
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void RTEnvelope::CopyFrom(const RTEnvelope& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:daw.rt.RTEnvelope)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
|
||||
void RTEnvelope::InternalSwap(RTEnvelope* PROTOBUF_RESTRICT other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
::google::protobuf::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.timestamp_us_)
|
||||
+ sizeof(RTEnvelope::_impl_.timestamp_us_)
|
||||
- PROTOBUF_FIELD_OFFSET(RTEnvelope, _impl_.seq_)>(
|
||||
reinterpret_cast<char*>(&_impl_.seq_),
|
||||
reinterpret_cast<char*>(&other->_impl_.seq_));
|
||||
swap(_impl_.payload_, other->_impl_.payload_);
|
||||
swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata RTEnvelope::GetMetadata() const {
|
||||
return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full());
|
||||
}
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace rt
|
||||
} // namespace daw
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type
|
||||
_static_init2_ PROTOBUF_UNUSED =
|
||||
(::_pbi::AddDescriptors(&descriptor_table_rt_2frt_5fenvelope_2eproto),
|
||||
::std::false_type{});
|
||||
#include "google/protobuf/port_undef.inc"
|
||||
@@ -1,643 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// NO CHECKED-IN PROTOBUF GENCODE
|
||||
// source: rt/rt_envelope.proto
|
||||
// Protobuf C++ Version: 5.29.3
|
||||
|
||||
#ifndef rt_2frt_5fenvelope_2eproto_2epb_2eh
|
||||
#define rt_2frt_5fenvelope_2eproto_2epb_2eh
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "google/protobuf/runtime_version.h"
|
||||
#if PROTOBUF_VERSION != 5029003
|
||||
#error "Protobuf C++ gencode is built with an incompatible version of"
|
||||
#error "Protobuf C++ headers/runtime. See"
|
||||
#error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp"
|
||||
#endif
|
||||
#include "google/protobuf/io/coded_stream.h"
|
||||
#include "google/protobuf/arena.h"
|
||||
#include "google/protobuf/arenastring.h"
|
||||
#include "google/protobuf/generated_message_tctable_decl.h"
|
||||
#include "google/protobuf/generated_message_util.h"
|
||||
#include "google/protobuf/metadata_lite.h"
|
||||
#include "google/protobuf/generated_message_reflection.h"
|
||||
#include "google/protobuf/message.h"
|
||||
#include "google/protobuf/message_lite.h"
|
||||
#include "google/protobuf/repeated_field.h" // IWYU pragma: export
|
||||
#include "google/protobuf/extension_set.h" // IWYU pragma: export
|
||||
#include "google/protobuf/unknown_field_set.h"
|
||||
#include "common/domain.pb.h"
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
// Must be included last.
|
||||
#include "google/protobuf/port_def.inc"
|
||||
|
||||
#define PROTOBUF_INTERNAL_EXPORT_rt_2frt_5fenvelope_2eproto
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
namespace internal {
|
||||
template <typename T>
|
||||
::absl::string_view GetAnyMessageName();
|
||||
} // namespace internal
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_rt_2frt_5fenvelope_2eproto {
|
||||
static const ::uint32_t offsets[];
|
||||
};
|
||||
extern const ::google::protobuf::internal::DescriptorTable
|
||||
descriptor_table_rt_2frt_5fenvelope_2eproto;
|
||||
namespace daw {
|
||||
namespace rt {
|
||||
class RTEnvelope;
|
||||
struct RTEnvelopeDefaultTypeInternal;
|
||||
extern RTEnvelopeDefaultTypeInternal _RTEnvelope_default_instance_;
|
||||
} // namespace rt
|
||||
} // namespace daw
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
namespace daw {
|
||||
namespace rt {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class RTEnvelope final : public ::google::protobuf::Message
|
||||
/* @@protoc_insertion_point(class_definition:daw.rt.RTEnvelope) */ {
|
||||
public:
|
||||
inline RTEnvelope() : RTEnvelope(nullptr) {}
|
||||
~RTEnvelope() PROTOBUF_FINAL;
|
||||
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
void operator delete(RTEnvelope* msg, std::destroying_delete_t) {
|
||||
SharedDtor(*msg);
|
||||
::google::protobuf::internal::SizedDelete(msg, sizeof(RTEnvelope));
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename = void>
|
||||
explicit PROTOBUF_CONSTEXPR RTEnvelope(
|
||||
::google::protobuf::internal::ConstantInitialized);
|
||||
|
||||
inline RTEnvelope(const RTEnvelope& from) : RTEnvelope(nullptr, from) {}
|
||||
inline RTEnvelope(RTEnvelope&& from) noexcept
|
||||
: RTEnvelope(nullptr, std::move(from)) {}
|
||||
inline RTEnvelope& operator=(const RTEnvelope& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline RTEnvelope& operator=(RTEnvelope&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
|
||||
}
|
||||
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields()
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
static const ::google::protobuf::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::google::protobuf::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::google::protobuf::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const RTEnvelope& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
enum PayloadCase {
|
||||
kParamChange = 10,
|
||||
kMidi = 11,
|
||||
kBufferRef = 12,
|
||||
PAYLOAD_NOT_SET = 0,
|
||||
};
|
||||
static inline const RTEnvelope* internal_default_instance() {
|
||||
return reinterpret_cast<const RTEnvelope*>(
|
||||
&_RTEnvelope_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages = 0;
|
||||
friend void swap(RTEnvelope& a, RTEnvelope& b) { a.Swap(&b); }
|
||||
inline void Swap(RTEnvelope* other) {
|
||||
if (other == this) return;
|
||||
if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) {
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::google::protobuf::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(RTEnvelope* other) {
|
||||
if (other == this) return;
|
||||
ABSL_DCHECK(GetArena() == other->GetArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
RTEnvelope* New(::google::protobuf::Arena* arena = nullptr) const {
|
||||
return ::google::protobuf::Message::DefaultConstruct<RTEnvelope>(arena);
|
||||
}
|
||||
using ::google::protobuf::Message::CopyFrom;
|
||||
void CopyFrom(const RTEnvelope& from);
|
||||
using ::google::protobuf::Message::MergeFrom;
|
||||
void MergeFrom(const RTEnvelope& from) { RTEnvelope::MergeImpl(*this, from); }
|
||||
|
||||
private:
|
||||
static void MergeImpl(
|
||||
::google::protobuf::MessageLite& to_msg,
|
||||
const ::google::protobuf::MessageLite& from_msg);
|
||||
|
||||
public:
|
||||
bool IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL;
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
private:
|
||||
static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg);
|
||||
static ::uint8_t* _InternalSerialize(
|
||||
const MessageLite& msg, ::uint8_t* target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* stream);
|
||||
|
||||
public:
|
||||
::size_t ByteSizeLong() const { return ByteSizeLong(*this); }
|
||||
::uint8_t* _InternalSerialize(
|
||||
::uint8_t* target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* stream) const {
|
||||
return _InternalSerialize(*this, target, stream);
|
||||
}
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
::size_t ByteSizeLong() const final;
|
||||
::uint8_t* _InternalSerialize(
|
||||
::uint8_t* target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* stream) const final;
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
int GetCachedSize() const { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::google::protobuf::Arena* arena);
|
||||
static void SharedDtor(MessageLite& self);
|
||||
void InternalSwap(RTEnvelope* other);
|
||||
private:
|
||||
template <typename T>
|
||||
friend ::absl::string_view(
|
||||
::google::protobuf::internal::GetAnyMessageName)();
|
||||
static ::absl::string_view FullMessageName() { return "daw.rt.RTEnvelope"; }
|
||||
|
||||
protected:
|
||||
explicit RTEnvelope(::google::protobuf::Arena* arena);
|
||||
RTEnvelope(::google::protobuf::Arena* arena, const RTEnvelope& from);
|
||||
RTEnvelope(::google::protobuf::Arena* arena, RTEnvelope&& from) noexcept
|
||||
: RTEnvelope(arena) {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
|
||||
static void* PlacementNew_(const void*, void* mem,
|
||||
::google::protobuf::Arena* arena);
|
||||
static constexpr auto InternalNewImpl_();
|
||||
static const ::google::protobuf::internal::ClassDataFull _class_data_;
|
||||
|
||||
public:
|
||||
::google::protobuf::Metadata GetMetadata() const;
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
enum : int {
|
||||
kSeqFieldNumber = 1,
|
||||
kTimestampUsFieldNumber = 2,
|
||||
kParamChangeFieldNumber = 10,
|
||||
kMidiFieldNumber = 11,
|
||||
kBufferRefFieldNumber = 12,
|
||||
};
|
||||
// uint64 seq = 1;
|
||||
void clear_seq() ;
|
||||
::uint64_t seq() const;
|
||||
void set_seq(::uint64_t value);
|
||||
|
||||
private:
|
||||
::uint64_t _internal_seq() const;
|
||||
void _internal_set_seq(::uint64_t value);
|
||||
|
||||
public:
|
||||
// uint64 timestamp_us = 2;
|
||||
void clear_timestamp_us() ;
|
||||
::uint64_t timestamp_us() const;
|
||||
void set_timestamp_us(::uint64_t value);
|
||||
|
||||
private:
|
||||
::uint64_t _internal_timestamp_us() const;
|
||||
void _internal_set_timestamp_us(::uint64_t value);
|
||||
|
||||
public:
|
||||
// .daw.common.ParameterChange param_change = 10;
|
||||
bool has_param_change() const;
|
||||
private:
|
||||
bool _internal_has_param_change() const;
|
||||
|
||||
public:
|
||||
void clear_param_change() ;
|
||||
const ::daw::common::ParameterChange& param_change() const;
|
||||
PROTOBUF_NODISCARD ::daw::common::ParameterChange* release_param_change();
|
||||
::daw::common::ParameterChange* mutable_param_change();
|
||||
void set_allocated_param_change(::daw::common::ParameterChange* value);
|
||||
void unsafe_arena_set_allocated_param_change(::daw::common::ParameterChange* value);
|
||||
::daw::common::ParameterChange* unsafe_arena_release_param_change();
|
||||
|
||||
private:
|
||||
const ::daw::common::ParameterChange& _internal_param_change() const;
|
||||
::daw::common::ParameterChange* _internal_mutable_param_change();
|
||||
|
||||
public:
|
||||
// .daw.common.MidiEvent midi = 11;
|
||||
bool has_midi() const;
|
||||
private:
|
||||
bool _internal_has_midi() const;
|
||||
|
||||
public:
|
||||
void clear_midi() ;
|
||||
const ::daw::common::MidiEvent& midi() const;
|
||||
PROTOBUF_NODISCARD ::daw::common::MidiEvent* release_midi();
|
||||
::daw::common::MidiEvent* mutable_midi();
|
||||
void set_allocated_midi(::daw::common::MidiEvent* value);
|
||||
void unsafe_arena_set_allocated_midi(::daw::common::MidiEvent* value);
|
||||
::daw::common::MidiEvent* unsafe_arena_release_midi();
|
||||
|
||||
private:
|
||||
const ::daw::common::MidiEvent& _internal_midi() const;
|
||||
::daw::common::MidiEvent* _internal_mutable_midi();
|
||||
|
||||
public:
|
||||
// .daw.common.AudioBufferRef buffer_ref = 12;
|
||||
bool has_buffer_ref() const;
|
||||
private:
|
||||
bool _internal_has_buffer_ref() const;
|
||||
|
||||
public:
|
||||
void clear_buffer_ref() ;
|
||||
const ::daw::common::AudioBufferRef& buffer_ref() const;
|
||||
PROTOBUF_NODISCARD ::daw::common::AudioBufferRef* release_buffer_ref();
|
||||
::daw::common::AudioBufferRef* mutable_buffer_ref();
|
||||
void set_allocated_buffer_ref(::daw::common::AudioBufferRef* value);
|
||||
void unsafe_arena_set_allocated_buffer_ref(::daw::common::AudioBufferRef* value);
|
||||
::daw::common::AudioBufferRef* unsafe_arena_release_buffer_ref();
|
||||
|
||||
private:
|
||||
const ::daw::common::AudioBufferRef& _internal_buffer_ref() const;
|
||||
::daw::common::AudioBufferRef* _internal_mutable_buffer_ref();
|
||||
|
||||
public:
|
||||
void clear_payload();
|
||||
PayloadCase payload_case() const;
|
||||
// @@protoc_insertion_point(class_scope:daw.rt.RTEnvelope)
|
||||
private:
|
||||
class _Internal;
|
||||
void set_has_param_change();
|
||||
void set_has_midi();
|
||||
void set_has_buffer_ref();
|
||||
inline bool has_payload() const;
|
||||
inline void clear_has_payload();
|
||||
friend class ::google::protobuf::internal::TcParser;
|
||||
static const ::google::protobuf::internal::TcParseTable<
|
||||
1, 5, 3,
|
||||
0, 2>
|
||||
_table_;
|
||||
|
||||
friend class ::google::protobuf::MessageLite;
|
||||
friend class ::google::protobuf::Arena;
|
||||
template <typename T>
|
||||
friend class ::google::protobuf::Arena::InternalHelper;
|
||||
using InternalArenaConstructable_ = void;
|
||||
using DestructorSkippable_ = void;
|
||||
struct Impl_ {
|
||||
inline explicit constexpr Impl_(
|
||||
::google::protobuf::internal::ConstantInitialized) noexcept;
|
||||
inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* arena);
|
||||
inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* arena, const Impl_& from,
|
||||
const RTEnvelope& from_msg);
|
||||
::uint64_t seq_;
|
||||
::uint64_t timestamp_us_;
|
||||
union PayloadUnion {
|
||||
constexpr PayloadUnion() : _constinit_{} {}
|
||||
::google::protobuf::internal::ConstantInitialized _constinit_;
|
||||
::daw::common::ParameterChange* param_change_;
|
||||
::daw::common::MidiEvent* midi_;
|
||||
::daw::common::AudioBufferRef* buffer_ref_;
|
||||
} payload_;
|
||||
::google::protobuf::internal::CachedSize _cached_size_;
|
||||
::uint32_t _oneof_case_[1];
|
||||
PROTOBUF_TSAN_DECLARE_MEMBER
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_rt_2frt_5fenvelope_2eproto;
|
||||
};
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// RTEnvelope
|
||||
|
||||
// uint64 seq = 1;
|
||||
inline void RTEnvelope::clear_seq() {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
_impl_.seq_ = ::uint64_t{0u};
|
||||
}
|
||||
inline ::uint64_t RTEnvelope::seq() const {
|
||||
// @@protoc_insertion_point(field_get:daw.rt.RTEnvelope.seq)
|
||||
return _internal_seq();
|
||||
}
|
||||
inline void RTEnvelope::set_seq(::uint64_t value) {
|
||||
_internal_set_seq(value);
|
||||
// @@protoc_insertion_point(field_set:daw.rt.RTEnvelope.seq)
|
||||
}
|
||||
inline ::uint64_t RTEnvelope::_internal_seq() const {
|
||||
::google::protobuf::internal::TSanRead(&_impl_);
|
||||
return _impl_.seq_;
|
||||
}
|
||||
inline void RTEnvelope::_internal_set_seq(::uint64_t value) {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
_impl_.seq_ = value;
|
||||
}
|
||||
|
||||
// uint64 timestamp_us = 2;
|
||||
inline void RTEnvelope::clear_timestamp_us() {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
_impl_.timestamp_us_ = ::uint64_t{0u};
|
||||
}
|
||||
inline ::uint64_t RTEnvelope::timestamp_us() const {
|
||||
// @@protoc_insertion_point(field_get:daw.rt.RTEnvelope.timestamp_us)
|
||||
return _internal_timestamp_us();
|
||||
}
|
||||
inline void RTEnvelope::set_timestamp_us(::uint64_t value) {
|
||||
_internal_set_timestamp_us(value);
|
||||
// @@protoc_insertion_point(field_set:daw.rt.RTEnvelope.timestamp_us)
|
||||
}
|
||||
inline ::uint64_t RTEnvelope::_internal_timestamp_us() const {
|
||||
::google::protobuf::internal::TSanRead(&_impl_);
|
||||
return _impl_.timestamp_us_;
|
||||
}
|
||||
inline void RTEnvelope::_internal_set_timestamp_us(::uint64_t value) {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
_impl_.timestamp_us_ = value;
|
||||
}
|
||||
|
||||
// .daw.common.ParameterChange param_change = 10;
|
||||
inline bool RTEnvelope::has_param_change() const {
|
||||
return payload_case() == kParamChange;
|
||||
}
|
||||
inline bool RTEnvelope::_internal_has_param_change() const {
|
||||
return payload_case() == kParamChange;
|
||||
}
|
||||
inline void RTEnvelope::set_has_param_change() {
|
||||
_impl_._oneof_case_[0] = kParamChange;
|
||||
}
|
||||
inline ::daw::common::ParameterChange* RTEnvelope::release_param_change() {
|
||||
// @@protoc_insertion_point(field_release:daw.rt.RTEnvelope.param_change)
|
||||
if (payload_case() == kParamChange) {
|
||||
clear_has_payload();
|
||||
auto* temp = _impl_.payload_.param_change_;
|
||||
if (GetArena() != nullptr) {
|
||||
temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
|
||||
}
|
||||
_impl_.payload_.param_change_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline const ::daw::common::ParameterChange& RTEnvelope::_internal_param_change() const {
|
||||
return payload_case() == kParamChange ? *_impl_.payload_.param_change_ : reinterpret_cast<::daw::common::ParameterChange&>(::daw::common::_ParameterChange_default_instance_);
|
||||
}
|
||||
inline const ::daw::common::ParameterChange& RTEnvelope::param_change() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_get:daw.rt.RTEnvelope.param_change)
|
||||
return _internal_param_change();
|
||||
}
|
||||
inline ::daw::common::ParameterChange* RTEnvelope::unsafe_arena_release_param_change() {
|
||||
// @@protoc_insertion_point(field_unsafe_arena_release:daw.rt.RTEnvelope.param_change)
|
||||
if (payload_case() == kParamChange) {
|
||||
clear_has_payload();
|
||||
auto* temp = _impl_.payload_.param_change_;
|
||||
_impl_.payload_.param_change_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline void RTEnvelope::unsafe_arena_set_allocated_param_change(::daw::common::ParameterChange* value) {
|
||||
// We rely on the oneof clear method to free the earlier contents
|
||||
// of this oneof. We can directly use the pointer we're given to
|
||||
// set the new value.
|
||||
clear_payload();
|
||||
if (value) {
|
||||
set_has_param_change();
|
||||
_impl_.payload_.param_change_ = value;
|
||||
}
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:daw.rt.RTEnvelope.param_change)
|
||||
}
|
||||
inline ::daw::common::ParameterChange* RTEnvelope::_internal_mutable_param_change() {
|
||||
if (payload_case() != kParamChange) {
|
||||
clear_payload();
|
||||
set_has_param_change();
|
||||
_impl_.payload_.param_change_ =
|
||||
::google::protobuf::Message::DefaultConstruct<::daw::common::ParameterChange>(GetArena());
|
||||
}
|
||||
return _impl_.payload_.param_change_;
|
||||
}
|
||||
inline ::daw::common::ParameterChange* RTEnvelope::mutable_param_change() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
::daw::common::ParameterChange* _msg = _internal_mutable_param_change();
|
||||
// @@protoc_insertion_point(field_mutable:daw.rt.RTEnvelope.param_change)
|
||||
return _msg;
|
||||
}
|
||||
|
||||
// .daw.common.MidiEvent midi = 11;
|
||||
inline bool RTEnvelope::has_midi() const {
|
||||
return payload_case() == kMidi;
|
||||
}
|
||||
inline bool RTEnvelope::_internal_has_midi() const {
|
||||
return payload_case() == kMidi;
|
||||
}
|
||||
inline void RTEnvelope::set_has_midi() {
|
||||
_impl_._oneof_case_[0] = kMidi;
|
||||
}
|
||||
inline ::daw::common::MidiEvent* RTEnvelope::release_midi() {
|
||||
// @@protoc_insertion_point(field_release:daw.rt.RTEnvelope.midi)
|
||||
if (payload_case() == kMidi) {
|
||||
clear_has_payload();
|
||||
auto* temp = _impl_.payload_.midi_;
|
||||
if (GetArena() != nullptr) {
|
||||
temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
|
||||
}
|
||||
_impl_.payload_.midi_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline const ::daw::common::MidiEvent& RTEnvelope::_internal_midi() const {
|
||||
return payload_case() == kMidi ? *_impl_.payload_.midi_ : reinterpret_cast<::daw::common::MidiEvent&>(::daw::common::_MidiEvent_default_instance_);
|
||||
}
|
||||
inline const ::daw::common::MidiEvent& RTEnvelope::midi() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_get:daw.rt.RTEnvelope.midi)
|
||||
return _internal_midi();
|
||||
}
|
||||
inline ::daw::common::MidiEvent* RTEnvelope::unsafe_arena_release_midi() {
|
||||
// @@protoc_insertion_point(field_unsafe_arena_release:daw.rt.RTEnvelope.midi)
|
||||
if (payload_case() == kMidi) {
|
||||
clear_has_payload();
|
||||
auto* temp = _impl_.payload_.midi_;
|
||||
_impl_.payload_.midi_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline void RTEnvelope::unsafe_arena_set_allocated_midi(::daw::common::MidiEvent* value) {
|
||||
// We rely on the oneof clear method to free the earlier contents
|
||||
// of this oneof. We can directly use the pointer we're given to
|
||||
// set the new value.
|
||||
clear_payload();
|
||||
if (value) {
|
||||
set_has_midi();
|
||||
_impl_.payload_.midi_ = value;
|
||||
}
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:daw.rt.RTEnvelope.midi)
|
||||
}
|
||||
inline ::daw::common::MidiEvent* RTEnvelope::_internal_mutable_midi() {
|
||||
if (payload_case() != kMidi) {
|
||||
clear_payload();
|
||||
set_has_midi();
|
||||
_impl_.payload_.midi_ =
|
||||
::google::protobuf::Message::DefaultConstruct<::daw::common::MidiEvent>(GetArena());
|
||||
}
|
||||
return _impl_.payload_.midi_;
|
||||
}
|
||||
inline ::daw::common::MidiEvent* RTEnvelope::mutable_midi() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
::daw::common::MidiEvent* _msg = _internal_mutable_midi();
|
||||
// @@protoc_insertion_point(field_mutable:daw.rt.RTEnvelope.midi)
|
||||
return _msg;
|
||||
}
|
||||
|
||||
// .daw.common.AudioBufferRef buffer_ref = 12;
|
||||
inline bool RTEnvelope::has_buffer_ref() const {
|
||||
return payload_case() == kBufferRef;
|
||||
}
|
||||
inline bool RTEnvelope::_internal_has_buffer_ref() const {
|
||||
return payload_case() == kBufferRef;
|
||||
}
|
||||
inline void RTEnvelope::set_has_buffer_ref() {
|
||||
_impl_._oneof_case_[0] = kBufferRef;
|
||||
}
|
||||
inline ::daw::common::AudioBufferRef* RTEnvelope::release_buffer_ref() {
|
||||
// @@protoc_insertion_point(field_release:daw.rt.RTEnvelope.buffer_ref)
|
||||
if (payload_case() == kBufferRef) {
|
||||
clear_has_payload();
|
||||
auto* temp = _impl_.payload_.buffer_ref_;
|
||||
if (GetArena() != nullptr) {
|
||||
temp = ::google::protobuf::internal::DuplicateIfNonNull(temp);
|
||||
}
|
||||
_impl_.payload_.buffer_ref_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline const ::daw::common::AudioBufferRef& RTEnvelope::_internal_buffer_ref() const {
|
||||
return payload_case() == kBufferRef ? *_impl_.payload_.buffer_ref_ : reinterpret_cast<::daw::common::AudioBufferRef&>(::daw::common::_AudioBufferRef_default_instance_);
|
||||
}
|
||||
inline const ::daw::common::AudioBufferRef& RTEnvelope::buffer_ref() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_get:daw.rt.RTEnvelope.buffer_ref)
|
||||
return _internal_buffer_ref();
|
||||
}
|
||||
inline ::daw::common::AudioBufferRef* RTEnvelope::unsafe_arena_release_buffer_ref() {
|
||||
// @@protoc_insertion_point(field_unsafe_arena_release:daw.rt.RTEnvelope.buffer_ref)
|
||||
if (payload_case() == kBufferRef) {
|
||||
clear_has_payload();
|
||||
auto* temp = _impl_.payload_.buffer_ref_;
|
||||
_impl_.payload_.buffer_ref_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline void RTEnvelope::unsafe_arena_set_allocated_buffer_ref(::daw::common::AudioBufferRef* value) {
|
||||
// We rely on the oneof clear method to free the earlier contents
|
||||
// of this oneof. We can directly use the pointer we're given to
|
||||
// set the new value.
|
||||
clear_payload();
|
||||
if (value) {
|
||||
set_has_buffer_ref();
|
||||
_impl_.payload_.buffer_ref_ = value;
|
||||
}
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:daw.rt.RTEnvelope.buffer_ref)
|
||||
}
|
||||
inline ::daw::common::AudioBufferRef* RTEnvelope::_internal_mutable_buffer_ref() {
|
||||
if (payload_case() != kBufferRef) {
|
||||
clear_payload();
|
||||
set_has_buffer_ref();
|
||||
_impl_.payload_.buffer_ref_ =
|
||||
::google::protobuf::Message::DefaultConstruct<::daw::common::AudioBufferRef>(GetArena());
|
||||
}
|
||||
return _impl_.payload_.buffer_ref_;
|
||||
}
|
||||
inline ::daw::common::AudioBufferRef* RTEnvelope::mutable_buffer_ref() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
::daw::common::AudioBufferRef* _msg = _internal_mutable_buffer_ref();
|
||||
// @@protoc_insertion_point(field_mutable:daw.rt.RTEnvelope.buffer_ref)
|
||||
return _msg;
|
||||
}
|
||||
|
||||
inline bool RTEnvelope::has_payload() const {
|
||||
return payload_case() != PAYLOAD_NOT_SET;
|
||||
}
|
||||
inline void RTEnvelope::clear_has_payload() {
|
||||
_impl_._oneof_case_[0] = PAYLOAD_NOT_SET;
|
||||
}
|
||||
inline RTEnvelope::PayloadCase RTEnvelope::payload_case() const {
|
||||
return RTEnvelope::PayloadCase(_impl_._oneof_case_[0]);
|
||||
}
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace rt
|
||||
} // namespace daw
|
||||
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include "google/protobuf/port_undef.inc"
|
||||
|
||||
#endif // rt_2frt_5fenvelope_2eproto_2epb_2eh
|
||||
@@ -15,7 +15,7 @@ retrieve_files(${CMAKE_CURRENT_SOURCE_DIR}/src SRC_FILES)
|
||||
# @param ${PROJECT_NAME}: 目标名称。
|
||||
# @param ${SRC_FILES}: 构成该目标的所有源文件。
|
||||
add_executable(${PROJECT_NAME} ${SRC_FILES})
|
||||
add_plugin_host_dependency(${PROJECT_NAME})
|
||||
#add_plugin_host_dependency(${PROJECT_NAME})
|
||||
|
||||
# 将依赖库链接到我们的可执行文件目标。
|
||||
# @param ${PROJECT_NAME}: 要链接的目标。
|
||||
|
||||
1
src/backend/src/engine/src/host/plugin_host.cpp
Normal file
1
src/backend/src/engine/src/host/plugin_host.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "plugin_host.h"
|
||||
34
src/backend/src/engine/src/host/plugin_host.h
Normal file
34
src/backend/src/engine/src/host/plugin_host.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include <span>
|
||||
|
||||
#include "midi_type.h"
|
||||
|
||||
class plugin_host {
|
||||
public:
|
||||
virtual void process(std::span<float*> in_buffers, std::span<float*> out_buffers, int32_t in_frames) = 0;
|
||||
virtual void process(std::span<double*> in_buffers, std::span<double*> out_buffers, int32_t in_frames) = 0;
|
||||
|
||||
virtual auto send_events(std::span<midi_type::midi_event> ev) -> bool = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_name() -> std::string = 0;
|
||||
[[nodiscard]] virtual auto get_vendor() -> std::string = 0;
|
||||
[[nodiscard]] virtual auto get_version() -> std::string = 0;
|
||||
[[nodiscard]] virtual auto get_product() -> std::string = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_input_count() const noexcept -> int = 0;
|
||||
[[nodiscard]] virtual auto get_output_count() const noexcept -> int = 0;
|
||||
[[nodiscard]] virtual auto get_parameter_count() const noexcept -> int = 0;
|
||||
[[nodiscard]] virtual auto can_double() const noexcept -> bool = 0;
|
||||
[[nodiscard]] virtual auto is_synth() const noexcept -> bool = 0;
|
||||
[[nodiscard]] virtual auto get_unique_id() const noexcept -> int = 0;
|
||||
[[nodiscard]] virtual auto is_valid() const noexcept -> bool = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_parameter(int idx) -> float = 0;
|
||||
virtual void set_parameter(int idx, float v) = 0;
|
||||
virtual void set_sample_rate(float in_sample_rate) = 0;
|
||||
virtual void set_block_size(int32_t in_block_size) = 0;
|
||||
[[nodiscard]] virtual auto get_program_name() -> std::string = 0;
|
||||
virtual void set_program_name(const std::string& name) = 0;
|
||||
virtual void set_program(int idx) = 0;
|
||||
[[nodiscard]] virtual auto get_program() -> int32_t = 0;
|
||||
};
|
||||
@@ -0,0 +1,351 @@
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
// VST Plug-Ins SDK
|
||||
// Version 2.4 $Date: 2006/06/20 17:22:55 $
|
||||
//
|
||||
// Category : VST 2.x Interfaces
|
||||
// Filename : aeffect.h
|
||||
// Created by : Steinberg Media Technologies
|
||||
// Description : Definition of AEffect structure
|
||||
//
|
||||
// © 2006, Steinberg Media Technologies, All Rights Reserved
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __aeffect__
|
||||
#define __aeffect__
|
||||
|
||||
// gcc based compiler, or CodeWarrior on Mac OS X
|
||||
#if ((defined(__GNUC__) && (defined(__APPLE_CPP__) || defined(__APPLE_CC__))) || (defined (__MWERKS__) && defined (__MACH__)))
|
||||
#ifndef TARGET_API_MAC_CARBON
|
||||
#define TARGET_API_MAC_CARBON 1
|
||||
#endif
|
||||
#if __ppc__
|
||||
#ifndef VST_FORCE_DEPRECATED
|
||||
#define VST_FORCE_DEPRECATED 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_CARBON
|
||||
#ifdef __LP64__
|
||||
#pragma options align=power
|
||||
#else
|
||||
#pragma options align=mac68k
|
||||
#endif
|
||||
#define VSTCALLBACK
|
||||
#elif defined __BORLANDC__
|
||||
#pragma -a8
|
||||
#elif defined(__GNUC__)
|
||||
#pragma pack(push,8)
|
||||
#define VSTCALLBACK __cdecl
|
||||
#elif defined(WIN32) || defined(__FLAT__) || defined CBUILDER
|
||||
#pragma pack(push)
|
||||
#pragma pack(8)
|
||||
#define VSTCALLBACK __cdecl
|
||||
#else
|
||||
#define VSTCALLBACK
|
||||
#endif
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include <string.h> // for strncpy
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
// VST Version
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** Define SDK Version (you can generate different versions (from 2.0 to 2.4) of this SDK by setting the unwanted extensions to 0). */
|
||||
#define VST_2_1_EXTENSIONS 1 ///< Version 2.1 extensions (08-06-2000)
|
||||
#define VST_2_2_EXTENSIONS 1 ///< Version 2.2 extensions (08-06-2001)
|
||||
#define VST_2_3_EXTENSIONS 1 ///< Version 2.3 extensions (20-05-2003)
|
||||
#ifndef VST_2_4_EXTENSIONS
|
||||
#define VST_2_4_EXTENSIONS 1 ///< Version 2.4 extensions (01-01-2006)
|
||||
#endif
|
||||
|
||||
/** Current VST Version */
|
||||
#if VST_2_4_EXTENSIONS
|
||||
#define kVstVersion 2400
|
||||
#elif VST_2_3_EXTENSIONS
|
||||
#define kVstVersion 2300
|
||||
#elif VST_2_2_EXTENSIONS
|
||||
#define kVstVersion 2200
|
||||
#elif VST_2_1_EXTENSIONS
|
||||
#define kVstVersion 2100
|
||||
#else
|
||||
#define kVstVersion 2
|
||||
#endif
|
||||
|
||||
/** Disable for Hosts to serve Plug-ins below VST 2.4 */
|
||||
#ifndef VST_FORCE_DEPRECATED
|
||||
#define VST_FORCE_DEPRECATED VST_2_4_EXTENSIONS
|
||||
#endif
|
||||
|
||||
/** Declares identifier as deprecated. */
|
||||
#if VST_FORCE_DEPRECATED
|
||||
#define DECLARE_VST_DEPRECATED(identifier) __##identifier##Deprecated
|
||||
#else
|
||||
#define DECLARE_VST_DEPRECATED(identifier) identifier
|
||||
#endif
|
||||
|
||||
/** Define for 64 Bit Platform. */
|
||||
#ifndef VST_64BIT_PLATFORM
|
||||
#define VST_64BIT_PLATFORM _WIN64 || __LP64__
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
// Integral Types
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef WIN32
|
||||
typedef short VstInt16; ///< 16 bit integer type
|
||||
typedef int VstInt32; ///< 32 bit integer type
|
||||
typedef __int64 VstInt64; ///< 64 bit integer type
|
||||
#else
|
||||
#include <stdint.h>
|
||||
typedef int16_t VstInt16; ///< 16 bit integer type
|
||||
typedef int32_t VstInt32; ///< 32 bit integer type
|
||||
typedef int64_t VstInt64; ///< 64 bit integer type
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
// Generic Types
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
#if VST_64BIT_PLATFORM
|
||||
typedef VstInt64 VstIntPtr; ///< platform-dependent integer type, same size as pointer
|
||||
#else
|
||||
typedef VstInt32 VstIntPtr; ///< platform-dependent integer type, same size as pointer
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
// Misc. Definition
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
#undef CCONST
|
||||
struct AEffect;
|
||||
|
||||
/// @cond ignore
|
||||
typedef VstIntPtr (VSTCALLBACK *audioMasterCallback) (AEffect* effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt);
|
||||
typedef VstIntPtr (VSTCALLBACK *AEffectDispatcherProc) (AEffect* effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt);
|
||||
typedef void (VSTCALLBACK *AEffectProcessProc) (AEffect* effect, float** inputs, float** outputs, VstInt32 sampleFrames);
|
||||
typedef void (VSTCALLBACK *AEffectProcessDoubleProc) (AEffect* effect, double** inputs, double** outputs, VstInt32 sampleFrames);
|
||||
typedef void (VSTCALLBACK *AEffectSetParameterProc) (AEffect* effect, VstInt32 index, float parameter);
|
||||
typedef float (VSTCALLBACK *AEffectGetParameterProc) (AEffect* effect, VstInt32 index);
|
||||
/// @endcond
|
||||
|
||||
/** Four Character Constant (for AEffect->uniqueID) */
|
||||
#define CCONST(a, b, c, d) \
|
||||
((((VstInt32)a) << 24) | (((VstInt32)b) << 16) | (((VstInt32)c) << 8) | (((VstInt32)d) << 0))
|
||||
|
||||
/** AEffect magic number */
|
||||
#define kEffectMagic CCONST ('V', 's', 't', 'P')
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Basic VST Effect "C" Interface. */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
struct AEffect
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
VstInt32 magic; ///< must be #kEffectMagic ('VstP')
|
||||
|
||||
/** Host to Plug-in dispatcher @see AudioEffect::dispatcher */
|
||||
AEffectDispatcherProc dispatcher;
|
||||
|
||||
/** \deprecated Accumulating process mode is deprecated in VST 2.4! Use AEffect::processReplacing instead! */
|
||||
AEffectProcessProc DECLARE_VST_DEPRECATED (process);
|
||||
|
||||
/** Set new value of automatable parameter @see AudioEffect::setParameter */
|
||||
AEffectSetParameterProc setParameter;
|
||||
|
||||
/** Returns current value of automatable parameter @see AudioEffect::getParameter*/
|
||||
AEffectGetParameterProc getParameter;
|
||||
|
||||
VstInt32 numPrograms; ///< number of programs
|
||||
VstInt32 numParams; ///< all programs are assumed to have numParams parameters
|
||||
VstInt32 numInputs; ///< number of audio inputs
|
||||
VstInt32 numOutputs; ///< number of audio outputs
|
||||
|
||||
VstInt32 flags; ///< @see VstAEffectFlags
|
||||
|
||||
VstIntPtr resvd1; ///< reserved for Host, must be 0
|
||||
VstIntPtr resvd2; ///< reserved for Host, must be 0
|
||||
|
||||
VstInt32 initialDelay; ///< for algorithms which need input in the first place (Group delay or latency in Samples). This value should be initialized in a resume state.
|
||||
|
||||
VstInt32 DECLARE_VST_DEPRECATED (realQualities); ///< \deprecated unused member
|
||||
VstInt32 DECLARE_VST_DEPRECATED (offQualities); ///< \deprecated unused member
|
||||
float DECLARE_VST_DEPRECATED (ioRatio); ///< \deprecated unused member
|
||||
|
||||
void* object; ///< #AudioEffect class pointer
|
||||
void* user; ///< user-defined pointer
|
||||
|
||||
VstInt32 uniqueID; ///< registered unique identifier (register it at Steinberg 3rd party support Web). This is used to identify a plug-in during save+load of preset and project.
|
||||
VstInt32 version; ///< plug-in version (example 1100 for version 1.1.0.0)
|
||||
|
||||
/** Process audio samples in replacing mode @see AudioEffect::processReplacing */
|
||||
AEffectProcessProc processReplacing;
|
||||
|
||||
#if VST_2_4_EXTENSIONS
|
||||
/** Process double-precision audio samples in replacing mode @see AudioEffect::processDoubleReplacing */
|
||||
AEffectProcessDoubleProc processDoubleReplacing;
|
||||
|
||||
char future[56]; ///< reserved for future use (please zero)
|
||||
#else
|
||||
char future[60]; ///< reserved for future use (please zero)
|
||||
#endif
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** AEffect flags */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
enum VstAEffectFlags
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
effFlagsHasEditor = 1 << 0, ///< set if the plug-in provides a custom editor
|
||||
effFlagsCanReplacing = 1 << 4, ///< supports replacing process mode (which should the default mode in VST 2.4)
|
||||
effFlagsProgramChunks = 1 << 5, ///< program data is handled in formatless chunks
|
||||
effFlagsIsSynth = 1 << 8, ///< plug-in is a synth (VSTi), Host may assign mixer channels for its outputs
|
||||
effFlagsNoSoundInStop = 1 << 9, ///< plug-in does not produce sound when input is all silence
|
||||
|
||||
#if VST_2_4_EXTENSIONS
|
||||
effFlagsCanDoubleReplacing = 1 << 12, ///< plug-in supports double precision processing
|
||||
#endif
|
||||
|
||||
DECLARE_VST_DEPRECATED (effFlagsHasClip) = 1 << 1, ///< \deprecated deprecated in VST 2.4
|
||||
DECLARE_VST_DEPRECATED (effFlagsHasVu) = 1 << 2, ///< \deprecated deprecated in VST 2.4
|
||||
DECLARE_VST_DEPRECATED (effFlagsCanMono) = 1 << 3, ///< \deprecated deprecated in VST 2.4
|
||||
DECLARE_VST_DEPRECATED (effFlagsExtIsAsync) = 1 << 10, ///< \deprecated deprecated in VST 2.4
|
||||
DECLARE_VST_DEPRECATED (effFlagsExtHasBuffer) = 1 << 11 ///< \deprecated deprecated in VST 2.4
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Basic dispatcher Opcodes (Host to Plug-in) */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
enum AEffectOpcodes
|
||||
{
|
||||
effOpen = 0, ///< no arguments @see AudioEffect::open
|
||||
effClose, ///< no arguments @see AudioEffect::close
|
||||
|
||||
effSetProgram, ///< [value]: new program number @see AudioEffect::setProgram
|
||||
effGetProgram, ///< [return value]: current program number @see AudioEffect::getProgram
|
||||
effSetProgramName, ///< [ptr]: char* with new program name, limited to #kVstMaxProgNameLen @see AudioEffect::setProgramName
|
||||
effGetProgramName, ///< [ptr]: char buffer for current program name, limited to #kVstMaxProgNameLen @see AudioEffect::getProgramName
|
||||
|
||||
effGetParamLabel, ///< [ptr]: char buffer for parameter label, limited to #kVstMaxParamStrLen @see AudioEffect::getParameterLabel
|
||||
effGetParamDisplay, ///< [ptr]: char buffer for parameter display, limited to #kVstMaxParamStrLen @see AudioEffect::getParameterDisplay
|
||||
effGetParamName, ///< [ptr]: char buffer for parameter name, limited to #kVstMaxParamStrLen @see AudioEffect::getParameterName
|
||||
|
||||
DECLARE_VST_DEPRECATED (effGetVu), ///< \deprecated deprecated in VST 2.4
|
||||
|
||||
effSetSampleRate, ///< [opt]: new sample rate for audio processing @see AudioEffect::setSampleRate
|
||||
effSetBlockSize, ///< [value]: new maximum block size for audio processing @see AudioEffect::setBlockSize
|
||||
effMainsChanged, ///< [value]: 0 means "turn off", 1 means "turn on" @see AudioEffect::suspend @see AudioEffect::resume
|
||||
|
||||
effEditGetRect, ///< [ptr]: #ERect** receiving pointer to editor size @see ERect @see AEffEditor::getRect
|
||||
effEditOpen, ///< [ptr]: system dependent Window pointer, e.g. HWND on Windows @see AEffEditor::open
|
||||
effEditClose, ///< no arguments @see AEffEditor::close
|
||||
|
||||
DECLARE_VST_DEPRECATED (effEditDraw), ///< \deprecated deprecated in VST 2.4
|
||||
DECLARE_VST_DEPRECATED (effEditMouse), ///< \deprecated deprecated in VST 2.4
|
||||
DECLARE_VST_DEPRECATED (effEditKey), ///< \deprecated deprecated in VST 2.4
|
||||
|
||||
effEditIdle, ///< no arguments @see AEffEditor::idle
|
||||
|
||||
DECLARE_VST_DEPRECATED (effEditTop), ///< \deprecated deprecated in VST 2.4
|
||||
DECLARE_VST_DEPRECATED (effEditSleep), ///< \deprecated deprecated in VST 2.4
|
||||
DECLARE_VST_DEPRECATED (effIdentify), ///< \deprecated deprecated in VST 2.4
|
||||
|
||||
effGetChunk, ///< [ptr]: void** for chunk data address [index]: 0 for bank, 1 for program @see AudioEffect::getChunk
|
||||
effSetChunk, ///< [ptr]: chunk data [value]: byte size [index]: 0 for bank, 1 for program @see AudioEffect::setChunk
|
||||
|
||||
effNumOpcodes
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Basic dispatcher Opcodes (Plug-in to Host) */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
enum AudioMasterOpcodes
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
audioMasterAutomate = 0, ///< [index]: parameter index [opt]: parameter value @see AudioEffect::setParameterAutomated
|
||||
audioMasterVersion, ///< [return value]: Host VST version (for example 2400 for VST 2.4) @see AudioEffect::getMasterVersion
|
||||
audioMasterCurrentId, ///< [return value]: current unique identifier on shell plug-in @see AudioEffect::getCurrentUniqueId
|
||||
audioMasterIdle, ///< no arguments @see AudioEffect::masterIdle
|
||||
DECLARE_VST_DEPRECATED (audioMasterPinConnected) ///< \deprecated deprecated in VST 2.4 r2
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** String length limits (in characters excl. 0 byte) */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
enum VstStringConstants
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
kVstMaxProgNameLen = 24, ///< used for #effGetProgramName, #effSetProgramName, #effGetProgramNameIndexed
|
||||
kVstMaxParamStrLen = 8, ///< used for #effGetParamLabel, #effGetParamDisplay, #effGetParamName
|
||||
kVstMaxVendorStrLen = 64, ///< used for #effGetVendorString, #audioMasterGetVendorString
|
||||
kVstMaxProductStrLen = 64, ///< used for #effGetProductString, #audioMasterGetProductString
|
||||
kVstMaxEffectNameLen = 32 ///< used for #effGetEffectName
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** String copy taking care of null terminator. */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
inline char* vst_strncpy (char* dst, const char* src, size_t maxLen)
|
||||
{
|
||||
char* result = strncpy (dst, src, maxLen);
|
||||
dst[maxLen] = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** String concatenation taking care of null terminator. */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
inline char* vst_strncat (char* dst, const char* src, size_t maxLen)
|
||||
{
|
||||
char* result = strncat (dst, src, maxLen);
|
||||
dst[maxLen] = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Cast #VstIntPtr to pointer. */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
template <class T> inline T* FromVstPtr (VstIntPtr& arg)
|
||||
{
|
||||
T** address = (T**)&arg;
|
||||
return *address;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Cast pointer to #VstIntPtr. */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
template <class T> inline VstIntPtr ToVstPtr (T* ptr)
|
||||
{
|
||||
VstIntPtr* address = (VstIntPtr*)&ptr;
|
||||
return *address;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Structure used for #effEditGetRect. */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
struct ERect
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
VstInt16 top; ///< top coordinate
|
||||
VstInt16 left; ///< left coordinate
|
||||
VstInt16 bottom; ///< bottom coordinate
|
||||
VstInt16 right; ///< right coordinate
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
#if TARGET_API_MAC_CARBON
|
||||
#pragma options align=reset
|
||||
#elif defined(WIN32) || defined(__FLAT__) || defined(__GNUC__)
|
||||
#pragma pack(pop)
|
||||
#elif defined __BORLANDC__
|
||||
#pragma -a-
|
||||
#endif
|
||||
|
||||
#endif // __aeffect__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,106 @@
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
// VST Plug-Ins SDK
|
||||
// Version 2.4 $Date: 2006/02/09 11:05:51 $
|
||||
//
|
||||
// Category : VST 2.x Interfaces
|
||||
// Filename : vstfxstore.h
|
||||
// Created by : Steinberg Media Technologies
|
||||
// Description : Definition of Program (fxp) and Bank (fxb) structures
|
||||
//
|
||||
// © 2006, Steinberg Media Technologies, All Rights Reserved
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __vstfxstore__
|
||||
#define __vstfxstore__
|
||||
|
||||
#ifndef __aeffect__
|
||||
#include "aeffect.h"
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Root chunk identifier for Programs (fxp) and Banks (fxb). */
|
||||
#define cMagic 'CcnK'
|
||||
|
||||
/** Regular Program (fxp) identifier. */
|
||||
#define fMagic 'FxCk'
|
||||
|
||||
/** Regular Bank (fxb) identifier. */
|
||||
#define bankMagic 'FxBk'
|
||||
|
||||
/** Program (fxp) identifier for opaque chunk data. */
|
||||
#define chunkPresetMagic 'FPCh'
|
||||
|
||||
/** Bank (fxb) identifier for opaque chunk data. */
|
||||
#define chunkBankMagic 'FBCh'
|
||||
|
||||
/*
|
||||
Note: The C data structures below are for illustration only. You can not read/write them directly.
|
||||
The byte order on disk of fxp and fxb files is Big Endian. You have to swap integer
|
||||
and floating-point values on Little Endian platforms (Windows, MacIntel)!
|
||||
*/
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Program (fxp) structure. */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
struct fxProgram
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
VstInt32 chunkMagic; ///< 'CcnK'
|
||||
VstInt32 byteSize; ///< size of this chunk, excl. magic + byteSize
|
||||
|
||||
VstInt32 fxMagic; ///< 'FxCk' (regular) or 'FPCh' (opaque chunk)
|
||||
VstInt32 version; ///< format version (currently 1)
|
||||
VstInt32 fxID; ///< fx unique ID
|
||||
VstInt32 fxVersion; ///< fx version
|
||||
|
||||
VstInt32 numParams; ///< number of parameters
|
||||
char prgName[28]; ///< program name (null-terminated ASCII string)
|
||||
|
||||
union
|
||||
{
|
||||
float params[1]; ///< variable sized array with parameter values
|
||||
struct
|
||||
{
|
||||
VstInt32 size; ///< size of program data
|
||||
char chunk[1]; ///< variable sized array with opaque program data
|
||||
} data; ///< program chunk data
|
||||
} content; ///< program content depending on fxMagic
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
/** Bank (fxb) structure. */
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
struct fxBank
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
VstInt32 chunkMagic; ///< 'CcnK'
|
||||
VstInt32 byteSize; ///< size of this chunk, excl. magic + byteSize
|
||||
|
||||
VstInt32 fxMagic; ///< 'FxBk' (regular) or 'FBCh' (opaque chunk)
|
||||
VstInt32 version; ///< format version (1 or 2)
|
||||
VstInt32 fxID; ///< fx unique ID
|
||||
VstInt32 fxVersion; ///< fx version
|
||||
|
||||
VstInt32 numPrograms; ///< number of programs
|
||||
|
||||
#if VST_2_4_EXTENSIONS
|
||||
VstInt32 currentProgram; ///< version 2: current program number
|
||||
char future[124]; ///< reserved, should be zero
|
||||
#else
|
||||
char future[128]; ///< reserved, should be zero
|
||||
#endif
|
||||
|
||||
union
|
||||
{
|
||||
fxProgram programs[1]; ///< variable number of programs
|
||||
struct
|
||||
{
|
||||
VstInt32 size; ///< size of bank data
|
||||
char chunk[1]; ///< variable sized array with opaque bank data
|
||||
} data; ///< bank chunk data
|
||||
} content; ///< bank content depending on fxMagic
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
#endif // __vstfxstore__
|
||||
1
src/backend/src/engine/src/host/vst2/vst2_host.cpp
Normal file
1
src/backend/src/engine/src/host/vst2/vst2_host.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "vst2_host.h"
|
||||
5
src/backend/src/engine/src/host/vst2/vst2_host.h
Normal file
5
src/backend/src/engine/src/host/vst2/vst2_host.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
class vst2_host {
|
||||
|
||||
};
|
||||
@@ -1,67 +1,184 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <condition_variable>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
#include "ipc/shm_mgr.h"
|
||||
|
||||
#include "plugin_manage/plugin_host_manager.h"
|
||||
|
||||
#include "misc_type.h"
|
||||
#include "ipc/ipc_node.h"
|
||||
#include "ipc/shm_mgr.h"
|
||||
#include "misc_type.h"
|
||||
#include "plugin_manage/plugin_host_manager.h"
|
||||
#include "rpc/engine_rpc.h"
|
||||
|
||||
boost::atomic<heartbeat_t>* engine_heartbeat = nullptr;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
shm_mgr::get_instance().init(true);
|
||||
(void)shm_mgr::msg_shm().destroy<boost::atomic<heartbeat_t>>("engine_heartbeat");
|
||||
engine_heartbeat = shm_mgr::msg_shm().construct_with_name<boost::atomic<heartbeat_t>>("engine_heartbeat", std::chrono::high_resolution_clock::now().time_since_epoch().count());
|
||||
// 创建一个心跳线程
|
||||
std::thread([]() {
|
||||
while (engine_heartbeat && *engine_heartbeat != 0) {
|
||||
*engine_heartbeat = std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
}).detach();
|
||||
namespace {
|
||||
constexpr float PI = 3.14159265359f;
|
||||
}
|
||||
|
||||
engine_ipc_node node;
|
||||
class AudioEngine {
|
||||
public:
|
||||
static constexpr size_t AUDIO_BLOCK_SIZE = 512;
|
||||
static constexpr size_t SAMPLE_RATE = 44100;
|
||||
static constexpr std::chrono::milliseconds PROCESSING_INTERVAL{10};
|
||||
|
||||
auto& host_manager = plugin_host_manager::get_instance();
|
||||
auto host_ins = host_manager.load_plugin(R"(D:\Projects\Alicho\src\backend\src\vst2_host\test\4Front Piano x64.dll)");
|
||||
AudioEngine() : running_(false), processing_(false) {}
|
||||
|
||||
bool processing = false;
|
||||
while (true) {
|
||||
node.process_rpc();
|
||||
host_manager.tick();
|
||||
void start() {
|
||||
running_ = true;
|
||||
|
||||
auto& rb = host_ins->plugin_node_.get_audio_rb();
|
||||
const auto& processed = rb.get_processed_block();
|
||||
if (!processed.data) {
|
||||
if (!processing) {
|
||||
const auto& b = rb.acquire_pending_block(512);
|
||||
if (b.data) {
|
||||
// 填充0
|
||||
for (size_t i = 0; i < b.size; ++i) {
|
||||
b.data[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
rb.commit_pending_block(b);
|
||||
}
|
||||
processing = true;
|
||||
} else {
|
||||
// 打印数据
|
||||
for (int i = 0; i < processed.size; ++i) {
|
||||
std::cout << processed.data[i] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
rb.release_processed_block();
|
||||
processing = false;
|
||||
}
|
||||
shm_mgr::get_instance().init(true);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds::zero());
|
||||
(void)shm_mgr::msg_shm().destroy<boost::atomic<heartbeat_t>>("engine_heartbeat");
|
||||
engine_heartbeat = shm_mgr::msg_shm().construct_with_name<boost::atomic<heartbeat_t>>(
|
||||
"engine_heartbeat", std::chrono::high_resolution_clock::now().time_since_epoch().count());
|
||||
|
||||
heartbeat_thread_ = std::thread([this]() { heartbeat_loop(); });
|
||||
audio_thread_ = std::thread([this]() { audio_processing_loop(); });
|
||||
}
|
||||
|
||||
*engine_heartbeat = 0;
|
||||
void stop() {
|
||||
running_ = false;
|
||||
cv_.notify_all();
|
||||
|
||||
if (heartbeat_thread_.joinable()) {
|
||||
heartbeat_thread_.join();
|
||||
}
|
||||
if (audio_thread_.joinable()) {
|
||||
audio_thread_.join();
|
||||
}
|
||||
|
||||
if (engine_heartbeat) {
|
||||
*engine_heartbeat = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void heartbeat_loop() {
|
||||
while (running_) {
|
||||
if (engine_heartbeat) {
|
||||
*engine_heartbeat = std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
}
|
||||
|
||||
void audio_processing_loop() {
|
||||
engine_ipc_node node;
|
||||
auto& host_manager = plugin_host_manager::get_instance();
|
||||
auto host_instance = host_manager.load_plugin(R"(D:\Projects\Alicho\src\backend\src\vst2_host\test\4Front Piano x64.dll)");
|
||||
if (!host_instance) {
|
||||
std::cerr << "Failed to load plugin" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
auto& audio_rb = host_instance->plugin_node_.get_audio_rb();
|
||||
|
||||
setup_audio_parameters(host_instance);
|
||||
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
|
||||
while (running_) {
|
||||
auto start_time = std::chrono::steady_clock::now();
|
||||
|
||||
node.process_rpc();
|
||||
host_manager.tick();
|
||||
|
||||
if (!host_instance->is_process_running()) {
|
||||
std::cerr << "Plugin process is no longer running." << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
process_audio_blocks(audio_rb);
|
||||
|
||||
auto end_time = std::chrono::steady_clock::now();
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time);
|
||||
|
||||
if (elapsed < PROCESSING_INTERVAL) {
|
||||
auto sleep_time = PROCESSING_INTERVAL - elapsed;
|
||||
cv_.wait_for(lock, sleep_time, [this] { return !running_; });
|
||||
} else {
|
||||
std::cerr << "Audio processing timeout: " << elapsed.count() << "ms" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setup_audio_parameters(const std::shared_ptr<plugin_instance>& /*plugin*/) {
|
||||
// TODO: propagate engine sample rate and block size to the plugin host via RPC.
|
||||
}
|
||||
|
||||
void process_audio_blocks(audio_ring_buffer<float>& rb) {
|
||||
const auto processed_block = rb.get_processed_block();
|
||||
|
||||
if (!processed_block.data) {
|
||||
if (!processing_) {
|
||||
const auto pending_block = rb.acquire_pending_block(AUDIO_BLOCK_SIZE);
|
||||
if (pending_block.data) {
|
||||
generate_audio_data(pending_block);
|
||||
rb.commit_pending_block(pending_block);
|
||||
}
|
||||
}
|
||||
processing_ = true;
|
||||
} else {
|
||||
handle_processed_audio(processed_block);
|
||||
rb.release_processed_block();
|
||||
processing_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void generate_audio_data(const audio_ring_buffer<float>::audio_block& block) {
|
||||
static float phase = 0.0f;
|
||||
const float frequency = 440.0f;
|
||||
const float phase_increment = 2.0f * PI * frequency / static_cast<float>(SAMPLE_RATE);
|
||||
|
||||
for (size_t i = 0; i < block.size; ++i) {
|
||||
block.data[i] = std::sin(phase) * 0.1f;
|
||||
phase += phase_increment;
|
||||
if (phase > 2.0f * PI) {
|
||||
phase -= 2.0f * PI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handle_processed_audio(const audio_ring_buffer<float>::audio_block& block) {
|
||||
float peak = 0.0f;
|
||||
float rms = 0.0f;
|
||||
|
||||
for (size_t i = 0; i < block.size; ++i) {
|
||||
const float sample = std::abs(block.data[i]);
|
||||
peak = std::max(peak, sample);
|
||||
rms += sample * sample;
|
||||
}
|
||||
|
||||
rms = std::sqrt(rms / static_cast<float>(block.size));
|
||||
|
||||
static int counter = 0;
|
||||
if (++counter % 100 == 0) {
|
||||
std::cout << "Audio stats - Peak: " << peak << ", RMS: " << rms << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::thread heartbeat_thread_;
|
||||
std::thread audio_thread_;
|
||||
std::atomic<bool> running_;
|
||||
std::atomic<bool> processing_;
|
||||
std::mutex mutex_;
|
||||
std::condition_variable cv_;
|
||||
};
|
||||
|
||||
int main(int /*argc*/, char* /*argv*/[]) {
|
||||
AudioEngine engine;
|
||||
|
||||
engine.start();
|
||||
|
||||
std::cout << "Audio engine started. Press Enter to stop..." << std::endl;
|
||||
std::cin.get();
|
||||
|
||||
engine.stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#include "plugin_host_manager.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
|
||||
#include "plugin_instance.h"
|
||||
|
||||
@@ -13,48 +17,87 @@ plugin_host_manager::~plugin_host_manager() {
|
||||
ids_to_unload.push_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
// Request graceful shutdown for all plugins first.
|
||||
for (const auto& id: ids_to_unload) {
|
||||
if (auto instance = get_plugin_instance(id)) {
|
||||
instance->request_graceful_shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
// Give plugins a moment to exit cleanly.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
// Then force terminate any remaining processes.
|
||||
for (const auto& id: ids_to_unload) {
|
||||
unload_plugin(id);
|
||||
}
|
||||
}
|
||||
|
||||
plugin_instance* plugin_host_manager::load_plugin(const std::filesystem::path& plugin_binary_path) {
|
||||
std::shared_ptr<plugin_instance> plugin_host_manager::load_plugin(const std::filesystem::path& plugin_binary_path) {
|
||||
auto plugin_id = get_next_plugin_id();
|
||||
|
||||
plugin_instance* ptr = nullptr;
|
||||
std::shared_ptr<plugin_instance> instance;
|
||||
try {
|
||||
auto instance = std::make_unique<plugin_instance>(io_context_, plugin_id, plugin_binary_path);
|
||||
ptr = instance.get();
|
||||
instance = std::make_shared<plugin_instance>(io_context_, plugin_id, plugin_binary_path);
|
||||
|
||||
// Remove the instance from the manager once the host process exits.
|
||||
instance->async_wait_for_exit([this, plugin_id](int exit_code) {
|
||||
spdlog::info("Plugin {} exited with code {}", plugin_id, exit_code);
|
||||
|
||||
std::lock_guard lock(mutex_);
|
||||
plugin_instances_.erase(plugin_id);
|
||||
});
|
||||
|
||||
std::lock_guard lock(mutex_);
|
||||
plugin_instances_.emplace(plugin_id, std::move(instance));
|
||||
plugin_instances_.emplace(plugin_id, instance);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
// TODO: 如果创建失败,清理已分配的资源
|
||||
spdlog::error("无法加载插件 {}:{}", plugin_binary_path.string(), e.what());
|
||||
}
|
||||
|
||||
return ptr;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void plugin_host_manager::unload_plugin(uint32_t plugin_id) {
|
||||
if (auto instance = get_plugin_instance(plugin_id)) {
|
||||
instance->kill_process(true);
|
||||
// Try graceful shutdown first.
|
||||
instance->request_graceful_shutdown();
|
||||
|
||||
// Allow a short grace period.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
|
||||
// Force terminate if the process is still running.
|
||||
if (instance->is_process_running()) {
|
||||
instance->kill_process(true);
|
||||
}
|
||||
|
||||
std::lock_guard lock(mutex_);
|
||||
plugin_instances_.erase(plugin_id);
|
||||
}
|
||||
}
|
||||
|
||||
void plugin_host_manager::tick() {
|
||||
// Service asynchronous operations.
|
||||
io_context_.poll();
|
||||
|
||||
}
|
||||
|
||||
plugin_instance* plugin_host_manager::get_plugin_instance(uint32_t plugin_id) {
|
||||
// Remove dead plugin instances.
|
||||
std::lock_guard lock(mutex_);
|
||||
const auto& it = plugin_instances_.find(plugin_id);
|
||||
if (it != plugin_instances_.end()) {
|
||||
return it->second.get();
|
||||
for (auto it = plugin_instances_.begin(); it != plugin_instances_.end(); ) {
|
||||
if (!it->second->is_process_running()) {
|
||||
spdlog::info("Removing dead plugin instance {}", it->first);
|
||||
it = plugin_instances_.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<plugin_instance> plugin_host_manager::get_plugin_instance(uint32_t plugin_id) {
|
||||
std::lock_guard lock(mutex_);
|
||||
const auto it = plugin_instances_.find(plugin_id);
|
||||
if (it != plugin_instances_.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <ranges>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "lazy_singleton.h"
|
||||
#include "plugin_instance.h"
|
||||
@@ -9,11 +11,11 @@ class plugin_host_manager : public lazy_singleton<plugin_host_manager> {
|
||||
public:
|
||||
~plugin_host_manager();
|
||||
|
||||
plugin_instance* load_plugin(const std::filesystem::path& plugin_binary_path);
|
||||
std::shared_ptr<plugin_instance> load_plugin(const std::filesystem::path& plugin_binary_path);
|
||||
void unload_plugin(uint32_t plugin_id);
|
||||
void tick();
|
||||
|
||||
plugin_instance* get_plugin_instance(uint32_t plugin_id);
|
||||
std::shared_ptr<plugin_instance> get_plugin_instance(uint32_t plugin_id);
|
||||
|
||||
template<typename Func>
|
||||
void for_each_plugin_instance(Func&& func) {
|
||||
@@ -28,7 +30,7 @@ private:
|
||||
}
|
||||
|
||||
std::mutex mutex_;
|
||||
std::unordered_map<uint32_t, std::unique_ptr<plugin_instance>> plugin_instances_;
|
||||
std::unordered_map<uint32_t, std::shared_ptr<plugin_instance>> plugin_instances_;
|
||||
std::atomic_uint32_t plugin_id_ = 1;
|
||||
boost::asio::io_context io_context_;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "plugin_instance.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace bi = boost::interprocess;
|
||||
namespace bp = boost::process;
|
||||
namespace bp = boost::process_v2;
|
||||
|
||||
[[nodiscard]] static auto get_plugin_id_name(uint32_t in_id) {
|
||||
return "plugin_" + std::to_string(in_id);
|
||||
@@ -35,7 +36,13 @@ auto execute_plugin_process(uint32_t id, boost::asio::io_context& ctx, const std
|
||||
throw std::runtime_error("未找到主机可执行文件:" + host_path.string());
|
||||
}
|
||||
|
||||
return new bp::process(ctx, host_path.string(), { get_plugin_id_name(id) });
|
||||
// 使用最新的Boost.Process v2 API
|
||||
try {
|
||||
return std::make_unique<bp::process>(ctx, host_path.string(), bp::process::args_t{get_plugin_id_name(id)});
|
||||
} catch (const std::exception& e) {
|
||||
spdlog::error("Failed to create plugin process: {}", e.what());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
plugin_instance::plugin_instance(boost::asio::io_context& ctx,
|
||||
@@ -53,13 +60,38 @@ plugin_instance::plugin_instance(boost::asio::io_context& ctx,
|
||||
// output_queue = output_segment->find_or_construct<lock_free_queue>("output_queue")();
|
||||
|
||||
plugin_node_.get_audio_rb().create_buffer(get_plugin_id_name(id), 10, 512); // 10块512采样点的缓冲区
|
||||
process = std::shared_ptr<boost::process::process>(execute_plugin_process(id, ctx, in_plugin_path), [](boost::process::process* p) {
|
||||
delete p;
|
||||
});
|
||||
if (!is_process_running()) {
|
||||
throw std::runtime_error("插件进程启动失败, 退出码: " + std::to_string(process->exit_code()));
|
||||
|
||||
process = execute_plugin_process(id, ctx, in_plugin_path);
|
||||
|
||||
if (!process || !is_process_running()) {
|
||||
throw std::runtime_error("插件进程启动失败");
|
||||
}
|
||||
|
||||
// 设置进程退出回调
|
||||
process->async_wait([this](boost::system::error_code ec, int exit_code) {
|
||||
if (!ec) {
|
||||
spdlog::info("Plugin process {} exited with code {}", id, exit_code);
|
||||
// 在这里可以处理进程退出事件
|
||||
is_processing_done = true;
|
||||
is_registered = false;
|
||||
}
|
||||
});
|
||||
|
||||
plugin_node_.open_queue(get_plugin_id_name(id));
|
||||
}
|
||||
|
||||
plugin_instance::~plugin_instance() {}
|
||||
plugin_instance::~plugin_instance() {
|
||||
// 使用新的API进行优雅关闭
|
||||
request_graceful_shutdown();
|
||||
|
||||
// 给予进程一定时间进行优雅关闭
|
||||
boost::system::error_code ec;
|
||||
if (process && process->is_open()) {
|
||||
// 等待最多1秒
|
||||
process->wait_for(std::chrono::seconds(1), ec);
|
||||
if (ec) {
|
||||
// 如果等待超时,强制终止
|
||||
kill_process(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <boost/process.hpp>
|
||||
#include <boost/process/v2.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
|
||||
#include "ipc/ipc_node.h"
|
||||
#include "rpc/common.h"
|
||||
|
||||
namespace bp = boost::process_v2;
|
||||
|
||||
struct plugin_instance {
|
||||
plugin_instance(boost::asio::io_context& ctx, uint32_t in_id, const std::filesystem::path& in_plugin_path);
|
||||
~plugin_instance();
|
||||
@@ -21,18 +23,41 @@ struct plugin_instance {
|
||||
std::atomic_bool is_registered{ false }; // RPC会话是否注册
|
||||
|
||||
auto is_process_running() const {
|
||||
return process && process->running();
|
||||
return process && process->is_open();
|
||||
}
|
||||
void kill_process(bool wait) {
|
||||
if (is_process_running()) {
|
||||
process->terminate();
|
||||
if (wait)
|
||||
process->wait();
|
||||
|
||||
void async_wait_for_exit(std::function<void(int)> callback) {
|
||||
if (process && process->is_open()) {
|
||||
process->async_wait([callback = std::move(callback)](boost::system::error_code ec, int exit_code) {
|
||||
if (!ec) {
|
||||
callback(exit_code);
|
||||
}
|
||||
});
|
||||
}
|
||||
process = nullptr;
|
||||
}
|
||||
|
||||
void request_graceful_shutdown() {
|
||||
if (process && process->is_open()) {
|
||||
boost::system::error_code ec;
|
||||
process->request_exit(ec);
|
||||
if (!ec) {
|
||||
// 优雅关闭请求已发送
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kill_process(bool wait) {
|
||||
if (process && process->is_open()) {
|
||||
boost::system::error_code ec;
|
||||
process->terminate(ec);
|
||||
if (wait && !ec) {
|
||||
process->wait(ec);
|
||||
}
|
||||
}
|
||||
process.reset();
|
||||
}
|
||||
|
||||
plugin_ipc_remote_node plugin_node_;
|
||||
private:
|
||||
std::shared_ptr<boost::process::process> process; // 沙箱进程句柄
|
||||
std::unique_ptr<bp::process> process; // 使用最新Boost.Process v2 API
|
||||
};
|
||||
|
||||
@@ -89,21 +89,21 @@ private:
|
||||
*/
|
||||
struct shared_control_block {
|
||||
// 原子变量,用于无锁队列和缓冲区的位置跟踪
|
||||
alignas(64) std::atomic<size_t> pending_write_pos{ 0 }; // "待处理"队列的写指针
|
||||
alignas(64) std::atomic<size_t> pending_read_pos{ 0 }; // "待处理"队列的读指针
|
||||
alignas(64) std::atomic<size_t> processed_write_pos{ 0 }; // "已处理"队列的写指针
|
||||
alignas(64) std::atomic<size_t> processed_read_pos{ 0 }; // "已处理"队列的读指针
|
||||
alignas(64) std::atomic<size_t> audio_write_pos{ 0 }; // 音频数据环形缓冲区的写指针
|
||||
alignas(64) std::atomic<size_t> audio_read_pos{ 0 }; // 音频数据环形缓冲区的读指针
|
||||
std::atomic<size_t> pending_write_pos{ 0 }; // "待处理"队列的写指针
|
||||
std::atomic<size_t> pending_read_pos{ 0 }; // "待处理"队列的读指针
|
||||
std::atomic<size_t> processed_write_pos{ 0 }; // "已处理"队列的写指针
|
||||
std::atomic<size_t> processed_read_pos{ 0 }; // "已处理"队列的读指针
|
||||
std::atomic<size_t> audio_write_pos{ 0 }; // 音频数据环形缓冲区的写指针
|
||||
std::atomic<size_t> audio_read_pos{ 0 }; // 音频数据环形缓冲区的读指针
|
||||
|
||||
// 静态容量信息
|
||||
alignas(64) size_t queue_capacity{}; // 队列容量 (pending 和 processed 队列大小相同)
|
||||
alignas(64) size_t audio_buffer_size{}; // 音频数据缓冲区的总容量
|
||||
size_t queue_capacity{}; // 队列容量 (pending 和 processed 队列大小相同)
|
||||
size_t audio_buffer_size{}; // 音频数据缓冲区的总容量
|
||||
|
||||
// TODO: 这个参数似乎没有在当前逻辑中使用,可以考虑移除或实现相关功能。
|
||||
alignas(64) size_t block_size{}; // 初始块大小
|
||||
size_t block_size{}; // 初始块大小
|
||||
|
||||
alignas(64) char initialized{}; // 初始化标志,用于确保共享内存只被初始化一次
|
||||
char initialized{}; // 初始化标志,用于确保共享内存只被初始化一次
|
||||
|
||||
shared_control_block() = default;
|
||||
|
||||
@@ -120,9 +120,9 @@ private:
|
||||
* 描述了一个已提交的音频块在主音频缓冲区中的位置和元数据。
|
||||
*/
|
||||
struct queue_entry {
|
||||
alignas(64) size_t audio_offset; // 数据在 audio_buffer_ 中的偏移量
|
||||
alignas(64) size_t size; // 数据块的大小
|
||||
alignas(64) uint64_t timestamp; // 时间戳
|
||||
size_t audio_offset; // 数据在 audio_buffer_ 中的偏移量
|
||||
size_t size; // 数据块的大小
|
||||
uint64_t timestamp; // 时间戳
|
||||
|
||||
queue_entry() = default;
|
||||
|
||||
@@ -134,11 +134,15 @@ private:
|
||||
|
||||
shm_block audio_shm_; // 共享内存管理器实例
|
||||
std::string buffer_name_; // 缓冲区的唯一名称标识符
|
||||
shared_control_block* control_; // 指向共享内存中的控制块
|
||||
queue_entry* pending_queue_; // 指向"待处理"队列的共享内存区域
|
||||
queue_entry* processed_queue_; // 指向"已处理"队列的共享内存区域
|
||||
T* audio_buffer_; // 指向音频数据环形缓冲区的共享内存区域
|
||||
|
||||
struct shm_data {
|
||||
shm_obj_t<shared_control_block> control;
|
||||
shm_obj_t<queue_entry> pending_queue;
|
||||
shm_obj_t<queue_entry> processed_queue;
|
||||
shm_obj_t<T> audio_buffer;
|
||||
[[nodiscard]] bool is_valid() const {
|
||||
return !control.is_null() && !pending_queue.is_null() && !processed_queue.is_null() && !audio_buffer.is_null();
|
||||
}
|
||||
} *data;
|
||||
public:
|
||||
// --- 构造、析构与生命周期管理 (Constructors, Destructor & Lifetime) ---
|
||||
|
||||
@@ -146,35 +150,22 @@ public:
|
||||
~audio_ring_buffer() = default;
|
||||
|
||||
// 移动构造函数:高效转移资源所有权
|
||||
audio_ring_buffer(audio_ring_buffer&& other) noexcept
|
||||
: audio_shm_(std::move(other.audio_shm_)),
|
||||
buffer_name_(std::move(other.buffer_name_)),
|
||||
control_(other.control_),
|
||||
pending_queue_(other.pending_queue_),
|
||||
processed_queue_(other.processed_queue_),
|
||||
audio_buffer_(other.audio_buffer_) {
|
||||
audio_ring_buffer(audio_ring_buffer&& other) noexcept : audio_shm_(std::move(other.audio_shm_)),
|
||||
buffer_name_(std::move(other.buffer_name_)),
|
||||
data(other.data) {
|
||||
// 将源对象的指针置空,防止其析构时释放资源
|
||||
other.control_ = nullptr;
|
||||
other.pending_queue_ = nullptr;
|
||||
other.processed_queue_ = nullptr;
|
||||
other.audio_buffer_ = nullptr;
|
||||
other.shm_data.control = {};
|
||||
}
|
||||
|
||||
// 移动赋值运算符
|
||||
audio_ring_buffer& operator=(audio_ring_buffer&& other) noexcept {
|
||||
if (this != &other) {
|
||||
audio_shm_ = std::move(other.audio_shm_);
|
||||
buffer_name_ = std::move(other.buffer_name_);
|
||||
control_ = other.control_;
|
||||
pending_queue_ = other.pending_queue_;
|
||||
processed_queue_ = other.processed_queue_;
|
||||
audio_buffer_ = other.audio_buffer_;
|
||||
audio_shm_ = other.audio_shm_;
|
||||
buffer_name_ = std::move(other.buffer_name_);
|
||||
data = other.data;
|
||||
|
||||
// 将源对象的指针置空
|
||||
other.control_ = nullptr;
|
||||
other.pending_queue_ = nullptr;
|
||||
other.processed_queue_ = nullptr;
|
||||
other.audio_buffer_ = nullptr;
|
||||
other.shm_data.control = {};
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -207,7 +198,7 @@ public:
|
||||
audio_shm_ = shm_mgr::ab_shm();
|
||||
buffer_name_ = in_name;
|
||||
initialize_shared_structures(queue_capacity, audio_buffer_capacity, block_size);
|
||||
return control_ != nullptr;
|
||||
return data->is_valid();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,7 +217,7 @@ public:
|
||||
audio_shm_ = shm_mgr::ab_shm();
|
||||
buffer_name_ = in_name;
|
||||
connect_to_existing_structures();
|
||||
return control_ != nullptr;
|
||||
return data->is_valid();
|
||||
}
|
||||
|
||||
// --- 核心写入操作 (Core Write Operations) ---
|
||||
@@ -250,8 +241,8 @@ public:
|
||||
* }
|
||||
*/
|
||||
audio_block acquire_pending_block(size_t required_size) {
|
||||
auto write_pos = control_->audio_write_pos.load(std::memory_order_acquire);
|
||||
auto read_pos = control_->audio_read_pos.load(std::memory_order_acquire);
|
||||
auto write_pos = data->control->audio_write_pos.load(std::memory_order_acquire);
|
||||
auto read_pos = data->control->audio_read_pos.load(std::memory_order_acquire);
|
||||
|
||||
auto available = calculate_available_space(write_pos, read_pos);
|
||||
|
||||
@@ -261,13 +252,13 @@ public:
|
||||
return audio_block(); // 扩展失败,返回无效块
|
||||
}
|
||||
// 扩容后,重新获取指针和可用空间
|
||||
write_pos = control_->audio_write_pos.load(std::memory_order_acquire);
|
||||
read_pos = control_->audio_read_pos.load(std::memory_order_acquire); // read_pos 也可能因数据整理而改变
|
||||
write_pos = data->control->audio_write_pos.load(std::memory_order_acquire);
|
||||
read_pos = data->control->audio_read_pos.load(std::memory_order_acquire); // read_pos 也可能因数据整理而改变
|
||||
available = calculate_available_space(write_pos, read_pos);
|
||||
}
|
||||
|
||||
// 检查在当前写指针位置是否有足够的连续空间
|
||||
if (write_pos + required_size > control_->audio_buffer_size) {
|
||||
if (write_pos + required_size > data->control->audio_buffer_size) {
|
||||
// 如果尾部空间不足,检查头部是否有足够空间(即环绕)
|
||||
if (read_pos >= required_size) {
|
||||
// 可以安全地环绕到缓冲区开头
|
||||
@@ -280,7 +271,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return audio_block(audio_buffer_ + write_pos, required_size);
|
||||
return audio_block(data->audio_buffer.to_local() + write_pos, required_size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,8 +295,8 @@ public:
|
||||
* }
|
||||
*/
|
||||
bool commit_pending_block(const audio_block& block, uint64_t timestamp = 0) {
|
||||
auto queue_write = control_->pending_write_pos.load(std::memory_order_acquire);
|
||||
auto queue_read = control_->pending_read_pos.load(std::memory_order_acquire);
|
||||
auto queue_write = data->control->pending_write_pos.load(std::memory_order_acquire);
|
||||
auto queue_read = data->control->pending_read_pos.load(std::memory_order_acquire);
|
||||
|
||||
// 检查 "待处理" 队列是否已满
|
||||
if (is_queue_full(queue_write, queue_read)) {
|
||||
@@ -313,18 +304,18 @@ public:
|
||||
return false; // 队列扩容失败
|
||||
}
|
||||
// 扩容后重新获取指针
|
||||
queue_write = control_->pending_write_pos.load(std::memory_order_acquire);
|
||||
queue_read = control_->pending_read_pos.load(std::memory_order_acquire);
|
||||
queue_write = data->control->pending_write_pos.load(std::memory_order_acquire);
|
||||
queue_read = data->control->pending_read_pos.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
// 计算数据在缓冲区中的偏移量
|
||||
auto audio_offset = block.data - audio_buffer_;
|
||||
auto audio_offset = block.data - data->audio_buffer.to_local();
|
||||
|
||||
// 在队列中创建一个新条目
|
||||
pending_queue_[queue_write] = queue_entry(audio_offset, block.size, timestamp);
|
||||
data->pending_queue[queue_write] = queue_entry(audio_offset, block.size, timestamp);
|
||||
|
||||
// 更新音频数据缓冲区的真实写指针
|
||||
control_->audio_write_pos.store(audio_offset + block.size, std::memory_order_release);
|
||||
data->control->audio_write_pos.store(audio_offset + block.size, std::memory_order_release);
|
||||
|
||||
// 原子地推进 "待处理" 队列的写指针
|
||||
auto next_write = (queue_write + 1) % control_->queue_capacity;
|
||||
@@ -548,53 +539,25 @@ private:
|
||||
void initialize_shared_structures(size_t queue_capacity,
|
||||
size_t audio_buffer_capacity,
|
||||
size_t block_size) {
|
||||
const std::string control_name = buffer_name_ + "_Control";
|
||||
control_ = audio_shm_.find_or_construct<shared_control_block>(control_name, queue_capacity, audio_buffer_capacity, block_size);
|
||||
auto control = audio_shm_.construct<shared_control_block>(queue_capacity, audio_buffer_capacity, block_size);
|
||||
auto pending_queue = audio_shm_.construct<queue_entry>();
|
||||
auto processed_queue = audio_shm_.construct<queue_entry>();
|
||||
auto audio_buffer = audio_shm_.construct<T>(audio_buffer_capacity);
|
||||
|
||||
const std::string pending_name = buffer_name_ + "_PendingQueue";
|
||||
const std::string processed_name = buffer_name_ + "_ProcessedQueue";
|
||||
const std::string audio_name = buffer_name_ + "_AudioBuffer";
|
||||
|
||||
pending_queue_ = audio_shm_.find_or_construct<queue_entry>(pending_name);
|
||||
processed_queue_ = audio_shm_.find_or_construct<queue_entry>(processed_name);
|
||||
audio_buffer_ = audio_shm_.find_or_construct<T>(audio_name, audio_buffer_capacity);
|
||||
|
||||
if (!control_ || !pending_queue_ || !processed_queue_ || !audio_buffer_) {
|
||||
// 如果任何一个结构创建失败,则抛出异常
|
||||
throw std::runtime_error("Failed to initialize audio ring buffer structures in shared memory.");
|
||||
}
|
||||
data = audio_shm_.construct_with_name<shm_data>(buffer_name_);
|
||||
data->control = control;
|
||||
data->pending_queue = pending_queue;
|
||||
data->processed_queue = processed_queue;
|
||||
data->audio_buffer = audio_buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 连接到已存在的共享内存数据结构。
|
||||
*/
|
||||
void connect_to_existing_structures() {
|
||||
const std::string control_name = buffer_name_ + "_Control";
|
||||
control_ = audio_shm_.find<shared_control_block>(control_name);
|
||||
if (!control_) {
|
||||
throw std::runtime_error("AudioRingBuffer control block not found: " +
|
||||
control_name);
|
||||
}
|
||||
|
||||
const std::string pending_name = buffer_name_ + "_PendingQueue";
|
||||
pending_queue_ = audio_shm_.find<queue_entry>(pending_name);
|
||||
if (!pending_queue_) {
|
||||
throw std::runtime_error("AudioRingBuffer pending queue not found: " +
|
||||
pending_name);
|
||||
}
|
||||
|
||||
const std::string processed_name = buffer_name_ + "_ProcessedQueue";
|
||||
processed_queue_ = audio_shm_.find<queue_entry>(processed_name);
|
||||
if (!processed_queue_) {
|
||||
throw std::runtime_error("AudioRingBuffer processed queue not found: " +
|
||||
processed_name);
|
||||
}
|
||||
|
||||
const std::string audio_name = buffer_name_ + "_AudioBuffer";
|
||||
audio_buffer_ = audio_shm_.find<T>(audio_name);
|
||||
if (!audio_buffer_) {
|
||||
throw std::runtime_error("AudioRingBuffer audio buffer not found: " +
|
||||
audio_name);
|
||||
data = audio_shm_.find<shm_data>(buffer_name_);
|
||||
if (!data) {
|
||||
throw std::runtime_error("Failed to connect to existing shared memory structures");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ auto shm_ptr_t::to_local() const -> void* {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
auto shm_ptr_t::from_local(shm_block_type in_type, void* in_ptr) {
|
||||
auto shm_ptr_t::from_local(shm_block_type in_type, void* in_ptr) -> shm_ptr_t {
|
||||
int64_t h = 0;
|
||||
switch (in_type) {
|
||||
case shm_block_type::message:
|
||||
|
||||
@@ -306,10 +306,25 @@ struct shm_ptr_t {
|
||||
return static_cast<T*>(to_local());
|
||||
}
|
||||
|
||||
[[nodiscard]] static auto from_local(shm_block_type in_type, void* in_ptr);
|
||||
[[nodiscard]] static auto from_local(shm_block_type in_type, void* in_ptr) -> shm_ptr_t;
|
||||
[[nodiscard]] static auto null() -> shm_ptr_t { return shm_ptr_t{ shm_block_type::invalid, 0 }; }
|
||||
|
||||
[[nodiscard]] bool is_null() const { return type == shm_block_type::invalid || handle == 0; }
|
||||
explicit operator bool() const { return !is_null(); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct shm_obj_t {
|
||||
shm_ptr_t ptr;
|
||||
|
||||
[[nodiscard]] auto is_null() const { return ptr.is_null(); }
|
||||
[[nodiscard]] auto to_local() const { return ptr.to_local<T>(); }
|
||||
|
||||
auto operator ->() const { return ptr.to_local<T>(); }
|
||||
|
||||
explicit operator bool() const {
|
||||
return !ptr.is_null();
|
||||
}
|
||||
};
|
||||
|
||||
// 包装器 - 保持原有接口完全不变
|
||||
|
||||
@@ -52,7 +52,7 @@ void shm_string::set_string(const std::string& in_str) {
|
||||
handle = 0;
|
||||
throw std::runtime_error("共享内存字符串构造失败");
|
||||
}
|
||||
handle = block.get_handle_from_address(shm_str);
|
||||
handle = block.get_handle_from_address(shm_str.to_local());
|
||||
}
|
||||
catch (...) {
|
||||
handle = 0;
|
||||
|
||||
287
src/backend/src/misc/src/midi_type.h
Normal file
287
src/backend/src/misc/src/midi_type.h
Normal file
@@ -0,0 +1,287 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
#include <expected>
|
||||
#include <format>
|
||||
#include <concepts>
|
||||
#include <array>
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
|
||||
namespace midi_type {
|
||||
enum class event_type : std::uint8_t {
|
||||
note_off = 0x80,
|
||||
note_on = 0x90,
|
||||
polyphonic_key_pressure = 0xA0,
|
||||
control_change = 0xB0,
|
||||
program_change = 0xC0,
|
||||
channel_pressure = 0xD0,
|
||||
pitch_bend = 0xE0,
|
||||
system_exclusive = 0xF0,
|
||||
time_code = 0xF1,
|
||||
song_position = 0xF2,
|
||||
song_select = 0xF3,
|
||||
tune_request = 0xF6,
|
||||
timing_clock = 0xF8,
|
||||
start = 0xFA,
|
||||
continue_ = 0xFB,
|
||||
stop = 0xFC,
|
||||
active_sensing = 0xFE,
|
||||
system_reset = 0xFF
|
||||
};
|
||||
|
||||
struct midi_error {
|
||||
enum class code : std::uint8_t {
|
||||
invalid_channel,
|
||||
invalid_velocity,
|
||||
invalid_note,
|
||||
invalid_control_number,
|
||||
invalid_data_byte,
|
||||
invalid_pitch_bend
|
||||
};
|
||||
|
||||
code code;
|
||||
std::string_view message;
|
||||
};
|
||||
|
||||
template<typename T>concept midi_data_byte = requires(T value) {
|
||||
requires std::integral<T>; requires (value >= 0 && value <= 127);
|
||||
};
|
||||
|
||||
template<typename T>concept midi_channel = requires(T channel) {
|
||||
requires std::integral<T>; requires (channel >= 0 && channel <= 15);
|
||||
};
|
||||
|
||||
class midi_event {
|
||||
public:
|
||||
using time_stamp = std::uint64_t;
|
||||
using data_bytes = std::array<std::uint8_t, 2>;
|
||||
|
||||
private:
|
||||
event_type event_type_;
|
||||
std::uint8_t channel_;
|
||||
data_bytes data_;
|
||||
time_stamp timestamp_;
|
||||
|
||||
public:
|
||||
// C++23 designated initializers support
|
||||
struct note_on_data {
|
||||
std::uint8_t note;
|
||||
std::uint8_t velocity;
|
||||
};
|
||||
|
||||
struct note_off_data {
|
||||
std::uint8_t note;
|
||||
std::uint8_t velocity = 0;
|
||||
};
|
||||
|
||||
struct control_change_data {
|
||||
std::uint8_t controller;
|
||||
std::uint8_t value;
|
||||
};
|
||||
|
||||
struct pitch_bend_data {
|
||||
std::uint16_t value; // 14-bit value
|
||||
};
|
||||
|
||||
// Modern constructor with validation
|
||||
constexpr midi_event(event_type type,
|
||||
std::uint8_t channel,
|
||||
data_bytes data = {},
|
||||
time_stamp timestamp = 0) noexcept : event_type_(type),
|
||||
channel_(channel & 0x0F),
|
||||
data_(data),
|
||||
timestamp_(timestamp) {
|
||||
}
|
||||
|
||||
// Factory methods with compile-time validation
|
||||
[[nodiscard]] static constexpr auto create_note_on(std::uint8_t channel,
|
||||
std::uint8_t note,
|
||||
std::uint8_t velocity,
|
||||
time_stamp timestamp = 0) noexcept -> std::expected<
|
||||
midi_event, midi_error> {
|
||||
if (channel > 15) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_channel, .message = "Channel must be 0-15" }
|
||||
};
|
||||
}
|
||||
if (note > 127) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_note, .message = "Note must be 0-127" }
|
||||
};
|
||||
}
|
||||
if (velocity > 127) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_velocity, .message = "Velocity must be 0-127" }
|
||||
};
|
||||
}
|
||||
|
||||
return midi_event{ event_type::note_on, channel, { note, velocity }, timestamp };
|
||||
}
|
||||
|
||||
[[nodiscard]] static constexpr auto create_note_off(std::uint8_t channel,
|
||||
std::uint8_t note,
|
||||
std::uint8_t velocity = 0,
|
||||
time_stamp timestamp = 0) noexcept -> std::expected<
|
||||
midi_event, midi_error> {
|
||||
if (channel > 15) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_channel, .message = "Channel must be 0-15" }
|
||||
};
|
||||
}
|
||||
if (note > 127) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_note, .message = "Note must be 0-127" }
|
||||
};
|
||||
}
|
||||
if (velocity > 127) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_velocity, .message = "Velocity must be 0-127" }
|
||||
};
|
||||
}
|
||||
|
||||
return midi_event{ event_type::note_off, channel, { note, velocity }, timestamp };
|
||||
}
|
||||
|
||||
[[nodiscard]] static constexpr auto create_control_change(std::uint8_t channel,
|
||||
std::uint8_t controller,
|
||||
std::uint8_t value,
|
||||
time_stamp timestamp = 0) noexcept -> std::expected<
|
||||
midi_event, midi_error> {
|
||||
if (channel > 15) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_channel, .message = "Channel must be 0-15" }
|
||||
};
|
||||
}
|
||||
if (controller > 127) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{
|
||||
.code = midi_error::code::invalid_control_number,
|
||||
.message = "Controller must be 0-127"
|
||||
}
|
||||
};
|
||||
}
|
||||
if (value > 127) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_data_byte, .message = "Value must be 0-127" }
|
||||
};
|
||||
}
|
||||
|
||||
return midi_event{ event_type::control_change, channel, { controller, value }, timestamp };
|
||||
}
|
||||
|
||||
[[nodiscard]] static constexpr auto create_pitch_bend(std::uint8_t channel,
|
||||
std::uint16_t value,
|
||||
time_stamp timestamp = 0) noexcept -> std::expected<
|
||||
midi_event, midi_error> {
|
||||
if (channel > 15) [[unlikely]] {
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_channel, .message = "Channel must be 0-15" }
|
||||
};
|
||||
}
|
||||
if (value > 16383) [[unlikely]] { // 14-bit maximum
|
||||
return std::unexpected{
|
||||
midi_error{ .code = midi_error::code::invalid_pitch_bend, .message = "Pitch bend must be 0-16383" }
|
||||
};
|
||||
}
|
||||
|
||||
std::uint8_t lsb = value & 0x7F;
|
||||
std::uint8_t msb = (value >> 7) & 0x7F;
|
||||
|
||||
return midi_event{ event_type::pitch_bend, channel, { lsb, msb }, timestamp };
|
||||
}
|
||||
|
||||
// Modern accessors
|
||||
[[nodiscard]] constexpr auto type() const noexcept { return event_type_; }
|
||||
[[nodiscard]] constexpr auto channel() const noexcept { return channel_; }
|
||||
[[nodiscard]] constexpr auto timestamp() const noexcept { return timestamp_; }
|
||||
[[nodiscard]] constexpr auto data() const noexcept { return std::span{ data_ }; }
|
||||
|
||||
// Specific data accessors
|
||||
[[nodiscard]] constexpr std::uint8_t note() const noexcept requires(true) { return data_[0]; }
|
||||
|
||||
[[nodiscard]] constexpr std::uint8_t velocity() const noexcept { return data_[1]; }
|
||||
|
||||
[[nodiscard]] constexpr std::uint8_t controller() const noexcept { return data_[0]; }
|
||||
|
||||
[[nodiscard]] constexpr std::uint8_t control_value() const noexcept { return data_[1]; }
|
||||
|
||||
[[nodiscard]] constexpr std::uint16_t pitch_bend_value() const noexcept { return data_[0] | (data_[1] << 7); }
|
||||
|
||||
// Serialize to raw MIDI bytes
|
||||
[[nodiscard]] constexpr auto to_bytes() const noexcept -> std::array<std::uint8_t, 3> {
|
||||
std::uint8_t status = static_cast<std::uint8_t>(event_type_) | channel_;
|
||||
return { status, data_[0], data_[1] };
|
||||
}
|
||||
|
||||
// Modern comparison operators (C++20 spaceship)
|
||||
[[nodiscard]] constexpr auto operator<=>(const midi_event& other) const noexcept = default;
|
||||
|
||||
[[nodiscard]] constexpr bool operator==(const midi_event& other) const noexcept = default;
|
||||
|
||||
// Format support
|
||||
[[nodiscard]] std::string to_string() const {
|
||||
return std::format("MidiEvent{{type: 0x{:02X}, channel: {}, data: [{}, {}], timestamp: {}}}",
|
||||
static_cast<std::uint8_t>(event_type_),
|
||||
channel_,
|
||||
data_[0],
|
||||
data_[1],
|
||||
timestamp_);
|
||||
}
|
||||
};
|
||||
|
||||
// Modern RAII MIDI Event Buffer
|
||||
class midi_event_buffer {
|
||||
private:
|
||||
std::vector<midi_event> events_;
|
||||
mutable std::shared_mutex mutex_;
|
||||
|
||||
public:
|
||||
void add_event(const midi_event& event) {
|
||||
std::unique_lock lock{ mutex_ };
|
||||
events_.emplace_back(event);
|
||||
}
|
||||
|
||||
void add_event(midi_event&& event) {
|
||||
std::unique_lock lock{ mutex_ };
|
||||
events_.emplace_back(std::move(event));
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_events() const -> std::vector<midi_event> {
|
||||
std::shared_lock lock{ mutex_ };
|
||||
return events_;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::size_t size() const noexcept {
|
||||
std::shared_lock lock{ mutex_ };
|
||||
return events_.size();
|
||||
}
|
||||
|
||||
void clear() noexcept {
|
||||
std::unique_lock lock{ mutex_ };
|
||||
events_.clear();
|
||||
}
|
||||
|
||||
// Range-based iteration support
|
||||
[[nodiscard]] auto begin() const {
|
||||
std::shared_lock lock{ mutex_ };
|
||||
return events_.begin();
|
||||
}
|
||||
|
||||
[[nodiscard]] auto end() const {
|
||||
std::shared_lock lock{ mutex_ };
|
||||
return events_.end();
|
||||
}
|
||||
};
|
||||
} // namespace Midi
|
||||
|
||||
// Custom formatter for std::format
|
||||
template<>
|
||||
struct std::formatter<midi_type::midi_event> {
|
||||
static constexpr auto parse(std::format_parse_context& ctx) { return ctx.begin(); }
|
||||
|
||||
static auto format(const midi_type::midi_event& event, std::format_context& ctx) {
|
||||
return std::format_to(ctx.out(), "{}", event.to_string());
|
||||
}
|
||||
};
|
||||
@@ -28,17 +28,17 @@ int main(int argc, char *argv[])
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
node.process_rpc();
|
||||
// 获取一个音频块
|
||||
const auto& b = node.get_audio_rb().get_pending_block();
|
||||
if (b.data) {
|
||||
// 将b.data填充数据
|
||||
for (size_t i = 0; i < b.size; ++i) {
|
||||
b.data[i] = data_counter;
|
||||
auto pending_block = node.get_audio_rb().get_pending_block();
|
||||
if (pending_block.data) {
|
||||
// 将待处理的数据写入插件输出
|
||||
for (size_t i = 0; i < pending_block.size; ++i) {
|
||||
pending_block.data[i] = data_counter;
|
||||
data_counter += 0.01f;
|
||||
if (data_counter > 1.0f)
|
||||
data_counter = -1.0f;
|
||||
}
|
||||
node.get_audio_rb().complete_pending_block();
|
||||
}
|
||||
node.get_audio_rb().commit_pending_block(b);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
1
src/backend/src/vst2_host/src/rpc.cpp
Normal file
1
src/backend/src/vst2_host/src/rpc.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "rpc.h"
|
||||
5
src/backend/src/vst2_host/src/rpc.h
Normal file
5
src/backend/src/vst2_host/src/rpc.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
namespace vst2_rpc {
|
||||
|
||||
};
|
||||
@@ -1,7 +1,20 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Daw.Project;
|
||||
using Grpc.Core;
|
||||
|
||||
namespace frontend.Views;
|
||||
|
||||
class DawProjectSync : Sync.SyncBase
|
||||
{
|
||||
public override Task Stream(IAsyncStreamReader<UpdateWrapper> requestStream, IServerStreamWriter<UpdateWrapper> responseStream, ServerCallContext context)
|
||||
{
|
||||
// responseStream.WriteAsync();
|
||||
// requestStream.Current.YUpdate;
|
||||
return base.Stream(requestStream, responseStream, context);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
|
||||
Reference in New Issue
Block a user