xref: /haiku/src/kits/midi2/MidiEndpoint.cpp (revision 7120e97489acbf17d86d3f33e3b2e68974fd4b23)
1 /**
2  * @file MidiEndpoint.cpp
3  *
4  * @author Matthijs Hollemans
5  * @author Jerome Leveque
6  */
7 
8 #include <MidiRoster.h>
9 
10 #include "debug.h"
11 #include "MidiEndpoint.h"
12 
13 //------------------------------------------------------------------------------
14 
15 const char* BMidiEndpoint::Name() const
16 {
17 	return fName.String();
18 }
19 
20 //------------------------------------------------------------------------------
21 
22 void BMidiEndpoint::SetName(const char* name)
23 {
24 	BMidiRoster *roster = BMidiRoster::MidiRoster();
25 	roster->Rename(this, name);
26 	fName.SetTo(name);
27 }
28 
29 //------------------------------------------------------------------------------
30 
31 int32 BMidiEndpoint::ID() const
32 {
33 	return fID;
34 }
35 
36 //------------------------------------------------------------------------------
37 
38 bool BMidiEndpoint::IsProducer() const
39 {
40 return (fFlags && 0x01) == 0x01;
41 }
42 
43 //------------------------------------------------------------------------------
44 
45 bool BMidiEndpoint::IsConsumer() const
46 {
47 return (fFlags && 0x01) == 0x01;
48 }
49 
50 //------------------------------------------------------------------------------
51 
52 bool BMidiEndpoint::IsRemote() const
53 {
54 	UNIMPLEMENTED
55 	return false;
56 }
57 
58 //------------------------------------------------------------------------------
59 
60 bool BMidiEndpoint::IsLocal() const
61 {
62 	UNIMPLEMENTED
63 	return false;
64 }
65 
66 //------------------------------------------------------------------------------
67 
68 bool BMidiEndpoint::IsPersistent() const
69 {
70 	UNIMPLEMENTED
71 	return false;
72 }
73 
74 //------------------------------------------------------------------------------
75 
76 bool BMidiEndpoint::IsValid() const
77 {
78 	UNIMPLEMENTED
79 	return false;
80 }
81 
82 //------------------------------------------------------------------------------
83 
84 status_t BMidiEndpoint::Release()
85 {
86 	if (1 == atomic_add(&fRefCount, -1))
87 	{
88 		Unregister();
89 		delete this;
90 		return B_OK;
91 	}
92 	else
93 	{
94 		return B_ERROR;
95 	}
96 }
97 
98 //------------------------------------------------------------------------------
99 
100 status_t BMidiEndpoint::Acquire()
101 {
102 	atomic_add(&fRefCount, 1);
103 	return B_OK;
104 }
105 
106 //------------------------------------------------------------------------------
107 
108 status_t BMidiEndpoint::SetProperties(const BMessage* props)
109 {
110 	UNIMPLEMENTED
111 	return B_ERROR;
112 }
113 
114 //------------------------------------------------------------------------------
115 
116 status_t BMidiEndpoint::GetProperties(BMessage* props) const
117 {
118 	UNIMPLEMENTED
119 	return B_ERROR;
120 }
121 
122 //------------------------------------------------------------------------------
123 
124 status_t BMidiEndpoint::Register(void)
125 {
126 	UNIMPLEMENTED
127 	return B_ERROR;
128 }
129 
130 //------------------------------------------------------------------------------
131 
132 status_t BMidiEndpoint::Unregister(void)
133 {
134 	UNIMPLEMENTED
135 	return B_ERROR;
136 }
137 
138 //------------------------------------------------------------------------------
139 
140 BMidiEndpoint::BMidiEndpoint(const char* name)
141 {
142 	fName = BString(name);
143 	fStatus = B_OK;
144 	fFlags = 0;
145 	fRefCount = 0;
146 //	fID = MidiRosterApp::GetNextFreeID();
147 }
148 
149 //------------------------------------------------------------------------------
150 
151 BMidiEndpoint::~BMidiEndpoint()
152 {
153 	UNIMPLEMENTED
154 }
155 
156 //------------------------------------------------------------------------------
157 
158 void BMidiEndpoint::_Reserved1() { }
159 void BMidiEndpoint::_Reserved2() { }
160 void BMidiEndpoint::_Reserved3() { }
161 void BMidiEndpoint::_Reserved4() { }
162 void BMidiEndpoint::_Reserved5() { }
163 void BMidiEndpoint::_Reserved6() { }
164 void BMidiEndpoint::_Reserved7() { }
165 void BMidiEndpoint::_Reserved8() { }
166 
167 //------------------------------------------------------------------------------
168 
169