Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f7686a9
Add K4A_RESULT_UNSUPPORTED to result enums.
AntonClaytonBursch Nov 6, 2020
70eaf43
Structs for device, color, depth. Enum for calibration. Functions to …
AntonClaytonBursch Nov 11, 2020
143cd46
Updates examples, src, tests and tools to use new config and color an…
AntonClaytonBursch Nov 11, 2020
7496015
Added fps mode structs and functions.
AntonClaytonBursch Nov 11, 2020
163d176
Updated code to reflect change to using fps mode.
AntonClaytonBursch Nov 11, 2020
bdb2ed3
Moded color, depth and fps enums from k4a/k4atypes.h to k4ainternal/m…
AntonClaytonBursch Nov 13, 2020
dc0db6b
Updated c++ wrapper to use new color and depth modes.
AntonClaytonBursch Nov 17, 2020
b7de2fb
Updated C++ wrapper with get device, depth, color and fps functions. …
AntonClaytonBursch Nov 17, 2020
f9dda0a
Update k4arecord/types.h and examples to use color, depth and fps mod…
AntonClaytonBursch Nov 19, 2020
051f8eb
added depth range to k4a_depth_mode_info, updated get color/depth/fps…
AntonClaytonBursch Nov 23, 2020
14ccb08
Update k4astaticimageproperties.h to use k4a.hpp instead of k4a.h
AntonClaytonBursch Nov 23, 2020
4bc4c00
Quick fix: forgot to add K4A_EXPORT to get mode and mode count functi…
AntonClaytonBursch Nov 23, 2020
e3d04a3
examples, tests, tools refactored to use new get mode functions
AntonClaytonBursch Nov 30, 2020
9ceb3e1
quick comments fix in calibration example and updates to color_ft tes…
AntonClaytonBursch Dec 3, 2020
b5b3806
Changed get modes loops for fps, color and depth.
AntonClaytonBursch Dec 9, 2020
33c964f
Viewer mode selection from radio to comboboxes
AntonClaytonBursch Dec 17, 2020
fcac45f
using mode info types instead of mode info type index
AntonClaytonBursch Dec 30, 2020
eed589a
refactor to use mode info instead of mode id
AntonClaytonBursch Dec 31, 2020
fc655bd
using depth/color/fps mode info instead of mode id
AntonClaytonBursch Jan 4, 2021
a85ed66
mode id changes and GUI cleanup
AntonClaytonBursch Jan 5, 2021
9c97825
revert back from using device mode info to device mode id for fps/col…
AntonClaytonBursch Jan 11, 2021
a488ed1
Use constants defined in usb_cmd_priv.h to set the vendor id and devi…
AntonClaytonBursch Jan 13, 2021
0289b22
Used const for color/depth/fps mode info initializers.
AntonClaytonBursch Jan 14, 2021
01893b2
Passing depth mode info down to point cloud viewer. Moved static k4a…
AntonClaytonBursch Jan 19, 2021
a1b772d
color, depth and fps mode infos saved in and parsed from recordings
AntonClaytonBursch Jan 20, 2021
158b641
Initialize the size and version of the mode structs
AntonClaytonBursch Jan 22, 2021
66bc1e5
Moved K4A_MSFT_VID, K4A_RGB_PID and K4A_DEPTH_PID to usbcommand.h. A…
AntonClaytonBursch Jan 22, 2021
2a70cd1
error handling for saving modes and device info in recording
AntonClaytonBursch Jan 22, 2021
5f99801
color, depth, fps mode info and device info saved in and parse from r…
AntonClaytonBursch Jan 22, 2021
af6d217
Fixing K4A build errors in src/record/internal/matroska_read.cpp abou…
JonathanESantos Jan 26, 2021
c541fde
SDK: docstring changes for Doxygen to run without errors.
JonathanESantos Jan 26, 2021
7a7854a
Merge pull request #1 from AntonClaytonBursch/user/jonsanto/Bug5456_F…
AntonClaytonBursch Jan 26, 2021
8f573d2
Merge pull request #2 from AntonClaytonBursch/user/jonsanto/Story5373…
AntonClaytonBursch Jan 26, 2021
e8fe464
K4A API: Adding to docstrings that functions may return status of UNS…
JonathanESantos Jan 26, 2021
d592958
linked k4a_math in viewer
AntonClaytonBursch Jan 26, 2021
5d51a26
Recording description from mode info saved in recording (or legacy de…
AntonClaytonBursch Jan 26, 2021
e3bfdb2
Merge pull request #3 from AntonClaytonBursch/user/jonsanto/Task5460_…
AntonClaytonBursch Jan 26, 2021
81b9de6
Use modes for k4arecorder
AntonClaytonBursch Jan 27, 2021
7a91853
Recorder mode option listed.
AntonClaytonBursch Jan 27, 2021
1bc8889
Merge branch 'api-update' of https://github.com/AntonClaytonBursch/Az…
AntonClaytonBursch Jan 27, 2021
162a016
k4aviewer: Removing audio support. To turn on audio support, in tools…
JonathanESantos Jan 27, 2021
1ccc23f
k4aviewer: Removing support for audio and clangformat wants to format…
JonathanESantos Jan 27, 2021
a828c1e
working on recorder command line validation
AntonClaytonBursch Jan 27, 2021
5be389d
Merge branch 'api-update' into user/jonsanto/Task5467_RemoveSupportFo…
JonathanESantos Jan 27, 2021
46e53da
k4arecorder: Minor editing.
JonathanESantos Jan 27, 2021
b493720
k4a: Adding functional tests for calling the added functions in k4a.h.
JonathanESantos Jan 28, 2021
b32f3ac
Removing commented-out code.
JonathanESantos Jan 28, 2021
6d28e16
k4a: Fixing a test in depth_ft.
JonathanESantos Jan 28, 2021
e8c0f22
Update main.cpp
JonathanESantos Jan 28, 2021
c7279c3
Update main.cpp
JonathanESantos Jan 28, 2021
da96ffc
Update main.cpp
JonathanESantos Jan 28, 2021
235ba8f
Update main.cpp
JonathanESantos Jan 28, 2021
8d2a3b1
Update main.cpp
JonathanESantos Jan 28, 2021
fa07ae8
Merge pull request #5 from AntonClaytonBursch/user/jonsanto/Task5466_…
AntonClaytonBursch Jan 28, 2021
df3b755
validate recorder cmd options
AntonClaytonBursch Jan 28, 2021
f82b42d
finished validating recording cmd options
AntonClaytonBursch Jan 28, 2021
1166777
Fixed get fps mode in recorder.
AntonClaytonBursch Jan 28, 2021
bab38b8
Merge branch 'api-update' into user/jonsanto/Task5467_RemoveSupportFo…
AntonClaytonBursch Jan 28, 2021
d9f616d
Merge pull request #4 from AntonClaytonBursch/user/jonsanto/Task5467_…
AntonClaytonBursch Jan 28, 2021
a5f6512
Fix broken Linux build.
JonathanESantos Jan 29, 2021
b4df263
k4a: ninja clangformat made these formatting changes.
JonathanESantos Jan 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
k4aviewer: Removing audio support. To turn on audio support, in tools…
…/k4aviewer/CMakeLists.txt, set K4A_INCLUDE_AUDIO to 1.
  • Loading branch information
JonathanESantos committed Jan 27, 2021
commit 162a01691757bad59a89321773601eef5b5bcd70
5 changes: 3 additions & 2 deletions src/record/internal/matroska_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,9 @@ k4a_result_t parse_recording_config(k4a_playback_context_t *context)
if (cJSON_IsNumber(device_info_json_capabilities) && device_info_json_capabilities->valuedouble != NULL)
{
uint32_t capabilities = (uint32_t)device_info_json_capabilities->valuedouble;
//hasDepthDevice = capabilities == 1 || capabilities == 3 || capabilities == 5 || capabilities == 7;
//hasColorDevice = capabilities == 2 || capabilities == 3 || capabilities == 6 || capabilities == 7;
// hasDepthDevice = capabilities == 1 || capabilities == 3 || capabilities == 5 || capabilities ==
// 7; hasColorDevice = capabilities == 2 || capabilities == 3 || capabilities == 6 || capabilities
// == 7;

hasDepthDevice = (capabilities & 0x0001) == 1;
hasColorDevice = ((capabilities >> 1) & 0x01) == 1;
Expand Down
4 changes: 2 additions & 2 deletions src/record/sdk/record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ k4a_result_t k4a_record_create(const char *path,
if (K4A_SUCCEEDED(device_info_result))
{
uint32_t capabilities = device_info.capabilities;
//hasDepthDevice = capabilities == 1 || capabilities == 3 || capabilities == 5 || capabilities == 7;
//hasColorDevice = capabilities == 2 || capabilities == 3 || capabilities == 6 || capabilities == 7;
// hasDepthDevice = capabilities == 1 || capabilities == 3 || capabilities == 5 || capabilities == 7;
// hasColorDevice = capabilities == 2 || capabilities == 3 || capabilities == 6 || capabilities == 7;
hasDepthDevice = (capabilities & 0x0001) == 1;
hasColorDevice = ((capabilities >> 1) & 0x01) == 1;

Expand Down
123 changes: 74 additions & 49 deletions tools/k4aviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# Include ${CMAKE_CURRENT_BINARY_DIR}/version.rc in the target's sources
# to embed version information
set(K4A_FILEDESCRIPTION "Azure Kinect Viewer")
set(K4A_ORIGINALFILENAME "k4aviewer.exe")
set(K4A_USE_ICON 1)
configure_file(
${K4A_VERSION_RC}
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY
)

find_package(OpenGL REQUIRED)
include_directories(
${OPENGL_INCLUDE_DIRS}
${CMAKE_CURRENT_LIST_DIR}
)

set(SOURCE_FILES
main.cpp
gpudepthtopointcloudconverter.cpp
k4aaudiochanneldatagraph.cpp
k4aaudiomanager.cpp
k4aaudiowindow.cpp
k4acolorimageconverter.cpp
k4adevicedockcontrol.cpp
k4afilepicker.cpp
Expand All @@ -15,8 +29,6 @@ set(SOURCE_FILES
k4aimugraphdatagenerator.cpp
k4aimuwindow.cpp
k4alogdockcontrol.cpp
k4amicrophone.cpp
k4amicrophonelistener.cpp
k4apointcloudrenderer.cpp
k4apointcloudviewcontrol.cpp
k4apointcloudvisualizer.cpp
Expand All @@ -37,70 +49,83 @@ set(SOURCE_FILES
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)

# Include ${CMAKE_CURRENT_BINARY_DIR}/version.rc in the target's sources
# to embed version information
set(K4A_FILEDESCRIPTION "Azure Kinect Viewer")
set(K4A_ORIGINALFILENAME "k4aviewer.exe")
set(K4A_USE_ICON 1)
configure_file(
${K4A_VERSION_RC}
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY
)

find_package(OpenGL REQUIRED)
include_directories(
${OPENGL_INCLUDE_DIRS}
${CMAKE_CURRENT_LIST_DIR}
)

set(EXTERNAL_LIBRARIES
k4a::k4a
k4a::k4arecord
k4a_math
imgui::imgui
libjpeg-turbo::libjpeg-turbo
libsoundio::libsoundio
LibUSB::LibUSB
libyuv::libyuv
glfw::glfw
${OPENGL_LIBRARIES}
)

# On Windows, we need to call into setupapi to get USB container ID information
# so we can correlate K4A microphone arrays and K4A depth cameras/sensors
#
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(APPEND SOURCE_FILES
platform/windows/filesystem17.cpp
platform/windows/k4adevicecorrelator.cpp
platform/windows/wmain.cpp
)
list(APPEND SOURCE_FILES
platform/windows/filesystem17.cpp
platform/windows/wmain.cpp
)

list(APPEND EXTERNAL_LIBRARIES
setupapi.lib
pathcch.lib
Shlwapi.lib
)
list(APPEND EXTERNAL_LIBRARIES
setupapi.lib
pathcch.lib
Shlwapi.lib
)
else()
list(APPEND SOURCE_FILES
platform/linux/filesystem17.cpp
platform/linux/k4adevicecorrelator.cpp
list(APPEND SOURCE_FILES
platform/linux/filesystem17.cpp
)
endif()


# Set K4A_INCLUDE_AUDIO to 1 for audio support.
set(K4A_INCLUDE_AUDIO 0)
if (K4A_INCLUDE_AUDIO)

add_compile_definitions(K4A_INCLUDE_AUDIO)

list(APPEND SOURCE_FILES
k4aaudiochanneldatagraph.cpp
k4aaudiomanager.cpp
k4aaudiowindow.cpp
k4amicrophone.cpp
k4amicrophonelistener.cpp
)

# This is a bit gross, but libsoundio has a file called endian.h in its
# include path, which conflicts with a system file with the same name on
# Linux. On Ubuntu 16.04, this causes a struct in waitstatus.h to have
# all its members defined twice (once for each endianness), which results
# in a build break. It looks like there's not a built-in way to pass
# idirafter in cmake like you can with target_include_directories, so
# anyone that uses libsoundio has to do this. Fortunately, that should
# just be k4aviewer
#
add_compile_options("-idirafter/usr/include/soundio")
list(APPEND EXTERNAL_LIBRARIES
libsoundio::libsoundio
)

# On Windows, we need to call into setupapi to get USB container ID information
# so we can correlate K4A microphone arrays and K4A depth cameras/sensors
#
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(APPEND SOURCE_FILES
platform/windows/k4adevicecorrelator.cpp
)

else()
list(APPEND SOURCE_FILES
platform/linux/k4adevicecorrelator.cpp
)

# This is a bit gross, but libsoundio has a file called endian.h in its
# include path, which conflicts with a system file with the same name on
# Linux. On Ubuntu 16.04, this causes a struct in waitstatus.h to have
# all its members defined twice (once for each endianness), which results
# in a build break. It looks like there's not a built-in way to pass
# idirafter in cmake like you can with target_include_directories, so
# anyone that uses libsoundio has to do this. Fortunately, that should
# just be k4aviewer
#
add_compile_options("-idirafter/usr/include/soundio")

endif()

endif()


add_executable(k4aviewer WIN32 ${SOURCE_FILES})
target_link_libraries(k4aviewer PRIVATE ${EXTERNAL_LIBRARIES})

Expand Down
27 changes: 26 additions & 1 deletion tools/k4aviewer/k4adevicedockcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@

// Project headers
//
#include "k4aaudiomanager.h"
#include "k4aimguiextensions.h"
#include "k4atypeoperators.h"
#include "k4aviewererrormanager.h"
#include "k4aviewerutil.h"
#include "k4awindowmanager.h"

#ifdef K4A_INCLUDE_AUDIO
#include "k4aaudiomanager.h"
#endif

using namespace k4aviewer;

namespace
Expand Down Expand Up @@ -272,7 +275,11 @@ void K4ADeviceDockControl::RefreshSyncCableStatus()

bool K4ADeviceDockControl::DeviceIsStarted() const
{
#ifdef K4A_INCLUDE_AUDIO
return m_camerasStarted || m_imuStarted || (m_microphone && m_microphone->IsStarted());
#else
return m_camerasStarted || m_imuStarted;
#endif
}

K4ADeviceDockControl::K4ADeviceDockControl(k4a::device &&device) : m_device(std::move(device))
Expand All @@ -282,7 +289,9 @@ K4ADeviceDockControl::K4ADeviceDockControl(k4a::device &&device) : m_device(std:
m_deviceSerialNumber = m_device.get_serialnum();
m_windowTitle = m_deviceSerialNumber + ": Configuration";

#ifdef K4A_INCLUDE_AUDIO
m_microphone = K4AAudioManager::Instance().GetMicrophoneForDevice(m_deviceSerialNumber);
#endif

LoadColorSettingsCache();
RefreshSyncCableStatus();
Expand Down Expand Up @@ -312,6 +321,7 @@ K4ADockControlStatus K4ADeviceDockControl::Show()

const bool deviceIsStarted = DeviceIsStarted();

#ifdef K4A_INCLUDE_AUDIO
// Check microphone health
//
if (m_microphone && m_microphone->GetStatusCode() != SoundIoErrorNone)
Expand All @@ -322,6 +332,7 @@ K4ADockControlStatus K4ADeviceDockControl::Show()
StopMicrophone();
m_microphone->ClearStatusCode();
}
#endif

// Draw controls
//
Expand Down Expand Up @@ -669,6 +680,7 @@ K4ADockControlStatus K4ADeviceDockControl::Show()
const bool synchronizedImagesAvailable = m_config.EnableColorCamera && m_config.EnableDepthCamera;
m_config.SynchronizedImagesOnly &= synchronizedImagesAvailable;

#ifdef K4A_INCLUDE_AUDIO
if (m_microphone)
{
ImGuiExtensions::K4ACheckbox("Enable Microphone", &m_config.EnableMicrophone, !deviceIsStarted);
Expand All @@ -678,6 +690,7 @@ K4ADockControlStatus K4ADeviceDockControl::Show()
m_config.EnableMicrophone = false;
ImGui::Text("Microphone not detected!");
}
#endif

ImGui::Separator();

Expand Down Expand Up @@ -884,10 +897,13 @@ void K4ADeviceDockControl::Start()
StartImu();
}
}

#ifdef K4A_INCLUDE_AUDIO
if (m_config.EnableMicrophone)
{
StartMicrophone();
}
#endif

SetViewType(K4AWindowSet::ViewType::Normal);
m_paused = false;
Expand All @@ -899,7 +915,10 @@ void K4ADeviceDockControl::Stop()

StopCameras();
StopImu();

#ifdef K4A_INCLUDE_AUDIO
StopMicrophone();
#endif
}

bool K4ADeviceDockControl::StartCameras()
Expand Down Expand Up @@ -969,6 +988,7 @@ void K4ADeviceDockControl::StopCameras()
&m_camerasAbortInProgress);
}

#ifdef K4A_INCLUDE_AUDIO
bool K4ADeviceDockControl::StartMicrophone()
{
if (!m_microphone)
Expand Down Expand Up @@ -1003,6 +1023,7 @@ void K4ADeviceDockControl::StopMicrophone()
m_microphone->Stop();
}
}
#endif

bool K4ADeviceDockControl::StartImu()
{
Expand Down Expand Up @@ -1072,6 +1093,7 @@ void K4ADeviceDockControl::SetViewType(K4AWindowSet::ViewType viewType)
{
K4AWindowManager::Instance().ClearWindows();

#ifdef K4A_INCLUDE_AUDIO
std::shared_ptr<K4AMicrophoneListener> micListener = nullptr;
if (m_config.EnableMicrophone)
{
Expand All @@ -1083,6 +1105,7 @@ void K4ADeviceDockControl::SetViewType(K4AWindowSet::ViewType viewType)
K4AViewerErrorManager::Instance().SetErrorStatus(errorBuilder.str());
}
}
#endif

k4a_depth_mode_info_t depth_mode_info = m_device.get_depth_mode(m_config.depth_mode_id);
k4a_color_mode_info_t color_mode_info = m_device.get_color_mode(m_config.color_mode_id);
Expand All @@ -1093,7 +1116,9 @@ void K4ADeviceDockControl::SetViewType(K4AWindowSet::ViewType viewType)
K4AWindowSet::StartNormalWindows(m_deviceSerialNumber.c_str(),
&m_cameraDataSource,
m_config.EnableImu ? &m_imuDataSource : nullptr,
#ifdef K4A_INCLUDE_AUDIO
std::move(micListener),
#endif
m_config.EnableDepthCamera,
depth_mode_info,
m_config.EnableColorCamera,
Expand Down
10 changes: 9 additions & 1 deletion tools/k4aviewer/k4adevicedockcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
#include "ik4adockcontrol.h"
#include "k4adatasource.h"
#include "k4amicrophone.h"
#include "k4apollingthread.h"
#include "k4aviewersettingsmanager.h"
#include "k4awindowset.h"

#ifdef K4A_INCLUDE_AUDIO
#include "k4amicrophone.h"
#endif

namespace k4aviewer
{
class K4ADeviceDockControl : public IK4ADockControl
Expand Down Expand Up @@ -84,8 +87,10 @@ class K4ADeviceDockControl : public IK4ADockControl
bool StartCameras();
void StopCameras();

#ifdef K4A_INCLUDE_AUDIO
bool StartMicrophone();
void StopMicrophone();
#endif

bool StartImu();
void StopImu();
Expand All @@ -110,7 +115,10 @@ class K4ADeviceDockControl : public IK4ADockControl
bool m_imuAbortInProgress = false;

std::string m_deviceSerialNumber;

#ifdef K4A_INCLUDE_AUDIO
std::shared_ptr<K4AMicrophone> m_microphone;
#endif

K4ADataSource<k4a::capture> m_cameraDataSource;
K4ADataSource<k4a_imu_sample_t> m_imuDataSource;
Expand Down
Loading