2021-03-22 Fred Gleason <fredg@paravelsystems.com>

* Implemented movable reference lines for 'Cut Gain' adjustments
	in 'RDMarkerDialog'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-03-22 11:05:19 -04:00
parent 757b97ff99
commit e1d3a756cc
4 changed files with 40 additions and 4 deletions

View File

@@ -21327,3 +21327,6 @@
2021-03-21 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'RDMarkerPlayer' that would cause the play cursor
position to fail to be properly initialized when opening a new cut.
2021-03-22 Fred Gleason <fredg@paravelsystems.com>
* Implemented movable reference lines for 'Cut Gain' adjustments
in 'RDMarkerDialog'.

View File

@@ -569,8 +569,11 @@ void RDMarkerView::setNoSegueFade(bool state)
void RDMarkerView::setPlayGain(int db)
{
d_has_unsaved_changes=db!=d_play_gain;
if(db!=d_play_gain) {
d_play_gain=db;
d_has_unsaved_changes=true;
SetReferenceLines();
}
}
@@ -1100,6 +1103,18 @@ void RDMarkerView::WriteWave()
d_scene->addRect(LEFT_MARGIN+wavemap.width(),0,d_pad_size,d_height-20,QPen(Qt::gray),QBrush(Qt::gray));
d_right_margin=LEFT_MARGIN+wavemap.width();
//
// Reference Level Lines
//
for(unsigned i=0;i<d_channels;i++) {
for(unsigned j=0;j<2;j++) {
d_reference_line_items[i][j]=new QGraphicsLineItem(0,0,d_right_margin,0);
d_reference_line_items[i][j]->setPen(QPen(Qt::red));
d_scene->addItem(d_reference_line_items[i][j]);
}
}
SetReferenceLines();
//
// Markers
//
@@ -1174,3 +1189,17 @@ void RDMarkerView::RemoveMarker(RDMarkerHandle::PointerRole role)
emit pointerValueChanged(role,-1);
}
void RDMarkerView::SetReferenceLines()
{
int sh=d_scene->height();
double ratio=exp10((double)(d_audio_gain-100*d_play_gain)/2000.0);
int ref_line=exp10((double)(-REFERENCE_LEVEL)/2000.00)*sh*ratio/
((double)d_channels*2.0);
for(unsigned i=0;i<d_channels;i++) {
int zero_line=sh/(d_channels*2)+i*sh/(d_channels);
d_reference_line_items[i][0]->setPos(0,zero_line+ref_line);
d_reference_line_items[i][1]->setPos(0,zero_line-ref_line);
}
}

View File

@@ -145,6 +145,7 @@ class RDMarkerView : public QWidget
void DrawMarker(RDMarkerHandle::PointerType type,
RDMarkerHandle::PointerRole role,int handle_pos);
void RemoveMarker(RDMarkerHandle::PointerRole role);
void SetReferenceLines();
QGraphicsView *d_view;
QGraphicsScene *d_scene;
unsigned d_cart_number;
@@ -180,6 +181,7 @@ class RDMarkerView : public QWidget
bool d_marker_menu_used;
RDMarkerHandle::PointerRole d_selected_markers[2];
int d_wheel_angle;
QGraphicsLineItem *d_reference_line_items[2][2];
};

View File

@@ -96,12 +96,13 @@ QPixmap RDWaveFactory::generate(int height,int x_shrink,int gain,
// Waveform
//
p->setPen(Qt::black);
int ref_line=exp10((double)(-REFERENCE_LEVEL)/2000.00)*height*ratio/
((double)d_energy_channels*2.0);
// int ref_line=exp10((double)(-REFERENCE_LEVEL)/2000.00)*height*ratio/
// ((double)d_energy_channels*2.0);
int clip_line=height/(2*d_energy_channels);
for(unsigned i=0;i<d_energy_channels;i++) {
int zero_line=height/(d_energy_channels*2)+i*height/(d_energy_channels);
if(incl_scale) {
/*
if(ref_line<clip_line) {
p->setPen(Qt::red);
p->drawLine(0,zero_line+ref_line,
@@ -110,6 +111,7 @@ QPixmap RDWaveFactory::generate(int height,int x_shrink,int gain,
d_energy.size()/x_shrink,zero_line-ref_line);
p->setPen(Qt::black);
}
*/
}
p->drawLine(0,zero_line,d_energy.size()/x_shrink,zero_line);
for(int j=i;j<d_energy.size();j+=(d_energy_channels*x_shrink)) {