cleanup, typos
svn-id: r47437
This commit is contained in:
parent
7ab85cd035
commit
a8c8763da5
2 changed files with 13 additions and 13 deletions
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill the given buffer with up to numSamples samples. Returns the actual
|
* Fill the given buffer with up to numSamples samples. Returns the actual
|
||||||
* number of samples read, or -1 if a critical error occured (note: you
|
* number of samples read, or -1 if a critical error occurred (note: you
|
||||||
* *must* check if this value is less than what you requested, this can
|
* *must* check if this value is less than what you requested, this can
|
||||||
* happen when the stream is fully used up).
|
* happen when the stream is fully used up).
|
||||||
*
|
*
|
||||||
|
@ -86,7 +86,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A rewindable audio stream. This allows for restting the AudioStream
|
* A rewindable audio stream. This allows for reseting the AudioStream
|
||||||
* to its initial state. Note that rewinding itself is not required to
|
* to its initial state. Note that rewinding itself is not required to
|
||||||
* be working when the stream is being played by Mixer!
|
* be working when the stream is being played by Mixer!
|
||||||
*/
|
*/
|
||||||
|
@ -101,7 +101,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A looping audio stream. This object does nothing beides using
|
* A looping audio stream. This object does nothing besides using
|
||||||
* a RewindableAudioStream to play a stream in a loop.
|
* a RewindableAudioStream to play a stream in a loop.
|
||||||
*/
|
*/
|
||||||
class LoopingAudioStream : public AudioStream {
|
class LoopingAudioStream : public AudioStream {
|
||||||
|
@ -141,7 +141,7 @@ private:
|
||||||
* Wrapper functionality to efficiently create a stream, which might be looped.
|
* Wrapper functionality to efficiently create a stream, which might be looped.
|
||||||
*
|
*
|
||||||
* Note that this function does not return a LoopingAudioStream, because it does
|
* Note that this function does not return a LoopingAudioStream, because it does
|
||||||
* not create one, when the loop count is "1". This allows to keep the runtime
|
* not create one when the loop count is "1". This allows to keep the runtime
|
||||||
* overhead down, when the code does not require any functionality only offered
|
* overhead down, when the code does not require any functionality only offered
|
||||||
* by LoopingAudioStream.
|
* by LoopingAudioStream.
|
||||||
*
|
*
|
||||||
|
@ -161,7 +161,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Tries to load a file by trying all available formats.
|
* Tries to load a file by trying all available formats.
|
||||||
* In case of an error, the file handle will be closed, but deleting
|
* In case of an error, the file handle will be closed, but deleting
|
||||||
* it is still the responsibilty of the caller.
|
* it is still the responsibility of the caller.
|
||||||
* @param basename a filename without an extension
|
* @param basename a filename without an extension
|
||||||
* @return an SeekableAudioStream ready to use in case of success;
|
* @return an SeekableAudioStream ready to use in case of success;
|
||||||
* NULL in case of an error (e.g. invalid/nonexisting file)
|
* NULL in case of an error (e.g. invalid/nonexisting file)
|
||||||
|
@ -203,7 +203,7 @@ public:
|
||||||
* This automatically starts the stream at time "start"!
|
* This automatically starts the stream at time "start"!
|
||||||
*
|
*
|
||||||
* Note that this function does not return a LoopingAudioStream, because it does
|
* Note that this function does not return a LoopingAudioStream, because it does
|
||||||
* not create one, when the loop count is "1". This allows to keep the runtime
|
* not create one when the loop count is "1". This allows to keep the runtime
|
||||||
* overhead down, when the code does not require any functionality only offered
|
* overhead down, when the code does not require any functionality only offered
|
||||||
* by LoopingAudioStream.
|
* by LoopingAudioStream.
|
||||||
*
|
*
|
||||||
|
@ -211,7 +211,7 @@ public:
|
||||||
* @param start Starttime of the stream interval to be looped
|
* @param start Starttime of the stream interval to be looped
|
||||||
* @param end End of the stream interval to be looped (a zero time, means till end)
|
* @param end End of the stream interval to be looped (a zero time, means till end)
|
||||||
* @param loops How often to loop (0 = infinite)
|
* @param loops How often to loop (0 = infinite)
|
||||||
* @return A new AudioStream, which offers the desired functionallity.
|
* @return A new AudioStream, which offers the desired functionality.
|
||||||
*/
|
*/
|
||||||
AudioStream *makeLoopingAudioStream(SeekableAudioStream *stream, Timestamp start, Timestamp end, uint loops);
|
AudioStream *makeLoopingAudioStream(SeekableAudioStream *stream, Timestamp start, Timestamp end, uint loops);
|
||||||
|
|
||||||
|
@ -251,6 +251,7 @@ private:
|
||||||
bool _done;
|
bool _done;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A SubSeekableAudioStream provides access to a SeekableAudioStream
|
* A SubSeekableAudioStream provides access to a SeekableAudioStream
|
||||||
* just in the range [start, end).
|
* just in the range [start, end).
|
||||||
|
|
|
@ -363,7 +363,7 @@ AudioStream *makeRawMemoryStream(const byte *ptr, uint32 len,
|
||||||
DisposeAfterUse::Flag autoFree,
|
DisposeAfterUse::Flag autoFree,
|
||||||
int rate, byte flags,
|
int rate, byte flags,
|
||||||
uint loopStart, uint loopEnd) {
|
uint loopStart, uint loopEnd) {
|
||||||
SeekableAudioStream *stream = makeRawMemoryStream(ptr, len, autoFree, rate, flags);
|
SeekableAudioStream *s = makeRawMemoryStream(ptr, len, autoFree, rate, flags);
|
||||||
|
|
||||||
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
|
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
|
||||||
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
|
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
|
||||||
|
@ -385,11 +385,11 @@ AudioStream *makeRawMemoryStream(const byte *ptr, uint32 len,
|
||||||
else if (is16Bit || isStereo)
|
else if (is16Bit || isStereo)
|
||||||
assert((loopLen & 1) == 0 && (loopStart & 1) == 0 && (loopEnd & 1) == 0);
|
assert((loopLen & 1) == 0 && (loopStart & 1) == 0 && (loopEnd & 1) == 0);
|
||||||
|
|
||||||
const uint32 extRate = stream->getRate() * (is16Bit ? 2 : 1) * (isStereo ? 2 : 1);
|
const uint32 extRate = s->getRate() * (is16Bit ? 2 : 1) * (isStereo ? 2 : 1);
|
||||||
|
|
||||||
return new SubLoopingAudioStream(stream, 0, Timestamp(0, loopStart, extRate), Timestamp(0, loopEnd, extRate));
|
return new SubLoopingAudioStream(s, 0, Timestamp(0, loopStart, extRate), Timestamp(0, loopEnd, extRate));
|
||||||
} else {
|
} else {
|
||||||
return stream;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,9 +436,9 @@ AudioStream *makeRawDiskStream(Common::SeekableReadStream *stream, RawDiskStream
|
||||||
const bool isLooping = (flags & Audio::FLAG_LOOP) != 0;
|
const bool isLooping = (flags & Audio::FLAG_LOOP) != 0;
|
||||||
|
|
||||||
if (isLooping) {
|
if (isLooping) {
|
||||||
uint loopOffset = 0, loopLen = 0;
|
|
||||||
const uint len = s->getLength().totalNumberOfFrames() / (is16Bit ? 2 : 1) / (isStereo ? 2 : 1);
|
const uint len = s->getLength().totalNumberOfFrames() / (is16Bit ? 2 : 1) / (isStereo ? 2 : 1);
|
||||||
|
|
||||||
|
uint loopOffset = 0, loopLen = 0;
|
||||||
if (loopEnd == 0)
|
if (loopEnd == 0)
|
||||||
loopEnd = len;
|
loopEnd = len;
|
||||||
assert(loopStart <= loopEnd);
|
assert(loopStart <= loopEnd);
|
||||||
|
@ -462,5 +462,4 @@ AudioStream *makeRawDiskStream(Common::SeekableReadStream *stream, RawDiskStream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // End of namespace Audio
|
} // End of namespace Audio
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue