/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
*/
#include "aedit.h"
void VirtualAConsole::get_playable_tracks()
{
if(!playable_tracks)
- playable_tracks = new PlayableTracks(renderengine->get_edl(),
- commonrender->current_position,
+ playable_tracks = new PlayableTracks(renderengine->get_edl(),
+ commonrender->current_position,
renderengine->command->get_direction(),
TRACK_AUDIO,
1);
}
-VirtualNode* VirtualAConsole::new_entry_node(Track *track,
+VirtualNode* VirtualAConsole::new_entry_node(Track *track,
Module *module,
int track_number)
{
{
int result = 0;
const int debug = 0;
-if(debug) printf("VirtualAConsole::process_buffer %d this=%p len=%jd\n",
+if(debug) printf("VirtualAConsole::process_buffer %d this=%p len=%jd\n",
__LINE__, this, len);
// clear output buffers
for(int i = 0; i < MAX_CHANNELS; i++)
{
-// if(debug) printf("VirtualAConsole::process_buffer 2 %d %p %jd\n",
-// i,
+// if(debug) printf("VirtualAConsole::process_buffer 2 %d %p %jd\n",
+// i,
// arender->audio_out[i],
// len);
VirtualANode *node = (VirtualANode*)exit_nodes.values[i];
Track *track = node->track;
- result |= node->render(output_temp,
+ result |= node->render(output_temp,
len,
start_position + track->nudge,
renderengine->get_edl()->session->sample_rate);
else
meter_render_end = len;
- if(meter_render_end > len)
+ if(meter_render_end > len)
meter_render_end = len;
double peak = 0;
-
- for( ; j < meter_render_end; j++)
- {
+ while( j < meter_render_end ) {
// Level history comes before clipping to get over status
- double *sample = ¤t_buffer[j];
-
-
- if(fabs(*sample) > peak) peak = fabs(*sample);
+ double *sample = ¤t_buffer[j++];
+ if( fabs(*sample) > peak ) peak = fabs(*sample);
// Make the output device clip it
// if(*sample > 1) *sample = 1;
// else
// if(*sample < -1) *sample = -1;
}
-
- if(renderengine->command->realtime)
- {
- arender->level_history[i][arender->current_level[i]] = peak;
- arender->level_samples[arender->current_level[i]] =
- renderengine->command->get_direction() == PLAY_REVERSE ?
- start_position - j :
- start_position + j;
- arender->current_level[i] = arender->get_next_peak(arender->current_level[i]);
- }
+ if( renderengine->command->realtime ) {
+ int direction = renderengine->command->get_direction();
+ int64_t pos = direction == PLAY_REVERSE ?
+ start_position - j :
+ start_position + j ;
+ arender->meter_history->set_peak(i, peak, pos);
+ }
}
}
}
// Pack channels, fix speed and send to device.
if(!renderengine->is_nested &&
- renderengine->command->realtime &&
+ renderengine->command->realtime &&
!interrupt)
{
// speed parameters
double *audio_out_packed[MAX_CHANNELS];
int audio_channels = renderengine->get_edl()->session->audio_channels;
- for(int i = 0, j = 0;
- i < audio_channels;
+ for(int i = 0, j = 0;
+ i < audio_channels;
i++)
{
audio_out_packed[j++] = arender->audio_out[i]->get_data();
}
- for(int i = 0;
- i < audio_channels;
+ for(int i = 0;
+ i < audio_channels;
i++)
{
int in, out;
if(renderengine->command->get_speed() < 1)
{
// number of samples to skip
- int interpolate_len = (int)(1.0 / renderengine->command->get_speed());
+ int interpolate_len = (int)(1.0 / renderengine->command->get_speed());
real_output_len = len * interpolate_len;
for(in = len - 1, out = real_output_len - 1; in >= 0; )