diff --git a/.efrocachemap b/.efrocachemap index 307eaa96..29b9507c 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3932,32 +3932,32 @@ "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", - "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a4/7e/cae0031859bed2e0a34a79b243c4", - "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/12/91/e6a3995fdf4553a5f34ce72cd1ed", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ca/cf/899cd549b81aa2f133155e9a6150", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ea/9d/bc80860fb39ff5918f39adb2e92c", - "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b3/61/9fe18f4a423c3c1219edeb9c7ced", - "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/e0/e7/4e4461de1cffaba4c1ca0f1de1b9", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/69/e6/5193ce71e7202edcca453317be2a", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/28/e7/bd1d4362769070d1da8be6688d2d", - "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c3/cc/cc028b2a8812890623e97bf31340", - "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/bc/0d/2293ebba6f0c207bb1173670023f", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d6/8f/525655e2d4028c9f706c11a6399e", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8a/da/c07231b5f6d2d9aff3d58c9e5c96", - "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/33/61/070d7647f4b62e27d7e240dbf942", - "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a2/ac/7b691e6ed2dcc79f384a78435b0b", - "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/9d/8f/567b8709eb5699120ddc984d5e4e", - "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/d3/48/3b6e71efd9e0b1eb714ec0dce009", - "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d3/51/8ddfd77cd98e30b27fbeb11cfbe7", + "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2b/89/50d247b7215e1619546ede709ec4", + "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/38/40/60b318c990a5f7f77cf90cf50043", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4c/f7/dae9baf614e87c145ae8f3825bff", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/29/47/e00996feacca50191ba962388165", + "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/49/3d/e48d5bc8b5d5f487256987223542", + "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/39/53/85c8b9cd8dc3b742012b437d1892", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/29/0c/2cdcdffcfce72e3edc65a7bcc81a", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f2/0e/38d5635f024b4cfdfeaac5919a94", + "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e1/41/1fe466a9619e8e052d354ef4de4a", + "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ff/b4/06bb0621c5e1a619ef035bdd9c4e", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/37/43/b87e6819f3824896cd653ed78015", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/39/8f/bb7342f8d272fe5edd26d3911db3", + "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/02/34/84b36406a25898f8fd23bbf24791", + "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/85/73/d11ba69a370b927271531addb1aa", + "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/0d/47/1e5a8aca6a9cc43827aa0a46efa1", + "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/5b/e7/d36f837dc56e97f2514ebbb66f58", + "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/cf/75ec792052efe66757cdbc31afcb", "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/83/25/980050d75bbea49a84652209050c", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/81/a4/e2b3ac8eec73286f93fa0409bf88", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4a/8f/a68e074e798efba12fe861273ebc", "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2b/45/7f9fbae208890455fce2fbc172d3", - "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/3e/17f9fe9561340888b18288550c6a", - "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5f/f6/1493211094c36ef8118cd54c7157", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/aa/f0/48b241f8c9545240cf01b5705d4a", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/28/20/fbbd31727b855379be4af95a4f54", - "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c5/5a/b2b2440f72d64e6894f45eef160d", - "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/39/57/631744ec1b02e20581023d39508d", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4a/ea/5ce1e1ca68ebca53373a42cd36f7", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5a/75/66dd49656ff2d3dbaafc5bca1278" + "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f6/79/33046e7b3a2b1ac662a038659c34", + "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/77/44/645495a98c95810deaddba3e841c", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/68/6f/cb92e512bb71230af1005aac91d4", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5b/cb/67b06cf9e5e50c3a0ba8283e64c8", + "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/95/16/30fb1ec30d38b189a6b9f847ad34", + "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/02/aa/5ea78bcd95c8f3ccbd184afb7cbf", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2d/3d/4a4ddffcee6d7c4e1bd723b7f67d", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ac/59/4b29077ebf672fcd1e2c1ab97210" } \ No newline at end of file diff --git a/docs/ba_module.md b/docs/ba_module.md index d0f6aeda..e8bff511 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-12-16 for Ballistica version 1.5.29 build 20259

+

last updated on 2020-12-20 for Ballistica version 1.5.29 build 20260

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


diff --git a/src/ballistica/audio/audio_server.cc b/src/ballistica/audio/audio_server.cc index 992bd619..837dc652 100644 --- a/src/ballistica/audio/audio_server.cc +++ b/src/ballistica/audio/audio_server.cc @@ -42,6 +42,15 @@ const bool kShowInUseSounds = false; int AudioServer::al_source_count_ = 0; +struct AudioServer::Impl { + Impl() {} + ~Impl() {} + +#if BA_ENABLE_AUDIO + ALCcontext* alc_context_{}; +#endif +}; + /// Location for sound emission (server version). class AudioServer::ThreadSource : public Object { public: @@ -167,7 +176,7 @@ void AudioServer::SetPaused(bool pause) { // Conceptual/AudioSessionProgrammingGuide/Cookbook/ // Cookbook.html#//apple_ref/doc/uid/TP40007875-CH6-SW38 #if BA_ENABLE_AUDIO - alcMakeContextCurrent(alc_context_); // hmm is this necessary?.. + alcMakeContextCurrent(impl_->alc_context_); // hmm is this necessary?.. #endif #endif // On android lets tell openal-soft to stop processing. @@ -317,7 +326,8 @@ void AudioServer::PushSetListenerOrientationCall(const Vector3f& forward, }); } -AudioServer::AudioServer(Thread* thread) : Module("audio", thread) { +AudioServer::AudioServer(Thread* thread) + : Module("audio", thread), impl_{std::make_unique()} { // we're a singleton.. assert(g_audio_server == nullptr); g_audio_server = this; @@ -370,9 +380,9 @@ AudioServer::AudioServer(Thread* thread) : Module("audio", thread) { ALCdevice* device; device = alcOpenDevice(alDeviceName); BA_PRECONDITION(device); - alc_context_ = alcCreateContext(device, nullptr); - BA_PRECONDITION(alc_context_); - BA_PRECONDITION(alcMakeContextCurrent(alc_context_)); + impl_->alc_context_ = alcCreateContext(device, nullptr); + BA_PRECONDITION(impl_->alc_context_); + BA_PRECONDITION(alcMakeContextCurrent(impl_->alc_context_)); CHECK_AL_ERROR; } @@ -417,8 +427,8 @@ AudioServer::~AudioServer() { { ALCdevice* device; BA_PRECONDITION_LOG(alcMakeContextCurrent(nullptr)); - device = alcGetContextsDevice(alc_context_); - alcDestroyContext(alc_context_); + device = alcGetContextsDevice(impl_->alc_context_); + alcDestroyContext(impl_->alc_context_); assert(alcGetError(device) == ALC_NO_ERROR); alcCloseDevice(device); } diff --git a/src/ballistica/audio/audio_server.h b/src/ballistica/audio/audio_server.h index 4fd758db..7ab2faae 100644 --- a/src/ballistica/audio/audio_server.h +++ b/src/ballistica/audio/audio_server.h @@ -47,10 +47,6 @@ class AudioServer : public Module { auto paused() const -> bool { return paused_; } - private: - class ThreadSource; - ~AudioServer() override; - // Client sources use these to pass settings to the server. void PushSourceSetIsMusicCall(uint32_t play_id, bool val); void PushSourceSetPositionalCall(uint32_t play_id, bool val); @@ -62,14 +58,21 @@ class AudioServer : public Module { void PushSourceStopCall(uint32_t play_id); void PushSourceEndCall(uint32_t play_id); - void SetPaused(bool paused); - // Fade a playing sound out over the given time. If it is already // fading or does not exist, does nothing. void FadeSoundOut(uint32_t play_id, uint32_t time); // Stop a sound from playing if it exists. void StopSound(uint32_t play_id); + + private: + class ThreadSource; + struct Impl; + + ~AudioServer() override; + + void SetPaused(bool paused); + void SetMusicVolume(float volume); void SetSoundVolume(float volume); void SetSoundPitch(float pitch); @@ -97,15 +100,12 @@ class AudioServer : public Module { // this function. void AddSoundRefDelete(const Object::Ref* c); + std::unique_ptr impl_{}; Timer* process_timer_{}; bool have_pending_loads_{}; bool paused_{}; millisecs_t last_sound_fade_process_time_{}; -#if BA_ENABLE_AUDIO - ALCcontext* alc_context_; -#endif - float sound_volume_{1.0f}; float sound_pitch_{1.0f}; float music_volume_{1.0f}; @@ -134,10 +134,6 @@ class AudioServer : public Module { millisecs_t last_sanity_check_time_{}; static int al_source_count_; - - // FIXME: Try to kill these. - friend class AudioSource; - friend class Audio; }; } // namespace ballistica diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index 742b5e8e..287ba719 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't change here. -const int kAppBuildNumber = 20260; +const int kAppBuildNumber = 20262; const char* kAppVersion = "1.5.29"; // Our standalone globals. diff --git a/src/ballistica/core/types.h b/src/ballistica/core/types.h index d03e54be..732bd079 100644 --- a/src/ballistica/core/types.h +++ b/src/ballistica/core/types.h @@ -15,9 +15,6 @@ // Predeclare a few global namespace things // (just enough to pass some pointers around without // requiring system-ish headers). -#if BA_ENABLE_AUDIO -typedef struct ALCcontext_struct ALCcontext; -#endif typedef struct _object PyObject; typedef struct _ts PyThreadState; typedef struct PyMethodDef PyMethodDef; diff --git a/src/ballistica/python/python.cc b/src/ballistica/python/python.cc index 62fc8d23..9ea3c977 100644 --- a/src/ballistica/python/python.cc +++ b/src/ballistica/python/python.cc @@ -2610,9 +2610,9 @@ class Python::ScopedInterpreterLock::Impl { }; Python::ScopedInterpreterLock::ScopedInterpreterLock() - : impl_(new Python::ScopedInterpreterLock::Impl()) {} + : impl_(std::make_unique()) {} -Python::ScopedInterpreterLock::~ScopedInterpreterLock() { delete impl_; } +Python::ScopedInterpreterLock::~ScopedInterpreterLock() {} template auto IsPyEnum(Python::ObjID enum_class_id, PyObject* obj) -> bool { diff --git a/src/ballistica/python/python.h b/src/ballistica/python/python.h index 899939fc..4c25b8e3 100644 --- a/src/ballistica/python/python.h +++ b/src/ballistica/python/python.h @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -50,7 +51,7 @@ class Python { private: class Impl; - Impl* impl_ = nullptr; + std::unique_ptr impl_{}; }; /// Return whether the current thread holds the global-interpreter-lock.