AUDIO: Add a NullAudioStream for streams that are dead-on-arrival
This commit is contained in:
parent
331d8ece21
commit
72239a25f9
2 changed files with 27 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
|||
#include "audio/decoders/quicktime.h"
|
||||
#include "audio/decoders/raw.h"
|
||||
#include "audio/decoders/vorbis.h"
|
||||
#include "audio/mixer.h"
|
||||
|
||||
|
||||
namespace Audio {
|
||||
|
@ -465,4 +466,24 @@ AudioStream *makeLimitingAudioStream(AudioStream *parentStream, const Timestamp
|
|||
return new LimitingAudioStream(parentStream, length, disposeAfterUse);
|
||||
}
|
||||
|
||||
/**
|
||||
* An AudioStream that plays nothing and immediately returns that
|
||||
* the endOfStream() has been reached
|
||||
*/
|
||||
class NullAudioStream : public AudioStream {
|
||||
public:
|
||||
bool isStereo() const { return false; }
|
||||
int getRate() const;
|
||||
int readBuffer(int16 *data, const int numSamples) { return 0; }
|
||||
bool endOfData() const { return true; }
|
||||
};
|
||||
|
||||
int NullAudioStream::getRate() const {
|
||||
return g_system->getMixer()->getOutputRate();
|
||||
}
|
||||
|
||||
AudioStream *makeNullAudioStream() {
|
||||
return new NullAudioStream();
|
||||
}
|
||||
|
||||
} // End of namespace Audio
|
||||
|
|
|
@ -433,6 +433,12 @@ private:
|
|||
Common::ScopedPtr<QueuingAudioStream> _stream;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create an AudioStream that plays nothing and immediately returns that
|
||||
* endOfStream() has been reached.
|
||||
*/
|
||||
AudioStream *makeNullAudioStream();
|
||||
|
||||
} // End of namespace Audio
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue