diff options
Diffstat (limited to 'servers/audio_server.cpp')
-rw-r--r-- | servers/audio_server.cpp | 59 |
1 files changed, 8 insertions, 51 deletions
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 0e68c8a543..90033d4a87 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -45,7 +45,7 @@ #define MARK_EDITED #endif -AudioDriver *AudioDriver::singleton = NULL; +AudioDriver *AudioDriver::singleton = nullptr; AudioDriver *AudioDriver::get_singleton() { return singleton; @@ -215,7 +215,7 @@ void AudioDriverManager::initialize(int p_driver) { AudioDriver *AudioDriverManager::get_driver(int p_driver) { - ERR_FAIL_INDEX_V(p_driver, driver_count, NULL); + ERR_FAIL_INDEX_V(p_driver, driver_count, nullptr); return drivers[p_driver]; } @@ -322,7 +322,7 @@ void AudioServer::_mix_step() { bus->soloed = true; } else { - bus = NULL; + bus = nullptr; } } while (bus); @@ -388,7 +388,7 @@ void AudioServer::_mix_step() { //process send - Bus *send = NULL; + Bus *send = nullptr; if (i > 0) { //everything has a send save for master bus @@ -476,8 +476,8 @@ bool AudioServer::thread_has_channel_mix_buffer(int p_bus, int p_buffer) const { AudioFrame *AudioServer::thread_get_channel_mix_buffer(int p_bus, int p_buffer) { - ERR_FAIL_INDEX_V(p_bus, buses.size(), NULL); - ERR_FAIL_INDEX_V(p_buffer, buses[p_bus]->channels.size(), NULL); + ERR_FAIL_INDEX_V(p_bus, buses.size(), nullptr); + ERR_FAIL_INDEX_V(p_buffer, buses[p_bus]->channels.size(), nullptr); AudioFrame *data = buses.write[p_bus]->channels.write[p_buffer].buffer.ptrw(); @@ -1129,48 +1129,7 @@ double AudioServer::get_time_since_last_mix() const { return AudioDriver::get_singleton()->get_time_since_last_mix(); } -AudioServer *AudioServer::singleton = NULL; - -void *AudioServer::audio_data_alloc(uint32_t p_data_len, const uint8_t *p_from_data) { - - void *ad = memalloc(p_data_len); - ERR_FAIL_COND_V(!ad, NULL); - if (p_from_data) { - copymem(ad, p_from_data, p_data_len); - } - - { - MutexLock lock(audio_data_lock); - - audio_data[ad] = p_data_len; - audio_data_total_mem += p_data_len; - audio_data_max_mem = MAX(audio_data_total_mem, audio_data_max_mem); - } - - return ad; -} - -void AudioServer::audio_data_free(void *p_data) { - - MutexLock lock(audio_data_lock); - - if (!audio_data.has(p_data)) { - ERR_FAIL(); - } - - audio_data_total_mem -= audio_data[p_data]; - audio_data.erase(p_data); - memfree(p_data); -} - -size_t AudioServer::audio_data_get_total_memory_usage() const { - - return audio_data_total_mem; -} -size_t AudioServer::audio_data_get_max_memory_usage() const { - - return audio_data_max_mem; -} +AudioServer *AudioServer::singleton = nullptr; void AudioServer::add_callback(AudioCallback p_callback, void *p_userdata) { lock(); @@ -1400,8 +1359,6 @@ void AudioServer::_bind_methods() { AudioServer::AudioServer() { singleton = this; - audio_data_total_mem = 0; - audio_data_max_mem = 0; mix_frames = 0; channel_count = 0; to_mix = 0; @@ -1415,7 +1372,7 @@ AudioServer::AudioServer() { AudioServer::~AudioServer() { - singleton = NULL; + singleton = nullptr; } ///////////////////////////////// |