7#include "../src/core/vae_engine.hpp"
23 float x = (rand() / float(RAND_MAX) - 0.5) * 10;
24 float y = (rand() / float(RAND_MAX) - 0.5) * 10;
25 float z = (rand() / float(RAND_MAX) - 0.5) * 10;
26 return {{ x, y, z }, {} };
30 std::this_thread::sleep_for(std::chrono::duration<double, std::milli>(ms));
37 for (
int i = 0; i < 2000; i++) {
46 const int emitterCount = 10000;
50 float spread = rand() / float(RAND_MAX);
54 for (
int i = 0; i < 2000; i++) {
60 auto em =
emitters[rand() % emitterCount];
72 for (
int i = 0; i < 2000; i++) {
75 engine.
setSpeed(emitter, sin(i * 0.3) * 0.2 + 1.0);
110 auto hrtf = engine.
loadHRTF(
"hrtf.json");
113 auto result = engine.
loadBank(
"bank1");
114 if (result != Result::Success) {
return 1; }
116 if (result != Result::Success) {
return 1; }
Central class handling all outside communication.
Result _VAE_PUBLIC_API fireGlobalEvent(GlobalEventHandle globalHandle, EmitterHandle emitterHandle, Sample gain=1.0, MixerHandle mixerHandle=InvalidMixerHandle, ListenerHandle listenerHandle=AllListeners)
Works like fireEvent but with a global Event identifier.
Result setMixerEffectParameter(BankHandle bank, MixerHandle mixer, Size index, Size param, Sample value)
Set the Mixer Effect Parameter.
void _VAE_PUBLIC_API setSpeed(EmitterHandle emitter, float speed)
Set the playback speed.
EmitterHandle _VAE_PUBLIC_API createEmitter()
Creates an emitter and returns the handle.
Result _VAE_PUBLIC_API init(const EngineConfig &config={})
Initializes the engine and does most of the upfront allocations.
void _VAE_PUBLIC_API setMasterVolume(Sample volume)
Set the global output volume before the limiter.
Result _VAE_PUBLIC_API stop()
Stops processing and waits for audio thead to clean up.
Result _VAE_PUBLIC_API loadBank(const char *path, Size size=0)
Load bank from filesystem.
Result _VAE_PUBLIC_API loadHRTF(const char *path, Size size=0)
Result _VAE_PUBLIC_API start()
Tries to open default device and start audio thread.
Result _VAE_PUBLIC_API unloadBankFromId(BankHandle bankHandle)
Unload bank from handle.
void _VAE_PUBLIC_API update()
Update function needs to be called regularly to handle outbound events and other housekeeping.
ListenerHandle _VAE_PUBLIC_API createListener()
Create a Listener object.
Result _VAE_PUBLIC_API setListener(ListenerHandle listener, const LocationOrientation &locOr)
Set the position of a listener.
Result _VAE_PUBLIC_API setEmitter(EmitterHandle emitter, const LocationDirection &locDir, float spread)
Set the Emitter position, orientation and spread.
LocationDirection randomVec()
void benchmarkBasicVoice(vae::core::Engine &engine)
void eventTriggered(const EventCallbackData *data)
void benchmark(vae::core::Engine &engine)
void filterTest(vae::core::Engine &engine)
const char *const emitters
Contains Typedefinitions and basic structures use by the public API and internally.
LargeHandle EmitterHandle
Settings for the engine defined at EnginePimpl::init.
const char * rootPath
Path where the bank files are located, needs to end with a trailing /.
EventCallback eventCallback
Each time a event of the type emit gets triggered Used to get information about ending sounds and sim...
Size internalSampleRate
Samplerate requested from device.
Struct containing relevant data passed to EventCallback provided in the EngineConfig.
Emitters have a position and direction vector.
static constexpr vae::GlobalEventHandle JumpRand
static constexpr vae::GlobalEventHandle Ambience1
static constexpr vae::GlobalEventHandle Music
Contains all public API types for VAE.