Fixed a few typos/style issues

This commit is contained in:
Marco Antognini 2015-03-09 10:47:20 +01:00
parent 0c2f306c17
commit aa9a6dec89
23 changed files with 72 additions and 64 deletions

View File

@ -45,7 +45,7 @@ class SoundFileReader;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API InputSoundFile : NonCopyable class SFML_AUDIO_API InputSoundFile : NonCopyable
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor
@ -161,7 +161,7 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Change the current read position to the given time offset /// \brief Change the current read position to the given time offset
/// ///
/// Using a time offset is handy but unprecise. If you need an accurate /// Using a time offset is handy but imprecise. If you need an accurate
/// result, consider using the overload which takes a sample offset. /// result, consider using the overload which takes a sample offset.
/// ///
/// If the given time exceeds to total duration, this function jumps /// If the given time exceeds to total duration, this function jumps
@ -227,10 +227,10 @@ private:
/// /* error */; /// /* error */;
/// ///
/// // Print the sound attributes /// // Print the sound attributes
/// std::cout << "duration: " << file.getDuration().asSeconds() << std::endl; /// std::cout << "duration: " << file.getDuration().asSeconds() << std::endl;
/// std::cout << "channels: " << file.getChannelCount() << std::endl; /// std::cout << "channels: " << file.getChannelCount() << std::endl;
/// std::cout << "sample rate: " << file.getSampleRate() << std::endl; /// std::cout << "sample rate: " << file.getSampleRate() << std::endl;
/// std::cout << "sample count: " << file.getSampleCount() << std::endl; /// std::cout << "sample count: " << file.getSampleCount() << std::endl;
/// ///
/// // Read and process batches of samples until the end of file is reached /// // Read and process batches of samples until the end of file is reached
/// sf::Int16 samples[1024]; /// sf::Int16 samples[1024];
@ -239,7 +239,7 @@ private:
/// { /// {
/// count = file.read(samples, 1024); /// count = file.read(samples, 1024);
/// ///
/// // process, analyse, play, convert, or whatever /// // process, analyze, play, convert, or whatever
/// // you want to do with the samples... /// // you want to do with the samples...
/// } /// }
/// while (count > 0); /// while (count > 0);

View File

@ -47,7 +47,7 @@ class InputStream;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API Music : public SoundStream class SFML_AUDIO_API Music : public SoundStream
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor
@ -87,7 +87,7 @@ public :
/// of supported formats. /// of supported formats.
/// Since the music is not loaded completely but rather streamed /// Since the music is not loaded completely but rather streamed
/// continuously, the \a data must remain available as long as the /// continuously, the \a data must remain available as long as the
/// music is playing (ie. you can't deallocate it right after calling /// music is playing (i.e. you can't deallocate it right after calling
/// this function). /// this function).
/// ///
/// \param data Pointer to the file data in memory /// \param data Pointer to the file data in memory
@ -109,7 +109,7 @@ public :
/// of supported formats. /// of supported formats.
/// Since the music is not loaded completely but rather streamed /// Since the music is not loaded completely but rather streamed
/// continuously, the \a stream must remain alive as long as the /// continuously, the \a stream must remain alive as long as the
/// music is playing (ie. you can't destroy it right after calling /// music is playing (i.e. you can't destroy it right after calling
/// this function). /// this function).
/// ///
/// \param stream Source stream to read from /// \param stream Source stream to read from
@ -129,7 +129,7 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Time getDuration() const; Time getDuration() const;
protected : protected:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Request a new chunk of audio samples from the stream source /// \brief Request a new chunk of audio samples from the stream source
@ -152,7 +152,7 @@ protected :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual void onSeek(Time timeOffset); virtual void onSeek(Time timeOffset);
private : private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Initialize the internal state after loading a new music /// \brief Initialize the internal state after loading a new music

View File

@ -43,7 +43,7 @@ class SoundFileWriter;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API OutputSoundFile : NonCopyable class SFML_AUDIO_API OutputSoundFile : NonCopyable
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -48,7 +48,7 @@ class InputStream;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API SoundBuffer : AlResource class SFML_AUDIO_API SoundBuffer : AlResource
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor
@ -223,7 +223,7 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
SoundBuffer& operator =(const SoundBuffer& right); SoundBuffer& operator =(const SoundBuffer& right);
private : private:
friend class Sound; friend class Sound;
@ -232,7 +232,7 @@ private :
/// ///
/// \param file Sound file providing access to the new loaded sound /// \param file Sound file providing access to the new loaded sound
/// ///
/// \return True on succesful initialization, false on failure /// \return True on successful initialization, false on failure
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool initialize(InputSoundFile& file); bool initialize(InputSoundFile& file);
@ -291,7 +291,7 @@ private :
/// A sound buffer holds the data of a sound, which is /// A sound buffer holds the data of a sound, which is
/// an array of audio samples. A sample is a 16 bits signed integer /// an array of audio samples. A sample is a 16 bits signed integer
/// that defines the amplitude of the sound at a given time. /// that defines the amplitude of the sound at a given time.
/// The sound is then restituted by playing these samples at /// The sound is then reconstituted by playing these samples at
/// a high rate (for example, 44100 samples per second is the /// a high rate (for example, 44100 samples per second is the
/// standard rate used for playing CDs). In short, audio samples /// standard rate used for playing CDs). In short, audio samples
/// are like texture pixels, and a sf::SoundBuffer is similar to /// are like texture pixels, and a sf::SoundBuffer is similar to
@ -324,20 +324,20 @@ private :
/// \code /// \code
/// // Declare a new sound buffer /// // Declare a new sound buffer
/// sf::SoundBuffer buffer; /// sf::SoundBuffer buffer;
/// ///
/// // Load it from a file /// // Load it from a file
/// if (!buffer.loadFromFile("sound.wav")) /// if (!buffer.loadFromFile("sound.wav"))
/// { /// {
/// // error... /// // error...
/// } /// }
/// ///
/// // Create a sound source and bind it to the buffer /// // Create a sound source and bind it to the buffer
/// sf::Sound sound1; /// sf::Sound sound1;
/// sound1.setBuffer(buffer); /// sound1.setBuffer(buffer);
/// ///
/// // Play the sound /// // Play the sound
/// sound1.play(); /// sound1.play();
/// ///
/// // Create another sound source bound to the same buffer /// // Create another sound source bound to the same buffer
/// sf::Sound sound2; /// sf::Sound sound2;
/// sound2.setBuffer(buffer); /// sound2.setBuffer(buffer);

View File

@ -40,12 +40,12 @@ class SoundFileReader;
class SoundFileWriter; class SoundFileWriter;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Manages and instanciates sound file readers and writers /// \brief Manages and instantiates sound file readers and writers
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API SoundFileFactory class SFML_AUDIO_API SoundFileFactory
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Register a new reader /// \brief Register a new reader
@ -84,7 +84,9 @@ public :
static void unregisterWriter(); static void unregisterWriter();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Instanciate the right reader for the given file on disk /// \brief Instantiate the right reader for the given file on disk
///
/// It's up to the caller to release the returned reader
/// ///
/// \param filename Path of the sound file /// \param filename Path of the sound file
/// ///
@ -96,7 +98,9 @@ public :
static SoundFileReader* createReaderFromFilename(const std::string& filename); static SoundFileReader* createReaderFromFilename(const std::string& filename);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Instanciate the right codec for the given file in memory /// \brief Instantiate the right codec for the given file in memory
///
/// It's up to the caller to release the returned reader
/// ///
/// \param data Pointer to the file data in memory /// \param data Pointer to the file data in memory
/// \param sizeInBytes Total size of the file data, in bytes /// \param sizeInBytes Total size of the file data, in bytes
@ -109,7 +113,9 @@ public :
static SoundFileReader* createReaderFromMemory(const void* data, std::size_t sizeInBytes); static SoundFileReader* createReaderFromMemory(const void* data, std::size_t sizeInBytes);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Instanciate the right codec for the given file in stream /// \brief Instantiate the right codec for the given file in stream
///
/// It's up to the caller to release the returned reader
/// ///
/// \param stream Source stream to read from /// \param stream Source stream to read from
/// ///
@ -121,7 +127,9 @@ public :
static SoundFileReader* createReaderFromStream(InputStream& stream); static SoundFileReader* createReaderFromStream(InputStream& stream);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Instanciate the right writer for the given file on disk /// \brief Instantiate the right writer for the given file on disk
///
/// It's up to the caller to release the returned writer
/// ///
/// \param filename Path of the sound file /// \param filename Path of the sound file
/// ///
@ -168,7 +176,7 @@ private:
/// \ingroup audio /// \ingroup audio
/// ///
/// This class is where all the sound file readers and writers are /// This class is where all the sound file readers and writers are
/// registered. You should normally only need to use its regitration /// registered. You should normally only need to use its registration
/// and unregistration functions; readers/writers creation and manipulation /// and unregistration functions; readers/writers creation and manipulation
/// are wrapped into the higher-level classes sf::InputSoundFile and /// are wrapped into the higher-level classes sf::InputSoundFile and
/// sf::OutputSoundFile. /// sf::OutputSoundFile.

View File

@ -42,7 +42,7 @@ class InputStream;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API SoundFileReader class SFML_AUDIO_API SoundFileReader
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Structure holding the audio properties of a sound file /// \brief Structure holding the audio properties of a sound file

View File

@ -40,7 +40,7 @@ namespace sf
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API SoundFileWriter class SFML_AUDIO_API SoundFileWriter
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Virtual destructor /// \brief Virtual destructor

View File

@ -52,7 +52,7 @@ namespace sf
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_SYSTEM_API FileInputStream : public InputStream class SFML_SYSTEM_API FileInputStream : public InputStream
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor
/// ///
@ -120,10 +120,10 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#ifndef ANDROID #ifdef ANDROID
std::ifstream m_file; ///< Standard file stream
#else
sf::priv::ResourceStream *m_file; sf::priv::ResourceStream *m_file;
#else
std::ifstream m_file; ///< Standard file stream
#endif #endif
}; };

View File

@ -42,7 +42,7 @@ namespace sf
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_SYSTEM_API MemoryInputStream : public InputStream class SFML_SYSTEM_API MemoryInputStream : public InputStream
{ {
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -244,9 +244,9 @@ void InputSoundFile::close()
if (m_streamOwned) if (m_streamOwned)
{ {
delete m_stream; delete m_stream;
m_stream = NULL;
m_streamOwned = false; m_streamOwned = false;
} }
m_stream = NULL;
// Reset the sound file attributes // Reset the sound file attributes
m_sampleCount = 0; m_sampleCount = 0;

View File

@ -38,7 +38,7 @@
namespace namespace
{ {
// register all the built-in readers and writers if not already done // Register all the built-in readers and writers if not already done
void ensureDefaultReadersWritersRegistered() void ensureDefaultReadersWritersRegistered()
{ {
static bool registered = false; static bool registered = false;

View File

@ -56,7 +56,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static bool check(InputStream& stream); static bool check(InputStream& stream);
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -54,7 +54,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static bool check(InputStream& stream); static bool check(InputStream& stream);
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -54,7 +54,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static bool check(InputStream& stream); static bool check(InputStream& stream);
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -55,7 +55,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static bool check(const std::string& filename); static bool check(const std::string& filename);
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -55,7 +55,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static bool check(const std::string& filename); static bool check(const std::string& filename);
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -55,7 +55,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static bool check(const std::string& filename); static bool check(const std::string& filename);
public : public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -56,13 +56,13 @@ FileInputStream::~FileInputStream()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool FileInputStream::open(const std::string& filename) bool FileInputStream::open(const std::string& filename)
{ {
#ifndef ANDROID #ifdef ANDROID
m_file.open(filename.c_str(), std::ios::binary);
return m_file.good();
#else
if (m_file) if (m_file)
delete m_file; delete m_file;
m_file = new sf::priv::ResourceStream(filename); m_file = new sf::priv::ResourceStream(filename);
#else
m_file.open(filename.c_str(), std::ios::binary);
return m_file.good();
#endif #endif
} }
@ -70,11 +70,11 @@ bool FileInputStream::open(const std::string& filename)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 FileInputStream::read(void* data, Int64 size) Int64 FileInputStream::read(void* data, Int64 size)
{ {
#ifndef ANDROID #ifdef ANDROID
return m_file->read(data, size);
#else
m_file.read(static_cast<char*>(data), size); m_file.read(static_cast<char*>(data), size);
return m_file.gcount(); return m_file.gcount();
#else
return m_file->read(data, size);
#endif #endif
} }
@ -82,13 +82,13 @@ Int64 FileInputStream::read(void* data, Int64 size)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 FileInputStream::seek(Int64 position) Int64 FileInputStream::seek(Int64 position)
{ {
#ifndef ANDROID #ifdef ANDROID
return m_file->seek(position);
#else
if (m_file.eof() || m_file.fail()) if (m_file.eof() || m_file.fail())
m_file.clear(); m_file.clear();
m_file.seekg(position); m_file.seekg(position);
return tell(); return tell();
#else
return m_file->seek(position);
#endif #endif
} }
@ -96,10 +96,10 @@ Int64 FileInputStream::seek(Int64 position)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 FileInputStream::tell() Int64 FileInputStream::tell()
{ {
#ifndef ANDROID #ifdef ANDROID
return m_file.tellg();
#else
return m_file->tell(); return m_file->tell();
#else
return m_file.tellg();
#endif #endif
} }
@ -107,14 +107,14 @@ Int64 FileInputStream::tell()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 FileInputStream::getSize() Int64 FileInputStream::getSize()
{ {
#ifndef ANDROID #ifdef ANDROID
return m_file->getSize();
#else
std::ifstream::pos_type pos = m_file.tellg(); std::ifstream::pos_type pos = m_file.tellg();
m_file.seekg(0, std::ios::end); m_file.seekg(0, std::ios::end);
std::ifstream::pos_type size = m_file.tellg(); std::ifstream::pos_type size = m_file.tellg();
m_file.seekg(pos); m_file.seekg(pos);
return size; return size;
#else
return m_file->getSize();
#endif #endif
} }

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// //
// SFML - Simple and Fast Multimedia Library // SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
// //
// This software is provided 'as-is', without any express or implied warranty. // 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. // In no event will the authors be held liable for any damages arising from the use of this software.

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// //
// SFML - Simple and Fast Multimedia Library // SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
// //
// This software is provided 'as-is', without any express or implied warranty. // 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. // In no event will the authors be held liable for any damages arising from the use of this software.

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// //
// SFML - Simple and Fast Multimedia Library // SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
// //
// This software is provided 'as-is', without any express or implied warranty. // 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. // In no event will the authors be held liable for any damages arising from the use of this software.

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// //
// SFML - Simple and Fast Multimedia Library // SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
// //
// This software is provided 'as-is', without any express or implied warranty. // 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. // In no event will the authors be held liable for any damages arising from the use of this software.

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// //
// SFML - Simple and Fast Multimedia Library // SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
// //
// This software is provided 'as-is', without any express or implied warranty. // 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. // In no event will the authors be held liable for any damages arising from the use of this software.