whitespace and style cleanup, no functional changes

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28358 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Maurice Kalinowski
2008-10-28 19:54:43 +00:00
parent 58b80f0913
commit 3feea27945
+31 -23
View File
@@ -109,15 +109,15 @@ bool FillBuffer(_gs_ramp * ramp, float * data, float * buffer, size_t * bytes)
BFileGameSound::BFileGameSound(const entry_ref *file,
bool looping,
BGameSoundDevice *device)
: BStreamingGameSound(device),
: BStreamingGameSound(device),
fAudioStream(NULL),
fStopping(false),
fLooping(looping),
fBuffer(NULL),
fPlayPosition(0),
fPausing(NULL),
fPaused(false),
fPauseGain(1.0)
fStopping(false),
fLooping(looping),
fBuffer(NULL),
fPlayPosition(0),
fPausing(NULL),
fPaused(false),
fPauseGain(1.0)
{
if (InitCheck() == B_OK)
SetInitError(Init(file));
@@ -127,15 +127,15 @@ BFileGameSound::BFileGameSound(const entry_ref *file,
BFileGameSound::BFileGameSound(const char *file,
bool looping,
BGameSoundDevice *device)
: BStreamingGameSound(device),
: BStreamingGameSound(device),
fAudioStream(NULL),
fStopping(false),
fLooping(looping),
fStopping(false),
fLooping(looping),
fBuffer(NULL),
fPlayPosition(0),
fPausing(NULL),
fPaused(false),
fPauseGain(1.0)
fPlayPosition(0),
fPausing(NULL),
fPaused(false),
fPauseGain(1.0)
{
if (InitCheck() == B_OK) {
entry_ref node;
@@ -239,28 +239,34 @@ BFileGameSound::FillBuffer(void *inBuffer,
// Fill the requested buffer, stopping if the paused flag is set
switch(Format().format) {
case gs_audio_format::B_GS_U8:
rampDone = ::FillBuffer(fPausing, (uint8*)inBuffer, (uint8*)&fBuffer[fPlayPosition], &bytes);
rampDone = ::FillBuffer(fPausing, (uint8*)inBuffer,
(uint8*)&fBuffer[fPlayPosition], &bytes);
break;
case gs_audio_format::B_GS_S16:
rampDone = ::FillBuffer(fPausing, (int16*)inBuffer, (int16*)&fBuffer[fPlayPosition], &bytes);
rampDone = ::FillBuffer(fPausing, (int16*)inBuffer,
(int16*)&fBuffer[fPlayPosition], &bytes);
break;
case gs_audio_format::B_GS_S32:
rampDone = ::FillBuffer(fPausing, (int32*)inBuffer, (int32*)&fBuffer[fPlayPosition], &bytes);
rampDone = ::FillBuffer(fPausing, (int32*)inBuffer,
(int32*)&fBuffer[fPlayPosition], &bytes);
break;
case gs_audio_format::B_GS_F:
rampDone = ::FillBuffer(fPausing, (float*)inBuffer, (float*)&fBuffer[fPlayPosition], &bytes);
rampDone = ::FillBuffer(fPausing, (float*)inBuffer,
(float*)&fBuffer[fPlayPosition], &bytes);
break;
}
// We finished ramping
if (rampDone) {
if (bytes < inByteCount && !fPausing) {
// Since we are resuming play back, we need to copy any remaining samples
// Since we are resuming play back,
// we need to copy any remaining samples
char * buffer = (char*)inBuffer;
memcpy(&buffer[bytes], &fBuffer[fPlayPosition + bytes], inByteCount - bytes);
memcpy(&buffer[bytes], &fBuffer[fPlayPosition + bytes],
inByteCount - bytes);
}
delete fPausing;
@@ -308,9 +314,11 @@ BFileGameSound::SetPaused(bool isPaused,
if (rampTime > 100000) {
// Setup for ramping
if (isPaused)
fPausing = InitRamp(&fPauseGain, 0.0, Format().frame_rate, rampTime);
fPausing = InitRamp(&fPauseGain, 0.0,
Format().frame_rate, rampTime);
else
fPausing = InitRamp(&fPauseGain, 1.0, Format().frame_rate, rampTime);
fPausing = InitRamp(&fPauseGain, 1.0,
Format().frame_rate, rampTime);
}
fPaused = isPaused;