* uses the full view for the ScopeView

* adjust the VUView range for the INT format
* cleanup


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31876 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2009-07-28 22:51:58 +00:00
parent d936f5e31f
commit 778f56175e
2 changed files with 14 additions and 17 deletions
+8 -9
View File
@@ -68,15 +68,14 @@ ScopeView::Draw(BRect updateRect)
BRect bounds = Bounds(); BRect bounds = Bounds();
SetHighColor(0,0,0); SetHighColor(0,0,0);
if (!fIsRendering) { if (!fIsRendering)
FillRect(BRect(0,0,2,bounds.bottom)); DrawBitmapAsync(fBitmap, BPoint(0, 0));
DrawBitmapAsync(fBitmap, BPoint(2,0)); else
} else
FillRect(bounds); FillRect(bounds);
float x = 2; float x = 0;
if (fTotalTime !=0) if (fTotalTime != 0)
x += (fMainTime - fLeftTime) * (bounds.right - 2) x += (fMainTime - fLeftTime) * bounds.right
/ (fRightTime - fLeftTime); / (fRightTime - fLeftTime);
SetHighColor(60,255,40); SetHighColor(60,255,40);
StrokeLine(BPoint(x, bounds.top), BPoint(x, bounds.bottom)); StrokeLine(BPoint(x, bounds.top), BPoint(x, bounds.bottom));
@@ -235,6 +234,7 @@ ScopeView::SetTotalTime(bigtime_t timestamp, bool reset)
TRACE("invalidate done\n"); TRACE("invalidate done\n");
} }
void void
ScopeView::SetLeftTime(bigtime_t timestamp) ScopeView::SetLeftTime(bigtime_t timestamp)
{ {
@@ -339,7 +339,6 @@ ScopeView::InitBitmap()
memset(fBitmap->Bits(), 0, fBitmap->BitsLength()); memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
rect.OffsetToSelf(B_ORIGIN); rect.OffsetToSelf(B_ORIGIN);
rect.right -= 2;
fBitmapView = new BView(rect.OffsetToSelf(B_ORIGIN), "bitmapView", fBitmapView = new BView(rect.OffsetToSelf(B_ORIGIN), "bitmapView",
B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW); B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW);
fBitmap->AddChild(fBitmapView); fBitmap->AddChild(fBitmapView);
@@ -355,7 +354,7 @@ ScopeView::RenderBitmap()
/* rendering */ /* rendering */
fBitmap->Lock(); fBitmap->Lock();
memset(fBitmap->Bits(), 0, fBitmap->BitsLength()); memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
float width = fBitmapView->Bounds().Width(); float width = fBitmapView->Bounds().Width() + 1;
fBitmapView->SetDrawingMode(B_OP_ADD); fBitmapView->SetDrawingMode(B_OP_ADD);
fBitmapView->SetHighColor(15,60,15); fBitmapView->SetHighColor(15,60,15);
+6 -8
View File
@@ -109,18 +109,16 @@ VUView::_RenderLoop()
{ {
rgb_color levels[fLevelCount][2]; rgb_color levels[fLevelCount][2];
for (int32 i=0; i<fLevelCount; i++) { for (int32 i = 0; i < fLevelCount; i++) {
levels[i][0] = levels[i][1] = back_color; levels[i][0] = levels[i][1] = back_color;
} }
int32 level = 0;
while (!fQuitting) { while (!fQuitting) {
/* computing */ /* computing */
for (int32 channel = 0; channel < 2; channel++) { for (int32 channel = 0; channel < 2; channel++) {
level = fCurrentLevels[channel]; int32 level = fCurrentLevels[channel];
for (int32 i=0; i<level; i++) { for (int32 i = 0; i < level; i++) {
if (levels[i][channel].red >= 90) { if (levels[i][channel].red >= 90) {
SHIFT_UNTIL(levels[i][channel].red, 15, low_color.red); SHIFT_UNTIL(levels[i][channel].red, 15, low_color.red);
SHIFT_UNTIL(levels[i][channel].blue, 15, low_color.blue); SHIFT_UNTIL(levels[i][channel].blue, 15, low_color.blue);
@@ -133,7 +131,7 @@ VUView::_RenderLoop()
levels[level][channel] = high_color; levels[level][channel] = high_color;
for (int32 i=level+1; i<fLevelCount; i++) { for (int32 i = level + 1; i < fLevelCount; i++) {
if (levels[i][channel].red >= 85) { if (levels[i][channel].red >= 85) {
SHIFT_UNTIL(levels[i][channel].red, 15, back_color.red); SHIFT_UNTIL(levels[i][channel].red, 15, back_color.red);
SHIFT_UNTIL(levels[i][channel].blue, 15, back_color.blue); SHIFT_UNTIL(levels[i][channel].blue, 15, back_color.blue);
@@ -154,7 +152,7 @@ VUView::_RenderLoop()
end1.x = 16; end1.x = 16;
end2.x = 35; end2.x = 35;
start1.y = end1.y = start2.y = end2.y = 2; start1.y = end1.y = start2.y = end2.y = 2;
for (int32 i=fLevelCount-1; i>=0; i--) { for (int32 i = fLevelCount - 1; i >= 0; i--) {
fBitmapView->AddLine(start1, end1, levels[i][0]); fBitmapView->AddLine(start1, end1, levels[i][0]);
fBitmapView->AddLine(start2, end2, levels[i][1]); fBitmapView->AddLine(start2, end2, levels[i][1]);
start1.y = end1.y = start2.y = end2.y = end2.y + 2; start1.y = end1.y = start2.y = end2.y = end2.y + 2;
@@ -213,7 +211,7 @@ VUView::ComputeLevels(void* data, size_t size, uint32 format)
{ {
int32 max = _ComputeNextLevel<int32>(data, size, format, int32 max = _ComputeNextLevel<int32>(data, size, format,
channel); channel);
fCurrentLevels[channel] = max / (2 << (32-8)); fCurrentLevels[channel] = max / (2 << (32-7));
break; break;
} }
case media_raw_audio_format::B_AUDIO_SHORT: case media_raw_audio_format::B_AUDIO_SHORT: