Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
liu-home-wreckers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
liuhomewreckers
liu-home-wreckers
Commits
a46ce619
Commit
a46ce619
authored
4 years ago
by
Daniel Engelsons
Browse files
Options
Downloads
Patches
Plain Diff
Microphone Done
parent
9f7bcbfd
No related branches found
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lhw_qi/include/lhw_qi/microphone_component.hpp
+2
-2
2 additions, 2 deletions
src/lhw_qi/include/lhw_qi/microphone_component.hpp
src/lhw_qi/src/microphone_component.cpp
+13
-11
13 additions, 11 deletions
src/lhw_qi/src/microphone_component.cpp
with
15 additions
and
13 deletions
src/lhw_qi/include/lhw_qi/microphone_component.hpp
+
2
−
2
View file @
a46ce619
...
...
@@ -22,9 +22,9 @@ namespace lhw_qi
LHW_QI_PUBLIC
explicit
Microphone
(
const
rclcpp
::
NodeOptions
&
options
);
void
initiate
(
qi
::
SessionPtr
session
,
boost
::
shared_ptr
<
Microphone
>
microphone_ptr
);
void
init
iateService
(
void
);
void
init
(
void
);
virtual
~
Microphone
(
void
);
void
process
(
const
int
&
nbOfChannels
,
void
process
Remote
(
const
int
&
nbOfChannels
,
const
int
&
nbrOfSamplesByChannel
,
const
qi
::
AnyValue
&
timestamp
,
const
qi
::
AnyValue
&
buffer
);
...
...
This diff is collapsed.
Click to expand it.
src/lhw_qi/src/microphone_component.cpp
+
13
−
11
View file @
a46ce619
...
...
@@ -16,7 +16,7 @@ namespace lhw_qi
pub_
=
this
->
create_publisher
<
std_msgs
::
msg
::
Int16
>
(
"microphone_buffer"
,
1000
);
}
QI_REGISTER_MT_OBJECT
(
Microphone
,
init
iateService
,
process
)
QI_REGISTER_MT_OBJECT
(
Microphone
,
init
,
process
Remote
)
Microphone
::~
Microphone
(
void
)
{
...
...
@@ -24,35 +24,37 @@ namespace lhw_qi
listener_
.
call
<
qi
::
AnyValue
>
(
"unsubscribe"
,
"Microphone"
);
}
void
Microphone
::
init
iateService
(
void
)
void
Microphone
::
init
(
void
)
{
listener_
.
call
<
qi
::
AnyValue
>
(
"setClientPreferences"
,
"Microphone"
,
48000
,
0
,
1
);
listener_
.
call
<
qi
::
AnyValue
>
(
"subscribe"
,
"Microphone"
);
}
void
Microphone
::
initiate
(
qi
::
SessionPtr
session
,
boost
::
shared_ptr
<
Microphone
>
microphone_ptr
)
{
session_
=
session
;
RCUTILS_LOG_INFO
(
"timestamp inne i initiate"
);
session_
->
waitForService
(
"ALAudioDevice"
);
RCUTILS_LOG_INFO
(
"initiate2"
);
listener_
=
session_
->
service
(
"ALAudioDevice"
);
session_
->
registerService
(
"Microphone"
,
qi
::
AnyObject
(
microphone_ptr
)
);
RCUTILS_LOG_INFO
(
"initiate3"
);
qi
::
AnyObject
microphone
=
session_
->
service
(
"Microphone"
);
RCUTILS_LOG_INFO
(
"initiate4"
);
microphone
.
call
<
qi
::
AnyValue
>
(
"init
iateService
"
);
RCUTILS_LOG_INFO
(
"initiate5"
);
microphone
.
call
<
qi
::
AnyValue
>
(
"init"
);
}
void
Microphone
::
process
(
const
int
&
nbOfChannels
,
void
Microphone
::
process
Remote
(
const
int
&
nbOfChannels
,
const
int
&
nbrOfSamplesByChannel
,
const
qi
::
AnyValue
&
timestamp
,
const
qi
::
AnyValue
&
buffer
)
{
...
...
@@ -60,7 +62,7 @@ namespace lhw_qi
std
::
pair
<
char
*
,
size_t
>
charBuffer
=
buffer
.
unwrap
().
asRaw
();
//RCUTILS_LOG_INFO("buffer %s", qi::encodeJSON(qibuffer).c_str());
RCUTILS_LOG_INFO
(
"timestamp %s"
,
qi
::
encodeJSON
(
timestamp
).
c_str
());
//
RCUTILS_LOG_INFO("timestamp %s", qi::encodeJSON(timestamp).c_str());
auto
msg
=
std_msgs
::
msg
::
Int16
();
msg
.
data
=
*
(
signed
short
*
)
charBuffer
.
first
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment