diff options
Diffstat (limited to 'intern/audaspace/FX')
-rw-r--r-- | intern/audaspace/FX/AUD_LoopReader.cpp | 9 | ||||
-rw-r--r-- | intern/audaspace/FX/AUD_LoopReader.h | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/intern/audaspace/FX/AUD_LoopReader.cpp b/intern/audaspace/FX/AUD_LoopReader.cpp index 7d70fc20221..3bcd8c2f9d3 100644 --- a/intern/audaspace/FX/AUD_LoopReader.cpp +++ b/intern/audaspace/FX/AUD_LoopReader.cpp @@ -31,6 +31,7 @@ AUD_LoopReader::AUD_LoopReader(AUD_IReader* reader, int loop) : AUD_EffectReader(reader), m_loop(loop) { + m_samples = -1; m_buffer = new AUD_Buffer(); AUD_NEW("buffer") } @@ -51,6 +52,7 @@ bool AUD_LoopReader::notify(AUD_Message &message) if(message.type == AUD_MSG_LOOP) { m_loop = message.loopcount; + m_samples = message.time * m_reader->getSpecs().rate; m_reader->notify(message); @@ -64,6 +66,13 @@ void AUD_LoopReader::read(int & length, sample_t* & buffer) AUD_Specs specs = m_reader->getSpecs(); int samplesize = AUD_SAMPLE_SIZE(specs); + if(m_samples >= 0) + { + if(length > m_samples) + length = m_samples; + m_samples -= length; + } + int len = length; m_reader->read(len, buffer); diff --git a/intern/audaspace/FX/AUD_LoopReader.h b/intern/audaspace/FX/AUD_LoopReader.h index 621ee3493ab..e61a49cb0db 100644 --- a/intern/audaspace/FX/AUD_LoopReader.h +++ b/intern/audaspace/FX/AUD_LoopReader.h @@ -46,6 +46,11 @@ private: */ int m_loop; + /** + * The left samples. + */ + int m_samples; + public: /** * Creates a new loop reader. |