From 778f56175e6999e1d34fd007d0e7bf1181f302c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 28 Jul 2009 22:51:58 +0000 Subject: [PATCH] * 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 --- src/apps/soundrecorder/ScopeView.cpp | 17 ++++++++--------- src/apps/soundrecorder/VUView.cpp | 14 ++++++-------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/apps/soundrecorder/ScopeView.cpp b/src/apps/soundrecorder/ScopeView.cpp index fe944b44cf..d7fc7b1235 100644 --- a/src/apps/soundrecorder/ScopeView.cpp +++ b/src/apps/soundrecorder/ScopeView.cpp @@ -68,15 +68,14 @@ ScopeView::Draw(BRect updateRect) BRect bounds = Bounds(); SetHighColor(0,0,0); - if (!fIsRendering) { - FillRect(BRect(0,0,2,bounds.bottom)); - DrawBitmapAsync(fBitmap, BPoint(2,0)); - } else + if (!fIsRendering) + DrawBitmapAsync(fBitmap, BPoint(0, 0)); + else FillRect(bounds); - float x = 2; - if (fTotalTime !=0) - x += (fMainTime - fLeftTime) * (bounds.right - 2) + float x = 0; + if (fTotalTime != 0) + x += (fMainTime - fLeftTime) * bounds.right / (fRightTime - fLeftTime); SetHighColor(60,255,40); StrokeLine(BPoint(x, bounds.top), BPoint(x, bounds.bottom)); @@ -235,6 +234,7 @@ ScopeView::SetTotalTime(bigtime_t timestamp, bool reset) TRACE("invalidate done\n"); } + void ScopeView::SetLeftTime(bigtime_t timestamp) { @@ -339,7 +339,6 @@ ScopeView::InitBitmap() memset(fBitmap->Bits(), 0, fBitmap->BitsLength()); rect.OffsetToSelf(B_ORIGIN); - rect.right -= 2; fBitmapView = new BView(rect.OffsetToSelf(B_ORIGIN), "bitmapView", B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW); fBitmap->AddChild(fBitmapView); @@ -355,7 +354,7 @@ ScopeView::RenderBitmap() /* rendering */ fBitmap->Lock(); memset(fBitmap->Bits(), 0, fBitmap->BitsLength()); - float width = fBitmapView->Bounds().Width(); + float width = fBitmapView->Bounds().Width() + 1; fBitmapView->SetDrawingMode(B_OP_ADD); fBitmapView->SetHighColor(15,60,15); diff --git a/src/apps/soundrecorder/VUView.cpp b/src/apps/soundrecorder/VUView.cpp index d634474386..f84801f911 100644 --- a/src/apps/soundrecorder/VUView.cpp +++ b/src/apps/soundrecorder/VUView.cpp @@ -109,18 +109,16 @@ VUView::_RenderLoop() { rgb_color levels[fLevelCount][2]; - for (int32 i=0; i= 90) { SHIFT_UNTIL(levels[i][channel].red, 15, low_color.red); SHIFT_UNTIL(levels[i][channel].blue, 15, low_color.blue); @@ -133,7 +131,7 @@ VUView::_RenderLoop() levels[level][channel] = high_color; - for (int32 i=level+1; i= 85) { SHIFT_UNTIL(levels[i][channel].red, 15, back_color.red); SHIFT_UNTIL(levels[i][channel].blue, 15, back_color.blue); @@ -154,7 +152,7 @@ VUView::_RenderLoop() end1.x = 16; end2.x = 35; 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(start2, end2, levels[i][1]); 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(data, size, format, channel); - fCurrentLevels[channel] = max / (2 << (32-8)); + fCurrentLevels[channel] = max / (2 << (32-7)); break; } case media_raw_audio_format::B_AUDIO_SHORT: