This commit is contained in:
2025-08-12 22:47:32 +08:00
commit fa4f9720f1
24 changed files with 16095 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.idea
*.exe
*.ilk
*.pdb
*.lib
cmake-build-*/
/src/frontend/obj/

16
Nina.sln Normal file
View File

@@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "frontend", "src\frontend\frontend.csproj", "{D3560CDC-2C15-4167-AF02-D1CA2D6F4240}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D3560CDC-2C15-4167-AF02-D1CA2D6F4240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3560CDC-2C15-4167-AF02-D1CA2D6F4240}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3560CDC-2C15-4167-AF02-D1CA2D6F4240}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3560CDC-2C15-4167-AF02-D1CA2D6F4240}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.14)
project(NinaEngine)
include(../cmake_script/project_cpp_standard.cmake)
include(../cmake_script/retrieve_files.cmake)
include(../cmake_script/utils.cmake)
setup_project_options(
STANDARD 23
INTERFACE_TARGET config_target
)
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/../../build)
configure_project_defaults()
set(SRC_FILS "")
retrieve_files(${CMAKE_CURRENT_SOURCE_DIR}/src SRC_FILES)
find_package(gRPC REQUIRED)
find_package(Protobuf REQUIRED)
find_package(ZeroMQ REQUIRED)
add_executable(${PROJECT_NAME} ${SRC_FILES})
target_link_libraries(${PROJECT_NAME} PRIVATE config_target)
target_link_libraries(${PROJECT_NAME} PRIVATE gRPC::grpc++ protobuf::libprotobuf zmq)
compile_proto_files(
TARGET_NAME ${PROJECT_NAME}_proto
PROTO_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../proto
OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/proto
GRPC_ENABLED TRUE
)

114
src/backend/src/main.cpp Normal file
View File

@@ -0,0 +1,114 @@
//
// Created by A on 2025/8/12.
//
#include "zmq.h"
#include "proto/daw_api.grpc.pb.h"
class daw_api_project_service : public daw::api::ProjectService::Service {
public:
grpc::Status NewProject(grpc::ServerContext* context,
const daw::api::Empty* request,
daw::api::ProjectState* response) override {
return grpc::Status::OK;
}
grpc::Status LoadProject(grpc::ServerContext* context,
const daw::api::LoadProjectRequest* request,
daw::api::ProjectState* response) override {
return grpc::Status::OK;
}
grpc::Status SaveProject(grpc::ServerContext* context,
const daw::api::SaveProjectRequest* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
};
class daw_api_transport_service : public daw::api::TransportService::Service {
public:
grpc::Status Play(grpc::ServerContext* context,
const daw::api::Empty* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
grpc::Status Pause(grpc::ServerContext* context,
const daw::api::Empty* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
grpc::Status Stop(grpc::ServerContext* context,
const daw::api::Empty* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
grpc::Status SetTempo(grpc::ServerContext* context,
const daw::api::SetTempoRequest* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
};
class daw_api_track_service : public daw::api::TrackService::Service {
public:
grpc::Status AddTrack(grpc::ServerContext* context,
const daw::api::AddTrackRequest* request,
daw::api::TrackInfo* response) override {
return grpc::Status::OK;
}
grpc::Status RemoveTrack(grpc::ServerContext* context,
const daw::api::TrackIdRequest* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
grpc::Status SetTrackVolume(grpc::ServerContext* context,
const daw::api::SetTrackVolumeRequest* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
grpc::Status SetTrackPan(grpc::ServerContext* context,
const daw::api::SetTrackPanRequest* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
};
class daw_api_plugin_service : public daw::api::PluginService::Service {
public:
grpc::Status LoadPlugin(grpc::ServerContext* context,
const daw::api::LoadPluginRequest* request,
daw::api::PluginInfo* response) override {
return grpc::Status::OK;
}
grpc::Status SetPluginParameter(grpc::ServerContext* context,
const daw::api::SetPluginParameterRequest* request,
daw::api::StatusResponse* response) override {
return grpc::Status::OK;
}
};
int main(int argc, char *argv[])
{
return 0;
}

View File

@@ -0,0 +1,649 @@
// Generated by the gRPC C++ plugin.
// If you make any local change, they will be lost.
// source: daw_api.proto
#include "daw_api.pb.h"
#include "daw_api.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 ::daw::api::Empty& request, ::daw::api::StatusResponse* response) {
return ::grpc::internal::BlockingUnaryCall< ::daw::api::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 ::daw::api::Empty* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
::grpc::internal::CallbackUnaryCall< ::daw::api::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 ::daw::api::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 ::daw::api::Empty& request, ::grpc::CompletionQueue* cq) {
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::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 ::daw::api::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 ::daw::api::Empty& request, ::daw::api::StatusResponse* response) {
return ::grpc::internal::BlockingUnaryCall< ::daw::api::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 ::daw::api::Empty* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
::grpc::internal::CallbackUnaryCall< ::daw::api::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 ::daw::api::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 ::daw::api::Empty& request, ::grpc::CompletionQueue* cq) {
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::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 ::daw::api::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 ::daw::api::Empty& request, ::daw::api::StatusResponse* response) {
return ::grpc::internal::BlockingUnaryCall< ::daw::api::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 ::daw::api::Empty* request, ::daw::api::StatusResponse* response, std::function<void(::grpc::Status)> f) {
::grpc::internal::CallbackUnaryCall< ::daw::api::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 ::daw::api::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 ::daw::api::Empty& request, ::grpc::CompletionQueue* cq) {
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::StatusResponse, ::daw::api::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 ::daw::api::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, ::daw::api::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
[](TransportService::Service* service,
::grpc::ServerContext* ctx,
const ::daw::api::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, ::daw::api::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
[](TransportService::Service* service,
::grpc::ServerContext* ctx,
const ::daw::api::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, ::daw::api::Empty, ::daw::api::StatusResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
[](TransportService::Service* service,
::grpc::ServerContext* ctx,
const ::daw::api::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 ::daw::api::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 ::daw::api::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 ::daw::api::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 ::daw::api::Empty& request, ::daw::api::ProjectState* response) {
return ::grpc::internal::BlockingUnaryCall< ::daw::api::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 ::daw::api::Empty* request, ::daw::api::ProjectState* response, std::function<void(::grpc::Status)> f) {
::grpc::internal::CallbackUnaryCall< ::daw::api::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 ::daw::api::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 ::daw::api::Empty& request, ::grpc::CompletionQueue* cq) {
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::daw::api::ProjectState, ::daw::api::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 ::daw::api::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, ::daw::api::Empty, ::daw::api::ProjectState, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
[](ProjectService::Service* service,
::grpc::ServerContext* ctx,
const ::daw::api::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 ::daw::api::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

10
src/backend/vcpkg.json Normal file
View File

@@ -0,0 +1,10 @@
{
"dependencies": [
"grpc",
"protobuf",
"zeromq",
"gtest"
],
"version": "0.0.1",
"name": "ninaengine"
}

View File

@@ -0,0 +1,118 @@
# 文件: cmake/CompilerSetup.cmake
# ==============================================================================
# 函数setup_project_options
# 描述:配置项目级的 C++ 标准、编译器警告、定义和依赖。
# 此函数遵循现代 CMake 实践,将所有配置封装到一个 INTERFACE 库中。
#
# 参数:
# standard - (必选) C++ 标准版本 (例如 17, 20, 23)。
# INTERFACE_TARGET - (必选) 用于接收创建的 INTERFACE 库名称的变量名。
#
# 用法:
# include(cmake/CompilerSetup.cmake)
# setup_project_options(
# STANDARD 20
# INTERFACE_TARGET my_project_options
# )
# # ... 定义你的可执行文件或库
# add_executable(my_app main.cpp)
# # ... 将配置应用到目标上
# target_link_libraries(my_app PRIVATE ${my_project_options})
# ==============================================================================
function(setup_project_options)
# --- 参数解析 ---
set(options "") # 无单值选项
set(oneValueArgs STANDARD INTERFACE_TARGET) # 定义接收单个值的参数
set(multiValueArgs "") # 无多值选项
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# --- 参数验证 ---
if(NOT ARG_STANDARD OR NOT ARG_INTERFACE_TARGET)
message(FATAL_ERROR "setup_project_options 必须提供 STANDARD 和 INTERFACE_TARGET 参数。")
endif()
set(VALID_STANDARDS 11 14 17 20 23)
list(FIND VALID_STANDARDS ${ARG_STANDARD} _standard_index)
if(_standard_index EQUAL -1)
message(FATAL_ERROR "不支持的 C++ 标准: ${ARG_STANDARD}。有效值: ${VALID_STANDARDS}")
endif()
# --- 创建 INTERFACE 库 ---
# 这是现代 CMake 的核心:创建一个虚拟目标来承载所有配置属性。
add_library(${ARG_INTERFACE_TARGET} INTERFACE)
message(STATUS "创建配置接口库: ${ARG_INTERFACE_TARGET}")
# --- 设置 C++ 标准 (应用到接口库) ---
target_compile_features(${ARG_INTERFACE_TARGET} INTERFACE cxx_std_${ARG_STANDARD})
# --- 设置通用编译定义和选项 ---
# 使用 target_compile_definitions 和 target_compile_options并指定 INTERFACE
# 这样任何链接到此库的目标都会继承这些属性。
# --- 平台特定设置 ---
if(WIN32)
target_compile_definitions(${ARG_INTERFACE_TARGET} INTERFACE UNICODE _UNICODE)
message(STATUS "为 Windows 添加 UNICODE 定义")
endif()
# --- 编译器特定设置 ---
if(MSVC)
# MSVC 特定选项
target_compile_options(${ARG_INTERFACE_TARGET} INTERFACE
/W4 # 更高警告等级
# /WX # 将警告视为错误 (可选,但推荐)
/EHsc
/utf-8 # 源码和执行字符集设为 UTF-8
/Zc:__cplusplus # 修正 __cplusplus 宏
/wd4100 # 禁用警告: 未使用的形参
/wd4996 # 禁用警告: 使用了被标记为否决的函数
)
message(STATUS "为 MSVC 添加特定编译选项")
else() # GCC / Clang / AppleClang
# 通用于 GCC 和 Clang 的选项
target_compile_options(${ARG_INTERFACE_TARGET} INTERFACE
-Wall
-Wextra
-Wpedantic # 更加严格的警告
-Werror # 将所有警告视为错误 (可选,但推荐)
-Wno-unused-parameter
)
# C++17 及以上标准的额外警告
if(${ARG_STANDARD} GREATER_EQUAL 17)
target_compile_options(${ARG_INTERFACE_TARGET} INTERFACE
-Wshadow
-Wnon-virtual-dtor
)
endif()
# 【核心修复】区分处理 AppleClang 和标准 Clang/GCC
# AppleClang 不支持 -finput-charset/-fexec-charset并默认源码为 UTF-8
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
target_compile_options(${ARG_INTERFACE_TARGET} INTERFACE
-finput-charset=UTF-8
-fexec-charset=UTF-8
)
message(STATUS "为 GCC/Clang 添加 UTF-8 字符集选项")
else()
message(STATUS "检测到 AppleClang源码假定为 UTF-8跳过字符集选项")
endif()
message(STATUS "为 GCC/Clang 添加特定编译选项")
endif()
# --- MinGW 特定设置 ---
if(MINGW)
# 为 C++17 及以上的 <filesystem> 支持添加链接库
if(${ARG_STANDARD} GREATER_EQUAL 17)
# 使用 target_link_libraries这才是正确的方式
target_link_libraries(${ARG_INTERFACE_TARGET} INTERFACE -lstdc++fs)
message(STATUS "为 MinGW C++${ARG_STANDARD} 添加 libstdc++fs 依赖 (用于 <filesystem>)")
endif()
endif()
# --- 将 INTERFACE 库的名称返回给调用者 ---
set(${ARG_INTERFACE_TARGET} ${ARG_INTERFACE_TARGET} PARENT_SCOPE)
message(STATUS "C++${ARG_STANDARD} 项目配置完成,请链接到 ${ARG_INTERFACE_TARGET} 目标。")
endfunction()

View File

@@ -0,0 +1,545 @@
#[=======================================================================[
:
platform: 平台标识符 (windows|linux|mac|mobile|desktop)
is_match:
#]=======================================================================]
function(is_current_platform platform is_match)
# 设置默认值为TRUE用于未知平台
set(matches FALSE)
if(platform STREQUAL "windows")
if(WIN32 OR CYGWIN)
set(matches TRUE)
endif()
elseif(platform STREQUAL "linux")
if(UNIX AND NOT APPLE)
set(matches TRUE)
endif()
elseif(platform STREQUAL "mac")
if(APPLE AND NOT IOS)
set(matches TRUE)
endif()
elseif(platform STREQUAL "ios")
if(IOS)
set(matches TRUE)
endif()
elseif(platform STREQUAL "android")
if(ANDROID)
set(matches TRUE)
endif()
# 添加对unix平台的支持
elseif(platform STREQUAL "unix")
if(UNIX)
set(matches TRUE)
endif()
elseif(platform STREQUAL "mobile")
if(ANDROID OR IOS)
set(matches TRUE)
endif()
elseif(platform STREQUAL "desktop")
if(WIN32 OR (UNIX AND NOT APPLE) OR (APPLE AND NOT IOS))
set(matches TRUE)
endif()
elseif(platform STREQUAL "web")
if(EMSCRIPTEN)
set(matches TRUE)
endif()
else()
# 未知平台标识,默认匹配
set(matches TRUE)
endif()
set(${is_match} ${matches} PARENT_SCOPE)
endfunction()
#[=======================================================================[
:
path:
extension:
out_files:
#]=======================================================================]
function(retrieve_files_custom path extension out_files)
# 1. 参数验证
if(NOT IS_DIRECTORY "${path}")
message(WARNING "错误:目录 '${path}' 不存在")
return()
endif()
message(STATUS "正在检索目录: ${path}")
# 2. 构建文件匹配模式
set(file_patterns "")
foreach(ext IN LISTS extension)
list(APPEND file_patterns "${path}/*.${ext}")
endforeach()
# 3. 递归查找所有匹配的文件
file(GLOB_RECURSE found_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_DEPENDS ${file_patterns}
)
# 4. 处理找到的文件
set(filtered_files "")
foreach(current_file IN LISTS found_files)
# 4.1 获取文件所在目录
get_filename_component(file_dir "${current_file}" DIRECTORY)
string(REPLACE "/" ";" dir_components "${file_dir}")
# 4.2 检查平台兼容性
set(should_skip_file FALSE)
set(found_platform_dir FALSE)
foreach(dir_name IN LISTS dir_components)
# 检查是否是平台相关目录
if(dir_name MATCHES "^(windows|linux|mac|ios|android|unix|mobile|desktop|web)$")
set(found_platform_dir TRUE)
is_current_platform(${dir_name} platform_matches)
if(NOT platform_matches)
set(should_skip_file TRUE)
break()
endif()
endif()
endforeach()
# 如果文件需要跳过,继续处理下一个文件
if(should_skip_file)
continue()
endif()
# 4.3 添加符合条件的文件
list(APPEND filtered_files "${current_file}")
# 4.4 设置IDE文件分组
# 计算相对路径作为分组名称
get_filename_component(root_abs_path "${path}" ABSOLUTE)
get_filename_component(file_dir_abs_path "${file_dir}" ABSOLUTE)
file(RELATIVE_PATH group_path "${root_abs_path}" "${file_dir_abs_path}")
# 处理根目录的特殊情况
if(group_path STREQUAL ".")
set(group_name "")
else()
string(REPLACE "/" "\\" group_name "${group_path}")
endif()
# 创建IDE分组
source_group("${group_name}" FILES "${current_file}")
endforeach()
# 5. 设置输出变量
set(${out_files} ${filtered_files} PARENT_SCOPE)
endfunction()
#[=======================================================================[
便
#]=======================================================================]
function(retrieve_files path out_files)
# 设置基础文件类型
set(file_extensions
"h" # 头文件
"hpp" # C++头文件
"ini" # 配置文件
"cpp" # C++源文件
"c" # C源文件
"cc"
"ixx" # C++20模块文件
)
# 针对Mac平台添加额外文件类型
if(APPLE)
list(APPEND file_extensions "mm") # Objective-C++源文件
endif()
# 执行文件检索
set(temp_files "")
retrieve_files_custom(${path} "${file_extensions}" temp_files)
# 合并结果到输出变量
set(${out_files} ${${out_files}} ${temp_files} PARENT_SCOPE)
endfunction()
#[=======================================================================[
ProtogRPC
:
TARGET_NAME: () -
PROTO_PATH: () - .proto
OUTPUT_PATH: () - ${CMAKE_CURRENT_BINARY_DIR}/generated
GRPC_ENABLED: () - gRPCTRUE
PROTO_IMPORT_DIRS:() - proto
EXPORT_MACRO: () - Windows DLL
:
compile_proto_files(
TARGET_NAME my_proto_lib
PROTO_PATH ${CMAKE_CURRENT_SOURCE_DIR}/protos
OUTPUT_PATH ${CMAKE_BINARY_DIR}/proto_gen
GRPC_ENABLED TRUE
PROTO_IMPORT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protos
)
#]=======================================================================]
function(compile_proto_files)
# 定义预期的参数
set(options GRPC_ENABLED)
set(oneValueArgs TARGET_NAME PROTO_PATH OUTPUT_PATH EXPORT_MACRO)
set(multiValueArgs PROTO_IMPORT_DIRS)
# 解析传递给函数的参数
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# 参数验证
if(NOT ARG_TARGET_NAME)
message(FATAL_ERROR "**compile_proto_files**: **缺少必需参数** **TARGET_NAME**.")
endif()
if(NOT ARG_PROTO_PATH)
message(FATAL_ERROR "**compile_proto_files**: **缺少必需参数** **PROTO_PATH**.")
endif()
# 设置默认值
if(NOT DEFINED ARG_GRPC_ENABLED)
set(ARG_GRPC_ENABLED TRUE)
endif()
if(NOT ARG_OUTPUT_PATH)
set(ARG_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/generated")
endif()
# 查找Protobuf和gRPC
find_package(Protobuf REQUIRED)
if(ARG_GRPC_ENABLED)
find_package(gRPC QUIET)
if(NOT gRPC_FOUND)
# 如果找不到gRPC包尝试手动查找
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
if(NOT GRPC_CPP_PLUGIN)
message(FATAL_ERROR "**compile_proto_files**: **找不到gRPC C++插件**. 请确保已安装gRPC.")
endif()
else()
set(GRPC_CPP_PLUGIN $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
endif()
endif()
# 创建输出目录
file(MAKE_DIRECTORY ${ARG_OUTPUT_PATH})
get_filename_component(PROTO_PATH "${ARG_PROTO_PATH}" ABSOLUTE)
# 递归查找所有.proto文件
file(GLOB_RECURSE PROTO_FILES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_DEPENDS
"${PROTO_PATH}/*.proto"
)
if(NOT PROTO_FILES)
message(WARNING "**compile_proto_files**: 在 '${PROTO_PATH}' 中未找到任何.proto文件")
return()
endif()
message(STATUS "找到 ${CMAKE_CURRENT_SOURCE_DIR} Proto文件: ${PROTO_FILES}")
# 准备生成的文件列表
set(PROTO_SRCS)
set(PROTO_HDRS)
set(GRPC_SRCS)
set(GRPC_HDRS)
# 构建导入路径参数
set(PROTO_IMPORT_ARGS)
list(APPEND PROTO_IMPORT_ARGS "-I${PROTO_PATH}")
foreach(IMPORT_DIR ${ARG_PROTO_IMPORT_DIRS})
list(APPEND PROTO_IMPORT_ARGS "-I${IMPORT_DIR}")
endforeach()
# 为每个proto文件生成代码
foreach(PROTO_FILE ${PROTO_FILES})
# 获取proto文件的绝对路径
get_filename_component(PROTO_FILE_ABS "${PROTO_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
get_filename_component(PROTO_NAME_WE "${PROTO_FILE}" NAME_WE)
get_filename_component(PROTO_DIR "${PROTO_FILE}" DIRECTORY)
# 计算相对路径以保持目录结构
if(PROTO_DIR)
file(RELATIVE_PATH REL_DIR "${PROTO_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/${PROTO_DIR}")
set(OUTPUT_SUBDIR "${ARG_OUTPUT_PATH}/${REL_DIR}")
else()
set(OUTPUT_SUBDIR "${ARG_OUTPUT_PATH}")
endif()
# 创建输出子目录
file(MAKE_DIRECTORY ${OUTPUT_SUBDIR})
# 生成的文件路径
set(PROTO_SRC "${OUTPUT_SUBDIR}/${PROTO_NAME_WE}.pb.cc")
set(PROTO_HDR "${OUTPUT_SUBDIR}/${PROTO_NAME_WE}.pb.h")
list(APPEND PROTO_SRCS ${PROTO_SRC})
list(APPEND PROTO_HDRS ${PROTO_HDR})
# 基础protobuf生成命令
set(PROTOC_ARGS
${PROTO_IMPORT_ARGS}
"--cpp_out=${ARG_OUTPUT_PATH}"
"${PROTO_FILE_ABS}"
)
if(ARG_GRPC_ENABLED)
set(GRPC_SRC "${OUTPUT_SUBDIR}/${PROTO_NAME_WE}.grpc.pb.cc")
set(GRPC_HDR "${OUTPUT_SUBDIR}/${PROTO_NAME_WE}.grpc.pb.h")
list(APPEND GRPC_SRCS ${GRPC_SRC})
list(APPEND GRPC_HDRS ${GRPC_HDR})
# 添加自定义命令生成protobuf和gRPC代码
add_custom_command(
OUTPUT ${PROTO_SRC} ${PROTO_HDR} ${GRPC_SRC} ${GRPC_HDR}
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
${PROTOC_ARGS}
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
${PROTO_IMPORT_ARGS}
"--grpc_out=${ARG_OUTPUT_PATH}"
"--plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN}"
"${PROTO_FILE_ABS}"
DEPENDS ${PROTO_FILE_ABS}
COMMENT "生成Protobuf和gRPC代码: ${PROTO_FILE}"
VERBATIM
)
else()
# 只生成protobuf代码
add_custom_command(
OUTPUT ${PROTO_SRC} ${PROTO_HDR}
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
${PROTOC_ARGS}
DEPENDS ${PROTO_FILE_ABS}
COMMENT "生成Protobuf代码: ${PROTO_FILE}"
VERBATIM
)
endif()
endforeach()
# 创建库目标
add_library(${ARG_TARGET_NAME} STATIC
${PROTO_SRCS}
${PROTO_HDRS}
${GRPC_SRCS}
${GRPC_HDRS}
)
# 设置包含目录
target_include_directories(${ARG_TARGET_NAME}
PUBLIC
$<BUILD_INTERFACE:${ARG_OUTPUT_PATH}>
$<INSTALL_INTERFACE:include>
)
# 链接必要的库
target_link_libraries(${ARG_TARGET_NAME}
PUBLIC
protobuf::libprotobuf
)
if(ARG_GRPC_ENABLED)
if(gRPC_FOUND)
target_link_libraries(${ARG_TARGET_NAME}
PUBLIC
gRPC::grpc++
gRPC::grpc++_reflection
)
else()
# 手动查找并链接gRPC库
find_library(GRPC_LIBRARY grpc++)
find_library(GRPC_REFLECTION_LIBRARY grpc++_reflection)
if(GRPC_LIBRARY AND GRPC_REFLECTION_LIBRARY)
target_link_libraries(${ARG_TARGET_NAME}
PUBLIC
${GRPC_LIBRARY}
${GRPC_REFLECTION_LIBRARY}
)
else()
message(WARNING "**compile_proto_files**: 无法找到gRPC库请手动链接")
endif()
endif()
endif()
# 设置导出宏(如果提供)
if(ARG_EXPORT_MACRO)
target_compile_definitions(${ARG_TARGET_NAME}
PRIVATE ${ARG_EXPORT_MACRO}_EXPORTS
INTERFACE ${ARG_EXPORT_MACRO}_IMPORTS
)
endif()
# 设置C++标准
target_compile_features(${ARG_TARGET_NAME} PUBLIC cxx_std_11)
# IDE文件分组
source_group("Proto Files" FILES ${PROTO_FILES})
source_group("Generated Files\\Protobuf" FILES ${PROTO_SRCS} ${PROTO_HDRS})
if(ARG_GRPC_ENABLED)
source_group("Generated Files\\gRPC" FILES ${GRPC_SRCS} ${GRPC_HDRS})
endif()
# 输出信息
message(STATUS "创建Proto库目标: ${ARG_TARGET_NAME}")
message(STATUS " Proto文件数量: ${CMAKE_CURRENT_SOURCE_DIR} list length: ${PROTO_FILES}")
message(STATUS " 输出目录: ${ARG_OUTPUT_PATH}")
message(STATUS " gRPC支持: ${ARG_GRPC_ENABLED}")
endfunction()
#[=======================================================================[
# 用于添加资源文件并在编译后复制到最终可执行文件所在目录
# 注意:此函数依赖于 CMAKE_RUNTIME_OUTPUT_DIRECTORY 或 EXECUTABLE_OUTPUT_PATH
# 变量的设置,以确定可执行文件的输出目录。请确保在项目中设置了其中之一。
#
# 参数:
# TARGET_NAME: (必需) - 关联的目标 (库或可执行文件) 的名称。
# 资源复制命令将在 TARGET_NAME 构建后执行。
# RESOURCE_FILES: (必需) - 一个或多个要复制的资源文件的路径列表 (相对或绝对)
# OUTPUT_SUBDIR: (可选) - 相对于可执行文件输出目录的子目录路径 (例如 "assets")
#
# 例子:
# # 确保设置了可执行文件输出目录 (通常在顶层 CMakeLists.txt)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#
# # 添加库
# add_library(my_lib STATIC src/my_lib.cpp)
#
# # 添加资源到 my_lib但复制到最终可执行文件的输出目录下的 'config' 子目录
# add_resource_file(
# TARGET_NAME my_lib
# RESOURCE_FILES config/settings.json config/defaults.ini
# OUTPUT_SUBDIR config
# )
#
# # 添加可执行文件
# add_executable(my_app main.cpp)
# target_link_libraries(my_app PRIVATE my_lib)
#
# # 添加 my_app 的资源,复制到可执行文件输出目录的根目录
# add_resource_file(
# TARGET_NAME my_app
# RESOURCE_FILES assets/icon.png
# )
#]=======================================================================]
function(add_resource_file)
# 定义预期的参数
set(options "") # 无布尔选项
set(oneValueArgs TARGET_NAME OUTPUT_SUBDIR)
set(multiValueArgs RESOURCE_FILES)
# 解析传递给函数的参数
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# --- 参数验证 ---
if(NOT ARG_TARGET_NAME)
message(FATAL_ERROR "**add_resource_file**: **缺少必需参数** **TARGET_NAME**.")
endif()
if(NOT ARG_RESOURCE_FILES)
message(FATAL_ERROR "**add_resource_file**: **缺少必需参数** **RESOURCE_FILES**.")
endif()
if(NOT TARGET ${ARG_TARGET_NAME})
message(WARNING "**add_resource_file**: 目标 '${ARG_TARGET_NAME}' (尚)不存在。请确保在调用 add_executable/add_library('${ARG_TARGET_NAME}') 之后调用此函数。")
# 即使目标尚不存在仍然尝试配置命令。CMake通常能处理好依赖关系。
endif()
# --- 确定最终可执行文件的目标基础目录 ---
set(DESTINATION_BASE "")
if(DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY AND CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(DESTINATION_BASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
elseif(DEFINED EXECUTABLE_OUTPUT_PATH AND EXECUTABLE_OUTPUT_PATH)
# EXECUTABLE_OUTPUT_PATH 是旧变量,但也检查一下
set(DESTINATION_BASE "${EXECUTABLE_OUTPUT_PATH}")
else()
# 如果是多配置生成器(如 Visual Studio, Xcode需要考虑配置类型
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
# 对于多配置,没有单一的顶级运行时目录变量。
# 可以考虑使用 $<OUTPUT_DIRECTORY> 配合一个已知的可执行文件名,但这会使函数复杂化。
# 最好的做法是要求用户设置 CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG>
# 或者我们直接报错,强制用户设置 CMAKE_RUNTIME_OUTPUT_DIRECTORY
message(FATAL_ERROR "**add_resource_file**: **无法确定可执行文件输出目录**。请在您的项目中设置 **CMAKE_RUNTIME_OUTPUT_DIRECTORY** 变量 (例如 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"\${CMAKE_BINARY_DIR}/bin\"))。对于多配置生成器,可能需要设置 CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> 变量。")
else()
# 对于单配置生成器(如 Makefiles, Ninja可以默认到 CMAKE_BINARY_DIR
set(DESTINATION_BASE "${CMAKE_BINARY_DIR}")
message(WARNING "**add_resource_file**: **未设置 CMAKE_RUNTIME_OUTPUT_DIRECTORY**。默认将资源复制到 CMAKE_BINARY_DIR ('${CMAKE_BINARY_DIR}')。强烈建议设置 CMAKE_RUNTIME_OUTPUT_DIRECTORY 以获得可预测的行为。")
endif()
# message(FATAL_ERROR "**add_resource_file**: **无法确定可执行文件输出目录**。请在您的项目中设置 **CMAKE_RUNTIME_OUTPUT_DIRECTORY** 变量 (例如 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"\${CMAKE_BINARY_DIR}/bin\"))。")
endif()
# 处理子目录
set(DESTINATION_DIR "${DESTINATION_BASE}") # 默认目标目录
if(ARG_OUTPUT_SUBDIR)
# 清理子目录路径字符串
string(STRIP "${ARG_OUTPUT_SUBDIR}" _subdir)
if(IS_ABSOLUTE "${_subdir}")
message(FATAL_ERROR "**add_resource_file**: **OUTPUT_SUBDIR** ('${ARG_OUTPUT_SUBDIR}') **必须是相对路径**。")
else()
# 移除可能存在的前导/后导斜杠,以便干净地拼接路径
string(REGEX REPLACE "^[/\\\\]+" "" _subdir "${_subdir}")
string(REGEX REPLACE "[/\\\\]+$" "" _subdir "${_subdir}")
if(_subdir) # 仅当子目录清理后非空时才追加
set(DESTINATION_DIR "${DESTINATION_BASE}/${_subdir}")
endif()
endif()
endif()
# --- 准备源文件路径 ---
set(ABS_RESOURCE_FILES "")
foreach(RESOURCE_FILE ${ARG_RESOURCE_FILES})
get_filename_component(RESOURCE_FILE_REALPATH "${RESOURCE_FILE}" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# if(IS_ABSOLUTE "${RESOURCE_FILE}")
# # 如果已经是绝对路径,直接使用
# list(APPEND ABS_RESOURCE_FILES "${RESOURCE_FILE}")
# else()
# # 如果是相对路径,相对于当前源目录进行解析
# list(APPEND ABS_RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_FILE}")
# endif()
list(APPEND ABS_RESOURCE_FILES "${RESOURCE_FILE_REALPATH}")
# 检查文件是否存在 (在配置时发出警告,有助于早期发现错误)
# list(GET ABS_RESOURCE_FILES -1 _current_abs_file) # 获取刚才添加的绝对路径
if(NOT EXISTS "${RESOURCE_FILE_REALPATH}")
message(WARNING "**add_resource_file**: **资源文件** '${RESOURCE_FILE}' (解析为 '${RESOURCE_FILE_REALPATH}') **在配置时不存在**。")
endif()
endforeach()
# --- 添加自定义命令 ---
# 使用 add_custom_command 在目标构建完成后执行复制操作
if(ABS_RESOURCE_FILES) # 确保有文件需要复制
# 注意DESTINATION_DIR 可能包含特定于配置的路径(例如,如果 CMAKE_RUNTIME_OUTPUT_DIRECTORY
# 设置为 ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin
# add_custom_command 的 COMMAND 参数在构建时执行,此时这些变量/生成器表达式已解析。
add_custom_command(
TARGET ${ARG_TARGET_NAME}
POST_BUILD # 指定在目标构建之后执行
# 步骤 1: 确保目标目录存在 (copy_if_different 不会创建目录)
COMMAND ${CMAKE_COMMAND} -E make_directory "${DESTINATION_DIR}"
# 步骤 2: 复制文件
COMMAND ${CMAKE_COMMAND} -E copy_if_different # 使用CMake内置命令复制仅当文件不同时
${ABS_RESOURCE_FILES} # 要复制的源文件列表(绝对路径)
"${DESTINATION_DIR}" # 最终可执行文件所在的目标目录 (带引号以处理空格)
COMMENT "为 ${ARG_TARGET_NAME} 将资源复制到可执行文件目录: ${DESTINATION_DIR}..." # 构建时显示的注释
VERBATIM # 确保参数(尤其是路径和生成器表达式)被正确处理
)
else()
message(WARNING "**add_resource_file**: 没有有效的资源文件提供给目标 '${ARG_TARGET_NAME}'。")
endif()
# --- 可选: 将资源文件添加到 IDE 项目结构中 ---
if(ABS_RESOURCE_FILES)
set(_source_group_name "Resource Files") # 基础组名
if(ARG_OUTPUT_SUBDIR)
# 使用与目标目录结构匹配的组名
string(STRIP "${ARG_OUTPUT_SUBDIR}" _clean_subdir)
string(REPLACE "\\" "/" _clean_subdir "${_clean_subdir}") # 统一使用正斜杠
string(REGEX REPLACE "^[/]+" "" _clean_subdir "${_clean_subdir}")
string(REGEX REPLACE "[/]+$" "" _clean_subdir "${_clean_subdir}")
if(_clean_subdir)
set(_source_group_name "Resource Files/${_clean_subdir}")
endif()
endif()
# 使用 source_group 将文件添加到 IDE 的指定组下
source_group(${_source_group_name} FILES ${ABS_RESOURCE_FILES})
endif()
endfunction()

View File

@@ -0,0 +1,46 @@
# 定义一个函数来配置项目的默认设置
# 这包括设置输出目录和项目根目录变量
function(configure_project_defaults)
# 检查是否在顶层 CMakeLists.txt 中调用 (可选但推荐)
# 确保 CMAKE_SOURCE_DIR 和 CMAKE_CURRENT_SOURCE_DIR 相同
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(WARNING "configure_project_defaults() 应该在项目的根 CMakeLists.txt 中调用。")
# 如果您确实需要在子目录中设置不同的根目录,请调整此逻辑
endif()
# --- 配置输出目录 ---
# 使用 CMAKE_BINARY_DIR 作为基础构建目录
# ${CMAKE_BINARY_DIR} 指向您配置 CMake 时指定的构建目录
# 例如,在 CLion 中通常是 cmake-build-debug 或 cmake-build-release
# 如果手动运行 cmake ..,它就是您运行 cmake 命令的目录
get_filename_component(ABS_BIN_DIR ${CMAKE_BINARY_DIR} ABSOLUTE)
# **设置可执行文件输出路径**:
# 对于单配置生成器 (如 Makefiles, Ninja), 可执行文件将位于 <build>/bin/
# 对于多配置生成器 (如 Visual Studio, Xcode), CMake 通常会自动在此路径下附加配置名称
# (例如 <build>/bin/Debug/, <build>/bin/Release/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ABS_BIN_DIR}/bin CACHE PATH "Directory for runtime executables")
message(STATUS "运行时输出目录设置为: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
# **设置库文件输出路径 (共享库和静态库)**:
# 规则同上,库文件将位于 <build>/lib/ 或 <build>/lib/<Config>/
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ABS_BIN_DIR}/lib CACHE PATH "Directory for shared libraries")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ABS_BIN_DIR}/lib CACHE PATH "Directory for static libraries")
message(STATUS "库输出目录设置为: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message(STATUS "存档输出目录设置为: ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
# --- 提示 ---
# 这种全局设置输出目录的方法对于中小型项目是常见的。
# 对于更复杂的项目或需要更细粒度控制的情况可以考虑为每个目标target单独设置输出目录属性
# 例如:
# add_executable(my_app main.cpp)
# set_target_properties(my_app PROPERTIES
# RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/executables"
# )
# add_library(my_lib STATIC my_lib.cpp)
# set_target_properties(my_lib PROPERTIES
# ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/static_libs"
# )
endfunction()

15
src/frontend/App.axaml Normal file
View File

@@ -0,0 +1,15 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="frontend.App"
xmlns:local="using:frontend"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>

47
src/frontend/App.axaml.cs Normal file
View File

@@ -0,0 +1,47 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core;
using Avalonia.Data.Core.Plugins;
using System.Linq;
using Avalonia.Markup.Xaml;
using frontend.ViewModels;
using frontend.Views;
namespace frontend;
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
// Avoid duplicate validations from both Avalonia and the CommunityToolkit.
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
DisableAvaloniaDataAnnotationValidation();
desktop.MainWindow = new MainWindow
{
DataContext = new MainWindowViewModel(),
};
}
base.OnFrameworkInitializationCompleted();
}
private void DisableAvaloniaDataAnnotationValidation()
{
// Get an array of plugins to remove
var dataValidationPluginsToRemove =
BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray();
// remove each entry found
foreach (var plugin in dataValidationPluginsToRemove)
{
BindingPlugins.DataValidators.Remove(plugin);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

21
src/frontend/Program.cs Normal file
View File

@@ -0,0 +1,21 @@
using Avalonia;
using System;
namespace frontend;
sealed class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}

View File

@@ -0,0 +1,30 @@
using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using frontend.ViewModels;
namespace frontend;
public class ViewLocator : IDataTemplate
{
public Control? Build(object? param)
{
if (param is null)
return null;
var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
var type = Type.GetType(name);
if (type != null)
{
return (Control)Activator.CreateInstance(type)!;
}
return new TextBlock { Text = "Not Found: " + name };
}
public bool Match(object? data)
{
return data is ViewModelBase;
}
}

View File

@@ -0,0 +1,6 @@
namespace frontend.ViewModels;
public partial class MainWindowViewModel : ViewModelBase
{
public string Greeting { get; } = "Welcome to Avalonia!";
}

View File

@@ -0,0 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace frontend.ViewModels;
public class ViewModelBase : ObservableObject
{
}

View File

@@ -0,0 +1,20 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:frontend.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="frontend.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
Icon="/Assets/avalonia-logo.ico"
Title="frontend">
<Design.DataContext>
<!-- This only sets the DataContext for the previewer in an IDE,
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
<vm:MainWindowViewModel/>
</Design.DataContext>
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Window>

View File

@@ -0,0 +1,11 @@
using Avalonia.Controls;
namespace frontend.Views;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

18
src/frontend/app.manifest Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embedded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="frontend.Desktop"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>

View File

@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\"/>
<AvaloniaResource Include="Assets\**"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.2"/>
<PackageReference Include="Avalonia.Desktop" Version="11.3.2"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.2"/>
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.2"/>
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.2">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1"/>
</ItemGroup>
<ItemGroup>
<Protobuf Include="..\proto\daw\*.proto" GrpcServices="Client" />
</ItemGroup>
</Project>

147
src/proto/daw_api.proto Normal file
View File

@@ -0,0 +1,147 @@
syntax = "proto3";
package daw.api;
// ===================================================================
// Service Definitions (gRPC Control Plane)
// ===================================================================
service TransportService {
rpc Play(Empty) returns (StatusResponse);
rpc Pause(Empty) returns (StatusResponse);
rpc Stop(Empty) returns (StatusResponse);
rpc SetTempo(SetTempoRequest) returns (StatusResponse);
}
service ProjectService {
rpc NewProject(Empty) returns (ProjectState);
rpc LoadProject(LoadProjectRequest) returns (ProjectState);
rpc SaveProject(SaveProjectRequest) returns (StatusResponse);
}
service TrackService {
rpc AddTrack(AddTrackRequest) returns (TrackInfo);
rpc RemoveTrack(TrackIdRequest) returns (StatusResponse);
rpc SetTrackVolume(SetTrackVolumeRequest) returns (StatusResponse);
rpc SetTrackPan(SetTrackPanRequest) returns (StatusResponse);
}
service PluginService {
rpc LoadPlugin(LoadPluginRequest) returns (PluginInfo);
rpc SetPluginParameter(SetPluginParameterRequest) returns (StatusResponse);
}
// ===================================================================
// Message Definitions
// ===================================================================
message Empty {}
message StatusResponse {
bool success = 1;
string error_message = 2;
}
message ProjectState {
string project_id = 1;
string project_name = 2;
PlaybackState playback_state = 3;
repeated TrackInfo tracks = 4;
}
message LoadProjectRequest {
string file_path = 1;
}
message SaveProjectRequest {
string file_path = 1;
}
message PlaybackState {
int32 bar = 1;
int32 beat = 2;
int32 tick = 3;
double bpm = 4;
bool is_playing = 6;
}
message SetTempoRequest {
double bpm = 1;
}
enum TrackType {
AUDIO = 0;
MIDI = 1;
}
message TrackInfo {
string track_id = 1;
string name = 2;
TrackType type = 3;
float volume_db = 5;
float pan = 6;
bool is_muted = 7;
bool is_soloed = 8;
repeated PluginInfo plugins = 9;
}
message AddTrackRequest {
string name = 1;
TrackType type = 2;
}
message TrackIdRequest {
string track_id = 1;
}
message SetTrackVolumeRequest {
string track_id = 1;
float volume_db = 2;
}
message SetTrackPanRequest {
string track_id = 1;
float pan = 2;
}
message PluginInfo {
string instance_id = 1;
string name = 2;
bool is_bypassed = 4;
repeated PluginParameter parameters = 5;
}
message PluginParameter {
uint32 parameter_id = 1;
string name = 2;
double value = 3;
}
message SetPluginParameterRequest {
string instance_id = 1;
uint32 parameter_id = 2;
double value = 3;
}
message LoadPluginRequest {
string file_path = 1;
}
// ===================================================================
// ZeroMQ High-Frequency Data Messages
// ===================================================================
message VUMeterUpdate {
string track_id = 1;
float peak_dbfs = 2;
float rms_dbfs = 3;
}
message VUMeterData {
repeated VUMeterUpdate updates = 1;
}
message RealtimeCursorPosition {
double time_in_seconds = 1;
int64 absolute_ticks = 2;
}