Skip to content

Commit 5a3754c

Browse files
author
Marc Boucek
committed
initial upload
1 parent 376d0f3 commit 5a3754c

File tree

259 files changed

+14257
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+14257
-0
lines changed

.clang-format

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
AccessModifierOffset: -4
2+
AlignAfterOpenBracket: Align
3+
AlignConsecutiveAssignments: true
4+
AlignConsecutiveDeclarations: true
5+
AlignEscapedNewlinesLeft: true
6+
AlignOperands: true
7+
AlignTrailingComments: true
8+
AllowAllParametersOfDeclarationOnNextLine: true
9+
AllowShortBlocksOnASingleLine: false
10+
AllowShortFunctionsOnASingleLine: None
11+
AllowShortIfStatementsOnASingleLine: false
12+
AllowShortLoopsOnASingleLine: false
13+
AlwaysBreakBeforeMultilineStrings: false
14+
AlwaysBreakTemplateDeclarations: true
15+
BinPackArguments: false
16+
BinPackParameters: false
17+
BraceWrapping:
18+
AfterClass: true
19+
AfterControlStatement: true
20+
AfterEnum: true
21+
AfterFunction: true
22+
AfterNamespace: true
23+
AfterObjCDeclaration: true
24+
AfterStruct: true
25+
AfterUnion: true
26+
BeforeCatch: true
27+
BeforeElse: true
28+
IndentBraces: false
29+
BreakBeforeBinaryOperators: NonAssignment
30+
BreakBeforeBraces: Custom
31+
BreakBeforeTernaryOperators: true
32+
BreakConstructorInitializersBeforeComma: true
33+
ColumnLimit: 120
34+
CommentPragmas: '^!'
35+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
36+
ConstructorInitializerIndentWidth: 0
37+
ContinuationIndentWidth: 4
38+
Cpp11BracedListStyle: true
39+
DerivePointerAlignment: false
40+
DisableFormat: false
41+
ExperimentalAutoDetectBinPacking: false
42+
ForEachMacros: [ foreach, BOOST_FOREACH ]
43+
IndentCaseLabels: true
44+
IndentFunctionDeclarationAfterType: false
45+
IndentWidth: 4
46+
IndentWrappedFunctionNames: false
47+
KeepEmptyLinesAtTheStartOfBlocks: true
48+
Language: Cpp
49+
MaxEmptyLinesToKeep: 2
50+
NamespaceIndentation: None
51+
ObjCSpaceAfterProperty: false
52+
ObjCSpaceBeforeProtocolList: true
53+
PenaltyBreakBeforeFirstCallParameter: 19
54+
PenaltyBreakComment: 300
55+
PenaltyBreakFirstLessLess: 120
56+
PenaltyBreakString: 1000
57+
PenaltyExcessCharacter: 100
58+
PenaltyReturnTypeOnItsOwnLine: 600
59+
PointerAlignment: Left
60+
SpaceAfterCStyleCast: true
61+
SpaceBeforeAssignmentOperators: true
62+
SpaceBeforeParens: ControlStatements
63+
SpaceInEmptyParentheses: false
64+
SpacesBeforeTrailingComments: 1
65+
SpacesInAngles: false
66+
SpacesInContainerLiterals: true
67+
SpacesInCStyleCastParentheses: false
68+
SpacesInParentheses: true
69+
SpacesInSquareBrackets: false
70+
Standard: Cpp11
71+
TabWidth: 4
72+
UseTab: Never

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# build products --------------------------------
2+
3+
build/
4+
5+
# cmake convention ------------------------------
6+
7+
/build*
8+
9+
# generated by python ---------------------------
10+
11+
*.pyc
12+
13+
# generated by XCode ----------------------------
14+
15+
xcuserdata/
16+
project.xcworkspace/
17+
*.pbxuser
18+
19+
# generated by Mac OS X -------------------------
20+
21+
.DS_Store
22+
23+
# generated by Visual Studio --------------------
24+
25+
*.bak
26+
*.ncb
27+
*.opensdf
28+
*.opt
29+
*.sdf
30+
*.suo
31+
*.user
32+
.vscode
33+
34+
35+
# temporary files -------------------------------
36+
37+
*~

CMakeLists.txt

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
cmake_minimum_required(VERSION 3.4)
2+
3+
if( TARGET ni-media )
4+
return()
5+
endif()
6+
7+
project( ni-media )
8+
9+
option( NIMEDIA_ENABLE_DEPRECATION_WARNINGS "Enable ni-media deprecation warnings" ON )
10+
if( CMAKE_PROJECT_NAME STREQUAL "ni-media" )
11+
option( NIMEDIA_TESTS "Build ni-media Tests" ON )
12+
else()
13+
option( NIMEDIA_TESTS "Build ni-media Tests" OFF )
14+
endif()
15+
16+
17+
if(WIN32 AND CMAKE_CL_64)
18+
set(WIN64 1)
19+
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
20+
set(LINUX 1)
21+
endif()
22+
23+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
24+
25+
include(ni_add_src_file)
26+
include(ni_add_src_group)
27+
include(ni_add_gtest)
28+
29+
30+
if( NIMEDIA_TESTS )
31+
enable_testing()
32+
find_package(GTest REQUIRED)
33+
endif()
34+
35+
add_subdirectory( pcm )
36+
add_subdirectory( audiostream )
37+
38+
# for backwards compatibility:
39+
add_library( ni-media INTERFACE )
40+
target_link_libraries( ni-media INTERFACE audiostream pcm )
41+
if( NOT NIMEDIA_ENABLE_DEPRECATION_WARNINGS )
42+
target_compile_definitions( ni-media INTERFACE NI_MEDIA_NO_DEPRECATION_WARNINGS )
43+
endif()
44+
45+
46+
foreach( target audiostream audiostream_test pcm pcm_test )
47+
if( TARGET ${target} )
48+
set_property( TARGET ${target} PROPERTY FOLDER ni-media )
49+
set_property( TARGET ${target} PROPERTY CXX_STANDARD 14)
50+
endif()
51+
endforeach()
52+

README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# NI MEDIA
2+
3+
NI Media is a library for reading from / writing to audio streams developed at [Native Instruments](https://www.native-instruments.com).
4+
5+
The goal is to have a modern C++ library for dealing with audio streams in an idiomatic C++ style.
6+
7+
Modern:
8+
- a clear separation of concerns (modular instead of fat classes)
9+
- support for ranges and iterators
10+
11+
Idiomatic:
12+
- based on std.streams.
13+
- integrates well with STL algorithms and boost
14+
15+
16+
The following example demonstrates how to stream an entire audio file into a vector:
17+
18+
```cpp
19+
#include <ni/media/audio/ifstream.h>
20+
#include <vector>
21+
22+
int main()
23+
{
24+
auto stream = audio::ifstream("hello.wav");
25+
auto samples = std::vector<float>(stream.info().num_samples());
26+
stream >> samples;
27+
// use samples
28+
}
29+
```
30+
31+
32+
Currently the library consists of the following components:
33+
34+
- [audiostream](audiostream/README.md): the main library for reading from / writing to audio streams.
35+
- [pcm](pcm/README.md): a small library to convert [pcm](https://en.wikipedia.org/wiki/Pulse-code_modulation)
36+
data from / to [arithmetic](http://en.cppreference.com/w/cpp/language/types) types.

0 commit comments

Comments
 (0)