PVS V595: Pointer was utilized before it was verified against nullptr.
Change-Id: Iba8b7e6160dc237f45080fa7c101fa72e4d8c753 Reviewed-on: https://review.haiku-os.org/c/1643 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
3ddf0bbc29
commit
122d4ef7e9
@@ -196,25 +196,29 @@ void DormantNodeView::MouseMoved(
|
|||||||
|
|
||||||
int32 index;
|
int32 index;
|
||||||
if (!message && ((index = IndexOf(point)) >= 0)) {
|
if (!message && ((index = IndexOf(point)) >= 0)) {
|
||||||
DormantNodeListItem *item = dynamic_cast<DormantNodeListItem *>(ItemAt(index));
|
DormantNodeListItem *item =
|
||||||
DormantNodeListItem *last = dynamic_cast<DormantNodeListItem *>(m_lastItemUnder);
|
dynamic_cast<DormantNodeListItem *>(ItemAt(index));
|
||||||
BRect r = item->getRealFrame(be_plain_font);
|
DormantNodeListItem *last =
|
||||||
if (item && r.Contains(point)) {
|
dynamic_cast<DormantNodeListItem *>(m_lastItemUnder);
|
||||||
if (item != last) {
|
if (item != NULL) {
|
||||||
if (last)
|
BRect r = item->getRealFrame(be_plain_font);
|
||||||
last->MouseOver(this, point, B_EXITED_VIEW);
|
if (r.Contains(point)) {
|
||||||
item->MouseOver(this, point, B_ENTERED_VIEW);
|
if (item != last) {
|
||||||
m_lastItemUnder = item;
|
if (last != NULL)
|
||||||
}
|
last->MouseOver(this, point, B_EXITED_VIEW);
|
||||||
else {
|
item->MouseOver(this, point, B_ENTERED_VIEW);
|
||||||
item->MouseOver(this, point, B_INSIDE_VIEW);
|
m_lastItemUnder = item;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item->MouseOver(this, point, B_INSIDE_VIEW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (last) {
|
else if (last != NULL) {
|
||||||
last->MouseOver(this, point, B_EXITED_VIEW);
|
last->MouseOver(this, point, B_EXITED_VIEW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inherited::MouseMoved(point, transit, message);
|
_inherited::MouseMoved(point, transit, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +254,7 @@ void DormantNodeView::_populateList() {
|
|||||||
int32 bufferSize = bufferInc;
|
int32 bufferSize = bufferInc;
|
||||||
dormant_node_info *infoBuffer = new dormant_node_info[bufferSize];
|
dormant_node_info *infoBuffer = new dormant_node_info[bufferSize];
|
||||||
int32 numNodes;
|
int32 numNodes;
|
||||||
|
|
||||||
// fill the buffer
|
// fill the buffer
|
||||||
while (true) {
|
while (true) {
|
||||||
numNodes = bufferSize;
|
numNodes = bufferSize;
|
||||||
@@ -261,13 +265,13 @@ void DormantNodeView::_populateList() {
|
|||||||
if (numNodes < bufferSize) {
|
if (numNodes < bufferSize) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reallocate buffer & try again
|
// reallocate buffer & try again
|
||||||
delete [] infoBuffer;
|
delete [] infoBuffer;
|
||||||
bufferSize += bufferInc;
|
bufferSize += bufferInc;
|
||||||
infoBuffer = new dormant_node_info[bufferSize];
|
infoBuffer = new dormant_node_info[bufferSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
// populate the list
|
// populate the list
|
||||||
for (int32 i = 0; i < numNodes; i++) {
|
for (int32 i = 0; i < numNodes; i++) {
|
||||||
DormantNodeListItem *item = new DormantNodeListItem(infoBuffer[i]);
|
DormantNodeListItem *item = new DormantNodeListItem(infoBuffer[i]);
|
||||||
@@ -298,7 +302,7 @@ void DormantNodeView::_updateList(
|
|||||||
int32 bufferSize = bufferInc;
|
int32 bufferSize = bufferInc;
|
||||||
dormant_node_info *infoBuffer = new dormant_node_info[bufferSize];
|
dormant_node_info *infoBuffer = new dormant_node_info[bufferSize];
|
||||||
int32 numNodes;
|
int32 numNodes;
|
||||||
|
|
||||||
// fill the buffer
|
// fill the buffer
|
||||||
while (true) {
|
while (true) {
|
||||||
numNodes = bufferSize;
|
numNodes = bufferSize;
|
||||||
@@ -309,7 +313,7 @@ void DormantNodeView::_updateList(
|
|||||||
if (numNodes < bufferSize) {
|
if (numNodes < bufferSize) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reallocate buffer & try again
|
// reallocate buffer & try again
|
||||||
delete [] infoBuffer;
|
delete [] infoBuffer;
|
||||||
bufferSize += bufferInc;
|
bufferSize += bufferInc;
|
||||||
|
|||||||
@@ -73,16 +73,20 @@ SavePanel::SavePanel(const char* name,
|
|||||||
|
|
||||||
// add this instance as BHandler to the window's looper
|
// add this instance as BHandler to the window's looper
|
||||||
window->AddHandler(this);
|
window->AddHandler(this);
|
||||||
|
|
||||||
// find a couple of important views and mess with their layout
|
// find a couple of important views and mess with their layout
|
||||||
BView* background = Window()->ChildAt(0);
|
BView* background = Window()->ChildAt(0);
|
||||||
|
if (background == NULL) {
|
||||||
|
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
BButton* cancel = dynamic_cast<BButton*>(
|
BButton* cancel = dynamic_cast<BButton*>(
|
||||||
background->FindView("cancel button"));
|
background->FindView("cancel button"));
|
||||||
BView* textview = background->FindView("text view");
|
BView* textview = background->FindView("text view");
|
||||||
BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(
|
BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(
|
||||||
background->FindView("HScrollBar"));
|
background->FindView("HScrollBar"));
|
||||||
|
|
||||||
if (!background || !cancel || !textview || !hscrollbar) {
|
if (!cancel || !textview || !hscrollbar) {
|
||||||
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
|
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -96,7 +100,7 @@ SavePanel::SavePanel(const char* name,
|
|||||||
rect.bottom = rect.top + fh.ascent + fh.descent + 5.0;
|
rect.bottom = rect.top + fh.ascent + fh.descent + 5.0;
|
||||||
|
|
||||||
fFormatMF = new BMenuField(rect, "format popup", B_TRANSLATE("Format"),
|
fFormatMF = new BMenuField(rect, "format popup", B_TRANSLATE("Format"),
|
||||||
fFormatM, true,
|
fFormatM, true,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
|
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
B_WILL_DRAW | B_NAVIGABLE);
|
||||||
fFormatMF->SetDivider(be_plain_font->StringWidth(
|
fFormatMF->SetDivider(be_plain_font->StringWidth(
|
||||||
@@ -129,7 +133,7 @@ SavePanel::SavePanel(const char* name,
|
|||||||
// Build the "Settings" button relative to the format menu
|
// Build the "Settings" button relative to the format menu
|
||||||
rect = cancel->Frame();
|
rect = cancel->Frame();
|
||||||
rect.OffsetTo(fFormatMF->Frame().right + 5.0, rect.top);
|
rect.OffsetTo(fFormatMF->Frame().right + 5.0, rect.top);
|
||||||
fSettingsB = new BButton(rect, "settings",
|
fSettingsB = new BButton(rect, "settings",
|
||||||
B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
|
B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(MSG_SETTINGS),
|
new BMessage(MSG_SETTINGS),
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
|
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
|
||||||
@@ -324,7 +328,7 @@ SavePanel::AdjustExtension()
|
|||||||
//
|
//
|
||||||
// if (exporter) {
|
// if (exporter) {
|
||||||
// BString name(textview->Text());
|
// BString name(textview->Text());
|
||||||
//
|
//
|
||||||
// // adjust the name extension
|
// // adjust the name extension
|
||||||
// const char* extension = exporter->Extension();
|
// const char* extension = exporter->Extension();
|
||||||
// if (strlen(extension) > 0) {
|
// if (strlen(extension) > 0) {
|
||||||
@@ -335,7 +339,7 @@ SavePanel::AdjustExtension()
|
|||||||
// }
|
// }
|
||||||
// name << "." << extension;
|
// name << "." << extension;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// SetSaveText(name.String());
|
// SetSaveText(name.String());
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@@ -365,7 +369,7 @@ SavePanel::_ExportSettings()
|
|||||||
// BTranslatorRoster *roster = BTranslatorRoster::Default();
|
// BTranslatorRoster *roster = BTranslatorRoster::Default();
|
||||||
// BView *view;
|
// BView *view;
|
||||||
// BRect rect(0, 0, 239, 239);
|
// BRect rect(0, 0, 239, 239);
|
||||||
//
|
//
|
||||||
// // Build a window around this translator's configuration view
|
// // Build a window around this translator's configuration view
|
||||||
// status_t err = roster->MakeConfigurationView(item->id, NULL, &view, &rect);
|
// status_t err = roster->MakeConfigurationView(item->id, NULL, &view, &rect);
|
||||||
// if (err < B_OK || view == NULL) {
|
// if (err < B_OK || view == NULL) {
|
||||||
@@ -397,30 +401,30 @@ SavePanel::_BuildMenu()
|
|||||||
{
|
{
|
||||||
fFormatM = new BPopUpMenu(B_TRANSLATE("Format"));
|
fFormatM = new BPopUpMenu(B_TRANSLATE("Format"));
|
||||||
|
|
||||||
fNativeMI = new SaveItem("Icon-O-Matic",
|
fNativeMI = new SaveItem("Icon-O-Matic",
|
||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_MESSAGE);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_MESSAGE);
|
||||||
fFormatM->AddItem(fNativeMI);
|
fFormatM->AddItem(fNativeMI);
|
||||||
fNativeMI->SetEnabled(false);
|
fNativeMI->SetEnabled(false);
|
||||||
|
|
||||||
fFormatM->AddSeparatorItem();
|
fFormatM->AddSeparatorItem();
|
||||||
|
|
||||||
fHVIFMI = new SaveItem("HVIF",
|
fHVIFMI = new SaveItem("HVIF",
|
||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_FLAT_ICON);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_FLAT_ICON);
|
||||||
fFormatM->AddItem(fHVIFMI);
|
fFormatM->AddItem(fHVIFMI);
|
||||||
|
|
||||||
fRDefMI = new SaveItem("HVIF RDef",
|
fRDefMI = new SaveItem("HVIF RDef",
|
||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_RDEF);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_RDEF);
|
||||||
fFormatM->AddItem(fRDefMI);
|
fFormatM->AddItem(fRDefMI);
|
||||||
|
|
||||||
fSourceMI = new SaveItem(B_TRANSLATE("HVIF Source Code"),
|
fSourceMI = new SaveItem(B_TRANSLATE("HVIF Source Code"),
|
||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_SOURCE);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_SOURCE);
|
||||||
fFormatM->AddItem(fSourceMI);
|
fFormatM->AddItem(fSourceMI);
|
||||||
|
|
||||||
fFormatM->AddSeparatorItem();
|
fFormatM->AddSeparatorItem();
|
||||||
|
|
||||||
fSVGMI = new SaveItem("SVG",
|
fSVGMI = new SaveItem("SVG",
|
||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_SVG);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_SVG);
|
||||||
|
|
||||||
fFormatM->AddItem(fSVGMI);
|
fFormatM->AddItem(fSVGMI);
|
||||||
|
|
||||||
fFormatM->AddSeparatorItem();
|
fFormatM->AddSeparatorItem();
|
||||||
@@ -437,19 +441,19 @@ SavePanel::_BuildMenu()
|
|||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_BITMAP_64);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_BITMAP_64);
|
||||||
fFormatM->AddItem(fBitmap64MI);
|
fFormatM->AddItem(fBitmap64MI);
|
||||||
|
|
||||||
fBitmapSetMI = new SaveItem(B_TRANSLATE("PNG Set"),
|
fBitmapSetMI = new SaveItem(B_TRANSLATE("PNG Set"),
|
||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_BITMAP_SET);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_BITMAP_SET);
|
||||||
fFormatM->AddItem(fBitmapSetMI);
|
fFormatM->AddItem(fBitmapSetMI);
|
||||||
|
|
||||||
fFormatM->AddSeparatorItem();
|
fFormatM->AddSeparatorItem();
|
||||||
|
|
||||||
fIconAttrMI = new SaveItem(B_TRANSLATE("BEOS:ICON Attribute"),
|
fIconAttrMI = new SaveItem(B_TRANSLATE("BEOS:ICON Attribute"),
|
||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_ATTR);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_ATTR);
|
||||||
fFormatM->AddItem(fIconAttrMI);
|
fFormatM->AddItem(fIconAttrMI);
|
||||||
|
|
||||||
fIconMimeAttrMI = new SaveItem(B_TRANSLATE("META:ICON Attribute"),
|
fIconMimeAttrMI = new SaveItem(B_TRANSLATE("META:ICON Attribute"),
|
||||||
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_MIME_ATTR);
|
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_MIME_ATTR);
|
||||||
|
|
||||||
fFormatM->AddItem(fIconMimeAttrMI);
|
fFormatM->AddItem(fIconMimeAttrMI);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ KUndoItem::KUndoItem(const char* redo_text, int32 length, int32 offset,
|
|||||||
|
|
||||||
if (redo_text != NULL) {
|
if (redo_text != NULL) {
|
||||||
RedoText = (char*)malloc(length);
|
RedoText = (char*)malloc(length);
|
||||||
memcpy(RedoText, redo_text, length);
|
|
||||||
if (RedoText != NULL)
|
if (RedoText != NULL) {
|
||||||
|
memcpy(RedoText, redo_text, length);
|
||||||
fStatus = B_OK;
|
fStatus = B_OK;
|
||||||
else
|
} else
|
||||||
fStatus = B_ERROR;
|
fStatus = B_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Copyright 2005, Jérôme Duval. All rights reserved.
|
* Copyright 2005, Jérôme Duval. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Inspired by SoundCapture from Be newsletter (Media Kit Basics:
|
* Inspired by SoundCapture from Be newsletter (Media Kit Basics:
|
||||||
* Consumers and Producers)
|
* Consumers and Producers)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -67,19 +67,19 @@ ScopeView::Draw(BRect updateRect)
|
|||||||
{
|
{
|
||||||
BRect bounds = Bounds();
|
BRect bounds = Bounds();
|
||||||
SetHighColor(0,0,0);
|
SetHighColor(0,0,0);
|
||||||
|
|
||||||
if (!fIsRendering)
|
if (!fIsRendering)
|
||||||
DrawBitmapAsync(fBitmap, BPoint(0, 0));
|
DrawBitmapAsync(fBitmap, BPoint(0, 0));
|
||||||
else
|
else
|
||||||
FillRect(bounds);
|
FillRect(bounds);
|
||||||
|
|
||||||
float x = 0;
|
float x = 0;
|
||||||
if (fTotalTime != 0)
|
if (fTotalTime != 0)
|
||||||
x += (fMainTime - fLeftTime) * bounds.right
|
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));
|
||||||
|
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ void
|
|||||||
ScopeView::Run()
|
ScopeView::Run()
|
||||||
{
|
{
|
||||||
fRenderSem = create_sem(0, "scope rendering");
|
fRenderSem = create_sem(0, "scope rendering");
|
||||||
fThreadId = spawn_thread(&RenderLaunch, "Scope view", B_NORMAL_PRIORITY,
|
fThreadId = spawn_thread(&RenderLaunch, "Scope view", B_NORMAL_PRIORITY,
|
||||||
this);
|
this);
|
||||||
if (fThreadId < 0)
|
if (fThreadId < 0)
|
||||||
return;
|
return;
|
||||||
@@ -121,8 +121,8 @@ ScopeView::ComputeRendering()
|
|||||||
int64 framesCount = fMediaTrack->CountFrames() / SAMPLES_COUNT;
|
int64 framesCount = fMediaTrack->CountFrames() / SAMPLES_COUNT;
|
||||||
if (framesCount <= 0)
|
if (framesCount <= 0)
|
||||||
return;
|
return;
|
||||||
T samples[fPlayFormat.u.raw_audio.buffer_size
|
T samples[fPlayFormat.u.raw_audio.buffer_size
|
||||||
/ (fPlayFormat.u.raw_audio.format
|
/ (fPlayFormat.u.raw_audio.format
|
||||||
& media_raw_audio_format::B_AUDIO_SIZE_MASK)];
|
& media_raw_audio_format::B_AUDIO_SIZE_MASK)];
|
||||||
int64 frames = 0;
|
int64 frames = 0;
|
||||||
U sum = 0;
|
U sum = 0;
|
||||||
@@ -140,19 +140,19 @@ ScopeView::ComputeRendering()
|
|||||||
int64 framesIndex = 0;
|
int64 framesIndex = 0;
|
||||||
|
|
||||||
while (framesIndex < frames) {
|
while (framesIndex < frames) {
|
||||||
for (; framesIndex < frames && sumCount < framesCount;
|
for (; framesIndex < frames && sumCount < framesCount;
|
||||||
framesIndex++, sumCount++) {
|
framesIndex++, sumCount++) {
|
||||||
sum += samples[2 * framesIndex];
|
sum += samples[2 * framesIndex];
|
||||||
sum += samples[2 * framesIndex + 1];
|
sum += samples[2 * framesIndex + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previewIndex >= SAMPLES_COUNT)
|
if (previewIndex >= SAMPLES_COUNT)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (sumCount >= framesCount) {
|
if (sumCount >= framesCount) {
|
||||||
// TRACE("computing block %ld, sumCount %ld\n", previewIndex,
|
// TRACE("computing block %ld, sumCount %ld\n", previewIndex,
|
||||||
// sumCount);
|
// sumCount);
|
||||||
fPreview[previewIndex] = (int32)(sum
|
fPreview[previewIndex] = (int32)(sum
|
||||||
/ fPlayFormat.u.raw_audio.channel_count / framesCount);
|
/ fPlayFormat.u.raw_audio.channel_count / framesCount);
|
||||||
if (previewMax < fPreview[previewIndex])
|
if (previewMax < fPreview[previewIndex])
|
||||||
previewMax = fPreview[previewIndex];
|
previewMax = fPreview[previewIndex];
|
||||||
@@ -162,11 +162,11 @@ ScopeView::ComputeRendering()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previewMax <= 0)
|
if (previewMax <= 0)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < SAMPLES_COUNT; i++)
|
for (int i = 0; i < SAMPLES_COUNT; i++)
|
||||||
fPreview[i] = (int32)(fPreview[i] * 1.0 / previewMax
|
fPreview[i] = (int32)(fPreview[i] * 1.0 / previewMax
|
||||||
* middle + middle);
|
* middle + middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ ScopeView::RenderLoop()
|
|||||||
{
|
{
|
||||||
while (acquire_sem(fRenderSem) == B_OK) {
|
while (acquire_sem(fRenderSem) == B_OK) {
|
||||||
fIsRendering = true;
|
fIsRendering = true;
|
||||||
|
|
||||||
switch (fPlayFormat.u.raw_audio.format) {
|
switch (fPlayFormat.u.raw_audio.format) {
|
||||||
case media_raw_audio_format::B_AUDIO_FLOAT:
|
case media_raw_audio_format::B_AUDIO_FLOAT:
|
||||||
ComputeRendering<float, float>();
|
ComputeRendering<float, float>();
|
||||||
@@ -194,28 +194,28 @@ ScopeView::RenderLoop()
|
|||||||
ComputeRendering<char, int32>();
|
ComputeRendering<char, int32>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("finished computing, rendering\n");
|
TRACE("finished computing, rendering\n");
|
||||||
|
|
||||||
/* rendering */
|
/* rendering */
|
||||||
RenderBitmap();
|
RenderBitmap();
|
||||||
|
|
||||||
TRACE("rendering done\n");
|
TRACE("rendering done\n");
|
||||||
|
|
||||||
/* ask drawing */
|
/* ask drawing */
|
||||||
|
|
||||||
fIsRendering = false;
|
fIsRendering = false;
|
||||||
|
|
||||||
if (Window()->LockWithTimeout(5000) == B_OK) {
|
if (Window()->LockWithTimeout(5000) == B_OK) {
|
||||||
Invalidate();
|
Invalidate();
|
||||||
TRACE("invalidate done\n");
|
TRACE("invalidate done\n");
|
||||||
Window()->Unlock();
|
Window()->Unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScopeView::SetMainTime(bigtime_t timestamp)
|
ScopeView::SetMainTime(bigtime_t timestamp)
|
||||||
{
|
{
|
||||||
fMainTime = timestamp;
|
fMainTime = timestamp;
|
||||||
@@ -224,7 +224,7 @@ ScopeView::SetMainTime(bigtime_t timestamp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScopeView::SetTotalTime(bigtime_t timestamp, bool reset)
|
ScopeView::SetTotalTime(bigtime_t timestamp, bool reset)
|
||||||
{
|
{
|
||||||
fTotalTime = timestamp;
|
fTotalTime = timestamp;
|
||||||
@@ -238,7 +238,7 @@ ScopeView::SetTotalTime(bigtime_t timestamp, bool reset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScopeView::SetLeftTime(bigtime_t timestamp)
|
ScopeView::SetLeftTime(bigtime_t timestamp)
|
||||||
{
|
{
|
||||||
fLeftTime = timestamp;
|
fLeftTime = timestamp;
|
||||||
@@ -247,7 +247,7 @@ ScopeView::SetLeftTime(bigtime_t timestamp)
|
|||||||
TRACE("invalidate done\n");
|
TRACE("invalidate done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ScopeView::SetRightTime(bigtime_t timestamp)
|
ScopeView::SetRightTime(bigtime_t timestamp)
|
||||||
{
|
{
|
||||||
fRightTime = timestamp;
|
fRightTime = timestamp;
|
||||||
@@ -299,10 +299,10 @@ ScopeView::MouseDown(BPoint position)
|
|||||||
drag.AddInt32("be:actions", B_COPY_TARGET);
|
drag.AddInt32("be:actions", B_COPY_TARGET);
|
||||||
drag.AddString("be:clip_name", "Audio Clip");
|
drag.AddString("be:clip_name", "Audio Clip");
|
||||||
drag.AddString("be:types", B_FILE_MIME_TYPE);
|
drag.AddString("be:types", B_FILE_MIME_TYPE);
|
||||||
|
|
||||||
uint8* data;
|
uint8* data;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
BMimeType wavType("audio/x-wav");
|
BMimeType wavType("audio/x-wav");
|
||||||
if (wavType.InitCheck() < B_OK
|
if (wavType.InitCheck() < B_OK
|
||||||
|| wavType.GetIcon(&data, &size) < B_OK) {
|
|| wavType.GetIcon(&data, &size) < B_OK) {
|
||||||
@@ -329,20 +329,20 @@ ScopeView::MouseDown(BPoint position)
|
|||||||
void
|
void
|
||||||
ScopeView::InitBitmap()
|
ScopeView::InitBitmap()
|
||||||
{
|
{
|
||||||
if (fBitmapView) {
|
if (fBitmap != NULL && fBitmapView != NULL) {
|
||||||
fBitmap->RemoveChild(fBitmapView);
|
fBitmap->RemoveChild(fBitmapView);
|
||||||
delete fBitmapView;
|
delete fBitmapView;
|
||||||
}
|
}
|
||||||
if (fBitmap)
|
if (fBitmap)
|
||||||
delete fBitmap;
|
delete fBitmap;
|
||||||
|
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
|
|
||||||
fBitmap = new BBitmap(rect, BScreen().ColorSpace(), true);
|
fBitmap = new BBitmap(rect, BScreen().ColorSpace(), true);
|
||||||
memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
|
memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
|
||||||
|
|
||||||
rect.OffsetToSelf(B_ORIGIN);
|
rect.OffsetToSelf(B_ORIGIN);
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -353,26 +353,26 @@ ScopeView::RenderBitmap()
|
|||||||
{
|
{
|
||||||
if (!fMediaTrack)
|
if (!fMediaTrack)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* rendering */
|
/* rendering */
|
||||||
fBitmap->Lock();
|
fBitmap->Lock();
|
||||||
memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
|
memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
|
||||||
float width = fBitmapView->Bounds().Width() + 1;
|
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);
|
||||||
int32 leftIndex =
|
int32 leftIndex =
|
||||||
(fTotalTime != 0) ? fLeftTime * 20000 / fTotalTime : 0;
|
(fTotalTime != 0) ? fLeftTime * 20000 / fTotalTime : 0;
|
||||||
int32 rightIndex =
|
int32 rightIndex =
|
||||||
(fTotalTime != 0) ? fRightTime * 20000 / fTotalTime : 20000;
|
(fTotalTime != 0) ? fRightTime * 20000 / fTotalTime : 20000;
|
||||||
|
|
||||||
for (int32 i = leftIndex; i<rightIndex; i++) {
|
for (int32 i = leftIndex; i<rightIndex; i++) {
|
||||||
BPoint point((i - leftIndex) * width / (rightIndex - leftIndex),
|
BPoint point((i - leftIndex) * width / (rightIndex - leftIndex),
|
||||||
fPreview[i]);
|
fPreview[i]);
|
||||||
//TRACE("point x %f y %f\n", point.x, point.y);
|
//TRACE("point x %f y %f\n", point.x, point.y);
|
||||||
fBitmapView->StrokeLine(point, point);
|
fBitmapView->StrokeLine(point, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
fBitmap->Unlock();
|
fBitmap->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ void
|
|||||||
play_buffer(void *cookie, void * buffer, size_t size, const media_raw_audio_format & format)
|
play_buffer(void *cookie, void * buffer, size_t size, const media_raw_audio_format & format)
|
||||||
{
|
{
|
||||||
int64 frames = 0;
|
int64 frames = 0;
|
||||||
|
|
||||||
// Use your feeling, Obi-Wan, and find him you will.
|
// Use your feeling, Obi-Wan, and find him you will.
|
||||||
playTrack->ReadFrames(buffer, &frames);
|
playTrack->ReadFrames(buffer, &frames);
|
||||||
|
|
||||||
if (frames <=0) {
|
if (frames <=0) {
|
||||||
player->SetHasData(false);
|
player->SetHasData(false);
|
||||||
release_sem(finished);
|
release_sem(finished);
|
||||||
@@ -70,38 +70,39 @@ int media_play(const char* uri)
|
|||||||
delete playFile;
|
delete playFile;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < playFile->CountTracks(); i++) {
|
for (int i = 0; i < playFile->CountTracks(); i++) {
|
||||||
BMediaTrack* track = playFile->TrackAt(i);
|
BMediaTrack* track = playFile->TrackAt(i);
|
||||||
playFormat.type = B_MEDIA_RAW_AUDIO;
|
if (track != NULL) {
|
||||||
if ((track->DecodedFormat(&playFormat) == B_OK)
|
playFormat.type = B_MEDIA_RAW_AUDIO;
|
||||||
|
if ((track->DecodedFormat(&playFormat) == B_OK)
|
||||||
&& (playFormat.type == B_MEDIA_RAW_AUDIO)) {
|
&& (playFormat.type == B_MEDIA_RAW_AUDIO)) {
|
||||||
playTrack = track;
|
playTrack = track;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (track)
|
|
||||||
playFile->ReleaseTrack(track);
|
playFile->ReleaseTrack(track);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Good relations with the Wookiees, I have.
|
// Good relations with the Wookiees, I have.
|
||||||
signal(SIGINT, keyb_int);
|
signal(SIGINT, keyb_int);
|
||||||
|
|
||||||
finished = create_sem(0, "finish wait");
|
finished = create_sem(0, "finish wait");
|
||||||
|
|
||||||
printf("Playing file...\n");
|
printf("Playing file...\n");
|
||||||
|
|
||||||
// Execute Plan 66!
|
// Execute Plan 66!
|
||||||
player = new BSoundPlayer(&playFormat.u.raw_audio, "playfile", play_buffer);
|
player = new BSoundPlayer(&playFormat.u.raw_audio, "playfile", play_buffer);
|
||||||
player->SetVolume(1.0f);
|
player->SetVolume(1.0f);
|
||||||
|
|
||||||
// Join me, Padmé and together we can rule this galaxy.
|
// Join me, Padmé and together we can rule this galaxy.
|
||||||
player->SetHasData(true);
|
player->SetHasData(true);
|
||||||
player->Start();
|
player->Start();
|
||||||
|
|
||||||
acquire_sem(finished);
|
acquire_sem(finished);
|
||||||
|
|
||||||
if (interrupt == true) {
|
if (interrupt == true) {
|
||||||
// Once more, the Sith will rule the galaxy.
|
// Once more, the Sith will rule the galaxy.
|
||||||
printf("Interrupted\n");
|
printf("Interrupted\n");
|
||||||
player->Stop();
|
player->Stop();
|
||||||
kill_thread(reader);
|
kill_thread(reader);
|
||||||
|
|||||||
@@ -738,7 +738,8 @@ ScreenWindow::_UpdateRefreshControl()
|
|||||||
if (item->Message()->FindFloat("refresh") == fSelected.refresh) {
|
if (item->Message()->FindFloat("refresh") == fSelected.refresh) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
// "Other" items only contains a refresh rate when active
|
// "Other" items only contains a refresh rate when active
|
||||||
fOtherRefresh->SetLabel(B_TRANSLATE("Other" B_UTF8_ELLIPSIS));
|
if (fOtherRefresh != NULL)
|
||||||
|
fOtherRefresh->SetLabel(B_TRANSLATE("Other" B_UTF8_ELLIPSIS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1004,7 +1004,10 @@ TabView::MouseDown(BPoint where)
|
|||||||
BRect fadeTabFrame(TabFrame(0));
|
BRect fadeTabFrame(TabFrame(0));
|
||||||
BTab* modulesTab = TabAt(1);
|
BTab* modulesTab = TabAt(1);
|
||||||
BRect modulesTabFrame(TabFrame(1));
|
BRect modulesTabFrame(TabFrame(1));
|
||||||
ModulesView* modulesView = dynamic_cast<ModulesView*>(modulesTab->View());
|
ModulesView* modulesView = NULL;
|
||||||
|
|
||||||
|
if (modulesTab != NULL)
|
||||||
|
modulesView = dynamic_cast<ModulesView*>(modulesTab->View());
|
||||||
|
|
||||||
if (fadeTab != NULL && Selection() != 0 && fadeTabFrame.Contains(where)
|
if (fadeTab != NULL && Selection() != 0 && fadeTabFrame.Contains(where)
|
||||||
&& modulesView != NULL) {
|
&& modulesView != NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user