Commit 85d261ea authored by Gargaj's avatar Gargaj
Browse files

Fix a few things, update the makefile + readme

parent e150afed
......@@ -22,6 +22,8 @@ else ()
set(BONZOMATIC_64BIT ON CACHE BOOL "Compile for 64 bit target?")
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_property(CACHE BONZOMATIC_WINDOWS_FLAVOR PROPERTY STRINGS DX11 DX9 GLFW)
......@@ -127,7 +129,7 @@ set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_jsonxx)
##############################################################################
# NDI
if (MSVC)
if (MSVC AND BONZOMATIC_NDI)
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} "c:/Program Files/NewTek/NewTek NDI SDK/Include/")
if (BONZOMATIC_64BIT)
set(BZC_LINK_DIRS ${BZC_LINK_DIRS} "c:/Program Files/NewTek/NewTek NDI SDK/Lib/x64/")
......@@ -429,6 +431,9 @@ elseif (UNIX)
# set_target_properties(${BZC_EXE_NAME} PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
endif ()
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")
target_compile_options(${BZC_EXE_NAME} PUBLIC "$<$<CONFIG:Release>:/MT>")
endif ()
......@@ -441,10 +446,12 @@ if (MSVC)
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}>)
endif ()
if (BONZOMATIC_NDI)
if (BONZOMATIC_64BIT)
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}>)
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 ()
......@@ -65,6 +65,7 @@ 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/)
- GLFW by whoever made GLFW (http://www.glfw.org/faq.html)
- 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.
......
......@@ -13,8 +13,10 @@
#ifdef WIN32
#include <windows.h>
#ifdef BONZOMATIC_ENABLE_NDI
#include <Processing.NDI.Lib.h>
#endif
#endif
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()
float fFFTSmoothingFactor = 0.9f; // higher value, smoother FFT
float fFFTSlightSmoothingFactor = 0.6f; // higher value, smoother FFT
#ifdef BONZOMATIC_ENABLE_NDI
std::string sNDIConnectionString;
float fNDIFrameRate = 60.0;
std::string sNDIIdentifier;
bool bNDIProgressive = true;
bool bNDIEnabled = true;
#endif // BONZOMATIC_ENABLE_NDI
char szConfig[65535];
FILE * fConf = fopen("config.json","rb");
......@@ -201,6 +205,7 @@ int main()
midiRoutes.insert( std::make_pair( it->second->number_value_, it->first ) );
}
}
#ifdef BONZOMATIC_ENABLE_NDI
if (o.has<jsonxx::Object>("ndi"))
{
if (o.get<jsonxx::Object>("ndi").has<jsonxx::Boolean>("enabled"))
......@@ -214,6 +219,7 @@ int main()
if (o.get<jsonxx::Object>("ndi").has<jsonxx::Boolean>("progressive"))
bNDIProgressive = o.get<jsonxx::Object>("ndi").get<jsonxx::Boolean>("progressive");
}
#endif // BONZOMATIC_ENABLE_NDI
}
Renderer::Texture * texFFT = Renderer::Create1DR32Texture( FFT_SIZE );
......@@ -296,12 +302,11 @@ int main()
static float fftDataIntegrated[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
// (for e.g. sending frames through the network)
// we'd do it here, and then below.
#ifdef BONZOMATIC_ENABLE_NDI
NDIlib_video_frame_t pNDIFrame;
NDIlib_send_instance_t pNDI_send;
unsigned int * pBuffer[2] = { NULL, NULL };
......@@ -348,6 +353,7 @@ int main()
pNDIFrame.p_data = NULL;
pNDIFrame.line_stride_in_bytes = settings.nWidth * 4;
}
#endif // BONZOMATIC_ENABLE_NDI
bool bShowGui = true;
Timer::Start();
......@@ -528,6 +534,7 @@ int main()
Renderer::EndFrame();
#ifdef BONZOMATIC_ENABLE_NDI
if (pBuffer[0] && pBuffer[1])
{
pNDIFrame.p_data = (BYTE*)pBuffer[ nBufferIndex ];
......@@ -540,8 +547,10 @@ int main()
NDIlib_send_send_video_async(pNDI_send, &pNDIFrame);
}
}
#endif // BONZOMATIC_ENABLE_NDI
}
#ifdef BONZOMATIC_ENABLE_NDI
if (pBuffer[0] && pBuffer[1])
{
NDIlib_send_send_video_async(pNDI_send, NULL); // stop async thread
......@@ -551,6 +560,7 @@ int main()
NDIlib_send_destroy(pNDI_send);
NDIlib_destroy();
}
#endif // BONZOMATIC_ENABLE_NDI
delete surface;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment