inout in footage viewer is now functional

This commit is contained in:
itsmattkc
2018-10-19 08:34:34 +11:00
parent be27cccde8
commit da24f0ef6a
3 changed files with 28 additions and 8 deletions
+13 -5
View File
@@ -136,21 +136,29 @@ int AudioSenderThread::send_audio_to_output(int offset, int max) {
int audio_ibuffer_limit = audio_ibuffer_read + actual_write;
// send samples to audio monitor cache
if (sequence != NULL) {
// TODO make this work for the footage viewer
Sequence* s = NULL;
if (panel_footage_viewer->playing) {
s = panel_footage_viewer->seq;
}
if (panel_sequence_viewer->playing) {
s = panel_sequence_viewer->seq;
}
if (s != NULL) {
if (panel_timeline->ui->audio_monitor->sample_cache_offset == -1) {
panel_timeline->ui->audio_monitor->sample_cache_offset = sequence->playhead;
panel_timeline->ui->audio_monitor->sample_cache_offset = s->playhead;
}
int channel_count = av_get_channel_layout_nb_channels(sequence->audio_layout);
int channel_count = av_get_channel_layout_nb_channels(s->audio_layout);
long sample_cache_playhead = panel_timeline->ui->audio_monitor->sample_cache_offset + (panel_timeline->ui->audio_monitor->sample_cache.size()/channel_count);
int next_buffer_offset, buffer_offset_adjusted, i;
int buffer_offset = get_buffer_offset_from_frame(sequence, sample_cache_playhead);
int buffer_offset = get_buffer_offset_from_frame(s, sample_cache_playhead);
if (samples.size() != channel_count) samples.resize(channel_count);
samples.fill(0);
// TODO: I don't like this, but i'm not sure if there's a smarter way to do it
while (buffer_offset < audio_ibuffer_limit) {
sample_cache_playhead++;
next_buffer_offset = qMin(get_buffer_offset_from_frame(sequence, sample_cache_playhead), audio_ibuffer_limit);
next_buffer_offset = qMin(get_buffer_offset_from_frame(s, sample_cache_playhead), audio_ibuffer_limit);
while (buffer_offset < next_buffer_offset) {
for (i=0;i<samples.size();i++) {
buffer_offset_adjusted = buffer_offset%audio_ibuffer_size;