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 "samples.inc"
30 class ARender : public CommonRender
33 ARender(RenderEngine *renderengine);
37 void allocate_buffers(int samples);
38 // Used by realtime rendering
39 void init_output_buffers();
40 void interrupt_playback();
41 VirtualConsole* new_vconsole_object();
42 int get_total_tracks();
43 Module* new_module(Track *track);
45 // set up and start thread
46 int arm_playback(int64_t current_position,
48 int64_t module_render_fragment,
49 int64_t playback_buffer,
50 int64_t output_length);
51 int wait_for_startup();
54 // renders into buffer_out argument when no audio device
55 // handles playback autos
56 int process_buffer(Samples **buffer_out,
58 int64_t input_position);
59 // renders to a device when there's a device
60 int process_buffer(int64_t input_len, int64_t input_position);
64 void send_last_buffer();
65 int stop_audio(int wait);
67 // Calculate number of samples in each meter fragment and how many
68 // meter fragments to buffer.
69 int calculate_history_size();
70 // Get subscript of history entry corresponding to sample
71 int get_history_number(int64_t *table, int64_t position);
73 int64_t tounits(double position, int round);
74 double fromunits(int64_t position);
76 // pointers to output buffers for VirtualConsole
77 Samples *audio_out[MAXCHANNELS];
78 // allocated memory for output
79 Samples *buffer[MAXCHANNELS];
80 // allocated buffer sizes for nested EDL rendering
81 int buffer_allocated[MAXCHANNELS];
82 // information for meters
83 int get_next_peak(int current_peak);
85 // samples to use for one meter update. Must be multiple of fragment_len
86 int64_t meter_render_fragment;
87 // Level history of output buffers
88 double *level_history[MAXCHANNELS];
89 // sample position of each level
90 int64_t *level_samples;
91 // total entries in level_history
93 // Next level to store value in
94 int current_level[MAXCHANNELS];
95 // Make VirtualAConsole block before the first buffer until video is ready