Index: trunk/nv/fmod/fmod_audio.hh
===================================================================
--- trunk/nv/fmod/fmod_audio.hh	(revision 194)
+++ trunk/nv/fmod/fmod_audio.hh	(revision 194)
@@ -0,0 +1,57 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+/**
+ * @file fmod_audio.hh
+ * @author Kornel Kisielewicz epyon@chaosforge.org
+ * @brief FMOD Audio interface 
+ */
+
+#ifndef NV_FMOD_AUDIO_HH
+#define NV_FMOD_AUDIO_HH
+
+#include <nv/common.hh>
+#include <nv/interface/audio.hh>
+
+namespace nv
+{
+
+	namespace fmod
+	{
+		class audio;
+
+		class sound : public nv::sound
+		{
+		private:
+			friend class nv::fmod::audio;
+			sound( void* data ) : m_sound( data ) {}
+		public:
+			virtual ~sound();
+		private:
+			void* m_sound;
+		};
+
+		class channel : public nv::channel
+		{
+		private:
+			friend class nv::fmod::audio;
+			virtual ~channel() {}
+		};
+
+		class audio : public nv::audio
+		{
+		public:
+			audio();
+			virtual nv::channel* play_sound( nv::sound* a_sound );
+			virtual nv::sound* load_sound( const std::string& a_path );
+			virtual void update();
+			virtual ~audio();
+		private:
+			void* m_system;
+		};
+	}
+}
+
+#endif // NV_FMOD_AUDIO_HH
Index: trunk/nv/interface/audio.hh
===================================================================
--- trunk/nv/interface/audio.hh	(revision 194)
+++ trunk/nv/interface/audio.hh	(revision 194)
@@ -0,0 +1,42 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+/**
+ * @file audio.hh
+ * @author Kornel Kisielewicz epyon@chaosforge.org
+ * @brief Audio interface class
+ */
+
+#ifndef NV_AUDIO_HH
+#define NV_AUDIO_HH
+
+#include <nv/common.hh>
+#include <nv/math.hh>
+
+namespace nv
+{
+	class sound
+	{
+	public:
+		virtual ~sound() {}
+	};
+
+	class channel
+	{
+	public:
+		virtual ~channel() {}
+	};
+
+	class audio
+	{
+	public:
+		virtual channel* play_sound( sound* a_sound ) = 0;
+		virtual sound* load_sound( const std::string& a_path ) = 0;
+		virtual void update() {};
+		virtual ~audio() {}
+	};
+}
+
+#endif // NV_AUDIO_HH
Index: trunk/nv/sdl/sdl_audio.hh
===================================================================
--- trunk/nv/sdl/sdl_audio.hh	(revision 194)
+++ trunk/nv/sdl/sdl_audio.hh	(revision 194)
@@ -0,0 +1,55 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+/**
+ * @file sdl_audio.hh
+ * @author Kornel Kisielewicz epyon@chaosforge.org
+ * @brief SDL Audio interface 
+ */
+
+#ifndef NV_SDL_AUDIO_HH
+#define NV_SDL_AUDIO_HH
+
+#include <nv/common.hh>
+#include <nv/interface/audio.hh>
+
+namespace nv
+{
+
+	namespace sdl
+	{
+		class audio;
+
+		class sound : public nv::sound
+		{
+		private:
+			friend class nv::sdl::audio;
+			sound( void* data ) : m_sound( data ) {}
+		public:
+			virtual ~sound();
+		private:
+			void* m_sound;
+		};
+
+		class channel : public nv::channel
+		{
+		private:
+			friend class nv::sdl::audio;
+			virtual ~channel() {}
+		};
+
+		class audio : public nv::audio
+		{
+		public:
+			audio();
+			virtual nv::channel* play_sound( nv::sound* a_sound );
+			virtual nv::sound* load_sound( const std::string& a_path );
+			virtual void update();
+			virtual ~audio();
+		};
+	}
+}
+
+#endif // NV_SDL_AUDIO_HH
Index: trunk/src/fmod/fmod_audio.cc
===================================================================
--- trunk/src/fmod/fmod_audio.cc	(revision 194)
+++ trunk/src/fmod/fmod_audio.cc	(revision 194)
@@ -0,0 +1,78 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#include "nv/fmod/fmod_audio.hh"
+
+#include "nv/lib/fmod.hh"
+#include "nv/logging.hh"
+
+using namespace nv;
+
+fmod::audio::audio()
+{
+	m_system = nullptr;
+
+	nv::load_fmod_library();
+
+	FMOD_RESULT result;
+	FMOD_SYSTEM* system;
+
+	result = FMOD_System_Create( &system );
+	if ( result != FMOD_OK )
+	{
+		NV_LOG( LOG_CRITICAL, "Failed to create FMOD System -- " << FMOD_ErrorString( result ) );
+		return;
+	}
+	result = FMOD_System_Init( system, 64, FMOD_INIT_NORMAL, 0 );
+	if ( result != FMOD_OK )
+	{
+		NV_LOG( LOG_ERROR, "Failed to initialize FMOD System -- " << FMOD_ErrorString( result ) );
+		return;
+	}
+	m_system = system;
+}
+
+
+nv::channel* fmod::audio::play_sound( nv::sound* a_sound )
+{
+	FMOD_SYSTEM* system = (FMOD_SYSTEM*)m_system;
+	FMOD_SOUND* sample  = (FMOD_SOUND*)( down_cast< fmod::sound >( a_sound )->m_sound );
+	FMOD_RESULT result  = FMOD_System_PlaySound( system, FMOD_CHANNEL_FREE, sample, false, 0 );
+	if ( result != FMOD_OK )
+	{
+		NV_LOG( LOG_WARNING, "FMOD failed to play sound -- " << FMOD_ErrorString( result ) );
+	}
+	return nullptr;
+}
+
+nv::sound* fmod::audio::load_sound( const std::string& a_path )
+{
+	FMOD_SYSTEM* system = (FMOD_SYSTEM*)m_system;
+	FMOD_SOUND* sample;
+	FMOD_RESULT result = FMOD_System_CreateSound( system, a_path.c_str(), FMOD_DEFAULT, 0, &sample );
+	if ( result != FMOD_OK )
+	{
+		NV_LOG( LOG_ERROR, "FMOD failed to load sample '" << a_path << "' -- " << FMOD_ErrorString( result ) );
+		return nullptr;
+	}
+	return new fmod::sound( sample );
+}
+
+void fmod::audio::update()
+{
+	FMOD_System_Update( (FMOD_SYSTEM*)m_system );
+	// no-op
+}
+
+fmod::audio::~audio()
+{
+	FMOD_System_Release( (FMOD_SYSTEM*)m_system );
+}
+
+fmod::sound::~sound()
+{
+	FMOD_Sound_Release( (FMOD_SOUND*)m_sound );
+}
Index: trunk/src/lib/sdl_mixer.cc
===================================================================
--- trunk/src/lib/sdl_mixer.cc	(revision 194)
+++ trunk/src/lib/sdl_mixer.cc	(revision 194)
@@ -0,0 +1,29 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#include "nv/lib/sdl_mixer.hh"
+
+#if defined( NV_SDL_DYNAMIC )
+
+#include "nv/library.hh"
+
+#define NV_SDL_FUN( rtype, fname, fparams ) rtype (NV_SDL_APIENTRY *fname) fparams = nullptr;
+#include <nv/lib/detail/sdl_mixer_functions.inc>
+#undef NV_SDL_FUN
+
+bool nv::load_sdl_mixer_library( const char* path )
+{
+	static nv::library sdl_mixer_library;
+	if ( sdl_mixer_library.is_open() ) return true;
+	sdl_mixer_library.open( path );
+
+#	define NV_SDL_FUN( rtype, fname, fparams ) *(void **) (&fname) = sdl_mixer_library.get(#fname);
+#	include <nv/lib/detail/sdl_mixer_functions.inc>
+#	undef NV_SDL_FUN
+
+	return true;
+}
+#endif
