VSE: Add sound strip retiming support #105072

Merged
Richard Antalik merged 16 commits from iss/blender:retiming-sound-2 into main 2023-04-21 16:53:39 +02:00
5 changed files with 19 additions and 20 deletions
Showing only changes of commit 4793a0e540 - Show all commits

View File

@ -167,8 +167,8 @@ AUD_API void AUD_SequenceEntry_move(AUD_SequenceEntry* entry, double begin, doub
AUD_API void AUD_SequenceEntry_setAnimationData_constant_range(AUD_SequenceEntry* entry, AUD_AnimateablePropertyType type, int frame_start, int frame_end, float* data)
{
AnimateableProperty* prop = (*entry)->getAnimProperty(static_cast<AnimateablePropertyType>(type));
prop->write_range(data, frame_start, frame_end);
AnimateableProperty* prop = (*entry)->getAnimProperty(static_cast<AnimateablePropertyType>(type));
iss marked this conversation as resolved Outdated

Audaspace has its own coding style as you surely noticed, since you're following most of it. Please make sure that indentation happens with tabs everywhere. I just recently introduced a clang-format file in upstream that you can find here: https://github.com/audaspace/audaspace/blob/master/.clang-format. Please only apply it to the changes though, since not all of audaspace is following it perfectly and I wouldn't want to make this patch verbose because of it (see the clang-format-diff script or https://offlinemark.com/2021/04/02/surgical-formatting-with-git-clang-format/ for example).

While we're at it: I would appreciate if you also create a pull request for the audaspace changes upstream (https://github.com/audaspace/audaspace/pulls)!

Audaspace has its own coding style as you surely noticed, since you're following most of it. Please make sure that indentation happens with tabs everywhere. I just recently introduced a clang-format file in upstream that you can find here: https://github.com/audaspace/audaspace/blob/master/.clang-format. Please only apply it to the changes though, since not all of audaspace is following it perfectly and I wouldn't want to make this patch verbose because of it (see the clang-format-diff script or https://offlinemark.com/2021/04/02/surgical-formatting-with-git-clang-format/ for example). While we're at it: I would appreciate if you also create a pull request for the audaspace changes upstream (https://github.com/audaspace/audaspace/pulls)!
prop->write_range(data, frame_start, frame_end);
}
AUD_API void AUD_SequenceEntry_setAnimationData(AUD_SequenceEntry* entry, AUD_AnimateablePropertyType type, int frame, float* data, char animated)

View File

@ -112,13 +112,13 @@ public:
*/
void write(const float* data, int position, int count);
/**
* Fills the properties frame range with constant value and marks it animated.
* \param data The new value.
* \param position_start The start position in the animation in frames.
* \param position_end The end position in the animation in frames.
*/
void write_range(const float* data, int position_start, int position_end);
/**
* Fills the properties frame range with constant value and marks it animated.
* \param data The new value.
* \param position_start The start position in the animation in frames.
* \param position_end The end position in the animation in frames.
*/
void write_range(const float* data, int position_start, int position_end);
iss marked this conversation as resolved Outdated

Please rename write_range similarly to the other API functions that call it, so that its also clear from the name that it writes the same data into the range and doesn't get the full data for the range in the parameters. I.e. it repeats the data found in the parameter rather than expecting a bigger block of data that may differ all the way from start to end.

Please rename `write_range` similarly to the other API functions that call it, so that its also clear from the name that it writes the same data into the range and doesn't get the full data for the range in the parameters. I.e. it repeats the data found in the parameter rather than expecting a bigger block of data that may differ all the way from start to end.

writeConstantRange

`writeConstantRange`
/**
* Reads the properties value.

View File

@ -63,8 +63,8 @@ private:
/// How many seconds are skipped at the beginning.
double m_skip;
/// The FPS of the scene.
float m_fps;
/// The FPS of the scene.
float m_fps;
iss marked this conversation as resolved Outdated

Likely a bug: Rather than having the fps duplicated here, please add a std::shared_ptr<SequenceData> and get the fps from there. This way, it will be updated when Sequence::setFPS is called which happens when the FPS in blender are changed!

Likely a bug: Rather than having the fps duplicated here, please add a `std::shared_ptr<SequenceData>` and get the fps from there. This way, it will be updated when `Sequence::setFPS` is called which happens when the FPS in blender are changed!
/// Whether the entry is muted.
bool m_muted;

View File

@ -67,17 +67,16 @@ void AnimateableProperty::write(const float* data)
void AnimateableProperty::write_range(const float* data, int position_start, int position_end)
{
assureSize(position_end * m_count * sizeof(float), true);
float* buf = getBuffer();
assureSize(position_end * m_count * sizeof(float), true);
float* buf = getBuffer();
for(int i = position_start; i < position_end; i++)
{
std::memcpy(buf + i * m_count, data, m_count * sizeof(float));
}
m_isAnimated = true;
for(int i = position_start; i < position_end; i++)
{
std::memcpy(buf + i * m_count, data, m_count * sizeof(float));
}
m_isAnimated = true;
}
void AnimateableProperty::write(const float* data, int position, int count)
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);

View File

@ -264,7 +264,7 @@ bool SequenceHandle::seek(double position)
}
double seekpos = target_frame / m_entry->m_fps;
m_handle->setPitch(1.0f);
m_handle->seek(seekpos);