Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
2f524481c1
974 changed files with 295448 additions and 0 deletions
93
CSFML/include/SFML/Audio/Listener.h
Normal file
93
CSFML/include/SFML/Audio/Listener.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_LISTENER_H
|
||||
#define SFML_LISTENER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the global volume of all the sounds
|
||||
///
|
||||
/// \param Volume : New global volume, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_SetGlobalVolume(float Volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current value of the global volume of all the sounds
|
||||
///
|
||||
/// \return Current global volume, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfListener_GetGlobalVolume();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the listener
|
||||
///
|
||||
/// \param PosX : X position of the listener in the world
|
||||
/// \param PosY : Y position of the listener in the world
|
||||
/// \param PosZ : Z position of the listener in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_SetPosition(float PosX, float PosY, float PosZ);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of the listener
|
||||
///
|
||||
/// \param PosX : X position of the listener in the world
|
||||
/// \param PosY : Y position of the listener in the world
|
||||
/// \param PosZ : Z position of the listener in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_GetPosition(float* PosX, float* PosY, float* PosZ);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the orientation of the listener (the point
|
||||
/// he must look at)
|
||||
///
|
||||
/// \param TargetX : X position of the point the listener must look at
|
||||
/// \param TargetY : X position of the point the listener must look at
|
||||
/// \param TargetZ : X position of the point the listener must look at
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_SetTarget(float TargetX, float TargetY, float TargetZ);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current orientation of the listener (the point
|
||||
/// he's looking at)
|
||||
///
|
||||
/// \param TargetX : X position of the point the listener is looking at
|
||||
/// \param TargetY : X position of the point the listener is looking at
|
||||
/// \param TargetZ : X position of the point the listener is looking at
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_GetTarget(float* TargetX, float* TargetY, float* TargetZ);
|
||||
|
||||
|
||||
#endif // SFML_LISTENER_H
|
267
CSFML/include/SFML/Audio/Music.h
Normal file
267
CSFML/include/SFML/Audio/Music.h
Normal file
|
@ -0,0 +1,267 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_MUSIC_H
|
||||
#define SFML_MUSIC_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/SoundStatus.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfMusic defines a big sound played using streaming,
|
||||
/// so usually what we call a music :)
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfMusic sfMusic;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new music and load it from a file
|
||||
///
|
||||
/// \param Filename : Path of the music file to open
|
||||
///
|
||||
/// \return A new sfMusic object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfMusic* sfMusic_CreateFromFile(const char* Filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new music and load it from a file in memory
|
||||
///
|
||||
/// \param Data : Pointer to the file data in memory
|
||||
/// \param SizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return A new sfMusic object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfMusic* sfMusic_CreateFromMemory(const char* Data, size_t SizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing music
|
||||
///
|
||||
/// \param Music : Music to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_Destroy(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a music loop state
|
||||
///
|
||||
/// \param Music : Music to set the loop state
|
||||
/// \param Loop : sfTrue to play in loop, sfFalse to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetLoop(sfMusic* Music, sfBool Loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a music is looping
|
||||
///
|
||||
/// \param Music : Music to get the loop state from
|
||||
///
|
||||
/// \return sfTrue if the music is looping, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfMusic_GetLoop(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a music duration
|
||||
///
|
||||
/// \param Music : Music to get the duration from
|
||||
///
|
||||
/// \return Music duration, in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetDuration(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a music
|
||||
///
|
||||
/// \param Music : Music to play
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_Play(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a music
|
||||
///
|
||||
/// \param Music : Music to pause
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_Pause(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a music
|
||||
///
|
||||
/// \param Music : Music to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_Stop(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a music (1 = mono, 2 = stereo)
|
||||
///
|
||||
/// \param Music : Music to get the channels count from
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfMusic_GetChannelsCount(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the stream sample rate of a music
|
||||
///
|
||||
/// \param Music : Music to get the sample rate from
|
||||
///
|
||||
/// \return Stream frequency (number of samples per second)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfMusic_GetSampleRate(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a music (stopped, paused, playing)
|
||||
///
|
||||
/// \param Music : Music to get the status from
|
||||
///
|
||||
/// \return Current status of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundStatus sfMusic_GetStatus(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a music
|
||||
///
|
||||
/// \param Music : Music to get the position from
|
||||
///
|
||||
/// \return Current playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetPlayingOffset(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a music
|
||||
///
|
||||
/// \param Music : Music to modify
|
||||
/// \param Pitch : New pitch
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetPitch(sfMusic* Music, float Pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a music
|
||||
///
|
||||
/// \param Music : Music to modify
|
||||
/// \param Volume : Volume (in range [0, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetVolume(sfMusic* Music, float Volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a music
|
||||
///
|
||||
/// \param Music : Music to modify
|
||||
/// \param X : X position of the sound in the world
|
||||
/// \param Y : Y position of the sound in the world
|
||||
/// \param Z : Z position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the music at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
///
|
||||
/// \param Music : Music to modify
|
||||
/// \param MinDistance : New minimum distance for the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetMinDistance(sfMusic* Music, float MinDistance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound will be attenuated with distance from listener.
|
||||
/// The default attenuation factor 1.0
|
||||
///
|
||||
/// \param Sound : Sound to modify
|
||||
/// \param Attenuation : New attenuation factor for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetAttenuation(sfMusic* Music, float Attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a music
|
||||
///
|
||||
/// \param Music : Music to get the pitch from
|
||||
///
|
||||
/// \return Pitch value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetPitch(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a music
|
||||
///
|
||||
/// \param Music : Music to get the volume from
|
||||
///
|
||||
/// \return Volume value (in range [1, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetVolume(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a music
|
||||
///
|
||||
/// \param Music : Music to get the position from
|
||||
/// \param X : X position of the sound in the world
|
||||
/// \param Y : Y position of the sound in the world
|
||||
/// \param Z : Z position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a music
|
||||
///
|
||||
/// \param Music : Music to get the minimum distance from
|
||||
///
|
||||
/// \return Minimum distance for the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetMinDistance(sfMusic* Music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a music
|
||||
///
|
||||
/// \param Music : Music to get the attenuation factor from
|
||||
///
|
||||
/// \return Attenuation factor for the a music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetAttenuation(sfMusic* Music);
|
||||
|
||||
|
||||
#endif // SFML_MUSIC_H
|
253
CSFML/include/SFML/Audio/Sound.h
Normal file
253
CSFML/include/SFML/Audio/Sound.h
Normal file
|
@ -0,0 +1,253 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUND_H
|
||||
#define SFML_SOUND_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/SoundBuffer.h>
|
||||
#include <SFML/Audio/SoundStatus.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfSound defines the properties of the sound such as position,
|
||||
/// volume, pitch, etc.
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfSound sfSound;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound
|
||||
///
|
||||
/// \return A new sfSound object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSound* sfSound_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound
|
||||
///
|
||||
/// \param Sound : Sound to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_Destroy(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a sound
|
||||
///
|
||||
/// \param Sound : Sound to play
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_Play(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a sound
|
||||
///
|
||||
/// \param Sound : Sound to pause
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_Pause(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a sound
|
||||
///
|
||||
/// \param Sound : Sound to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_Stop(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind a sound buffer to a sound
|
||||
///
|
||||
/// \param Sound : Sound to set the loop state
|
||||
/// \param Buffer : Buffer to bind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetBuffer(sfSound* Sound, sfSoundBuffer* Buffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sound buffer bound to a sound
|
||||
///
|
||||
/// \param Sound : Sound to get the buffer from
|
||||
///
|
||||
/// \return Pointer to the sound's buffer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSound_GetBuffer(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a sound loop state
|
||||
///
|
||||
/// \param Sound : Sound to set the loop state
|
||||
/// \param Loop : sfTrue to play in loop, sfFalse to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetLoop(sfSound* Sound, sfBool Loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a sound is looping
|
||||
///
|
||||
/// \param Sound : Sound to get the loop state from
|
||||
///
|
||||
/// \return sfTrue if the sound is looping, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSound_GetLoop(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a sound (stopped, paused, playing)
|
||||
///
|
||||
/// \param Sound : Sound to get the status from
|
||||
///
|
||||
/// \return Current status of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundStatus sfSound_GetStatus(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a sound
|
||||
///
|
||||
/// \param Sound : Sound to modify
|
||||
/// \param Pitch : New pitch
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetPitch(sfSound* Sound, float Pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a sound
|
||||
///
|
||||
/// \param Sound : Sound to modify
|
||||
/// \param Volume : Volume (in range [0, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetVolume(sfSound* Sound, float Volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a sound
|
||||
///
|
||||
/// \param Sound : Sound to modify
|
||||
/// \param X : X position of the sound in the world
|
||||
/// \param Y : Y position of the sound in the world
|
||||
/// \param Z : Z position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the sound at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
///
|
||||
/// \param Sound : Sound to modify
|
||||
/// \param MinDistance : New minimum distance for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetMinDistance(sfSound* Sound, float MinDistance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound will be attenuated with distance from listener.
|
||||
/// The default attenuation factor is 1.0
|
||||
///
|
||||
/// \param Sound : Sound to modify
|
||||
/// \param Attenuation : New attenuation factor for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetAttenuation(sfSound* Sound, float Attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of a sound
|
||||
///
|
||||
/// \param Sound : Sound to modify
|
||||
/// \param TimeOffset : New playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetPlayingOffset(sfSound* Sound, float TimeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a sound
|
||||
///
|
||||
/// \param Sound : Sound to get the pitch from
|
||||
///
|
||||
/// \return Pitch value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetPitch(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a sound
|
||||
///
|
||||
/// \param Sound : Sound to get the volume from
|
||||
///
|
||||
/// \return Volume value (in range [1, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetVolume(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a sound
|
||||
///
|
||||
/// \param Sound : Sound to get the position from
|
||||
/// \param X : X position of the sound in the world
|
||||
/// \param Y : Y position of the sound in the world
|
||||
/// \param Z : Z position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a sound
|
||||
///
|
||||
/// \param Sound : Sound to get the minimum distance from
|
||||
///
|
||||
/// \return Minimum distance for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetMinDistance(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a sound
|
||||
///
|
||||
/// \param Sound : Sound to get the attenuation factor from
|
||||
///
|
||||
/// \return Attenuation factor for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetAttenuation(sfSound* Sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a sound
|
||||
///
|
||||
/// \param Sound : Sound to get the position from
|
||||
///
|
||||
/// \return Current playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetPlayingOffset(sfSound* Sound);
|
||||
|
||||
|
||||
#endif // SFML_SOUND_H
|
147
CSFML/include/SFML/Audio/SoundBuffer.h
Normal file
147
CSFML/include/SFML/Audio/SoundBuffer.h
Normal file
|
@ -0,0 +1,147 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDBUFFER_H
|
||||
#define SFML_SOUNDBUFFER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfSoundBuffer is the low-level for loading and manipulating
|
||||
/// sound buffers
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfSoundBuffer sfSoundBuffer;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from a file
|
||||
///
|
||||
/// \param Filename : Path of the music file to open
|
||||
///
|
||||
/// \return A new sfSoundBuffer object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* Filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from a file in memory
|
||||
///
|
||||
/// \param Data : Pointer to the file data in memory
|
||||
/// \param SizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return A new sfSoundBuffer object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* Data, size_t SizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from an array of
|
||||
/// samples in memory - assumed format for samples is
|
||||
/// 16 bits signed integer
|
||||
///
|
||||
/// \param Samples : Pointer to the samples in memory
|
||||
/// \param SamplesCount : Number of samples pointed by Samples
|
||||
/// \param ChannelsCount : Number of channels (1 = mono, 2 = stereo, ...)
|
||||
/// \param SampleRate : Frequency (number of samples to play per second)
|
||||
///
|
||||
/// \return A new sfSoundBuffer object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* Samples, size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound buffer
|
||||
///
|
||||
/// \param SoundBuffer : Sound buffer to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundBuffer_Destroy(sfSoundBuffer* SoundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save a sound buffer to a file
|
||||
///
|
||||
/// \param SoundBuffer : Sound buffer to save
|
||||
/// \param Filename : Path of the sound file to write
|
||||
///
|
||||
/// \return sfTrue if saving has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSoundBuffer_SaveToFile(sfSoundBuffer* SoundBuffer, const char* Filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the samples contained in a sound buffer
|
||||
///
|
||||
/// \param SoundBuffer : Sound buffer to get samples from
|
||||
///
|
||||
/// \return Pointer to the array of sound samples, in 16 bits signed integer format
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfInt16* sfSoundBuffer_GetSamples(sfSoundBuffer* SoundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of samples contained in a sound buffer
|
||||
///
|
||||
/// \param SoundBuffer : Sound buffer to get samples count from
|
||||
///
|
||||
/// \return Number of samples
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API size_t sfSoundBuffer_GetSamplesCount(sfSoundBuffer* SoundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound buffer
|
||||
///
|
||||
/// \param SoundBuffer : Sound buffer to get sample rate from
|
||||
///
|
||||
/// \return Sound frequency (number of samples per second)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundBuffer_GetSampleRate(sfSoundBuffer* SoundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a sound buffer (1 = mono, 2 = stereo, ...)
|
||||
///
|
||||
/// \param SoundBuffer : Sound buffer to get channels count from
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundBuffer_GetChannelsCount(sfSoundBuffer* SoundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the duration of a sound buffer
|
||||
///
|
||||
/// \param SoundBuffer : Sound buffer to get duration from
|
||||
///
|
||||
/// \return Sound duration, in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundBuffer_GetDuration(sfSoundBuffer* SoundBuffer);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDBUFFER_H
|
98
CSFML/include/SFML/Audio/SoundBufferRecorder.h
Normal file
98
CSFML/include/SFML/Audio/SoundBufferRecorder.h
Normal file
|
@ -0,0 +1,98 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDBUFFERRECORDER_H
|
||||
#define SFML_SOUNDBUFFERRECORDER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/SoundBuffer.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Specialized sfSoundRecorder which saves the captured
|
||||
/// audio data into a sound buffer
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfSoundBufferRecorder sfSoundBufferRecorder;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound buffer recorder
|
||||
///
|
||||
/// \return A new sfSoundBufferRecorder object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBufferRecorder* sfSoundBufferRecorder_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound buffer recorder
|
||||
///
|
||||
/// \param SoundBufferRecorder : Sound buffer recorder to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* SoundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start the capture.
|
||||
/// Warning : only one capture can happen at the same time
|
||||
///
|
||||
/// \param SoundBufferRecorder : Sound bufferrecorder to start
|
||||
/// \param SampleRate : Sound frequency (the more samples, the higher the quality)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* SoundBufferRecorder, unsigned int SampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop the capture
|
||||
///
|
||||
/// \param SoundBufferRecorder : Sound buffer recorder to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* SoundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound buffer recorder
|
||||
///
|
||||
/// \param SoundBufferRecorder : Sound buffer recorder to get sample rate from
|
||||
///
|
||||
/// \return Frequency, in samples per second
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundBufferRecorder_GetSampleRate(sfSoundBufferRecorder* SoundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sound buffer containing the captured audio data
|
||||
/// of a sound buffer recorder
|
||||
///
|
||||
/// \param SoundBufferRecorder : Sound buffer recorder to get the sound buffer from
|
||||
///
|
||||
/// \return Pointer to the sound buffer (you don't need to destroy it after use)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(sfSoundBufferRecorder* SoundBufferRecorder);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDBUFFERRECORDER_H
|
108
CSFML/include/SFML/Audio/SoundRecorder.h
Normal file
108
CSFML/include/SFML/Audio/SoundRecorder.h
Normal file
|
@ -0,0 +1,108 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDRECORDER_H
|
||||
#define SFML_SOUNDRECORDER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/SoundBuffer.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfSoundRecorder is an interface for capturing sound data
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfSoundRecorder sfSoundRecorder;
|
||||
|
||||
typedef sfBool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture
|
||||
typedef sfBool (*sfSoundRecorderProcessCallback)(const sfInt16*, size_t, void*); ///< Type of the callback used to process audio data
|
||||
typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound recorder with callback functions
|
||||
/// for processing captured samples
|
||||
///
|
||||
/// \param OnStart : Callback function which will be called when a new capture starts (can be NULL)
|
||||
/// \param OnProcess : Callback function which will be called each time there's audio data to process
|
||||
/// \param OnStop : Callback function which will be called when the current capture stops (can be NULL)
|
||||
/// \param UserData : Data to pass to the callback function (can be NULL)
|
||||
///
|
||||
/// \return A new sfSoundRecorder object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback OnStart,
|
||||
sfSoundRecorderProcessCallback OnProcess,
|
||||
sfSoundRecorderStopCallback OnStop,
|
||||
void* UserData);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound recorder
|
||||
///
|
||||
/// \param SoundRecorder : Sound recorder to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundRecorder_Destroy(sfSoundRecorder* SoundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start the capture.
|
||||
/// Warning : only one capture can happen at the same time
|
||||
///
|
||||
/// \param SoundRecorder : Sound recorder to start
|
||||
/// \param SampleRate : Sound frequency (the more samples, the higher the quality)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundRecorder_Start(sfSoundRecorder* SoundRecorder, unsigned int SampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop the capture
|
||||
///
|
||||
/// \param SoundRecorder : Sound recorder to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundRecorder_Stop(sfSoundRecorder* SoundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound recorder
|
||||
///
|
||||
/// \param SoundRecorder : Sound recorder to get sample rate from
|
||||
///
|
||||
/// \return Frequency, in samples per second
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundRecorder_GetSampleRate(sfSoundRecorder* SoundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the system supports sound capture.
|
||||
/// If not, this class won't be usable
|
||||
///
|
||||
/// \return sfTrue if audio capture is supported
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSoundRecorder_CanCapture();
|
||||
|
||||
|
||||
#endif // SFML_SOUNDRECORDER_H
|
42
CSFML/include/SFML/Audio/SoundStatus.h
Normal file
42
CSFML/include/SFML/Audio/SoundStatus.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDSTATUS_H
|
||||
#define SFML_SOUNDSTATUS_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sfStopped, ///< Sound / music is not playing
|
||||
sfPaused, ///< Sound / music is paused
|
||||
sfPlaying ///< Sound / music is playing
|
||||
} sfSoundStatus;
|
||||
|
||||
|
||||
#endif // SFML_SOUNDSTATUS_H
|
270
CSFML/include/SFML/Audio/SoundStream.h
Normal file
270
CSFML/include/SFML/Audio/SoundStream.h
Normal file
|
@ -0,0 +1,270 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDSTREAM_H
|
||||
#define SFML_SOUNDSTREAM_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/SoundStatus.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfSoundStream is a streamed sound, ie samples are acquired
|
||||
/// while the sound is playing. Use it for big sound that would
|
||||
/// require hundreds of MB in memory (see sfMusic),
|
||||
/// or for streaming sound from the network
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfSoundStream sfSoundStream;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfSoundStreamChunk defines the data to fill by the
|
||||
/// OnGetData callback
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfInt16* Samples; ///< Pointer to the audio samples
|
||||
unsigned int NbSamples; ///< Number of samples pointed by Samples
|
||||
} sfSoundStreamChunk;
|
||||
|
||||
typedef sfBool (*sfSoundStreamStartCallback)(void*); ///< Type of the callback used to start a sound stream
|
||||
typedef sfBool (*sfSoundStreamGetDataCallback)(sfSoundStreamChunk*, void*); ///< Type of the callback used to get a sound stream data
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound stream
|
||||
///
|
||||
/// \param OnStart : Function called when the stream starts (can be NULL)
|
||||
/// \param OnGetData : Function called when the stream needs more data (can't be NULL)
|
||||
/// \param ChannelsCount : Number of channels to use (1 = mono, 2 = stereo)
|
||||
/// \param SampleRate : Sample rate of the sound (44100 = CD quality)
|
||||
/// \param UserData : Data to pass to the callback functions
|
||||
///
|
||||
/// \return A new sfSoundStream object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundStream* sfSoundStream_Create(sfSoundStreamStartCallback OnStart,
|
||||
sfSoundStreamGetDataCallback OnGetData,
|
||||
unsigned int ChannelsCount,
|
||||
unsigned int SampleRate,
|
||||
void* UserData);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_Destroy(sfSoundStream* SoundStreamStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to play
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_Play(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to pause
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_Pause(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_Stop(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a sound stream (stopped, paused, playing)
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the status from
|
||||
///
|
||||
/// \return Current status of the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundStatus sfSoundStream_GetStatus(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a sound stream
|
||||
/// (1 = mono, 2 = stereo)
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the channels count from
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundStream_GetChannelsCount(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the sample rate from
|
||||
///
|
||||
/// \return Stream frequency (number of samples per second)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundStream_GetSampleRate(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to modify
|
||||
/// \param Pitch : New pitch
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetPitch(sfSoundStream* SoundStream, float Pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to modify
|
||||
/// \param Volume : Volume (in range [0, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetVolume(sfSoundStream* SoundStream, float Volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to modify
|
||||
/// \param X : X position of the sound stream in the world
|
||||
/// \param Y : Y position of the sound stream in the world
|
||||
/// \param Z : Z position of the sound stream in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, float Z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the sound stream at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
///
|
||||
/// \param SoundStream : Sound stream to modify
|
||||
/// \param MinDistance : New minimum distance for the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetMinDistance(sfSoundStream* SoundStream, float MinDistance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound stream will be attenuated with distance from listener.
|
||||
/// The default attenuation factor 1.0
|
||||
///
|
||||
/// \param SoundStream : Sound stream to modify
|
||||
/// \param Attenuation : New attenuation factor for the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetAttenuation(sfSoundStream* SoundStream, float Attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a stream loop state
|
||||
///
|
||||
/// \param SoundStream : Stream to set the loop state
|
||||
/// \param Loop : sfTrue to play in loop, sfFalse to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetLoop(sfSoundStream* SoundStream, sfBool Loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the pitch from
|
||||
///
|
||||
/// \return Pitch value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetPitch(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the volume from
|
||||
///
|
||||
/// \return Volume value (in range [1, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetVolume(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the position from
|
||||
/// \param X : X position of the sound stream in the world
|
||||
/// \param Y : Y position of the sound stream in the world
|
||||
/// \param Z : Z position of the sound stream in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, float* Z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the minimum distance from
|
||||
///
|
||||
/// \return Minimum distance for the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetMinDistance(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the attenuation factor from
|
||||
///
|
||||
/// \return Attenuation factor for the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetAttenuation(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a stream is looping
|
||||
///
|
||||
/// \param SoundStream : Soundstream to get the loop state from
|
||||
///
|
||||
/// \return sfTrue if the stream is looping, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSoundStream_GetLoop(sfSoundStream* SoundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a sound stream
|
||||
///
|
||||
/// \param SoundStream : Sound stream to get the position from
|
||||
///
|
||||
/// \return Current playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetPlayingOffset(sfSoundStream* SoundStream);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDSTREAM_H
|
Loading…
Add table
Add a link
Reference in a new issue