4 * Copyright (C) 2009 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "commonrender.h"
27 #include "maxchannels.h"
28 #include "meterhistory.h"
29 #include "samples.inc"
31 class ARender : public CommonRender
34 ARender(RenderEngine *renderengine);
38 void allocate_buffers(int samples);
39 // Used by realtime rendering
40 void init_output_buffers();
41 void interrupt_playback();
42 VirtualConsole* new_vconsole_object();
43 int get_total_tracks();
44 Module* new_module(Track *track);
46 // set up and start thread
47 int arm_playback(int64_t current_position,
49 int64_t module_render_fragment,
50 int64_t playback_buffer,
51 int64_t output_length);
52 int wait_for_startup();
55 // renders into buffer_out argument when no audio device
56 // handles playback autos
57 int process_buffer(Samples **buffer_out,
59 int64_t input_position);
60 // renders to a device when there's a device
61 int process_buffer(int64_t input_len, int64_t input_position);
65 void send_last_buffer();
66 int stop_audio(int wait);
68 // Calculate number of samples in each meter fragment and how many
69 // meter fragments to buffer.
71 int calculate_history_size();
73 MeterHistory *meter_history;
74 // samples to use for one meter update. Must be multiple of fragment_len
75 int64_t meter_render_fragment;
77 int64_t tounits(double position, int round);
78 double fromunits(int64_t position);
80 // pointers to output buffers for VirtualConsole
81 Samples *audio_out[MAXCHANNELS];
82 // allocated memory for output
83 Samples *buffer[MAXCHANNELS];
84 // allocated buffer sizes for nested EDL rendering
85 int buffer_allocated[MAXCHANNELS];
86 // Make VirtualAConsole block before the first buffer until video is ready