Changed internal naming convention (local variables now start with a lower case character)

Removed the AudioResource class

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1166 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-07-11 22:17:24 +00:00
parent 7cc00085d8
commit 45b150648d
245 changed files with 7865 additions and 8065 deletions

View file

@ -1,67 +0,0 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2009 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_AUDIORESOURCE_HPP
#define SFML_AUDIORESOURCE_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
namespace sf
{
////////////////////////////////////////////////////////////
/// Abstract base class for every class that owns a
/// device-dependant resource -- allow them to initialize / shutdown
/// even when the audio context is not created
////////////////////////////////////////////////////////////
class SFML_API AudioResource
{
protected :
////////////////////////////////////////////////////////////
/// Default constructor
///
////////////////////////////////////////////////////////////
AudioResource();
////////////////////////////////////////////////////////////
/// Copy constructor
///
////////////////////////////////////////////////////////////
AudioResource(const AudioResource&);
////////////////////////////////////////////////////////////
/// Destructor
///
////////////////////////////////////////////////////////////
virtual ~AudioResource();
};
} // namespace sf
#endif // SFML_AUDIORESOURCE_HPP

View file

@ -47,10 +47,10 @@ public :
/// Change the global volume of all the sounds.
/// The default volume is 100
///
/// \param Volume : New global volume, in the range [0, 100]
/// \param volume : New global volume, in the range [0, 100]
///
////////////////////////////////////////////////////////////
static void SetGlobalVolume(float Volume);
static void SetGlobalVolume(float volume);
////////////////////////////////////////////////////////////
/// Get the current value of the global volume of all the sounds
@ -64,19 +64,19 @@ public :
/// Change the position of the listener (take 3 values).
/// The default position is (0, 0, 0)
///
/// \param X, Y, Z : Position of the listener in the world
/// \param x, y, z : Position of the listener in the world
///
////////////////////////////////////////////////////////////
static void SetPosition(float X, float Y, float Z);
static void SetPosition(float x, float y, float z);
////////////////////////////////////////////////////////////
/// Change the position of the listener (take a 3D vector).
/// The default position is (0, 0, 0)
///
/// \param Position : Position of the listener in the world
/// \param position : Position of the listener in the world
///
////////////////////////////////////////////////////////////
static void SetPosition(const Vector3f& Position);
static void SetPosition(const Vector3f& position);
////////////////////////////////////////////////////////////
/// Get the current position of the listener
@ -91,20 +91,20 @@ public :
/// he must look at) (take 3 values).
/// The default target is (0, 0, -1)
///
/// \param X, Y, Z : Position of the point the listener must look at
/// \param x, y, z : Position of the point the listener must look at
///
////////////////////////////////////////////////////////////
static void SetTarget(float X, float Y, float Z);
static void SetTarget(float x, float y, float z);
////////////////////////////////////////////////////////////
/// Change the orientation of the listener (the point
/// he must look at) (take a 3D vector).
/// The default target is (0, 0, -1)
///
/// \param Target : Position of the point the listener must look at
/// \param target : Position of the point the listener must look at
///
////////////////////////////////////////////////////////////
static void SetTarget(const Vector3f& Target);
static void SetTarget(const Vector3f& target);
////////////////////////////////////////////////////////////
/// Get the current orientation of the listener (the point

View file

@ -52,11 +52,11 @@ public :
////////////////////////////////////////////////////////////
/// Construct the music with a buffer size
///
/// \param BufferSize : Size of the internal buffer, expressed in number of samples
/// \param bufferSize : Size of the internal buffer, expressed in number of samples
/// (ie. size taken by the music in memory) (44100 by default)
///
////////////////////////////////////////////////////////////
Music(std::size_t BufferSize = 44100);
Music(std::size_t bufferSize = 44100);
////////////////////////////////////////////////////////////
/// Destructor
@ -67,23 +67,23 @@ public :
////////////////////////////////////////////////////////////
/// Open a music file (doesn't play it -- call Play() for that)
///
/// \param Filename : Path of the music file to open
/// \param filename : Path of the music file to open
///
/// \return True if loading has been successful
///
////////////////////////////////////////////////////////////
bool OpenFromFile(const std::string& Filename);
bool OpenFromFile(const std::string& filename);
////////////////////////////////////////////////////////////
/// Open a music file from memory (doesn't play it -- call Play() for that)
///
/// \param Data : Pointer to the file data in memory
/// \param SizeInBytes : Size of the data to load, in bytes
/// \param data : Pointer to the file data in memory
/// \param sizeInBytes : Size of the data to load, in bytes
///
/// \return True if loading has been successful
///
////////////////////////////////////////////////////////////
bool OpenFromMemory(const char* Data, std::size_t SizeInBytes);
bool OpenFromMemory(const char* data, std::size_t sizeInBytes);
////////////////////////////////////////////////////////////
/// Get the music duration
@ -99,13 +99,13 @@ private :
/// /see SoundStream::OnGetData
///
////////////////////////////////////////////////////////////
virtual bool OnGetData(Chunk& Data);
virtual bool OnGetData(Chunk& data);
////////////////////////////////////////////////////////////
/// /see SoundStream::OnSeek
///
////////////////////////////////////////////////////////////
virtual void OnSeek(float TimeOffset);
virtual void OnSeek(float timeOffset);
////////////////////////////////////////////////////////////
// Member data

View file

@ -28,9 +28,9 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <SFML/System/Resource.hpp>
#include <SFML/System/Vector3.hpp>
#include <SFML/Audio/AudioResource.hpp>
#include <cstdlib>
@ -42,7 +42,7 @@ class SoundBuffer;
/// Sound defines the properties of a sound such as position,
/// volume, pitch, etc.
////////////////////////////////////////////////////////////
class SFML_API Sound : public AudioResource
class SFML_API Sound
{
public :
@ -65,22 +65,22 @@ public :
////////////////////////////////////////////////////////////
/// Construct the sound from its parameters
///
/// \param Buffer : Sound buffer to play (NULL by default)
/// \param Loop : Loop flag (false by default)
/// \param Pitch : Value of the pitch (1 by default)
/// \param Volume : Volume (100 by default)
/// \param Position : Position (0, 0, 0 by default)
/// \param buffer : Sound buffer to play (NULL by default)
/// \param loop : Loop flag (false by default)
/// \param pitch : Value of the pitch (1 by default)
/// \param volume : Volume (100 by default)
/// \param position : Position (0, 0, 0 by default)
///
////////////////////////////////////////////////////////////
Sound(const SoundBuffer& Buffer, bool Loop = false, float Pitch = 1.f, float Volume = 100.f, const Vector3f& Position = Vector3f(0, 0, 0));
Sound(const SoundBuffer& buffer, bool loop = false, float pitch = 1.f, float volume = 100.f, const Vector3f& position = Vector3f(0, 0, 0));
////////////////////////////////////////////////////////////
/// Copy constructor
///
/// \param Copy : Instance to copy
/// \param copy : Instance to copy
///
////////////////////////////////////////////////////////////
Sound(const Sound& Copy);
Sound(const Sound& copy);
////////////////////////////////////////////////////////////
/// Destructor
@ -109,93 +109,93 @@ public :
////////////////////////////////////////////////////////////
/// Set the source buffer
///
/// \param Buffer : New sound buffer to bind to the sound
/// \param buffer : New sound buffer to bind to the sound
///
////////////////////////////////////////////////////////////
void SetBuffer(const SoundBuffer& Buffer);
void SetBuffer(const SoundBuffer& buffer);
////////////////////////////////////////////////////////////
/// Set the sound loop state.
/// This parameter is disabled by default
///
/// \param Loop : True to play in loop, false to play once
/// \param loop : True to play in loop, false to play once
///
////////////////////////////////////////////////////////////
void SetLoop(bool Loop);
void SetLoop(bool loop);
////////////////////////////////////////////////////////////
/// Set the sound pitch.
/// The default pitch is 1
///
/// \param Pitch : New pitch
/// \param pitch : New pitch
///
////////////////////////////////////////////////////////////
void SetPitch(float Pitch);
void SetPitch(float pitch);
////////////////////////////////////////////////////////////
/// Set the sound volume.
/// The default volume is 100
///
/// \param Volume : Volume (in range [0, 100])
/// \param volume : Volume (in range [0, 100])
///
////////////////////////////////////////////////////////////
void SetVolume(float Volume);
void SetVolume(float volume);
////////////////////////////////////////////////////////////
/// Set the sound position (take 3 values).
/// The default position is (0, 0, 0)
///
/// \param X, Y, Z : Position of the sound in the world
/// \param x, y, z : Position of the sound in the world
///
////////////////////////////////////////////////////////////
void SetPosition(float X, float Y, float Z);
void SetPosition(float x, float y, float z);
////////////////////////////////////////////////////////////
/// Set the sound position (take a 3D vector).
/// The default position is (0, 0, 0)
///
/// \param Position : Position of the sound in the world
/// \param position : Position of the sound in the world
///
////////////////////////////////////////////////////////////
void SetPosition(const Vector3f& Position);
void SetPosition(const Vector3f& position);
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param Relative : True to set the position relative, false to set it absolute
/// \param relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
void SetRelativeToListener(bool Relative);
void SetRelativeToListener(bool relative);
////////////////////////////////////////////////////////////
/// 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 MinDistance : New minimum distance for the sound
/// \param distance : New minimum distance for the sound
///
////////////////////////////////////////////////////////////
void SetMinDistance(float MinDistance);
void SetMinDistance(float distance);
////////////////////////////////////////////////////////////
/// 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 Attenuation : New attenuation factor for the sound
/// \param attenuation : New attenuation factor for the sound
///
////////////////////////////////////////////////////////////
void SetAttenuation(float Attenuation);
void SetAttenuation(float attenuation);
////////////////////////////////////////////////////////////
/// Set the current playing position of the sound
///
/// \param TimeOffset : New playing position, expressed in seconds
/// \param timeOffset : New playing position, expressed in seconds
///
////////////////////////////////////////////////////////////
void SetPlayingOffset(float TimeOffset);
void SetPlayingOffset(float timeOffset);
////////////////////////////////////////////////////////////
/// Get the source buffer
@ -286,7 +286,7 @@ public :
/// \return Reference to the sound
///
////////////////////////////////////////////////////////////
Sound& operator =(const Sound& Other);
Sound& operator =(const Sound& other);
private :

View file

@ -28,8 +28,8 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <SFML/System/Resource.hpp>
#include <SFML/Audio/AudioResource.hpp>
#include <string>
#include <vector>
@ -40,7 +40,7 @@ namespace sf
/// SoundBuffer is the low-level for loading and manipulating
/// sound buffers
////////////////////////////////////////////////////////////
class SFML_API SoundBuffer : public AudioResource, public Resource<SoundBuffer>
class SFML_API SoundBuffer : public Resource<SoundBuffer>
{
public :
@ -53,10 +53,10 @@ public :
////////////////////////////////////////////////////////////
/// Copy constructor
///
/// \param Copy : Instance to copy
/// \param copy : Instance to copy
///
////////////////////////////////////////////////////////////
SoundBuffer(const SoundBuffer& Copy);
SoundBuffer(const SoundBuffer& copy);
////////////////////////////////////////////////////////////
/// Destructor
@ -67,47 +67,47 @@ public :
////////////////////////////////////////////////////////////
/// Load the sound buffer from a file
///
/// \param Filename : Path of the sound file to load
/// \param filename : Path of the sound file to load
///
/// \return True if loading has been successful
///
////////////////////////////////////////////////////////////
bool LoadFromFile(const std::string& Filename);
bool LoadFromFile(const std::string& filename);
////////////////////////////////////////////////////////////
/// Load the sound buffer from a file in memory
///
/// \param Data : Pointer to the file data in memory
/// \param SizeInBytes : Size of the data to load, in bytes
/// \param data : Pointer to the file data in memory
/// \param sizeInBytes : Size of the data to load, in bytes
///
/// \return True if loading has been successful
///
////////////////////////////////////////////////////////////
bool LoadFromMemory(const char* Data, std::size_t SizeInBytes);
bool LoadFromMemory(const char* data, std::size_t sizeInBytes);
////////////////////////////////////////////////////////////
/// Load the sound buffer from an array of samples - 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)
/// \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 True if loading has been successful
///
////////////////////////////////////////////////////////////
bool LoadFromSamples(const Int16* Samples, std::size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate);
bool LoadFromSamples(const Int16* samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// Save the sound buffer to a file
///
/// \param Filename : Path of the sound file to write
/// \param filename : Path of the sound file to write
///
/// \return True if saving has been successful
///
////////////////////////////////////////////////////////////
bool SaveToFile(const std::string& Filename) const;
bool SaveToFile(const std::string& filename) const;
////////////////////////////////////////////////////////////
/// Return the sound samples
@ -152,12 +152,12 @@ public :
////////////////////////////////////////////////////////////
/// Assignment operator
///
/// \param Other : Instance to assign
/// \param other : Instance to assign
///
/// \return Reference to the sound buffer
///
////////////////////////////////////////////////////////////
SoundBuffer& operator =(const SoundBuffer& Other);
SoundBuffer& operator =(const SoundBuffer& other);
private :
@ -166,13 +166,13 @@ private :
////////////////////////////////////////////////////////////
/// Update the internal buffer with the audio samples
///
/// \param ChannelsCount : Number of channels
/// \param SampleRate : Sample rate
/// \param channelsCount : Number of channels
/// \param sampleRate : Sample rate
///
/// \return True on success
///
////////////////////////////////////////////////////////////
bool Update(unsigned int ChannelsCount, unsigned int SampleRate);
bool Update(unsigned int channelsCount, unsigned int sampleRate);
////////////////////////////////////////////////////////////
// Member data

View file

@ -63,7 +63,7 @@ private :
/// /see SoundBuffer::OnProcessSamples
///
////////////////////////////////////////////////////////////
virtual bool OnProcessSamples(const Int16* Samples, std::size_t SamplesCount);
virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount);
////////////////////////////////////////////////////////////
/// /see SoundBuffer::OnStop

View file

@ -52,11 +52,11 @@ public :
/// Start the capture.
/// Warning : only one capture can happen at the same time
///
/// \param SampleRate : Sound frequency (the more samples, the higher the quality)
/// \param sampleRate : Sound frequency (the more samples, the higher the quality)
/// (44100 by default = CD quality)
///
////////////////////////////////////////////////////////////
void Start(unsigned int SampleRate = 44100);
void Start(unsigned int sampleRate = 44100);
////////////////////////////////////////////////////////////
/// Stop the capture
@ -102,13 +102,13 @@ private :
////////////////////////////////////////////////////////////
/// Process a new chunk of recorded samples
///
/// \param Samples : Pointer to the new chunk of recorded samples
/// \param SamplesCount : Number of samples pointed by Samples
/// \param samples : Pointer to the new chunk of recorded samples
/// \param samplesCount : Number of samples pointed by Samples
///
/// \return False to stop recording audio data, true to continue
///
////////////////////////////////////////////////////////////
virtual bool OnProcessSamples(const Int16* Samples, std::size_t SamplesCount) = 0;
virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount) = 0;
////////////////////////////////////////////////////////////
/// Stop recording audio data

View file

@ -117,10 +117,10 @@ public :
////////////////////////////////////////////////////////////
/// Set the current playing position of the stream
///
/// \param TimeOffset : New playing position, expressed in seconds
/// \param timeOffset : New playing position, expressed in seconds
///
////////////////////////////////////////////////////////////
void SetPlayingOffset(float TimeOffset);
void SetPlayingOffset(float timeOffset);
////////////////////////////////////////////////////////////
/// Get the current playing position of the stream
@ -134,10 +134,10 @@ public :
/// Set the stream loop state.
/// This parameter is disabled by default
///
/// \param Loop : True to play in loop, false to play once
/// \param loop : True to play in loop, false to play once
///
////////////////////////////////////////////////////////////
void SetLoop(bool Loop);
void SetLoop(bool loop);
////////////////////////////////////////////////////////////
/// Tell whether or not the stream is looping
@ -158,11 +158,11 @@ protected :
////////////////////////////////////////////////////////////
/// Set the audio stream parameters, you must call it before Play()
///
/// \param ChannelsCount : Number of channels
/// \param SampleRate : Sample rate
/// \param channelsCount : Number of channels
/// \param sampleRate : Sample rate
///
////////////////////////////////////////////////////////////
void Initialize(unsigned int ChannelsCount, unsigned int SampleRate);
void Initialize(unsigned int channelsCount, unsigned int sampleRate);
private :
@ -175,31 +175,31 @@ private :
////////////////////////////////////////////////////////////
/// Called each time new audio data is needed to feed the stream
///
/// \param Data : New chunk of data to stream
/// \param data : New chunk of data to stream
///
/// \return True to continue playback, false to stop
///
////////////////////////////////////////////////////////////
virtual bool OnGetData(Chunk& Data) = 0;
virtual bool OnGetData(Chunk& data) = 0;
////////////////////////////////////////////////////////////
/// Called to move the current reading position
///
/// \param TimeOffset : New read position, expressed in seconds
/// \param timeOffset : New read position, expressed in seconds
///
////////////////////////////////////////////////////////////
virtual void OnSeek(float TimeOffset) = 0;
virtual void OnSeek(float timeOffset) = 0;
////////////////////////////////////////////////////////////
/// Fill a new buffer with audio data, and push it to the
/// playing queue
///
/// \param Buffer : Buffer to fill
/// \param buffer : Buffer to fill
///
/// \return True if the derived class has requested to stop
///
////////////////////////////////////////////////////////////
bool FillAndPushBuffer(unsigned int Buffer);
bool FillAndPushBuffer(unsigned int buffer);
////////////////////////////////////////////////////////////
/// Fill the buffers queue with all available buffers