forked from bartvdbraak/blender
Audio:
* Fix for high quality upsampling which was wrong. * Fix for doppler effects which were calculated wrong for scenes. * Improved animation evaluation at the beginning and end of a scene.
This commit is contained in:
parent
5f62f5c6fe
commit
ab2fc6f106
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -691,7 +691,7 @@ static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
update_animation_flags_exec(C, NULL);
|
||||
|
||||
for(cfra = scene->r.sfra; cfra <= scene->r.efra; cfra++)
|
||||
for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++)
|
||||
{
|
||||
scene->r.cfra = cfra;
|
||||
scene_update_for_newframe(bmain, scene, scene->lay);
|
||||
|
Loading…
Reference in New Issue
Block a user