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:
@@ -109,15 +109,15 @@ bool FillBuffer(_gs_ramp * ramp, float * data, float * buffer, size_t * bytes)
|
|||||||
BFileGameSound::BFileGameSound(const entry_ref *file,
|
BFileGameSound::BFileGameSound(const entry_ref *file,
|
||||||
bool looping,
|
bool looping,
|
||||||
BGameSoundDevice *device)
|
BGameSoundDevice *device)
|
||||||
: BStreamingGameSound(device),
|
: BStreamingGameSound(device),
|
||||||
fAudioStream(NULL),
|
fAudioStream(NULL),
|
||||||
fStopping(false),
|
fStopping(false),
|
||||||
fLooping(looping),
|
fLooping(looping),
|
||||||
fBuffer(NULL),
|
fBuffer(NULL),
|
||||||
fPlayPosition(0),
|
fPlayPosition(0),
|
||||||
fPausing(NULL),
|
fPausing(NULL),
|
||||||
fPaused(false),
|
fPaused(false),
|
||||||
fPauseGain(1.0)
|
fPauseGain(1.0)
|
||||||
{
|
{
|
||||||
if (InitCheck() == B_OK)
|
if (InitCheck() == B_OK)
|
||||||
SetInitError(Init(file));
|
SetInitError(Init(file));
|
||||||
@@ -127,15 +127,15 @@ BFileGameSound::BFileGameSound(const entry_ref *file,
|
|||||||
BFileGameSound::BFileGameSound(const char *file,
|
BFileGameSound::BFileGameSound(const char *file,
|
||||||
bool looping,
|
bool looping,
|
||||||
BGameSoundDevice *device)
|
BGameSoundDevice *device)
|
||||||
: BStreamingGameSound(device),
|
: BStreamingGameSound(device),
|
||||||
fAudioStream(NULL),
|
fAudioStream(NULL),
|
||||||
fStopping(false),
|
fStopping(false),
|
||||||
fLooping(looping),
|
fLooping(looping),
|
||||||
fBuffer(NULL),
|
fBuffer(NULL),
|
||||||
fPlayPosition(0),
|
fPlayPosition(0),
|
||||||
fPausing(NULL),
|
fPausing(NULL),
|
||||||
fPaused(false),
|
fPaused(false),
|
||||||
fPauseGain(1.0)
|
fPauseGain(1.0)
|
||||||
{
|
{
|
||||||
if (InitCheck() == B_OK) {
|
if (InitCheck() == B_OK) {
|
||||||
entry_ref node;
|
entry_ref node;
|
||||||
@@ -239,28 +239,34 @@ BFileGameSound::FillBuffer(void *inBuffer,
|
|||||||
// Fill the requested buffer, stopping if the paused flag is set
|
// Fill the requested buffer, stopping if the paused flag is set
|
||||||
switch(Format().format) {
|
switch(Format().format) {
|
||||||
case gs_audio_format::B_GS_U8:
|
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;
|
break;
|
||||||
|
|
||||||
case gs_audio_format::B_GS_S16:
|
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;
|
break;
|
||||||
|
|
||||||
case gs_audio_format::B_GS_S32:
|
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;
|
break;
|
||||||
|
|
||||||
case gs_audio_format::B_GS_F:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We finished ramping
|
// We finished ramping
|
||||||
if (rampDone) {
|
if (rampDone) {
|
||||||
if (bytes < inByteCount && !fPausing) {
|
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;
|
char * buffer = (char*)inBuffer;
|
||||||
memcpy(&buffer[bytes], &fBuffer[fPlayPosition + bytes], inByteCount - bytes);
|
memcpy(&buffer[bytes], &fBuffer[fPlayPosition + bytes],
|
||||||
|
inByteCount - bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fPausing;
|
delete fPausing;
|
||||||
@@ -308,9 +314,11 @@ BFileGameSound::SetPaused(bool isPaused,
|
|||||||
if (rampTime > 100000) {
|
if (rampTime > 100000) {
|
||||||
// Setup for ramping
|
// Setup for ramping
|
||||||
if (isPaused)
|
if (isPaused)
|
||||||
fPausing = InitRamp(&fPauseGain, 0.0, Format().frame_rate, rampTime);
|
fPausing = InitRamp(&fPauseGain, 0.0,
|
||||||
|
Format().frame_rate, rampTime);
|
||||||
else
|
else
|
||||||
fPausing = InitRamp(&fPauseGain, 1.0, Format().frame_rate, rampTime);
|
fPausing = InitRamp(&fPauseGain, 1.0,
|
||||||
|
Format().frame_rate, rampTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
fPaused = isPaused;
|
fPaused = isPaused;
|
||||||
|
|||||||
Reference in New Issue
Block a user