corrected audio glitch
This commit is contained in:
+7
-6
@@ -79,6 +79,7 @@ const EffectMeta* get_internal_meta(int internal_id) {
|
|||||||
return &video_effects.at(i);
|
return &video_effects.at(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_internal_effects() {
|
void load_internal_effects() {
|
||||||
@@ -781,22 +782,22 @@ GLuint Effect::process_superimpose(double timecode) {
|
|||||||
void Effect::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count) {
|
void Effect::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count) {
|
||||||
// only volume/pan, hand off to AU and VST for all other cases
|
// only volume/pan, hand off to AU and VST for all other cases
|
||||||
|
|
||||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
/*double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||||
|
|
||||||
for (int i=0;i<nb_bytes;i+=2) {
|
for (int i=0;i<nb_bytes;i+=2) {
|
||||||
qint32 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
qint32 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||||
|
|
||||||
/*jsEngine.globalObject().setProperty("sample", samp);
|
jsEngine.globalObject().setProperty("sample", samp);
|
||||||
jsEngine.globalObject().setProperty("volume", row(0)->field(0)->get_double_value(timecode_start+(interval*i), true));
|
jsEngine.globalObject().setProperty("volume", row(0)->field(0)->get_double_value(timecode_start+(interval*i), true));
|
||||||
QJSValue result = eval.call();
|
QJSValue result = eval.call();
|
||||||
samp = result.toInt();*/
|
samp = result.toInt();
|
||||||
/*QJSValueList args;
|
QJSValueList args;
|
||||||
args << samples << nb_bytes;*/
|
args << samples << nb_bytes;
|
||||||
|
|
||||||
|
|
||||||
samples[i+1] = (quint8) (samp >> 8);
|
samples[i+1] = (quint8) (samp >> 8);
|
||||||
samples[i] = (quint8) samp;
|
samples[i] = (quint8) samp;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect::redraw(double timecode) {
|
void Effect::redraw(double timecode) {
|
||||||
|
|||||||
+2
-2
@@ -270,7 +270,7 @@ void cache_audio_worker(Clip* c, Clip* nest) {
|
|||||||
#endif
|
#endif
|
||||||
if (c->audio_buffer_write == 0) c->audio_buffer_write = get_buffer_offset_from_frame(c->sequence, qMax(timeline_in, c->audio_target_frame));
|
if (c->audio_buffer_write == 0) c->audio_buffer_write = get_buffer_offset_from_frame(c->sequence, qMax(timeline_in, c->audio_target_frame));
|
||||||
|
|
||||||
int offset = (audio_ibuffer_read + 2048) - c->audio_buffer_write;
|
int offset = (audio_ibuffer_read + 512) - c->audio_buffer_write;
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
c->audio_buffer_write += offset;
|
c->audio_buffer_write += offset;
|
||||||
c->frame_sample_index += offset;
|
c->frame_sample_index += offset;
|
||||||
@@ -325,7 +325,7 @@ void cache_audio_worker(Clip* c, Clip* nest) {
|
|||||||
long buffer_timeline_out = get_buffer_offset_from_frame(c->sequence, timeline_out);
|
long buffer_timeline_out = get_buffer_offset_from_frame(c->sequence, timeline_out);
|
||||||
audio_write_lock.lock();
|
audio_write_lock.lock();
|
||||||
while (c->frame_sample_index < nb_bytes
|
while (c->frame_sample_index < nb_bytes
|
||||||
&& c->audio_buffer_write < audio_ibuffer_read+audio_ibuffer_size
|
&& c->audio_buffer_write < audio_ibuffer_read+audio_ibuffer_size-512
|
||||||
&& c->audio_buffer_write < buffer_timeline_out) {
|
&& c->audio_buffer_write < buffer_timeline_out) {
|
||||||
int upper_byte_index = (c->audio_buffer_write+1)%audio_ibuffer_size;
|
int upper_byte_index = (c->audio_buffer_write+1)%audio_ibuffer_size;
|
||||||
int lower_byte_index = (c->audio_buffer_write)%audio_ibuffer_size;
|
int lower_byte_index = (c->audio_buffer_write)%audio_ibuffer_size;
|
||||||
|
|||||||
Reference in New Issue
Block a user