summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2011-12-20 13:55:44 +0000
committerTim Redfern <tim@eclectronics.org>2011-12-20 13:55:44 +0000
commit3a0fe9a2700596abe8e29f042ca967f57cc014d7 (patch)
treef904f12f433542c09385631479c4c32a8382a3ce
initial show versionHEADmaster
-rw-r--r--Makefile466
-rwxr-xr-xaddons.make3
-rw-r--r--bin/data/settings.xml30
-rw-r--r--bin/libs/libfmodex.sobin0 -> 1381296 bytes
-rw-r--r--bin/libs/libfmodexp.sobin0 -> 584676 bytes
-rw-r--r--config.make34
-rw-r--r--globePlayer02.cbp109
-rw-r--r--globePlayer02.layout28
-rw-r--r--globePlayer02.workspace9
-rwxr-xr-xmapping.txt20
-rwxr-xr-xsrc/globeLayer.cpp277
-rwxr-xr-xsrc/globeLayer.h101
-rwxr-xr-xsrc/main.cpp17
-rwxr-xr-xsrc/testApp.cpp199
-rwxr-xr-xsrc/testApp.h42
15 files changed, 1335 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2db4a8b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,466 @@
+# openFrameworks universal makefile
+#
+# make help : shows this message
+# make Debug: makes the application with debug symbols
+# make Release: makes the app with optimizations
+# make: the same as make Release
+# make CleanDebug: cleans the Debug target
+# make CleanRelease: cleans the Release target
+# make clean: cleans everything
+#
+#
+# this should work with any OF app, just copy any example
+# change the name of the folder and it should compile
+# only .cpp support, don't use .c files
+# it will look for files in any folder inside the application
+# folder except that in the EXCLUDE_FROM_SOURCE variable
+# it doesn't autodetect include paths yet
+# add the include paths in the USER_CFLAGS variable
+# using the gcc syntax: -Ipath
+#
+# to add addons to your application, edit the addons.make file
+# in this directory and add the names of the addons you want to
+# include
+#
+# edit the following vars to customize the makefile
+
+include config.make
+
+ifeq ($(findstring Android,$(MAKECMDGOALS)),Android)
+ include $(OF_ROOT)/libs/openFrameworksCompiled/project/android/paths.make
+ ARCH = android
+ ifeq ($(shell uname),Darwin)
+ HOST_PLATFORM = darwin-x86
+ else
+ HOST_PLATFORM = linux-x86
+ endif
+endif
+
+ifeq ($(ARCH),android)
+ COMPILER_OPTIMIZATION = $(ANDROID_COMPILER_OPTIMIZATION)
+ NDK_PLATFORM = android-8
+else
+ COMPILER_OPTIMIZATION = $(USER_COMPILER_OPTIMIZATION)
+endif
+
+
+
+
+# you shouldn't modify anything below this line
+
+
+SHELL = /bin/sh
+ifneq ($(ARCH),android)
+ CXX = g++
+ ARCH = $(shell uname -m)
+ ifeq ($(ARCH),x86_64)
+ LIBSPATH=linux64
+ else
+ LIBSPATH=linux
+ endif
+else
+ ifeq ($(findstring Release_arm7,$(MAKECMDGOALS)),Release_arm7)
+ LIBSPATH =android/armeabi-v7a
+ else
+ LIBSPATH =android/armeabi
+ endif
+ #NDK_ROOT = $(shell cat $(OF_ROOT)/libs/openFrameworksCompiled/project/android/ndk_path.make)
+ #SDK_ROOT = $(shell cat $(OF_ROOT)/libs/openFrameworksCompiled/project/android/sdk_path.make)
+ TOOLCHAIN=arm-linux-androideabi-4.4.3
+ TOOLCHAIN_PATH=$(NDK_ROOT)/toolchains/$(TOOLCHAIN)/prebuilt/$(HOST_PLATFORM)/bin/
+ ANDROID_PREFIX=arm-linux-androideabi-
+ CC=$(NDK_ROOT)/toolchains/$(TOOLCHAIN)/prebuilt/$(HOST_PLATFORM)/bin/$(ANDROID_PREFIX)gcc
+ CXX=$(NDK_ROOT)/toolchains/$(TOOLCHAIN)/prebuilt/$(HOST_PLATFORM)/bin/$(ANDROID_PREFIX)g++
+ AR=$(NDK_ROOT)/toolchains/$(TOOLCHAIN)/prebuilt/$(HOST_PLATFORM)/bin/$(ANDROID_PREFIX)ar
+ SYSROOT=$(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/
+ CFLAGS += -nostdlib --sysroot=$(SYSROOT) -fno-short-enums
+ CFLAGS += -I"$(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/usr/include" -I"$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/include/" -I"$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"
+ CFLAGS += -DANDROID
+endif
+
+NODEPS = clean
+SED_EXCLUDE_FROM_SRC = $(shell echo $(EXCLUDE_FROM_SOURCE) | sed s/\,/\\\\\|/g)
+SOURCE_DIRS = $(shell find . -maxdepth 1 -mindepth 1 -type d | grep -v $(SED_EXCLUDE_FROM_SRC) | sed s/.\\///)
+SOURCES = $(shell find $(SOURCE_DIRS) -name "*.cpp" -or -name "*.c" -or -name "*.cc")
+OBJFILES = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(patsubst %.cc,%.o,$(SOURCES))))
+
+ifneq (,$(USER_SOURCE_DIR))
+ USER_SOURCES = $(shell find $(USER_SOURCE_DIR) -name "*.cpp" -or -name "*.c" -or -name "*.cc")
+ USER_OBJFILES = $(subst $(USER_SOURCE_DIR)/, ,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(patsubst %.cc,%.o,$(USER_SOURCES)))))
+endif
+
+APPNAME = $(shell basename `pwd`)
+CORE_INCLUDES = $(shell find $(OF_ROOT)/libs/openFrameworks/ -type d)
+CORE_INCLUDE_FLAGS = $(addprefix -I,$(CORE_INCLUDES))
+INCLUDES = $(shell find $(OF_ROOT)/libs/*/include -type d | grep -v glu | grep -v quicktime | grep -v poco)
+INCLUDES_FLAGS = $(addprefix -I,$(INCLUDES))
+INCLUDES_FLAGS += -I$(OF_ROOT)/libs/poco/include
+ifeq ($(ARCH),android)
+ INCLUDES_FLAGS += -I$(OF_ROOT)/libs/glu/include_android
+else
+ INCLUDES_FLAGS += -I$(OF_ROOT)/libs/glu/include
+ INCLUDES_FLAGS += $(shell pkg-config glew gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 libudev --cflags)
+ #check if gtk exists and add it
+ GTK = $(shell pkg-config gtk+-2.0 --exists; echo $$?)
+ ifeq ($(GTK),0)
+ CFLAGS += $(shell pkg-config gtk+-2.0 --cflags) -DOF_USING_GTK
+ SYSTEMLIBS += $(shell pkg-config gtk+-2.0 --libs)
+ endif
+
+ #check if mpg123 exists and add it
+ MPG123 = $(shell pkg-config libmpg123 --exists; echo $$?)
+ ifeq ($(MPG123),0)
+ CFLAGS += -DOF_USING_MPG123
+ SYSTEMLIBS += -lmpg123
+ endif
+endif
+LIB_STATIC = $(shell ls $(OF_ROOT)/libs/*/lib/$(LIBSPATH)/*.a 2> /dev/null | grep -v openFrameworksCompiled | grep -v Poco)
+LIB_SHARED = $(shell ls $(OF_ROOT)/libs/*/lib/$(LIBSPATH)/*.so 2> /dev/null | grep -v openFrameworksCompiled | sed "s/.*\\/lib\([^/]*\)\.so/-l\1/")
+LIB_STATIC += $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoNet.a ../../../libs/poco/lib/$(LIBSPATH)/libPocoXML.a ../../../libs/poco/lib/$(LIBSPATH)/libPocoUtil.a ../../../libs/poco/lib/$(LIBSPATH)/libPocoFoundation.a
+LIB_PATHS_FLAGS = $(shell ls -d $(OF_ROOT)/libs/*/lib/$(LIBSPATH) | sed "s/\(\.*\)/-L\1/")
+
+CFLAGS += -Wall -fexceptions
+CFLAGS += -I.
+CFLAGS += $(INCLUDES_FLAGS)
+CFLAGS += $(CORE_INCLUDE_FLAGS)
+
+
+
+ifeq ($(ARCH),android)
+ LDFLAGS = --sysroot=$(SYSROOT) -nostdlib -L"$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi"
+ SYSTEMLIBS += -lstdc++ -lsupc++ -lgcc -lz -lGLESv1_CM -llog -ldl -lm -lc
+else
+ LDFLAGS = -Wl,-rpath=./libs
+ SYSTEMLIBS += $(shell pkg-config jack glew gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 gstreamer-app-0.10 libudev --libs)
+ SYSTEMLIBS += -lglut -lGL -lasound -lopenal -lsndfile -lvorbis -lFLAC -logg -lfreeimage
+endif
+
+
+ifeq ($(findstring addons.make,$(wildcard *.make)),addons.make)
+ ifneq ($(ARCH),android)
+ ADDONS = $(shell cat addons.make | grep -v ofxAndroid)
+ else
+ ADDONS = $(shell cat addons.make)
+ endif
+
+ ifneq ($(strip $(ADDONS)),)
+ ADDONS_REL_DIRS = $(addsuffix /src, $(ADDONS))
+ ADDONS_LIBS_REL_DIRS = $(addsuffix /libs, $(ADDONS))
+ ADDONS_DIRS = $(addprefix $(OF_ROOT)/addons/, $(ADDONS_REL_DIRS) )
+ ADDONS_LIBS_DIRS = $(addprefix $(OF_ROOT)/addons/, $(ADDONS_LIBS_REL_DIRS) )
+ ADDONS_BIN_LIBS_DIRS = $(addsuffix /*/lib/$(LIBSPATH), $(ADDONS_LIBS_DIRS) )
+
+ ADDONS_INCLUDES = $(ADDONS_DIRS)
+ ADDONS_INCLUDES = $(ADDONS_LIBS_DIRS)
+ ADDONS_INCLUDES += $(shell find $(ADDONS_DIRS) -type d 2> /dev/null)
+ ADDONS_INCLUDES += $(shell find $(ADDONS_LIBS_DIRS) -type d 2> /dev/null)
+ ADDONSCFLAGS = $(addprefix -I,$(ADDONS_INCLUDES))
+
+ ifeq ($(findstring libsorder.make,$(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null)),libsorder.make)
+ ADDONS_LIBS_W_ORDER = $(shell cat $(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null))
+ EXCLUDE_LIBS_FILTER = $(addprefix %,$(addsuffix .a,$(ADDONS_LIBS_W_ORDER)))
+ ADDONS_LIBS_STATICS = $(filter-out $(EXCLUDE_LIBS_FILTER), $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.a))
+ ADDONS_LIBS_STATICS += $(addprefix -l, $(ADDONS_LIBS_W_ORDER))
+ ADDONS_LIBS_STATICS += $(addprefix -L, $(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null | sed s/libsorder.make//g))
+ else
+ ADDONS_LIBS_STATICS = $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.a 2> /dev/null)
+ endif
+
+ ADDONS_LIBS_SHARED = $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.so 2> /dev/null)
+ ADDONSLIBS = $(ADDONS_LIBS_STATICS)
+ ADDONSLIBS += $(ADDONS_LIBS_SHARED)
+
+
+ ADDONS_SOURCES = $(shell find $(ADDONS_DIRS) -name "*.cpp" -or -name "*.c" 2> /dev/null)
+ ADDONS_SOURCES += $(shell find $(ADDONS_LIBS_DIRS) -name "*.cpp" -or -name "*.c" -or -name "*.cc" 2>/dev/null)
+ ADDONS_OBJFILES = $(subst $(OF_ROOT)/, ,$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(ADDONS_SOURCES)))))
+ endif
+endif
+
+
+ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug)
+ TARGET_CFLAGS = -g
+ TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworksDebug.a
+ TARGET_NAME = Debug
+endif
+
+ifeq ($(findstring Release,$(MAKECMDGOALS)),Release)
+ TARGET_CFLAGS = $(COMPILER_OPTIMIZATION)
+ TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworks.a
+ TARGET_NAME = Release
+endif
+
+ifeq ($(ARCH),android)
+ ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug)
+ TARGET = libs/armeabi/libOFAndroidApp.so
+ TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworksDebug.a
+ LDFLAGS += -Wl,--fix-cortex-a8 -shared
+ USER_LIBS = $(USER_LIBS_ARM)
+ endif
+
+ ifeq ($(findstring Release,$(MAKECMDGOALS)),Release)
+ TARGET = libs/armeabi/libOFAndroidApp.so
+ TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks.a
+ LDFLAGS += -Wl,--fix-cortex-a8 -shared
+ USER_LIBS = $(USER_LIBS_ARM)
+ endif
+
+ ifeq ($(findstring Release_arm7,$(MAKECMDGOALS)),Release_arm7)
+ TARGET_NAME = Release_arm7
+ TARGET_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mthumb
+ TARGET = libs/armeabi-v7a/libOFAndroidApp.so
+ TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks_arm7.a
+ USER_LIBS = $(USER_LIBS_ARM7)
+ endif
+
+ ifeq ($(findstring Release_neon,$(MAKECMDGOALS)),Release_neon)
+ TARGET_NAME = Release_neon
+ TARGET_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
+ TARGET = libs/armeabi-v7a/libOFAndroidApp_neon.so
+ TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks_neon.a
+ USER_LIBS = $(USER_LIBS_NEON)
+ endif
+
+ ifeq ($(findstring TestLink,$(MAKECMDGOALS)),TestLink)
+ TARGET_NAME = Debug
+ TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworksDebug.a
+ LDFLAGS += -Wl,--entry=main,--fix-cortex-a8
+ BIN_NAME = $(APPNAME)
+ TARGET = obj/$(BIN_NAME)
+ USER_LIBS = $(USER_LIBS_ARM)
+ endif
+else
+ ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug)
+ BIN_NAME = $(APPNAME)_debug
+ TARGET = bin/$(BIN_NAME)
+ endif
+
+ ifeq ($(findstring Release,$(MAKECMDGOALS)),Release)
+ BIN_NAME = $(APPNAME)
+ TARGET = bin/$(BIN_NAME)
+ endif
+
+ ifeq ($(MAKECMDGOALS),)
+ TARGET_NAME = Release
+ BIN_NAME = $(APPNAME)
+ TARGET = bin/$(BIN_NAME)
+ TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworks.a
+ endif
+endif
+
+ifeq ($(MAKECMDGOALS),clean)
+ TARGET = bin/$(APPNAME)_debug bin/$(APPNAME)
+ TARGET_NAME = Release
+endif
+
+
+OBJ_OUTPUT = obj/$(ARCH)$(TARGET_NAME)/
+CLEANTARGET = clean$(TARGET_NAME)
+
+OBJS = $(addprefix $(OBJ_OUTPUT), $(OBJFILES))
+DEPFILES = $(patsubst %.o,%.d,$(OBJS))
+
+USER_OBJS = $(addprefix $(OBJ_OUTPUT), $(USER_OBJFILES))
+DEPFILES += $(patsubst %.o,%.d,$(USER_OBJS))
+
+ifeq ($(findstring addons.make,$(wildcard *.make)),addons.make)
+ ADDONS_OBJS = $(addprefix $(OBJ_OUTPUT), $(ADDONS_OBJFILES))
+ DEPFILES += $(patsubst %.o,%.d,$(ADDONS_OBJS))
+endif
+
+.PHONY: Debug Release all after afterDebugAndroid afterReleaseAndroid
+
+Release: $(TARGET) after
+
+Debug: $(TARGET) after
+
+all:
+ $(MAKE) Release
+
+DebugAndroid: $(TARGET)
+
+ReleaseAndroid: $(TARGET)
+
+Release_arm7Android: $(TARGET)
+
+Release_neonAndroid: $(TARGET) afterReleaseAndroid
+
+TestLinkAndroid: $(TARGET) afterDebugAndroid
+
+AndroidDebug:
+ $(MAKE) DebugAndroid
+ $(MAKE) TestLinkAndroid
+
+AndroidRelease:
+ $(MAKE) ReleaseAndroid
+ $(MAKE) Release_arm7Android
+ $(MAKE) Release_neonAndroid
+
+
+#This rule does the compilation
+#$(OBJS): $(SOURCES)
+$(OBJ_OUTPUT)%.o: %.cpp
+ @echo "compiling object for: " $<
+ mkdir -p $(@D)
+ $(CXX) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
+
+$(OBJ_OUTPUT)%.o: %.c
+ @echo "compiling object for: " $<
+ mkdir -p $(@D)
+ $(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
+
+$(OBJ_OUTPUT)%.o: %.cc
+ @echo "compiling object for: " $<
+ mkdir -p $(@D)
+ $(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
+
+$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.cpp
+ @echo "compiling addon object for" $<
+ mkdir -p $(@D)
+ $(CXX) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $<
+
+$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.c
+ @echo "compiling addon object for" $<
+ mkdir -p $(@D)
+ $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $<
+
+$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.cc
+ @echo "compiling addon object for" $<
+ mkdir -p $(@D)
+ $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $<
+
+$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.c
+ @echo "compiling object for: " $<
+ mkdir -p $(@D)
+ $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
+
+$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.cc
+ @echo "compiling object for: " $<
+ mkdir -p $(@D)
+ $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
+
+$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.cpp
+ @echo "compiling object for: " $<
+ mkdir -p $(@D)
+ $(CXX) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
+
+$(TARGET): $(OBJS) $(ADDONS_OBJS) $(USER_OBJS) $(TARGET_LIBS) $(LIB_STATIC)
+ @echo 'linking $(TARGET)'
+ mkdir -p $(@D)
+ $(CXX) -o $@ $(OBJS) $(ADDONS_OBJS) $(USER_OBJS) $(LDFLAGS) $(USER_LDFLAGS) $(TARGET_LIBS) $(ADDONSLIBS) $(USER_LIBS) $(LIB_STATIC) $(LIB_PATHS_FLAGS) $(LIB_SHARED) $(SYSTEMLIBS)
+
+-include $(DEPFILES)
+
+.PHONY: clean cleanDebug cleanRelease CleanAndroid
+clean:
+ rm -rf $(OBJ_OUTPUT)
+ rm -f $(TARGET)
+ rm -r bin/libs
+
+$(CLEANTARGET):
+ rm -rf $(OBJ_OUTPUT)
+ rm -f $(TARGET)
+ rm -rf bin/libs
+
+CleanAndroid:
+ rm -Rf obj
+ rm -f libs/armeabi-v7a/libOFAndroidApp.so
+ rm -f libs/armeabi/libOFAndroidApp.so
+ rm -f obj/$(APPNAME)
+
+
+afterDebugAndroid:$(TARGET)
+ @if [ -d libs/armeabi-v7a ]; then rm -r libs/armeabi-v7a; fi
+
+ @cp $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver libs/armeabi
+
+ #create gdb.setup for armeabi
+ @echo "set solib-search-path $(PWD)/obj/local/armeabi:$(PWD)/libs/armeabi" > libs/armeabi/gdb.setup
+ @echo "directory $(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/usr/include" >> libs/armeabi/gdb.setup
+ @echo "directory $(PWD)/src" >> libs/armeabi/gdb.setup
+ @echo "directory $(NDK_ROOT)/sources/cxx-stl/system" >> libs/armeabi/gdb.setup
+ @echo "directory $(PWD)/libs/armeabi" >> libs/armeabi/gdb.setup
+ @echo "" >> libs/armeabi/gdb.setup
+
+ @if [ ! -d jni ]; then mkdir jni; fi
+ @echo "APP_ABI := armeabi" > jni/Application.mk
+ @echo "#LOCAL_MODULE := OFAndroidApp" > jni/Android.mk
+
+afterReleaseAndroid:$(TARGET)
+ @if [ -f obj/$(BIN_NAME) ]; then rm obj/$(BIN_NAME); fi
+
+ @cp $(OF_ROOT)/libs/openFrameworksCompiled/project/android/libneondetection.so libs/armeabi-v7a/
+ @cp $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver libs/armeabi-v7a
+
+ #create gdb.setup for armeabi-v7a
+ @echo "set solib-search-path $(PWD)/obj/local/armeabi-v7a:$(PWD)/libs/armeabi-v7a" > libs/armeabi-v7a/gdb.setup
+ @echo "directory $(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/usr/include" >> libs/armeabi-v7a/gdb.setup
+ @echo "directory $(PWD)/src" >> libs/armeabi-v7a/gdb.setup
+ @echo "directory $(NDK_ROOT)/sources/cxx-stl/system" >> libs/armeabi-v7a/gdb.setup
+ @echo "directory $(PWD)/libs/armeabi-v7a" >> libs/armeabi-v7a/gdb.setup
+ @echo "" >> libs/armeabi-v7a/gdb.setup
+
+ @if [ ! -d jni ]; then mkdir jni; fi
+ @echo "APP_ABI := armeabi armeabi-v7a" > jni/Application.mk
+ @echo "#LOCAL_MODULE := OFAndroidApp" > jni/Android.mk
+
+RESNAME=$(shell echo $(APPNAME)Resources | tr '[A-Z]' '[a-z]')
+
+AndroidInstall:
+ if [ -d "bin/data" ]; then \
+ mkdir -p res/raw; \
+ rm res/raw/$(RESNAME).zip; \
+ cd bin/data; \
+ zip -r ../../res/raw/$(RESNAME).zip *; \
+ cd ../..; \
+ fi
+ if [ -f obj/$(BIN_NAME) ]; then rm obj/$(BIN_NAME); fi
+ #touch AndroidManifest.xml
+ $(SDK_ROOT)/tools/android update project --target $(NDK_PLATFORM) --path $(PROJECT_PATH)
+ ant debug
+ cp bin/OFActivity-debug.apk bin/$(APPNAME).apk
+ #if [ "$(shell $(SDK_ROOT)/platform-tools/adb get-state)" = "device" ]; then
+ $(SDK_ROOT)/platform-tools/adb install -r bin/$(APPNAME).apk;
+ #fi
+ $(SDK_ROOT)/platform-tools/adb shell am start -a android.intent.action.MAIN -n cc.openframeworks.$(APPNAME)/cc.openframeworks.$(APPNAME).OFActivity
+
+
+after:$(TARGET)
+ cp -r $(OF_ROOT)/export/$(LIBSPATH)/libs bin/
+ @echo
+ @echo " compiling done"
+ @echo " to launch the application"
+ @echo
+ @echo " cd bin"
+ @echo " ./$(BIN_NAME)"
+ @echo
+
+
+.PHONY: help
+help:
+ @echo
+ @echo openFrameworks universal makefile
+ @echo
+ @echo targets:
+ @echo "make Debug: builds the application with debug symbols"
+ @echo "make Release: builds the app with optimizations"
+ @echo "make: = make Release"
+ @echo "make all: = make Release"
+ @echo "make CleanDebug: cleans the Debug target"
+ @echo "make CleanRelease: cleans the Release target"
+ @echo "make clean: cleans everything"
+ @echo
+ @echo this should work with any OF app, just copy any example
+ @echo change the name of the folder and it should compile
+ @echo "only .cpp support, don't use .c files"
+ @echo it will look for files in any folder inside the application
+ @echo folder except that in the EXCLUDE_FROM_SOURCE variable.
+ @echo "it doesn't autodetect include paths yet"
+ @echo "add the include paths editing the var USER_CFLAGS"
+ @echo at the beginning of the makefile using the gcc syntax:
+ @echo -Ipath
+ @echo
+ @echo to add addons to your application, edit the addons.make file
+ @echo in this directory and add the names of the addons you want to
+ @echo include
+ @echo
diff --git a/addons.make b/addons.make
new file mode 100755
index 0000000..cd4c2cc
--- /dev/null
+++ b/addons.make
@@ -0,0 +1,3 @@
+ofxXmlSettings
+ofxMidi
+
diff --git a/bin/data/settings.xml b/bin/data/settings.xml
new file mode 100644
index 0000000..57c1042
--- /dev/null
+++ b/bin/data/settings.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<globePlayer port="1" channel="0">
+ <layer>
+ <content type="player">
+ <settings name="glopen03.avi" x="0.0" y="128.0" w="1024" h="576" note="24" mix="08"></settings>
+ </content>
+ </layer>
+ <layer>
+ <content type="player">
+ <settings name="daras08-circle.mov" x="0.0" y="128.0" w="1024" h="576" note="26" mix="09"></settings>
+ </content>
+ </layer>
+ <layer>
+ <content type="grabber">
+ <settings camera="1" deInt="1" x="0.0" y="0.0" w="1024" h="768" note="28" mix="10" grabW="720" grabH="576" whitePoint="0.9" blackPoint="0.3" gamma="1.0" whitePtCtl="30" blackPtCtl="28" gammaCtl="29" redCtl="14" greenCtl="15" blueCtl="16" flipCtl="27" devCtl="28" cam1="3" cam2="4" cam3="5" cam4="6"></settings>
+ </content>
+ </layer>
+ <layer>
+ <content type="player">
+ <settings name="glclose.mov" x="0.0" y="128.0" w="1024" h="576" note="29" mix="12"></settings>
+ </content>
+ </layer>
+ <layer>
+ <content type="player">
+ <settings name="GlobePoster.mov" x="22.0" y="20.0" w="980" h="700" note="31" mix="13"></settings>
+ </content>
+ </layer>
+</globePlayer>
+
+
diff --git a/bin/libs/libfmodex.so b/bin/libs/libfmodex.so
new file mode 100644
index 0000000..ede2f98
--- /dev/null
+++ b/bin/libs/libfmodex.so
Binary files differ
diff --git a/bin/libs/libfmodexp.so b/bin/libs/libfmodexp.so
new file mode 100644
index 0000000..8badce9
--- /dev/null
+++ b/bin/libs/libfmodexp.so
Binary files differ
diff --git a/config.make b/config.make
new file mode 100644
index 0000000..cc16340
--- /dev/null
+++ b/config.make
@@ -0,0 +1,34 @@
+# add custom variables to this file
+
+# OF_ROOT allows to move projects outside apps/* just set this variable to the
+# absoulte path to the OF root folder
+
+OF_ROOT = ../../..
+
+
+# USER_CFLAGS allows to pass custom flags to the compiler
+# for example search paths like:
+# USER_CFLAGS = -I src/objects
+
+USER_CFLAGS =
+
+
+# USER_LDFLAGS allows to pass custom flags to the linker
+# for example libraries like:
+# USER_LD_FLAGS = libs/libawesomelib.a
+
+USER_LDFLAGS =
+
+
+# use this to add system libraries for example:
+# USER_LIBS = -lpango
+
+USER_LIBS =
+
+
+# change this to add different compiler optimizations to your project
+
+USER_COMPILER_OPTIMIZATION = -march=native -mtune=native -Os
+
+
+EXCLUDE_FROM_SOURCE="bin,.xcodeproj,obj"
diff --git a/globePlayer02.cbp b/globePlayer02.cbp
new file mode 100644
index 0000000..9da1961
--- /dev/null
+++ b/globePlayer02.cbp
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="6" />
+ <Project>
+ <Option title="globePlayer02" />
+ <Option makefile_is_custom="1" />
+ <Option execution_dir="/home/tim/workspace/of_preRelease_v007_linux/custom/dev/globePlayer02" />
+ <Option pch_mode="2" />
+ <Option compiler="gcc" />
+ <Option virtualFolders="addons/;src/;build config/;" />
+ <Build>
+ <Target title="Debug">
+ <Option output="bin/$(PROJECT_NAME)_debug" prefix_auto="1" extension_auto="1" />
+ <Option working_dir="bin" />
+ <Option object_output="obj/Debug/" />
+ <Option external_deps="../../../libs/openFrameworksCompiled/lib/linux/libopenFrameworksDebug.a;" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Option projectLinkerOptionsRelation="2" />
+ </Target>
+ <Target title="Release">
+ <Option output="bin/$(PROJECT_NAME)" prefix_auto="1" extension_auto="1" />
+ <Option working_dir="bin" />
+ <Option object_output="obj/Release/" />
+ <Option external_deps="../../../libs/openFrameworksCompiled/lib/linux/libopenFrameworks.a;" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Option projectLinkerOptionsRelation="2" />
+ </Target>
+ </Build>
+ <Unit filename="../../../addons/ofxMidi/libs/RtError.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/libs/RtMidi.cpp">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/libs/RtMidi.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/src/ofxMidi.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/src/ofxMidiConstants.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/src/ofxMidiEvents.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/src/ofxMidiIn.cpp">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/src/ofxMidiIn.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/src/ofxMidiOut.cpp">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxMidi/src/ofxMidiOut.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxXmlSettings/libs/tinyxml.cpp">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxXmlSettings/libs/tinyxml.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxXmlSettings/libs/tinyxmlerror.cpp">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxXmlSettings/libs/tinyxmlparser.cpp">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxXmlSettings/src/ofxXmlSettings.cpp">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="../../../addons/ofxXmlSettings/src/ofxXmlSettings.h">
+ <Option virtualFolder="addons/" />
+ </Unit>
+ <Unit filename="bin/data/settings.xml">
+ <Option virtualFolder="build config/" />
+ </Unit>
+ <Unit filename="config.make">
+ <Option virtualFolder="build config" />
+ </Unit>
+ <Unit filename="mapping.txt">
+ <Option virtualFolder="build config/" />
+ </Unit>
+ <Unit filename="src/globeLayer.cpp">
+ <Option virtualFolder="src/" />
+ </Unit>
+ <Unit filename="src/globeLayer.h">
+ <Option virtualFolder="src/" />
+ </Unit>
+ <Unit filename="src/main.cpp">
+ <Option virtualFolder="src/" />
+ </Unit>
+ <Unit filename="src/testApp.cpp">
+ <Option virtualFolder="src/" />
+ </Unit>
+ <Unit filename="src/testApp.h">
+ <Option virtualFolder="src/" />
+ </Unit>
+ <Extensions>
+ <code_completion />
+ <envvars />
+ <debugger />
+ </Extensions>
+ </Project>
+</CodeBlocks_project_file>
diff --git a/globePlayer02.layout b/globePlayer02.layout
new file mode 100644
index 0000000..a6a3e93
--- /dev/null
+++ b/globePlayer02.layout
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_layout_file>
+ <ActiveTarget name="Release" />
+ <File name="bin/data/settings.xml" open="1" top="0" tabpos="2">
+ <Cursor position="517" topLine="0" />
+ </File>
+ <File name="config.make" open="1" top="0" tabpos="6">
+ <Cursor position="312" topLine="0" />
+ </File>
+ <File name="mapping.txt" open="0" top="0" tabpos="7">
+ <Cursor position="323" topLine="0" />
+ </File>
+ <File name="src/globeLayer.cpp" open="1" top="0" tabpos="1">
+ <Cursor position="1558" topLine="217" />
+ </File>
+ <File name="src/globeLayer.h" open="1" top="0" tabpos="3">
+ <Cursor position="1753" topLine="50" />
+ </File>
+ <File name="src/main.cpp" open="1" top="0" tabpos="5">
+ <Cursor position="1" topLine="0" />
+ </File>
+ <File name="src/testApp.cpp" open="1" top="0" tabpos="4">
+ <Cursor position="3303" topLine="16" />
+ </File>
+ <File name="src/testApp.h" open="1" top="1" tabpos="7">
+ <Cursor position="605" topLine="0" />
+ </File>
+</CodeBlocks_layout_file>
diff --git a/globePlayer02.workspace b/globePlayer02.workspace
new file mode 100644
index 0000000..b7cd3f2
--- /dev/null
+++ b/globePlayer02.workspace
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<CodeBlocks_workspace_file>
+ <Workspace title="movieGrabberExample">
+ <Project filename="movieGrabberExample.cbp" active="1">
+ <Depends filename="../../../libs/openFrameworksCompiled/project/linux/libopenFrameworks.cbp"/>
+ </Project>
+ <Project filename="../../../libs/openFrameworksCompiled/project/linux/libopenFrameworks.cbp"/>
+ </Workspace>
+</CodeBlocks_workspace_file>
diff --git a/mapping.txt b/mapping.txt
new file mode 100755
index 0000000..8a66ecf
--- /dev/null
+++ b/mapping.txt
@@ -0,0 +1,20 @@
+
+P4
+cc 17h 18h 19h 1Ah 1Bh 1Ch 1Dh 1Eh
+no 18h 1Ah 1Ch 1Dh 1Fh 21h 23h 24h
+no 00h 02h 04h 05h 07h 09h 0Bh 0Ch
+cc 08h 09h 0Ah 0Ch 0Dh 0Eh 0Fh 10h
+
+
+dec
+
+23 24 25 26 27 28 29 30
+
+24 26 28 29 31 33 35 36
+00 02 04 05 07 09 11 12
+
+08 09 10 12 13 14 15 16
+
+
+
+rem globe at end- after 'encore' during name callout
diff --git a/src/globeLayer.cpp b/src/globeLayer.cpp
new file mode 100755
index 0000000..17b1fec
--- /dev/null
+++ b/src/globeLayer.cpp
@@ -0,0 +1,277 @@
+#include "globeLayer.h"
+globeLayer::globeLayer()
+{
+ x=y=0.0f;
+ w=ofGetWindowWidth();
+ h=ofGetWindowHeight();
+ mixAmount=1.0f;
+}
+globeLayer::globeLayer(map<string,string> * _settings)
+{
+ settings=map<string,string>(*_settings);
+ x=ofToFloat(settings["x"]);
+ y=ofToFloat(settings["y"]);
+ w=ofToFloat(settings["w"]);
+ h=ofToFloat(settings["h"]);
+ note=ofToInt(settings["note"]);
+ mix=ofToInt(settings["mix"]);
+ if (mix>0) mixAmount=0.0f;
+ else mixAmount=1.0f;
+ active=false;
+
+ printf("layer created, %fx%f\n",w,h);
+}
+void globeLayer::draw() {
+ if (mixAmount<1.0f) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_CONSTANT_ALPHA,GL_ONE);
+ glBlendColor(1.0f,1.0f,1.0f, mixAmount);
+ }
+ else glDisable(GL_BLEND);
+}
+void globeLayer::update() {
+}
+void globeLayer::setActive(bool _active){
+ active=_active;
+}
+/*
+void globeLayer::setMixAmt(float _mixAmt){
+ mixAmount=_mixAmt;
+}
+*/
+void globeLayer::CC(int _controller,int _value) {
+ if (_controller==mix) mixAmount=((float)_value)/127.0f;
+ //printf("layer: mix %f\n",mixAmount);
+}
+
+//====================================================
+
+globePlayer::globePlayer(map<string,string> * _settings)
+:globeLayer(_settings)
+{
+ fileName=settings["name"];
+ if(player.loadMovie(fileName)) {
+ printf("globePlayer: loaded %s\n",fileName.c_str());
+ player.setLoopState(OF_LOOP_NORMAL);
+ }
+ else printf("globePlayer: could not load %s\n",fileName.c_str());
+
+ isPlaying=false;
+}
+globePlayer::~globePlayer()
+{
+
+}
+void globePlayer::CC(int _controller,int _value){
+ globeLayer::CC(_controller,_value);
+}
+
+void globePlayer::update()
+{
+ if (!isPlaying&&active) {
+ player.setFrame(0);
+ player.setSpeed(1.0f);
+ player.play();
+ isPlaying=true;
+ }
+ if (isPlaying&&!active) {
+ player.stop();
+ isPlaying=false;
+ }
+ if (active) player.idleMovie();
+
+}
+void globePlayer::draw()
+{
+ if (active) {
+ globeLayer::draw();
+ player.draw(x,y,w,h);
+ }
+}
+
+//====================================================
+
+globeGrabber::globeGrabber(map<string,string> * _settings)
+:globeLayer(_settings)
+{
+ camWidth=ofToInt(settings["grabW"]);
+ camHeight=ofToInt(settings["grabH"]);
+
+ //grabber.setVerbose(true);
+ grabber.listDevices();
+ int device=ofToInt(settings["device"]);
+ if (device>0) {
+ //grabber.setDeviceID(device);
+ printf("using device %i\n",device);
+ }
+ grabber.initGrabber(camWidth,camHeight);
+
+ deInterlace=ofToInt(settings["deInt"])!=0;
+
+ outTexture.allocate(camWidth,camHeight, GL_RGB);
+
+ gammamap=new unsigned char[256];
+ line1=new unsigned char[camWidth];
+ line2=new unsigned char[camWidth];
+ outBuffer=new unsigned char[camWidth*camHeight*3];
+
+ whitePt=ofToFloat(settings["whitePoint"]);
+ blackPt=ofToFloat(settings["blackPoint"]);
+ gamma=ofToFloat(settings["gamma"]);
+
+ whitePCtl=ofToInt(settings["whitePtCtl"]);
+ blackPCtl=ofToInt(settings["blackPtCtl"]);
+ gammaCtl=ofToInt(settings["gammaCtl"]);
+ devCtl=ofToInt(settings["devCtl"]);
+
+ redCtl=ofToInt(settings["redCtl"]);
+ blueCtl=ofToInt(settings["blueCtl"]);
+ greenCtl=ofToInt(settings["greenCtl"]);
+
+ calcGammaMap();
+
+ lineOffset=ofToInt("lineOffset");
+
+ field2=false;
+ use2fields=true;
+
+ red=green=blue=1.0;
+
+
+
+ flip=false;
+ flipCtl=ofToInt(settings["flipCtl"]);
+
+ printf("grabber: RGB %f,%f,%f %f-%f-%f\n",red,green,blue,whitePt,blackPt,gamma);
+}
+globeGrabber::~globeGrabber()
+{
+}
+void globeGrabber::calcGammaMap(){
+ for (int i=0;i<256;i++){
+ //gammamap[i]=(unsigned char)(min(1.0f,pow(max(0.0f,(float(i)/180.0f)-0.4f),0.5f))*255.0);
+
+ float ewp=max(whitePt,blackPt+0.1f); //limit range to 0.1
+ gammamap[i]=(unsigned char)(pow(min(1.0f,max(0.0f,(((float(i)/255.0f)-blackPt)/(ewp-blackPt)))),gamma)*255.0);
+ }
+}
+unsigned char globeGrabber::gsGammaMap(unsigned char *pixel) {
+ return gammamap[(unsigned char)((((int(pixel[0])*76)+(int(pixel[1])*150)+(int(pixel[2]))*28))>>8)];
+}
+void globeGrabber::CC(int _controller,int _value){
+ globeLayer::CC(_controller,_value);
+ //add some colour settings
+ if (_controller==whitePCtl||_controller==blackPCtl||_controller==gammaCtl){
+ if (_controller==whitePCtl) whitePt=((float)_value)/127.0;
+ if (_controller==blackPCtl) blackPt=((float)_value)/127.0;
+ if (_controller==gammaCtl) gamma=(((float)_value)/63.0)+0.1f; //0.1-2.1
+ calcGammaMap();
+ }
+ if (_controller==redCtl) red=((float)_value)/127.0;
+ if (_controller==blueCtl) blue=((float)_value)/127.0;
+ if (_controller==greenCtl) green=((float)_value)/127.0;
+ if (_controller==flipCtl) flip=_value>63;
+ if (_controller==devCtl) {
+ grabber.close();
+ grabber.setDeviceID(_value);
+ grabber.initGrabber(camWidth,camHeight);
+ printf("Grabber changed to device %i\n",_value);
+
+ }
+
+ //printf("grabber: RGB %f,%f,%f %f-%f-%f\n",red,green,blue,blackPt,gamma,whitePt);
+}
+void globeGrabber::update()
+{
+ if (active) grabber.grabFrame();
+ if (grabber.isFrameNew()){
+ int time=ofGetElapsedTimeMillis();
+ frameTime=time-grabTime;
+ grabTime=time;
+ unsigned char * pixels = grabber.getPixels();
+ if(!deInterlace) {
+ int totalPixels = camWidth*camHeight;
+ for (int i = 0; i < totalPixels; i++){
+ unsigned char gs=(unsigned char)((int(pixels[i*3])+int(pixels[i*3+1])+int(pixels[i*3+2]))/3);
+ outBuffer[i*3] = gammamap[gs];
+ outBuffer[i*3+1] = gammamap[gs];
+ outBuffer[i*3+2] = gammamap[gs];
+ }
+ }
+ else {
+ field2=true;
+ unsigned char* lp1=line1;
+ unsigned char* lp2=line2;
+ unsigned char* tp;
+ int j = 0;
+ for (int i=0;i<camWidth;i++) lp1[i]=gsGammaMap(&pixels[(((j*camWidth)+i)*3)]);
+ //lp1[i]=gammamap[(unsigned char)((int(pixels[(((j*camWidth)+i)*3)])+int(pixels[(((j*camWidth)+i)*3)+1])+int(pixels[(((j*camWidth)+i)*3)+2]))/3)];//
+ //lp1[i]=gsGammaMap(&pixels[(((j*camWidth)+i)*3)]);
+ //
+ for (j = 2; j < camHeight; j+=2){
+ for (int i=0;i<camWidth;i++) {
+ //lp2[i]=gsGammaMap(&pixels[(((j*camWidth)+i)*3)]);
+ lp2[i]=gammamap[(unsigned char)((int(pixels[(((j*camWidth)+i)*3)])+int(pixels[(((j*camWidth)+i)*3)+1])+int(pixels[(((j*camWidth)+i)*3)+2]))/3)];
+ unsigned char mp=(unsigned char)((int(lp1[i])+int(lp2[i]))/2);
+ outBuffer[(j*camWidth+i)*3] = mp;
+ outBuffer[(j*camWidth+i)*3+1] = mp;
+ outBuffer[(j*camWidth+i)*3+2] = mp;
+ outBuffer[((j+1)*camWidth+i)*3] = lp2[i];
+ outBuffer[((j+1)*camWidth+i)*3+1] = lp2[i];
+ outBuffer[((j+1)*camWidth+i)*3+2] = lp2[i];
+ }
+ tp=lp1;
+ lp1=lp2;
+ lp2=tp;
+ }
+ }
+ outTexture.loadData(outBuffer, camWidth,camHeight, GL_RGB);
+ }
+ if (deInterlace&&use2fields&&field2&&((ofGetElapsedTimeMillis()-grabTime)>=(frameTime/2))){
+ field2=false;
+ unsigned char * pixels = grabber.getPixels();
+ unsigned char* lp1=line1;
+ unsigned char* lp2=line2;
+ unsigned char* tp;
+ int j = 1;
+ for (int i=0;i<camWidth;i++) lp1[i]=gammamap[(unsigned char)((int(pixels[(((j*camWidth)+i)*3)])+int(pixels[(((j*camWidth)+i)*3)+1])+int(pixels[(((j*camWidth)+i)*3)+2]))/3)];
+ for (j = 3; j < camHeight-1; j+=2){
+ for (int i=0;i<camWidth;i++) {
+ lp2[i]=gammamap[(unsigned char)((int(pixels[(((j*camWidth)+i)*3)])+int(pixels[(((j*camWidth)+i)*3)+1])+int(pixels[(((j*camWidth)+i)*3)+2]))/3)];
+ char mp=(unsigned char)((int(lp1[i])+int(lp2[i]))/2);
+ outBuffer[(j*camWidth+i)*3] = mp;
+ outBuffer[(j*camWidth+i)*3+1] = mp;
+ outBuffer[(j*camWidth+i)*3+2] = mp;
+ outBuffer[((j+1)*camWidth+i)*3] = lp2[i];
+ outBuffer[((j+1)*camWidth+i)*3+1] = lp2[i];
+ outBuffer[((j+1)*camWidth+i)*3+2] = lp2[i];
+ }
+ tp=lp1;
+ lp1=lp2;
+ lp2=tp;
+ }
+ outTexture.loadData(outBuffer, camWidth,camHeight, GL_RGB);
+ }
+
+}
+void globeGrabber::draw()
+{
+
+ if (active) {
+ //globeLayer::draw();
+ /*
+ if (mixAmount<1.0f) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_CONSTANT_ALPHA,GL_ONE);
+ glBlendColor(red,green,blue, mixAmount);
+ }
+ else glDisable(GL_BLEND);
+ */
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_CONSTANT_COLOR,GL_ONE);
+ glBlendColor(red*mixAmount,green*mixAmount,blue*mixAmount, 1.0f);
+ if (flip) outTexture.draw(x+w,y,-w,h);
+ else outTexture.draw(x,y,w,h);
+ }
+
+}
diff --git a/src/globeLayer.h b/src/globeLayer.h
new file mode 100755
index 0000000..781750a
--- /dev/null
+++ b/src/globeLayer.h
@@ -0,0 +1,101 @@
+#ifndef GLOBELAYER_H
+#define GLOBELAYER_H
+
+#include "ofMain.h"
+
+class globeLayer
+{
+ public:
+ globeLayer();
+ globeLayer(map<string,string> * _settings);
+
+ virtual void update();
+ virtual void draw();
+ void setActive(bool _active);
+ //void setMixAmt(float _mixAmt);
+
+ int note,mix; //midi note to play and controller to mix
+
+ virtual void CC(int _controller,int _value); //control change is sent to all channels
+
+ //colour changing and setting functions
+ protected:
+ float x,y; //pos on screen
+ float w,h; //size on screen
+ bool active;
+ float mixAmount;
+
+ map<string,string>settings; //copy of settings key (is neecesary?)
+ //char* CCs; //registers interest for midi CC messages
+
+ private:
+
+};
+
+
+class globePlayer: public globeLayer
+{
+ public:
+ globePlayer();
+ globePlayer(map<string,string> * _settings);
+ ~globePlayer();
+
+ void update();
+ void draw();
+
+ void CC(int _controller,int _value); //have to override virtual function
+
+ private:
+ bool isPlaying;
+ string fileName;
+ ofVideoPlayer player;
+};
+
+class globeGrabber: public globeLayer
+{
+ public:
+ globeGrabber();
+ globeGrabber(map<string,string> * _settings);
+ ~globeGrabber();
+
+ void update();
+ void draw();
+
+ void CC(int _controller,int _value); //add some colour settings
+
+ protected:
+ void calcGammaMap();
+
+ private:
+ bool isPlaying;
+
+ ofVideoGrabber grabber;
+
+ int camWidth,camHeight;
+
+ unsigned char* gammamap;
+ unsigned char gsGammaMap(unsigned char *pixel);
+
+ unsigned char* line1;
+ unsigned char* line2;
+ bool deInterlace;
+ ofTexture outTexture;
+
+ unsigned char* outBuffer;
+
+ bool field2; //flag that there is a 2nd field waiting to be processed
+ bool use2fields;
+ int frameTime,grabTime; //keep track of field timing
+
+ int whitePCtl,blackPCtl,gammaCtl,redCtl,blueCtl,greenCtl,devCtl;
+ float whitePt,blackPt,gamma;
+
+ float red,green,blue;
+
+ int lineOffset;
+ bool flip;
+ int flipCtl;
+
+};
+
+#endif // GLOBELAYER_H
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100755
index 0000000..6809b1c
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,17 @@
+#include "ofMain.h"
+#include "testApp.h"
+#include "ofAppGlutWindow.h"
+
+//========================================================================
+int main( ){
+
+ ofAppGlutWindow window;
+ //ofSetupOpenGL(&window, 1440,900, OF_FULLSCREEN); // <-------- setup the GL context
+ ofSetupOpenGL(&window, 1024,768, OF_FULLSCREEN);
+
+ // this kicks off the running of my app
+ // can be OF_WINDOW or OF_FULLSCREEN
+ // pass in width and height too:
+ ofRunApp( new testApp());
+
+}
diff --git a/src/testApp.cpp b/src/testApp.cpp
new file mode 100755
index 0000000..ab5fcbb
--- /dev/null
+++ b/src/testApp.cpp
@@ -0,0 +1,199 @@
+#include "testApp.h"
+
+
+//--------------------------------------------------------------
+void testApp::setup(){
+ int midiPort=0;
+ midiChannel=0;
+ numLayers=0;
+ if( !XML.loadFile("settings.xml") ){
+ printf("unable to load settings.xml check data/ folder\n");
+ }else{
+ printf("settings loaded!\n");
+ midiPort=ofToInt(XML.getAttribute("globePlayer", "port", "0")); //default to 0/all
+ midiChannel=ofToInt(XML.getAttribute("globePlayer", "channel", "0"));
+ if (midiChannel) printf("listening on midi channel %d\n",midiChannel);
+ else printf("listening on all midi channels\n");
+ if(XML.pushTag("globePlayer")) {
+ numLayers=XML.getNumTags("layer");
+ if(numLayers) {
+ layers=new globeLayer*[numLayers];
+ for (int i=0;i<numLayers;i++){
+ XML.pushTag("layer",i);
+ string layerType=XML.getAttribute("content", "type", "");
+ XML.pushTag("content");
+ vector<string>keys;
+ XML.getAttributeNames("settings", keys, 0);
+ map<string,string> settings;
+ for (int k=0;k<keys.size();k++) {
+ settings[keys[k]]=XML.getAttribute("settings",keys[k],"none",0);
+ }
+ if (layerType=="player") layers[i]=new globePlayer(&settings);
+ if (layerType=="grabber") layers[i]=new globeGrabber(&settings);
+ XML.popTag();
+ XML.popTag();
+ }
+ }
+ }
+ if (numLayers==0) printf("no layers loaded!\n");
+ }
+
+ midiIn.listPorts();
+ midiIn.openPort(midiPort);
+ midiIn.addListener(this);
+
+ // to register only to one controller pass the id as first argument
+ // midiIn.addListener(84,this);
+
+ // to debug
+ // midiIn.setVerbose(true);
+ showFPS=false;
+}
+
+//--------------------------------------------------------------
+void testApp::update(){
+ for (int i=0;i<numLayers;i++) layers[i]->update();
+}
+
+//--------------------------------------------------------------
+void testApp::draw(){
+ ofBackground(0,0,0);
+
+ for (int i=0;i<numLayers;i++) layers[i]->draw();
+
+ if (showFPS) ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20);
+
+}
+
+//--------------------------------------------------------------
+void testApp::keyPressed (int key){
+ if(key == 's'){
+ XML.saveFile("settings.xml");
+ printf("settings saved!\n");
+ }
+ if(key == 'f'){
+ toggleFPS();
+ }
+ if(key=='1'){
+ layers[0]->setActive(100);
+ layers[0]->CC(8,127);
+ }
+ if(key=='q'){
+ layers[0]->setActive(0);
+ layers[0]->CC(8,0);
+ }
+ if(key=='2'){
+ layers[1]->setActive(100);
+ layers[1]->CC(9,127);
+ }
+ if(key=='w'){
+ layers[1]->setActive(0);
+ layers[1]->CC(9,0);
+ }
+ if(key=='3'){
+ layers[2]->setActive(100);
+ layers[2]->CC(10,127);
+ }
+ if(key=='e'){
+ layers[2]->setActive(0);
+ layers[2]->CC(10,0);
+ }
+ if(key=='7'){
+ layers[2]->CC(20,3);
+ printf("changing to device 3\n");
+
+ }
+ if(key=='8'){
+ layers[2]->CC(20,4);
+ printf("changing to device 4\n");
+ }
+ //this doesn't seem to arrive
+ if(key=='4'){
+ layers[3]->setActive(100);
+ layers[3]->CC(16,127);
+ }
+ if(key=='r'){
+ layers[3]->setActive(0);
+ layers[3]->CC(16,0);
+ }
+
+}
+
+//--------------------------------------------------------------
+void testApp::keyReleased(int key){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseMoved(int x, int y ){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseDragged(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseReleased(int x, int y, int button){
+
+
+}
+void testApp::mousePressed(int x, int y, int button) {
+}
+
+//--------------------------------------------------------------
+void testApp::windowResized(int w, int h){
+
+}
+
+//--------------------------------------------------------------
+void testApp::gotMessage(ofMessage msg){
+
+}
+
+//--------------------------------------------------------------
+void testApp::dragEvent(ofDragInfo dragInfo){
+
+}
+
+void testApp::toggleFPS(){
+ showFPS=!showFPS;
+}
+
+void testApp::newMidiMessage(ofxMidiEventArgs& eventArgs){
+
+ //newMessage(eventArgs.port, eventArgs.channel, eventArgs.byteTwo, eventArgs.timestamp);
+
+//byteOne : message type
+
+ /*
+ int port;
+ int channel;
+ int status;
+ int byteOne;
+ int byteTwo;
+ double timestamp;
+ */
+
+ //printf("%d %d %d %d %d\n",eventArgs.port,eventArgs.channel,eventArgs.status,eventArgs.byteOne,eventArgs.byteTwo);
+
+ bool noteOn; //this old thing!
+
+ if ((midiChannel==0)||(eventArgs.channel==midiChannel)) {
+ switch(eventArgs.status) {
+ case 144: //noteon-off
+ noteOn=(eventArgs.byteTwo==0?false:true);
+ for (int i=0;i<numLayers;i++){
+ if (layers[i]->note==eventArgs.byteOne) layers[i]->setActive(noteOn);
+ }
+ break;
+ case 176: //control change
+ for (int i=0;i<numLayers;i++){
+ //if (layers[i]->mix==eventArgs.byteOne) layers[i]->setMixAmt(((float)eventArgs.byteTwo)/127.0f);
+ layers[i]->CC(eventArgs.byteOne,eventArgs.byteTwo);
+ }
+ }
+ }
+}
+
diff --git a/src/testApp.h b/src/testApp.h
new file mode 100755
index 0000000..df989df
--- /dev/null
+++ b/src/testApp.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "ofMain.h"
+#include "ofxXmlSettings.h"
+
+#include "globeLayer.h"
+
+#define OF_ADDON_USING_OFXMIDIIN
+
+#include "ofxMidi.h"
+
+class testApp : public ofBaseApp, public ofxMidiListener{
+
+ public:
+
+ void setup();
+ void update();
+ void draw();
+
+ void keyPressed(int key);
+ void keyReleased(int key);
+ void mouseMoved(int x, int y );
+ void mouseDragged(int x, int y, int button);
+ void mousePressed(int x, int y, int button);
+ void mouseReleased(int x, int y, int button);
+ void windowResized(int w, int h);
+ void dragEvent(ofDragInfo dragInfo);
+ void gotMessage(ofMessage msg);
+
+ void toggleFPS();
+ bool showFPS;
+
+ ofxXmlSettings XML;
+
+ globeLayer** layers;
+ int numLayers;
+
+ int midiChannel;
+ ofxMidiIn midiIn;
+ void newMidiMessage(ofxMidiEventArgs& eventArgs);
+};
+