diff options
Diffstat (limited to 'modules/stb_vorbis')
-rw-r--r-- | modules/stb_vorbis/SCsub | 4 | ||||
-rw-r--r-- | modules/stb_vorbis/audio_stream_ogg_vorbis.cpp | 23 | ||||
-rw-r--r-- | modules/stb_vorbis/config.py | 3 | ||||
-rw-r--r-- | modules/stb_vorbis/resource_importer_ogg_vorbis.h | 2 |
4 files changed, 18 insertions, 14 deletions
diff --git a/modules/stb_vorbis/SCsub b/modules/stb_vorbis/SCsub index d14939a3b1..266c87c802 100644 --- a/modules/stb_vorbis/SCsub +++ b/modules/stb_vorbis/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_stb_vorbis = env_modules.Clone() diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 42f341cef7..9609c234ec 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -122,7 +122,7 @@ void AudioStreamPlaybackOGGVorbis::seek(float p_time) { AudioStreamPlaybackOGGVorbis::~AudioStreamPlaybackOGGVorbis() { if (ogg_alloc.alloc_buffer) { stb_vorbis_close(ogg_stream); - AudioServer::get_singleton()->audio_data_free(ogg_alloc.alloc_buffer); + memfree(ogg_alloc.alloc_buffer); } } @@ -130,11 +130,11 @@ Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() { Ref<AudioStreamPlaybackOGGVorbis> ovs; - ERR_FAIL_COND_V(data == NULL, ovs); + ERR_FAIL_COND_V(data == nullptr, ovs); ovs.instance(); ovs->vorbis_stream = Ref<AudioStreamOGGVorbis>(this); - ovs->ogg_alloc.alloc_buffer = (char *)AudioServer::get_singleton()->audio_data_alloc(decode_mem_size); + ovs->ogg_alloc.alloc_buffer = (char *)memalloc(decode_mem_size); ovs->ogg_alloc.alloc_buffer_length_in_bytes = decode_mem_size; ovs->frames_mixed = 0; ovs->active = false; @@ -143,8 +143,8 @@ Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() { ovs->ogg_stream = stb_vorbis_open_memory((const unsigned char *)data, data_len, &error, &ovs->ogg_alloc); if (!ovs->ogg_stream) { - AudioServer::get_singleton()->audio_data_free(ovs->ogg_alloc.alloc_buffer); - ovs->ogg_alloc.alloc_buffer = NULL; + memfree(ovs->ogg_alloc.alloc_buffer); + ovs->ogg_alloc.alloc_buffer = nullptr; ERR_FAIL_COND_V(!ovs->ogg_stream, Ref<AudioStreamPlaybackOGGVorbis>()); } @@ -158,8 +158,8 @@ String AudioStreamOGGVorbis::get_stream_name() const { void AudioStreamOGGVorbis::clear_data() { if (data) { - AudioServer::get_singleton()->audio_data_free(data); - data = NULL; + memfree(data); + data = nullptr; data_len = 0; } } @@ -172,7 +172,7 @@ void AudioStreamOGGVorbis::set_data(const Vector<uint8_t> &p_data) { uint32_t alloc_try = 1024; Vector<char> alloc_mem; char *w; - stb_vorbis *ogg_stream = NULL; + stb_vorbis *ogg_stream = nullptr; stb_vorbis_alloc ogg_alloc; while (alloc_try < MAX_TEST_MEM) { @@ -194,7 +194,7 @@ void AudioStreamOGGVorbis::set_data(const Vector<uint8_t> &p_data) { } else { ERR_FAIL_COND(alloc_try == MAX_TEST_MEM); - ERR_FAIL_COND(ogg_stream == NULL); + ERR_FAIL_COND(ogg_stream == nullptr); stb_vorbis_info info = stb_vorbis_get_info(ogg_stream); @@ -210,7 +210,8 @@ void AudioStreamOGGVorbis::set_data(const Vector<uint8_t> &p_data) { // free any existing data clear_data(); - data = AudioServer::get_singleton()->audio_data_alloc(src_data_len, src_datar); + data = memalloc(src_data_len); + copymem(data, src_datar, src_data_len); data_len = src_data_len; break; @@ -273,7 +274,7 @@ void AudioStreamOGGVorbis::_bind_methods() { AudioStreamOGGVorbis::AudioStreamOGGVorbis() { - data = NULL; + data = nullptr; data_len = 0; length = 0; sample_rate = 1; diff --git a/modules/stb_vorbis/config.py b/modules/stb_vorbis/config.py index 200b8dfd50..1eb0a8cf33 100644 --- a/modules/stb_vorbis/config.py +++ b/modules/stb_vorbis/config.py @@ -1,13 +1,16 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "AudioStreamOGGVorbis", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.h b/modules/stb_vorbis/resource_importer_ogg_vorbis.h index 43541bcf3c..8d6f71a456 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.h +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.h @@ -50,7 +50,7 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr); ResourceImporterOGGVorbis(); }; |