*
*/
+#include "asset.h"
#include "amodule.h"
#include "apluginarray.h"
#include "atrack.h"
void APluginArray::process_realtime(int module, int64_t input_position, int64_t len)
{
- values[module]->process_buffer(realtime_buffers + module,
+ int ibfr = module % file->asset->channels;
+ values[module]->process_buffer(realtime_buffers + ibfr,
input_position,
len,
edl->session->sample_rate,
int APluginArray::process_loop(int module, int64_t &write_length)
{
if(!realtime_buffers) realtime_buffers = file->get_audio_buffer();
- int result = values[module]->process_loop(&realtime_buffers[module],
+ int ibfr = module % file->asset->channels;
+ int result = values[module]->process_loop(&realtime_buffers[ibfr],
write_length);
return result;
}
void Edit::insert_transition(char *title)
{
//printf("Edit::insert_transition this=%p title=%p title=%s\n", this, title, title);
- detach_transition();
- transition = new Transition(edl,
- this,
- title,
+ delete transition;
+ transition = new Transition(edl, this, title,
track->to_units(edl->session->default_transition_length, 1));
}
int Edit::silence()
{
- if(asset || nested_edl)
- return 0;
- else
- return 1;
+ return asset || nested_edl ? 0 : 1;
}
void MWindow::save_backup()
{
FileXML file;
+ edl->optimize();
edl->set_path(session->filename);
- edl->save_xml(&file,
- BACKUP_PATH,
- 0,
- 0);
+ edl->save_xml(&file, BACKUP_PATH, 0, 0);
file.terminate_string();
char path[BCTEXTLEN];
FileSystem fs;
for(int i = 0; i < plugin_set.total; i++)
{
if( !plugin_set.values[i]->last ) continue;
- length = from_units(plugin_set.values[i]->last->startproject);
+ length = from_units(plugin_set.values[i]->last->startproject +
+ plugin_set.values[i]->last->length);
if(length > total_length) total_length = length;
}
{
int64_t edit_x, edit_y, edit_w, edit_h;
edit_dimensions(edit, edit_x, edit_y, edit_w, edit_h);
-
- if( cursor_x >= edit_x && cursor_x < edit_x + edit_w &&
- cursor_y >= edit_y && cursor_y < edit_y + edit_h ) {
+ if( cursor_y < edit_y || cursor_y >= edit_y + edit_h ) continue;
+ if( cursor_x >= edit_x && cursor_x < edit_x + edit_w ) {
*over_edit = edit;
break;
}
if( edit != track->edits->last ) continue;
- if( edit->silence() ) continue;
if( mwindow->session->current_operation != DRAG_ATRANSITION &&
mwindow->session->current_operation != DRAG_VTRANSITION ) continue;
- if( cursor_x >= edit_x + edit_w &&
- cursor_y >= edit_y && cursor_y < edit_y + edit_h ) {
+ if( !edit->silence() ) {
// add silence to allow drag transition past last edit
// will be deleted by Edits::optimize if not used
double length = mwindow->edl->session->default_transition_length;
int64_t start = edit->startproject+edit->length;
int64_t units = track->to_units(length, 1);
track->edits->create_silence(start, start+units);
+ continue;
}
+ if( cursor_x >= edit_x ) { *over_edit = edit; break; }
}
for(int i = 0; i < track->plugin_set.total; i++)
{
current_edit->transition->length =
current_track->to_units(length, 1);
+ if( current_edit == current_track->edits->last &&
+ current_edit->silence() ) {
+ current_edit->length = current_edit->transition->length;
+ }
}
}
}
if(current_edit->transition == transition)
{
transition->length = current_track->to_units(length, 1);
+ if( current_edit == current_track->edits->last &&
+ current_edit->silence() ) {
+ current_edit->length = current_edit->transition->length;
+ }
done = 1;
}
}
{
int64_t start_units = current_track->to_units(start, 0);
int64_t end_units = current_track->to_units(end, 0);
-
- for(Edit *current_edit = current_track->edits->first;
- current_edit;
- current_edit = current_edit->next)
- {
- if(current_edit->startproject > 0 &&
- ((end_units > start_units &&
- current_edit->startproject >= start_units &&
- current_edit->startproject < end_units) ||
- (end_units == start_units &&
- current_edit->startproject <= start_units &&
- current_edit->startproject + current_edit->length > start_units)))
- {
+ if( start_units == end_units ) {
+ for( Edit *current_edit = current_track->edits->first;
+ current_edit; current_edit = current_edit->next) {
+ int64_t edit_start = current_edit->startproject;
+ int64_t edit_end = edit_start + current_edit->length;
+ if( edit_start > start_units ) continue;
+ if( start_units == current_track->edits->length() ) {
+ double length = edl->session->default_transition_length;
+ int64_t units = current_track->to_units(length, 1);
+ current_edit = current_track->edits->
+ create_silence(start_units, start_units+units);
+ }
+ else if( start_units >= edit_end ) continue;
current_edit->insert_transition(title);
}
}
+ else {
+ for( Edit *current_edit = current_track->edits->first;
+ current_edit; current_edit = current_edit->next) {
+ int64_t edit_start = current_edit->startproject;
+ if( !edit_start ) continue;
+ if( edit_start >= start_units && edit_start < end_units ) {
+ current_edit->insert_transition(title);
+ }
+ }
+ }
}
}
}
Edit *current_edit = current->edits->editof(position,
PLAY_FORWARD,
0);
+ if( !current_edit && position == current->edits->length() ) {
+ double length = edl->session->default_transition_length;
+ int64_t units = current->to_units(length, 1);
+ current_edit = current->edits->create_silence(position, position+units);
+ }
if(current_edit)
{
paste_transition(server, current_edit);
Edit *current_edit = current->edits->editof(position,
PLAY_FORWARD,
0);
+ if( !current_edit && position == current->edits->length() ) {
+ double length = edl->session->default_transition_length;
+ int64_t units = current->to_units(length, 1);
+ current_edit = current->edits->create_silence(position, position+units);
+ }
if(current_edit)
{
paste_transition(server, current_edit);
*
*/
+#include "asset.h"
#include "bcsignals.h"
#include "cache.h"
#include "edl.h"
int64_t input_position,
int64_t len)
{
- values[module]->process_buffer(realtime_buffers[module],
+ int ibfr = module % file->asset->layers;
+ values[module]->process_buffer(realtime_buffers[ibfr],
input_position,
edl->session->frame_rate,
end - start,
if(!realtime_buffers) realtime_buffers = file->get_video_buffer();
// Convert from array of frames to array of tracks
- VFrame **temp_buffer;
- temp_buffer = new VFrame*[total_tracks()];
- for(int i = 0; i < total_tracks(); i++)
- {
- temp_buffer[i] = realtime_buffers[i][0];
- }
-
- int result = values[module]->process_loop(realtime_buffers[module], write_length);
- delete [] temp_buffer;
+// VFrame **temp_buffer;
+// temp_buffer = new VFrame*[total_tracks()];
+// for(int i = 0; i < total_tracks(); i++)
+// {
+// temp_buffer[i] = realtime_buffers[i][0];
+// }
+
+ int ibfr = module % file->asset->layers;
+ int result = values[module]->process_loop(realtime_buffers[ibfr], write_length);
+// delete [] temp_buffer;
return result;
}