diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/audaspace/intern/AUD_JOSResampleReader.cpp | 11 | ||||
-rw-r--r-- | intern/audaspace/intern/AUD_SequencerHandle.cpp | 4 | ||||
-rw-r--r-- | intern/audaspace/intern/AUD_SequencerHandle.h | 3 | ||||
-rw-r--r-- | intern/audaspace/intern/AUD_SequencerReader.cpp | 4 |
4 files changed, 12 insertions, 10 deletions
diff --git a/intern/audaspace/intern/AUD_JOSResampleReader.cpp b/intern/audaspace/intern/AUD_JOSResampleReader.cpp index 8da3d55acae..82b784a43bf 100644 --- a/intern/audaspace/intern/AUD_JOSResampleReader.cpp +++ b/intern/audaspace/intern/AUD_JOSResampleReader.cpp @@ -118,7 +118,8 @@ void AUD_JOSResampleReader::updateBuffer(int size, double factor, int samplesize {\ sample_t* buf = m_buffer.getBuffer();\ \ - int P, l, end, channel, i;\ + unsigned int P, l;\ + int end, channel, i;\ double eta, v, f_increment, factor;\ \ m_sums.assureSize(m_channels * sizeof(double));\ @@ -222,7 +223,7 @@ void AUD_JOSResampleReader::updateBuffer(int size, double factor, int samplesize \ for(channel = 0; channel < m_channels; channel++)\ {\ - *buffer = f_increment / m_L * sums[channel];\ + *buffer = factor * sums[channel];\ buffer++;\ }\ }\ @@ -230,7 +231,7 @@ void AUD_JOSResampleReader::updateBuffer(int size, double factor, int samplesize m_P += fmod(1.0 / factor, 1.0);\ m_n += floor(1.0 / factor);\ \ - if(m_P >= 1.0)\ + while(m_P >= 1.0)\ {\ m_P -= 1.0;\ m_n++;\ @@ -364,9 +365,9 @@ void AUD_JOSResampleReader::read(int& length, bool& eos, sample_t* buffer) double factor = AUD_MIN(target_factor, m_last_factor); if(factor >= 1) - len = (m_n - m_cache_valid) + int(ceil(length / factor)) + ceil(num_samples); + len = (int(m_n) - m_cache_valid) + int(ceil(length / factor)) + ceil(num_samples); else - len = (m_n - m_cache_valid) + int(ceil(length / factor) + ceil(num_samples / factor)); + len = (int(m_n) - m_cache_valid) + int(ceil(length / factor) + ceil(num_samples / factor)); if(len > 0) { diff --git a/intern/audaspace/intern/AUD_SequencerHandle.cpp b/intern/audaspace/intern/AUD_SequencerHandle.cpp index c9cf46ccdc3..87f5eb29d70 100644 --- a/intern/audaspace/intern/AUD_SequencerHandle.cpp +++ b/intern/audaspace/intern/AUD_SequencerHandle.cpp @@ -66,7 +66,7 @@ void AUD_SequencerHandle::stop() m_handle->stop(); } -void AUD_SequencerHandle::update(float position, float frame) +void AUD_SequencerHandle::update(float position, float frame, float fps) { if(!m_handle.isNull()) { @@ -132,7 +132,7 @@ void AUD_SequencerHandle::update(float position, float frame) m_3dhandle->setSourceLocation(v); m_entry->m_location.read(frame + 1, v2.get()); v2 -= v; - m_3dhandle->setSourceVelocity(v2); + m_3dhandle->setSourceVelocity(v2 * fps); if(m_entry->m_muted) m_handle->setVolume(0); diff --git a/intern/audaspace/intern/AUD_SequencerHandle.h b/intern/audaspace/intern/AUD_SequencerHandle.h index 9703d2b0059..ab86bf49b0f 100644 --- a/intern/audaspace/intern/AUD_SequencerHandle.h +++ b/intern/audaspace/intern/AUD_SequencerHandle.h @@ -94,8 +94,9 @@ public: * Updates the handle for playback. * \param position The current time during playback. * \param frame The current frame during playback. + * \param fps The animation frames per second. */ - void update(float position, float frame); + void update(float position, float frame, float fps); /** * Seeks the handle to a specific time position. diff --git a/intern/audaspace/intern/AUD_SequencerReader.cpp b/intern/audaspace/intern/AUD_SequencerReader.cpp index 0b8a400a97b..c468de19580 100644 --- a/intern/audaspace/intern/AUD_SequencerReader.cpp +++ b/intern/audaspace/intern/AUD_SequencerReader.cpp @@ -162,7 +162,7 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer) for(AUD_HandleIterator it = m_handles.begin(); it != m_handles.end(); it++) { - (*it)->update(time, frame); + (*it)->update(time, frame, m_factory->m_fps); } m_factory->m_volume.read(frame, &volume); @@ -174,7 +174,7 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer) m_device.setListenerLocation(v); m_factory->m_location.read(frame + 1, v2.get()); v2 -= v; - m_device.setListenerVelocity(v2); + m_device.setListenerVelocity(v2 * m_factory->m_fps); m_device.read(reinterpret_cast<data_t*>(buffer + specs.channels * pos), len); |