corrected sample rate issue when exporting

This commit is contained in:
itsmattkc
2019-01-02 12:07:15 +11:00
parent 8a5bc58f9f
commit 19765088d9
3 changed files with 520 additions and 513 deletions
+6 -1
View File
@@ -8,6 +8,7 @@
#include "panels/timeline.h"
#include "panels/viewer.h"
#include "ui/audiomonitor.h"
#include "playback/playback.h"
#include "debug.h"
#include <QApplication>
@@ -104,9 +105,13 @@ void clear_audio_ibuffer() {
audio_ibuffer_read = 0;
}
int current_audio_freq() {
return rendering ? sequence->audio_frequency : audio_output->format().sampleRate();
}
int get_buffer_offset_from_frame(double framerate, long frame) {
if (frame >= audio_ibuffer_frame) {
return qFloor(((double) (frame - audio_ibuffer_frame)/framerate)*audio_output->format().sampleRate())*av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)*av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
return qFloor(((double) (frame - audio_ibuffer_frame)/framerate)*current_audio_freq())*av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)*av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
} else {
dout << "[WARNING] Invalid values passed to get_buffer_offset_from_frame";
return 0;
+2
View File
@@ -43,6 +43,8 @@ extern double audio_ibuffer_timecode;
extern bool audio_scrub;
void clear_audio_ibuffer();
int current_audio_freq();
bool is_audio_device_set();
void init_audio();
+512 -512
View File
File diff suppressed because it is too large Load Diff