From c8f3b02fcf8aad2e105d3360121a6ec47b7b3511 Mon Sep 17 00:00:00 2001 From: DeeJayLSP Date: Thu, 28 Jul 2022 15:34:41 -0300 Subject: Rename every instance of "OGG" to "Ogg" --- modules/vorbis/audio_stream_ogg_vorbis.cpp | 94 +++++++++++----------- modules/vorbis/audio_stream_ogg_vorbis.h | 34 ++++---- modules/vorbis/config.py | 4 +- .../vorbis/doc_classes/AudioStreamOGGVorbis.xml | 26 ------ .../vorbis/doc_classes/AudioStreamOggVorbis.xml | 26 ++++++ .../doc_classes/AudioStreamPlaybackOGGVorbis.xml | 9 --- .../doc_classes/AudioStreamPlaybackOggVorbis.xml | 9 +++ modules/vorbis/register_types.cpp | 6 +- modules/vorbis/resource_importer_ogg_vorbis.cpp | 60 +++++++------- modules/vorbis/resource_importer_ogg_vorbis.h | 8 +- 10 files changed, 138 insertions(+), 138 deletions(-) delete mode 100644 modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml create mode 100644 modules/vorbis/doc_classes/AudioStreamOggVorbis.xml delete mode 100644 modules/vorbis/doc_classes/AudioStreamPlaybackOGGVorbis.xml create mode 100644 modules/vorbis/doc_classes/AudioStreamPlaybackOggVorbis.xml (limited to 'modules/vorbis') diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index 76f7317daa..8315eea614 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -34,7 +34,7 @@ #include "core/variant/typed_array.h" #include "thirdparty/libogg/ogg/ogg.h" -int AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_frames) { +int AudioStreamPlaybackOggVorbis::_mix_internal(AudioFrame *p_buffer, int p_frames) { ERR_FAIL_COND_V(!ready, 0); if (!active) { @@ -141,7 +141,7 @@ int AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fram return p_frames - todo; } -int AudioStreamPlaybackOGGVorbis::_mix_frames_vorbis(AudioFrame *p_buffer, int p_frames) { +int AudioStreamPlaybackOggVorbis::_mix_frames_vorbis(AudioFrame *p_buffer, int p_frames) { ERR_FAIL_COND_V(!ready, 0); if (!have_samples_left) { ogg_packet *packet = nullptr; @@ -184,11 +184,11 @@ int AudioStreamPlaybackOGGVorbis::_mix_frames_vorbis(AudioFrame *p_buffer, int p return frames; } -float AudioStreamPlaybackOGGVorbis::get_stream_sampling_rate() { +float AudioStreamPlaybackOggVorbis::get_stream_sampling_rate() { return vorbis_data->get_sampling_rate(); } -bool AudioStreamPlaybackOGGVorbis::_alloc_vorbis() { +bool AudioStreamPlaybackOggVorbis::_alloc_vorbis() { vorbis_info_init(&info); info_is_allocated = true; vorbis_comment_init(&comment); @@ -223,7 +223,7 @@ bool AudioStreamPlaybackOGGVorbis::_alloc_vorbis() { return true; } -void AudioStreamPlaybackOGGVorbis::start(float p_from_pos) { +void AudioStreamPlaybackOggVorbis::start(float p_from_pos) { ERR_FAIL_COND(!ready); loop_fade_remaining = FADE_SIZE; active = true; @@ -232,27 +232,27 @@ void AudioStreamPlaybackOGGVorbis::start(float p_from_pos) { begin_resample(); } -void AudioStreamPlaybackOGGVorbis::stop() { +void AudioStreamPlaybackOggVorbis::stop() { active = false; } -bool AudioStreamPlaybackOGGVorbis::is_playing() const { +bool AudioStreamPlaybackOggVorbis::is_playing() const { return active; } -int AudioStreamPlaybackOGGVorbis::get_loop_count() const { +int AudioStreamPlaybackOggVorbis::get_loop_count() const { return loops; } -float AudioStreamPlaybackOGGVorbis::get_playback_position() const { +float AudioStreamPlaybackOggVorbis::get_playback_position() const { return float(frames_mixed) / vorbis_data->get_sampling_rate(); } -void AudioStreamPlaybackOGGVorbis::tag_used_streams() { +void AudioStreamPlaybackOggVorbis::tag_used_streams() { vorbis_stream->tag_used(get_playback_position()); } -void AudioStreamPlaybackOGGVorbis::seek(float p_time) { +void AudioStreamPlaybackOggVorbis::seek(float p_time) { ERR_FAIL_COND(!ready); ERR_FAIL_COND(vorbis_stream.is_null()); if (!active) { @@ -370,7 +370,7 @@ void AudioStreamPlaybackOGGVorbis::seek(float p_time) { } } -AudioStreamPlaybackOGGVorbis::~AudioStreamPlaybackOGGVorbis() { +AudioStreamPlaybackOggVorbis::~AudioStreamPlaybackOggVorbis() { if (block_is_allocated) { vorbis_block_clear(&block); } @@ -385,13 +385,13 @@ AudioStreamPlaybackOGGVorbis::~AudioStreamPlaybackOGGVorbis() { } } -Ref AudioStreamOGGVorbis::instantiate_playback() { - Ref ovs; +Ref AudioStreamOggVorbis::instantiate_playback() { + Ref ovs; ERR_FAIL_COND_V(packet_sequence.is_null(), nullptr); ovs.instantiate(); - ovs->vorbis_stream = Ref(this); + ovs->vorbis_stream = Ref(this); ovs->vorbis_data = packet_sequence; ovs->frames_mixed = 0; ovs->active = false; @@ -403,11 +403,11 @@ Ref AudioStreamOGGVorbis::instantiate_playback() { return nullptr; } -String AudioStreamOGGVorbis::get_stream_name() const { +String AudioStreamOggVorbis::get_stream_name() const { return ""; //return stream_name; } -void AudioStreamOGGVorbis::maybe_update_info() { +void AudioStreamOggVorbis::maybe_update_info() { ERR_FAIL_COND(packet_sequence.is_null()); vorbis_info info; @@ -417,7 +417,7 @@ void AudioStreamOGGVorbis::maybe_update_info() { vorbis_info_init(&info); vorbis_comment_init(&comment); - Ref packet_sequence_playback = packet_sequence->instantiate_playback(); + Ref packet_sequence_playback = packet_sequence->instantiate_playback(); for (int i = 0; i < 3; i++) { ogg_packet *packet; @@ -443,90 +443,90 @@ void AudioStreamOGGVorbis::maybe_update_info() { vorbis_info_clear(&info); } -void AudioStreamOGGVorbis::set_packet_sequence(Ref p_packet_sequence) { +void AudioStreamOggVorbis::set_packet_sequence(Ref p_packet_sequence) { packet_sequence = p_packet_sequence; if (packet_sequence.is_valid()) { maybe_update_info(); } } -Ref AudioStreamOGGVorbis::get_packet_sequence() const { +Ref AudioStreamOggVorbis::get_packet_sequence() const { return packet_sequence; } -void AudioStreamOGGVorbis::set_loop(bool p_enable) { +void AudioStreamOggVorbis::set_loop(bool p_enable) { loop = p_enable; } -bool AudioStreamOGGVorbis::has_loop() const { +bool AudioStreamOggVorbis::has_loop() const { return loop; } -void AudioStreamOGGVorbis::set_loop_offset(float p_seconds) { +void AudioStreamOggVorbis::set_loop_offset(float p_seconds) { loop_offset = p_seconds; } -float AudioStreamOGGVorbis::get_loop_offset() const { +float AudioStreamOggVorbis::get_loop_offset() const { return loop_offset; } -float AudioStreamOGGVorbis::get_length() const { +float AudioStreamOggVorbis::get_length() const { ERR_FAIL_COND_V(packet_sequence.is_null(), 0); return packet_sequence->get_length(); } -void AudioStreamOGGVorbis::set_bpm(double p_bpm) { +void AudioStreamOggVorbis::set_bpm(double p_bpm) { ERR_FAIL_COND(p_bpm < 0); bpm = p_bpm; emit_changed(); } -double AudioStreamOGGVorbis::get_bpm() const { +double AudioStreamOggVorbis::get_bpm() const { return bpm; } -void AudioStreamOGGVorbis::set_beat_count(int p_beat_count) { +void AudioStreamOggVorbis::set_beat_count(int p_beat_count) { ERR_FAIL_COND(p_beat_count < 0); beat_count = p_beat_count; emit_changed(); } -int AudioStreamOGGVorbis::get_beat_count() const { +int AudioStreamOggVorbis::get_beat_count() const { return beat_count; } -void AudioStreamOGGVorbis::set_bar_beats(int p_bar_beats) { +void AudioStreamOggVorbis::set_bar_beats(int p_bar_beats) { ERR_FAIL_COND(p_bar_beats < 2); bar_beats = p_bar_beats; emit_changed(); } -int AudioStreamOGGVorbis::get_bar_beats() const { +int AudioStreamOggVorbis::get_bar_beats() const { return bar_beats; } -bool AudioStreamOGGVorbis::is_monophonic() const { +bool AudioStreamOggVorbis::is_monophonic() const { return false; } -void AudioStreamOGGVorbis::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_packet_sequence", "packet_sequence"), &AudioStreamOGGVorbis::set_packet_sequence); - ClassDB::bind_method(D_METHOD("get_packet_sequence"), &AudioStreamOGGVorbis::get_packet_sequence); +void AudioStreamOggVorbis::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_packet_sequence", "packet_sequence"), &AudioStreamOggVorbis::set_packet_sequence); + ClassDB::bind_method(D_METHOD("get_packet_sequence"), &AudioStreamOggVorbis::get_packet_sequence); - ClassDB::bind_method(D_METHOD("set_loop", "enable"), &AudioStreamOGGVorbis::set_loop); - ClassDB::bind_method(D_METHOD("has_loop"), &AudioStreamOGGVorbis::has_loop); + ClassDB::bind_method(D_METHOD("set_loop", "enable"), &AudioStreamOggVorbis::set_loop); + ClassDB::bind_method(D_METHOD("has_loop"), &AudioStreamOggVorbis::has_loop); - ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOGGVorbis::set_loop_offset); - ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOGGVorbis::get_loop_offset); + ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOggVorbis::set_loop_offset); + ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOggVorbis::get_loop_offset); - ClassDB::bind_method(D_METHOD("set_bpm", "bpm"), &AudioStreamOGGVorbis::set_bpm); - ClassDB::bind_method(D_METHOD("get_bpm"), &AudioStreamOGGVorbis::get_bpm); + ClassDB::bind_method(D_METHOD("set_bpm", "bpm"), &AudioStreamOggVorbis::set_bpm); + ClassDB::bind_method(D_METHOD("get_bpm"), &AudioStreamOggVorbis::get_bpm); - ClassDB::bind_method(D_METHOD("set_beat_count", "count"), &AudioStreamOGGVorbis::set_beat_count); - ClassDB::bind_method(D_METHOD("get_beat_count"), &AudioStreamOGGVorbis::get_beat_count); + ClassDB::bind_method(D_METHOD("set_beat_count", "count"), &AudioStreamOggVorbis::set_beat_count); + ClassDB::bind_method(D_METHOD("get_beat_count"), &AudioStreamOggVorbis::get_beat_count); - ClassDB::bind_method(D_METHOD("set_bar_beats", "count"), &AudioStreamOGGVorbis::set_bar_beats); - ClassDB::bind_method(D_METHOD("get_bar_beats"), &AudioStreamOGGVorbis::get_bar_beats); + ClassDB::bind_method(D_METHOD("set_bar_beats", "count"), &AudioStreamOggVorbis::set_bar_beats); + ClassDB::bind_method(D_METHOD("get_bar_beats"), &AudioStreamOggVorbis::get_bar_beats); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "packet_sequence", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_packet_sequence", "get_packet_sequence"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bpm", PROPERTY_HINT_RANGE, "0,400,0.01,or_greater"), "set_bpm", "get_bpm"); @@ -536,6 +536,6 @@ void AudioStreamOGGVorbis::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "loop_offset"), "set_loop_offset", "get_loop_offset"); } -AudioStreamOGGVorbis::AudioStreamOGGVorbis() {} +AudioStreamOggVorbis::AudioStreamOggVorbis() {} -AudioStreamOGGVorbis::~AudioStreamOGGVorbis() {} +AudioStreamOggVorbis::~AudioStreamOggVorbis() {} diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h index 9b6d928d87..0350e1f761 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.h +++ b/modules/vorbis/audio_stream_ogg_vorbis.h @@ -36,10 +36,10 @@ #include "servers/audio/audio_stream.h" #include "thirdparty/libvorbis/vorbis/codec.h" -class AudioStreamOGGVorbis; +class AudioStreamOggVorbis; -class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled { - GDCLASS(AudioStreamPlaybackOGGVorbis, AudioStreamPlaybackResampled); +class AudioStreamPlaybackOggVorbis : public AudioStreamPlaybackResampled { + GDCLASS(AudioStreamPlaybackOggVorbis, AudioStreamPlaybackResampled); uint32_t frames_mixed = 0; bool active = false; @@ -66,11 +66,11 @@ class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled { bool have_samples_left = false; bool have_packets_left = false; - friend class AudioStreamOGGVorbis; + friend class AudioStreamOggVorbis; - Ref vorbis_data; - Ref vorbis_data_playback; - Ref vorbis_stream; + Ref vorbis_data; + Ref vorbis_data_playback; + Ref vorbis_stream; int _mix_frames(AudioFrame *p_buffer, int p_frames); int _mix_frames_vorbis(AudioFrame *p_buffer, int p_frames); @@ -94,16 +94,16 @@ public: virtual void tag_used_streams() override; - AudioStreamPlaybackOGGVorbis() {} - ~AudioStreamPlaybackOGGVorbis(); + AudioStreamPlaybackOggVorbis() {} + ~AudioStreamPlaybackOggVorbis(); }; -class AudioStreamOGGVorbis : public AudioStream { - GDCLASS(AudioStreamOGGVorbis, AudioStream); +class AudioStreamOggVorbis : public AudioStream { + GDCLASS(AudioStreamOggVorbis, AudioStream); OBJ_SAVE_TYPE(AudioStream); // Saves derived classes with common type so they can be interchanged. RES_BASE_EXTENSION("oggvorbisstr"); - friend class AudioStreamPlaybackOGGVorbis; + friend class AudioStreamPlaybackOggVorbis; int channels = 1; float length = 0.0; @@ -114,7 +114,7 @@ class AudioStreamOGGVorbis : public AudioStream { // Also causes allocation and deallocation. void maybe_update_info(); - Ref packet_sequence; + Ref packet_sequence; double bpm = 0; int beat_count = 0; @@ -142,15 +142,15 @@ public: virtual Ref instantiate_playback() override; virtual String get_stream_name() const override; - void set_packet_sequence(Ref p_packet_sequence); - Ref get_packet_sequence() const; + void set_packet_sequence(Ref p_packet_sequence); + Ref get_packet_sequence() const; virtual float get_length() const override; //if supported, otherwise return 0 virtual bool is_monophonic() const override; - AudioStreamOGGVorbis(); - virtual ~AudioStreamOGGVorbis(); + AudioStreamOggVorbis(); + virtual ~AudioStreamOggVorbis(); }; #endif // AUDIO_STREAM_OGG_VORBIS_H diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py index 978eccb29f..7ce885a37a 100644 --- a/modules/vorbis/config.py +++ b/modules/vorbis/config.py @@ -8,8 +8,8 @@ def configure(env): def get_doc_classes(): return [ - "AudioStreamOGGVorbis", - "AudioStreamPlaybackOGGVorbis", + "AudioStreamOggVorbis", + "AudioStreamPlaybackOggVorbis", ] diff --git a/modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml deleted file mode 100644 index f87296dcd8..0000000000 --- a/modules/vorbis/doc_classes/AudioStreamOGGVorbis.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - If [code]true[/code], the stream will automatically loop when it reaches the end. - - - Time in seconds at which the stream starts after being looped. - - - Contains the raw OGG data for this stream. - - - diff --git a/modules/vorbis/doc_classes/AudioStreamOggVorbis.xml b/modules/vorbis/doc_classes/AudioStreamOggVorbis.xml new file mode 100644 index 0000000000..225ea4e6ae --- /dev/null +++ b/modules/vorbis/doc_classes/AudioStreamOggVorbis.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + If [code]true[/code], the stream will automatically loop when it reaches the end. + + + Time in seconds at which the stream starts after being looped. + + + Contains the raw Ogg data for this stream. + + + diff --git a/modules/vorbis/doc_classes/AudioStreamPlaybackOGGVorbis.xml b/modules/vorbis/doc_classes/AudioStreamPlaybackOGGVorbis.xml deleted file mode 100644 index 68aa46147f..0000000000 --- a/modules/vorbis/doc_classes/AudioStreamPlaybackOGGVorbis.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/modules/vorbis/doc_classes/AudioStreamPlaybackOggVorbis.xml b/modules/vorbis/doc_classes/AudioStreamPlaybackOggVorbis.xml new file mode 100644 index 0000000000..0879c773ac --- /dev/null +++ b/modules/vorbis/doc_classes/AudioStreamPlaybackOggVorbis.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/modules/vorbis/register_types.cpp b/modules/vorbis/register_types.cpp index 7f81f88cdb..84a71fe82d 100644 --- a/modules/vorbis/register_types.cpp +++ b/modules/vorbis/register_types.cpp @@ -40,13 +40,13 @@ void initialize_vorbis_module(ModuleInitializationLevel p_level) { #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint()) { - Ref ogg_vorbis_importer; + Ref ogg_vorbis_importer; ogg_vorbis_importer.instantiate(); ResourceFormatImporter::get_singleton()->add_importer(ogg_vorbis_importer); } #endif - GDREGISTER_CLASS(AudioStreamOGGVorbis); - GDREGISTER_CLASS(AudioStreamPlaybackOGGVorbis); + GDREGISTER_CLASS(AudioStreamOggVorbis); + GDREGISTER_CLASS(AudioStreamPlaybackOggVorbis); } void uninitialize_vorbis_module(ModuleInitializationLevel p_level) { diff --git a/modules/vorbis/resource_importer_ogg_vorbis.cpp b/modules/vorbis/resource_importer_ogg_vorbis.cpp index 9461d531fd..1ad1366d0b 100644 --- a/modules/vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/vorbis/resource_importer_ogg_vorbis.cpp @@ -40,39 +40,39 @@ #include "editor/import/audio_stream_import_settings.h" #endif -String ResourceImporterOGGVorbis::get_importer_name() const { +String ResourceImporterOggVorbis::get_importer_name() const { return "oggvorbisstr"; } -String ResourceImporterOGGVorbis::get_visible_name() const { +String ResourceImporterOggVorbis::get_visible_name() const { return "oggvorbisstr"; } -void ResourceImporterOGGVorbis::get_recognized_extensions(List *p_extensions) const { +void ResourceImporterOggVorbis::get_recognized_extensions(List *p_extensions) const { p_extensions->push_back("ogg"); } -String ResourceImporterOGGVorbis::get_save_extension() const { +String ResourceImporterOggVorbis::get_save_extension() const { return "oggvorbisstr"; } -String ResourceImporterOGGVorbis::get_resource_type() const { - return "AudioStreamOGGVorbis"; +String ResourceImporterOggVorbis::get_resource_type() const { + return "AudioStreamOggVorbis"; } -bool ResourceImporterOGGVorbis::get_option_visibility(const String &p_path, const String &p_option, const HashMap &p_options) const { +bool ResourceImporterOggVorbis::get_option_visibility(const String &p_path, const String &p_option, const HashMap &p_options) const { return true; } -int ResourceImporterOGGVorbis::get_preset_count() const { +int ResourceImporterOggVorbis::get_preset_count() const { return 0; } -String ResourceImporterOGGVorbis::get_preset_name(int p_idx) const { +String ResourceImporterOggVorbis::get_preset_name(int p_idx) const { return String(); } -void ResourceImporterOGGVorbis::get_import_options(const String &p_path, List *r_options, int p_preset) const { +void ResourceImporterOggVorbis::get_import_options(const String &p_path, List *r_options, int p_preset) const { r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true)); r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "loop_offset"), 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "bpm", PROPERTY_HINT_RANGE, "0,400,0.01,or_greater"), 0)); @@ -80,9 +80,9 @@ void ResourceImporterOGGVorbis::get_import_options(const String &p_path, Listpush_back(ImportOption(PropertyInfo(Variant::INT, "bar_beats", PROPERTY_HINT_RANGE, "2,32,or_greater"), 4)); } -Ref ResourceImporterOGGVorbis::import_ogg_vorbis(const String &p_path) { +Ref ResourceImporterOggVorbis::import_ogg_vorbis(const String &p_path) { Ref f = FileAccess::open(p_path, FileAccess::READ); - ERR_FAIL_COND_V_MSG(f.is_null(), Ref(), "Cannot open file '" + p_path + "'."); + ERR_FAIL_COND_V_MSG(f.is_null(), Ref(), "Cannot open file '" + p_path + "'."); uint64_t len = f->get_length(); @@ -92,10 +92,10 @@ Ref ResourceImporterOGGVorbis::import_ogg_vorbis(const Str f->get_buffer(w, len); - Ref ogg_vorbis_stream; + Ref ogg_vorbis_stream; ogg_vorbis_stream.instantiate(); - Ref ogg_packet_sequence; + Ref ogg_packet_sequence; ogg_packet_sequence.instantiate(); ogg_stream_state stream_state; @@ -110,16 +110,16 @@ Ref ResourceImporterOGGVorbis::import_ogg_vorbis(const Str size_t packet_count = 0; bool done = false; while (!done) { - ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); + ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); while (ogg_sync_pageout(&sync_state, &page) != 1) { if (cursor >= len) { done = true; break; } - ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); + ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); char *sync_buf = ogg_sync_buffer(&sync_state, OGG_SYNC_BUFFER_SIZE); - ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); - ERR_FAIL_COND_V(cursor > len, Ref()); + ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); + ERR_FAIL_COND_V(cursor > len, Ref()); size_t copy_size = len - cursor; if (copy_size > OGG_SYNC_BUFFER_SIZE) { copy_size = OGG_SYNC_BUFFER_SIZE; @@ -127,22 +127,22 @@ Ref ResourceImporterOGGVorbis::import_ogg_vorbis(const Str memcpy(sync_buf, &file_data[cursor], copy_size); ogg_sync_wrote(&sync_state, copy_size); cursor += copy_size; - ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); + ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); } if (done) { break; } - ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); + ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref(), "Ogg sync error " + itos(err)); // Have a page now. if (!initialized_stream) { if (ogg_stream_init(&stream_state, ogg_page_serialno(&page))) { - ERR_FAIL_V_MSG(Ref(), "Failed allocating memory for OGG Vorbis stream."); + ERR_FAIL_V_MSG(Ref(), "Failed allocating memory for Ogg Vorbis stream."); } initialized_stream = true; } ogg_stream_pagein(&stream_state, &page); - ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Ref(), "Ogg stream error " + itos(err)); + ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Ref(), "Ogg stream error " + itos(err)); int desync_iters = 0; Vector> packet_data; @@ -153,7 +153,7 @@ Ref ResourceImporterOGGVorbis::import_ogg_vorbis(const Str if (err == -1) { // According to the docs this is usually recoverable, but don't sit here spinning forever. desync_iters++; - ERR_FAIL_COND_V_MSG(desync_iters > 100, Ref(), "Packet sync issue during ogg import"); + ERR_FAIL_COND_V_MSG(desync_iters > 100, Ref(), "Packet sync issue during Ogg import"); continue; } else if (err == 0) { // Not enough data to fully reconstruct a packet. Go on to the next page. @@ -186,7 +186,7 @@ Ref ResourceImporterOGGVorbis::import_ogg_vorbis(const Str ogg_sync_clear(&sync_state); if (ogg_packet_sequence->get_packet_granule_positions().is_empty()) { - ERR_FAIL_V_MSG(Ref(), "OGG Vorbis decoding failed. Check that your data is a valid OGG Vorbis audio stream."); + ERR_FAIL_V_MSG(Ref(), "Ogg Vorbis decoding failed. Check that your data is a valid Ogg Vorbis audio stream."); } ogg_vorbis_stream->set_packet_sequence(ogg_packet_sequence); @@ -196,26 +196,26 @@ Ref ResourceImporterOGGVorbis::import_ogg_vorbis(const Str #ifdef TOOLS_ENABLED -bool ResourceImporterOGGVorbis::has_advanced_options() const { +bool ResourceImporterOggVorbis::has_advanced_options() const { return true; } -void ResourceImporterOGGVorbis::show_advanced_options(const String &p_path) { - Ref ogg_stream = import_ogg_vorbis(p_path); +void ResourceImporterOggVorbis::show_advanced_options(const String &p_path) { + Ref ogg_stream = import_ogg_vorbis(p_path); if (ogg_stream.is_valid()) { AudioStreamImportSettings::get_singleton()->edit(p_path, "oggvorbisstr", ogg_stream); } } #endif -Error ResourceImporterOGGVorbis::import(const String &p_source_file, const String &p_save_path, const HashMap &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { +Error ResourceImporterOggVorbis::import(const String &p_source_file, const String &p_save_path, const HashMap &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { bool loop = p_options["loop"]; float loop_offset = p_options["loop_offset"]; double bpm = p_options["bpm"]; int beat_count = p_options["beat_count"]; int bar_beats = p_options["bar_beats"]; - Ref ogg_vorbis_stream = import_ogg_vorbis(p_source_file); + Ref ogg_vorbis_stream = import_ogg_vorbis(p_source_file); if (ogg_vorbis_stream.is_null()) { return ERR_CANT_OPEN; } @@ -229,5 +229,5 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin return ResourceSaver::save(p_save_path + ".oggvorbisstr", ogg_vorbis_stream); } -ResourceImporterOGGVorbis::ResourceImporterOGGVorbis() { +ResourceImporterOggVorbis::ResourceImporterOggVorbis() { } diff --git a/modules/vorbis/resource_importer_ogg_vorbis.h b/modules/vorbis/resource_importer_ogg_vorbis.h index e6e98a29c1..a1a970e2cc 100644 --- a/modules/vorbis/resource_importer_ogg_vorbis.h +++ b/modules/vorbis/resource_importer_ogg_vorbis.h @@ -34,8 +34,8 @@ #include "audio_stream_ogg_vorbis.h" #include "core/io/resource_importer.h" -class ResourceImporterOGGVorbis : public ResourceImporter { - GDCLASS(ResourceImporterOGGVorbis, ResourceImporter); +class ResourceImporterOggVorbis : public ResourceImporter { + GDCLASS(ResourceImporterOggVorbis, ResourceImporter); enum { OGG_SYNC_BUFFER_SIZE = 8192, @@ -44,7 +44,7 @@ class ResourceImporterOGGVorbis : public ResourceImporter { private: // virtual int get_samples_in_packet(Vector p_packet) = 0; - static Ref import_ogg_vorbis(const String &p_path); + static Ref import_ogg_vorbis(const String &p_path); public: #ifdef TOOLS_ENABLED @@ -63,7 +63,7 @@ public: virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap &p_options, List *r_platform_variants, List *r_gen_files = nullptr, Variant *r_metadata = nullptr) override; - ResourceImporterOGGVorbis(); + ResourceImporterOggVorbis(); }; #endif // RESOURCE_IMPORTER_OGG_VORBIS_H -- cgit v1.2.3