made tone effect, doesn't yet work on NULL clips

This commit is contained in:
itsmattkc
2018-09-09 16:36:50 +10:00
parent 779e6b0a24
commit 96802e971a
14 changed files with 141 additions and 41 deletions
+1 -2
View File
@@ -155,8 +155,7 @@ void cache_audio_worker(Clip* c, Clip* nest) {
int lower_byte_index = (c->audio_buffer_write)%audio_ibuffer_size;
qint16 old_sample = static_cast<qint16>((audio_ibuffer[upper_byte_index] & 0xFF) << 8 | (audio_ibuffer[lower_byte_index] & 0xFF));
qint16 new_sample = static_cast<qint16>((frame->data[0][c->frame_sample_index+1] & 0xFF) << 8 | (frame->data[0][c->frame_sample_index] & 0xFF));
qint32 mixed_sample = static_cast<qint32>(old_sample) + static_cast<qint32>(new_sample);
mixed_sample = qMax(qMin(mixed_sample, static_cast<qint32>(INT16_MAX)), static_cast<qint32>(INT16_MIN));
qint16 mixed_sample = mixAudioSample(old_sample, new_sample);
audio_ibuffer[upper_byte_index] = static_cast<quint8>((mixed_sample >> 8) & 0xFF);
audio_ibuffer[lower_byte_index] = static_cast<quint8>(mixed_sample & 0xFF);
+11 -9
View File
@@ -92,16 +92,18 @@ void close_clip(Clip* clip) {
}
void cache_clip(Clip* clip, long playhead, bool write_A, bool write_B, bool reset, Clip* nest) {
if (clip->multithreaded) {
clip->cacher->playhead = playhead;
clip->cacher->write_A = write_A;
clip->cacher->write_B = write_B;
clip->cacher->reset = reset;
clip->cacher->nest = nest;
if (clip->media_type == MEDIA_TYPE_FOOTAGE) {
if (clip->multithreaded) {
clip->cacher->playhead = playhead;
clip->cacher->write_A = write_A;
clip->cacher->write_B = write_B;
clip->cacher->reset = reset;
clip->cacher->nest = nest;
clip->can_cache.wakeAll();
} else {
cache_clip_worker(clip, playhead, write_A, write_B, reset, nest);
clip->can_cache.wakeAll();
} else {
cache_clip_worker(clip, playhead, write_A, write_B, reset, nest);
}
}
}