Media: Use assignment operators instead of memset.

Spotted by GCC 8 -Werror=class-memaccess.
This commit is contained in:
Augustin Cavalier
2019-05-24 14:19:07 -04:00
parent 7a73df5e2c
commit 38b015579f
5 changed files with 144 additions and 144 deletions
@@ -61,12 +61,12 @@ uint32 OpenSoundDevice::convert_oss_format_to_media_format(int fmt)
{ {
if (fmt & AFMT_FLOAT) if (fmt & AFMT_FLOAT)
return media_raw_audio_format::B_AUDIO_FLOAT; return media_raw_audio_format::B_AUDIO_FLOAT;
if (fmt & AFMT_S32_LE || if (fmt & AFMT_S32_LE ||
fmt & AFMT_S24_LE || fmt & AFMT_S24_LE ||
fmt & AFMT_S32_BE || fmt & AFMT_S32_BE ||
fmt & AFMT_S24_BE) fmt & AFMT_S24_BE)
return media_raw_audio_format::B_AUDIO_INT; return media_raw_audio_format::B_AUDIO_INT;
if (fmt & AFMT_S16_LE || if (fmt & AFMT_S16_LE ||
fmt & AFMT_S16_BE) /* U16 unsupported */ fmt & AFMT_S16_BE) /* U16 unsupported */
return media_raw_audio_format::B_AUDIO_SHORT; return media_raw_audio_format::B_AUDIO_SHORT;
if (fmt & AFMT_S8) if (fmt & AFMT_S8)
@@ -81,15 +81,15 @@ int OpenSoundDevice::convert_oss_format_to_endian(int fmt)
{ {
if (fmt & AFMT_FLOAT) if (fmt & AFMT_FLOAT)
return B_MEDIA_HOST_ENDIAN; return B_MEDIA_HOST_ENDIAN;
if (fmt & AFMT_S32_LE || if (fmt & AFMT_S32_LE ||
fmt & AFMT_S24_LE || fmt & AFMT_S24_LE ||
fmt & AFMT_S16_LE || fmt & AFMT_S16_LE ||
fmt & AFMT_U16_LE || fmt & AFMT_U16_LE ||
fmt & AFMT_S24_PACKED) fmt & AFMT_S24_PACKED)
return B_MEDIA_LITTLE_ENDIAN; return B_MEDIA_LITTLE_ENDIAN;
if (fmt & AFMT_S32_BE || if (fmt & AFMT_S32_BE ||
fmt & AFMT_S24_BE || fmt & AFMT_S24_BE ||
fmt & AFMT_S16_BE || fmt & AFMT_S16_BE ||
fmt & AFMT_U16_BE) fmt & AFMT_U16_BE)
return B_MEDIA_BIG_ENDIAN; return B_MEDIA_BIG_ENDIAN;
if (fmt & AFMT_S8 || if (fmt & AFMT_S8 ||
@@ -189,7 +189,7 @@ status_t OpenSoundDevice::get_media_format_description_for(int fmt, media_format
{ {
int i; int i;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
memset(&desc[i], 0, sizeof(media_format_description)); desc[i] = media_format_description();
if (count < 1) if (count < 1)
return 0; return 0;
if (fmt & AFMT_SUPPORTED_PCM) { if (fmt & AFMT_SUPPORTED_PCM) {
@@ -366,13 +366,13 @@ status_t OpenSoundDevice::InitDriver()
CALLED(); CALLED();
PRINT(("OpenSoundDevice::InitDriver: %" B_PRId32 " engines, %" B_PRId32 PRINT(("OpenSoundDevice::InitDriver: %" B_PRId32 " engines, %" B_PRId32
" mixers\n", CountEngines(), CountMixers())); " mixers\n", CountEngines(), CountMixers()));
if (CountMixers()) { if (CountMixers()) {
;//... ;//...
} }
fInitCheckStatus = B_OK; fInitCheckStatus = B_OK;
return B_OK; return B_OK;
} }
@@ -398,7 +398,7 @@ OpenSoundDevice::AddEngine(oss_audioinfo *info)
delete engine; delete engine;
return err; return err;
} }
fEngines.AddItem(engine); fEngines.AddItem(engine);
return B_OK; return B_OK;
} }
@@ -417,7 +417,7 @@ OpenSoundDevice::AddMixer(oss_mixerinfo *info)
delete mixer; delete mixer;
return err; return err;
} }
fMixers.AddItem(mixer); fMixers.AddItem(mixer);
return B_OK; return B_OK;
} }
@@ -345,7 +345,7 @@ OpenSoundNode::OpenSoundNode(BMediaAddOn* addon, const char* name,
// initialize our preferred format object // initialize our preferred format object
// TODO: this should go away! should use engine's preferred for each afmt. // TODO: this should go away! should use engine's preferred for each afmt.
#if 1 #if 1
memset(&fPreferredFormat, 0, sizeof(fPreferredFormat)); fPreferredFormat = media_format();
// set everything to wildcard first // set everything to wildcard first
fPreferredFormat.type = B_MEDIA_RAW_AUDIO; fPreferredFormat.type = B_MEDIA_RAW_AUDIO;
fPreferredFormat.u.raw_audio = media_multi_audio_format::wildcard; fPreferredFormat.u.raw_audio = media_multi_audio_format::wildcard;
+124 -124
View File
@@ -69,7 +69,7 @@ __BEGIN_CORTEX_NAMESPACE
class _GroupInfoView : class _GroupInfoView :
public BView { public BView {
typedef BView _inherited; typedef BView _inherited;
public: // ctor/dtor public: // ctor/dtor
_GroupInfoView( _GroupInfoView(
BRect frame, BRect frame,
@@ -77,12 +77,12 @@ public: // ctor/dtor
const char* name, const char* name,
uint32 resizeMode =B_FOLLOW_LEFT|B_FOLLOW_TOP, uint32 resizeMode =B_FOLLOW_LEFT|B_FOLLOW_TOP,
uint32 flags =B_WILL_DRAW|B_FRAME_EVENTS) : uint32 flags =B_WILL_DRAW|B_FRAME_EVENTS) :
BView(frame, name, resizeMode, flags), BView(frame, name, resizeMode, flags),
m_parent(parent), m_parent(parent),
m_plainFont(be_plain_font), m_plainFont(be_plain_font),
m_boldFont(be_bold_font) { m_boldFont(be_bold_font) {
_initViews(); _initViews();
_initColors(); _initColors();
_updateLayout(); _updateLayout();
@@ -97,25 +97,25 @@ public: // BView
_updateLayout(); _updateLayout();
Invalidate(); Invalidate();
} }
virtual void GetPreferredSize( virtual void GetPreferredSize(
float* width, float* width,
float* height) { float* height) {
font_height fh; font_height fh;
m_plainFont.GetHeight(&fh); m_plainFont.GetHeight(&fh);
*width = 0.0; *width = 0.0;
*height = (fh.ascent+fh.descent+fh.leading) * 2; *height = (fh.ascent+fh.descent+fh.leading) * 2;
*height += 4.0; //+++++ *height += 4.0; //+++++
} }
virtual void Draw( virtual void Draw(
BRect updateRect) { BRect updateRect) {
NodeGroup* g = m_parent->m_group; NodeGroup* g = m_parent->m_group;
BRect b = Bounds(); BRect b = Bounds();
// border // border
rgb_color hi = tint_color(ViewColor(), B_LIGHTEN_2_TINT); rgb_color hi = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
rgb_color lo = tint_color(ViewColor(), B_DARKEN_2_TINT); rgb_color lo = tint_color(ViewColor(), B_DARKEN_2_TINT);
@@ -130,19 +130,19 @@ public: // BView
b.LeftBottom(), b.RightBottom()); b.LeftBottom(), b.RightBottom());
StrokeLine( StrokeLine(
b.RightTop(), b.RightBottom()); b.RightTop(), b.RightBottom());
SetHighColor(255,255,255,255); SetHighColor(255,255,255,255);
// background +++++ // background +++++
// name // name
BString name = g ? g->name() : "(no group)"; BString name = g ? g->name() : "(no group)";
// +++++ constrain width // +++++ constrain width
SetFont(&m_boldFont); SetFont(&m_boldFont);
DrawString(name.String(), m_namePosition); DrawString(name.String(), m_namePosition);
SetFont(&m_plainFont); SetFont(&m_plainFont);
// node count // node count
BString nodeCount; BString nodeCount;
if(g) if(g)
@@ -152,23 +152,23 @@ public: // BView
nodeCount << ((nodeCount == "1") ? " node." : " nodes."); nodeCount << ((nodeCount == "1") ? " node." : " nodes.");
// +++++ constrain width // +++++ constrain width
DrawString(nodeCount.String(), m_nodeCountPosition); DrawString(nodeCount.String(), m_nodeCountPosition);
// status // status
BString status = "No errors."; BString status = "No errors.";
// +++++ constrain width // +++++ constrain width
DrawString(status.String(), m_statusPosition); DrawString(status.String(), m_statusPosition);
} }
virtual void MouseDown( virtual void MouseDown(
BPoint point) { BPoint point) {
NodeGroup* g = m_parent->m_group; NodeGroup* g = m_parent->m_group;
if(!g) if(!g)
return; return;
font_height fh; font_height fh;
m_boldFont.GetHeight(&fh); m_boldFont.GetHeight(&fh);
BRect nameBounds( BRect nameBounds(
m_namePosition.x, m_namePosition.x,
m_namePosition.y - fh.ascent, m_namePosition.y - fh.ascent,
@@ -202,11 +202,11 @@ public: // implementation
void _updateLayout() { void _updateLayout() {
float _edge_pad_x = 3.0; float _edge_pad_x = 3.0;
float _edge_pad_y = 1.0; float _edge_pad_y = 1.0;
BRect b = Bounds(); BRect b = Bounds();
font_height fh; font_height fh;
m_plainFont.GetHeight(&fh); m_plainFont.GetHeight(&fh);
float realWidth = b.Width() - (_edge_pad_x * 2); float realWidth = b.Width() - (_edge_pad_x * 2);
m_maxNameWidth = realWidth * 0.7; m_maxNameWidth = realWidth * 0.7;
@@ -215,7 +215,7 @@ public: // implementation
m_namePosition.y = _edge_pad_x + fh.ascent - 2.0; m_namePosition.y = _edge_pad_x + fh.ascent - 2.0;
m_nodeCountPosition = m_namePosition; m_nodeCountPosition = m_namePosition;
m_nodeCountPosition.x = m_maxNameWidth; m_nodeCountPosition.x = m_maxNameWidth;
m_maxStatusWidth = realWidth; m_maxStatusWidth = realWidth;
m_statusPosition.x = _edge_pad_x; m_statusPosition.x = _edge_pad_x;
m_statusPosition.y = b.Height() - (fh.descent + fh.leading + _edge_pad_y); m_statusPosition.y = b.Height() - (fh.descent + fh.leading + _edge_pad_y);
@@ -223,16 +223,16 @@ public: // implementation
private: private:
TransportView* m_parent; TransportView* m_parent;
BFont m_plainFont; BFont m_plainFont;
BFont m_boldFont; BFont m_boldFont;
BPoint m_namePosition; BPoint m_namePosition;
float m_maxNameWidth; float m_maxNameWidth;
BPoint m_nodeCountPosition; BPoint m_nodeCountPosition;
float m_maxNodeCountWidth; float m_maxNodeCountWidth;
BPoint m_statusPosition; BPoint m_statusPosition;
float m_maxStatusWidth; float m_maxStatusWidth;
}; };
@@ -241,11 +241,11 @@ __END_CORTEX_NAMESPACE
// -------------------------------------------------------- // // -------------------------------------------------------- //
// *** ctors // *** ctors
// -------------------------------------------------------- // // -------------------------------------------------------- //
TransportView::TransportView( TransportView::TransportView(
NodeManager* manager, NodeManager* manager,
const char* name) : const char* name) :
BView( BView(
BRect(), BRect(),
name, name,
@@ -259,7 +259,7 @@ TransportView::TransportView(
_constructControls(); _constructControls();
// _updateLayout(); deferred until AttachedToWindow(): 24aug99 // _updateLayout(); deferred until AttachedToWindow(): 24aug99
_disableControls(); _disableControls();
SetViewColor( SetViewColor(
tint_color( tint_color(
ui_color(B_PANEL_BACKGROUND_COLOR), ui_color(B_PANEL_BACKGROUND_COLOR),
@@ -272,10 +272,10 @@ TransportView::TransportView(
void TransportView::AttachedToWindow() { void TransportView::AttachedToWindow() {
_inherited::AttachedToWindow(); _inherited::AttachedToWindow();
// finish layout // finish layout
_updateLayout(); _updateLayout();
// watch the node manager (for time-source create/delete notification) // watch the node manager (for time-source create/delete notification)
RouteApp* app = dynamic_cast<RouteApp*>(be_app); RouteApp* app = dynamic_cast<RouteApp*>(be_app);
ASSERT(app); ASSERT(app);
@@ -284,7 +284,7 @@ void TransportView::AttachedToWindow() {
void TransportView::AllAttached() { void TransportView::AllAttached() {
_inherited::AllAttached(); _inherited::AllAttached();
// set message targets for view-configuation controls // set message targets for view-configuation controls
for(target_set::iterator it = m_localTargets.begin(); for(target_set::iterator it = m_localTargets.begin();
it != m_localTargets.end(); ++it) { it != m_localTargets.end(); ++it) {
@@ -295,7 +295,7 @@ void TransportView::AllAttached() {
void TransportView::DetachedFromWindow() { void TransportView::DetachedFromWindow() {
_inherited::DetachedFromWindow(); _inherited::DetachedFromWindow();
RouteApp* app = dynamic_cast<RouteApp*>(be_app); RouteApp* app = dynamic_cast<RouteApp*>(be_app);
ASSERT(app); ASSERT(app);
remove_observer(this, app->manager); remove_observer(this, app->manager);
@@ -324,13 +324,13 @@ void TransportView::KeyDown(
default: default:
_inherited::KeyDown(bytes, count); _inherited::KeyDown(bytes, count);
} }
} }
void TransportView::MouseDown( void TransportView::MouseDown(
BPoint where) { BPoint where) {
MakeFocus(true); MakeFocus(true);
} }
@@ -343,11 +343,11 @@ void TransportView::MessageReceived(
BMessage* message) { BMessage* message) {
status_t err; status_t err;
uint32 groupID; uint32 groupID;
// PRINT(( // PRINT((
// "TransportView::MessageReceived()\n")); // "TransportView::MessageReceived()\n"));
// message->PrintToStream(); // message->PrintToStream();
switch(message->what) { switch(message->what) {
case NodeGroup::M_RELEASED: case NodeGroup::M_RELEASED:
@@ -364,15 +364,15 @@ void TransportView::MessageReceived(
" mismatched groupID.\n")); " mismatched groupID.\n"));
break; break;
} }
_releaseGroup(); _releaseGroup();
// //
// BMessage m(M_REMOVE_OBSERVER); // BMessage m(M_REMOVE_OBSERVER);
// m.AddMessenger("observer", BMessenger(this)); // m.AddMessenger("observer", BMessenger(this));
// message->SendReply(&m); // message->SendReply(&m);
} }
break; break;
case NodeGroup::M_OBSERVER_ADDED: case NodeGroup::M_OBSERVER_ADDED:
err = message->FindInt32("groupID", (int32*)&groupID); err = message->FindInt32("groupID", (int32*)&groupID);
if(err < B_OK) { if(err < B_OK) {
@@ -387,10 +387,10 @@ void TransportView::MessageReceived(
" mismatched groupID; ignoring.\n")); " mismatched groupID; ignoring.\n"));
break; break;
} }
_enableControls(); _enableControls();
break; break;
case NodeGroup::M_TRANSPORT_STATE_CHANGED: case NodeGroup::M_TRANSPORT_STATE_CHANGED:
uint32 groupID; uint32 groupID;
err = message->FindInt32("groupID", (int32*)&groupID); err = message->FindInt32("groupID", (int32*)&groupID);
@@ -406,20 +406,20 @@ void TransportView::MessageReceived(
" mismatched groupID; ignoring.\n")); " mismatched groupID; ignoring.\n"));
break; break;
} }
_updateTransportButtons(); _updateTransportButtons();
break; break;
case NodeGroup::M_TIME_SOURCE_CHANGED: case NodeGroup::M_TIME_SOURCE_CHANGED:
//_updateTimeSource(); +++++ check group? //_updateTimeSource(); +++++ check group?
break; break;
case NodeGroup::M_RUN_MODE_CHANGED: case NodeGroup::M_RUN_MODE_CHANGED:
//_updateRunMode(); +++++ check group? //_updateRunMode(); +++++ check group?
break; break;
// * CONTROL PROCESSING // * CONTROL PROCESSING
case NodeGroup::M_SET_START_POSITION: { case NodeGroup::M_SET_START_POSITION: {
if(!m_group) if(!m_group)
@@ -429,7 +429,7 @@ void TransportView::MessageReceived(
m_regionStartView->value()); m_regionStartView->value());
message->AddInt64("position", position); message->AddInt64("position", position);
BMessenger(m_group).SendMessage(message); BMessenger(m_group).SendMessage(message);
// update start-button duty/label [e.moon 11oct99] // update start-button duty/label [e.moon 11oct99]
if(m_group->transportState() == NodeGroup::TRANSPORT_STOPPED) if(m_group->transportState() == NodeGroup::TRANSPORT_STOPPED)
_updateTransportButtons(); _updateTransportButtons();
@@ -453,7 +453,7 @@ void TransportView::MessageReceived(
break; break;
} }
case M_SET_NAME: case M_SET_NAME:
{ {
const char* name; const char* name;
@@ -469,7 +469,7 @@ void TransportView::MessageReceived(
} }
} }
break; break;
case RouteAppNodeManager::M_TIME_SOURCE_CREATED: case RouteAppNodeManager::M_TIME_SOURCE_CREATED:
_timeSourceCreated(message); _timeSourceCreated(message);
break; break;
@@ -498,12 +498,12 @@ void TransportView::_handleSelectGroup(
"* TransportView::_handleSelectGroup(): no groupID\n")); "* TransportView::_handleSelectGroup(): no groupID\n"));
return; return;
} }
if(m_group && groupID != m_group->id()) if(m_group && groupID != m_group->id())
_releaseGroup(); _releaseGroup();
_selectGroup(groupID); _selectGroup(groupID);
Invalidate(); Invalidate();
} }
@@ -516,7 +516,7 @@ void TransportView::_handleSelectGroup(
void TransportView::_selectGroup( void TransportView::_selectGroup(
uint32 groupID) { uint32 groupID) {
status_t err; status_t err;
if(m_group) if(m_group)
_releaseGroup(); _releaseGroup();
@@ -534,19 +534,19 @@ void TransportView::_selectGroup(
strerror(err))); strerror(err)));
return; return;
} }
_observeGroup(); _observeGroup();
} }
void TransportView::_observeGroup() { void TransportView::_observeGroup() {
ASSERT(m_group); ASSERT(m_group);
add_observer(this, m_group); add_observer(this, m_group);
} }
void TransportView::_releaseGroup() { void TransportView::_releaseGroup() {
ASSERT(m_group); ASSERT(m_group);
remove_observer(this, m_group); remove_observer(this, m_group);
m_group = 0; m_group = 0;
} }
@@ -591,7 +591,7 @@ void TransportView::_constructControls() {
this, this,
"infoView"); "infoView");
AddChild(m_infoView); AddChild(m_infoView);
m_runModeView = new BMenuField( m_runModeView = new BMenuField(
BRect(), BRect(),
"runModeView", "runModeView",
@@ -613,8 +613,8 @@ void TransportView::_constructControls() {
m_fromLabel = new BStringView(BRect(), 0, "Roll from"); m_fromLabel = new BStringView(BRect(), 0, "Roll from");
AddChild(m_fromLabel); AddChild(m_fromLabel);
m = new BMessage(NodeGroup::M_SET_START_POSITION); m = new BMessage(NodeGroup::M_SET_START_POSITION);
m_regionStartView = new NumericValControl( m_regionStartView = new NumericValControl(
BRect(), BRect(),
@@ -622,15 +622,15 @@ void TransportView::_constructControls() {
m, m,
2, 4, // * DIGITS 2, 4, // * DIGITS
false, ValControl::ALIGN_FLUSH_LEFT); false, ValControl::ALIGN_FLUSH_LEFT);
// redirect view back to self. this gives me the chance to // redirect view back to self. this gives me the chance to
// augment the message with the position before sending // augment the message with the position before sending
_addLocalTarget(m_regionStartView); _addLocalTarget(m_regionStartView);
AddChild(m_regionStartView); AddChild(m_regionStartView);
m_toLabel = new BStringView(BRect(), 0, "to"); m_toLabel = new BStringView(BRect(), 0, "to");
AddChild(m_toLabel); AddChild(m_toLabel);
m = new BMessage(NodeGroup::M_SET_END_POSITION); m = new BMessage(NodeGroup::M_SET_END_POSITION);
m_regionEndView = new NumericValControl( m_regionEndView = new NumericValControl(
BRect(), BRect(),
@@ -638,9 +638,9 @@ void TransportView::_constructControls() {
m, m,
2, 4, // * DIGITS 2, 4, // * DIGITS
false, ValControl::ALIGN_FLUSH_LEFT); false, ValControl::ALIGN_FLUSH_LEFT);
// redirect view back to self. this gives me the chance to // redirect view back to self. this gives me the chance to
// augment the message with the position before sending // augment the message with the position before sending
_addLocalTarget(m_regionEndView); _addLocalTarget(m_regionEndView);
AddChild(m_regionEndView); AddChild(m_regionEndView);
@@ -654,7 +654,7 @@ void TransportView::_constructControls() {
// //
// _addGroupTarget(m_regionStartView); // _addGroupTarget(m_regionStartView);
//// m_regionStartView->TextView()->SetAlignment(B_ALIGN_RIGHT); //// m_regionStartView->TextView()->SetAlignment(B_ALIGN_RIGHT);
// //
// AddChild(m_regionStartView); // AddChild(m_regionStartView);
// //
// m = new BMessage(NodeGroup::M_SET_END_POSITION); // m = new BMessage(NodeGroup::M_SET_END_POSITION);
@@ -668,7 +668,7 @@ void TransportView::_constructControls() {
// _addGroupTarget(m_regionEndView); // _addGroupTarget(m_regionEndView);
//// m_regionEndView->TextView()->SetAlignment(B_ALIGN_RIGHT); //// m_regionEndView->TextView()->SetAlignment(B_ALIGN_RIGHT);
// AddChild(m_regionEndView); // AddChild(m_regionEndView);
m = new BMessage(NodeGroup::M_START); m = new BMessage(NodeGroup::M_START);
m_startButton = new BButton( m_startButton = new BButton(
BRect(), BRect(),
@@ -701,7 +701,7 @@ void TransportView::_constructControls() {
// [e.moon 11oct99] // [e.moon 11oct99]
bigtime_t TransportView::_scalePosition( bigtime_t TransportView::_scalePosition(
double value) { double value) {
return bigtime_t(value * 1000000.0); return bigtime_t(value * 1000000.0);
} }
@@ -793,7 +793,7 @@ void TransportView::_populateTimeSourceMenu(
menu->AddItem(i); menu->AddItem(i);
_addGroupTarget(i); _addGroupTarget(i);
} }
// BMessage* m; // BMessage* m;
// for(int n = 0; n < _time_sources; ++n) { // for(int n = 0; n < _time_sources; ++n) {
// m = new BMessage(NodeGroup::M_SET_TIME_SOURCE); // m = new BMessage(NodeGroup::M_SET_TIME_SOURCE);
@@ -804,7 +804,7 @@ void TransportView::_populateTimeSourceMenu(
// sizeof(media_node)); // sizeof(media_node));
// // +++++ copy media_node of associated time source! // // +++++ copy media_node of associated time source!
//// m->AddInt32("timeSource", n); //// m->AddInt32("timeSource", n);
// //
// BMenuItem* i = new BMenuItem( // BMenuItem* i = new BMenuItem(
// _time_source_strings[n], m); // _time_source_strings[n], m);
// menu->AddItem(i); // menu->AddItem(i);
@@ -818,7 +818,7 @@ void TransportView::_populateTimeSourceMenu(
void TransportView::_addLocalTarget( void TransportView::_addLocalTarget(
BInvoker* invoker) { BInvoker* invoker) {
m_localTargets.push_back(invoker); m_localTargets.push_back(invoker);
if(Window()) if(Window())
invoker->SetTarget(this); invoker->SetTarget(this);
@@ -826,7 +826,7 @@ void TransportView::_addLocalTarget(
void TransportView::_addGroupTarget( void TransportView::_addGroupTarget(
BInvoker* invoker) { BInvoker* invoker) {
m_groupTargets.push_back(invoker); m_groupTargets.push_back(invoker);
if(m_group) if(m_group)
invoker->SetTarget(m_group); invoker->SetTarget(m_group);
@@ -849,7 +849,7 @@ void TransportView::_disableControls() {
// m_nameView->SetText("(no group)"); // m_nameView->SetText("(no group)");
m_infoView->Invalidate(); m_infoView->Invalidate();
m_runModeView->SetEnabled(false); m_runModeView->SetEnabled(false);
m_runModeView->Menu()->Superitem()->SetLabel("(none)"); m_runModeView->Menu()->Superitem()->SetLabel("(none)");
@@ -861,7 +861,7 @@ void TransportView::_disableControls() {
m_regionEndView->SetEnabled(false); m_regionEndView->SetEnabled(false);
m_regionEndView->setValue(0); m_regionEndView->setValue(0);
m_startButton->SetEnabled(false); m_startButton->SetEnabled(false);
m_stopButton->SetEnabled(false); m_stopButton->SetEnabled(false);
m_prerollButton->SetEnabled(false); m_prerollButton->SetEnabled(false);
@@ -892,14 +892,14 @@ void TransportView::_enableControls() {
BView* focused = w->CurrentFocus(); BView* focused = w->CurrentFocus();
if(focused) if(focused)
focused->MakeFocus(false); focused->MakeFocus(false);
} }
// BString nameViewText = m_group->name(); // BString nameViewText = m_group->name();
// nameViewText << ": " << m_group->countNodes() << " nodes."; // nameViewText << ": " << m_group->countNodes() << " nodes.";
// m_nameView->SetText(nameViewText.String()); // m_nameView->SetText(nameViewText.String());
m_infoView->Invalidate(); m_infoView->Invalidate();
m_runModeView->SetEnabled(true); m_runModeView->SetEnabled(true);
_updateRunMode(); _updateRunMode();
@@ -907,14 +907,14 @@ void TransportView::_enableControls() {
_updateTimeSource(); _updateTimeSource();
_updateTransportButtons(); _updateTransportButtons();
// +++++ ick. hard-coded scaling factors make me queasy // +++++ ick. hard-coded scaling factors make me queasy
m_regionStartView->SetEnabled(true); m_regionStartView->SetEnabled(true);
m_regionStartView->setValue( m_regionStartView->setValue(
((double)m_group->startPosition()) / 1000000.0); ((double)m_group->startPosition()) / 1000000.0);
m_regionEndView->SetEnabled(true); m_regionEndView->SetEnabled(true);
m_regionEndView->setValue( m_regionEndView->setValue(
((double)m_group->endPosition()) / 1000000.0); ((double)m_group->endPosition()) / 1000000.0);
@@ -928,7 +928,7 @@ void TransportView::_enableControls() {
if(w) { if(w) {
w->EndViewTransaction(); w->EndViewTransaction();
} }
// PRINT(( // PRINT((
// "*** DONE: _enableControls()\n")); // "*** DONE: _enableControls()\n"));
@@ -937,7 +937,7 @@ void TransportView::_enableControls() {
void TransportView::_updateTransportButtons() { void TransportView::_updateTransportButtons() {
ASSERT(m_group); ASSERT(m_group);
switch(m_group->transportState()) { switch(m_group->transportState()) {
case NodeGroup::TRANSPORT_INVALID: case NodeGroup::TRANSPORT_INVALID:
case NodeGroup::TRANSPORT_STARTING: case NodeGroup::TRANSPORT_STARTING:
@@ -946,7 +946,7 @@ void TransportView::_updateTransportButtons() {
m_stopButton->SetEnabled(false); m_stopButton->SetEnabled(false);
m_prerollButton->SetEnabled(false); m_prerollButton->SetEnabled(false);
break; break;
case NodeGroup::TRANSPORT_STOPPED: case NodeGroup::TRANSPORT_STOPPED:
m_startButton->SetEnabled(true); m_startButton->SetEnabled(true);
m_stopButton->SetEnabled(false); m_stopButton->SetEnabled(false);
@@ -964,11 +964,11 @@ void TransportView::_updateTransportButtons() {
// based on group settings, set the start button to do either // based on group settings, set the start button to do either
// a simple start or a roll (atomic start/stop.) [e.moon 11oct99] // a simple start or a roll (atomic start/stop.) [e.moon 11oct99]
ASSERT(m_startButton->Message()); ASSERT(m_startButton->Message());
// get current region settings // get current region settings
bigtime_t startPosition = _scalePosition(m_regionStartView->value()); bigtime_t startPosition = _scalePosition(m_regionStartView->value());
bigtime_t endPosition = _scalePosition(m_regionEndView->value()); bigtime_t endPosition = _scalePosition(m_regionEndView->value());
// get current run-mode setting // get current run-mode setting
uint32 runMode = 0; uint32 runMode = 0;
BMenuItem* i = m_runModeView->Menu()->FindMarked(); BMenuItem* i = m_runModeView->Menu()->FindMarked();
@@ -979,7 +979,7 @@ void TransportView::_updateTransportButtons() {
endPosition > startPosition && endPosition > startPosition &&
(runMode == BMediaNode::B_OFFLINE || (runMode == BMediaNode::B_OFFLINE ||
!m_group->canCycle())) { !m_group->canCycle())) {
m_startButton->SetLabel("Roll"); m_startButton->SetLabel("Roll");
m_startButton->Message()->what = NodeGroup::M_ROLL; m_startButton->Message()->what = NodeGroup::M_ROLL;
@@ -1017,27 +1017,27 @@ void TransportView::_updateTimeSource() {
BMessage* message = menu->ItemAt(n)->Message(); BMessage* message = menu->ItemAt(n)->Message();
if(!message) if(!message)
continue; continue;
ssize_t size = sizeof(media_node); ssize_t size = sizeof(media_node);
err = message->FindData( err = message->FindData(
"timeSourceNode", "timeSourceNode",
B_RAW_TYPE, B_RAW_TYPE,
&data, &data,
&size); &size);
if(err < B_OK) if(err < B_OK)
continue; continue;
memcpy(&itemNode, data, sizeof(media_node)); itemNode = *((media_node*)data);
if(itemNode != tsNode) if(itemNode != tsNode)
continue; continue;
// found it // found it
PRINT(( PRINT((
"### _updateTimeSource: %s\n", "### _updateTimeSource: %s\n",
menu->ItemAt(n)->Label())); menu->ItemAt(n)->Label()));
menu->ItemAt(n)->SetMarked(true); menu->ItemAt(n)->SetMarked(true);
break; break;
} }
// ASSERT(m_timeSourcePresets); // ASSERT(m_timeSourcePresets);
// int n; // int n;
// for(n = 0; n < _time_sources; ++n) { // for(n = 0; n < _time_sources; ++n) {
@@ -1054,7 +1054,7 @@ void TransportView::_updateTimeSource() {
} }
void TransportView::_updateRunMode() { void TransportView::_updateRunMode() {
ASSERT(m_group); ASSERT(m_group);
BMenu* menu = m_runModeView->Menu(); BMenu* menu = m_runModeView->Menu();
uint32 runMode = m_group->runMode() - 1; // real run mode starts at 1 uint32 runMode = m_group->runMode() - 1; // real run mode starts at 1
ASSERT((uint32)menu->CountItems() > runMode); ASSERT((uint32)menu->CountItems() > runMode);
@@ -1069,7 +1069,7 @@ void TransportView::_updateRunMode() {
// if(err == B_OK) { // if(err == B_OK) {
// m_timeSources.push_back(node.node); // m_timeSources.push_back(node.node);
// } // }
// //
// err = m_manager->roster->GetSystemTimeSource(&m_timeSourcePresets[1]); // err = m_manager->roster->GetSystemTimeSource(&m_timeSourcePresets[1]);
// if(err < B_OK) { // if(err < B_OK) {
// PRINT(( // PRINT((
@@ -1087,7 +1087,7 @@ void TransportView::_timeSourceCreated(
err = message->FindInt32("nodeID", &id); err = message->FindInt32("nodeID", &id);
if(err < B_OK) if(err < B_OK)
return; return;
// PRINT(("### _timeSourceCreated(): %" B_PRId32 "\n", id)); // PRINT(("### _timeSourceCreated(): %" B_PRId32 "\n", id));
NodeRef* ref; NodeRef* ref;
err = m_manager->getNodeRef(id, &ref); err = m_manager->getNodeRef(id, &ref);
@@ -1095,7 +1095,7 @@ void TransportView::_timeSourceCreated(
PRINT(( PRINT((
"!!! TransportView::_timeSourceCreated(): node %" B_PRId32 " doesn't exist\n", "!!! TransportView::_timeSourceCreated(): node %" B_PRId32 " doesn't exist\n",
id)); id));
return; return;
} }
char nameBuffer[B_MEDIA_NAME_LENGTH+16]; char nameBuffer[B_MEDIA_NAME_LENGTH+16];
@@ -1125,7 +1125,7 @@ void TransportView::_timeSourceDeleted(
err = message->FindInt32("nodeID", &id); err = message->FindInt32("nodeID", &id);
if(err < B_OK) if(err < B_OK)
return; return;
// PRINT(("### _timeSourceDeleted(): %" B_PRId32 "\n", id)); // PRINT(("### _timeSourceDeleted(): %" B_PRId32 "\n", id));
BMenu* menu = m_timeSourceView->Menu(); BMenu* menu = m_timeSourceView->Menu();
@@ -1139,20 +1139,20 @@ void TransportView::_timeSourceDeleted(
BMessage* message = menu->ItemAt(n)->Message(); BMessage* message = menu->ItemAt(n)->Message();
if(!message) if(!message)
continue; continue;
ssize_t size = sizeof(media_node); ssize_t size = sizeof(media_node);
err = message->FindData( err = message->FindData(
"timeSourceNode", "timeSourceNode",
B_RAW_TYPE, B_RAW_TYPE,
&data, &data,
&size); &size);
if(err < B_OK) if(err < B_OK)
continue; continue;
memcpy(&itemNode, data, sizeof(media_node)); itemNode = *((media_node*)data);
if(itemNode.node != id) if(itemNode.node != id)
continue; continue;
// found it; remove the item // found it; remove the item
menu->RemoveItem(n); menu->RemoveItem(n);
break; break;
@@ -1190,7 +1190,7 @@ class TransportView::_layout_state {
public: public:
_layout_state() {} _layout_state() {}
// +++++ // +++++
}; };
inline float _menu_width( inline float _menu_width(
@@ -1198,7 +1198,7 @@ inline float _menu_width(
const BFont* font) { const BFont* font) {
float max = 0.0; float max = 0.0;
int total = menu->CountItems(); int total = menu->CountItems();
for(int n = 0; n < total; ++n) { for(int n = 0; n < total; ++n) {
float w = font->StringWidth( float w = font->StringWidth(
@@ -1206,7 +1206,7 @@ inline float _menu_width(
if(w > max) if(w > max)
max = w; max = w;
} }
return max; return max;
} }
@@ -1227,10 +1227,10 @@ void TransportView::_updateLayout() // +++++
// * max label width // * max label width
float maxLabelWidth = 0.0; float maxLabelWidth = 0.0;
float w; float w;
maxLabelWidth = be_bold_font->StringWidth( maxLabelWidth = be_bold_font->StringWidth(
m_runModeView->Label()); m_runModeView->Label());
w = be_bold_font->StringWidth( w = be_bold_font->StringWidth(
m_timeSourceView->Label()); m_timeSourceView->Label());
if(w > maxLabelWidth) if(w > maxLabelWidth)
@@ -1277,7 +1277,7 @@ void TransportView::_updateLayout() // +++++
viewWidth += (buttonSpan - columnWidth); viewWidth += (buttonSpan - columnWidth);
// float insideWidth = viewWidth - (_edge_pad_x*2); // float insideWidth = viewWidth - (_edge_pad_x*2);
// * figure view height a row at a time // * figure view height a row at a time
font_height fh; font_height fh;
be_plain_font->GetHeight(&fh); be_plain_font->GetHeight(&fh);
@@ -1286,20 +1286,20 @@ void TransportView::_updateLayout() // +++++
float prefInfoWidth, prefInfoHeight; float prefInfoWidth, prefInfoHeight;
m_infoView->GetPreferredSize(&prefInfoWidth, &prefInfoHeight); m_infoView->GetPreferredSize(&prefInfoWidth, &prefInfoHeight);
float row_1_height = max(prefInfoHeight, _transport_button_height); float row_1_height = max(prefInfoHeight, _transport_button_height);
float row1_y = _edge_pad_y; float row1_y = _edge_pad_y;
float row2_y = row1_y + row_1_height + _transport_pad_y; float row2_y = row1_y + row_1_height + _transport_pad_y;
float row3_y = row2_y + lineHeight + _control_pad_y; float row3_y = row2_y + lineHeight + _control_pad_y;
// float row4_y = row3_y + lineHeight + _control_pad_y + _transport_pad_y; // float row4_y = row3_y + lineHeight + _control_pad_y + _transport_pad_y;
// float row5_y = row4_y + lineHeight + _control_pad_y; // float row5_y = row4_y + lineHeight + _control_pad_y;
float viewHeight = row3_y + lineHeight + _control_pad_y + _edge_pad_y; float viewHeight = row3_y + lineHeight + _control_pad_y + _edge_pad_y;
// Place controls // Place controls
m_infoView->MoveTo( m_infoView->MoveTo(
column1_x+1.0, row1_y+1.0); column1_x+1.0, row1_y+1.0);
m_infoView->ResizeTo( m_infoView->ResizeTo(
columnWidth, prefInfoHeight); columnWidth, prefInfoHeight);
BRect br( BRect br(
column2_x, row1_y, column2_x, row1_y,
column2_x+_transport_button_width, column2_x+_transport_button_width,
@@ -1326,7 +1326,7 @@ void TransportView::_updateLayout() // +++++
maxLabelWidth+_label_pad_x); maxLabelWidth+_label_pad_x);
m_runModeView->SetAlignment( m_runModeView->SetAlignment(
B_ALIGN_LEFT); B_ALIGN_LEFT);
m_timeSourceView->MoveTo( m_timeSourceView->MoveTo(
column2_x, row3_y); column2_x, row3_y);
m_timeSourceView->ResizeTo( m_timeSourceView->ResizeTo(
@@ -1343,27 +1343,27 @@ void TransportView::_updateLayout() // +++++
// B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP); // B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP);
// "FROM" // "FROM"
BPoint rtLeftTop(column1_x, row2_y + 5.0); BPoint rtLeftTop(column1_x, row2_y + 5.0);
BPoint rtRightBottom; BPoint rtRightBottom;
m_fromLabel->MoveTo(rtLeftTop); m_fromLabel->MoveTo(rtLeftTop);
m_fromLabel->ResizeToPreferred(); m_fromLabel->ResizeToPreferred();
rtRightBottom = rtLeftTop + BPoint( rtRightBottom = rtLeftTop + BPoint(
m_fromLabel->Bounds().Width(), m_fromLabel->Bounds().Width(),
m_fromLabel->Bounds().Height()); m_fromLabel->Bounds().Height());
// (region-start) // (region-start)
rtLeftTop.x = rtRightBottom.x+4; rtLeftTop.x = rtRightBottom.x+4;
m_regionStartView->MoveTo(rtLeftTop + BPoint(0.0, 2.0)); m_regionStartView->MoveTo(rtLeftTop + BPoint(0.0, 2.0));
m_regionStartView->ResizeToPreferred(); m_regionStartView->ResizeToPreferred();
rtRightBottom = rtLeftTop + BPoint( rtRightBottom = rtLeftTop + BPoint(
m_regionStartView->Bounds().Width(), m_regionStartView->Bounds().Width(),
m_regionStartView->Bounds().Height()); m_regionStartView->Bounds().Height());
// m_regionStartView->SetDivider( // m_regionStartView->SetDivider(
// maxLabelWidth); // maxLabelWidth);
// m_regionStartView->TextView()->ResizeTo( // m_regionStartView->TextView()->ResizeTo(
@@ -1379,11 +1379,11 @@ void TransportView::_updateLayout() // +++++
rtRightBottom = rtLeftTop + BPoint( rtRightBottom = rtLeftTop + BPoint(
m_toLabel->Bounds().Width(), m_toLabel->Bounds().Width(),
m_toLabel->Bounds().Height()); m_toLabel->Bounds().Height());
// (region-end) // (region-end)
rtLeftTop.x = rtRightBottom.x + 4; rtLeftTop.x = rtRightBottom.x + 4;
m_regionEndView->MoveTo(rtLeftTop + BPoint(0.0, 2.0)); m_regionEndView->MoveTo(rtLeftTop + BPoint(0.0, 2.0));
m_regionEndView->ResizeToPreferred(); m_regionEndView->ResizeToPreferred();
// m_regionEndView->SetDivider( // m_regionEndView->SetDivider(
@@ -1400,7 +1400,7 @@ void TransportView::_updateLayout() // +++++
float targetHeight = (b.Height() < viewHeight) ? float targetHeight = (b.Height() < viewHeight) ?
viewHeight : viewHeight :
b.Height(); b.Height();
// Resize view to fit contents // Resize view to fit contents
ResizeTo(targetWidth, targetHeight); ResizeTo(targetWidth, targetHeight);
@@ -1429,6 +1429,6 @@ TransportView::~TransportView() {
if(m_layout) if(m_layout)
delete m_layout; delete m_layout;
} }
// END -- TransportView.cpp -- // END -- TransportView.cpp --
@@ -465,7 +465,7 @@ LoggingConsumer::Disconnected(
mLogger->Log(LOG_DISCONNECTED, logMsg); mLogger->Log(LOG_DISCONNECTED, logMsg);
// wipe out our input record // wipe out our input record
memset(&mInput, 0, sizeof(mInput)); mInput = media_input();
} }
status_t status_t
+1 -1
View File
@@ -432,7 +432,7 @@ AudioSettingsView::_FillChannelMenu(const dormant_node_info* nodeInfo)
for (int32 i = 0; i < inputCount; i++) { for (int32 i = 0; i < inputCount; i++) {
media_input* input = new media_input(); media_input* input = new media_input();
memcpy(input, &inputs[i], sizeof(*input)); *input = inputs[i];
ChannelMenuItem* channelItem = new ChannelMenuItem(input, ChannelMenuItem* channelItem = new ChannelMenuItem(input,
new BMessage(message)); new BMessage(message));
fChannelMenu->AddItem(channelItem); fChannelMenu->AddItem(channelItem);