Anklang-0.3.0-1416-gfa8ce8d2 anklang-0.3.0-1416-gfa8ce8d2
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
server.hh
Go to the documentation of this file.
1 // This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
2#pragma once
3
4#include <ase/gadget.hh>
5#include <ase/memory.hh>
6
7namespace Ase {
8
9class ServerImpl : public GadgetImpl, public virtual Server {
10 FastMemory::Arena telemetry_arena;
11public:
12 static ServerImplP instancep ();
13 explicit ServerImpl ();
14 virtual ~ServerImpl ();
15 String name () const override { return ""; } // no Tracktion object
16 void name (const std::string&) override {}
17 StringS read_only_properties () const override { return { "name" }; }
18 bool set_data (const String &key, const Value &v) override;
19 Value get_data (const String &key) const override;
20 String get_version () override;
21 String get_build_id () override;
22 String get_opus_version () override;
23 String get_flac_version () override;
24 String get_sndfile_version () override;
25 String error_blurb (Error error) const override;
26 String musical_tuning_label (MusicalTuning musicaltuning) const override;
27 String musical_tuning_blurb (MusicalTuning musicaltuning) const override;
28 uint64 user_note (const String &text, const String &channel = "misc", UserNote::Flags flags = UserNote::TRANSIENT, const String &rest = "") override;
29 bool user_reply (uint64 noteid, uint r) override;
30 bool broadcast_telemetry (const TelemetrySegmentS &plan, int32 interval_ms) override;
31 void shutdown () override;
32 ProjectP last_project () override;
33 ProjectP create_project (String projectname) override;
34 PropertyP access_preference (const String &ident) override;
35 StringS list_preferences () override;
36 UiConfig ui_config () override;
37 String ui_test_fetch () override;
38 void ui_test_report (const String &testname, bool success) override;
39 String ui_js_fetch () override;
40 using Block = FastMemory::Block;
41 Block telemem_allocate (uint32 length) const;
42 void telemem_release (Block telememblock) const;
43 ptrdiff_t telemem_start () const;
44};
45extern ServerImpl *SERVER;
46
47// static constexpr const char* telemetry_type (const int64 &field) { return "i64"; }
48static constexpr const char* telemetry_type (const int8 &field) { return "i8"; }
49static constexpr const char* telemetry_type (const int32 &field) { return "i32"; }
50static constexpr const char* telemetry_type (const float &field) { return "f32"; }
51static constexpr const char* telemetry_type (const double &field) { return "f64"; }
52
53template<class T> inline TelemetryField
54telemetry_field (const String &name, const T *field)
55{
56 auto start = ServerImpl::instancep()->telemem_start();
57 const ptrdiff_t offset = ptrdiff_t (field) - start;
58 ASE_ASSERT_RETURN (offset >= 0 && offset < 2147483647, {}); // INT_MAX
59 TelemetryField tfield { name, telemetry_type (*field), int32 (offset), sizeof (*field) };
60 return tfield;
61}
62
63} // Ase
Base type for classes that have a Property.
Definition gadget.hh:11
String get_flac_version() override
Retrieve FLAC handler version.
Definition server.cc:69
UiConfig ui_config() override
Retrieve UI configuration values.
Definition server.cc:113
String ui_test_fetch() override
Fetch next UI test name to run (empty if none).
Definition server.cc:129
StringS read_only_properties() const override
List x()/x (v) properties that this object can't change, their setters ignore the value or warn.
Definition server.hh:17
String get_build_id() override
Retrieve ASE build id.
Definition server.cc:57
Value get_data(const String &key) const override
Retrieve session data.
Definition server.cc:190
void ui_test_report(const String &testname, bool success) override
Report UI test result.
Definition server.cc:147
ProjectP last_project() override
Retrieve the last created project.
Definition server.cc:88
String ui_js_fetch() override
Fetch UI JS script to run (empty if none).
Definition server.cc:163
PropertyP access_preference(const String &ident) override
Retrieve property handle for a Preference identifier.
Definition server.cc:107
StringS list_preferences() override
Retrieve a list of all preference identifiers.
Definition server.cc:100
ProjectP create_project(String projectname) override
Create a new project (name is modified to be unique if necessary.
Definition server.cc:94
String get_version() override
Retrieve ASE version.
Definition server.cc:51
void shutdown() override
Shutdown ASE.
Definition server.cc:81
String get_sndfile_version() override
Retrieve libsndfile support version.
Definition server.cc:75
bool broadcast_telemetry(const TelemetrySegmentS &plan, int32 interval_ms) override
Broadcast telemetry memory segments to the current Jsonipc connection.
Definition server.cc:530
String get_opus_version() override
Retrieve Opus handler version.
Definition server.cc:63
bool set_data(const String &key, const Value &v) override
Assign session data, prefix ephemerals with '_'.
Definition server.cc:176
Central singleton, serves as API entry point.
Definition api.hh:412
#define ASE_ASSERT_RETURN(expr,...)
Return from the current function if expr evaluates to false and issue an assertion warning.
Definition cxxaux.hh:81
The Anklang C++ API namespace.
Definition api.hh:8
uint64_t uint64
A 64-bit unsigned integer, use PRI*64 in format strings.
Definition cxxaux.hh:24
int32_t int32
A 32-bit signed integer.
Definition cxxaux.hh:27
int8_t int8
An 8-bit signed integer.
Definition cxxaux.hh:25
Error
Enum representing Error states.
Definition api.hh:21
std::string String
Convenience alias for std::string.
Definition cxxaux.hh:34
uint32_t uint32
A 32-bit unsigned integer.
Definition cxxaux.hh:23
uint32_t uint
Provide 'uint' as convenience type.
Definition cxxaux.hh:17
MusicalTuning
Musical tunings, see: http://en.wikipedia.org/wiki/Musical_tuning.
Definition api.hh:82
Configuration values for the UI.
Definition api.hh:406
Memory area (over-)aligned to cache size and utilizing huge pages.
Definition memory.hh:99
Reference for an allocated memory block.
Definition memory.hh:89
Value type used to interface with various property types.
Definition value.hh:53