Explorar el Código

Remove ResourceManager dependency from SoundWorld

Daniele Bartolini hace 11 años
padre
commit
9f71cf8695

+ 2 - 2
engine/audio/SoundWorld.h

@@ -61,9 +61,9 @@ public:
 
 	virtual ~SoundWorld() {};
 
-	/// Plays the sound @a name at the given @a volume [0 .. 1].
+	/// Plays the sound @a sr at the given @a volume [0 .. 1].
 	/// If loop is true the sound will be played looping.
-	virtual SoundInstanceId play(const char* name, bool loop, float volume, const Vector3& pos) = 0;
+	virtual SoundInstanceId play(SoundResource* sr, bool loop, float volume, const Vector3& pos) = 0;
 
 	/// Stops the sound with the given @a id.
 	/// After this call, the instance will be destroyed.

+ 2 - 8
engine/audio/backend/ALSoundWorld.cpp

@@ -33,11 +33,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Vector3.h"
 #include "Matrix4x4.h"
 #include "Resource.h"
-#include "Device.h"
-#include "ResourceManager.h"
 #include "SoundResource.h"
 #include "ContainerTypes.h"
 #include "TempAllocator.h"
+#include "Log.h"
 
 namespace crown
 {
@@ -234,12 +233,7 @@ public:
 	{
 	}
 
-	virtual SoundInstanceId play(const char* name, bool loop, float volume, const Vector3& pos)
-	{
-		return play((SoundResource*) device()->resource_manager()->get(SOUND_EXTENSION, name), loop, volume, pos);
-	}
-
-	SoundInstanceId play(SoundResource* sr, bool loop, float volume, const Vector3& pos)
+	virtual SoundInstanceId play(SoundResource* sr, bool loop, float volume, const Vector3& pos)
 	{
 		SoundInstance instance;
 		instance.create(sr, pos);

+ 1 - 8
engine/audio/backend/SLESSoundWorld.cpp

@@ -33,8 +33,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Vector3.h"
 #include "Matrix4x4.h"
 #include "Resource.h"
-#include "Device.h"
-#include "ResourceManager.h"
 #include "SoundResource.h"
 #include "ContainerTypes.h"
 #include "TempAllocator.h"
@@ -376,12 +374,7 @@ public:
 		sles_sound_world::shutdown();
 	}
 
-	virtual SoundInstanceId play(const char* name, bool loop, float volume, const Vector3& /*pos*/)
-	{
-		return play((SoundResource*) device()->resource_manager()->get(SOUND_EXTENSION, name), loop, volume);
-	}
-
-	SoundInstanceId play(SoundResource* sr, bool loop, float volume)
+	virtual SoundInstanceId play(SoundResource* sr, bool loop, float volume, const Vector3& /*pos*/)
 	{
 		SoundInstance dummy;
 		SoundInstanceId id = id_array::create(m_playing_sounds, dummy);