Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
100ffbae
Commit
100ffbae
authored
5 years ago
by
Sebastian Hahta
Browse files
Options
Downloads
Patches
Plain Diff
fix vr
parent
d5db9e5d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Doxyfile
+2
-1
2 additions, 1 deletion
Doxyfile
applications/gui/src/camera.cpp
+2
-2
2 additions, 2 deletions
applications/gui/src/camera.cpp
components/audio/src/speaker.cpp
+48
-48
48 additions, 48 deletions
components/audio/src/speaker.cpp
with
52 additions
and
51 deletions
Doxyfile
+
2
−
1
View file @
100ffbae
...
...
@@ -876,7 +876,8 @@ RECURSIVE = YES
EXCLUDE = "components/common/cpp/include/nlohmann/json.hpp" \
"components/common/cpp/include/loguru.hpp" \
"components/common/cpp/include/ctpl_stl.h" \
"build/"
"build/" \
"ext/"
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
...
...
This diff is collapsed.
Click to expand it.
applications/gui/src/camera.cpp
+
2
−
2
View file @
100ffbae
...
...
@@ -406,7 +406,7 @@ bool ftl::gui::Camera::setVR(bool on) {
else
{
vr_mode_
=
false
;
setChannel
(
Channel
::
Left
);
// reset to left channel
// todo restore camera params
// todo restore camera params
<
}
return
vr_mode_
;
...
...
@@ -415,7 +415,7 @@ bool ftl::gui::Camera::setVR(bool on) {
void
ftl
::
gui
::
Camera
::
setChannel
(
Channel
c
)
{
#ifdef HAVE_OPENVR
if
(
isVR
())
{
if
(
isVR
()
&&
(
c
!=
Channel
::
Right
)
)
{
LOG
(
ERROR
)
<<
"Changing channel in VR mode is not possible."
;
return
;
}
...
...
This diff is collapsed.
Click to expand it.
components/audio/src/speaker.cpp
+
48
−
48
View file @
100ffbae
...
...
@@ -13,49 +13,49 @@ using ftl::codecs::Channel;
/* Portaudio callback to receive audio data. */
static
int
pa_speaker_callback
(
const
void
*
input
,
void
*
output
,
unsigned
long
frameCount
,
const
PaStreamCallbackTimeInfo
*
timeInfo
,
PaStreamCallbackFlags
statusFlags
,
void
*
userData
)
{
unsigned
long
frameCount
,
const
PaStreamCallbackTimeInfo
*
timeInfo
,
PaStreamCallbackFlags
statusFlags
,
void
*
userData
)
{
auto
*
buffer
=
(
ftl
::
audio
::
StereoBuffer16
<
2000
>*
)
userData
;
short
*
out
=
(
short
*
)
output
;
auto
*
buffer
=
(
ftl
::
audio
::
StereoBuffer16
<
2000
>*
)
userData
;
short
*
out
=
(
short
*
)
output
;
buffer
->
readFrame
(
out
);
return
0
;
return
0
;
}
#endif
Speaker
::
Speaker
(
nlohmann
::
json
&
config
)
:
ftl
::
Configurable
(
config
),
buffer_
(
48000
)
{
#ifdef HAVE_PORTAUDIO
ftl
::
audio
::
pa_init
();
auto
err
=
Pa_OpenDefaultStream
(
&
stream_
,
0
,
2
,
paInt16
,
48000
,
// Sample rate
256
,
// Size of single frame
pa_speaker_callback
,
&
this
->
buffer_
);
if
(
err
!=
paNoError
)
{
LOG
(
ERROR
)
<<
"Portaudio open stream error: "
<<
Pa_GetErrorText
(
err
);
active_
=
false
;
ftl
::
audio
::
pa_init
();
auto
err
=
Pa_OpenDefaultStream
(
&
stream_
,
0
,
2
,
paInt16
,
48000
,
// Sample rate
256
,
// Size of single frame
pa_speaker_callback
,
&
this
->
buffer_
);
if
(
err
!=
paNoError
)
{
LOG
(
ERROR
)
<<
"Portaudio open stream error: "
<<
Pa_GetErrorText
(
err
);
active_
=
false
;
return
;
}
else
{
active_
=
true
;
}
}
else
{
active_
=
true
;
}
err
=
Pa_StartStream
(
stream_
);
err
=
Pa_StartStream
(
stream_
);
if
(
err
!=
paNoError
)
{
LOG
(
ERROR
)
<<
"Portaudio start stream error: "
<<
Pa_GetErrorText
(
err
);
//active_ = false;
if
(
err
!=
paNoError
)
{
LOG
(
ERROR
)
<<
"Portaudio start stream error: "
<<
Pa_GetErrorText
(
err
);
//active_ = false;
return
;
}
}
#else // No portaudio
...
...
@@ -71,40 +71,40 @@ Speaker::Speaker(nlohmann::json &config) : ftl::Configurable(config), buffer_(48
}
Speaker
::~
Speaker
()
{
if
(
active_
)
{
active_
=
false
;
if
(
active_
)
{
active_
=
false
;
#ifdef HAVE_PORTAUDIO
auto
err
=
Pa_StopStream
(
stream_
);
auto
err
=
Pa_StopStream
(
stream_
);
if
(
err
!=
paNoError
)
{
LOG
(
ERROR
)
<<
"Portaudio stop stream error: "
<<
Pa_GetErrorText
(
err
);
//active_ = false;
}
if
(
err
!=
paNoError
)
{
LOG
(
ERROR
)
<<
"Portaudio stop stream error: "
<<
Pa_GetErrorText
(
err
);
//active_ = false;
}
err
=
Pa_CloseStream
(
stream_
);
err
=
Pa_CloseStream
(
stream_
);
if
(
err
!=
paNoError
)
{
LOG
(
ERROR
)
<<
"Portaudio close stream error: "
<<
Pa_GetErrorText
(
err
);
}
if
(
err
!=
paNoError
)
{
LOG
(
ERROR
)
<<
"Portaudio close stream error: "
<<
Pa_GetErrorText
(
err
);
}
#endif
}
}
#ifdef HAVE_PORTAUDIO
ftl
::
audio
::
pa_final
();
ftl
::
audio
::
pa_final
();
#endif
}
void
Speaker
::
queue
(
int64_t
ts
,
ftl
::
audio
::
Frame
&
frame
)
{
auto
&
audio
=
frame
.
get
<
ftl
::
audio
::
Audio
>
(
Channel
::
Audio
);
auto
&
audio
=
frame
.
get
<
ftl
::
audio
::
Audio
>
(
Channel
::
Audio
);
LOG
(
INFO
)
<<
"Buffer Fullness ("
<<
ts
<<
"): "
<<
buffer_
.
size
();
//
LOG(INFO) << "Buffer Fullness (" << ts << "): " << buffer_.size();
buffer_
.
write
(
audio
.
data
());
LOG
(
INFO
)
<<
"Audio delay: "
<<
buffer_
.
delay
()
<<
"s"
;
//
LOG(INFO) << "Audio delay: " << buffer_.delay() << "s";
}
void
Speaker
::
setDelay
(
int64_t
ms
)
{
float
d
=
static_cast
<
float
>
(
ms
)
/
1000.0
f
+
extra_delay_
;
if
(
d
<
0.0
f
)
d
=
0.0
f
;
// Clamp to 0 delay (not ideal to be exactly 0)
buffer_
.
setDelay
(
d
);
float
d
=
static_cast
<
float
>
(
ms
)
/
1000.0
f
+
extra_delay_
;
if
(
d
<
0.0
f
)
d
=
0.0
f
;
// Clamp to 0 delay (not ideal to be exactly 0)
buffer_
.
setDelay
(
d
);
}
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