Moved all bindings to the "bindings" sub-directory

Renamed the CSFML directory to c
Renamed the DSFML directory to d
--> bindings must now be updated to match the new organization!

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1630 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-11-09 17:13:17 +00:00
parent 0cc5563cac
commit 0e2297af28
417 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,36 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.all;
public import
dsfml.audio.listener,
dsfml.audio.music,
dsfml.audio.sound,
dsfml.audio.soundbuffer,
dsfml.audio.soundbufferrecorder,
dsfml.audio.soundrecorder,
dsfml.audio.soundstream;

View file

@ -0,0 +1,185 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.listener;
import dsfml.system.common;
import dsfml.system.vector;
/**
* Listener is a global interface for defining the audio
* listener properties ; the audio listener is the point in
* the scene from where all the sounds are heard.
*
* See_Also:
* SFML Tutorial for sound spatialization example.
*/
class Listener
{
/**
* Change the global volume of all the sounds.
* The default volume is 100
*
* Params:
* volume = New global volume, in the range [0, 100]
*/
static void setGlobalVolume(float volume)
in
{
assert (volume >= 0.f && volume <= 100.f);
}
body
{
sfListener_SetGlobalVolume(volume);
}
/**
* Get the current value of the global volume of all the sounds
*
* Returns:
* Current global volume, in the range [0, 100]
*/
static float getGlobalVolume()
{
return sfListener_GetGlobalVolume();
}
/**
* Change the position of the listener.
* The default position is (0, 0, 0)
*
* Params:
* posX = X position of the listener in the world
* posY = Y position of the listener in the world
* posZ = Z position of the listener in the world
*/
static void setPosition(float posX, float posY, float posZ)
{
sfListener_SetPosition(posX, posY, posZ);
}
/**
* Change the position of the listener.
* The default position is (0, 0, 0)
*
* Params:
* position = new position
*/
static void setPosition(Vector3f position)
{
sfListener_SetPosition(position.x, position.y, position.z);
}
/**
* Get the current position of the listener
*
* Returns:
* Current position
*/
static Vector3f getPosition()
{
Vector3f ret;
sfListener_GetPosition(&ret.x, &ret.y, &ret.z);
return ret;
}
/**
* Change the orientation of the listener
* The default direction is (0, 0, -1)
*
* Params:
* directionX = X component of the listener's direction
* directionY = Y component of the listener's direction
* directionZ = Z component of the listener's direction
*/
static void setDirection(float directionX, float directionY, float directionZ)
{
sfListener_SetDirection(directionX, directionY, directionZ);
}
/**
* Change the orientation of the listener
* The default direction is (0, 0, -1)
*
* Params:
* direction = Position of the point the listener must look at
*/
static void setDirection(Vector3f position)
{
sfListener_SetDirection(position.x, position.y, position.z);
}
/**
* Get the current orientation of the listener
*
* Returns:
* Position of the point the listener is looking at
*/
static Vector3f getDirection()
{
Vector3f ret;
sfListener_GetDirection(&ret.x, &ret.y, &ret.z);
return ret;
}
private:
// External ====================================================================
extern (C)
{
typedef void function(float) pf_sfListener_SetGlobalVolume;
typedef float function() pf_sfListener_GetGlobalVolume;
typedef void function(float, float, float) pf_sfListener_SetPosition;
typedef void function(float*, float*, float*) pf_sfListener_GetPosition;
typedef void function(float, float, float) pf_sfListener_SetDirection;
typedef void function(float*, float*, float*) pf_sfListener_GetDirection;
static pf_sfListener_SetGlobalVolume sfListener_SetGlobalVolume;
static pf_sfListener_GetGlobalVolume sfListener_GetGlobalVolume;
static pf_sfListener_SetPosition sfListener_SetPosition;
static pf_sfListener_GetPosition sfListener_GetPosition;
static pf_sfListener_SetDirection sfListener_SetDirection;
static pf_sfListener_GetDirection sfListener_GetDirection;
}
static this()
{
debug
DllLoader dll = DllLoader.load("csfml-audio-d");
else
DllLoader dll = DllLoader.load("csfml-audio");
sfListener_SetGlobalVolume = cast(pf_sfListener_SetGlobalVolume)dll.getSymbol("sfListener_SetGlobalVolume");
sfListener_GetGlobalVolume = cast(pf_sfListener_GetGlobalVolume)dll.getSymbol("sfListener_GetGlobalVolume");
sfListener_SetPosition = cast(pf_sfListener_SetPosition)dll.getSymbol("sfListener_SetPosition");
sfListener_GetPosition = cast(pf_sfListener_GetPosition)dll.getSymbol("sfListener_GetPosition");
sfListener_SetDirection = cast(pf_sfListener_SetDirection)dll.getSymbol("sfListener_SetDirection");
sfListener_GetDirection = cast(pf_sfListener_GetDirection)dll.getSymbol("sfListener_GetDirection");
}
}

View file

@ -0,0 +1,188 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.music;
import dsfml.audio.soundsource;
import dsfml.system.common;
import dsfml.system.exception;
import dsfml.system.stringutil;
import dsfml.system.vector;
/**
* Music defines a big sound played using streaming,
* so usually what we call a music :)
*/
class Music : SoundSource!("sfMusic")
{
/**
* Open a music file (doesn't play it -- call Play for that)
*
* Params:
* filename = Path of the file to open
*
*/
this(string filename)
{
if (filename is null || filename.length == 0)
throw new LoadingException("LoadingException : Filename is invalid.");
m_ptr = sfMusic_CreateFromFile(toStringz(filename)); // TODO: this is a hack, should properly call the super constructor
}
/**
* Open a music file from memory (doesn't play it -- call Play() for that)
*
* Params:
* data = file data in memory
*
*/
this(byte[] data)
{
if (data is null || data.length == 0)
throw new Exception("LoadingException : Memory stream is invalid.");
m_ptr = sfMusic_CreateFromMemory(data.ptr, data.length); // TODO: ditto
}
/**
* Start playing the audio stream
*/
void play()
{
sfMusic_Play(m_ptr);
}
/**
* Stop playing the audio stream
*/
void stop()
{
sfMusic_Stop(m_ptr);
}
/**
* Pause the audio stream
*/
void pause()
{
sfMusic_Pause(m_ptr);
}
/**
* Return the number of channels (1 = mono, 2 = stereo)
*
* Returns:
* Number of channels
*/
uint getChannelsCount()
{
return sfMusic_GetChannelsCount(m_ptr);
}
/**
* Get the stream sample rate
*
* Returns:
* Stream frequency (number of samples per second)
*/
uint getSampleRate()
{
return sfMusic_GetSampleRate(m_ptr);
}
/**
* Get the music duration
*
* Returns:
* Music duration, in seconds
*/
float getDuration()
{
return sfMusic_GetDuration(m_ptr);
}
/**
* Tell whether or not the music is looping
*
* Returns:
* True if the music is looping, false otherwise
*/
bool getLoop()
{
return cast(bool)sfMusic_GetLoop(m_ptr);
}
/**
* Set the music loop state.
* This parameter is disabled by default
*
* Params:
* loop = True to play in loop, false to play once
*/
void setLoop(bool loop)
{
sfMusic_SetLoop(m_ptr, loop);
}
}
private:
extern(C)
{
SFMLClass function(cchar*) sfMusic_CreateFromFile;
SFMLClass function(byte*, size_t) sfMusic_CreateFromMemory;
void function(SFMLClass, int) sfMusic_SetLoop;
bool function(SFMLClass) sfMusic_GetLoop;
float function(SFMLClass) sfMusic_GetDuration;
void function(SFMLClass) sfMusic_Play;
void function(SFMLClass) sfMusic_Pause;
void function(SFMLClass) sfMusic_Stop;
uint function(SFMLClass) sfMusic_GetChannelsCount;
uint function(SFMLClass) sfMusic_GetSampleRate;
}
static this()
{
debug
DllLoader dll = DllLoader.load("csfml-audio-d");
else
DllLoader dll = DllLoader.load("csfml-audio");
mixin(loadFromSharedLib("sfMusic_CreateFromFile"));
mixin(loadFromSharedLib("sfMusic_CreateFromMemory"));
mixin(loadFromSharedLib("sfMusic_SetLoop"));
mixin(loadFromSharedLib("sfMusic_GetLoop"));
mixin(loadFromSharedLib("sfMusic_GetDuration"));
mixin(loadFromSharedLib("sfMusic_Play"));
mixin(loadFromSharedLib("sfMusic_Pause"));
mixin(loadFromSharedLib("sfMusic_Stop"));
mixin(loadFromSharedLib("sfMusic_GetChannelsCount"));
mixin(loadFromSharedLib("sfMusic_GetSampleRate"));
}

View file

@ -0,0 +1,224 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.sound;
import dsfml.audio.soundbuffer;
import dsfml.audio.soundsource;
import dsfml.system.common;
import dsfml.system.exception;
import dsfml.system.vector;
/**
* Sound defines the properties of the sound such as position,
* volume, pitch, etc.
*/
class Sound : SoundSource!("sfSound")
{
/**
* Default constructor
*/
this()
{
super();
}
/**
* Construct the sound from its parameters
*
* Params:
* soundbuffer = Sound buffer to play
* loop = Loop flag (false by default)
* pitch = Value of the pitch (1 by default)
* volume = Volume (100 by default)
* x = X position (0 by default)
* y = Y position (0 by default)
* z = Z position (0 by default)
*
* Throws:
* NullParameterException if buffer is null
*/
this(SoundBuffer soundbuffer, bool loop = false, float pitch = 1.f, float volume = 100.f, float x = 0.f, float y = 0.f, float z = 0.f)
{
if (soundbuffer is null)
throw new NullParameterException("NullParameterException : SoundBuffer is null.");
super();
buffer = soundbuffer;
loop = loop;
pitch = pitch;
volume = volume;
setPosition(x, y, z);
}
/**
* Play the sound
*/
void play()
{
sfSound_Play(m_ptr);
}
/**
* Pause the sound
*/
void pause()
{
sfSound_Pause(m_ptr);
}
/**
* Stop the sound
*/
void stop()
{
sfSound_Stop(m_ptr);
}
@property
{
/**
* Set the source buffer
*
* Params:
* buffer = New sound buffer to bind to the sound
*/
void buffer(SoundBuffer buffer)
{
if (buffer is null)
throw new NullParameterException("NullParameterException : SoundBuffer is null.");
m_buffer = buffer;
sfSound_SetBuffer(m_ptr, buffer.nativePointer);
}
/**
* Set the sound loop state.
* This parameter is disabled by default
*
* Params:
* loop = True to play in loop, false to play once
*/
void loop(bool loop)
{
sfSound_SetLoop(m_ptr, loop);
}
/**
* Set the current playing offset of a sound
*
* Params:
* offset = new playing position, expressed in seconds
*/
void playingOffset(float offset)
{
sfSound_SetPlayingOffset(m_ptr, offset);
}
/**
* Get the source buffer
*
* Returns:
* Sound buffer bound to the sound (can be NULL)
*/
SoundBuffer buffer()
{
return m_buffer;
}
/**
* Tell whether or not the sound is looping
*
* Returns:
* True if the sound is looping, false otherwise
*/
bool loop()
{
return cast(bool)(sfSound_GetLoop(m_ptr));
}
/**
* Get the current playing position of the sound
*
* Returns:
* Current playing position, expressed in seconds
*/
float playingOffset()
{
return sfSound_GetPlayingOffset(m_ptr);
}
}
private:
SoundBuffer m_buffer;
// External ====================================================================
extern (C)
{
typedef void function(SFMLClass) pf_sfSound_Play;
typedef void function(SFMLClass) pf_sfSound_Pause;
typedef void function(SFMLClass) pf_sfSound_Stop;
typedef void function(SFMLClass, SFMLClass) pf_sfSound_SetBuffer;
typedef SFMLClass function(SFMLClass) pf_sfSound_GetBuffer;
typedef void function(SFMLClass, int) pf_sfSound_SetLoop;
typedef int function(SFMLClass) pf_sfSound_GetLoop;
typedef float function(SFMLClass) pf_sfSound_GetPlayingOffset;
typedef void function(SFMLClass, float) pf_sfSound_SetPlayingOffset;
static pf_sfSound_Play sfSound_Play;
static pf_sfSound_Pause sfSound_Pause;
static pf_sfSound_Stop sfSound_Stop;
static pf_sfSound_SetBuffer sfSound_SetBuffer;
static pf_sfSound_GetBuffer sfSound_GetBuffer;
static pf_sfSound_SetLoop sfSound_SetLoop;
static pf_sfSound_GetLoop sfSound_GetLoop;
static pf_sfSound_GetPlayingOffset sfSound_GetPlayingOffset;
static pf_sfSound_SetPlayingOffset sfSound_SetPlayingOffset;
}
static this()
{
debug
DllLoader dll = DllLoader.load("csfml-audio-d");
else
DllLoader dll = DllLoader.load("csfml-audio");
sfSound_Play = cast(pf_sfSound_Play)dll.getSymbol("sfSound_Play");
sfSound_Pause = cast(pf_sfSound_Pause)dll.getSymbol("sfSound_Pause");
sfSound_Stop = cast(pf_sfSound_Stop)dll.getSymbol("sfSound_Stop");
sfSound_SetBuffer = cast(pf_sfSound_SetBuffer)dll.getSymbol("sfSound_SetBuffer");
sfSound_GetBuffer = cast(pf_sfSound_GetBuffer)dll.getSymbol("sfSound_GetBuffer");
sfSound_SetLoop = cast(pf_sfSound_SetLoop)dll.getSymbol("sfSound_SetLoop");
sfSound_GetLoop = cast(pf_sfSound_GetLoop)dll.getSymbol("sfSound_GetLoop");
sfSound_GetPlayingOffset = cast(pf_sfSound_GetPlayingOffset)dll.getSymbol("sfSound_GetPlayingOffset");
sfSound_SetPlayingOffset = cast(pf_sfSound_SetPlayingOffset)dll.getSymbol("sfSound_SetPlayingOffset");
}
}

View file

@ -0,0 +1,205 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.soundbuffer;
import dsfml.system.common;
import dsfml.system.exception;
import dsfml.system.stringutil;
/**
* SoundBuffer is the low-level for loading and manipulating
* sound buffers
*/
class SoundBuffer : DSFMLObject
{
/**
* Load the sound buffer from a file
*
* Params:
* filename = Path of the sound file to load
*
* Throws:
* LoadingException on failure
*/
this(string filename)
{
if (filename is null || filename.length == 0)
throw new LoadingException("LoadingException : Filename is invalid.");
super(sfSoundBuffer_CreateFromFile(toStringz(filename)));
}
/**
* Load the sound buffer from a file in memory
*
* Params:
* data = Array of file data in memory
*
* Throws:
* LoadingException on failure
*/
this(byte[] data)
{
if (data is null || data.length == 0)
throw new Exception("LoadingException : Memory stream is invalid.");
super(sfSoundBuffer_CreateFromMemory(data.ptr, data.length));
}
/**
* Load the sound buffer from an array of samples - assumed format for
* samples is 16 bits signed integer
*
* Params:
* samples = Array of samples in memory
* channelsCount = Number of channels (1 = mono, 2 = stereo, ...)
* sampleRate = Frequency (number of samples to play per second)
*
* Throws:
* LoadingException on failure
*/
this(const(short)[] samples, uint channelsCount, uint sampleRate)
{
if (samples is null || samples.length == 0)
throw new Exception("LoadingException : Samples array is invalid.");
super(sfSoundBuffer_CreateFromSamples(samples.ptr, samples.length, channelsCount, sampleRate));
}
override void dispose()
{
sfSoundBuffer_Destroy(m_ptr);
}
/**
* Save the sound buffer to a file
*
* Params:
* filename = Path of the sound file to write
*
* Returns:
* True if saving has been successful
*/
bool saveToFile(string filename)
{
if (filename !is null && filename.length > 0 )
{
return cast(bool)sfSoundBuffer_SaveToFile(m_ptr, toStringz(filename));
}
return false;
}
@property
{
/**
* Return the sound samples
*
* Returns:
* Array of sound samples, in 16 bits signed integer format
*/
short[] samples()
{
short* temp = null;
temp = sfSoundBuffer_GetSamples(m_ptr);
return temp is null ? null : temp[0..samplesCount()];
}
/**
* Return the samples count
*
* Returns:
* Number of samples
*/
size_t samplesCount()
{
return sfSoundBuffer_GetSamplesCount(m_ptr);
}
/**
* Get the sample rate
*
* Returns:
* Sound frequency (number of samples per second)
*/
uint sampleRate()
{
return sfSoundBuffer_GetSampleRate(m_ptr);
}
/**
* Return the number of channels (1 = mono, 2 = stereo, ...)
*
* Returns:
* Number of channels
*/
uint channelsCount()
{
return sfSoundBuffer_GetChannelsCount(m_ptr);
}
/**
* Get the sound duration
*
* Returns:
* Sound duration, in seconds
*/
float duration()
{
return sfSoundBuffer_GetDuration(m_ptr);
}
}
package:
this(SFMLClass ptr)
{
super(ptr, true);
}
private:
static extern(C)
{
SFMLClass function(cchar*) sfSoundBuffer_CreateFromFile;
SFMLClass function(const(byte)*, size_t) sfSoundBuffer_CreateFromMemory;
SFMLClass function(const(short)*, size_t, uint, uint) sfSoundBuffer_CreateFromSamples;
void function(SFMLClass) sfSoundBuffer_Destroy;
int function(SFMLClass, cchar*) sfSoundBuffer_SaveToFile;
short* function(SFMLClass) sfSoundBuffer_GetSamples;
size_t function(SFMLClass) sfSoundBuffer_GetSamplesCount;
uint function(SFMLClass) sfSoundBuffer_GetSampleRate;
uint function(SFMLClass) sfSoundBuffer_GetChannelsCount;
float function(SFMLClass) sfSoundBuffer_GetDuration;
}
mixin(loadFromSharedLib2("csfml-audio", "sfSoundBuffer",
"CreateFromFile", "CreateFromMemory", "CreateFromSamples", "Destroy", "SaveToFile", "GetSamples", "GetSamplesCount",
"GetSampleRate", "GetChannelsCount", "GetDuration"));
}

View file

@ -0,0 +1,109 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.soundbufferrecorder;
import dsfml.system.common;
import dsfml.audio.soundbuffer;
import dsfml.audio.soundrecorder;
/**
* Specialized sfSoundRecorder which saves the captured
* audio data into a sound buffer
*/
class SoundBufferRecorder : SoundRecorder
{
/**
* Constructor
*/
this()
{
super(sfSoundBufferRecorder_Create());
}
override void dispose()
{
sfSoundBufferRecorder_Destroy(m_ptr);
}
/**
* Get the sound buffer containing the captured audio data
*
* Returns:
* SoundBuffer containing the captured audio data
*
*/
SoundBuffer getBuffer()
{
return new SoundBuffer(sfSoundBufferRecorder_GetBuffer(m_ptr));
}
protected:
override bool onStart()
{
return true;
}
override bool onProcessSamples(short[] s)
{
return true;
}
override void onStop()
{
}
private:
// External ====================================================================
extern (C)
{
typedef SFMLClass function() pf_sfSoundBufferRecorder_Create;
typedef void function(SFMLClass) pf_sfSoundBufferRecorder_Destroy;
typedef SFMLClass function(SFMLClass) pf_sfSoundBufferRecorder_GetBuffer;
static pf_sfSoundBufferRecorder_Create sfSoundBufferRecorder_Create;
static pf_sfSoundBufferRecorder_Destroy sfSoundBufferRecorder_Destroy;
static pf_sfSoundBufferRecorder_GetBuffer sfSoundBufferRecorder_GetBuffer;
}
static this()
{
debug
DllLoader dll = DllLoader.load("csfml-audio-d");
else
DllLoader dll = DllLoader.load("csfml-audio");
sfSoundBufferRecorder_Create = cast(pf_sfSoundBufferRecorder_Create)dll.getSymbol("sfSoundBufferRecorder_Create");
sfSoundBufferRecorder_Destroy = cast(pf_sfSoundBufferRecorder_Destroy)dll.getSymbol("sfSoundBufferRecorder_Destroy");
sfSoundBufferRecorder_GetBuffer = cast(pf_sfSoundBufferRecorder_GetBuffer)dll.getSymbol("sfSoundBufferRecorder_GetBuffer");
}
}

View file

@ -0,0 +1,316 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.soundrecorder;
import dsfml.audio.soundbuffer;
import dsfml.system.alloc;
import dsfml.system.common;
import dsfml.system.linkedlist;
import dsfml.system.lock;
import core.thread;
import core.sync.mutex;
/**
* SoundRecorder is an interface for capturing sound data.
*
* $(B onProcessSamples and onStop will be called by a different thread, take care of synchronization issues.)
*
* Examples:
* -------
* class MySoundRecorder : SoundRecorder
* {
* this()
* {
*
* }
*
* protected bool onStart()
* {
* return true;
* }
*
* protected void onStop()
* {
*
* }
*
* protected bool onProcessSamples(out short[])
* {
* // Process data here
*
* return true; //return true to continue capture, else return false
* }
* }
* -------
*/
abstract class SoundRecorder : DSFMLObject
{
override void dispose()
{
if (m_flag)
stop();
m_instances.remove(m_id);
sfSoundRecorder_Destroy(m_ptr);
}
/**
* Start the capture.
*
* Only one capture can happen at the same time
*
* Params:
* sampleRate : Sound frequency (the more samples, the higher the quality)
* (44100 by default = CD quality)
*/
void start(uint sampleRate = 44100)
{
sfSoundRecorder_Start(m_ptr, sampleRate);
m_t = new Thread(&threadPoll);
m_t.start();
}
/**
* Stop the capture
*/
void stop()
{
sfSoundRecorder_Stop(m_ptr);
m_flag = false;
m_t.join();
m_t = null;
}
/**
* Get the sample rate
*
* Returns:
* Frequency, in samples per second
*/
uint getSampleRate()
{
return sfSoundRecorder_GetSampleRate(m_ptr);
}
/**
* Tell if the system supports sound capture.
* If not, this class won't be usable
*
* Returns:
* True if audio capture is supported
*
*/
static bool isAvailable()
{
return cast(bool) sfSoundRecorder_IsAvailable();
}
protected:
/**
* Protected constructor
*/
this()
{
m_id = ++seed;
m_instances[m_id] = this;
super(sfSoundRecorder_Create(&internalOnStart, &internalCallback, &internalOnStop, &m_id));
init(true);
}
this(SFMLClass ptr)
{
super(ptr);
init(false);
}
/**
* Start recording audio data
*
* Returns:
* False to abort recording audio data, true to start
*/
abstract bool onStart();
/**
* Stop recording audio data
*/
abstract void onStop();
/**
* callback function
*
* Parameters:
* samples = Array of samples
*
* Returns:
* true to continue recording, false to stop.
*/
abstract bool onProcessSamples(short[] samples);
bool m_disposed;
private:
/*
* an init function to initialize id of the object.
*/
void init(bool flag)
{
if (flag)
{
m_list = new LinkedList!(Samples)();
m_flag = true;
m_continue = true;
m_mutex = new Mutex();
}
}
void* m_userData;
int m_id;
static int seed = 0;
static SoundRecorder[int] m_instances;
/*
* Extern C callback function
*
* This function must be static for C interop. To retrieve the current
* instance, we retrieve id of the sender in the user data, and search associated instance
* in the associative array.
*
* We don't call delegate or derived class on that thread because GC is not aware of this thread
* instead we enqueue data informations in a queue and poll this queue with a managed thread.
*/
extern(C) static int internalCallback(short* s, size_t size, void* user)
{
int id;
// retrieve instance
if ((id = *cast(int*)(user)) in m_instances)
{
SoundRecorder temp = m_instances[id];
scope Lock l = new Lock(temp.m_mutex);
if (temp.m_continue)
// this new is allowed because Samples is an custom alloc class.
temp.m_list.enqueue(new Samples(s, size));
return temp.m_continue;
}
return false;
}
extern(C) static int internalOnStart(void* user)
{
int id;
bool ret = false;
if ((id = *cast(int*)(user)) in m_instances)
{
SoundRecorder temp = m_instances[id];
ret = temp.onStart();
}
return ret;
}
extern(C) static void internalOnStop(void* user)
{
// Nothing to do
}
/*
* Managed thread loop
*/
void threadPoll()
{
while (m_flag)
{
Thread.sleep(50_000_0); // 50ms
// if samples are available
if (!m_list.empty)
{
// Lock ressources
scope Lock l = new Lock(m_mutex);
Samples s = m_list.dequeue;
m_continue = this.onProcessSamples(s.data[0..s.length].dup);
delete s;
if (!m_continue)
{
// delete all samples left
foreach(Samples dummy; m_list)
delete dummy;
break;
}
}
}
onStop();
}
Mutex m_mutex;
bool m_flag;
bool m_continue = true;
LinkedList!(Samples) m_list;
Thread m_t;
// External ====================================================================
static extern (C)
{
SFMLClass function(int function(void*), int function(const(short)*, size_t, void*), void function(void*), void*) sfSoundRecorder_Create;
void function(SFMLClass) sfSoundRecorder_Destroy;
void function(SFMLClass, uint SampleRate) sfSoundRecorder_Start;
void function(SFMLClass) sfSoundRecorder_Stop;
uint function(SFMLClass) sfSoundRecorder_GetSampleRate;
int function() sfSoundRecorder_IsAvailable;
}
mixin(loadFromSharedLib2("csfml-audio", "sfSoundRecorder", "Create", "Destroy", "Start",
"Stop", "GetSampleRate", "IsAvailable"));
}
// Use explicit alloc to allow instaciation by C thread
private class Samples
{
mixin Alloc;
this(short* data, size_t length)
{
this.data = data;
this.length = length;
}
public short* data;
public size_t length;
}

View file

@ -0,0 +1,311 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.soundsource;
import dsfml.system.vector;
import dsfml.system.common;
/// the sound's current status
enum SoundStatus
{
Stopped, /// Sound is not playing
Paused, /// Sound is paused
Playing /// Sound is playing
}
/// base class
package class SoundSource(alias derivedClassName) : DSFMLObject
{
protected:
/**
* Default constructor
*
* This constructor is meant ot be called by derived classes only.
*
*/
this()
{
super(sfSoundSource_Create());
}
this(SFMLClass ptr)
{
super(ptr);
}
override void dispose()
{
sfSoundSource_Destroy(m_ptr);
}
public:
/**
* Set the 3D position of the sound in the audio scene
*
* Only sounds with one channel (mono sounds) can be spatialized.
* The default position of a sound is (0, 0, 0).
*
* Params:
* x = X coordinate of the position of the sound in the scene
* y = Y coordinate of the position of the sound in the scene
* z = Z coordinate of the position of the sound in the scene
*/
void setPosition(float x, float y, float z)
{
sfSoundSource_SetPosition(m_ptr, x, y, z);
}
@property
{
/**
* Get the current status of the sound (stopped, paused, playing)
*
* Returns:
* current status of the sound
*/
SoundStatus status()
{
return sfSoundSource_GetStatus(m_ptr);
}
/**
* Set the pitch of the sound
*
* The pitch represents the perceived fundamental frequency
* of a sound; thus you can make a sound more acute or grave
* by changing its pitch. A side effect of changing the pitch
* is to modify the playing speed of the sound as well.
* The default value for the pitch is 1.
*
* Params:
* pitch = New pitch to apply to the sound
*/
void pitch(float pitch)
{
sfSoundSource_SetPitch(m_ptr, pitch);
}
/**
* Get the pitch of the sound
*
* Returns:
* pitch of the sound
*/
float pitch()
{
return sfSoundSource_GetPitch(m_ptr);
}
/**
* Set the volume of the sound
*
* The volume is a value between 0 (mute) and 100 (full volume).
* The default value for the volume is 100.
*
* Params:
* volume = volume of the sound
*/
void volume(float volume)
in
{
assert(volume >= 0 && volume <= 100);
}
body
{
sfSoundSource_SetVolume(m_ptr, volume);
}
/**
* Get the volume of the sound
*
* Returns:
* Volume of the sound, in the range [0, 100]
*/
float volume()
{
return sfSoundSource_GetVolume(m_ptr);
}
/**
* Set the 3D position of the sound in the audio scene
*
* Only sounds with one channel (mono sounds) can be
* spatialized.
* The default position of a sound is (0, 0, 0).
*
* Params:
* position = Position of the sound in the scene
*/
void position(Vector3f position)
{
sfSoundSource_SetPosition(m_ptr, position.x, position.y, position.z);
}
/**
* Get the 3D position of the sound in the audio scene
*
* Returns:
* Position of the sound
*/
Vector3f position()
{
Vector3f ret;
sfSoundSource_GetPosition(m_ptr, &ret.x, &ret.y, &ret.z);
return ret;
}
/**
* Make the sound's position relative to the listener or absolute
*
* Making a sound relative to the listener will ensure that it will always
* be played the same way regardless the position of the listener.
* This can be useful for non-spatialized sounds, sounds that are
* produced by the listener, or sounds attached to it.
* The default value is false (position is absolute).
*
* Params:
* relative = True to set the position relative, false to set it absolute
*/
void relativeToListener(bool relative)
{
sfSoundSource_SetRelativeToListener(m_ptr, relative);
}
/**
* Tell whether the sound's position is relative to the listener or is absolute
*
* Returns:
* True if the position is relative, false if it's absolute
*/
bool relativeToListener()
{
return sfSoundSource_IsRelativeToListener(m_ptr);
}
/**
* Set the minimum distance of the sound
*
* The "minimum distance" of a sound is the maximum
* distance at which it is heard at its maximum volume. Further
* than the minimum distance, it will start to fade out according
* to its attenuation factor. A value of 0 ("inside the head
* of the listener") is an invalid value and is forbidden.
* The default value of the minimum distance is 1.
*
* Params:
* distance = New minimum distance of the sound
*
* \see GetMinDistance, SetAttenuation
*
*/
void minDistance(float distance)
{
sfSoundSource_SetMinDistance(m_ptr, distance);
}
/**
* Get the minimum distance of the sound
*
* Returns:
* Minimum distance of the sound
*
* \see SetMinDistance, GetAttenuation
*
*/
float minDistance()
{
return sfSoundSource_GetMinDistance(m_ptr);
}
/**
* Set the attenuation factor of the sound
*
* The attenuation is a multiplicative factor which makes
* the sound more or less loud according to its distance
* from the listener. An attenuation of 0 will produce a
* non-attenuated sound, i.e. its volume will always be the same
* whether it is heard from near or from far. On the other hand,
* an attenuation value such as 100 will make the sound fade out
* very quickly as it gets further from the listener.
* The default value of the attenuation is 1.
*
* Params:
* attenuation = New attenuation factor of the sound
*
* \see GetAttenuation, SetMinDistance
*
*/
void attenuation(float attenuation)
{
sfSoundSource_SetAttenuation(m_ptr, attenuation);
}
/**
* Get the attenuation factor of the sound
*
* Returns:
* Attenuation factor of the sound
*
* \see SetAttenuation, GetMinDistance
*
*/
float attenuation()
{
return sfSoundSource_GetAttenuation(m_ptr);
}
} // of @property
private:
static extern(C)
{
SFMLClass function() sfSoundSource_Create;
void function(SFMLClass) sfSoundSource_Destroy;
SoundStatus function(SFMLClass) sfSoundSource_GetStatus;
void function(SFMLClass, float) sfSoundSource_SetPitch;
void function(SFMLClass, float) sfSoundSource_SetVolume;
void function(SFMLClass, float, float, float) sfSoundSource_SetPosition;
float function(SFMLClass) sfSoundSource_GetPitch;
float function(SFMLClass) sfSoundSource_GetVolume;
void function(SFMLClass, float*, float*, float*) sfSoundSource_GetPosition;
float function(SFMLClass) sfSoundSource_GetMinDistance;
float function(SFMLClass) sfSoundSource_GetAttenuation;
void function(SFMLClass, float) sfSoundSource_SetMinDistance;
void function(SFMLClass, float) sfSoundSource_SetAttenuation;
void function(SFMLClass, bool) sfSoundSource_SetRelativeToListener;
bool function(SFMLClass) sfSoundSource_IsRelativeToListener;
}
mixin(loadDerivedFromSharedLib("csfml-audio", "sfSoundSource", derivedClassName,
"Create", "Destroy", "GetStatus", "GetPitch", "SetPitch", "GetVolume", "SetVolume", "GetPosition", "SetPosition",
"GetMinDistance", "SetMinDistance", "GetAttenuation", "SetAttenuation", "SetRelativeToListener", "IsRelativeToListener"));
}

View file

@ -0,0 +1,384 @@
/*
* DSFML - SFML Library wrapper for the D programming language.
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
* Copyright (C) 2010 Andreas Hollandt
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but
* is not required.
*
* 2. Altered source versions must be plainly marked as such,
* and must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any
* source distribution.
*/
module dsfml.audio.soundstream;
import dsfml.system.alloc;
import dsfml.system.common;
import dsfml.system.vector;
import dsfml.system.linkedlist;
import dsfml.system.lock;
import core.thread;
import core.sync.mutex;
import dsfml.audio.sound;
import dsfml.audio.soundsource;
/**
* SoundStream is a streamed sound, ie samples are acquired
* while the sound is playing. Use it for big sounds that would
* require hundreds of MB in memory, or for streaming sound from the network.
*
* SoundStream is a base class and cannot be instanciated directly.
*
* $(B onGetData override will be called by a different thread, take care of synchronization issues.) onStart is called by the thread which called .play().
*
* ------------------------
* class MySoundStream : SoundStream
* {
* this()
* {
* super(2, 44100); // you need to initialize the base class before any operation.
* }
* protected bool onGetData(out short[] data)
* {
* //You need to fill data array with some samples
*
* return true; //or false if you want to stop playback
* }
*
* protected bool onStart()
* {
* return true;
* }
* }
* ------------------------
*/
abstract class SoundStream : SoundSource!("sfSoundStream")
{
override void dispose()
{
stop();
sfSoundStream_Destroy(m_ptr);
s_instances.remove(m_id);
}
/**
* Start playing the stream
*/
void play()
{
m_flag = true;
sfSoundStream_Play(m_ptr);
if (status != SoundStatus.Paused)
{
m_t = new Thread(&threadPoll);
m_t.start();
}
}
/**
* Pause the stream
*/
void pause()
{
sfSoundStream_Pause(m_ptr);
}
/**
* Stop the stream
*/
void stop()
{
m_flag = false;
sfSoundStream_Stop(m_ptr);
m_t.join();
if (m_dummy !is null)
delete m_dummy;
}
@property
{
/**
* Get number of channels of the stream
*
* Returns:
* number of channels
*/
uint channelsCount()
{
return m_channelsCount;
}
/**
* Get the sample rate of the stream
*
* Returns:
* sample rate
*/
uint sampleRate()
{
return m_sampleRate;
}
/**
* Get the current playing offset of the stream
*
* Returns:
* current playing offset, in seconds.
*/
float playingOffset()
{
return sfSoundStream_GetPlayingOffset(m_ptr);
}
/**
* Set the current playing position of a music
*
* Params:
* timeOffset = New playing position, expressed in seconds
*/
void playingOffset(float timeOffset)
{
sfSoundStream_SetPlayingOffset(m_ptr, timeOffset);
}
/**
* Tell whether or not the stream is looping
*
* Returns:
* True if the music is looping, false otherwise
*/
bool loop()
{
if (m_ptr !is null)
return cast(bool)sfSoundStream_GetLoop(m_ptr);
return false;
}
/**
* Set the stream loop state.
*
* Disabled by default.
*
* Params:
* loop = true to play in loop, false to play once
*/
void loop(bool loop)
{
if (m_ptr !is null)
sfSoundStream_SetLoop(m_ptr, loop);
}
} // of @property
protected:
/**
* Protected constructor
*
* Params:
* channelsCount = number of channel
* sampleRate = sample rate of the stream
*
*/
this(uint channelsCount, uint sampleRate)
{
m_channelsCount = channelsCount;
m_sampleRate = sampleRate;
super(sfSoundStream_Create(&externalOnGetData, &externalOnSeek, channelsCount, sampleRate, &m_id));
m_mutex = new Mutex();
m_samples = new LinkedList!(Data);
m_t = new Thread(&this.threadPoll);
m_id = ++s_seed;
s_instances[m_id] = this;
}
/**
* Called each time the stream is seeked
*/
abstract void onSeek(float timeOffset);
/**
* Called each time the stream needs new data.
* This method will be call by an other thread, take care of possible synchronisation issues.
*
* Params:
* data = array of samples to stream
*
* Returns:
* true to continue streaming, false to stop
*/
abstract bool onGetData(out short[] data);
private:
// Called sync when user calling play()
// TODO: check if it's correct that way
extern(C) static void externalOnSeek(float t, void* user)
{
int id;
if ((id = *cast(int*) user) in s_instances)
{
SoundStream temp = s_instances[id];
return (temp.onSeek(t));
}
}
// C Thread callback (no allocation can be done)
extern (C) static int externalOnGetData(sfSoundStreamChunk* data, void* user)
{
int id, flag = false;
// Get calling soundStream
if ((id = *cast(int*) user) in s_instances)
{
SoundStream temp = s_instances[id];
//if no samples are available but streaming is not stopped, we sleep the thread
while (temp.m_samples.empty && temp.m_flag)
Thread.sleep(10_000_0); // 10ms
scope Lock l = new Lock(temp.m_mutex);
if (!temp.m_samples.empty)
{
if (temp.m_dummy !is null)
delete temp.m_dummy;
temp.m_dummy = temp.m_samples.dequeue;
if ((flag = temp.m_dummy.Flag) == true)
{
data.Samples = temp.m_dummy.Samples.ptr;
data.NbSamples = temp.m_dummy.Samples.length;
}
else
{
data.Samples = null;
data.NbSamples = 0;
}
}
}
return flag;
}
// Managed thread loop
void threadPoll()
{
short[] data;
bool ret = true;
// while streaming is active ...
while (ret && m_flag)
{
{
scope Lock l = new Lock(m_mutex);
// see how many samples are available (keep always 2 samples ready)
if (m_samples.getCount < 2)
{
// if we need new samples, lock and call derived class
ret = onGetData(data);
m_samples.enqueue(new Data(data, ret));
}
}
Thread.sleep(100_000_0); // 100ms
}
}
private class Data
{
short[] Samples;
bool Flag;
mixin Alloc;
this (short[] samples, bool flag)
{
this.Samples = samples;
this.Flag = flag;
}
}
Thread m_t;
Mutex m_mutex;
LinkedList!(Data) m_samples;
Data m_dummy;
bool m_flag;
uint m_channelsCount;
uint m_sampleRate;
int m_id;
static SoundStream[int] s_instances;
static int s_seed = 0;
// External ====================================================================
extern (C)
{
struct sfSoundStreamChunk{ short* Samples; uint NbSamples; }
alias void function(float, void*) sfSoundStreamSeekCallback;
alias int function (sfSoundStreamChunk*, void*) sfSoundStreamGetDataCallback;
alias SFMLClass function(sfSoundStreamGetDataCallback, sfSoundStreamSeekCallback, uint, uint, void*) pf_sfSoundStream_Create;
alias void function(SFMLClass) pf_sfSoundStream_Destroy;
alias void function(SFMLClass) pf_sfSoundStream_Play;
alias void function(SFMLClass) pf_sfSoundStream_Pause;
alias void function(SFMLClass) pf_sfSoundStream_Stop;
alias uint function(SFMLClass) pf_sfSoundStream_GetChannelsCount;
alias uint function(SFMLClass) pf_sfSoundStream_GetSampleRate;
alias float function(SFMLClass) pf_sfSoundStream_GetPlayingOffset;
alias void function(SFMLClass, float) pf_sfSoundStream_SetPlayingOffset;
alias int function(SFMLClass) pf_sfSoundStream_GetLoop;
alias void function(SFMLClass, int) pf_sfSoundStream_SetLoop;
static pf_sfSoundStream_Create sfSoundStream_Create;
static pf_sfSoundStream_Destroy sfSoundStream_Destroy;
static pf_sfSoundStream_Play sfSoundStream_Play;
static pf_sfSoundStream_Pause sfSoundStream_Pause;
static pf_sfSoundStream_Stop sfSoundStream_Stop;
static pf_sfSoundStream_GetChannelsCount sfSoundStream_GetChannelsCount;
static pf_sfSoundStream_GetSampleRate sfSoundStream_GetSampleRate;
static pf_sfSoundStream_GetPlayingOffset sfSoundStream_GetPlayingOffset;
static pf_sfSoundStream_SetPlayingOffset sfSoundStream_SetPlayingOffset;
static pf_sfSoundStream_GetLoop sfSoundStream_GetLoop;
static pf_sfSoundStream_SetLoop sfSoundStream_SetLoop;
}
static this()
{
debug
DllLoader dll = DllLoader.load("csfml-audio-d");
else
DllLoader dll = DllLoader.load("csfml-audio");
sfSoundStream_Create = cast(pf_sfSoundStream_Create)dll.getSymbol("sfSoundStream_Create");
sfSoundStream_Destroy = cast(pf_sfSoundStream_Destroy)dll.getSymbol("sfSoundStream_Destroy");
sfSoundStream_Play = cast(pf_sfSoundStream_Play)dll.getSymbol("sfSoundStream_Play");
sfSoundStream_Pause = cast(pf_sfSoundStream_Pause)dll.getSymbol("sfSoundStream_Pause");
sfSoundStream_Stop = cast(pf_sfSoundStream_Stop)dll.getSymbol("sfSoundStream_Stop");
sfSoundStream_GetChannelsCount = cast(pf_sfSoundStream_GetChannelsCount)dll.getSymbol("sfSoundStream_GetChannelsCount");
sfSoundStream_GetSampleRate = cast(pf_sfSoundStream_GetSampleRate)dll.getSymbol("sfSoundStream_GetSampleRate");
sfSoundStream_GetPlayingOffset = cast(pf_sfSoundStream_GetPlayingOffset)dll.getSymbol("sfSoundStream_GetPlayingOffset");
sfSoundStream_SetPlayingOffset = cast(pf_sfSoundStream_SetPlayingOffset)dll.getSymbol("sfSoundStream_SetPlayingOffset");
sfSoundStream_GetLoop = cast(pf_sfSoundStream_GetLoop)dll.getSymbol("sfSoundStream_GetLoop");
sfSoundStream_SetLoop = cast(pf_sfSoundStream_SetLoop)dll.getSymbol("sfSoundStream_SetLoop");
}
}