FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
jack2/common/JackExternalClient.cpp at develop · jackaudio/jack2 · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
jackaudio
/
jack2
Public
Notifications
You must be signed in to change notification settings
Fork
396
Star
2.4k
Code
Issues
332
Pull requests
38
Discussions
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
jack2
/
common
/
JackExternalClient.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
88 lines (70 loc) · 2.68 KB
Breadcrumbs
jack2
/
common
/
JackExternalClient.cpp
Copy path
File metadata and controls
88 lines (70 loc) · 2.68 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
Copyright (C) 2001-2003 Paul Davis
Copyright (C) 2004-2008 Grame
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#
include
"
JackExternalClient.h
"
#
include
"
JackClientControl.h
"
#
include
"
JackGlobals.h
"
#
include
"
JackChannel.h
"
#
include
"
JackError.h
"
namespace
Jack
{
JackExternalClient::JackExternalClient
():
fClientControl
(
NULL
)
{}
JackExternalClient::~JackExternalClient
()
{}
int
JackExternalClient::ClientNotify
(
int
refnum,
const
char
* name,
int
notify,
int
sync,
const
char
* message,
int
value1,
int
value2)
{
int
result = -
1
;
jack_log
(
"
JackExternalClient::ClientNotify ref = %ld client = %s name = %s notify = %ld
"
, refnum,
fClientControl
->
fName
, name, notify);
fChannel
.
ClientNotify
(refnum, name, notify, sync, message, value1, value2, &result);
return
result;
}
int
JackExternalClient::Open
(
const
char
* name,
int
pid,
int
refnum,
jack_uuid_t
uuid,
int
* shared_client)
{
try
{
if
(
fChannel
.
Open
(name) <
0
) {
jack_error
(
"
Cannot connect to client name = %s
\n
"
, name);
return
-
1
;
}
//
Use "placement new" to allocate object in shared memory
JackShmMemAble* shared_mem =
static_cast
<JackShmMemAble*>(JackShmMem::
operator
new
(
sizeof
(JackClientControl)));
shared_mem->
Init
();
fClientControl
=
new
(shared_mem)
JackClientControl
(name, pid, refnum, uuid);
if
(!
fClientControl
) {
jack_error
(
"
Cannot allocate client shared memory segment
"
);
return
-
1
;
}
*shared_client = shared_mem->
GetShmIndex
();
jack_log
(
"
JackExternalClient::Open name = %s index = %ld base = %x
"
, name, shared_mem->
GetShmIndex
(), shared_mem->
GetShmAddress
());
return
0
;
}
catch
(std::exception&) {
return
-
1
;
}
}
int
JackExternalClient::Close
()
{
jack_log
(
"
JackExternalClient::Close
"
);
fChannel
.
Close
();
if
(
fClientControl
) {
fClientControl
->
~JackClientControl
();
JackShmMem::
operator
delete
(
fClientControl
);
}
return
0
;
}
JackClientControl*
JackExternalClient::GetClientControl
()
const
{
return
fClientControl
;
}
}
//
end of namespace
Back
|
FazBrowse Home
|
New Git URL