summaryrefslogtreecommitdiff
path: root/modules/vorbis
diff options
context:
space:
mode:
authorMarc Gilleron <marc.gilleron@gmail.com>2018-06-11 02:59:53 +0200
committerMarc Gilleron <marc.gilleron@gmail.com>2018-12-15 05:34:53 +0000
commit065e2670af53ae2f71b78d57f8a217b4539cbbe2 (patch)
treea6b802b74f6f7ebd2018b5a3d35061bdcb91eb9d /modules/vorbis
parentca28c455bfdc8408485c217c17f07011c0b43f64 (diff)
Added basic support for custom resource savers and loaders
Diffstat (limited to 'modules/vorbis')
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h1
-rw-r--r--modules/vorbis/register_types.cpp7
2 files changed, 5 insertions, 3 deletions
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index 73c4b5f3f4..7683f38991 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -127,6 +127,7 @@ public:
};
class ResourceFormatLoaderAudioStreamOGGVorbis : public ResourceFormatLoader {
+ GDCLASS(ResourceFormatLoaderAudioStreamOGGVorbis, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/modules/vorbis/register_types.cpp b/modules/vorbis/register_types.cpp
index 0ea1fbe8b2..8219e9e7ba 100644
--- a/modules/vorbis/register_types.cpp
+++ b/modules/vorbis/register_types.cpp
@@ -32,16 +32,17 @@
#include "audio_stream_ogg_vorbis.h"
-static ResourceFormatLoaderAudioStreamOGGVorbis *vorbis_stream_loader = NULL;
+static Ref<ResourceFormatLoaderAudioStreamOGGVorbis> vorbis_stream_loader;
void register_vorbis_types() {
- vorbis_stream_loader = memnew(ResourceFormatLoaderAudioStreamOGGVorbis);
+ vorbis_stream_loader.instance();
ResourceLoader::add_resource_format_loader(vorbis_stream_loader);
ClassDB::register_class<AudioStreamOGGVorbis>();
}
void unregister_vorbis_types() {
- memdelete(vorbis_stream_loader);
+ ResourceLoader::remove_resource_format_loader(vorbis_stream_loader);
+ vorbis_stream_loader.unref();
}