Corrected the name of some functions/variable

This commit is contained in:
Laurent Gomila 2011-12-25 23:42:43 +01:00
parent c817f882e6
commit aaa21dfaf6
32 changed files with 203 additions and 203 deletions

View file

@ -99,12 +99,12 @@ bool AudioDevice::IsExtensionSupported(const std::string& extension)
////////////////////////////////////////////////////////////
int AudioDevice::GetFormatFromChannelsCount(unsigned int channelsCount)
int AudioDevice::GetFormatFromChannelCount(unsigned int channelCount)
{
EnsureALInit();
// Find the good format according to the number of channels
switch (channelsCount)
switch (channelCount)
{
case 1 : return AL_FORMAT_MONO16;
case 2 : return AL_FORMAT_STEREO16;

View file

@ -75,12 +75,12 @@ public :
////////////////////////////////////////////////////////////
/// \brief Get the OpenAL format that matches the given number of channels
///
/// \param channelsCount Number of channels
/// \param channelCount Number of channels
///
/// \return Corresponding format
///
////////////////////////////////////////////////////////////
static int GetFormatFromChannelsCount(unsigned int channelsCount);
static int GetFormatFromChannelCount(unsigned int channelCount);
};
} // namespace priv

View file

@ -139,14 +139,14 @@ void Music::OnSeek(Uint32 timeOffset)
void Music::Initialize()
{
// Compute the music duration
Uint64 samples = myFile->GetSamplesCount();
myDuration = static_cast<Uint32>(1000 * samples / myFile->GetSampleRate() / myFile->GetChannelsCount());
Uint64 samples = myFile->GetSampleCount();
myDuration = static_cast<Uint32>(1000 * samples / myFile->GetSampleRate() / myFile->GetChannelCount());
// Resize the internal buffer so that it can contain 1 second of audio samples
mySamples.resize(myFile->GetSampleRate() * myFile->GetChannelsCount());
mySamples.resize(myFile->GetSampleRate() * myFile->GetChannelCount());
// Initialize the stream
SoundStream::Initialize(myFile->GetChannelsCount(), myFile->GetSampleRate());
SoundStream::Initialize(myFile->GetChannelCount(), myFile->GetSampleRate());
}
} // namespace sf

View file

@ -59,7 +59,7 @@ mySounds () // don't copy the attached sounds
ALCheck(alGenBuffers(1, &myBuffer));
// Update the internal buffer with the new samples
Update(copy.GetChannelsCount(), copy.GetSampleRate());
Update(copy.GetChannelCount(), copy.GetSampleRate());
}
@ -110,24 +110,24 @@ bool SoundBuffer::LoadFromStream(InputStream& stream)
////////////////////////////////////////////////////////////
bool SoundBuffer::LoadFromSamples(const Int16* samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate)
bool SoundBuffer::LoadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate)
{
if (samples && samplesCount && channelsCount && sampleRate)
if (samples && sampleCount && channelCount && sampleRate)
{
// Copy the new audio samples
mySamples.assign(samples, samples + samplesCount);
mySamples.assign(samples, samples + sampleCount);
// Update the internal buffer with the new samples
return Update(channelsCount, sampleRate);
return Update(channelCount, sampleRate);
}
else
{
// Error...
Err() << "Failed to load sound buffer from samples ("
<< "array: " << samples << ", "
<< "count: " << samplesCount << ", "
<< "channels: " << channelsCount << ", "
<< "samplerate: " << sampleRate << ")"
<< "array: " << samples << ", "
<< "count: " << sampleCount << ", "
<< "channels: " << channelCount << ", "
<< "samplerate: " << sampleRate << ")"
<< std::endl;
return false;
@ -140,7 +140,7 @@ bool SoundBuffer::SaveToFile(const std::string& filename) const
{
// Create the sound file in write mode
priv::SoundFile file;
if (file.OpenWrite(filename, GetChannelsCount(), GetSampleRate()))
if (file.OpenWrite(filename, GetChannelCount(), GetSampleRate()))
{
// Write the samples to the opened file
file.Write(&mySamples[0], mySamples.size());
@ -162,7 +162,7 @@ const Int16* SoundBuffer::GetSamples() const
////////////////////////////////////////////////////////////
std::size_t SoundBuffer::GetSamplesCount() const
std::size_t SoundBuffer::GetSampleCount() const
{
return mySamples.size();
}
@ -179,12 +179,12 @@ unsigned int SoundBuffer::GetSampleRate() const
////////////////////////////////////////////////////////////
unsigned int SoundBuffer::GetChannelsCount() const
unsigned int SoundBuffer::GetChannelCount() const
{
ALint channelsCount;
ALCheck(alGetBufferi(myBuffer, AL_CHANNELS, &channelsCount));
ALint channelCount;
ALCheck(alGetBufferi(myBuffer, AL_CHANNELS, &channelCount));
return channelsCount;
return channelCount;
}
@ -213,16 +213,16 @@ SoundBuffer& SoundBuffer::operator =(const SoundBuffer& right)
bool SoundBuffer::Initialize(priv::SoundFile& file)
{
// Retrieve the sound parameters
std::size_t nbSamples = file.GetSamplesCount();
unsigned int channelsCount = file.GetChannelsCount();
unsigned int sampleRate = file.GetSampleRate();
std::size_t nbSamples = file.GetSampleCount();
unsigned int channelCount = file.GetChannelCount();
unsigned int sampleRate = file.GetSampleRate();
// Read the samples from the provided file
mySamples.resize(nbSamples);
if (file.Read(&mySamples[0], nbSamples) == nbSamples)
{
// Update the internal buffer with the new samples
return Update(channelsCount, sampleRate);
return Update(channelCount, sampleRate);
}
else
{
@ -232,19 +232,19 @@ bool SoundBuffer::Initialize(priv::SoundFile& file)
////////////////////////////////////////////////////////////
bool SoundBuffer::Update(unsigned int channelsCount, unsigned int sampleRate)
bool SoundBuffer::Update(unsigned int channelCount, unsigned int sampleRate)
{
// Check parameters
if (!channelsCount || !sampleRate || mySamples.empty())
if (!channelCount || !sampleRate || mySamples.empty())
return false;
// Find the good format according to the number of channels
ALenum format = priv::AudioDevice::GetFormatFromChannelsCount(channelsCount);
ALenum format = priv::AudioDevice::GetFormatFromChannelCount(channelCount);
// Check if the format is valid
if (format == 0)
{
Err() << "Failed to load sound buffer (unsupported number of channels: " << channelsCount << ")" << std::endl;
Err() << "Failed to load sound buffer (unsupported number of channels: " << channelCount << ")" << std::endl;
return false;
}
@ -253,7 +253,7 @@ bool SoundBuffer::Update(unsigned int channelsCount, unsigned int sampleRate)
ALCheck(alBufferData(myBuffer, format, &mySamples[0], size, sampleRate));
// Compute the duration
myDuration = static_cast<Uint32>(1000 * mySamples.size() / sampleRate / channelsCount);
myDuration = static_cast<Uint32>(1000 * mySamples.size() / sampleRate / channelCount);
return true;
}

View file

@ -43,9 +43,9 @@ bool SoundBufferRecorder::OnStart()
////////////////////////////////////////////////////////////
bool SoundBufferRecorder::OnProcessSamples(const Int16* samples, std::size_t samplesCount)
bool SoundBufferRecorder::OnProcessSamples(const Int16* samples, std::size_t sampleCount)
{
std::copy(samples, samples + samplesCount, std::back_inserter(mySamples));
std::copy(samples, samples + sampleCount, std::back_inserter(mySamples));
return true;
}

View file

@ -53,10 +53,10 @@ namespace priv
{
////////////////////////////////////////////////////////////
SoundFile::SoundFile() :
myFile (NULL),
myNbSamples (0),
myChannelsCount(0),
mySampleRate (0)
myFile (NULL),
myNbSamples (0),
myChannelCount(0),
mySampleRate (0)
{
}
@ -71,16 +71,16 @@ SoundFile::~SoundFile()
////////////////////////////////////////////////////////////
std::size_t SoundFile::GetSamplesCount() const
std::size_t SoundFile::GetSampleCount() const
{
return myNbSamples;
}
////////////////////////////////////////////////////////////
unsigned int SoundFile::GetChannelsCount() const
unsigned int SoundFile::GetChannelCount() const
{
return myChannelsCount;
return myChannelCount;
}
@ -108,9 +108,9 @@ bool SoundFile::OpenRead(const std::string& filename)
}
// Set the sound parameters
myChannelsCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelsCount;
myChannelCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelCount;
return true;
}
@ -145,9 +145,9 @@ bool SoundFile::OpenRead(const void* data, std::size_t sizeInBytes)
}
// Set the sound parameters
myChannelsCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelsCount;
myChannelCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelCount;
return true;
}
@ -177,16 +177,16 @@ bool SoundFile::OpenRead(InputStream& stream)
}
// Set the sound parameters
myChannelsCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelsCount;
myChannelCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelCount;
return true;
}
////////////////////////////////////////////////////////////
bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelsCount, unsigned int sampleRate)
bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelCount, unsigned int sampleRate)
{
// If the file is already opened, first close it
if (myFile)
@ -203,7 +203,7 @@ bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelsCoun
// Fill the sound infos with parameters
SF_INFO fileInfos;
fileInfos.channels = channelsCount;
fileInfos.channels = channelCount;
fileInfos.samplerate = sampleRate;
fileInfos.format = format | (format == SF_FORMAT_OGG ? SF_FORMAT_VORBIS : SF_FORMAT_PCM_16);
@ -216,9 +216,9 @@ bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelsCoun
}
// Set the sound parameters
myChannelsCount = channelsCount;
mySampleRate = sampleRate;
myNbSamples = 0;
myChannelCount = channelCount;
mySampleRate = sampleRate;
myNbSamples = 0;
return true;
}

View file

@ -65,7 +65,7 @@ public :
/// \return Number of samples
///
////////////////////////////////////////////////////////////
std::size_t GetSamplesCount() const;
std::size_t GetSampleCount() const;
////////////////////////////////////////////////////////////
/// \brief Get the number of channels used by the sound
@ -73,7 +73,7 @@ public :
/// \return Number of channels (1 = mono, 2 = stereo)
///
////////////////////////////////////////////////////////////
unsigned int GetChannelsCount() const;
unsigned int GetChannelCount() const;
////////////////////////////////////////////////////////////
/// \brief Get the sample rate of the sound
@ -117,19 +117,19 @@ public :
////////////////////////////////////////////////////////////
/// \brief a the sound file for writing
///
/// \param filename Path of the sound file to write
/// \param channelsCount Number of channels in the sound
/// \param sampleRate Sample rate of the sound
/// \param filename Path of the sound file to write
/// \param channelCount Number of channels in the sound
/// \param sampleRate Sample rate of the sound
///
/// \return True if the file was successfully opened
///
////////////////////////////////////////////////////////////
bool OpenWrite(const std::string& filename, unsigned int channelsCount, unsigned int sampleRate);
bool OpenWrite(const std::string& filename, unsigned int channelCount, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Read audio samples from the loaded sound
///
/// \param data Pointer to the samples array to fill
/// \param data Pointer to the sample array to fill
/// \param nbSamples Number of samples to read
///
/// \return Number of samples actually read (may be less than \a nbSamples)
@ -140,7 +140,7 @@ public :
////////////////////////////////////////////////////////////
/// \brief Write audio samples to the file
///
/// \param data Pointer to the samples array to write
/// \param data Pointer to the sample array to write
/// \param nbSamples Number of samples to write
///
////////////////////////////////////////////////////////////
@ -198,11 +198,11 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
SNDFILE* myFile; ///< File descriptor
Memory myMemory; ///< Memory reading info
std::size_t myNbSamples; ///< Total number of samples in the file
unsigned int myChannelsCount; ///< Number of channels used by the sound
unsigned int mySampleRate; ///< Number of samples per second
SNDFILE* myFile; ///< File descriptor
Memory myMemory; ///< Memory reading info
std::size_t myNbSamples; ///< Total number of samples in the file
unsigned int myChannelCount; ///< Number of channels used by the sound
unsigned int mySampleRate; ///< Number of samples per second
};
} // namespace priv

View file

@ -42,7 +42,7 @@ namespace sf
SoundStream::SoundStream() :
myThread (&SoundStream::Stream, this),
myIsStreaming (false),
myChannelsCount (0),
myChannelCount (0),
mySampleRate (0),
myFormat (0),
myLoop (false),
@ -61,20 +61,20 @@ SoundStream::~SoundStream()
////////////////////////////////////////////////////////////
void SoundStream::Initialize(unsigned int channelsCount, unsigned int sampleRate)
void SoundStream::Initialize(unsigned int channelCount, unsigned int sampleRate)
{
myChannelsCount = channelsCount;
mySampleRate = sampleRate;
myChannelCount = channelCount;
mySampleRate = sampleRate;
// Deduce the format from the number of channels
myFormat = priv::AudioDevice::GetFormatFromChannelsCount(channelsCount);
myFormat = priv::AudioDevice::GetFormatFromChannelCount(channelCount);
// Check if the format is valid
if (myFormat == 0)
{
myChannelsCount = 0;
mySampleRate = 0;
Err() << "Unsupported number of channels (" << myChannelsCount << ")" << std::endl;
myChannelCount = 0;
mySampleRate = 0;
Err() << "Unsupported number of channels (" << myChannelCount << ")" << std::endl;
}
}
@ -123,9 +123,9 @@ void SoundStream::Stop()
////////////////////////////////////////////////////////////
unsigned int SoundStream::GetChannelsCount() const
unsigned int SoundStream::GetChannelCount() const
{
return myChannelsCount;
return myChannelCount;
}
@ -159,7 +159,7 @@ void SoundStream::SetPlayingOffset(Uint32 timeOffset)
OnSeek(timeOffset);
// Restart streaming
mySamplesProcessed = static_cast<Uint64>(timeOffset) * mySampleRate * myChannelsCount / 1000;
mySamplesProcessed = static_cast<Uint64>(timeOffset) * mySampleRate * myChannelCount / 1000;
myIsStreaming = true;
myThread.Launch();
}
@ -171,7 +171,7 @@ Uint32 SoundStream::GetPlayingOffset() const
ALfloat seconds = 0.f;
ALCheck(alGetSourcef(mySource, AL_SEC_OFFSET, &seconds));
return static_cast<Uint32>(1000 * seconds + 1000 * mySamplesProcessed / mySampleRate / myChannelsCount);
return static_cast<Uint32>(1000 * seconds + 1000 * mySamplesProcessed / mySampleRate / myChannelCount);
}
@ -193,8 +193,8 @@ bool SoundStream::GetLoop() const
void SoundStream::Stream()
{
// Create the buffers
ALCheck(alGenBuffers(BuffersCount, myBuffers));
for (int i = 0; i < BuffersCount; ++i)
ALCheck(alGenBuffers(BufferCount, myBuffers));
for (int i = 0; i < BufferCount; ++i)
myEndBuffers[i] = false;
// Fill the queue
@ -232,7 +232,7 @@ void SoundStream::Stream()
// Find its number
unsigned int bufferNum = 0;
for (int i = 0; i < BuffersCount; ++i)
for (int i = 0; i < BufferCount; ++i)
if (myBuffers[i] == buffer)
{
bufferNum = i;
@ -275,7 +275,7 @@ void SoundStream::Stream()
// Delete the buffers
ALCheck(alSourcei(mySource, AL_BUFFER, 0));
ALCheck(alDeleteBuffers(BuffersCount, myBuffers));
ALCheck(alDeleteBuffers(BufferCount, myBuffers));
}
@ -332,7 +332,7 @@ bool SoundStream::FillQueue()
{
// Fill and enqueue all the available buffers
bool requestStop = false;
for (int i = 0; (i < BuffersCount) && !requestStop; ++i)
for (int i = 0; (i < BufferCount) && !requestStop; ++i)
{
if (FillAndPushBuffer(i))
requestStop = true;

View file

@ -32,9 +32,9 @@
namespace sf
{
////////////////////////////////////////////////////////////
CircleShape::CircleShape(float radius, unsigned int pointsCount) :
myRadius (radius),
myPointsCount(pointsCount)
CircleShape::CircleShape(float radius, unsigned int pointCount) :
myRadius (radius),
myPointCount(pointCount)
{
Update();
}
@ -56,16 +56,16 @@ float CircleShape::GetRadius() const
////////////////////////////////////////////////////////////
void CircleShape::SetPointsCount(unsigned int count)
void CircleShape::SetPointCount(unsigned int count)
{
myPointsCount = count;
myPointCount = count;
Update();
}
////////////////////////////////////////////////////////////
unsigned int CircleShape::GetPointsCount() const
unsigned int CircleShape::GetPointCount() const
{
return myPointsCount;
return myPointCount;
}
@ -74,7 +74,7 @@ Vector2f CircleShape::GetPoint(unsigned int index) const
{
static const float pi = 3.141592654f;
float angle = index * 2 * pi / myPointsCount - pi / 2;
float angle = index * 2 * pi / myPointCount - pi / 2;
float x = std::cos(angle) * myRadius;
float y = std::sin(angle) * myRadius;

View file

@ -31,14 +31,14 @@
namespace sf
{
////////////////////////////////////////////////////////////
ConvexShape::ConvexShape(unsigned int pointsCount)
ConvexShape::ConvexShape(unsigned int pointCount)
{
SetPointsCount(pointsCount);
SetPointCount(pointCount);
}
////////////////////////////////////////////////////////////
void ConvexShape::SetPointsCount(unsigned int count)
void ConvexShape::SetPointCount(unsigned int count)
{
myPoints.resize(count);
Update();
@ -46,7 +46,7 @@ void ConvexShape::SetPointsCount(unsigned int count)
////////////////////////////////////////////////////////////
unsigned int ConvexShape::GetPointsCount() const
unsigned int ConvexShape::GetPointCount() const
{
return myPoints.size();
}

View file

@ -54,7 +54,7 @@ const Vector2f& RectangleShape::GetSize() const
////////////////////////////////////////////////////////////
unsigned int RectangleShape::GetPointsCount() const
unsigned int RectangleShape::GetPointCount() const
{
return 4;
}

View file

@ -127,21 +127,21 @@ void RenderTarget::Draw(const Drawable& drawable, const RenderStates& states)
////////////////////////////////////////////////////////////
void RenderTarget::Draw(const Vertex* vertices, unsigned int verticesCount,
void RenderTarget::Draw(const Vertex* vertices, unsigned int vertexCount,
PrimitiveType type, const RenderStates& states)
{
// Nothing to draw?
if (!vertices || (verticesCount == 0))
if (!vertices || (vertexCount == 0))
return;
if (Activate(true))
{
// Check if the vertex count is low enough so that we can pre-transform them
bool useVertexCache = (verticesCount <= StatesCache::VertexCacheSize);
bool useVertexCache = (vertexCount <= StatesCache::VertexCacheSize);
if (useVertexCache)
{
// Pre-transform the vertices and store them into the vertex cache
for (unsigned int i = 0; i < verticesCount; ++i)
for (unsigned int i = 0; i < vertexCount; ++i)
{
Vertex& vertex = myCache.VertexCache[i];
vertex.Position = states.Transform * vertices[i].Position;
@ -200,7 +200,7 @@ void RenderTarget::Draw(const Vertex* vertices, unsigned int verticesCount,
GLenum mode = modes[type];
// Draw the primitives
GLCheck(glDrawArrays(mode, 0, verticesCount));
GLCheck(glDrawArrays(mode, 0, vertexCount));
// Unbind the shader, if any
if (states.Shader)

View file

@ -169,7 +169,7 @@ myBounds ()
void Shape::Update()
{
// Get the total number of points of the shape
unsigned int count = GetPointsCount();
unsigned int count = GetPointCount();
if (count < 3)
{
myVertices.Resize(0);
@ -227,7 +227,7 @@ void Shape::Draw(RenderTarget& target, RenderStates states) const
////////////////////////////////////////////////////////////
void Shape::UpdateFillColors()
{
for (unsigned int i = 0; i < myVertices.GetVerticesCount(); ++i)
for (unsigned int i = 0; i < myVertices.GetVertexCount(); ++i)
myVertices[i].Color = myFillColor;
}
@ -235,7 +235,7 @@ void Shape::UpdateFillColors()
////////////////////////////////////////////////////////////
void Shape::UpdateTexCoords()
{
for (unsigned int i = 0; i < myVertices.GetVerticesCount(); ++i)
for (unsigned int i = 0; i < myVertices.GetVertexCount(); ++i)
{
float xratio = (myVertices[i].Position.x - myInsideBounds.Left) / myInsideBounds.Width;
float yratio = (myVertices[i].Position.y - myInsideBounds.Top) / myInsideBounds.Height;
@ -248,7 +248,7 @@ void Shape::UpdateTexCoords()
////////////////////////////////////////////////////////////
void Shape::UpdateOutline()
{
unsigned int count = myVertices.GetVerticesCount() - 2;
unsigned int count = myVertices.GetVertexCount() - 2;
myOutlineVertices.Resize((count + 1) * 2);
for (unsigned int i = 0; i < count; ++i)
@ -288,7 +288,7 @@ void Shape::UpdateOutline()
////////////////////////////////////////////////////////////
void Shape::UpdateOutlineColors()
{
for (unsigned int i = 0; i < myOutlineVertices.GetVerticesCount(); ++i)
for (unsigned int i = 0; i < myOutlineVertices.GetVertexCount(); ++i)
myOutlineVertices[i].Color = myOutlineColor;
}

View file

@ -106,7 +106,7 @@ void Text::SetColor(const Color& color)
if (color != myColor)
{
myColor = color;
for (unsigned int i = 0; i < myVertices.GetVerticesCount(); ++i)
for (unsigned int i = 0; i < myVertices.GetVertexCount(); ++i)
myVertices[i].Color = myColor;
}
}

View file

@ -40,15 +40,15 @@ myPrimitiveType(Points)
////////////////////////////////////////////////////////////
VertexArray::VertexArray(PrimitiveType type, unsigned int verticesCount) :
myVertices (verticesCount),
VertexArray::VertexArray(PrimitiveType type, unsigned int vertexCount) :
myVertices (vertexCount),
myPrimitiveType(type)
{
}
////////////////////////////////////////////////////////////
unsigned int VertexArray::GetVerticesCount() const
unsigned int VertexArray::GetVertexCount() const
{
return myVertices.size();
}
@ -76,9 +76,9 @@ void VertexArray::Clear()
////////////////////////////////////////////////////////////
void VertexArray::Resize(unsigned int verticesCount)
void VertexArray::Resize(unsigned int vertexCount)
{
myVertices.resize(verticesCount);
myVertices.resize(vertexCount);
}

View file

@ -290,7 +290,7 @@ void WindowImplWin32::SetIcon(unsigned int width, unsigned int height, const Uin
iconPixels[i * 4 + 3] = pixels[i * 4 + 3];
}
// Create the icon from the pixels array
// Create the icon from the pixel array
myIcon = CreateIcon(GetModuleHandle(NULL), width, height, 1, 32, NULL, &iconPixels[0]);
// Set it as both big and small icon of the window