cleanup whitespaces

svn-id: r11221
This commit is contained in:
Paweł Kołodziejski 2003-11-08 23:05:04 +00:00
parent 13c7acee9d
commit 1f99fbe77c
7 changed files with 42 additions and 46 deletions

View file

@ -116,7 +116,7 @@ protected:
byte *_bufferEnd;
byte *_pos;
byte *_end;
inline int16 readIntern();
inline bool eosIntern() const { return _end == _pos; };
public:
@ -255,11 +255,11 @@ public:
*/
MP3InputStream::MP3InputStream(File *file, mad_timer_t duration, uint size) {
// duration == 0 means: play everything till end of file
mad_stream_init(&_stream);
mad_frame_init(&_frame);
mad_synth_init(&_synth);
_duration = duration;
_posInFrame = 0;
@ -276,27 +276,26 @@ MP3InputStream::MP3InputStream(File *file, mad_timer_t duration, uint size) {
if (size) {
_file = 0;
}
}
MP3InputStream::~MP3InputStream() {
mad_synth_finish(&_synth);
mad_frame_finish(&_frame);
mad_stream_finish(&_stream);
free(_ptr);
}
bool MP3InputStream::init() {
// TODO
// Read in the first chunk of the MP3 file
_size = _file->read(_ptr, _bufferSize);
if (_size <= 0) {
warning("MP3InputStream: Failed to read MP3 data");
return false;
}
// Feed the data we just read into the stream decoder
mad_stream_buffer(&_stream, _ptr, _size);
@ -305,8 +304,7 @@ bool MP3InputStream::init() {
// Check the header, determine if this is a stereo stream
int num;
switch(_frame.header.mode)
{
switch(_frame.header.mode) {
case MAD_MODE_SINGLE_CHANNEL:
case MAD_MODE_DUAL_CHANNEL:
case MAD_MODE_JOINT_STEREO:
@ -333,7 +331,7 @@ void MP3InputStream::refill(bool first) {
if (!_file)
_size = -1;
// Give up immediately if we are at the EOF already
if (_size <= 0)
return;
@ -347,7 +345,7 @@ void MP3InputStream::refill(bool first) {
}
// Read in more data from the input file
_size = _file->read(_ptr + offset, _bufferSize - offset);
// Nothing read -> EOF -> bail out
if (_size <= 0) {
return;
@ -364,7 +362,7 @@ void MP3InputStream::refill(bool first) {
error("MP3InputStream: Unrecoverable error");
}
}
// Subtract the duration of this frame from the time left to play
mad_timer_t frame_duration = _frame.header.duration;
mad_timer_negate(&frame_duration);
@ -372,7 +370,7 @@ void MP3InputStream::refill(bool first) {
if (!first && _file && mad_timer_compare(_duration, mad_timer_zero) <= 0)
_size = -1; // Mark for EOF
// Synthesise the frame into PCM samples and reset the buffer position
mad_synth_frame(&_synth, &_frame);
_posInFrame = 0;
@ -494,7 +492,7 @@ VorbisInputStream::VorbisInputStream(OggVorbis_File *file, int duration)
_end_pos = ov_pcm_tell(_ov_file) + duration;
else
_end_pos = ov_pcm_total(_ov_file, -1);
// Read in initial data
refill();
}
@ -537,14 +535,14 @@ void VorbisInputStream::refill() {
long result = ov_read(_ov_file, read_pos, len_left,
#ifndef VORBIS_TREMOR
#ifdef SCUMM_BIG_ENDIAN
1,
1,
#else
0,
0,
#endif
2, // 16 bit
1, // signed
2, // 16 bit
1, // signed
#endif
NULL);
NULL);
if (result == OV_HOLE) {
// Possibly recoverable, just warn about it
warning("Corrupted data in Vorbis file");

View file

@ -625,9 +625,9 @@ static int OPLOpenTable(void) {
pom = 20 * log10(1 / pom); /* decibel */
j = int(pom / EG_STEP); /* TL_TABLE steps */
/* degree 0 - 90 , degree 180 - 90 : plus section */
/* degree 0 - 90 , degree 180 - 90 : plus section */
SIN_TABLE[ s] = SIN_TABLE[SIN_ENT / 2 - s] = &TL_TABLE[j];
/* degree 180 - 270 , degree 360 - 270 : minus section */
/* degree 180 - 270 , degree 360 - 270 : minus section */
SIN_TABLE[SIN_ENT / 2 + s] = SIN_TABLE[SIN_ENT - s] = &TL_TABLE[TL_MAX + j];
}
for (s = 0;s < SIN_ENT; s++) {

View file

@ -43,8 +43,7 @@ _autoLoop (false),
_smartJump (false),
_num_tracks (0),
_active_track (255),
_abort_parse (0)
{
_abort_parse (0) {
memset (_active_notes, 0, sizeof(_active_notes));
}

View file

@ -144,7 +144,7 @@ bool MidiParser_XMIDI::loadMusic (byte *data, uint32 size) {
// Read length of
len = read4high (pos);
start = pos;
// XDIRless XMIDI, we can handle them here.
if (!memcmp (pos, "XMID", 4)) {
printf ("Warning: XMIDI doesn't have XDIR\n");
@ -166,11 +166,11 @@ bool MidiParser_XMIDI::loadMusic (byte *data, uint32 size) {
// Read length of chunk
chunk_len = read4high (pos);
// Add eight bytes
i += 8;
if (memcmp (buf, "INFO", 4)) {
if (memcmp (buf, "INFO", 4)) {
// Must align
pos += (chunk_len + 1) & ~1;
i += (chunk_len + 1) & ~1;
@ -182,7 +182,7 @@ bool MidiParser_XMIDI::loadMusic (byte *data, uint32 size) {
printf ("Invalid chunk length %d for 'INFO' block!\n", (int) chunk_len);
return false;
}
_num_tracks = (byte) read2low (pos);
if (chunk_len > 2) {
@ -197,21 +197,21 @@ bool MidiParser_XMIDI::loadMusic (byte *data, uint32 size) {
printf ("Didn't find a valid track count\n");
return false;
}
// Ok now to start part 2
// Goto the right place
pos = start + ((len + 1) & ~1);
if (memcmp (pos, "CAT ", 4)) {
// Not an XMID
printf ("Expected 'CAT ' but found '%c%c%c%c'\n", pos[0], pos[1], pos[2], pos[3]);
return false;
}
pos += 4;
// Now read length of this track
len = read4high (pos);
if (memcmp (pos, "XMID", 4)) {
// Not an XMID
printf ("Expected 'XMID' but found '%c%c%c%c'\n", pos[0], pos[1], pos[2], pos[3]);

View file

@ -199,7 +199,7 @@ void SoundMixer::appendStream(PlayingSoundHandle handle, void *sound, uint32 siz
void SoundMixer::endStream(PlayingSoundHandle handle) {
Common::StackLock lock(_mutex);
// Simply ignore stop requests for handles of sounds that already terminated
if (handle == 0)
return;
@ -331,7 +331,7 @@ void SoundMixer::stopID(int id) {
void SoundMixer::stopHandle(PlayingSoundHandle handle) {
Common::StackLock lock(_mutex);
// Simply ignore stop requests for handles of sounds that already terminated
if (handle == 0)
return;
@ -349,7 +349,7 @@ void SoundMixer::stopHandle(PlayingSoundHandle handle) {
void SoundMixer::setChannelVolume(PlayingSoundHandle handle, byte volume) {
Common::StackLock lock(_mutex);
if (handle == 0)
return;
@ -366,7 +366,7 @@ void SoundMixer::setChannelVolume(PlayingSoundHandle handle, byte volume) {
void SoundMixer::setChannelPan(PlayingSoundHandle handle, int8 pan) {
Common::StackLock lock(_mutex);
if (handle == 0)
return;
@ -537,8 +537,8 @@ ChannelRaw::~ChannelRaw() {
}
ChannelStream::ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle,
void *sound, uint32 size, uint rate,
byte flags, uint32 buffer_size, byte volume, int8 pan)
void *sound, uint32 size, uint rate,
byte flags, uint32 buffer_size, byte volume, int8 pan)
: Channel(mixer, handle) {
_volume = volume;
_pan = pan;

View file

@ -147,19 +147,19 @@ public:
/** Check whether any SFX channel is active.*/
bool hasActiveSFXChannel();
/** set the global volume, 0-256 */
void setVolume(int volume);
/** query the global volume, 0-256 */
int getVolume() const { return _globalVolume; }
/** set the music volume, 0-256 */
void setMusicVolume(int volume);
/** query the music volume, 0-256 */
int getMusicVolume() const { return _musicVolume; }
/** query the output rate in kHz */
uint getOutputRate() const { return _outputRate; }

View file

@ -115,7 +115,7 @@ LinearRateConverter<stereo, reverseStereo>::LinearRateConverter(st_rate_t inrate
ilast[0] = ilast[1] = 0;
icur[0] = icur[1] = 0;
inLen = 0;
}
@ -124,11 +124,10 @@ LinearRateConverter<stereo, reverseStereo>::LinearRateConverter(st_rate_t inrate
* Return number of samples processed.
*/
template<bool stereo, bool reverseStereo>
int LinearRateConverter<stereo, reverseStereo>::flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r)
{
int LinearRateConverter<stereo, reverseStereo>::flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) {
st_sample_t *ostart, *oend;
st_sample_t out[2];
const int numChannels = stereo ? 2 : 1;
int i;