Пример #1
0
int InterpolateAllEffect::stop_loop()
{
	progress->stop_progress();
	delete progress;
	return 0;
}
Пример #2
0
int PluginArray::run_plugins()
{
// Length to write after process_loop
	int64_t write_length;

	done = 0;     // for when done
	error = 0;
	if(plugin_server->realtime)
	{
		int64_t len;
		MainProgressBar *progress;
		char string[BCTEXTLEN], string2[BCTEXTLEN];

		sprintf(string, _("%s..."), plugin_server->title);
		progress = mwindow->mainprogress->start_progress(string, end - start);

		for(int current_position = start; 
			current_position < end && !done && !error;
			current_position += len)
		{
			len = buffer_size;
			if(current_position + len > end) len = end - current_position;

// Process in plugin.  This pulls data from the modules
			get_buffers();
			for(int i = 0; i < total; i++)
			{
				process_realtime(i, current_position, len);
			}

// Write to file
			error = write_buffers(len);
			done = progress->update(current_position - start + len);
		}

		progress->get_time(string2);
		progress->stop_progress();
		delete progress;

		sprintf(string, _("%s took %s"), plugin_server->title, string2);
		mwindow->gui->lock_window();
		mwindow->gui->show_message(string2);
		mwindow->gui->unlock_window();
	}
	else
	{
// Run main loop once for multichannel plugins.
// Run multiple times for single channel plugins.
// Each write to the file must contain all the channels
		while(!done && !error)
		{
			for(int i = 0; i < total; i++)
			{
				write_length = 0;
				done += process_loop(i, write_length);
			}


			if(write_length)
				error = write_buffers(write_length);
		}
	}

	return error;
}
Пример #3
0
void MainIndexes::run()
{
	while(!done)
	{
// Wait for new assets to be released
		input_lock->lock("MainIndexes::run 1");
		if(done) return;
		interrupt_lock->lock("MainIndexes::run 2");
		load_next_assets();
		interrupt_flag = 0;






// test index of each asset
		MainProgressBar *progress = 0;
		for(int i = 0; i < current_assets.total && !interrupt_flag; i++)
		{
			Asset *current_asset = current_assets.values[i];
//printf("MainIndexes::run 3 %s %d %d\n", current_asset->path, current_asset->index_status, current_asset->audio_data);

			if(current_asset->index_status == INDEX_NOTTESTED && 
				current_asset->audio_data)
			{





// Doesn't exist if this returns 1.
				if(indexfile->open_index(current_asset))
				{
// Try to create index now.
					if(!progress)
					{
						if(mwindow->gui) mwindow->gui->lock_window("MainIndexes::run 1");
						progress = mwindow->mainprogress->start_progress(_("Building Indexes..."), 1);
						if(mwindow->gui) mwindow->gui->unlock_window();
					}

//printf("MainIndexes::run 5 %p %s\n", current_asset, current_asset->path);

					indexfile->create_index(current_asset, progress);
//printf("MainIndexes::run 6 %p %s\n", current_asset, current_asset->path);
					if(progress->is_cancelled()) interrupt_flag = 1;
//printf("MainIndexes::run 7 %p %s\n", current_asset, current_asset->path);
				}
				else
// Exists.  Update real thing.
				{
//printf("MainIndexes::run 8\n");
					if(current_asset->index_status == INDEX_NOTTESTED)
					{
						current_asset->index_status = INDEX_READY;
						if(mwindow->gui) mwindow->gui->lock_window("MainIndexes::run 2");
						mwindow->edl->set_index_file(current_asset);
						if(mwindow->gui) mwindow->gui->unlock_window();
					}
					indexfile->close_index();
				}


//printf("MainIndexes::run 8\n");
			}
//printf("MainIndexes::run 9\n");
		}

		if(progress)     // progress box is only created when an index is built
		{
			if(mwindow->gui) mwindow->gui->lock_window("MainIndexes::run 3");
			progress->stop_progress();
			delete progress;
			if(mwindow->gui) mwindow->gui->unlock_window();
			progress = 0;
		}






		interrupt_lock->unlock();
	}
}