Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
Bonzomatic
Commits
85d261ea
Commit
85d261ea
authored
Nov 30, 2016
by
Gargaj
Browse files
Fix a few things, update the makefile + readme
parent
e150afed
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
85d261ea
...
@@ -22,6 +22,8 @@ else ()
...
@@ -22,6 +22,8 @@ else ()
set
(
BONZOMATIC_64BIT ON CACHE BOOL
"Compile for 64 bit target?"
)
set
(
BONZOMATIC_64BIT ON CACHE BOOL
"Compile for 64 bit target?"
)
endif
()
endif
()
option
(
BONZOMATIC_NDI
"Enable NDI?"
OFF
)
set
(
BONZOMATIC_WINDOWS_FLAVOR
"DX11"
CACHE STRING
"Windows renderer flavor selected at CMake configure time (DX11, DX9 or GLFW)"
)
set
(
BONZOMATIC_WINDOWS_FLAVOR
"DX11"
CACHE STRING
"Windows renderer flavor selected at CMake configure time (DX11, DX9 or GLFW)"
)
set_property
(
CACHE BONZOMATIC_WINDOWS_FLAVOR PROPERTY STRINGS DX11 DX9 GLFW
)
set_property
(
CACHE BONZOMATIC_WINDOWS_FLAVOR PROPERTY STRINGS DX11 DX9 GLFW
)
...
@@ -127,7 +129,7 @@ set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_jsonxx)
...
@@ -127,7 +129,7 @@ set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_jsonxx)
##############################################################################
##############################################################################
# NDI
# NDI
if
(
MSVC
)
if
(
MSVC
AND BONZOMATIC_NDI
)
set
(
BZC_PROJECT_INCLUDES
${
BZC_PROJECT_INCLUDES
}
"c:/Program Files/NewTek/NewTek NDI SDK/Include/"
)
set
(
BZC_PROJECT_INCLUDES
${
BZC_PROJECT_INCLUDES
}
"c:/Program Files/NewTek/NewTek NDI SDK/Include/"
)
if
(
BONZOMATIC_64BIT
)
if
(
BONZOMATIC_64BIT
)
set
(
BZC_LINK_DIRS
${
BZC_LINK_DIRS
}
"c:/Program Files/NewTek/NewTek NDI SDK/Lib/x64/"
)
set
(
BZC_LINK_DIRS
${
BZC_LINK_DIRS
}
"c:/Program Files/NewTek/NewTek NDI SDK/Lib/x64/"
)
...
@@ -429,6 +431,9 @@ elseif (UNIX)
...
@@ -429,6 +431,9 @@ elseif (UNIX)
# set_target_properties(${BZC_EXE_NAME} PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
# set_target_properties(${BZC_EXE_NAME} PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
endif
()
endif
()
elseif
(
MSVC
)
elseif
(
MSVC
)
if
(
BONZOMATIC_NDI
)
target_compile_definitions
(
${
BZC_EXE_NAME
}
PUBLIC -DBONZOMATIC_ENABLE_NDI
)
endif
()
set_target_properties
(
${
BZC_EXE_NAME
}
PROPERTIES LINK_FLAGS
"/SUBSYSTEM:CONSOLE"
)
set_target_properties
(
${
BZC_EXE_NAME
}
PROPERTIES LINK_FLAGS
"/SUBSYSTEM:CONSOLE"
)
target_compile_options
(
${
BZC_EXE_NAME
}
PUBLIC
"$<$<CONFIG:Release>:/MT>"
)
target_compile_options
(
${
BZC_EXE_NAME
}
PUBLIC
"$<$<CONFIG:Release>:/MT>"
)
endif
()
endif
()
...
@@ -441,10 +446,12 @@ if (MSVC)
...
@@ -441,10 +446,12 @@ if (MSVC)
elseif
()
elseif
()
add_custom_command
(
TARGET
${
BZC_EXE_NAME
}
POST_BUILD COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"
${
CMAKE_SOURCE_DIR
}
/external/bass/x86/bass.dll"
$<TARGET_FILE_DIR:
${
BZC_EXE_NAME
}
>
)
add_custom_command
(
TARGET
${
BZC_EXE_NAME
}
POST_BUILD COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"
${
CMAKE_SOURCE_DIR
}
/external/bass/x86/bass.dll"
$<TARGET_FILE_DIR:
${
BZC_EXE_NAME
}
>
)
endif
()
endif
()
if
(
BONZOMATIC_64BIT
)
if
(
BONZOMATIC_NDI
)
add_custom_command
(
TARGET
${
BZC_EXE_NAME
}
POST_BUILD COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"c:/Program Files/NewTek/NewTek NDI SDK/Bin/x64/Processing.NDI.Lib.x64.dll"
$<TARGET_FILE_DIR:
${
BZC_EXE_NAME
}
>
)
if
(
BONZOMATIC_64BIT
)
elseif
()
add_custom_command
(
TARGET
${
BZC_EXE_NAME
}
POST_BUILD COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"c:/Program Files/NewTek/NewTek NDI SDK/Bin/x64/Processing.NDI.Lib.x64.dll"
$<TARGET_FILE_DIR:
${
BZC_EXE_NAME
}
>
)
add_custom_command
(
TARGET
${
BZC_EXE_NAME
}
POST_BUILD COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"c:/Program Files/NewTek/NewTek NDI SDK/Bin/x86/Processing.NDI.Lib.x86.dll"
$<TARGET_FILE_DIR:
${
BZC_EXE_NAME
}
>
)
elseif
()
add_custom_command
(
TARGET
${
BZC_EXE_NAME
}
POST_BUILD COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"c:/Program Files/NewTek/NewTek NDI SDK/Bin/x86/Processing.NDI.Lib.x86.dll"
$<TARGET_FILE_DIR:
${
BZC_EXE_NAME
}
>
)
endif
()
endif
()
endif
()
endif
()
endif
()
README.md
View file @
85d261ea
...
@@ -65,7 +65,8 @@ As you can see you're gonna need [CMAKE](https://cmake.org/) for this, but don't
...
@@ -65,7 +65,8 @@ As you can see you're gonna need [CMAKE](https://cmake.org/) for this, but don't
-
STB Image and Truetype libraries by Sean Barrett (http://nothings.org/)
-
STB Image and Truetype libraries by Sean Barrett (http://nothings.org/)
-
GLFW by whoever made GLFW (http://www.glfw.org/faq.html)
-
GLFW by whoever made GLFW (http://www.glfw.org/faq.html)
-
JSON++ by Hong Jiang (https://github.com/hjiang/jsonxx)
-
JSON++ by Hong Jiang (https://github.com/hjiang/jsonxx)
-
NDI(tm) SDK by NewTek(tm) (http://www.newtek.com/ndi.html)
These software are available under their respective licenses.
These software are available under their respective licenses.
The remainder of this project code was (mostly, I guess) written by Gargaj / Conspiracy and is public domain.
The remainder of this project code was (mostly, I guess) written by Gargaj / Conspiracy and is public domain.
...
...
src/main.cpp
View file @
85d261ea
...
@@ -13,8 +13,10 @@
...
@@ -13,8 +13,10 @@
#ifdef WIN32
#ifdef WIN32
#include
<windows.h>
#include
<windows.h>
#ifdef BONZOMATIC_ENABLE_NDI
#include
<Processing.NDI.Lib.h>
#include
<Processing.NDI.Lib.h>
#endif
#endif
#endif
void
ReplaceTokens
(
std
::
string
&
sDefShader
,
const
char
*
sTokenBegin
,
const
char
*
sTokenName
,
const
char
*
sTokenEnd
,
std
::
vector
<
std
::
string
>
&
tokens
)
void
ReplaceTokens
(
std
::
string
&
sDefShader
,
const
char
*
sTokenBegin
,
const
char
*
sTokenName
,
const
char
*
sTokenEnd
,
std
::
vector
<
std
::
string
>
&
tokens
)
{
{
...
@@ -129,11 +131,13 @@ int main()
...
@@ -129,11 +131,13 @@ int main()
float
fFFTSmoothingFactor
=
0.9
f
;
// higher value, smoother FFT
float
fFFTSmoothingFactor
=
0.9
f
;
// higher value, smoother FFT
float
fFFTSlightSmoothingFactor
=
0.6
f
;
// higher value, smoother FFT
float
fFFTSlightSmoothingFactor
=
0.6
f
;
// higher value, smoother FFT
#ifdef BONZOMATIC_ENABLE_NDI
std
::
string
sNDIConnectionString
;
std
::
string
sNDIConnectionString
;
float
fNDIFrameRate
=
60.0
;
float
fNDIFrameRate
=
60.0
;
std
::
string
sNDIIdentifier
;
std
::
string
sNDIIdentifier
;
bool
bNDIProgressive
=
true
;
bool
bNDIProgressive
=
true
;
bool
bNDIEnabled
=
true
;
bool
bNDIEnabled
=
true
;
#endif // BONZOMATIC_ENABLE_NDI
char
szConfig
[
65535
];
char
szConfig
[
65535
];
FILE
*
fConf
=
fopen
(
"config.json"
,
"rb"
);
FILE
*
fConf
=
fopen
(
"config.json"
,
"rb"
);
...
@@ -201,6 +205,7 @@ int main()
...
@@ -201,6 +205,7 @@ int main()
midiRoutes
.
insert
(
std
::
make_pair
(
it
->
second
->
number_value_
,
it
->
first
)
);
midiRoutes
.
insert
(
std
::
make_pair
(
it
->
second
->
number_value_
,
it
->
first
)
);
}
}
}
}
#ifdef BONZOMATIC_ENABLE_NDI
if
(
o
.
has
<
jsonxx
::
Object
>
(
"ndi"
))
if
(
o
.
has
<
jsonxx
::
Object
>
(
"ndi"
))
{
{
if
(
o
.
get
<
jsonxx
::
Object
>
(
"ndi"
).
has
<
jsonxx
::
Boolean
>
(
"enabled"
))
if
(
o
.
get
<
jsonxx
::
Object
>
(
"ndi"
).
has
<
jsonxx
::
Boolean
>
(
"enabled"
))
...
@@ -213,7 +218,8 @@ int main()
...
@@ -213,7 +218,8 @@ int main()
fNDIFrameRate
=
o
.
get
<
jsonxx
::
Object
>
(
"ndi"
).
get
<
jsonxx
::
Number
>
(
"frameRate"
);
fNDIFrameRate
=
o
.
get
<
jsonxx
::
Object
>
(
"ndi"
).
get
<
jsonxx
::
Number
>
(
"frameRate"
);
if
(
o
.
get
<
jsonxx
::
Object
>
(
"ndi"
).
has
<
jsonxx
::
Boolean
>
(
"progressive"
))
if
(
o
.
get
<
jsonxx
::
Object
>
(
"ndi"
).
has
<
jsonxx
::
Boolean
>
(
"progressive"
))
bNDIProgressive
=
o
.
get
<
jsonxx
::
Object
>
(
"ndi"
).
get
<
jsonxx
::
Boolean
>
(
"progressive"
);
bNDIProgressive
=
o
.
get
<
jsonxx
::
Object
>
(
"ndi"
).
get
<
jsonxx
::
Boolean
>
(
"progressive"
);
}
}
#endif // BONZOMATIC_ENABLE_NDI
}
}
Renderer
::
Texture
*
texFFT
=
Renderer
::
Create1DR32Texture
(
FFT_SIZE
);
Renderer
::
Texture
*
texFFT
=
Renderer
::
Create1DR32Texture
(
FFT_SIZE
);
...
@@ -296,12 +302,11 @@ int main()
...
@@ -296,12 +302,11 @@ int main()
static
float
fftDataIntegrated
[
FFT_SIZE
];
static
float
fftDataIntegrated
[
FFT_SIZE
];
memset
(
fftDataIntegrated
,
0
,
sizeof
(
float
)
*
FFT_SIZE
);
memset
(
fftDataIntegrated
,
0
,
sizeof
(
float
)
*
FFT_SIZE
);
// if we want to do some sort of frame capturing code
// if we want to do some sort of frame capturing code
// if we want to do some sort of frame capturing code
// (for e.g. sending frames through the network)
// (for e.g. sending frames through the network)
// we'd do it here, and then below.
// we'd do it here, and then below.
#ifdef BONZOMATIC_ENABLE_NDI
NDIlib_video_frame_t
pNDIFrame
;
NDIlib_video_frame_t
pNDIFrame
;
NDIlib_send_instance_t
pNDI_send
;
NDIlib_send_instance_t
pNDI_send
;
unsigned
int
*
pBuffer
[
2
]
=
{
NULL
,
NULL
};
unsigned
int
*
pBuffer
[
2
]
=
{
NULL
,
NULL
};
...
@@ -348,7 +353,8 @@ int main()
...
@@ -348,7 +353,8 @@ int main()
pNDIFrame
.
p_data
=
NULL
;
pNDIFrame
.
p_data
=
NULL
;
pNDIFrame
.
line_stride_in_bytes
=
settings
.
nWidth
*
4
;
pNDIFrame
.
line_stride_in_bytes
=
settings
.
nWidth
*
4
;
}
}
#endif // BONZOMATIC_ENABLE_NDI
bool
bShowGui
=
true
;
bool
bShowGui
=
true
;
Timer
::
Start
();
Timer
::
Start
();
float
fNextTick
=
0.1
;
float
fNextTick
=
0.1
;
...
@@ -528,6 +534,7 @@ int main()
...
@@ -528,6 +534,7 @@ int main()
Renderer
::
EndFrame
();
Renderer
::
EndFrame
();
#ifdef BONZOMATIC_ENABLE_NDI
if
(
pBuffer
[
0
]
&&
pBuffer
[
1
])
if
(
pBuffer
[
0
]
&&
pBuffer
[
1
])
{
{
pNDIFrame
.
p_data
=
(
BYTE
*
)
pBuffer
[
nBufferIndex
];
pNDIFrame
.
p_data
=
(
BYTE
*
)
pBuffer
[
nBufferIndex
];
...
@@ -540,8 +547,10 @@ int main()
...
@@ -540,8 +547,10 @@ int main()
NDIlib_send_send_video_async
(
pNDI_send
,
&
pNDIFrame
);
NDIlib_send_send_video_async
(
pNDI_send
,
&
pNDIFrame
);
}
}
}
}
#endif // BONZOMATIC_ENABLE_NDI
}
}
#ifdef BONZOMATIC_ENABLE_NDI
if
(
pBuffer
[
0
]
&&
pBuffer
[
1
])
if
(
pBuffer
[
0
]
&&
pBuffer
[
1
])
{
{
NDIlib_send_send_video_async
(
pNDI_send
,
NULL
);
// stop async thread
NDIlib_send_send_video_async
(
pNDI_send
,
NULL
);
// stop async thread
...
@@ -551,6 +560,7 @@ int main()
...
@@ -551,6 +560,7 @@ int main()
NDIlib_send_destroy
(
pNDI_send
);
NDIlib_send_destroy
(
pNDI_send
);
NDIlib_destroy
();
NDIlib_destroy
();
}
}
#endif // BONZOMATIC_ENABLE_NDI
delete
surface
;
delete
surface
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment