Compare commits

..

No commits in common. "85178368d7ee55c52b846bfd54d71fe71bdf6c5e" and "cb22e622b3e7a44b99fb78f5ec5b6dcbe7d1dbc1" have entirely different histories.

5 changed files with 4 additions and 50 deletions

View File

@ -12,7 +12,6 @@ option(LIBICSNEO_BUILD_EXAMPLES "Build examples." ON)
option(LIBICSNEO_BUILD_ICSNEOC "Build dynamic C library" ON)
option(LIBICSNEO_BUILD_ICSNEOC_STATIC "Build static C library" ON)
option(LIBICSNEO_BUILD_ICSNEOLEGACY "Build icsnVC40 compatibility library" ON)
option(LIBICSNEO_BUILD_ICSNEOLEGACY_STATIC "Build static icsnVC40 compatibility library" ON)
set(LIBICSNEO_NPCAP_INCLUDE_DIR "" CACHE STRING "Npcap include directory; set to build with Npcap")
# Device Drivers
@ -449,7 +448,6 @@ if(LIBICSNEO_BUILD_ICSNEOC_STATIC)
)
target_link_libraries(icsneoc-static PUBLIC icsneocpp)
target_compile_features(icsneoc-static PUBLIC cxx_auto_type cxx_constexpr cxx_lambdas cxx_nullptr cxx_range_for cxx_rvalue_references cxx_sizeof_member cxx_strong_enums)
target_compile_definitions(icsneoc-static PUBLIC ICSNEOC_BUILD_STATIC)
endif()
if(LIBICSNEO_BUILD_ICSNEOLEGACY)
@ -470,25 +468,6 @@ if(LIBICSNEO_BUILD_ICSNEOLEGACY)
target_compile_features(icsneolegacy PRIVATE cxx_auto_type cxx_constexpr cxx_lambdas cxx_nullptr cxx_range_for cxx_rvalue_references cxx_sizeof_member cxx_strong_enums)
endif()
if(LIBICSNEO_BUILD_ICSNEOLEGACY_STATIC)
add_library(icsneolegacy-static STATIC
api/icsneolegacy/icsneolegacy.cpp
api/icsneolegacy/icsneolegacyextra.cpp
api/icsneoc/icsneoc.cpp
)
target_include_directories(icsneolegacy-static
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_link_libraries(icsneolegacy-static PUBLIC icsneocpp)
target_compile_features(icsneolegacy-static PUBLIC cxx_auto_type cxx_constexpr cxx_lambdas cxx_nullptr cxx_range_for cxx_rvalue_references cxx_sizeof_member cxx_strong_enums)
target_compile_definitions(icsneolegacy-static PUBLIC ICSNEOC_BUILD_STATIC)
endif()
# googletest
if(LIBICSNEO_BUILD_TESTS)
if(WIN32)

View File

@ -59,7 +59,7 @@ size_t A2BMessage::getSampleOffset(Direction dir, uint8_t channel, size_t frame)
size_t sampleOffset = static_cast<size_t>(frameSize * frame + 2 * channel * getBytesPerChannel());
if(dir == Direction::Upstream) {
sampleOffset += getBytesPerChannel();
sampleOffset++;
}
return sampleOffset;
@ -152,6 +152,7 @@ PCMSample A2BMessage::getChannelSample(Direction dir, uint8_t channel, size_t fr
void A2BMessage::setChannelSample(Direction dir, uint8_t channel, size_t frame, PCMSample sampleToSet, PCMType pcmType) {
size_t sampleOffset = getSampleOffset(dir, channel, frame);
uint8_t* audioData = data.data();
uint32_t& uSample = *reinterpret_cast<uint32_t*>(&sampleToSet);
// Align the bytes towards the most significant bit by multiplying using
@ -167,10 +168,10 @@ void A2BMessage::setChannelSample(Direction dir, uint8_t channel, size_t frame,
if(channelSize16) {
// Read the 2 most significant bytes of the sample
SAMPLE_TO_BYTES_16(data, sampleOffset, uSample)
SAMPLE_TO_BYTES_16(audioData, sampleOffset, uSample)
} else {
// Read the entire sample
SAMPLE_TO_BYTES_32(data, sampleOffset, uSample);
SAMPLE_TO_BYTES_32(audioData, sampleOffset, uSample);
}
}

View File

@ -9,12 +9,7 @@
#include "icsneo/platform/posix/linux/dynamiclib.h"
#endif
#ifndef ICSNEOC_BUILD_STATIC
#define DLLExport __attribute__((visibility("default")))
#else
#define DLLExport
#endif
#define LegacyDLLExport DLLExport
// #ifndef ICSNEO_NO_AUTO_DESTRUCT

View File

@ -3,17 +3,11 @@
#include "icsneo/platform/windows.h"
#ifndef ICSNEOC_BUILD_STATIC
#ifdef ICSNEOC_MAKEDLL
#define DLLExport __declspec(dllexport)
#else
#define DLLExport __declspec(dllimport)
#endif
#else
#define DLLExport
#endif
#define LegacyDLLExport DLLExport _stdcall
// MSVC does not have the ability to specify a destructor

View File

@ -71,21 +71,6 @@ TEST_F(A2BEncoderDecoderTest, PacketEncoderTest)
packetEncoder->encode(*packetizer, bytestream, messagePtr);
EXPECT_EQ(bytestream, testBytes);
message.setChannelSample(
icsneo::A2BMessage::Direction::Upstream,
static_cast<uint8_t>(1u),
0u,
-102,
icsneo::PCMType::L16
);
EXPECT_EQ(message.getChannelSample(
icsneo::A2BMessage::Direction::Upstream,
static_cast<uint8_t>(1u),
0u,
icsneo::PCMType::L16
), -102);
}
TEST_F(A2BEncoderDecoderTest, PacketDecoderTest)