summaryrefslogtreecommitdiffstats
path: root/pokescripting/SoundWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokescripting/SoundWrapper.cpp')
-rw-r--r--pokescripting/SoundWrapper.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/pokescripting/SoundWrapper.cpp b/pokescripting/SoundWrapper.cpp
index 62a092a5..4075f387 100644
--- a/pokescripting/SoundWrapper.cpp
+++ b/pokescripting/SoundWrapper.cpp
@@ -18,6 +18,9 @@
// Header include
#include "SoundWrapper.h"
+// Pokescripting includes
+#include "PokemodWrapper.h"
+
// Qt includes
#include <QtCore/QBuffer>
@@ -25,7 +28,14 @@
#include <Phonon/MediaObject>
#include <Phonon/MediaSource>
-Pokescripting::SoundWrapper::SoundWrapper(const Pokemod::Sound* sound, QObject* parent) :
+Pokescripting::SoundWrapper* Pokescripting::SoundWrapper::create(const Pokemod::Sound* sound, PokemodWrapper* parent)
+{
+ if (!m_instances.contains(Signiture(parent, sound->id())))
+ m_instances[Signiture(parent, sound->id())] = new SoundWrapper(sound, parent);
+ return qobject_cast<SoundWrapper*>(m_instances[Signiture(parent, sound->id())]);
+}
+
+Pokescripting::SoundWrapper::SoundWrapper(const Pokemod::Sound* sound, PokemodWrapper* parent) :
ObjectWrapper(sound, parent),
m_sound(sound)
{
@@ -36,6 +46,11 @@ QString Pokescripting::SoundWrapper::name() const
return m_sound->name();
}
+Pokemod::Sound::Type Pokescripting::SoundWrapper::type() const
+{
+ return m_sound->type();
+}
+
Phonon::MediaObject* Pokescripting::SoundWrapper::data()
{
Phonon::MediaObject* media = new Phonon::MediaObject(this);