Added missing break(s) in switch block in GameSoundBuffer::GetAttributes(). Added missing default case. Avoid double calculation of buffer size

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27706 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2008-09-23 12:28:18 +00:00
parent 3beb2f72d7
commit 671fe092d3

View File

@ -198,7 +198,7 @@ GameSoundBuffer::GetAttributes(gs_attribute * attributes,
size_t attributeCount)
{
for (size_t i = 0; i < attributeCount; i++) {
switch(attributes[i].attribute) {
switch (attributes[i].attribute) {
case B_GS_GAIN:
attributes[i].value = fGain;
if (fGainRamp)
@ -209,14 +209,17 @@ GameSoundBuffer::GetAttributes(gs_attribute * attributes,
attributes[i].value = fPan;
if (fPanRamp)
attributes[i].duration = fGainRamp->duration;
break;
case B_GS_LOOPING:
attributes[i].value = (fLooping) ? -1.0 : 0.0;
attributes[i].duration = bigtime_t(0);
break;
default:
attributes[i].value = 0.0;
attributes[i].duration = bigtime_t(0);
break;
}
}
@ -242,6 +245,10 @@ GameSoundBuffer::SetAttributes(gs_attribute * attributes,
case B_GS_LOOPING:
fLooping = bool(attributes[i].value);
break;
default:
break;
}
}
@ -465,9 +472,9 @@ SimpleSoundBuffer::SimpleSoundBuffer(const gs_audio_format * format,
fPosition(0)
{
fBuffer = new char[frames * fFrameSize];
fBufferSize = frames * fFrameSize;
fBuffer = new char[fBufferSize];
memcpy(fBuffer, data, fBufferSize);
}