You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
(43) |
May
(14) |
Jun
(17) |
Jul
(19) |
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(19) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(13) |
Feb
(15) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mc...@us...> - 2011-01-09 18:03:34
|
Revision: 263 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=263&view=rev Author: mchinen Date: 2011-01-09 18:03:27 +0000 (Sun, 09 Jan 2011) Log Message: ----------- fix bubble sort colors Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/bubble.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/bubble.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/bubble.cpp 2011-01-06 03:22:58 UTC (rev 262) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/bubble.cpp 2011-01-09 18:03:27 UTC (rev 263) @@ -47,7 +47,7 @@ Order(&something[j-1], &something[j]); // first look and "Order" the last two values of array and then decrement until i (beginning of array) // takes same amount of time for best and worst case. - printdoublearray(something, n,j-1,2); // sonification what happens here? + printdoublearray(something, n, 0, 0, j-1, j); // sonification what happens here? if(SortingMan::Instance()->ShouldStop()) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2011-01-06 03:23:04
|
Revision: 262 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=262&view=rev Author: mchinen Date: 2011-01-06 03:22:58 +0000 (Thu, 06 Jan 2011) Log Message: ----------- remove ofxfbo include Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2011-01-05 15:27:13 UTC (rev 261) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2011-01-06 03:22:58 UTC (rev 262) @@ -9,7 +9,6 @@ #include "SquaresView.h" #include "BarsView.h" #include "ConsoleView.h" -#include "ofxFbo.h" #define kSquaresViewIndex 0 #define kBarsViewIndex 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2011-01-05 15:27:19
|
Revision: 261 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=261&view=rev Author: mchinen Date: 2011-01-05 15:27:13 +0000 (Wed, 05 Jan 2011) Log Message: ----------- remove ofxFBO Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2011-01-04 15:08:19 UTC (rev 260) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2011-01-05 15:27:13 UTC (rev 261) @@ -27,7 +27,6 @@ 840F2DF911E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840F2DF811E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp */; }; 8416E04411DA9FBA003A3B23 /* openFrameworks.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8416E04311DA9FBA003A3B23 /* openFrameworks.a */; }; 8416E0EC11DDFCA0003A3B23 /* cleanerinsert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */; }; - 843BC38D12D143470040A3BC /* ofxFbo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 843BC38B12D143470040A3BC /* ofxFbo.cpp */; }; 843BC56112D2B8240040A3BC /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 843BC56012D2B8240040A3BC /* OpenGL.framework */; }; 843BC96E12D363B20040A3BC /* ImageWriterSquaresView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 843BC96D12D363B20040A3BC /* ImageWriterSquaresView.cpp */; }; 8448D52B12B5AD03003E0F48 /* ConsoleView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */; }; @@ -157,8 +156,6 @@ 840F2DF811E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxSimpleGuiTextInput.cpp; sourceTree = "<group>"; }; 8416E04311DA9FBA003A3B23 /* openFrameworks.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = openFrameworks.a; path = ../../../../of/of_preRelease_v0061_osx_FAT/libs/openFrameworksCompiled/lib/osx/openFrameworks.a; sourceTree = SOURCE_ROOT; }; 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cleanerinsert.cpp; sourceTree = "<group>"; }; - 843BC38B12D143470040A3BC /* ofxFbo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxFbo.cpp; sourceTree = "<group>"; }; - 843BC38C12D143470040A3BC /* ofxFbo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxFbo.h; sourceTree = "<group>"; }; 843BC56012D2B8240040A3BC /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; 843BC96C12D363B20040A3BC /* ImageWriterSquaresView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageWriterSquaresView.h; sourceTree = "<group>"; }; 843BC96D12D363B20040A3BC /* ImageWriterSquaresView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = ImageWriterSquaresView.cpp; sourceTree = "<group>"; tabWidth = 3; usesTabs = 0; }; @@ -350,24 +347,6 @@ path = Controls; sourceTree = "<group>"; }; - 843BC38912D143470040A3BC /* ofxFBO */ = { - isa = PBXGroup; - children = ( - 843BC38A12D143470040A3BC /* src */, - ); - name = ofxFBO; - path = "lib-src/ofxFBO"; - sourceTree = "<group>"; - }; - 843BC38A12D143470040A3BC /* src */ = { - isa = PBXGroup; - children = ( - 843BC38B12D143470040A3BC /* ofxFbo.cpp */, - 843BC38C12D143470040A3BC /* ofxFbo.h */, - ); - path = src; - sourceTree = "<group>"; - }; 847D386012ABC55E006E9CA2 /* src */ = { isa = PBXGroup; children = ( @@ -381,7 +360,6 @@ 84BFF66D11C4CD9C000DB417 /* addons */ = { isa = PBXGroup; children = ( - 843BC38912D143470040A3BC /* ofxFBO */, 847D386012ABC55E006E9CA2 /* src */, 840F2CCA11E788F200C5CD20 /* src */, 840F2C9211E7869C00C5CD20 /* src */, @@ -883,7 +861,6 @@ 847D3AF712AD91F4006E9CA2 /* BarsView.cpp in Sources */, 847D3AF812AD91F4006E9CA2 /* SquaresView.cpp in Sources */, 8448D52B12B5AD03003E0F48 /* ConsoleView.cpp in Sources */, - 843BC38D12D143470040A3BC /* ofxFbo.cpp in Sources */, 843BC96E12D363B20040A3BC /* ImageWriterSquaresView.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2011-01-04 15:08:26
|
Revision: 260 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=260&view=rev Author: mchinen Date: 2011-01-04 15:08:19 +0000 (Tue, 04 Jan 2011) Log Message: ----------- add save image capability Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.h algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h Added Paths: ----------- algorhythmicSorting/ofAlgorhythmicSorting/src/ImageWriterSquaresView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/ImageWriterSquaresView.h Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2011-01-02 22:36:01 UTC (rev 259) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2011-01-04 15:08:19 UTC (rev 260) @@ -27,25 +27,10 @@ 840F2DF911E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840F2DF811E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp */; }; 8416E04411DA9FBA003A3B23 /* openFrameworks.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8416E04311DA9FBA003A3B23 /* openFrameworks.a */; }; 8416E0EC11DDFCA0003A3B23 /* cleanerinsert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */; }; + 843BC38D12D143470040A3BC /* ofxFbo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 843BC38B12D143470040A3BC /* ofxFbo.cpp */; }; + 843BC56112D2B8240040A3BC /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 843BC56012D2B8240040A3BC /* OpenGL.framework */; }; + 843BC96E12D363B20040A3BC /* ImageWriterSquaresView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 843BC96D12D363B20040A3BC /* ImageWriterSquaresView.cpp */; }; 8448D52B12B5AD03003E0F48 /* ConsoleView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */; }; - 8448DA5812B67424003E0F48 /* libcairo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3012B67424003E0F48 /* libcairo.a */; }; - 8448DA5912B67424003E0F48 /* libcharset.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3112B67424003E0F48 /* libcharset.a */; }; - 8448DA5A12B67424003E0F48 /* libgettextpo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3212B67424003E0F48 /* libgettextpo.a */; }; - 8448DA5B12B67424003E0F48 /* libgio-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3312B67424003E0F48 /* libgio-2.0.a */; }; - 8448DA5C12B67424003E0F48 /* libglib-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3412B67424003E0F48 /* libglib-2.0.a */; }; - 8448DA5D12B67424003E0F48 /* libgmodule-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3512B67424003E0F48 /* libgmodule-2.0.a */; }; - 8448DA5E12B67424003E0F48 /* libgobject-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3612B67424003E0F48 /* libgobject-2.0.a */; }; - 8448DA5F12B67424003E0F48 /* libgthread-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3712B67424003E0F48 /* libgthread-2.0.a */; }; - 8448DA6012B67424003E0F48 /* libiconv.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3812B67424003E0F48 /* libiconv.a */; }; - 8448DA6112B67424003E0F48 /* libintl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3912B67424003E0F48 /* libintl.a */; }; - 8448DA6212B67424003E0F48 /* libpango-1.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3A12B67424003E0F48 /* libpango-1.0.a */; }; - 8448DA6312B67424003E0F48 /* libpangocairo-1.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3B12B67424003E0F48 /* libpangocairo-1.0.a */; }; - 8448DA6412B67424003E0F48 /* libpixman-1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3C12B67424003E0F48 /* libpixman-1.a */; }; - 8448DA6512B67424003E0F48 /* ofxPango.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA4D12B67424003E0F48 /* ofxPango.cpp */; }; - 8448DA6612B67424003E0F48 /* ofxPCContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA4F12B67424003E0F48 /* ofxPCContext.cpp */; }; - 8448DA6712B67424003E0F48 /* ofxPCPangoFontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA5112B67424003E0F48 /* ofxPCPangoFontDescription.cpp */; }; - 8448DA6812B67424003E0F48 /* ofxPCPangoLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA5312B67424003E0F48 /* ofxPCPangoLayout.cpp */; }; - 8448DA6912B67424003E0F48 /* ofxPCSurface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA5512B67424003E0F48 /* ofxPCSurface.cpp */; }; 847D385D12ABC4E6006E9CA2 /* ofxMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */; }; 847D386312ABC55E006E9CA2 /* ofxThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D386112ABC55E006E9CA2 /* ofxThread.cpp */; }; 847D3AF612AD91F4006E9CA2 /* ArrayView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D3AF012AD91F4006E9CA2 /* ArrayView.cpp */; }; @@ -70,14 +55,12 @@ 84BFF8AB11C4F069000DB417 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84BFF8AA11C4F069000DB417 /* AudioUnit.framework */; }; E45BE0AA0E8CC67C009D7055 /* GLee.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE0A90E8CC67C009D7055 /* GLee.a */; }; E45BE2E40E8CC69C009D7055 /* rtAudio.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE2E30E8CC69C009D7055 /* rtAudio.a */; }; - E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9710E8CC7DD009D7055 /* AGL.framework */; }; E45BE97C0E8CC7DD009D7055 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9720E8CC7DD009D7055 /* ApplicationServices.framework */; }; E45BE97D0E8CC7DD009D7055 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9730E8CC7DD009D7055 /* AudioToolbox.framework */; }; E45BE97E0E8CC7DD009D7055 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9740E8CC7DD009D7055 /* Carbon.framework */; }; E45BE97F0E8CC7DD009D7055 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9750E8CC7DD009D7055 /* CoreAudio.framework */; }; E45BE9800E8CC7DD009D7055 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9760E8CC7DD009D7055 /* CoreFoundation.framework */; }; E45BE9810E8CC7DD009D7055 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9770E8CC7DD009D7055 /* CoreServices.framework */; }; - E45BE9830E8CC7DD009D7055 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9790E8CC7DD009D7055 /* OpenGL.framework */; }; E45BE9840E8CC7DD009D7055 /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE97A0E8CC7DD009D7055 /* QuickTime.framework */; }; E4B69E200A3A1BDC003C02F2 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B69E1D0A3A1BDC003C02F2 /* main.cpp */; }; E4B69E210A3A1BDC003C02F2 /* testApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */; }; @@ -174,45 +157,13 @@ 840F2DF811E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxSimpleGuiTextInput.cpp; sourceTree = "<group>"; }; 8416E04311DA9FBA003A3B23 /* openFrameworks.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = openFrameworks.a; path = ../../../../of/of_preRelease_v0061_osx_FAT/libs/openFrameworksCompiled/lib/osx/openFrameworks.a; sourceTree = SOURCE_ROOT; }; 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cleanerinsert.cpp; sourceTree = "<group>"; }; + 843BC38B12D143470040A3BC /* ofxFbo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxFbo.cpp; sourceTree = "<group>"; }; + 843BC38C12D143470040A3BC /* ofxFbo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxFbo.h; sourceTree = "<group>"; }; + 843BC56012D2B8240040A3BC /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; + 843BC96C12D363B20040A3BC /* ImageWriterSquaresView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageWriterSquaresView.h; sourceTree = "<group>"; }; + 843BC96D12D363B20040A3BC /* ImageWriterSquaresView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = ImageWriterSquaresView.cpp; sourceTree = "<group>"; tabWidth = 3; usesTabs = 0; }; 8448D52912B5AD03003E0F48 /* ConsoleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleView.h; sourceTree = "<group>"; }; 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsoleView.cpp; sourceTree = "<group>"; }; - 8448DA3012B67424003E0F48 /* libcairo.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libcairo.a; sourceTree = "<group>"; }; - 8448DA3112B67424003E0F48 /* libcharset.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libcharset.a; sourceTree = "<group>"; }; - 8448DA3212B67424003E0F48 /* libgettextpo.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgettextpo.a; sourceTree = "<group>"; }; - 8448DA3312B67424003E0F48 /* libgio-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libgio-2.0.a"; sourceTree = "<group>"; }; - 8448DA3412B67424003E0F48 /* libglib-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libglib-2.0.a"; sourceTree = "<group>"; }; - 8448DA3512B67424003E0F48 /* libgmodule-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libgmodule-2.0.a"; sourceTree = "<group>"; }; - 8448DA3612B67424003E0F48 /* libgobject-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libgobject-2.0.a"; sourceTree = "<group>"; }; - 8448DA3712B67424003E0F48 /* libgthread-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libgthread-2.0.a"; sourceTree = "<group>"; }; - 8448DA3812B67424003E0F48 /* libiconv.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libiconv.a; sourceTree = "<group>"; }; - 8448DA3912B67424003E0F48 /* libintl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libintl.a; sourceTree = "<group>"; }; - 8448DA3A12B67424003E0F48 /* libpango-1.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libpango-1.0.a"; sourceTree = "<group>"; }; - 8448DA3B12B67424003E0F48 /* libpangocairo-1.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libpangocairo-1.0.a"; sourceTree = "<group>"; }; - 8448DA3C12B67424003E0F48 /* libpixman-1.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libpixman-1.a"; sourceTree = "<group>"; }; - 8448DA3E12B67424003E0F48 /* freetype6.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = freetype6.dll; sourceTree = "<group>"; }; - 8448DA3F12B67424003E0F48 /* libexpat-1.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libexpat-1.dll"; sourceTree = "<group>"; }; - 8448DA4012B67424003E0F48 /* libfontconfig-1.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libfontconfig-1.dll"; sourceTree = "<group>"; }; - 8448DA4112B67424003E0F48 /* libgio-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libgio-2.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4212B67424003E0F48 /* libglib-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libglib-2.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4312B67424003E0F48 /* libgmodule-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libgmodule-2.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4412B67424003E0F48 /* libgobject-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libgobject-2.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4512B67424003E0F48 /* libgthread-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libgthread-2.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4612B67424003E0F48 /* libpangoft2-1.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpangoft2-1.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4712B67424003E0F48 /* libpangowin32-1.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpangowin32-1.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4812B67424003E0F48 /* libpng14-14.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpng14-14.dll"; sourceTree = "<group>"; }; - 8448DA4A12B67424003E0F48 /* libcairo-2.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libcairo-2.dll"; sourceTree = "<group>"; }; - 8448DA4B12B67424003E0F48 /* libpango-1.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpango-1.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4C12B67424003E0F48 /* libpangocairo-1.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpangocairo-1.0-0.dll"; sourceTree = "<group>"; }; - 8448DA4D12B67424003E0F48 /* ofxPango.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPango.cpp; sourceTree = "<group>"; }; - 8448DA4E12B67424003E0F48 /* ofxPango.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPango.h; sourceTree = "<group>"; }; - 8448DA4F12B67424003E0F48 /* ofxPCContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPCContext.cpp; sourceTree = "<group>"; }; - 8448DA5012B67424003E0F48 /* ofxPCContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPCContext.h; sourceTree = "<group>"; }; - 8448DA5112B67424003E0F48 /* ofxPCPangoFontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPCPangoFontDescription.cpp; sourceTree = "<group>"; }; - 8448DA5212B67424003E0F48 /* ofxPCPangoFontDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPCPangoFontDescription.h; sourceTree = "<group>"; }; - 8448DA5312B67424003E0F48 /* ofxPCPangoLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPCPangoLayout.cpp; sourceTree = "<group>"; }; - 8448DA5412B67424003E0F48 /* ofxPCPangoLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPCPangoLayout.h; sourceTree = "<group>"; }; - 8448DA5512B67424003E0F48 /* ofxPCSurface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPCSurface.cpp; sourceTree = "<group>"; }; - 8448DA5612B67424003E0F48 /* ofxPCSurface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPCSurface.h; sourceTree = "<group>"; }; 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxMutex.cpp; sourceTree = "<group>"; }; 847D385C12ABC4E6006E9CA2 /* ofxMutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxMutex.h; sourceTree = "<group>"; }; 847D386112ABC55E006E9CA2 /* ofxThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxThread.cpp; sourceTree = "<group>"; }; @@ -221,7 +172,7 @@ 847D3AF112AD91F4006E9CA2 /* ArrayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayView.h; sourceTree = "<group>"; }; 847D3AF212AD91F4006E9CA2 /* BarsView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BarsView.cpp; sourceTree = "<group>"; }; 847D3AF312AD91F4006E9CA2 /* BarsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BarsView.h; sourceTree = "<group>"; }; - 847D3AF412AD91F4006E9CA2 /* SquaresView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SquaresView.cpp; sourceTree = "<group>"; }; + 847D3AF412AD91F4006E9CA2 /* SquaresView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = SquaresView.cpp; sourceTree = "<group>"; tabWidth = 3; usesTabs = 0; }; 847D3AF512AD91F4006E9CA2 /* SquaresView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SquaresView.h; sourceTree = "<group>"; }; 84BE5524119B20CA0092BDA7 /* handyfuncs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = handyfuncs.cpp; sourceTree = "<group>"; }; 84BE5525119B20CA0092BDA7 /* handyfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = handyfuncs.h; sourceTree = "<group>"; }; @@ -272,14 +223,12 @@ E45BE2E00E8CC69C009D7055 /* RtAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RtAudio.h; sourceTree = "<group>"; }; E45BE2E10E8CC69C009D7055 /* RtError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RtError.h; sourceTree = "<group>"; }; E45BE2E30E8CC69C009D7055 /* rtAudio.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = rtAudio.a; path = ../../../../of/of_preRelease_v0061_osx_FAT/libs/rtAudio/lib/osx/rtAudio.a; sourceTree = SOURCE_ROOT; }; - E45BE9710E8CC7DD009D7055 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; }; E45BE9720E8CC7DD009D7055 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; }; E45BE9730E8CC7DD009D7055 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; }; E45BE9740E8CC7DD009D7055 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; E45BE9750E8CC7DD009D7055 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; }; E45BE9760E8CC7DD009D7055 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; E45BE9770E8CC7DD009D7055 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; }; - E45BE9790E8CC7DD009D7055 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; E45BE97A0E8CC7DD009D7055 /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; }; E4B69B5B0A3A1756003C02F2 /* AlgorhythmicSortingDebug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AlgorhythmicSortingDebug.app; sourceTree = BUILT_PRODUCTS_DIR; }; E4B69E1D0A3A1BDC003C02F2 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = src/main.cpp; sourceTree = SOURCE_ROOT; }; @@ -307,14 +256,12 @@ 84BFF87B11C4E744000DB417 /* libportaudio.a in Frameworks */, E45BE0AA0E8CC67C009D7055 /* GLee.a in Frameworks */, E45BE2E40E8CC69C009D7055 /* rtAudio.a in Frameworks */, - E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */, E45BE97C0E8CC7DD009D7055 /* ApplicationServices.framework in Frameworks */, E45BE97D0E8CC7DD009D7055 /* AudioToolbox.framework in Frameworks */, E45BE97E0E8CC7DD009D7055 /* Carbon.framework in Frameworks */, E45BE97F0E8CC7DD009D7055 /* CoreAudio.framework in Frameworks */, E45BE9800E8CC7DD009D7055 /* CoreFoundation.framework in Frameworks */, E45BE9810E8CC7DD009D7055 /* CoreServices.framework in Frameworks */, - E45BE9830E8CC7DD009D7055 /* OpenGL.framework in Frameworks */, E45BE9840E8CC7DD009D7055 /* QuickTime.framework in Frameworks */, E4C2424710CC5A17004149E2 /* AppKit.framework in Frameworks */, E4C2424810CC5A17004149E2 /* Cocoa.framework in Frameworks */, @@ -330,19 +277,7 @@ 84BFF84611C4E60C000DB417 /* libfmodex.dylib in Frameworks */, 84BFF8AB11C4F069000DB417 /* AudioUnit.framework in Frameworks */, 8416E04411DA9FBA003A3B23 /* openFrameworks.a in Frameworks */, - 8448DA5812B67424003E0F48 /* libcairo.a in Frameworks */, - 8448DA5912B67424003E0F48 /* libcharset.a in Frameworks */, - 8448DA5A12B67424003E0F48 /* libgettextpo.a in Frameworks */, - 8448DA5B12B67424003E0F48 /* libgio-2.0.a in Frameworks */, - 8448DA5C12B67424003E0F48 /* libglib-2.0.a in Frameworks */, - 8448DA5D12B67424003E0F48 /* libgmodule-2.0.a in Frameworks */, - 8448DA5E12B67424003E0F48 /* libgobject-2.0.a in Frameworks */, - 8448DA5F12B67424003E0F48 /* libgthread-2.0.a in Frameworks */, - 8448DA6012B67424003E0F48 /* libiconv.a in Frameworks */, - 8448DA6112B67424003E0F48 /* libintl.a in Frameworks */, - 8448DA6212B67424003E0F48 /* libpango-1.0.a in Frameworks */, - 8448DA6312B67424003E0F48 /* libpangocairo-1.0.a in Frameworks */, - 8448DA6412B67424003E0F48 /* libpixman-1.a in Frameworks */, + 843BC56112D2B8240040A3BC /* OpenGL.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -415,91 +350,24 @@ path = Controls; sourceTree = "<group>"; }; - 8448D94B12B67424003E0F48 /* src */ = { + 843BC38912D143470040A3BC /* ofxFBO */ = { isa = PBXGroup; children = ( - 8448DA2D12B67424003E0F48 /* libs */, - 8448DA4D12B67424003E0F48 /* ofxPango.cpp */, - 8448DA4E12B67424003E0F48 /* ofxPango.h */, - 8448DA4F12B67424003E0F48 /* ofxPCContext.cpp */, - 8448DA5012B67424003E0F48 /* ofxPCContext.h */, - 8448DA5112B67424003E0F48 /* ofxPCPangoFontDescription.cpp */, - 8448DA5212B67424003E0F48 /* ofxPCPangoFontDescription.h */, - 8448DA5312B67424003E0F48 /* ofxPCPangoLayout.cpp */, - 8448DA5412B67424003E0F48 /* ofxPCPangoLayout.h */, - 8448DA5512B67424003E0F48 /* ofxPCSurface.cpp */, - 8448DA5612B67424003E0F48 /* ofxPCSurface.h */, + 843BC38A12D143470040A3BC /* src */, ); - name = src; - path = ../../../ofxPango/src; - sourceTree = SOURCE_ROOT; - }; - 8448DA2D12B67424003E0F48 /* libs */ = { - isa = PBXGroup; - children = ( - 8448DA2E12B67424003E0F48 /* mac */, - 8448DA3D12B67424003E0F48 /* win */, - ); - path = libs; + name = ofxFBO; + path = "lib-src/ofxFBO"; sourceTree = "<group>"; }; - 8448DA2E12B67424003E0F48 /* mac */ = { + 843BC38A12D143470040A3BC /* src */ = { isa = PBXGroup; children = ( - 8448DA2F12B67424003E0F48 /* static */, + 843BC38B12D143470040A3BC /* ofxFbo.cpp */, + 843BC38C12D143470040A3BC /* ofxFbo.h */, ); - path = mac; + path = src; sourceTree = "<group>"; }; - 8448DA2F12B67424003E0F48 /* static */ = { - isa = PBXGroup; - children = ( - 8448DA3012B67424003E0F48 /* libcairo.a */, - 8448DA3112B67424003E0F48 /* libcharset.a */, - 8448DA3212B67424003E0F48 /* libgettextpo.a */, - 8448DA3312B67424003E0F48 /* libgio-2.0.a */, - 8448DA3412B67424003E0F48 /* libglib-2.0.a */, - 8448DA3512B67424003E0F48 /* libgmodule-2.0.a */, - 8448DA3612B67424003E0F48 /* libgobject-2.0.a */, - 8448DA3712B67424003E0F48 /* libgthread-2.0.a */, - 8448DA3812B67424003E0F48 /* libiconv.a */, - 8448DA3912B67424003E0F48 /* libintl.a */, - 8448DA3A12B67424003E0F48 /* libpango-1.0.a */, - 8448DA3B12B67424003E0F48 /* libpangocairo-1.0.a */, - 8448DA3C12B67424003E0F48 /* libpixman-1.a */, - ); - path = static; - sourceTree = "<group>"; - }; - 8448DA3D12B67424003E0F48 /* win */ = { - isa = PBXGroup; - children = ( - 8448DA3E12B67424003E0F48 /* freetype6.dll */, - 8448DA3F12B67424003E0F48 /* libexpat-1.dll */, - 8448DA4012B67424003E0F48 /* libfontconfig-1.dll */, - 8448DA4112B67424003E0F48 /* libgio-2.0-0.dll */, - 8448DA4212B67424003E0F48 /* libglib-2.0-0.dll */, - 8448DA4312B67424003E0F48 /* libgmodule-2.0-0.dll */, - 8448DA4412B67424003E0F48 /* libgobject-2.0-0.dll */, - 8448DA4512B67424003E0F48 /* libgthread-2.0-0.dll */, - 8448DA4612B67424003E0F48 /* libpangoft2-1.0-0.dll */, - 8448DA4712B67424003E0F48 /* libpangowin32-1.0-0.dll */, - 8448DA4812B67424003E0F48 /* libpng14-14.dll */, - 8448DA4912B67424003E0F48 /* static */, - ); - path = win; - sourceTree = "<group>"; - }; - 8448DA4912B67424003E0F48 /* static */ = { - isa = PBXGroup; - children = ( - 8448DA4A12B67424003E0F48 /* libcairo-2.dll */, - 8448DA4B12B67424003E0F48 /* libpango-1.0-0.dll */, - 8448DA4C12B67424003E0F48 /* libpangocairo-1.0-0.dll */, - ); - path = static; - sourceTree = "<group>"; - }; 847D386012ABC55E006E9CA2 /* src */ = { isa = PBXGroup; children = ( @@ -513,7 +381,7 @@ 84BFF66D11C4CD9C000DB417 /* addons */ = { isa = PBXGroup; children = ( - 8448D94B12B67424003E0F48 /* src */, + 843BC38912D143470040A3BC /* ofxFBO */, 847D386012ABC55E006E9CA2 /* src */, 840F2CCA11E788F200C5CD20 /* src */, 840F2C9211E7869C00C5CD20 /* src */, @@ -591,6 +459,7 @@ 84BFF8AA11C4F069000DB417 /* AudioUnit.framework */, 84BFF86711C4E744000DB417 /* libportaudio.a */, E45BEED60E8CCB34009D7055 /* core */, + 843BC56012D2B8240040A3BC /* OpenGL.framework */, ); name = libs; sourceTree = "<group>"; @@ -731,14 +600,12 @@ E4C2424410CC5A17004149E2 /* AppKit.framework */, E4C2424510CC5A17004149E2 /* Cocoa.framework */, E4C2424610CC5A17004149E2 /* IOKit.framework */, - E45BE9710E8CC7DD009D7055 /* AGL.framework */, E45BE9720E8CC7DD009D7055 /* ApplicationServices.framework */, E45BE9730E8CC7DD009D7055 /* AudioToolbox.framework */, E45BE9740E8CC7DD009D7055 /* Carbon.framework */, E45BE9750E8CC7DD009D7055 /* CoreAudio.framework */, E45BE9760E8CC7DD009D7055 /* CoreFoundation.framework */, E45BE9770E8CC7DD009D7055 /* CoreServices.framework */, - E45BE9790E8CC7DD009D7055 /* OpenGL.framework */, E45BE97A0E8CC7DD009D7055 /* QuickTime.framework */, ); name = "core frameworks"; @@ -809,6 +676,8 @@ E4B69E1F0A3A1BDC003C02F2 /* testApp.h */, 8448D52912B5AD03003E0F48 /* ConsoleView.h */, 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */, + 843BC96C12D363B20040A3BC /* ImageWriterSquaresView.h */, + 843BC96D12D363B20040A3BC /* ImageWriterSquaresView.cpp */, ); path = src; sourceTree = SOURCE_ROOT; @@ -1014,11 +883,8 @@ 847D3AF712AD91F4006E9CA2 /* BarsView.cpp in Sources */, 847D3AF812AD91F4006E9CA2 /* SquaresView.cpp in Sources */, 8448D52B12B5AD03003E0F48 /* ConsoleView.cpp in Sources */, - 8448DA6512B67424003E0F48 /* ofxPango.cpp in Sources */, - 8448DA6612B67424003E0F48 /* ofxPCContext.cpp in Sources */, - 8448DA6712B67424003E0F48 /* ofxPCPangoFontDescription.cpp in Sources */, - 8448DA6812B67424003E0F48 /* ofxPCPangoLayout.cpp in Sources */, - 8448DA6912B67424003E0F48 /* ofxPCSurface.cpp in Sources */, + 843BC38D12D143470040A3BC /* ofxFbo.cpp in Sources */, + 843BC96E12D363B20040A3BC /* ImageWriterSquaresView.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Added: algorhythmicSorting/ofAlgorhythmicSorting/src/ImageWriterSquaresView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ImageWriterSquaresView.cpp (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ImageWriterSquaresView.cpp 2011-01-04 15:08:19 UTC (rev 260) @@ -0,0 +1,47 @@ +/* + * ImageWriterSquaresView.cpp + * AlgorhythmicSorting + * + * Created by Administrator on 1/4/11. + * Copyright 2011 __MyCompanyName__. All rights reserved. + * + */ + +#include "ImageWriterSquaresView.h" +#include "ofMain.h" + +void ImageWriterSquaresView::SetColor(int color) +{ + mColor = color; +} + +void ImageWriterSquaresView::SetFill(bool fill) +{ + mFill = fill; +} + +void ImageWriterSquaresView::DrawRect(int x, int y, int w, int h) +{ + if (!mImage) return; + + if (mFill) { + //get the buffer. + unsigned char* pixels = mImage->getPixels(); + int pixelIndex; + int imageHeight = mImage->getHeight(); + int imageWidth = mImage->getWidth(); + int imageEnd = 4 * imageWidth * imageHeight; + for (int i = 0; i < h; i++) { + for (int j = 0; j < w; j++) { + pixelIndex = 4 * ((x + j) + (y + i) * imageWidth); + if (pixelIndex >= 0 && pixelIndex < imageEnd) { + pixels[pixelIndex++] = (mColor & 0xFF0000) >> 16; + pixels[pixelIndex++] = (mColor & 0x00FF00) >> 8; + pixels[pixelIndex++] = mColor & 0xFF; + pixels[pixelIndex++] = 0xFF; + } + } + } + } +} + Added: algorhythmicSorting/ofAlgorhythmicSorting/src/ImageWriterSquaresView.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ImageWriterSquaresView.h (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ImageWriterSquaresView.h 2011-01-04 15:08:19 UTC (rev 260) @@ -0,0 +1,32 @@ +/* + * ImageWriterSquaresView.h + * AlgorhythmicSorting + * + * Created by Administrator on 1/4/11. + * Copyright 2011 __MyCompanyName__. All rights reserved. + * + */ + +#ifndef __IMAGE_WRITER_SQUARES_VIEW_H__ +#define __IMAGE_WRITER_SQUARES_VIEW_H__ + +#include "SquaresView.h" +class ofImage; +class ImageWriterSquaresView : public SquaresView +{ +public: + ImageWriterSquaresView(int x, int y, int width, int height):SquaresView(x,y,width,height){}; + virtual ~ImageWriterSquaresView(){} + + void SetImage(ofImage *image) {mImage = image;} +protected: + void SetColor(int color); + void SetFill(bool fill); + void DrawRect(int x, int y, int w, int h); + + ofImage *mImage; + int mColor; + bool mFill; +}; + +#endif \ No newline at end of file Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2011-01-02 22:36:01 UTC (rev 259) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2011-01-04 15:08:19 UTC (rev 260) @@ -26,15 +26,16 @@ color = color & 0x22FFFF; //take out some green and red components else if(markers[i - startRow][j] & kMarkerFocused) color = color & 0xFFFF22; //take out some red and blue components - ofFill(); - ofSetColor(color); - ofRect(m_x + kDrawMethodBorder + j * squareSize, + + SetFill(true); + SetColor(color); + DrawRect(m_x + kDrawMethodBorder + j * squareSize, m_y + kDrawMethodBorder + i * squareSize, squareSize, squareSize); if (i == numRows - 1 && currentIndex == j) { - ofSetColor(0xFFFFFF); - ofNoFill(); - ofRect(m_x + kDrawMethodBorder + j * squareSize, + SetColor(0xFFFFFF); + SetFill(false); + DrawRect(m_x + kDrawMethodBorder + j * squareSize, m_y + kDrawMethodBorder + i * squareSize, squareSize - 1, squareSize - 1); } @@ -42,12 +43,34 @@ } } +int SquaresView::GetSquareHeight() +{ + int len = SortingMan::Instance()->GetArraySize(); + int viewWidth = m_width - kDrawMethodBorder * 2; + return viewWidth / len; +} int SquaresView::CalcNumRowsNeeded() { - int len = SortingMan::Instance()->GetArraySize(); - int viewWidth = m_width - kDrawMethodBorder * 2; int viewHeight = m_height - kDrawMethodBorder * 2; - int squareSize = viewWidth / len; - return viewHeight / squareSize; -} \ No newline at end of file + return viewHeight / GetSquareHeight(); +} + +void SquaresView::SetColor(int color) +{ + ofSetColor(color); +} + +void SquaresView::SetFill(bool fill) +{ + if (fill) + ofFill(); + else + ofNoFill(); +} + +void SquaresView::DrawRect(int x, int y, int w, int h) +{ + ofRect(x, y, w, h); +} + Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.h 2011-01-02 22:36:01 UTC (rev 259) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.h 2011-01-04 15:08:19 UTC (rev 260) @@ -11,6 +11,14 @@ virtual void Draw(std::vector<double*> &arrays, std::vector<int*> &markers); //if the number of rows displayed is more than one override this. virtual int CalcNumRowsNeeded(); + + virtual int GetSquareHeight(); + + +protected: + virtual void SetColor(int color); + virtual void SetFill(bool fill); + virtual void DrawRect(int x, int y, int w, int h); }; #endif \ No newline at end of file Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2011-01-02 22:36:01 UTC (rev 259) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2011-01-04 15:08:19 UTC (rev 260) @@ -5,11 +5,12 @@ #include "SortingMan.h" #include "AlgorhythmicAudioIO.h" #include "ofxSimpleGuiComboBox.h" +#include "ImageWriterSquaresView.h" #include "SquaresView.h" #include "BarsView.h" #include "ConsoleView.h" +#include "ofxFbo.h" - #define kSquaresViewIndex 0 #define kBarsViewIndex 1 #define kConsoleViewIndex 2 @@ -19,6 +20,7 @@ int myInt1; bool startButton; bool genButton; +bool bSaveImage = false; string textInput; ofxSimpleGuiButton *startButtonControl; //-------------------------------------------------------------- @@ -79,6 +81,7 @@ gui.addButton("Generate New Array", genButton); startButtonControl = &gui.addButton("Start", startButton); + gui.addButton("Save History as Image", bSaveImage); gui.loadFromXML(); gui.setPage(2); @@ -104,6 +107,11 @@ //-------------------------------------------------------------- void testApp::update(){ + if(bSaveImage) { + writePng(); + bSaveImage = false; + } + if(startButton) { startButton = false; //start. @@ -149,7 +157,6 @@ //-------------------------------------------------------------- void testApp::draw(){ - if (viewMode == eDrawAll) { views[kSquaresViewIndex]->SetRect(0, 0, ofGetWidth() / 2, ofGetHeight() / 2); views[kBarsViewIndex]->SetRect(ofGetWidth() / 2, 0, ofGetWidth() / 2, ofGetHeight() / 2); @@ -260,6 +267,34 @@ keyMode = eKeyModeNormal; } +void testApp::writePng() +{ + //draw everything in the history + ImageWriterSquaresView *view = new ImageWriterSquaresView(0,0,ofGetWidth(),ofGetHeight()); + ofImage image; + int squaresDrawn; + int width = ofGetWidth() /2 ; + int height = ofGetHeight() /2; + int squareHeight; + // std::vector<double*> history = history; + // std::vector<int*> markers = markers; + view->SetRect(0, 0, width, height); + squareHeight = view->GetSquareHeight(); +#define kDrawMethodBorder 10 + height = squareHeight * history.size() + kDrawMethodBorder * 2; + + image.allocate(width, height, OF_IMAGE_COLOR_ALPHA); + view->SetImage(&image); + view->SetRect(0, 0, width, height); + view->Draw(history, markers); + delete view; +// image.update(); + char filename[200]; + static int counter = 1; + sprintf(filename, "%04dAlgorhymicSorting%d-%d-%d-%02d:%02d:%02d.png", counter++, ofGetDay(), ofGetMonth(), ofGetYear(), ofGetHours(), ofGetMinutes(), ofGetSeconds()); + image.saveImage(filename); +} + void testApp::keyPressedZoomMode(int key) { if(key == 'a' || key == 'z') @@ -326,6 +361,9 @@ }else if(key == '5') { viewMode = eDrawBarsAndSquares; + }else if(key == '0') + { + bSaveImage = true; }else if(key == '4') { viewMode = eDrawAll; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2011-01-02 22:36:01 UTC (rev 259) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2011-01-04 15:08:19 UTC (rev 260) @@ -63,6 +63,7 @@ void setup(); void update(); void draw(); + void writePng(); void keyPressedMouseMode(int key); void keyPressedZoomMode(int key); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2011-01-02 22:36:08
|
Revision: 259 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=259&view=rev Author: mchinen Date: 2011-01-02 22:36:01 +0000 (Sun, 02 Jan 2011) Log Message: ----------- add highlight frame around currently playing index for all drawing views Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-23 16:33:29 UTC (rev 258) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2011-01-02 22:36:01 UTC (rev 259) @@ -252,13 +252,13 @@ 84BFF87711C4E744000DB417 /* sorthelp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sorthelp.cpp; sourceTree = "<group>"; }; 84BFF87811C4E744000DB417 /* sorthelp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sorthelp.h; sourceTree = "<group>"; }; 84BFF87F11C4E77F000DB417 /* quicksort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = quicksort.cpp; sourceTree = "<group>"; }; - 84BFF88011C4E77F000DB417 /* SortingMan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SortingMan.cpp; sourceTree = "<group>"; }; + 84BFF88011C4E77F000DB417 /* SortingMan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = SortingMan.cpp; sourceTree = "<group>"; tabWidth = 3; usesTabs = 0; }; 84BFF88111C4E77F000DB417 /* SortingMan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SortingMan.h; sourceTree = "<group>"; }; 84BFF88E11C4E7DB000DB417 /* heap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = heap.cpp; sourceTree = "<group>"; }; 84BFF88F11C4E7DB000DB417 /* insert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = insert.cpp; sourceTree = "<group>"; }; 84BFF89011C4E7DB000DB417 /* shell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shell.cpp; sourceTree = "<group>"; }; - 84BFF89611C4ECE1000DB417 /* AlgorhythmicAudioIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AlgorhythmicAudioIO.cpp; sourceTree = "<group>"; }; - 84BFF89711C4ECE1000DB417 /* AlgorhythmicAudioIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlgorhythmicAudioIO.h; sourceTree = "<group>"; }; + 84BFF89611C4ECE1000DB417 /* AlgorhythmicAudioIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = AlgorhythmicAudioIO.cpp; sourceTree = "<group>"; tabWidth = 3; usesTabs = 0; }; + 84BFF89711C4ECE1000DB417 /* AlgorhythmicAudioIO.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = AlgorhythmicAudioIO.h; sourceTree = "<group>"; tabWidth = 3; usesTabs = 0; }; 84BFF8AA11C4F069000DB417 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; }; E45BE0390E8CC647009D7055 /* FreeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FreeImage.h; path = ../../../../of/of_preRelease_v0061_osx_FAT/libs/FreeImage/include/FreeImage.h; sourceTree = SOURCE_ROOT; }; E45BE03F0E8CC650009D7055 /* fmod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fmod.h; path = ../../../../of/of_preRelease_v0061_osx_FAT/libs/fmodex/include/fmod.h; sourceTree = SOURCE_ROOT; }; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp 2010-12-23 16:33:29 UTC (rev 258) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp 2011-01-02 22:36:01 UTC (rev 259) @@ -139,7 +139,21 @@ } +static void ComputeCurrentIndex(int localIndex) +{ + AlgorhythmicAudioIO *io = AlgorhythmicAudioIO::Instance(); + + io->ComputeCurrentIndex(localIndex); +} +void AlgorhythmicAudioIO::ComputeCurrentIndex(int localIndex) +{ + if (m_playingIndividual) + m_currentIndex = localIndex ? m_playIndexA : m_playIndexB; + else + m_currentIndex = m_playIndexA + localIndex; +} + int nb_samples_left = 0; int nb_samples_total = 0; /* This routine will be called by the PortAudio engine when audio is needed. @@ -190,6 +204,7 @@ dataa->lastNoteIndex++; } index = dataa->lastNoteIndex; + ComputeCurrentIndex(index); if(dataa->doubleArray && index <= dataa->doubleArraySize && dataa->durations && dataa->durations[dataa->lastNoteIndex]* SAMPLE_RATE> dataa->sampleCursor) { @@ -252,6 +267,7 @@ dataa->sampleCursor=0; dataa->lastNoteIndex++; index = dataa->lastNoteIndex; + ComputeCurrentIndex(index); if(!(dataa->lastNoteIndex<= dataa->doubleArraySize)) break; else if (dataa->lastNoteIndex < dataa->doubleArraySize) @@ -495,4 +511,4 @@ void AlgorhythmicAudioIO::Terminate() { Pa_Terminate(); -} \ No newline at end of file +} Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-12-23 16:33:29 UTC (rev 258) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2011-01-02 22:36:01 UTC (rev 259) @@ -81,6 +81,13 @@ void ResetEvalCount(){mzsortdata.approxEvals =0;} int GetEvalCount(){return mzsortdata.approxEvals;} float GetActualLatency(){return m_actualLatency;} + + void SetIndividual(bool i) { m_playingIndividual = i; } + void SetAIndex(int a) { m_playIndexA = a; } + void SetBIndex(int b) { m_playIndexB = b; } + int CurrentIndex() { return m_currentIndex; } + int RemoveCurrentIndex() { m_currentIndex = -1; } + void ComputeCurrentIndex(int localIndex); protected: //private constructor - Singleton. AlgorhythmicAudioIO(); @@ -98,7 +105,13 @@ bool m_seperatorOn; bool m_notesOn; - + + //these variables let the audio thread compute which index is currently being played back + bool m_playingIndividual; + int m_playIndexA; + int m_playIndexB; + int m_currentIndex; + ofxMutex audioDataMutex; }; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp 2010-12-23 16:33:29 UTC (rev 258) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp 2011-01-02 22:36:01 UTC (rev 259) @@ -1,6 +1,7 @@ #include "BarsView.h" #include "ofMain.h" #include "SortingMan.h" +#include "AlgorhythmicAudioIO.h" #include "handyfuncs.h" void BarsView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) { @@ -9,6 +10,7 @@ int len = SortingMan::Instance()->GetArraySize(); double* array = arrays[arrays.size() - 1]; int* status = markers[markers.size() - 1]; + int currentIndex = AlgorhythmicAudioIO::Instance()->CurrentIndex(); float y1,y2; for(int i=0;i<len;i++){ @@ -22,10 +24,19 @@ else if(status[i] & kMarkerFocused) color &= 0xFFFF22; //take out some red and blue components - ofSetColor(color); y1 = m_height/2; y2 = (1.0 + (array[i]/-100.0)) * m_height/2; + + ofFill(); + ofSetColor(color); ofRect(m_x + m_width * ((float)i/len), m_y + mymin(y1,y2), (float)m_width/len, fabs(y1-y2)); + if (currentIndex == i) { + ofSetColor(0xFFFFFF); + ofNoFill(); + ofRect(m_x + m_width * ((float)i/len), m_y + mymin(y1,y2), + (float)m_width / len - 1, fabs(y1-y2) - 1); + } + } } \ No newline at end of file Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-23 16:33:29 UTC (rev 258) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2011-01-02 22:36:01 UTC (rev 259) @@ -10,6 +10,7 @@ #include "ConsoleView.h" #include "SortingMan.h" #include "ofMain.h" +#include "AlgorhythmicAudioIO.h" #define kDrawMethodBorder 10 ConsoleView::ConsoleView(int x, int y, int width, int height) @@ -35,6 +36,7 @@ int consoleCursor = m_consoleOutput.size() - 1; int startRow = arrays.size() - 1; int len = SortingMan::Instance()->GetArraySize(); + int currentIndex = AlgorhythmicAudioIO::Instance()->CurrentIndex(); int xCursor; char fill[5]; fill[4] = 0; @@ -87,6 +89,10 @@ bounds.y, dx, dy); } + + //if it is playing make the index brighter but not white to keep the color + if (currentIndex == j && i == startRow) + color |= 0xaaaaaa; ofSetColor(color); m_arrayFont->drawString(numStr, m_x + kDrawMethodBorder + xCursor, Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-23 16:33:29 UTC (rev 258) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2011-01-02 22:36:01 UTC (rev 259) @@ -322,7 +322,7 @@ }while(SortingMan::Instance()->IsLooping() && !SortingMan::Instance()->ShouldStop()) ; SortingMan::Instance()->SetDoneSorting(); - + AlgorhythmicAudioIO::Instance()->RemoveCurrentIndex(); AlgorhythmicAudioIO::Instance()->Stop(); return 0; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2010-12-23 16:33:29 UTC (rev 258) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2011-01-02 22:36:01 UTC (rev 259) @@ -1,5 +1,6 @@ #include "SquaresView.h" #include "SortingMan.h" +#include "AlgorhythmicAudioIO.h" #include "ofMain.h" #define kDrawMethodBorder 10 void SquaresView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) @@ -10,6 +11,7 @@ int squareSize = viewWidth / len; int numRows = viewHeight / squareSize; int startRow = numRows - arrays.size(); + int currentIndex = AlgorhythmicAudioIO::Instance()->CurrentIndex(); for(int i = startRow; i < numRows; i++) { for(int j = 0; j < len; j++) { int val; @@ -24,10 +26,18 @@ color = color & 0x22FFFF; //take out some green and red components else if(markers[i - startRow][j] & kMarkerFocused) color = color & 0xFFFF22; //take out some red and blue components + ofFill(); ofSetColor(color); ofRect(m_x + kDrawMethodBorder + j * squareSize, - m_y + kDrawMethodBorder + i * squareSize, - squareSize, squareSize); + m_y + kDrawMethodBorder + i * squareSize, + squareSize, squareSize); + if (i == numRows - 1 && currentIndex == j) { + ofSetColor(0xFFFFFF); + ofNoFill(); + ofRect(m_x + kDrawMethodBorder + j * squareSize, + m_y + kDrawMethodBorder + i * squareSize, + squareSize - 1, squareSize - 1); + } } } } Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-23 16:33:29 UTC (rev 258) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2011-01-02 22:36:01 UTC (rev 259) @@ -21,16 +21,27 @@ { //if we were given a pair, we just play the pair. doublePair[0]=array[swapaindex]; - doublePair[1]=array[swapbindex]; + doublePair[1]=array[swapbindex]; + //mark that we are just playing two possibly seperated values and their indexes + //so we audio io thread can tell us which index is currently being played + AlgorhythmicAudioIO::Instance()->SetIndividual(true); + AlgorhythmicAudioIO::Instance()->SetAIndex(swapaindex); + AlgorhythmicAudioIO::Instance()->SetBIndex(swapbindex); secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray((double*)doublePair, 2); // }else if(swapaindex!=-1) { //some cases have just one number in focus - doublePair[0]=array[swapaindex]; + doublePair[0]=array[swapaindex]; + AlgorhythmicAudioIO::Instance()->SetIndividual(true); + AlgorhythmicAudioIO::Instance()->SetAIndex(swapaindex); secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray((double*)doublePair, 1); // }else { - // play the values (freq) of a block + // play the values (freq) of a block + //in the array case we overload A index as starting point and b as size + AlgorhythmicAudioIO::Instance()->SetIndividual(false); + AlgorhythmicAudioIO::Instance()->SetAIndex(focusstart); + AlgorhythmicAudioIO::Instance()->SetBIndex(focussize); secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray(array+focusstart, focussize); // } float secsLatency = AlgorhythmicAudioIO::Instance()->GetActualLatency()/1000.0f; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-23 16:33:36
|
Revision: 258 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=258&view=rev Author: mchinen Date: 2010-12-23 16:33:29 +0000 (Thu, 23 Dec 2010) Log Message: ----------- add volume, frequency min/max sliders. add toggle for percussion and tones. rearrange other gui elements Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-12-23 16:00:57 UTC (rev 257) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-12-23 16:33:29 UTC (rev 258) @@ -53,11 +53,13 @@ float GetSpeed(){return m_speed;} void PlaySeperator(int depth); void PlayIntArray(int * array, int size, float duration); - float PlayDoubleArray(double * array, int size); + float PlayDoubleArray(double * array, int size); void ChangeSpeed(float newSpeed){m_speed=newSpeed;} void ToggleSeperator(){m_seperatorOn = !m_seperatorOn;} void ToggleNotes(){m_notesOn = !m_notesOn;} + void SetSeperator(bool yn) {m_seperatorOn = yn;} + void SetNotes(bool yn) {m_notesOn = yn;} void ChangeVolume(float vol){m_volume=vol;} Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-23 16:00:57 UTC (rev 257) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-23 16:33:29 UTC (rev 258) @@ -53,9 +53,19 @@ gui.addPage(" "); speedSliderVal = speedSliderVal_old = 25; - gui.addSlider("Speed", speedSliderVal, 1.0f, 500.0f, false); arraysize = prev_arraysize = 10; - gui.addSlider("Array Size", arraysize, 2, 200); + freqRangeSliderVal = 0.20f; + freqBaseSliderVal = 100.0f; + volumeSliderVal = 0.8f; + bPercussion = true; + bTones = true; + bLoop = false; + gui.addSlider("Speed", speedSliderVal, 1.0f, 500.0f, false); + gui.addSlider("Volume", volumeSliderVal, 0.0f, 1.0f, false); + gui.addSlider("Frequency Range", freqRangeSliderVal, 0.001f, 1.0f, false); + gui.addSlider("Frequency Base", freqBaseSliderVal, 40.0f, 20000.0f, false); + gui.addToggle("Percusion", bPercussion); + gui.addToggle("Tones", bTones); gui.addToggle("Loop", bLoop); string algostrings[eNumSortAlgorithms]; @@ -65,8 +75,9 @@ gui.addComboBox("Sorting Algorithm", algonum, eNumSortAlgorithms,algostrings); // gui.addTextInput("number",textInput); + gui.addSlider("Array Size", arraysize, 2, 200); + gui.addButton("Generate New Array", genButton); startButtonControl = &gui.addButton("Start", startButton); - gui.addButton("Generate New Array", genButton); gui.loadFromXML(); @@ -127,7 +138,13 @@ AlgorhythmicAudioIO::Instance()->ChangeSpeed(speedSliderVal/1000); } - + //just constantly blast the sonification params + AlgorhythmicAudioIO::Instance()->ChangeFreqMin(freqBaseSliderVal); + AlgorhythmicAudioIO::Instance()->ChangeFreqMax(freqRangeSliderVal * + (20000.0f - freqBaseSliderVal)); + AlgorhythmicAudioIO::Instance()->SetNotes(bTones); + AlgorhythmicAudioIO::Instance()->SetSeperator(bPercussion); + AlgorhythmicAudioIO::Instance()->ChangeVolume(volumeSliderVal); } //-------------------------------------------------------------- Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-23 16:00:57 UTC (rev 257) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-23 16:33:29 UTC (rev 258) @@ -91,8 +91,15 @@ int algonum; int arraysize, prev_arraysize; ViewMode viewMode; -bool bLoop; + //gui vals + bool bLoop; + bool bPercussion; + bool bTones; + float freqRangeSliderVal; + float freqBaseSliderVal; + float volumeSliderVal; + float * lAudio; float * rAudio; float * lIn; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-23 16:01:04
|
Revision: 257 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=257&view=rev Author: mchinen Date: 2010-12-23 16:00:57 +0000 (Thu, 23 Dec 2010) Log Message: ----------- correct margin spacing on console view. add elapsed time to console view. Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-23 15:40:10 UTC (rev 256) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-23 16:00:57 UTC (rev 257) @@ -114,7 +114,7 @@ { int len = SortingMan::Instance()->GetArraySize(); int viewWidth = m_width - kDrawMethodBorder * 2; - int viewHeight = m_height - kDrawMethodBorder * 2; + int viewHeight = m_height - kDrawMethodBorder * 2; //we take off xtra for the title bar //compute font size if (m_lastArraySize != len) { @@ -135,8 +135,7 @@ m_lastArraySize = len; } - int lineHeight = m_arrayFont->getLineHeight(); - m_rowsNeeded = viewHeight / lineHeight; + m_rowsNeeded = viewHeight / m_arrayFont->getLineHeight(); //console is a special case cause we mix console messages with the array history. //maintain a vector of <history array ptr key, console string> that keeps track Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-23 15:40:10 UTC (rev 256) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-23 16:00:57 UTC (rev 257) @@ -11,8 +11,8 @@ #include "handyfuncs.h" #include "ofxThread.h" +#include "ofMain.h" - void* sortstuffhelper (void * arg); class SortThread:public ofxThread { @@ -274,7 +274,7 @@ AlgorhythmicAudioIO::Instance()->ResetEvalCount(); //NSDate *date = [NSDate date]; - + float startTimeSecs = ofGetElapsedTimef(); switch (params->algo) { //bubble sort case eBubbleSortAlgorithm: @@ -307,7 +307,7 @@ // Find elapsed time and convert to milliseconds // Use (-) modifier to conversion since receiver is earlier than now //NSTimeInterval timePassed_ms = [date timeIntervalSinceNow] * -1000.0; - + float elapsedTimeSecs = ofGetElapsedTimef() - startTimeSecs; //print the array clean printdoublearray(a, n,0,0); static int debug = 0; @@ -315,7 +315,7 @@ algoName, SortingMan::Instance()->ShouldStop()?"cancelled":"finished", AlgorhythmicAudioIO::Instance()->GetEvalCount(), - -1.0); + elapsedTimeSecs); SortingMan::Instance()->AppendToOutput(mystring); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-23 15:40:17
|
Revision: 256 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=256&view=rev Author: mchinen Date: 2010-12-23 15:40:10 +0000 (Thu, 23 Dec 2010) Log Message: ----------- hack fix for strange behavior in console Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-23 15:12:20 UTC (rev 255) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-23 15:40:10 UTC (rev 256) @@ -23,7 +23,13 @@ #define kNormalTextColor 0xFFFFFF void ConsoleView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) -{ +{ + //TODO: there is a bug where old messages get redrawn out of place, becuase + //we are doing the timestamps by pointer values, and an old deleted array + //in the history gets reallocated to the same spot in memory. + //fix this by adding timestamps to the array/marker system. + //I've hacked it for now by adding kMinHistory to fetchHistory, and it fixes + //it in the most cases. //start drawing from the bottom up. int consoleCursor = m_consoleOutput.size() - 1; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-23 15:12:20 UTC (rev 255) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-23 15:40:10 UTC (rev 256) @@ -310,12 +310,12 @@ //print the array clean printdoublearray(a, n,0,0); - - sprintf(mystring, "%s %s. Approx. %i comparisons/moves. lapsed time:%.2f ms\n", + static int debug = 0; + sprintf(mystring, "%s %s. %i comparisons/moves. elapsed time:%.2f ms\n", algoName, SortingMan::Instance()->ShouldStop()?"cancelled":"finished", AlgorhythmicAudioIO::Instance()->GetEvalCount(), - -1); + -1.0); SortingMan::Instance()->AppendToOutput(mystring); Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-23 15:12:20 UTC (rev 255) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-23 15:40:10 UTC (rev 256) @@ -172,6 +172,7 @@ #define kDrawMethodBorder 10 +#define kMinHistory 1000 void testApp::fetchHistory() { int rowsNeeded = 1; @@ -179,7 +180,7 @@ for (int i = 0; i < views.size(); i++) { rowsNeeded = mymax(views[i]->CalcNumRowsNeeded(), rowsNeeded); } - + rowsNeeded = mymax(kMinHistory, rowsNeeded); static int lastlen = -1; int len = SortingMan::Instance()->GetArraySize(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-23 15:12:26
|
Revision: 255 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=255&view=rev Author: mchinen Date: 2010-12-23 15:12:20 +0000 (Thu, 23 Dec 2010) Log Message: ----------- vertical split bars and squares mode added removed console view for bars only and squares only view. Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.h algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-13 20:54:55 UTC (rev 254) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-23 15:12:20 UTC (rev 255) @@ -15,35 +15,16 @@ ConsoleView::ConsoleView(int x, int y, int width, int height) :ArrayView(x,y,width,height) { - m_arrayFont = new ofTrueTypeFont; - m_currFontSize = -1; + m_arrayFont = new ofTrueTypeFont; + m_currFontSize = -1; m_lastArraySize = -1; + m_rowsNeeded = 0; } #define kNormalTextColor 0xFFFFFF void ConsoleView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) { - //console is a special case cause we mix console messages with the array history. - //maintain a vector of <history array ptr key, console string> that keeps track - //of when in the history the string came out. The console string should be printed - //after the history array. - //a key of NULL means it is on the top. - //we only need to keep track of CalcNumRowsNeeded() of these because the display will be full then. - console_map m; - do { - m = SortingMan::Instance()->PopOutput(); - if (m.message) - m_consoleOutput.push_back(m); - } while(m.message) - ; - //detect if we have too many messages - int rows = CalcNumRowsNeeded(); - while (m_consoleOutput.size() > rows) { - free(m_consoleOutput[0].message); - m_consoleOutput.erase(m_consoleOutput.begin() + 0); - } - //start drawing from the bottom up. int consoleCursor = m_consoleOutput.size() - 1; int startRow = arrays.size() - 1; @@ -53,6 +34,7 @@ fill[4] = 0; fill[0] = fill[1] = fill[2] = 'p'; fill[3] = '1'; + int rows = m_rowsNeeded; for (int i = startRow; rows > 0 && i >= 0; i--) { //before we draw the array, see if a console message comes after it. while (consoleCursor >= 0 && @@ -148,6 +130,28 @@ m_lastArraySize = len; } int lineHeight = m_arrayFont->getLineHeight(); - return viewHeight / lineHeight; + m_rowsNeeded = viewHeight / lineHeight; + + //console is a special case cause we mix console messages with the array history. + //maintain a vector of <history array ptr key, console string> that keeps track + //of when in the history the string came out. The console string should be printed + //after the history array. + //a key of NULL means it is on the top. + //we only need to keep track of CalcNumRowsNeeded() of these because the display will be full then. + console_map m; + do { + m = SortingMan::Instance()->PopOutput(); + if (m.message) + m_consoleOutput.push_back(m); + } while(m.message) + ; + + //detect if we have too many messages + while (m_consoleOutput.size() > m_rowsNeeded) { + free(m_consoleOutput[0].message); + m_consoleOutput.erase(m_consoleOutput.begin() + 0); + } + + return m_rowsNeeded; } Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.h 2010-12-13 20:54:55 UTC (rev 254) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.h 2010-12-23 15:12:20 UTC (rev 255) @@ -28,6 +28,7 @@ std::vector<console_map> m_consoleOutput; int m_currFontSize; int m_lastArraySize; + int m_rowsNeeded; }; #endif \ No newline at end of file Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-13 20:54:55 UTC (rev 254) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-23 15:12:20 UTC (rev 255) @@ -85,7 +85,7 @@ views.push_back(new SquaresView(0,0,ofGetWidth(),ofGetHeight())); views.push_back(new BarsView(0,0,ofGetWidth(),ofGetHeight())); views.push_back(new ConsoleView(0,0,ofGetWidth(),ofGetHeight())); - viewMode = eDrawAll; + viewMode = eDrawBarsAndSquares; ofSetFrameRate(60); ofBackground(0,0,0); } @@ -141,18 +141,22 @@ for ( int i = 0; i < views.size(); i++) views[i]->Draw(history, markers); - } else if (viewMode == eDrawSquares) { + } else if (viewMode == eDrawBarsAndSquares) { + views[kSquaresViewIndex]->SetRect(0, 0, ofGetWidth() / 2, ofGetHeight()); + views[kBarsViewIndex]->SetRect(ofGetWidth() / 2, 0, ofGetWidth() / 2, ofGetHeight()); + fetchHistory(); + views[kSquaresViewIndex]->Draw(history, markers); + views[kBarsViewIndex]->Draw(history, markers); + } else if (viewMode == eDrawSquares) { views[kSquaresViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); views[kConsoleViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); fetchHistory(); views[kSquaresViewIndex]->Draw(history, markers); - views[kConsoleViewIndex]->Draw(history, markers); } else if (viewMode == eDrawBars) { views[kBarsViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); views[kConsoleViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); fetchHistory(); views[kBarsViewIndex]->Draw(history, markers); - views[kConsoleViewIndex]->Draw(history, markers); } else if (viewMode == eDrawConsole) { views[kConsoleViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); fetchHistory(); @@ -301,6 +305,9 @@ volume = MIN(volume, 1); } else if(key == 'c') { drawGUI=!drawGUI; + }else if(key == '5') + { + viewMode = eDrawBarsAndSquares; }else if(key == '4') { viewMode = eDrawAll; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-13 20:54:55 UTC (rev 254) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-23 15:12:20 UTC (rev 255) @@ -50,6 +50,7 @@ eDrawConsole = 0, eDrawSquares = 1, eDrawBars, + eDrawBarsAndSquares, eDrawAll }; class ArrayView; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-13 20:55:01
|
Revision: 254 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=254&view=rev Author: mchinen Date: 2010-12-13 20:54:55 +0000 (Mon, 13 Dec 2010) Log Message: ----------- add greyscale bars Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp 2010-12-13 20:27:52 UTC (rev 253) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp 2010-12-13 20:54:55 UTC (rev 254) @@ -1,31 +1,31 @@ -#include "BarsView.h" -#include "ofMain.h" -#include "SortingMan.h" -#include "handyfuncs.h" -void BarsView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) -{ - if(!arrays.size()) - return; - int len = SortingMan::Instance()->GetArraySize(); - double* array = arrays[arrays.size() - 1]; - int* status = markers[markers.size() - 1]; - float y1,y2; - for(int i=0;i<len;i++){ - - int color; - if(status[i] & kMarkerChanged) - color = 0xFF22FF; //take out some green and blue components - else if(status[i] & kMarkerCompared) - color = 0x22FFFF; //take out some green and red components - else if(status[i] & kMarkerFocused) - color = 0xFFFF22; //take out some red and blue components - else - color = 0x666666; - - ofSetColor(color); - y1 = m_height/2; - y2 = (1.0 + (array[i]/-100.0)) * m_height/2; - ofRect(m_x + m_width * ((float)i/len), m_y + mymin(y1,y2), - (float)m_width/len, fabs(y1-y2)); - } +#include "BarsView.h" +#include "ofMain.h" +#include "SortingMan.h" +#include "handyfuncs.h" +void BarsView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) +{ + if(!arrays.size()) + return; + int len = SortingMan::Instance()->GetArraySize(); + double* array = arrays[arrays.size() - 1]; + int* status = markers[markers.size() - 1]; + float y1,y2; + for(int i=0;i<len;i++){ + + int color; + color = kHighNumberBrightness * 3 /4 * ((float) (array[i]+100)/200.0) + kHighNumberBrightness/4;//brightness + color |= color << 8 | color << 16; + if(status[i] & kMarkerChanged) + color &= 0xFF22FF; //take out some green and blue components + else if(status[i] & kMarkerCompared) + color &= 0x22FFFF; //take out some green and red components + else if(status[i] & kMarkerFocused) + color &= 0xFFFF22; //take out some red and blue components + + ofSetColor(color); + y1 = m_height/2; + y2 = (1.0 + (array[i]/-100.0)) * m_height/2; + ofRect(m_x + m_width * ((float)i/len), m_y + mymin(y1,y2), + (float)m_width/len, fabs(y1-y2)); + } } \ No newline at end of file Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2010-12-13 20:27:52 UTC (rev 253) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2010-12-13 20:54:55 UTC (rev 254) @@ -14,12 +14,10 @@ for(int j = 0; j < len; j++) { int val; int color; - val = arrays[i - startRow][j]; - color = kHighNumberBrightness * ((float) (val+100)/200.0);//brightness - //copy to other bytes + val = arrays[i - startRow][j]; + color = kHighNumberBrightness * 3 / 4 * ((float) (val+100)/200.0) + kHighNumberBrightness/4;//brightness color |= color << 8 | color << 16; - if(markers[i - startRow][j] & kMarkerChanged) color = color & 0xFF22FF; //take out some green and blue components else if(markers[i - startRow][j] & kMarkerCompared) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-13 20:27:58
|
Revision: 253 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=253&view=rev Author: mchinen Date: 2010-12-13 20:27:52 +0000 (Mon, 13 Dec 2010) Log Message: ----------- black background Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-13 20:11:23 UTC (rev 252) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-13 20:27:52 UTC (rev 253) @@ -20,7 +20,7 @@ m_lastArraySize = -1; } - +#define kNormalTextColor 0xFFFFFF void ConsoleView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) { //console is a special case cause we mix console messages with the array history. @@ -58,6 +58,7 @@ while (consoleCursor >= 0 && m_consoleOutput[consoleCursor].ownerArrayPtr == arrays[i]) { //draw the message + ofSetColor(kNormalTextColor); m_arrayFont->drawString(m_consoleOutput[consoleCursor].message, m_x + kDrawMethodBorder, m_y + rows * m_arrayFont->getLineHeight() + kDrawMethodBorder); @@ -77,14 +78,14 @@ sprintf(numStr, "%3.0f ", val); //sprintf might not null terminate. numStr[4] = 0; - color = 0x0; + color = kNormalTextColor; bgcolor = 0xffffff; if(markers[i][j] & kMarkerChanged) - color = 0x881188; //take out some green and blue components + color = 0xff22ff; //take out some green and blue components else if(markers[i][j] & kMarkerCompared) - color = 0x118888; //take out some green and red components + color = 0x22ffff; //take out some green and red components else if(markers[i][j] & kMarkerFocused) - color = 0x888811; //take out some red and blue components + color = 0xffff22; //take out some red and blue components ofRectangle bounds = m_arrayFont->getStringBoundingBox(fill, m_x + kDrawMethodBorder + xCursor, @@ -111,7 +112,7 @@ //draw whatever console messages can fit above while (consoleCursor >= 0 && rows > 0) { - ofSetColor(kHighNumberBrightness, kHighNumberBrightness, kHighNumberBrightness); + ofSetColor(kNormalTextColor); m_arrayFont->drawString(m_consoleOutput[consoleCursor].message, m_x + kDrawMethodBorder, m_y + rows * m_arrayFont->getLineHeight() + kDrawMethodBorder); Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-13 20:11:23 UTC (rev 252) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-13 20:27:52 UTC (rev 253) @@ -87,6 +87,7 @@ views.push_back(new ConsoleView(0,0,ofGetWidth(),ofGetHeight())); viewMode = eDrawAll; ofSetFrameRate(60); + ofBackground(0,0,0); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-13 20:11:30
|
Revision: 252 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=252&view=rev Author: mchinen Date: 2010-12-13 20:11:23 +0000 (Mon, 13 Dec 2010) Log Message: ----------- add cairo/pongo Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-13 16:02:27 UTC (rev 251) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-13 20:11:23 UTC (rev 252) @@ -28,6 +28,24 @@ 8416E04411DA9FBA003A3B23 /* openFrameworks.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8416E04311DA9FBA003A3B23 /* openFrameworks.a */; }; 8416E0EC11DDFCA0003A3B23 /* cleanerinsert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */; }; 8448D52B12B5AD03003E0F48 /* ConsoleView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */; }; + 8448DA5812B67424003E0F48 /* libcairo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3012B67424003E0F48 /* libcairo.a */; }; + 8448DA5912B67424003E0F48 /* libcharset.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3112B67424003E0F48 /* libcharset.a */; }; + 8448DA5A12B67424003E0F48 /* libgettextpo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3212B67424003E0F48 /* libgettextpo.a */; }; + 8448DA5B12B67424003E0F48 /* libgio-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3312B67424003E0F48 /* libgio-2.0.a */; }; + 8448DA5C12B67424003E0F48 /* libglib-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3412B67424003E0F48 /* libglib-2.0.a */; }; + 8448DA5D12B67424003E0F48 /* libgmodule-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3512B67424003E0F48 /* libgmodule-2.0.a */; }; + 8448DA5E12B67424003E0F48 /* libgobject-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3612B67424003E0F48 /* libgobject-2.0.a */; }; + 8448DA5F12B67424003E0F48 /* libgthread-2.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3712B67424003E0F48 /* libgthread-2.0.a */; }; + 8448DA6012B67424003E0F48 /* libiconv.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3812B67424003E0F48 /* libiconv.a */; }; + 8448DA6112B67424003E0F48 /* libintl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3912B67424003E0F48 /* libintl.a */; }; + 8448DA6212B67424003E0F48 /* libpango-1.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3A12B67424003E0F48 /* libpango-1.0.a */; }; + 8448DA6312B67424003E0F48 /* libpangocairo-1.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3B12B67424003E0F48 /* libpangocairo-1.0.a */; }; + 8448DA6412B67424003E0F48 /* libpixman-1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8448DA3C12B67424003E0F48 /* libpixman-1.a */; }; + 8448DA6512B67424003E0F48 /* ofxPango.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA4D12B67424003E0F48 /* ofxPango.cpp */; }; + 8448DA6612B67424003E0F48 /* ofxPCContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA4F12B67424003E0F48 /* ofxPCContext.cpp */; }; + 8448DA6712B67424003E0F48 /* ofxPCPangoFontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA5112B67424003E0F48 /* ofxPCPangoFontDescription.cpp */; }; + 8448DA6812B67424003E0F48 /* ofxPCPangoLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA5312B67424003E0F48 /* ofxPCPangoLayout.cpp */; }; + 8448DA6912B67424003E0F48 /* ofxPCSurface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448DA5512B67424003E0F48 /* ofxPCSurface.cpp */; }; 847D385D12ABC4E6006E9CA2 /* ofxMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */; }; 847D386312ABC55E006E9CA2 /* ofxThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D386112ABC55E006E9CA2 /* ofxThread.cpp */; }; 847D3AF612AD91F4006E9CA2 /* ArrayView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D3AF012AD91F4006E9CA2 /* ArrayView.cpp */; }; @@ -158,6 +176,43 @@ 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cleanerinsert.cpp; sourceTree = "<group>"; }; 8448D52912B5AD03003E0F48 /* ConsoleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleView.h; sourceTree = "<group>"; }; 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsoleView.cpp; sourceTree = "<group>"; }; + 8448DA3012B67424003E0F48 /* libcairo.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libcairo.a; sourceTree = "<group>"; }; + 8448DA3112B67424003E0F48 /* libcharset.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libcharset.a; sourceTree = "<group>"; }; + 8448DA3212B67424003E0F48 /* libgettextpo.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgettextpo.a; sourceTree = "<group>"; }; + 8448DA3312B67424003E0F48 /* libgio-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libgio-2.0.a"; sourceTree = "<group>"; }; + 8448DA3412B67424003E0F48 /* libglib-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libglib-2.0.a"; sourceTree = "<group>"; }; + 8448DA3512B67424003E0F48 /* libgmodule-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libgmodule-2.0.a"; sourceTree = "<group>"; }; + 8448DA3612B67424003E0F48 /* libgobject-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libgobject-2.0.a"; sourceTree = "<group>"; }; + 8448DA3712B67424003E0F48 /* libgthread-2.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libgthread-2.0.a"; sourceTree = "<group>"; }; + 8448DA3812B67424003E0F48 /* libiconv.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libiconv.a; sourceTree = "<group>"; }; + 8448DA3912B67424003E0F48 /* libintl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libintl.a; sourceTree = "<group>"; }; + 8448DA3A12B67424003E0F48 /* libpango-1.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libpango-1.0.a"; sourceTree = "<group>"; }; + 8448DA3B12B67424003E0F48 /* libpangocairo-1.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libpangocairo-1.0.a"; sourceTree = "<group>"; }; + 8448DA3C12B67424003E0F48 /* libpixman-1.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libpixman-1.a"; sourceTree = "<group>"; }; + 8448DA3E12B67424003E0F48 /* freetype6.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = freetype6.dll; sourceTree = "<group>"; }; + 8448DA3F12B67424003E0F48 /* libexpat-1.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libexpat-1.dll"; sourceTree = "<group>"; }; + 8448DA4012B67424003E0F48 /* libfontconfig-1.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libfontconfig-1.dll"; sourceTree = "<group>"; }; + 8448DA4112B67424003E0F48 /* libgio-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libgio-2.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4212B67424003E0F48 /* libglib-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libglib-2.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4312B67424003E0F48 /* libgmodule-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libgmodule-2.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4412B67424003E0F48 /* libgobject-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libgobject-2.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4512B67424003E0F48 /* libgthread-2.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libgthread-2.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4612B67424003E0F48 /* libpangoft2-1.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpangoft2-1.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4712B67424003E0F48 /* libpangowin32-1.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpangowin32-1.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4812B67424003E0F48 /* libpng14-14.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpng14-14.dll"; sourceTree = "<group>"; }; + 8448DA4A12B67424003E0F48 /* libcairo-2.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libcairo-2.dll"; sourceTree = "<group>"; }; + 8448DA4B12B67424003E0F48 /* libpango-1.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpango-1.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4C12B67424003E0F48 /* libpangocairo-1.0-0.dll */ = {isa = PBXFileReference; lastKnownFileType = file; path = "libpangocairo-1.0-0.dll"; sourceTree = "<group>"; }; + 8448DA4D12B67424003E0F48 /* ofxPango.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPango.cpp; sourceTree = "<group>"; }; + 8448DA4E12B67424003E0F48 /* ofxPango.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPango.h; sourceTree = "<group>"; }; + 8448DA4F12B67424003E0F48 /* ofxPCContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPCContext.cpp; sourceTree = "<group>"; }; + 8448DA5012B67424003E0F48 /* ofxPCContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPCContext.h; sourceTree = "<group>"; }; + 8448DA5112B67424003E0F48 /* ofxPCPangoFontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPCPangoFontDescription.cpp; sourceTree = "<group>"; }; + 8448DA5212B67424003E0F48 /* ofxPCPangoFontDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPCPangoFontDescription.h; sourceTree = "<group>"; }; + 8448DA5312B67424003E0F48 /* ofxPCPangoLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPCPangoLayout.cpp; sourceTree = "<group>"; }; + 8448DA5412B67424003E0F48 /* ofxPCPangoLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPCPangoLayout.h; sourceTree = "<group>"; }; + 8448DA5512B67424003E0F48 /* ofxPCSurface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPCSurface.cpp; sourceTree = "<group>"; }; + 8448DA5612B67424003E0F48 /* ofxPCSurface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPCSurface.h; sourceTree = "<group>"; }; 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxMutex.cpp; sourceTree = "<group>"; }; 847D385C12ABC4E6006E9CA2 /* ofxMutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxMutex.h; sourceTree = "<group>"; }; 847D386112ABC55E006E9CA2 /* ofxThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxThread.cpp; sourceTree = "<group>"; }; @@ -275,6 +330,19 @@ 84BFF84611C4E60C000DB417 /* libfmodex.dylib in Frameworks */, 84BFF8AB11C4F069000DB417 /* AudioUnit.framework in Frameworks */, 8416E04411DA9FBA003A3B23 /* openFrameworks.a in Frameworks */, + 8448DA5812B67424003E0F48 /* libcairo.a in Frameworks */, + 8448DA5912B67424003E0F48 /* libcharset.a in Frameworks */, + 8448DA5A12B67424003E0F48 /* libgettextpo.a in Frameworks */, + 8448DA5B12B67424003E0F48 /* libgio-2.0.a in Frameworks */, + 8448DA5C12B67424003E0F48 /* libglib-2.0.a in Frameworks */, + 8448DA5D12B67424003E0F48 /* libgmodule-2.0.a in Frameworks */, + 8448DA5E12B67424003E0F48 /* libgobject-2.0.a in Frameworks */, + 8448DA5F12B67424003E0F48 /* libgthread-2.0.a in Frameworks */, + 8448DA6012B67424003E0F48 /* libiconv.a in Frameworks */, + 8448DA6112B67424003E0F48 /* libintl.a in Frameworks */, + 8448DA6212B67424003E0F48 /* libpango-1.0.a in Frameworks */, + 8448DA6312B67424003E0F48 /* libpangocairo-1.0.a in Frameworks */, + 8448DA6412B67424003E0F48 /* libpixman-1.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -347,6 +415,91 @@ path = Controls; sourceTree = "<group>"; }; + 8448D94B12B67424003E0F48 /* src */ = { + isa = PBXGroup; + children = ( + 8448DA2D12B67424003E0F48 /* libs */, + 8448DA4D12B67424003E0F48 /* ofxPango.cpp */, + 8448DA4E12B67424003E0F48 /* ofxPango.h */, + 8448DA4F12B67424003E0F48 /* ofxPCContext.cpp */, + 8448DA5012B67424003E0F48 /* ofxPCContext.h */, + 8448DA5112B67424003E0F48 /* ofxPCPangoFontDescription.cpp */, + 8448DA5212B67424003E0F48 /* ofxPCPangoFontDescription.h */, + 8448DA5312B67424003E0F48 /* ofxPCPangoLayout.cpp */, + 8448DA5412B67424003E0F48 /* ofxPCPangoLayout.h */, + 8448DA5512B67424003E0F48 /* ofxPCSurface.cpp */, + 8448DA5612B67424003E0F48 /* ofxPCSurface.h */, + ); + name = src; + path = ../../../ofxPango/src; + sourceTree = SOURCE_ROOT; + }; + 8448DA2D12B67424003E0F48 /* libs */ = { + isa = PBXGroup; + children = ( + 8448DA2E12B67424003E0F48 /* mac */, + 8448DA3D12B67424003E0F48 /* win */, + ); + path = libs; + sourceTree = "<group>"; + }; + 8448DA2E12B67424003E0F48 /* mac */ = { + isa = PBXGroup; + children = ( + 8448DA2F12B67424003E0F48 /* static */, + ); + path = mac; + sourceTree = "<group>"; + }; + 8448DA2F12B67424003E0F48 /* static */ = { + isa = PBXGroup; + children = ( + 8448DA3012B67424003E0F48 /* libcairo.a */, + 8448DA3112B67424003E0F48 /* libcharset.a */, + 8448DA3212B67424003E0F48 /* libgettextpo.a */, + 8448DA3312B67424003E0F48 /* libgio-2.0.a */, + 8448DA3412B67424003E0F48 /* libglib-2.0.a */, + 8448DA3512B67424003E0F48 /* libgmodule-2.0.a */, + 8448DA3612B67424003E0F48 /* libgobject-2.0.a */, + 8448DA3712B67424003E0F48 /* libgthread-2.0.a */, + 8448DA3812B67424003E0F48 /* libiconv.a */, + 8448DA3912B67424003E0F48 /* libintl.a */, + 8448DA3A12B67424003E0F48 /* libpango-1.0.a */, + 8448DA3B12B67424003E0F48 /* libpangocairo-1.0.a */, + 8448DA3C12B67424003E0F48 /* libpixman-1.a */, + ); + path = static; + sourceTree = "<group>"; + }; + 8448DA3D12B67424003E0F48 /* win */ = { + isa = PBXGroup; + children = ( + 8448DA3E12B67424003E0F48 /* freetype6.dll */, + 8448DA3F12B67424003E0F48 /* libexpat-1.dll */, + 8448DA4012B67424003E0F48 /* libfontconfig-1.dll */, + 8448DA4112B67424003E0F48 /* libgio-2.0-0.dll */, + 8448DA4212B67424003E0F48 /* libglib-2.0-0.dll */, + 8448DA4312B67424003E0F48 /* libgmodule-2.0-0.dll */, + 8448DA4412B67424003E0F48 /* libgobject-2.0-0.dll */, + 8448DA4512B67424003E0F48 /* libgthread-2.0-0.dll */, + 8448DA4612B67424003E0F48 /* libpangoft2-1.0-0.dll */, + 8448DA4712B67424003E0F48 /* libpangowin32-1.0-0.dll */, + 8448DA4812B67424003E0F48 /* libpng14-14.dll */, + 8448DA4912B67424003E0F48 /* static */, + ); + path = win; + sourceTree = "<group>"; + }; + 8448DA4912B67424003E0F48 /* static */ = { + isa = PBXGroup; + children = ( + 8448DA4A12B67424003E0F48 /* libcairo-2.dll */, + 8448DA4B12B67424003E0F48 /* libpango-1.0-0.dll */, + 8448DA4C12B67424003E0F48 /* libpangocairo-1.0-0.dll */, + ); + path = static; + sourceTree = "<group>"; + }; 847D386012ABC55E006E9CA2 /* src */ = { isa = PBXGroup; children = ( @@ -360,6 +513,7 @@ 84BFF66D11C4CD9C000DB417 /* addons */ = { isa = PBXGroup; children = ( + 8448D94B12B67424003E0F48 /* src */, 847D386012ABC55E006E9CA2 /* src */, 840F2CCA11E788F200C5CD20 /* src */, 840F2C9211E7869C00C5CD20 /* src */, @@ -860,6 +1014,11 @@ 847D3AF712AD91F4006E9CA2 /* BarsView.cpp in Sources */, 847D3AF812AD91F4006E9CA2 /* SquaresView.cpp in Sources */, 8448D52B12B5AD03003E0F48 /* ConsoleView.cpp in Sources */, + 8448DA6512B67424003E0F48 /* ofxPango.cpp in Sources */, + 8448DA6612B67424003E0F48 /* ofxPCContext.cpp in Sources */, + 8448DA6712B67424003E0F48 /* ofxPCPangoFontDescription.cpp in Sources */, + 8448DA6812B67424003E0F48 /* ofxPCPangoLayout.cpp in Sources */, + 8448DA6912B67424003E0F48 /* ofxPCSurface.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -943,7 +1102,9 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_7)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_8)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../../../ofxPango/src/libs/mac/static\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../libs/freeimage/lib/osx\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_14 = "\"$(SRCROOT)/../../../libs/fmodex/lib/osx\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_15 = "\"$(SRCROOT)/../../../libs/freetype/lib/osx\""; @@ -987,6 +1148,7 @@ ../../../../of/of_preRelease_v0061_osx_FAT/libs/openFrameworks/libs/freetype/include/freetype2, ../../../../of/of_preRelease_v0061_osx_FAT/libs/poco/include, ../../../../of/of_preRelease_v0061_osx_FAT/addons/, + "../../../ofxPango/src/includes//**", ); OTHER_CPLUSPLUSFLAGS = ( "-D__MACOSX_CORE__", @@ -1074,6 +1236,7 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_7)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_8)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_9)", ); LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../libs/freeimage/lib/osx\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_14 = "\"$(SRCROOT)/../../../libs/fmodex/lib/osx\""; @@ -1085,6 +1248,7 @@ LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_6 = "\"$(SRCROOT)/../../../libs/rtAudio/lib/osx\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_7 = "\"$(SRCROOT)/src\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_8 = "\"$(SRCROOT)/../../../../of/of_preRelease_v0061_osx_FAT/libs/openFrameworksCompiled/lib/osx\""; + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_9 = "\"$(SRCROOT)/../../../ofxPango/src/libs/mac/static\""; PREBINDING = NO; PRODUCT_NAME = "$(TARGET_NAME)Debug"; WRAPPER_EXTENSION = app; @@ -1129,7 +1293,9 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_7)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_8)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../../../ofxPango/src/libs/mac/static\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../libs/freeimage/lib/osx\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_14 = "\"$(SRCROOT)/../../../libs/fmodex/lib/osx\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_15 = "\"$(SRCROOT)/../../../libs/freetype/lib/osx\""; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-13 16:02:27 UTC (rev 251) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-13 20:11:23 UTC (rev 252) @@ -91,6 +91,7 @@ m_y + rows * m_arrayFont->getLineHeight() + kDrawMethodBorder); dx = bounds.width; dy = bounds.height; + //the bounds rect is funny, so omit drawing it for now (by not setting bgcolor) if (bgcolor != 0xffffff) { ofSetColor(0); ofRect(bounds.x, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-13 16:02:33
|
Revision: 251 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=251&view=rev Author: mchinen Date: 2010-12-13 16:02:27 +0000 (Mon, 13 Dec 2010) Log Message: ----------- update windows project. Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj 2010-12-13 05:17:19 UTC (rev 250) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj 2010-12-13 16:02:27 UTC (rev 251) @@ -227,6 +227,14 @@ > </File> <File + RelativePath=".\src\ConsoleView.cpp" + > + </File> + <File + RelativePath=".\src\ConsoleView.h" + > + </File> + <File RelativePath=".\src\handyfuncs.cpp" > </File> Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp 2010-12-13 05:17:19 UTC (rev 250) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp 2010-12-13 16:02:27 UTC (rev 251) @@ -6,26 +6,26 @@ { if(!arrays.size()) return; - int len = SortingMan::Instance()->GetArraySize(); - double* array = arrays[arrays.size() - 1]; - int* status = markers[markers.size() - 1]; - float y1,y2; - for(int i=0;i<len;i++){ - - int color; + int len = SortingMan::Instance()->GetArraySize(); + double* array = arrays[arrays.size() - 1]; + int* status = markers[markers.size() - 1]; + float y1,y2; + for(int i=0;i<len;i++){ + + int color; if(status[i] & kMarkerChanged) color = 0xFF22FF; //take out some green and blue components else if(status[i] & kMarkerCompared) color = 0x22FFFF; //take out some green and red components else if(status[i] & kMarkerFocused) color = 0xFFFF22; //take out some red and blue components - else - color = 0x666666; - - ofSetColor(color); - y1 = m_height/2; - y2 = (1.0 + (array[i]/-100.0)) * m_height/2; - ofRect(m_x + m_width * ((float)i/len), m_y + mymin(y1,y2), - (float)m_width/len, fabs(y1-y2)); + else + color = 0x666666; + + ofSetColor(color); + y1 = m_height/2; + y2 = (1.0 + (array[i]/-100.0)) * m_height/2; + ofRect(m_x + m_width * ((float)i/len), m_y + mymin(y1,y2), + (float)m_width/len, fabs(y1-y2)); } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-13 05:17:26
|
Revision: 250 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=250&view=rev Author: mchinen Date: 2010-12-13 05:17:19 +0000 (Mon, 13 Dec 2010) Log Message: ----------- major text overhaul add colors, better scaling Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.h algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h Added Paths: ----------- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.h Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-12 19:34:16 UTC (rev 249) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-13 05:17:19 UTC (rev 250) @@ -27,6 +27,7 @@ 840F2DF911E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840F2DF811E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp */; }; 8416E04411DA9FBA003A3B23 /* openFrameworks.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8416E04311DA9FBA003A3B23 /* openFrameworks.a */; }; 8416E0EC11DDFCA0003A3B23 /* cleanerinsert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */; }; + 8448D52B12B5AD03003E0F48 /* ConsoleView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */; }; 847D385D12ABC4E6006E9CA2 /* ofxMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */; }; 847D386312ABC55E006E9CA2 /* ofxThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D386112ABC55E006E9CA2 /* ofxThread.cpp */; }; 847D3AF612AD91F4006E9CA2 /* ArrayView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D3AF012AD91F4006E9CA2 /* ArrayView.cpp */; }; @@ -155,6 +156,8 @@ 840F2DF811E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxSimpleGuiTextInput.cpp; sourceTree = "<group>"; }; 8416E04311DA9FBA003A3B23 /* openFrameworks.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = openFrameworks.a; path = ../../../../of/of_preRelease_v0061_osx_FAT/libs/openFrameworksCompiled/lib/osx/openFrameworks.a; sourceTree = SOURCE_ROOT; }; 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cleanerinsert.cpp; sourceTree = "<group>"; }; + 8448D52912B5AD03003E0F48 /* ConsoleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleView.h; sourceTree = "<group>"; }; + 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsoleView.cpp; sourceTree = "<group>"; }; 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxMutex.cpp; sourceTree = "<group>"; }; 847D385C12ABC4E6006E9CA2 /* ofxMutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxMutex.h; sourceTree = "<group>"; }; 847D386112ABC55E006E9CA2 /* ofxThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxThread.cpp; sourceTree = "<group>"; }; @@ -650,6 +653,8 @@ E4B69E1D0A3A1BDC003C02F2 /* main.cpp */, E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */, E4B69E1F0A3A1BDC003C02F2 /* testApp.h */, + 8448D52912B5AD03003E0F48 /* ConsoleView.h */, + 8448D52A12B5AD03003E0F48 /* ConsoleView.cpp */, ); path = src; sourceTree = SOURCE_ROOT; @@ -854,6 +859,7 @@ 847D3AF612AD91F4006E9CA2 /* ArrayView.cpp in Sources */, 847D3AF712AD91F4006E9CA2 /* BarsView.cpp in Sources */, 847D3AF812AD91F4006E9CA2 /* SquaresView.cpp in Sources */, + 8448D52B12B5AD03003E0F48 /* ConsoleView.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.h 2010-12-12 19:34:16 UTC (rev 249) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.h 2010-12-13 05:17:19 UTC (rev 250) @@ -2,6 +2,8 @@ #define __ARRAY_VIEW_H__ #include <vector> + +#define kHighNumberBrightness 0xFF class ArrayView { public: Added: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.cpp 2010-12-13 05:17:19 UTC (rev 250) @@ -0,0 +1,151 @@ +/* + * ConsoleView.cpp + * AlgorhythmicSorting + * + * Created by mchinen on 12/13/10. + * Copyright 2010 Institute for Algorhythmics. All rights reserved. + * + */ + +#include "ConsoleView.h" +#include "SortingMan.h" +#include "ofMain.h" +#define kDrawMethodBorder 10 + +ConsoleView::ConsoleView(int x, int y, int width, int height) +:ArrayView(x,y,width,height) +{ + m_arrayFont = new ofTrueTypeFont; + m_currFontSize = -1; + m_lastArraySize = -1; +} + + +void ConsoleView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) +{ + //console is a special case cause we mix console messages with the array history. + //maintain a vector of <history array ptr key, console string> that keeps track + //of when in the history the string came out. The console string should be printed + //after the history array. + //a key of NULL means it is on the top. + //we only need to keep track of CalcNumRowsNeeded() of these because the display will be full then. + console_map m; + do { + m = SortingMan::Instance()->PopOutput(); + if (m.message) + m_consoleOutput.push_back(m); + } while(m.message) + ; + + //detect if we have too many messages + int rows = CalcNumRowsNeeded(); + while (m_consoleOutput.size() > rows) { + free(m_consoleOutput[0].message); + m_consoleOutput.erase(m_consoleOutput.begin() + 0); + } + + //start drawing from the bottom up. + int consoleCursor = m_consoleOutput.size() - 1; + int startRow = arrays.size() - 1; + int len = SortingMan::Instance()->GetArraySize(); + int xCursor; + char fill[5]; + fill[4] = 0; + fill[0] = fill[1] = fill[2] = 'p'; + fill[3] = '1'; + for (int i = startRow; rows > 0 && i >= 0; i--) { + //before we draw the array, see if a console message comes after it. + while (consoleCursor >= 0 && + m_consoleOutput[consoleCursor].ownerArrayPtr == arrays[i]) { + //draw the message + m_arrayFont->drawString(m_consoleOutput[consoleCursor].message, + m_x + kDrawMethodBorder, + m_y + rows * m_arrayFont->getLineHeight() + kDrawMethodBorder); + rows--; + consoleCursor--; + } + + //draw the array using the same cmy(k) scheme in the other views. + xCursor = 0; + for(int j = 0; j < len; j++) { + double val; + int color, bgcolor; + char numStr[8]; + int dx, dy; + + val = arrays[i][j]; + sprintf(numStr, "%3.0f ", val); + //sprintf might not null terminate. + numStr[4] = 0; + color = 0x0; + bgcolor = 0xffffff; + if(markers[i][j] & kMarkerChanged) + color = 0x881188; //take out some green and blue components + else if(markers[i][j] & kMarkerCompared) + color = 0x118888; //take out some green and red components + else if(markers[i][j] & kMarkerFocused) + color = 0x888811; //take out some red and blue components + + ofRectangle bounds = m_arrayFont->getStringBoundingBox(fill, + m_x + kDrawMethodBorder + xCursor, + m_y + rows * m_arrayFont->getLineHeight() + kDrawMethodBorder); + dx = bounds.width; + dy = bounds.height; + if (bgcolor != 0xffffff) { + ofSetColor(0); + ofRect(bounds.x, + bounds.y, + dx, dy); + } + ofSetColor(color); + m_arrayFont->drawString(numStr, + m_x + kDrawMethodBorder + xCursor, + m_y + rows * m_arrayFont->getLineHeight() + kDrawMethodBorder); + //stringWidth doesn't handle spaces, so substitute a char filled buffer + + xCursor += dx; + } + rows--; + } + + //draw whatever console messages can fit above + while (consoleCursor >= 0 && rows > 0) { + ofSetColor(kHighNumberBrightness, kHighNumberBrightness, kHighNumberBrightness); + m_arrayFont->drawString(m_consoleOutput[consoleCursor].message, + m_x + kDrawMethodBorder, + m_y + rows * m_arrayFont->getLineHeight() + kDrawMethodBorder); + rows--; + consoleCursor--; + } +} + + +int ConsoleView::CalcNumRowsNeeded() +{ + int len = SortingMan::Instance()->GetArraySize(); + int viewWidth = m_width - kDrawMethodBorder * 2; + int viewHeight = m_height - kDrawMethodBorder * 2; + + //compute font size + if (m_lastArraySize != len) { + int desiredFontSize = 10; + //Make sure the font size fits in the view size + static char test[800]; + memset(test, 'p', 800); + test[len*4] = 0; + + do { + delete m_arrayFont; + m_arrayFont = new ofTrueTypeFont; + m_arrayFont->loadFont("Inconsolata.otf",desiredFontSize,true, true); + m_currFontSize = desiredFontSize--; + } while (desiredFontSize > 3 && + m_arrayFont->stringWidth(test) > viewWidth - 2 * kDrawMethodBorder) + ; + + m_lastArraySize = len; + } + int lineHeight = m_arrayFont->getLineHeight(); + return viewHeight / lineHeight; +} + Added: algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.h (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ConsoleView.h 2010-12-13 05:17:19 UTC (rev 250) @@ -0,0 +1,33 @@ +/* + * ConsoleView.h + * AlgorhythmicSorting + * + * Created by mchinen on 12/13/10. + * Copyright 2010 Institute for Algorhythmics. All rights reserved. + * + */ + +#ifndef __CONSOLE_VIEW_H__ +#define __CONSOLE_VIEW_H__ + +#include "ArrayView.h" +#include "SortingMan.h" + +class ofTrueTypeFont; +class ConsoleView : public ArrayView +{ +public: + ConsoleView(int x, int y, int width, int height); + virtual ~ConsoleView(){} + + virtual void Draw(std::vector<double*> &arrays, std::vector<int*> &markers); + //if the number of rows displayed is more than one override this. + virtual int CalcNumRowsNeeded(); +protected: + ofTrueTypeFont *m_arrayFont; + std::vector<console_map> m_consoleOutput; + int m_currFontSize; + int m_lastArraySize; +}; + +#endif \ No newline at end of file Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-12 19:34:16 UTC (rev 249) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-13 05:17:19 UTC (rev 250) @@ -31,41 +31,35 @@ void* priv; }; -#define kStringSizeLimit 10000 void SortingMan::AppendToOutput(const char* inputString) { -// NSString* temp; - //this will append the input to this member string. Creates a new reference, so we have to be careful. + int len = strlen(inputString) + 1; + char *entry = (char*)malloc(sizeof(char) * len); + console_map m; + + memcpy(entry, inputString, sizeof(char) * len); + m.message = entry; + stringLock.lock(); - if( strlen(m_outputString) + strlen(inputString) < kStringSizeLimit) //size limit - { - strcat(m_outputString,inputString); - } - else if(strlen(inputString)<kStringSizeLimit) - { - strcpy(m_outputString, inputString); - } -// [NSString stringWithString:inputString]];// encoding:NSASCIIStringEncoding ] ]; -// [m_outputString retain]; - + m.ownerArrayPtr = m_lastArrayPtr; + m_outputStrings.push_back(m); stringLock.unlock(); - } -char* SortingMan::PopOutput() +console_map SortingMan::PopOutput() { - char* ret; + console_map ret; stringLock.lock(); - - ret = m_outputString; - - m_outputString = (char*)malloc(kStringSizeLimit+1); - m_outputString[0]=0;//null terminate - + if(m_outputStrings.size()) { + ret = m_outputStrings[0]; + m_outputStrings.erase(m_outputStrings.begin() + 0); + } else { + ret.message = NULL; + } stringLock.unlock(); - //has one retain count will be released by refresh view + //users will need to delete ret.message if non null return ret; } @@ -79,7 +73,7 @@ int *marks = (int*)malloc(sizeof(int) * n); memcpy(marks, marker, sizeof(int) * n); m_markers.push_back(marks); - + m_lastArrayPtr = entry; stringLock.unlock(); } @@ -145,9 +139,8 @@ GenerateNewArray(m_size); m_isSorting=false; m_shouldStop = false; - m_outputString = (char*)malloc(kStringSizeLimit+1); - m_outputString[0]=0;//null terminate - return m_inited; + m_lastArrayPtr = NULL; + return m_inited; } @@ -158,6 +151,9 @@ //to keep the thread ref around (unlike pthreads) static SortThread thread; + if(thread.isThreadRunning()) + return; + while(ShouldStop()) { #ifdef WIN32 Sleep(1); //windows sleep in milliseconds @@ -166,7 +162,9 @@ #endif } + isSortingLock.lock(); m_isSorting=true; + isSortingLock.unlock(); m_lastSort.size = m_size; m_lastSort.algo = m_type; m_lastSort.shouldStop = false; @@ -180,7 +178,6 @@ thread.SetPriv(&m_lastSort); thread.startThread(true,false); - // sortstuffhelper(&m_lastSort); } void SortingMan::StopSorting() @@ -191,6 +188,24 @@ m_shouldStop = true; } } + + +bool SortingMan::IsSorting() +{ + bool ret; + isSortingLock.lock(); + ret = m_isSorting; + isSortingLock.unlock(); + return ret; +} +void SortingMan::SetDoneSorting() +{ + isSortingLock.lock(); + m_isSorting=false; + m_shouldStop = false; + isSortingLock.unlock(); +} + void SortingMan::SetAlgorithm(SortAlgorithms newType) { @@ -244,9 +259,8 @@ //get the name of the algo - this can change algoName = gAlgoStrings[params->algo]; - sprintf(mystring,"%s with array of length %d, speed %f, pitch range %d-%d\n",algoName,n,AlgorhythmicAudioIO::Instance()->GetSpeed(),freqMin,freqMax); -// @"%@ with array of length %d, speed %f, pitch range %d-%d\n",algoName,n,AlgorhythmicAudioIO::Instance()->GetSpeed(),freqMin,freqMax] -// attributes: blueAttrs]; + sprintf(mystring,"%s with array of length %d, speed %f, pitch range %d-%d\n", + algoName,n,AlgorhythmicAudioIO::Instance()->GetSpeed(),freqMin,freqMax); SortingMan::Instance()->AppendToOutput(mystring); //create array based on seed @@ -297,26 +311,17 @@ //print the array clean printdoublearray(a, n,0,0); - sprintf(mystring, "\n%s %s. Approx. %i comparisons/moves. lapsed time:%.2f ms\n\n", + sprintf(mystring, "%s %s. Approx. %i comparisons/moves. lapsed time:%.2f ms\n", algoName, SortingMan::Instance()->ShouldStop()?"cancelled":"finished", AlgorhythmicAudioIO::Instance()->GetEvalCount(), -1); -// mystring = [[NSAttributedString alloc] -// initWithString:[NSString stringWithFormat: -// @"\n%@ %@. Approx. %i comparisons/moves. lapsed time:%.2f ms\n\n", -// algoName, -// SortingMan::Instance()->ShouldStop()?@"cancelled":@"finished", -// AlgorhythmicAudioIO::Instance()->GetEvalCount(), -// timePassed_ms] -// attributes: blueAttrs]; + SortingMan::Instance()->AppendToOutput(mystring); -// [mystring autorelease]; }while(SortingMan::Instance()->IsLooping() && !SortingMan::Instance()->ShouldStop()) ; SortingMan::Instance()->SetDoneSorting(); -// [blueAttrs release]; AlgorhythmicAudioIO::Instance()->Stop(); return 0; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h 2010-12-12 19:34:16 UTC (rev 249) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h 2010-12-13 05:17:19 UTC (rev 250) @@ -34,6 +34,11 @@ long seed; }; +typedef struct console_map { + double *ownerArrayPtr; + char *message; +} console_map; + //for array markers returned by PopHistory() #define kMarkerChanged 1 #define kMarkerFocused 2 @@ -48,7 +53,7 @@ bool Init(); void AppendToOutput(const char* inputString); - char* PopOutput(); + console_map PopOutput(); void AppendToHistory(double *array, int *marker, int n); @@ -59,8 +64,8 @@ void SortStuff(); void StopSorting(); - bool IsSorting() {return m_isSorting;} - void SetDoneSorting(){m_isSorting=false; m_shouldStop = false;} + bool IsSorting(); + void SetDoneSorting(); void SetAlgorithm(SortAlgorithms newType); void GenerateNewArray(int size); @@ -79,10 +84,11 @@ SortingMan(); virtual ~SortingMan(); - char* volatile m_outputString; + std::vector<console_map> m_outputStrings; std::vector<double*> m_history; std::vector<int*> m_markers; // pthread_mutex_t m_outViewMutex; + double *m_lastArrayPtr; bool m_inited; bool m_looping; @@ -94,11 +100,12 @@ int m_size; SortAlgorithms m_type; - bool m_isSorting; + volatile bool m_isSorting; sort_params m_lastSort; bool m_shouldStop; ofxMutex stringLock ; + ofxMutex isSortingLock ; }; #endif Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2010-12-12 19:34:16 UTC (rev 249) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2010-12-13 05:17:19 UTC (rev 250) @@ -15,7 +15,7 @@ int val; int color; val = arrays[i - startRow][j]; - color = 0xFF * ((float) (val+100)/200.0);//brightness + color = kHighNumberBrightness * ((float) (val+100)/200.0);//brightness //copy to other bytes color |= color << 8 | color << 16; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-12 19:34:16 UTC (rev 249) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-13 05:17:19 UTC (rev 250) @@ -95,15 +95,15 @@ } //save last[i] = array[i]; - sprintf(myString," %4.0f",array[i]); +// sprintf(myString," %3.0f",array[i]); - SortingMan::Instance()->AppendToOutput(myString); +// SortingMan::Instance()->AppendToOutput(myString); } SortingMan::Instance()->AppendToHistory(array, arrayStatus, size); SortingMan::Instance()->SetArrayStatus(arrayStatus); - sprintf(myString,"\n"); - SortingMan::Instance()->AppendToOutput(myString); +// sprintf(myString,"\n"); +// SortingMan::Instance()->AppendToOutput(myString); #ifdef WIN32 Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-12 19:34:16 UTC (rev 249) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-13 05:17:19 UTC (rev 250) @@ -7,10 +7,12 @@ #include "ofxSimpleGuiComboBox.h" #include "SquaresView.h" #include "BarsView.h" +#include "ConsoleView.h" #define kSquaresViewIndex 0 #define kBarsViewIndex 1 +#define kConsoleViewIndex 2 float speedSliderVal; float speedSliderVal_old; @@ -82,6 +84,7 @@ //setup views views.push_back(new SquaresView(0,0,ofGetWidth(),ofGetHeight())); views.push_back(new BarsView(0,0,ofGetWidth(),ofGetHeight())); + views.push_back(new ConsoleView(0,0,ofGetWidth(),ofGetHeight())); viewMode = eDrawAll; ofSetFrameRate(60); } @@ -96,6 +99,10 @@ SortingMan::Instance()->StopSorting(); startButtonControl->setName("start"); } else { + if (prev_arraysize != arraysize) { + SortingMan::Instance()->GenerateNewArray(arraysize); + prev_arraysize = arraysize; + } SortingMan::Instance()->SortStuff(); startButtonControl->setName("stop"); } @@ -104,9 +111,8 @@ startButtonControl->setName("start"); } - if(genButton || prev_arraysize != arraysize){ + if(genButton){ genButton = false; - prev_arraysize = arraysize; SortingMan::Instance()->GenerateNewArray(arraysize); } @@ -129,23 +135,27 @@ if (viewMode == eDrawAll) { views[kSquaresViewIndex]->SetRect(0, 0, ofGetWidth() / 2, ofGetHeight() / 2); views[kBarsViewIndex]->SetRect(ofGetWidth() / 2, 0, ofGetWidth() / 2, ofGetHeight() / 2); + views[kConsoleViewIndex]->SetRect(0, ofGetHeight() / 2, ofGetWidth(), ofGetHeight() /2); fetchHistory(); for ( int i = 0; i < views.size(); i++) views[i]->Draw(history, markers); - drawConsole(0, ofGetHeight() / 2, ofGetWidth(), ofGetHeight() /2); } else if (viewMode == eDrawSquares) { views[kSquaresViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); + views[kConsoleViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); fetchHistory(); views[kSquaresViewIndex]->Draw(history, markers); - drawConsole(0, 0, ofGetWidth(), ofGetHeight()); + views[kConsoleViewIndex]->Draw(history, markers); } else if (viewMode == eDrawBars) { views[kBarsViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); + views[kConsoleViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); fetchHistory(); views[kBarsViewIndex]->Draw(history, markers); - drawConsole(0, 0, ofGetWidth(), ofGetHeight()); + views[kConsoleViewIndex]->Draw(history, markers); } else if (viewMode == eDrawConsole) { - drawConsole(0, 0, ofGetWidth(), ofGetHeight()); + views[kConsoleViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); + fetchHistory(); + views[kConsoleViewIndex]->Draw(history, markers); } if(drawGUI) @@ -193,89 +203,6 @@ lastlen = len; } -void testApp::drawConsole(int x, int y, int width, int height) -{ - static int bufsize = 0; - char* poppedString; - unsigned int popsize; - static int lines=0; - - poppedString = SortingMan::Instance()->PopOutput(); - //only draw if we have something. don't use strlen cause it can be slow. - if(poppedString[0]!=0) { - popsize = strlen(poppedString);//take off the null terminator, since this won't be copied - // free(lastDrawString); - if(popsize > kArraysStringMaxSize) { - strcpy(lastDrawString, poppedString+(popsize-kArraysStringMaxSize)); - bufsize = kArraysStringMaxSize; - } - else if(bufsize + popsize>kArraysStringMaxSize) { - memmove(lastDrawString, lastDrawString+(bufsize-popsize), popsize); - strcpy(lastDrawString+(kArraysStringMaxSize-popsize),poppedString); - bufsize = kArraysStringMaxSize; - } - else{ - strcat(lastDrawString,poppedString); - bufsize+=popsize; - } - //compute font size - static int lastsize = -1; - - if (lastsize != prev_arraysize) { - int desiredFontSize = 10; - //compute where we should start - static char test[800]; - memset(test, 'p', 800); - test[prev_arraysize*4] = 0; - - do { - delete arrayFont; - arrayFont = new ofTrueTypeFont; - arrayFont->loadFont("Inconsolata.otf",desiredFontSize,true, true); - currFontSize = desiredFontSize--; - } while (desiredFontSize > 3 && - arrayFont->stringWidth(test) > width - 16 * kDrawMethodBorder) //this is a hack - stringWidth is wrong. - ; - lastsize = prev_arraysize; - } - - int viewHeight = height - kDrawMethodBorder; - int lineHeight = arrayFont->getLineHeight(); - int n = bufsize; - lines = 0; - while(--n > -1) { - - if(lastDrawString[n]=='\n') { - lines++; - } - if(lines * lineHeight > viewHeight) - { - n++;//restore n to point after the endline. - break; - } - - } - - //truncate the string. - if(n>0) { - memmove(lastDrawString, lastDrawString+n, bufsize-n); - - bufsize -= n; - lastDrawString[bufsize]=0;//put a new null term. - } - - - } - - free(poppedString); - - if(lastDrawString && (viewMode == eDrawConsole || viewMode == eDrawAll)){ - ofSetColor(0xFF0000); - // ofDrawBitmapString(lastDrawString,kConsoleX,kConsoleY); - arrayFont->drawString(lastDrawString, x + kDrawMethodBorder, y + kDrawMethodBorder); - } -} - //-------------------------------------------------------------- void testApp::keyPressedMouseMode(int key) { Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-12 19:34:16 UTC (rev 249) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-13 05:17:19 UTC (rev 250) @@ -76,9 +76,6 @@ void windowResized(int w, int h); protected: - void drawBars(int x, int y, int width, int height); - void drawConsole(int x, int y, int width, int height); - void drawSquares(int x, int y, int width, int height); void fetchHistory(); std::vector<double*> history; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-12 19:34:22
|
Revision: 249 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=249&view=rev Author: mchinen Date: 2010-12-12 19:34:16 +0000 (Sun, 12 Dec 2010) Log Message: ----------- fix latency on mac Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp 2010-12-07 00:10:12 UTC (rev 248) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp 2010-12-12 19:34:16 UTC (rev 249) @@ -324,7 +324,7 @@ mzsortdata.seperatorPlayed = true; /* Initialize library before making any other calls. */ err = Pa_Initialize(); - + m_actualLatency = 0.0001f; m_inited= err == paNoError ; // audioDataMutex = [[NSLock alloc] init]; @@ -452,30 +452,34 @@ /* Open an audio I/O stream. */ PaDeviceIndex outDev = Pa_GetDefaultOutputDevice(); PaStreamParameters playbackParameters; - playbackParameters.device = outDev; - playbackParameters.sampleFormat = paFloat32; - playbackParameters.hostApiSpecificStreamInfo = NULL; + playbackParameters.device = outDev; + playbackParameters.sampleFormat = paFloat32; + playbackParameters.hostApiSpecificStreamInfo = NULL; playbackParameters.channelCount = 2; playbackParameters.suggestedLatency = kAudioLatency/1000.0; - err = Pa_OpenStream( &m_stream, - NULL, &playbackParameters, - SAMPLE_RATE, /*paFramesPerBufferUnspecified, */256, - paNoFlag, + err = Pa_OpenStream( &m_stream, + NULL, &playbackParameters, + SAMPLE_RATE, /*paFramesPerBufferUnspecified, */256, + paNoFlag, SortingPortAudioCallback, &data ); -// err = Pa_OpenDefaultStream( &m_stream, -// 0, /* no input channels */ -// 2, /* stereo output */ -// paFloat32, /* 32 bit floating point output */ -// SAMPLE_RATE, -// 256, /* frames per buffer */ -// SortingPortAudioCallback, -// &data ); if( err != paNoError ) return false; + err = Pa_StartStream( m_stream ); if( err != paNoError ) return false; + + const PaStreamInfo *info; + info = Pa_GetStreamInfo(&m_stream); + + if(info && info->outputLatency > 0) + m_actualLatency = info->outputLatency; + else { + m_actualLatency = (256.0/44100.0)/1000.0; + } + + return true; } bool AlgorhythmicAudioIO::Stop() Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-12-07 00:10:12 UTC (rev 248) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-12-12 19:34:16 UTC (rev 249) @@ -78,6 +78,7 @@ void ResetEvalCount(){mzsortdata.approxEvals =0;} int GetEvalCount(){return mzsortdata.approxEvals;} + float GetActualLatency(){return m_actualLatency;} protected: //private constructor - Singleton. AlgorhythmicAudioIO(); @@ -85,6 +86,7 @@ virtual ~AlgorhythmicAudioIO(); PaStream* m_stream; + float m_actualLatency; bool m_inited; struct ssortdata mzsortdata; float m_speed; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-07 00:10:12 UTC (rev 248) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-12 19:34:16 UTC (rev 249) @@ -33,7 +33,7 @@ // play the values (freq) of a block secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray(array+focusstart, focussize); // } - float secsLatency = kAudioLatency/1000.0f; + float secsLatency = AlgorhythmicAudioIO::Instance()->GetActualLatency()/1000.0f; //rest so the visuals don't popup before audio. #ifdef WIN32 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-07 00:10:19
|
Revision: 248 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=248&view=rev Author: mchinen Date: 2010-12-07 00:10:12 +0000 (Tue, 07 Dec 2010) Log Message: ----------- make spacebar hit start/stop button Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-06 21:53:13 UTC (rev 247) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-07 00:10:12 UTC (rev 248) @@ -396,6 +396,9 @@ }else if(key == 'x') { keyMode = eKeyModeEffects; + }else if(key == ' ') + { + startButton = 1; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-06 21:53:20
|
Revision: 247 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=247&view=rev Author: mchinen Date: 2010-12-06 21:53:13 +0000 (Mon, 06 Dec 2010) Log Message: ----------- add new files to mac project Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-06 21:06:46 UTC (rev 246) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-06 21:53:13 UTC (rev 247) @@ -29,6 +29,9 @@ 8416E0EC11DDFCA0003A3B23 /* cleanerinsert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */; }; 847D385D12ABC4E6006E9CA2 /* ofxMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */; }; 847D386312ABC55E006E9CA2 /* ofxThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D386112ABC55E006E9CA2 /* ofxThread.cpp */; }; + 847D3AF612AD91F4006E9CA2 /* ArrayView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D3AF012AD91F4006E9CA2 /* ArrayView.cpp */; }; + 847D3AF712AD91F4006E9CA2 /* BarsView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D3AF212AD91F4006E9CA2 /* BarsView.cpp */; }; + 847D3AF812AD91F4006E9CA2 /* SquaresView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D3AF412AD91F4006E9CA2 /* SquaresView.cpp */; }; 84BE5526119B20CA0092BDA7 /* handyfuncs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84BE5524119B20CA0092BDA7 /* handyfuncs.cpp */; }; 84BFF6B111C4CECD000DB417 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84BFF6AA11C4CECD000DB417 /* tinyxml.cpp */; }; 84BFF6B211C4CECD000DB417 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84BFF6AC11C4CECD000DB417 /* tinyxmlerror.cpp */; }; @@ -156,6 +159,12 @@ 847D385C12ABC4E6006E9CA2 /* ofxMutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxMutex.h; sourceTree = "<group>"; }; 847D386112ABC55E006E9CA2 /* ofxThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxThread.cpp; sourceTree = "<group>"; }; 847D386212ABC55E006E9CA2 /* ofxThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxThread.h; sourceTree = "<group>"; }; + 847D3AF012AD91F4006E9CA2 /* ArrayView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayView.cpp; sourceTree = "<group>"; }; + 847D3AF112AD91F4006E9CA2 /* ArrayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayView.h; sourceTree = "<group>"; }; + 847D3AF212AD91F4006E9CA2 /* BarsView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BarsView.cpp; sourceTree = "<group>"; }; + 847D3AF312AD91F4006E9CA2 /* BarsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BarsView.h; sourceTree = "<group>"; }; + 847D3AF412AD91F4006E9CA2 /* SquaresView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SquaresView.cpp; sourceTree = "<group>"; }; + 847D3AF512AD91F4006E9CA2 /* SquaresView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SquaresView.h; sourceTree = "<group>"; }; 84BE5524119B20CA0092BDA7 /* handyfuncs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = handyfuncs.cpp; sourceTree = "<group>"; }; 84BE5525119B20CA0092BDA7 /* handyfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = handyfuncs.h; sourceTree = "<group>"; }; 84BFF6A811C4CECD000DB417 /* install.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = install.xml; sourceTree = "<group>"; }; @@ -612,6 +621,12 @@ E4B69E1C0A3A1BDC003C02F2 /* src */ = { isa = PBXGroup; children = ( + 847D3AF012AD91F4006E9CA2 /* ArrayView.cpp */, + 847D3AF112AD91F4006E9CA2 /* ArrayView.h */, + 847D3AF212AD91F4006E9CA2 /* BarsView.cpp */, + 847D3AF312AD91F4006E9CA2 /* BarsView.h */, + 847D3AF412AD91F4006E9CA2 /* SquaresView.cpp */, + 847D3AF512AD91F4006E9CA2 /* SquaresView.h */, 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */, 847D385C12ABC4E6006E9CA2 /* ofxMutex.h */, 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */, @@ -836,6 +851,9 @@ 840F2DF911E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp in Sources */, 847D385D12ABC4E6006E9CA2 /* ofxMutex.cpp in Sources */, 847D386312ABC55E006E9CA2 /* ofxThread.cpp in Sources */, + 847D3AF612AD91F4006E9CA2 /* ArrayView.cpp in Sources */, + 847D3AF712AD91F4006E9CA2 /* BarsView.cpp in Sources */, + 847D3AF812AD91F4006E9CA2 /* SquaresView.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-06 21:06:52
|
Revision: 246 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=246&view=rev Author: mchinen Date: 2010-12-06 21:06:46 +0000 (Mon, 06 Dec 2010) Log Message: ----------- Make bars color cmyk. Also refactor view code into c++ classes for cleaner history and better (consistent) drawing of state markers. Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h Added Paths: ----------- algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.h algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.h algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.h Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj 2010-12-06 19:50:18 UTC (rev 245) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj 2010-12-06 21:06:46 UTC (rev 246) @@ -199,6 +199,22 @@ > </File> <File + RelativePath=".\src\ArrayView.cpp" + > + </File> + <File + RelativePath=".\src\ArrayView.h" + > + </File> + <File + RelativePath=".\src\BarsView.cpp" + > + </File> + <File + RelativePath=".\src\BarsView.h" + > + </File> + <File RelativePath=".\src\bubble.cpp" > </File> @@ -271,6 +287,14 @@ > </File> <File + RelativePath=".\src\SquaresView.cpp" + > + </File> + <File + RelativePath=".\src\SquaresView.h" + > + </File> + <File RelativePath=".\src\testApp.cpp" > </File> Added: algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.cpp (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.cpp 2010-12-06 21:06:46 UTC (rev 246) @@ -0,0 +1,15 @@ +#include "ArrayView.h" + + +ArrayView::ArrayView(int x, int y, int width, int height) +{ + SetRect(x, y, width, height); +} + +void ArrayView::SetRect(int x, int y, int width, int height) +{ + m_width = width; + m_height = height; + m_x = x; + m_y = y; +} \ No newline at end of file Added: algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.h (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ArrayView.h 2010-12-06 21:06:46 UTC (rev 246) @@ -0,0 +1,20 @@ +#ifndef __ARRAY_VIEW_H__ +#define __ARRAY_VIEW_H__ + +#include <vector> +class ArrayView +{ +public: + ArrayView(int x, int y, int width, int height); + virtual ~ArrayView(){} + virtual void Draw(std::vector<double*> &arrays, std::vector<int*> &markers) = 0; + //if the number of rows displayed is more than one override this. + virtual int CalcNumRowsNeeded() {return 1;} + void SetRect(int x, int y, int width, int height); +protected: + int m_x; + int m_y; + int m_width; + int m_height; +}; +#endif \ No newline at end of file Added: algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.cpp 2010-12-06 21:06:46 UTC (rev 246) @@ -0,0 +1,31 @@ +#include "BarsView.h" +#include "ofMain.h" +#include "SortingMan.h" +#include "handyfuncs.h" +void BarsView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) +{ + if(!arrays.size()) + return; + int len = SortingMan::Instance()->GetArraySize(); + double* array = arrays[arrays.size() - 1]; + int* status = markers[markers.size() - 1]; + float y1,y2; + for(int i=0;i<len;i++){ + + int color; + if(status[i] & kMarkerChanged) + color = 0xFF22FF; //take out some green and blue components + else if(status[i] & kMarkerCompared) + color = 0x22FFFF; //take out some green and red components + else if(status[i] & kMarkerFocused) + color = 0xFFFF22; //take out some red and blue components + else + color = 0x666666; + + ofSetColor(color); + y1 = m_height/2; + y2 = (1.0 + (array[i]/-100.0)) * m_height/2; + ofRect(m_x + m_width * ((float)i/len), m_y + mymin(y1,y2), + (float)m_width/len, fabs(y1-y2)); + } +} \ No newline at end of file Added: algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.h (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/BarsView.h 2010-12-06 21:06:46 UTC (rev 246) @@ -0,0 +1,14 @@ +#ifndef __BARS_VIEW_H__ +#define __BARS_VIEW_H__ + +#include "ArrayView.h" +class BarsView : public ArrayView +{ +public: + BarsView(int x, int y, int width, int height):ArrayView(x,y,width,height){}; + virtual ~BarsView(){} + + virtual void Draw(std::vector<double*> &arrays, std::vector<int*> &markers); +}; + +#endif \ No newline at end of file Added: algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.cpp 2010-12-06 21:06:46 UTC (rev 246) @@ -0,0 +1,45 @@ +#include "SquaresView.h" +#include "SortingMan.h" +#include "ofMain.h" +#define kDrawMethodBorder 10 +void SquaresView::Draw(std::vector<double*> &arrays, std::vector<int*> &markers) +{ + int len = SortingMan::Instance()->GetArraySize(); + int viewWidth = m_width - kDrawMethodBorder * 2; + int viewHeight = m_height - kDrawMethodBorder * 2; + int squareSize = viewWidth / len; + int numRows = viewHeight / squareSize; + int startRow = numRows - arrays.size(); + for(int i = startRow; i < numRows; i++) { + for(int j = 0; j < len; j++) { + int val; + int color; + val = arrays[i - startRow][j]; + color = 0xFF * ((float) (val+100)/200.0);//brightness + //copy to other bytes + color |= color << 8 | color << 16; + + + if(markers[i - startRow][j] & kMarkerChanged) + color = color & 0xFF22FF; //take out some green and blue components + else if(markers[i - startRow][j] & kMarkerCompared) + color = color & 0x22FFFF; //take out some green and red components + else if(markers[i - startRow][j] & kMarkerFocused) + color = color & 0xFFFF22; //take out some red and blue components + ofSetColor(color); + ofRect(m_x + kDrawMethodBorder + j * squareSize, + m_y + kDrawMethodBorder + i * squareSize, + squareSize, squareSize); + } + } +} + + +int SquaresView::CalcNumRowsNeeded() +{ + int len = SortingMan::Instance()->GetArraySize(); + int viewWidth = m_width - kDrawMethodBorder * 2; + int viewHeight = m_height - kDrawMethodBorder * 2; + int squareSize = viewWidth / len; + return viewHeight / squareSize; +} \ No newline at end of file Added: algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.h (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SquaresView.h 2010-12-06 21:06:46 UTC (rev 246) @@ -0,0 +1,16 @@ +#ifndef __SQUARES_VIEW_H__ +#define __SQUARES_VIEW_H__ + +#include "ArrayView.h" +class SquaresView : public ArrayView +{ +public: + SquaresView(int x, int y, int width, int height):ArrayView(x,y,width,height){}; + virtual ~SquaresView(){} + + virtual void Draw(std::vector<double*> &arrays, std::vector<int*> &markers); + //if the number of rows displayed is more than one override this. + virtual int CalcNumRowsNeeded(); +}; + +#endif \ No newline at end of file Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-06 19:50:18 UTC (rev 245) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-06 21:06:46 UTC (rev 246) @@ -5,7 +5,13 @@ #include "SortingMan.h" #include "AlgorhythmicAudioIO.h" #include "ofxSimpleGuiComboBox.h" +#include "SquaresView.h" +#include "BarsView.h" + +#define kSquaresViewIndex 0 +#define kBarsViewIndex 1 + float speedSliderVal; float speedSliderVal_old; int myInt1; @@ -15,11 +21,7 @@ ofxSimpleGuiButton *startButtonControl; //-------------------------------------------------------------- void testApp::setup(){ - bDrawConsole = true; - bDrawBars = false; - bDrawSquares = false; currFontSize = 10; - drawAll = true; arrayFont = new ofTrueTypeFont; arrayFont->loadFont("Inconsolata.otf", currFontSize, true, true); // arrayFont.setLineHeight(10.0f); @@ -77,7 +79,10 @@ activeEffects = eAudioEffectsAll; audioState = eAudioStateNone; - + //setup views + views.push_back(new SquaresView(0,0,ofGetWidth(),ofGetHeight())); + views.push_back(new BarsView(0,0,ofGetWidth(),ofGetHeight())); + viewMode = eDrawAll; ofSetFrameRate(60); } @@ -120,16 +125,29 @@ //-------------------------------------------------------------- void testApp::draw(){ - if (!drawAll) { - drawBars(0, 0, ofGetWidth(), ofGetHeight()); - drawSquares(0, 0, ofGetWidth(), ofGetHeight()); + + if (viewMode == eDrawAll) { + views[kSquaresViewIndex]->SetRect(0, 0, ofGetWidth() / 2, ofGetHeight() / 2); + views[kBarsViewIndex]->SetRect(ofGetWidth() / 2, 0, ofGetWidth() / 2, ofGetHeight() / 2); + fetchHistory(); + + for ( int i = 0; i < views.size(); i++) + views[i]->Draw(history, markers); + drawConsole(0, ofGetHeight() / 2, ofGetWidth(), ofGetHeight() /2); + } else if (viewMode == eDrawSquares) { + views[kSquaresViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); + fetchHistory(); + views[kSquaresViewIndex]->Draw(history, markers); drawConsole(0, 0, ofGetWidth(), ofGetHeight()); - } else { - drawBars(ofGetWidth() / 2, 0, ofGetWidth() / 2, ofGetHeight() / 2); - drawSquares(0, 0, ofGetWidth() / 2, ofGetHeight() / 2); - drawConsole(0, ofGetHeight() / 2, ofGetWidth(), ofGetHeight() /2); + } else if (viewMode == eDrawBars) { + views[kBarsViewIndex]->SetRect(0, 0, ofGetWidth(), ofGetHeight()); + fetchHistory(); + views[kBarsViewIndex]->Draw(history, markers); + drawConsole(0, 0, ofGetWidth(), ofGetHeight()); + } else if (viewMode == eDrawConsole) { + drawConsole(0, 0, ofGetWidth(), ofGetHeight()); } - + if(drawGUI) gui.draw(); } @@ -137,50 +155,16 @@ static char lastDrawString[kArraysStringMaxSize+1]=""; -void testApp::drawBars(int x, int y, int width, int height) +#define kDrawMethodBorder 10 + +void testApp::fetchHistory() { - if(!bDrawBars && !drawAll) - return; - //we don't need to worry about thread safety because the array pointer and size is only modified on the main thread. - //the values change and there's a chance of corruption, but probably it won't happen and we can take a glitch. - int len = SortingMan::Instance()->GetArraySize(); - double* array = SortingMan::Instance()->GetArray(); - int* status = SortingMan::Instance()->GetArrayStatus(); - float y1,y2; - for(int i=0;i<len;i++){ - if(status){ - switch(status[i]){ - //no change or focus or compare - case 0: - ofSetColor(0x333333); - break; - //change - case 1: - ofSetColor(0xFF6666); - break; - //compare - case 2: - ofSetColor(0x6666FF); - break; - //focus - case 3: - ofSetColor(0x66FF66); - break; - } - }else - ofSetColor(0x666666); - y1 = height/2; - y2 = (1.0 + (array[i]/-100.0)) * height/2; - ofRect(x + width * ((float)i/len), y + mymin(y1,y2), - (float)width/len, fabs(y1-y2)); + int rowsNeeded = 1; + //find the largest history req for our views + for (int i = 0; i < views.size(); i++) { + rowsNeeded = mymax(views[i]->CalcNumRowsNeeded(), rowsNeeded); } -} -#define kDrawMethodBorder 10 -void testApp::drawSquares(int x, int y, int width, int height) -{ - static vector<double*> history; - static vector<int*> markers; //for change, focus, etc. static int lastlen = -1; int len = SortingMan::Instance()->GetArraySize(); @@ -200,45 +184,13 @@ history.push_back(array); markers.push_back(marker); } - - int viewWidth = width - kDrawMethodBorder * 2; - int viewHeight = height - kDrawMethodBorder * 2; - int squareSize = viewWidth / len; - int numRows = viewHeight / squareSize; - - while (history.size() > numRows) { + while (history.size() > rowsNeeded) { free(history[0]); history.erase(history.begin() + 0); free(markers[0]); markers.erase(markers.begin() + 0); } - - int startRow = numRows - history.size(); - if(bDrawSquares || drawAll) { - for(int i = startRow; i < numRows; i++) { - for(int j = 0; j < len; j++) { - int val; - int color; - val = history[i - startRow][j]; - color = 0xFF * ((float) (val+100)/200.0);//brightness - //copy to other bytes - color |= color << 8 | color << 16; - - - if(markers[i - startRow][j] & kMarkerChanged) - color = color & 0xFF22FF; //take out some green and blue components - else if(markers[i - startRow][j] & kMarkerCompared) - color = color & 0x22FFFF; //take out some green and red components - else if(markers[i - startRow][j] & kMarkerFocused) - color = color & 0xFFFF22; //take out some red and blue components - ofSetColor(color); - ofRect(x + kDrawMethodBorder + j * squareSize, - y + kDrawMethodBorder + i * squareSize, - squareSize, squareSize); - } - } - } - lastlen = len; + lastlen = len; } void testApp::drawConsole(int x, int y, int width, int height) @@ -317,7 +269,7 @@ free(poppedString); - if(lastDrawString && (bDrawConsole || drawAll)){ + if(lastDrawString && (viewMode == eDrawConsole || viewMode == eDrawAll)){ ofSetColor(0xFF0000); // ofDrawBitmapString(lastDrawString,kConsoleX,kConsoleY); arrayFont->drawString(lastDrawString, x + kDrawMethodBorder, y + kDrawMethodBorder); @@ -423,17 +375,16 @@ drawGUI=!drawGUI; }else if(key == '4') { - drawAll = !drawAll; + viewMode = eDrawAll; }else if(key == '3') { - bDrawSquares = !bDrawSquares; + viewMode = eDrawSquares; }else if(key == '2') - { - bDrawBars = !bDrawBars; + { + viewMode = eDrawBars; }else if(key == '1') { - //fade in and outloops. - bDrawConsole=!bDrawConsole; + viewMode = eDrawConsole; }else if(key == 'a') { //set mouse mode Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-06 19:50:18 UTC (rev 245) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-06 21:06:46 UTC (rev 246) @@ -46,6 +46,14 @@ eAudioStateAll = 0xFFFF }; +enum ViewMode { + eDrawConsole = 0, + eDrawSquares = 1, + eDrawBars, + eDrawAll +}; +class ArrayView; + class testApp : public ofBaseApp{ public: @@ -71,7 +79,11 @@ void drawBars(int x, int y, int width, int height); void drawConsole(int x, int y, int width, int height); void drawSquares(int x, int y, int width, int height); - + void fetchHistory(); + + std::vector<double*> history; + std::vector<int*> markers; //for change, focus, etc. + std::vector<ArrayView*> views; vector<double*> mHistory; float pan; int sampleRate; @@ -80,9 +92,8 @@ int downsampleTimes; int algonum; int arraysize, prev_arraysize; - + ViewMode viewMode; bool bLoop; - bool drawAll; float * lAudio; float * rAudio; @@ -138,9 +149,6 @@ ofTrueTypeFont *arrayFont; int currFontSize; bool drawGUI; - bool bDrawConsole; - bool bDrawBars; - bool bDrawSquares; }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-06 19:50:25
|
Revision: 245 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=245&view=rev Author: mchinen Date: 2010-12-06 19:50:18 +0000 (Mon, 06 Dec 2010) Log Message: ----------- fix audio latency for windows build Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj 2010-12-06 03:36:14 UTC (rev 244) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj 2010-12-06 19:50:18 UTC (rev 245) @@ -271,14 +271,6 @@ > </File> <File - RelativePath=".\SortThread.cpp" - > - </File> - <File - RelativePath=".\SortThread.h" - > - </File> - <File RelativePath=".\src\testApp.cpp" > </File> Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp 2010-12-06 03:36:14 UTC (rev 244) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp 2010-12-06 19:50:18 UTC (rev 245) @@ -154,7 +154,6 @@ { int noisefactor; noisefactor = 1; - float * noisearray = new float[framesPerBuffer*(1+noisefactor)]; float vol = AlgorhythmicAudioIO::Instance()->GetVolume(); float freqMin = AlgorhythmicAudioIO::Instance()->GetFreqMin(); @@ -165,8 +164,6 @@ for( int z = 0; z < NUM_CHANNELS; z++ ) memset(((float*)outputBuffer)+framesPerBuffer*z, 0, framesPerBuffer*sizeof(float)); - // memcpy(((float*)outputBuffer)+framesPerBuffer*z,noisearray+randint(framesPerBuffer*(noisefactor)),framesPerBuffer*sizeof(float)); - delete [] noisearray; //sonify stuff struct ssortdata* dataa = AlgorhythmicAudioIO::Instance()->GetSortData(); @@ -196,8 +193,8 @@ if(dataa->doubleArray && index <= dataa->doubleArraySize && dataa->durations && dataa->durations[dataa->lastNoteIndex]* SAMPLE_RATE> dataa->sampleCursor) { - float pan; - float freq; + float pan = 0.5f; + float freq = 0.0f; if(index < dataa->doubleArraySize) { freq = 100*(100+dataa->doubleArray[index]); //hack - values range from -100 to 100 @@ -453,14 +450,28 @@ PaError err; /* Open an audio I/O stream. */ - err = Pa_OpenDefaultStream( &m_stream, - 0, /* no input channels */ - 2, /* stereo output */ - paFloat32, /* 32 bit floating point output */ - SAMPLE_RATE, - 256, /* frames per buffer */ - SortingPortAudioCallback, - &data ); + PaDeviceIndex outDev = Pa_GetDefaultOutputDevice(); + PaStreamParameters playbackParameters; + playbackParameters.device = outDev; + playbackParameters.sampleFormat = paFloat32; + playbackParameters.hostApiSpecificStreamInfo = NULL; + playbackParameters.channelCount = 2; + playbackParameters.suggestedLatency = kAudioLatency/1000.0; + + err = Pa_OpenStream( &m_stream, + NULL, &playbackParameters, + SAMPLE_RATE, /*paFramesPerBufferUnspecified, */256, + paNoFlag, + SortingPortAudioCallback, &data ); + +// err = Pa_OpenDefaultStream( &m_stream, +// 0, /* no input channels */ +// 2, /* stereo output */ +// paFloat32, /* 32 bit floating point output */ +// SAMPLE_RATE, +// 256, /* frames per buffer */ +// SortingPortAudioCallback, +// &data ); if( err != paNoError ) return false; err = Pa_StartStream( m_stream ); Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-12-06 03:36:14 UTC (rev 244) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-12-06 19:50:18 UTC (rev 245) @@ -13,6 +13,9 @@ #ifndef __AlgorhythmicAudioIO__ #define __AlgorhythmicAudioIO__ +//audio latency in millis +#define kAudioLatency 80.0 + #include "portaudio.h" #include "ofxMutex.h" struct ssortdata Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-06 03:36:14 UTC (rev 244) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-06 19:50:18 UTC (rev 245) @@ -228,17 +228,12 @@ // [[NSAutoreleasePool alloc] init]; sort_params* params = (sort_params*) arg; - AlgorhythmicAudioIO::Instance()->Start(); + int i,h, n=params->size; -// static double a[] = {7,3,66,3.5,-5,22,-77,2,36,-12, 24}; double* a = params->array; -// double *a=NULL; - -// NSDictionary *blueAttrs = [[NSDictionary dictionaryWithObjectsAndKeys:[NSColor blueColor],NSForegroundColorAttributeName, -// [NSFont fontWithName:@"Courier" size:10.0],NSFontAttributeName,nil] retain]; - + char mystring[256]; const char *algoName; //sort a few arrays @@ -322,6 +317,8 @@ ; SortingMan::Instance()->SetDoneSorting(); // [blueAttrs release]; + + AlgorhythmicAudioIO::Instance()->Stop(); return 0; } Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-06 03:36:14 UTC (rev 244) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-06 19:50:18 UTC (rev 245) @@ -1,7 +1,9 @@ #include <stdio.h> #include "sorthelp.h" -#ifndef WIN32 +#ifdef WIN32 +#include <Windows.h> +#else #include <unistd.h> #endif #include "AlgorhythmicAudioIO.h" @@ -13,6 +15,33 @@ static double doublePair[2]; void printdoublearray(double* array, int size, int focusstart, int focussize, int swapaindex, int swapbindex){ int i; + //audio has latency so we do this first then rest by the latency amt. + float secondsToRest; + if(swapaindex!=-1 && swapbindex !=-1) + { + //if we were given a pair, we just play the pair. + doublePair[0]=array[swapaindex]; + doublePair[1]=array[swapbindex]; + secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray((double*)doublePair, 2); // + }else if(swapaindex!=-1) + { + //some cases have just one number in focus + doublePair[0]=array[swapaindex]; + secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray((double*)doublePair, 1); // + }else + { + // play the values (freq) of a block + secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray(array+focusstart, focussize); // + } + float secsLatency = kAudioLatency/1000.0f; + + //rest so the visuals don't popup before audio. + #ifdef WIN32 + timeBeginPeriod(1); + Sleep(1000*(mymin(secsLatency, secondsToRest))); //windows sleep in milliseconds + #else + usleep(1000000*(mymin(secsLatency, secondsToRest))); //mac sleep in microseconds - cooler :) + #endif static double* last = NULL; static int lastSize = -1; @@ -43,20 +72,7 @@ haveLast = true; } - // NSAutoreleasePool* pool =[[NSAutoreleasePool alloc] init]; - // NSDictionary *blackAttrs = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor blackColor],NSForegroundColorAttributeName, - // [NSFont fontWithName:@"Courier" size:10.0],NSFontAttributeName,nil]; - // - // NSDictionary *greyAttrs = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor grayColor],NSForegroundColorAttributeName, - // [NSFont fontWithName:@"Courier" size:10.0],NSFontAttributeName,nil]; - // - // NSDictionary *redAttrs = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor redColor],NSForegroundColorAttributeName, - // [NSFont fontWithName:@"Courier" size:10.0],NSFontAttributeName,nil]; - // - // NSDictionary *blueAttrs = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor blueColor],NSForegroundColorAttributeName, - // [NSFont fontWithName:@"Courier" size:10.0],NSFontAttributeName,nil]; - // - // NSAttributedString *myString; + char myString[64]; for(i=0; i<size; i++) { @@ -82,42 +98,22 @@ sprintf(myString," %4.0f",array[i]); SortingMan::Instance()->AppendToOutput(myString); - // [myString autorelease]; } SortingMan::Instance()->AppendToHistory(array, arrayStatus, size); SortingMan::Instance()->SetArrayStatus(arrayStatus); sprintf(myString,"\n"); - // myString = [[NSAttributedString alloc] - // initWithString:[NSString stringWithFormat:@"\n"] - // attributes: blackAttrs]; - SortingMan::Instance()->AppendToOutput(myString); - // [myString autorelease]; - // [pool release]; - float secondsToRest; - if(swapaindex!=-1 && swapbindex !=-1) - { - //if we were given a pair, we just play the pair. - doublePair[0]=array[swapaindex]; - doublePair[1]=array[swapbindex]; - secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray((double*)doublePair, 2); // - }else if(swapaindex!=-1) - { - //some cases have just one number in focus - doublePair[0]=array[swapaindex]; - secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray((double*)doublePair, 1); // - }else - { - // play the values (freq) of a block - secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray(array+focusstart, focussize); // - } + #ifdef WIN32 - Sleep(1000*(secondsToRest)); //windows sleep in milliseconds + timeBeginPeriod(1); + Sleep(1000 * mymax(0,secondsToRest - secsLatency)); //windows sleep in milliseconds #else - usleep(1000000*(secondsToRest)); //mac sleep in microseconds - cooler :) - #endif + usleep(1000000 * mymax(0,secondsToRest - secsLatency)); //mac sleep in microseconds - cooler :) + #endif + + } void printseperator(int depth) @@ -131,6 +127,7 @@ for(i=0; i<size; i++){ printf(" %d ",array[i]); // type (d integer) for float f variable type #ifdef WIN32 + timeBeginPeriod(1); Sleep(1000*(delayseconds/size)); //windows sleep in milliseconds #else usleep(1000000*(delayseconds/size)); //mac sleep in microseconds - cooler :) Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-06 03:36:14 UTC (rev 244) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-06 19:50:18 UTC (rev 245) @@ -20,7 +20,8 @@ bDrawSquares = false; currFontSize = 10; drawAll = true; - arrayFont.loadFont("Inconsolata.otf", currFontSize, true, true); + arrayFont = new ofTrueTypeFont; + arrayFont->loadFont("Inconsolata.otf", currFontSize, true, true); // arrayFont.setLineHeight(10.0f); ofBackground(255,255,255); @@ -276,16 +277,18 @@ test[prev_arraysize*4] = 0; do { - arrayFont.loadFont("Inconsolata.otf",desiredFontSize,true, true); + delete arrayFont; + arrayFont = new ofTrueTypeFont; + arrayFont->loadFont("Inconsolata.otf",desiredFontSize,true, true); currFontSize = desiredFontSize--; } while (desiredFontSize > 3 && - arrayFont.stringWidth(test) > width - 16 * kDrawMethodBorder) //this is a hack - stringWidth is wrong. + arrayFont->stringWidth(test) > width - 16 * kDrawMethodBorder) //this is a hack - stringWidth is wrong. ; lastsize = prev_arraysize; } int viewHeight = height - kDrawMethodBorder; - int lineHeight = arrayFont.getLineHeight(); + int lineHeight = arrayFont->getLineHeight(); int n = bufsize; lines = 0; while(--n > -1) { @@ -317,7 +320,7 @@ if(lastDrawString && (bDrawConsole || drawAll)){ ofSetColor(0xFF0000); // ofDrawBitmapString(lastDrawString,kConsoleX,kConsoleY); - arrayFont.drawString(lastDrawString, x + kDrawMethodBorder, y + kDrawMethodBorder); + arrayFont->drawString(lastDrawString, x + kDrawMethodBorder, y + kDrawMethodBorder); } } Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-06 03:36:14 UTC (rev 244) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-06 19:50:18 UTC (rev 245) @@ -135,7 +135,7 @@ ofxMutex delayMutex; ofxMutex loopMutex; - ofTrueTypeFont arrayFont; + ofTrueTypeFont *arrayFont; int currFontSize; bool drawGUI; bool bDrawConsole; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-06 03:36:20
|
Revision: 244 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=244&view=rev Author: mchinen Date: 2010-12-06 03:36:14 +0000 (Mon, 06 Dec 2010) Log Message: ----------- add cmyk coloring to squares view Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-05 20:14:36 UTC (rev 243) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-06 03:36:14 UTC (rev 244) @@ -10,12 +10,12 @@ #include "AlgorhythmicAudioIO.h" #include "handyfuncs.h" -#include "ofxThread.h" - +#include "ofxThread.h" -void* sortstuffhelper (void * arg); - -class SortThread:public ofxThread { + +void* sortstuffhelper (void * arg); + +class SortThread:public ofxThread { public: SortThread(){} virtual ~SortThread(){} @@ -24,11 +24,11 @@ protected: //------------------------------------------------- //you need to overide this with the function you want to thread - virtual void threadedFunction(){ - sortstuffhelper(priv); - } - - void* priv; + virtual void threadedFunction(){ + sortstuffhelper(priv); + } + + void* priv; }; #define kStringSizeLimit 10000 @@ -69,30 +69,39 @@ return ret; } -void SortingMan::AppendToHistory(double *array, int n) +void SortingMan::AppendToHistory(double *array, int *marker, int n) { - stringLock.lock(); double *entry = (double*)malloc(sizeof(double) * n); memcpy(entry, array, sizeof(double) * n); m_history.push_back(entry); + + int *marks = (int*)malloc(sizeof(int) * n); + memcpy(marks, marker, sizeof(int) * n); + m_markers.push_back(marks); + stringLock.unlock(); } -double* SortingMan::PopHistory() +int SortingMan::PopHistory(double **arrayOut, int **markerOut) { - double* ret; + double *ret = NULL; + int *ret2 = NULL; //we are recylcing mutexes. stringLock.lock(); if(m_history.size()) { - ret = m_history[0]; + ret = m_history[0]; + ret2 = m_markers[0]; m_history.erase(m_history.begin() + 0); + m_markers.erase(m_markers.begin() + 0); } else { ret = NULL; } stringLock.unlock(); - - return ret; + + *arrayOut = ret; + *markerOut = ret2; + return ret ? 1 : 0; } Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h 2010-12-05 20:14:36 UTC (rev 243) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h 2010-12-06 03:36:14 UTC (rev 244) @@ -34,6 +34,11 @@ long seed; }; +//for array markers returned by PopHistory() +#define kMarkerChanged 1 +#define kMarkerFocused 2 +#define kMarkerCompared 4 + class SortingMan { public: @@ -45,9 +50,11 @@ void AppendToOutput(const char* inputString); char* PopOutput(); - void AppendToHistory(double *array, int n); - double* PopHistory(); + void AppendToHistory(double *array, int *marker, int n); + //returns 1 when valid pop returned, 0 otherwise + int PopHistory(double **arrayOut, int **markerOut); + //runs on a different thread; void SortStuff(); void StopSorting(); @@ -73,7 +80,8 @@ virtual ~SortingMan(); char* volatile m_outputString; - std::vector<double*> m_history; + std::vector<double*> m_history; + std::vector<int*> m_markers; // pthread_mutex_t m_outViewMutex; bool m_inited; bool m_looping; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-05 20:14:36 UTC (rev 243) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-06 03:36:14 UTC (rev 244) @@ -66,27 +66,25 @@ //see if the value changed from last array if(haveLast) { - if(last[i]!=array[i]){ - arrayStatus[i] = 1; + if (last[i] != array[i]) { + arrayStatus[i] |= kMarkerChanged; changed= true; } + if (i >= focusstart && i < focusstart + focussize) { + arrayStatus[i] |= kMarkerFocused; + } + if (i == swapaindex || i == swapbindex) { + arrayStatus[i] |= kMarkerCompared; + } } //save last[i] = array[i]; sprintf(myString," %4.0f",array[i]); - if(!arrayStatus[i]) { - arrayStatus[i] = (i==swapaindex||i==swapbindex) ? 2:(i>=focusstart && i < focusstart+focussize)?3:0; - } - // myString = [[NSAttributedString alloc] - // initWithString:[NSString stringWithFormat:@" %4.0f",array[i]] - // attributes: changed?redAttrs: - // (i==swapaindex||i==swapbindex)?blueAttrs: - // (i>=focusstart && i < focusstart+focussize)?blackAttrs:greyAttrs]; SortingMan::Instance()->AppendToOutput(myString); // [myString autorelease]; } - SortingMan::Instance()->AppendToHistory(array, size); + SortingMan::Instance()->AppendToHistory(array, arrayStatus, size); SortingMan::Instance()->SetArrayStatus(arrayStatus); sprintf(myString,"\n"); Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-05 20:14:36 UTC (rev 243) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-06 03:36:14 UTC (rev 244) @@ -179,19 +179,25 @@ void testApp::drawSquares(int x, int y, int width, int height) { static vector<double*> history; + static vector<int*> markers; //for change, focus, etc. static int lastlen = -1; int len = SortingMan::Instance()->GetArraySize(); - double* array; + double *array; + int *marker; if (lastlen != len) { - for(int i = 0; i < history.size(); i++) + for(int i = 0; i < history.size(); i++) { free(history[i]); + free(markers[i]); + } history.clear(); + markers.clear(); } - while(array = SortingMan::Instance()->PopHistory()) { + while(SortingMan::Instance()->PopHistory(&array, &marker)) { history.push_back(array); + markers.push_back(marker); } int viewWidth = width - kDrawMethodBorder * 2; @@ -202,6 +208,8 @@ while (history.size() > numRows) { free(history[0]); history.erase(history.begin() + 0); + free(markers[0]); + markers.erase(markers.begin() + 0); } int startRow = numRows - history.size(); @@ -211,9 +219,17 @@ int val; int color; val = history[i - startRow][j]; - color = 0xFF * ((float) (val+100)/200.0);//brightness + color = 0xFF * ((float) (val+100)/200.0);//brightness //copy to other bytes color |= color << 8 | color << 16; + + + if(markers[i - startRow][j] & kMarkerChanged) + color = color & 0xFF22FF; //take out some green and blue components + else if(markers[i - startRow][j] & kMarkerCompared) + color = color & 0x22FFFF; //take out some green and red components + else if(markers[i - startRow][j] & kMarkerFocused) + color = color & 0xFFFF22; //take out some red and blue components ofSetColor(color); ofRect(x + kDrawMethodBorder + j * squareSize, y + kDrawMethodBorder + i * squareSize, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-05 20:14:42
|
Revision: 243 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=243&view=rev Author: mchinen Date: 2010-12-05 20:14:36 +0000 (Sun, 05 Dec 2010) Log Message: ----------- cleanups and shrink button sizes Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp Added Paths: ----------- algorhythmicSorting/ofAlgorhythmicSorting/bin/data/Inconsolata.otf Added: algorhythmicSorting/ofAlgorhythmicSorting/bin/data/Inconsolata.otf =================================================================== (Binary files differ) Property changes on: algorhythmicSorting/ofAlgorhythmicSorting/bin/data/Inconsolata.otf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-05 18:38:05 UTC (rev 242) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-05 20:14:36 UTC (rev 243) @@ -6,7 +6,6 @@ #include "AlgorhythmicAudioIO.h" #include "ofxSimpleGuiComboBox.h" -#define kTatsumiRingBufferSize (44100*60) float speedSliderVal; float speedSliderVal_old; int myInt1; @@ -21,13 +20,35 @@ bDrawSquares = false; currFontSize = 10; drawAll = true; - arrayFont.loadFont("Courier New.ttf", currFontSize, true, true); + arrayFont.loadFont("Inconsolata.otf", currFontSize, true, true); // arrayFont.setLineHeight(10.0f); ofBackground(255,255,255); + gui.setup(); + ofxSimpleGuiConfig &config = *gui.config; + + config.sliderHeight = 10; + config.sliderTextHeight = 15; + config.titleHeight = config.sliderHeight + config.sliderTextHeight; + config.toggleHeight = config.titleHeight; + config.buttonHeight = config.titleHeight; + config.slider2DTextHeight = config.titleHeight * 1.5; + config.comboBoxHeight = 47; //15 + config.comboBoxTextHeight = 16; + + + config.padding.set (config.titleHeight/2, 10); + config.offset.set (config.titleHeight/2, config.titleHeight/2); + config.slider2DSize.set (config.titleHeight * 4, config.titleHeight * 4); + + config.gridSize.x = 200 + config.padding.x; + config.gridSize.y = config.toggleHeight + config.padding.y; + +// gui.headerPage = &gui.addPage(" "); + gui.addPage(" "); + speedSliderVal = speedSliderVal_old = 25; - gui.addTitle("A group"); - gui.addSlider("speed", speedSliderVal, 0.01, 1000); + gui.addSlider("Speed", speedSliderVal, 1.0f, 500.0f, false); arraysize = prev_arraysize = 10; gui.addSlider("Array Size", arraysize, 2, 200); gui.addToggle("Loop", bLoop); @@ -42,8 +63,12 @@ startButtonControl = &gui.addButton("Start", startButton); gui.addButton("Generate New Array", genButton); + gui.loadFromXML(); + gui.setPage(2); gui.show(); + + drawGUI=true; //flags init mouseMode = eMouseModeNone; @@ -201,77 +226,83 @@ void testApp::drawConsole(int x, int y, int width, int height) { - static int bufsize = 0; - char* poppedString; - unsigned int popsize; - static int lines=0; - - poppedString = SortingMan::Instance()->PopOutput(); - //only draw if we have something. don't use strlen cause it can be slow. - if(poppedString[0]!=0) { - popsize = strlen(poppedString);//take off the null terminator, since this won't be copied - // free(lastDrawString); - if(popsize > kArraysStringMaxSize) { - strcpy(lastDrawString, poppedString+(popsize-kArraysStringMaxSize)); - bufsize = kArraysStringMaxSize; - } - else if(bufsize + popsize>kArraysStringMaxSize) { - memmove(lastDrawString, lastDrawString+(bufsize-popsize), popsize); - strcpy(lastDrawString+(kArraysStringMaxSize-popsize),poppedString); - bufsize = kArraysStringMaxSize; - } - else{ - strcat(lastDrawString,poppedString); - bufsize+=popsize; - } - - //compute where we should start - int desiredFontSize = 10; - static char test[800]; - memset(test, '1', 800); - test[prev_arraysize*4] = 0; + static int bufsize = 0; + char* poppedString; + unsigned int popsize; + static int lines=0; + + poppedString = SortingMan::Instance()->PopOutput(); + //only draw if we have something. don't use strlen cause it can be slow. + if(poppedString[0]!=0) { + popsize = strlen(poppedString);//take off the null terminator, since this won't be copied + // free(lastDrawString); + if(popsize > kArraysStringMaxSize) { + strcpy(lastDrawString, poppedString+(popsize-kArraysStringMaxSize)); + bufsize = kArraysStringMaxSize; + } + else if(bufsize + popsize>kArraysStringMaxSize) { + memmove(lastDrawString, lastDrawString+(bufsize-popsize), popsize); + strcpy(lastDrawString+(kArraysStringMaxSize-popsize),poppedString); + bufsize = kArraysStringMaxSize; + } + else{ + strcat(lastDrawString,poppedString); + bufsize+=popsize; + } + //compute font size + static int lastsize = -1; + + if (lastsize != prev_arraysize) { + int desiredFontSize = 10; + //compute where we should start + static char test[800]; + memset(test, 'p', 800); + test[prev_arraysize*4] = 0; - do { - arrayFont.loadFont("Courier New.ttf",desiredFontSize,true, true); - currFontSize = desiredFontSize--; - } while (desiredFontSize > 3 && arrayFont.stringWidth(test) > width - 8 * kDrawMethodBorder) - ; - - int viewHeight = height - kDrawMethodBorder; - int lineHeight = arrayFont.getLineHeight(); - int n = bufsize; - lines = 0; - while(--n > -1) { - - if(lastDrawString[n]=='\n') { - lines++; - } - if(lines * lineHeight > viewHeight) - { - n++;//restore n to point after the endline. - break; - } - - } - - //truncate the string. - if(n>0) { - memmove(lastDrawString, lastDrawString+n, bufsize-n); - - bufsize -= n; - lastDrawString[bufsize]=0;//put a new null term. - } - - - } - - free(poppedString); - - if(lastDrawString && (bDrawConsole || drawAll)){ - ofSetColor(0xFF0000); - // ofDrawBitmapString(lastDrawString,kConsoleX,kConsoleY); - arrayFont.drawString(lastDrawString, x + kDrawMethodBorder, y + kDrawMethodBorder); - } + do { + arrayFont.loadFont("Inconsolata.otf",desiredFontSize,true, true); + currFontSize = desiredFontSize--; + } while (desiredFontSize > 3 && + arrayFont.stringWidth(test) > width - 16 * kDrawMethodBorder) //this is a hack - stringWidth is wrong. + ; + lastsize = prev_arraysize; + } + + int viewHeight = height - kDrawMethodBorder; + int lineHeight = arrayFont.getLineHeight(); + int n = bufsize; + lines = 0; + while(--n > -1) { + + if(lastDrawString[n]=='\n') { + lines++; + } + if(lines * lineHeight > viewHeight) + { + n++;//restore n to point after the endline. + break; + } + + } + + //truncate the string. + if(n>0) { + memmove(lastDrawString, lastDrawString+n, bufsize-n); + + bufsize -= n; + lastDrawString[bufsize]=0;//put a new null term. + } + + + } + + free(poppedString); + + if(lastDrawString && (bDrawConsole || drawAll)){ + ofSetColor(0xFF0000); + // ofDrawBitmapString(lastDrawString,kConsoleX,kConsoleY); + arrayFont.drawString(lastDrawString, x + kDrawMethodBorder, y + kDrawMethodBorder); + } } //-------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-05 18:38:11
|
Revision: 242 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=242&view=rev Author: mchinen Date: 2010-12-05 18:38:05 +0000 (Sun, 05 Dec 2010) Log Message: ----------- fix loop slider; was being blocked somehow by the text input Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-05 18:18:36 UTC (rev 241) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-12-05 18:38:05 UTC (rev 242) @@ -37,7 +37,7 @@ algostrings[i] = gAlgoStrings[i]; gui.addComboBox("Sorting Algorithm", algonum, eNumSortAlgorithms,algostrings); - gui.addTextInput("number",textInput); +// gui.addTextInput("number",textInput); startButtonControl = &gui.addButton("Start", startButton); gui.addButton("Generate New Array", genButton); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-05 18:18:43
|
Revision: 241 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=241&view=rev Author: mchinen Date: 2010-12-05 18:18:36 +0000 (Sun, 05 Dec 2010) Log Message: ----------- get mac build working again using new ofxThread and ofxMutex Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj Modified: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-05 03:21:31 UTC (rev 240) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.xcodeproj/project.pbxproj 2010-12-05 18:18:36 UTC (rev 241) @@ -27,6 +27,8 @@ 840F2DF911E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840F2DF811E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp */; }; 8416E04411DA9FBA003A3B23 /* openFrameworks.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8416E04311DA9FBA003A3B23 /* openFrameworks.a */; }; 8416E0EC11DDFCA0003A3B23 /* cleanerinsert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */; }; + 847D385D12ABC4E6006E9CA2 /* ofxMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */; }; + 847D386312ABC55E006E9CA2 /* ofxThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 847D386112ABC55E006E9CA2 /* ofxThread.cpp */; }; 84BE5526119B20CA0092BDA7 /* handyfuncs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84BE5524119B20CA0092BDA7 /* handyfuncs.cpp */; }; 84BFF6B111C4CECD000DB417 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84BFF6AA11C4CECD000DB417 /* tinyxml.cpp */; }; 84BFF6B211C4CECD000DB417 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84BFF6AC11C4CECD000DB417 /* tinyxmlerror.cpp */; }; @@ -150,6 +152,10 @@ 840F2DF811E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxSimpleGuiTextInput.cpp; sourceTree = "<group>"; }; 8416E04311DA9FBA003A3B23 /* openFrameworks.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = openFrameworks.a; path = ../../../../of/of_preRelease_v0061_osx_FAT/libs/openFrameworksCompiled/lib/osx/openFrameworks.a; sourceTree = SOURCE_ROOT; }; 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cleanerinsert.cpp; sourceTree = "<group>"; }; + 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxMutex.cpp; sourceTree = "<group>"; }; + 847D385C12ABC4E6006E9CA2 /* ofxMutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxMutex.h; sourceTree = "<group>"; }; + 847D386112ABC55E006E9CA2 /* ofxThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxThread.cpp; sourceTree = "<group>"; }; + 847D386212ABC55E006E9CA2 /* ofxThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxThread.h; sourceTree = "<group>"; }; 84BE5524119B20CA0092BDA7 /* handyfuncs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = handyfuncs.cpp; sourceTree = "<group>"; }; 84BE5525119B20CA0092BDA7 /* handyfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = handyfuncs.h; sourceTree = "<group>"; }; 84BFF6A811C4CECD000DB417 /* install.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = install.xml; sourceTree = "<group>"; }; @@ -329,9 +335,20 @@ path = Controls; sourceTree = "<group>"; }; + 847D386012ABC55E006E9CA2 /* src */ = { + isa = PBXGroup; + children = ( + 847D386112ABC55E006E9CA2 /* ofxThread.cpp */, + 847D386212ABC55E006E9CA2 /* ofxThread.h */, + ); + name = src; + path = ../../../../of/of_preRelease_v0061_osx_FAT/addons/ofxThread/src; + sourceTree = SOURCE_ROOT; + }; 84BFF66D11C4CD9C000DB417 /* addons */ = { isa = PBXGroup; children = ( + 847D386012ABC55E006E9CA2 /* src */, 840F2CCA11E788F200C5CD20 /* src */, 840F2C9211E7869C00C5CD20 /* src */, 84BFF6A711C4CECD000DB417 /* ofxXmlSettings */, @@ -595,6 +612,8 @@ E4B69E1C0A3A1BDC003C02F2 /* src */ = { isa = PBXGroup; children = ( + 847D385B12ABC4E6006E9CA2 /* ofxMutex.cpp */, + 847D385C12ABC4E6006E9CA2 /* ofxMutex.h */, 8416E0EB11DDFCA0003A3B23 /* cleanerinsert.cpp */, 84BFF89611C4ECE1000DB417 /* AlgorhythmicAudioIO.cpp */, 84BFF89711C4ECE1000DB417 /* AlgorhythmicAudioIO.h */, @@ -815,6 +834,8 @@ 840F2D0011E788F300C5CD20 /* ofxSimpleGuiPage.cpp in Sources */, 840F2D0111E788F300C5CD20 /* ofxSimpleGuiToo.cpp in Sources */, 840F2DF911E7B63300C5CD20 /* ofxSimpleGuiTextInput.cpp in Sources */, + 847D385D12ABC4E6006E9CA2 /* ofxMutex.cpp in Sources */, + 847D386312ABC55E006E9CA2 /* ofxThread.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-12-05 03:21:38
|
Revision: 240 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=240&view=rev Author: mchinen Date: 2010-12-05 03:21:31 +0000 (Sun, 05 Dec 2010) Log Message: ----------- build on windows msvc express 2008. works but with bad sound delay, probably due to windows sleep function not being as precise. had to overhaul the pthreads code to be cross platform. Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/howtobuild.txt algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h algorhythmicSorting/ofAlgorhythmicSorting/src/shell.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h Added Paths: ----------- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.sln algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj algorhythmicSorting/ofAlgorhythmicSorting/src/ofxMutex.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/ofxMutex.h algorhythmicSorting/ofAlgorhythmicSorting/src/portaudio-v19.lib Added: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.sln =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.sln (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.sln 2010-12-05 03:21:31 UTC (rev 240) @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworksCompiled\project\vs2008\openframeworksLib.vcproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "algorhythmicSorting", "AlgorhythmicSorting.vcproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 + {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 + {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 + {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 + {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 + {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 + {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 + {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/AlgorhythmicSorting.vcproj 2010-12-05 03:21:31 UTC (rev 240) @@ -0,0 +1,517 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="algorhythmicSorting" + ProjectGUID="{7FD42DF7-442E-479A-BA76-D0022F99702A}" + RootNamespace="emptyExample" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="bin" + IntermediateDirectory="obj\$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="src\portaudio\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworks;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworks\graphics;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworks\app;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworks\sound;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworks\utils;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworks\communication;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworks\video;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworks\events;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\glut\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\rtAudio\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\quicktime\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\freetype\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\freetype\include\freetype2;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\freeImage\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\fmodex\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\videoInput\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\glee\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\glu\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\poco\include;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxThread\src;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxXmlSettings\libs;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxXmlSettings\src;..\..\..\ofxMSA\ofxMSAInteractiveObject\src;..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls;..\..\..\ofxMSA\ofxSimpleGuiToo\src;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;POCO_STATIC" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="openframeworksLibDebug.lib OpenGL32.lib GLu32.lib kernel32.lib setupapi.lib glut32.lib rtAudioD.lib videoInput.lib libfreetype.lib FreeImage.lib qtmlClient.lib dsound.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib GLee.lib fmodex_vc.lib glu32.lib PocoFoundationmtd.lib PocoNetmtd.lib PocoUtilmtd.lib PocoXMLmtd.lib portaudio-v19.lib" + OutputFile="$(OutDir)\$(ProjectName)_debug.exe" + LinkIncremental="2" + AdditionalLibraryDirectories="src;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\glut\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\rtAudio\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\FreeImage\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\freetype\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\quicktime\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\fmodex\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\videoInput\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\glee\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\glu\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\Poco\lib\vs2008;..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\libs\openFrameworksCompiled\lib\vs2008" + GenerateManifest="true" + IgnoreDefaultLibraryNames="atlthunk.lib; LIBC.lib; LIBCMT;" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(TargetDir)$(TargetName)_debugInfo.pdb" + SubSystem="1" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="adding DLLs and creating data folder" + CommandLine="xcopy /e /i /y "$(ProjectDir)..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\export\vs2008\*.dll" "$(ProjectDir)bin"
if not exist "$(ProjectDir)bin\data" mkdir "$(ProjectDir)bin\data"
" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="bin" + IntermediateDirectory="obj\$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + WholeProgramOptimization="false" + AdditionalIncludeDirectories="..\..\..\libs\openFrameworks;..\..\..\libs\openFrameworks\graphics;..\..\..\libs\openFrameworks\app;..\..\..\libs\openFrameworks\sound;..\..\..\libs\openFrameworks\utils;..\..\..\libs\openFrameworks\communication;..\..\..\libs\openFrameworks\video;..\..\..\libs\openFrameworks\events;..\..\..\libs\glut\include;..\..\..\libs\rtAudio\include;..\..\..\libs\quicktime\include;..\..\..\libs\freetype\include;..\..\..\libs\freetype\include\freetype2;..\..\..\libs\freeImage\include;..\..\..\libs\fmodex\include;..\..\..\libs\videoInput\include;..\..\..\libs\glee\include;..\..\..\libs\glu\include;..\..\..\libs\poco\include;..\..\..\addons" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;POCO_STATIC" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="openframeworksLib.lib OpenGL32.lib GLu32.lib kernel32.lib setupapi.lib glut32.lib rtAudio.lib videoInput.lib libfreetype.lib FreeImage.lib qtmlClient.lib dsound.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib GLee.lib fmodex_vc.lib glu32.lib PocoFoundationmt.lib PocoNetmt.lib PocoUtilmt.lib PocoXMLmt.lib" + LinkIncremental="1" + AdditionalLibraryDirectories="..\..\..\libs\glut\lib\vs2008;..\..\..\libs\rtAudio\lib\vs2008;..\..\..\libs\FreeImage\lib\vs2008;..\..\..\libs\freetype\lib\vs2008;..\..\..\libs\quicktime\lib\vs2008;..\..\..\libs\fmodex\lib\vs2008;..\..\..\libs\videoInput\lib\vs2008;..\..\..\libs\glee\lib\vs2008;..\..\..\libs\glu\lib\vs2008;..\..\..\libs\Poco\lib\vs2008;..\..\..\libs\openFrameworksCompiled\lib\vs2008" + IgnoreAllDefaultLibraries="false" + IgnoreDefaultLibraryNames="atlthunk.lib; LIBC.lib; LIBCMT;" + GenerateDebugInformation="false" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="adding DLLs and creating data folder" + CommandLine="xcopy /e /i /y "$(ProjectDir)\..\..\..\export\vs2008\*.dll" "$(ProjectDir)\bin"
if not exist "$(ProjectDir)\bin\data" mkdir "$(ProjectDir)\bin\data"

" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="src" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\src\AlgorhythmicAudioIO.cpp" + > + </File> + <File + RelativePath=".\src\AlgorhythmicAudioIO.h" + > + </File> + <File + RelativePath=".\src\bubble.cpp" + > + </File> + <File + RelativePath=".\src\bubble.h" + > + </File> + <File + RelativePath=".\src\cleanerinsert.cpp" + > + </File> + <File + RelativePath=".\src\handyfuncs.cpp" + > + </File> + <File + RelativePath=".\src\handyfuncs.h" + > + </File> + <File + RelativePath=".\src\heap.cpp" + > + </File> + <File + RelativePath=".\src\insert.cpp" + > + </File> + <File + RelativePath=".\src\main.cpp" + > + </File> + <File + RelativePath=".\src\msort.cpp" + > + </File> + <File + RelativePath=".\src\msort.h" + > + </File> + <File + RelativePath=".\src\ofxMutex.cpp" + > + </File> + <File + RelativePath=".\src\ofxMutex.h" + > + </File> + <File + RelativePath=".\src\quicksort.cpp" + > + </File> + <File + RelativePath=".\src\shell.cpp" + > + </File> + <File + RelativePath=".\src\sorthelp.cpp" + > + </File> + <File + RelativePath=".\src\sorthelp.h" + > + </File> + <File + RelativePath=".\src\SortingMan.cpp" + > + </File> + <File + RelativePath=".\src\SortingMan.h" + > + </File> + <File + RelativePath=".\SortThread.cpp" + > + </File> + <File + RelativePath=".\SortThread.h" + > + </File> + <File + RelativePath=".\src\testApp.cpp" + > + </File> + <File + RelativePath=".\src\testApp.h" + > + </File> + </Filter> + <Filter + Name="addons" + > + <Filter + Name="ofxMSAInteractiveObject" + > + <File + RelativePath="..\..\..\ofxMSA\ofxMSAInteractiveObject\src\ofxMSAInteractiveObject.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxMSAInteractiveObject\src\ofxMSAInteractiveObject.h" + > + </File> + </Filter> + <Filter + Name="ofxSimpleGuiToo" + > + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiConfig.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiConfig.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiControl.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiControl.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiIncludes.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiPage.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiPage.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiToo.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\ofxSimpleGuiToo.h" + > + </File> + <Filter + Name="Controls" + > + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiButton.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiButton.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiColorPicker.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiColorPicker.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiComboBox.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiComboBox.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiContent.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiContent.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiFPSCounter.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiFPSCounter.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiMovieSlider.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiMovieSlider.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiOption.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiOption.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiOptionGroup.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiOptionGroup.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiQuadWarp.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiQuadWarp.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiSlider2d.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiSlider2d.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiSliderBase.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiSliderFloat.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiSliderInt.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiTextInput.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiTextInput.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiTitle.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiTitle.h" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiToggle.cpp" + > + </File> + <File + RelativePath="..\..\..\ofxMSA\ofxSimpleGuiToo\src\Controls\ofxSimpleGuiToggle.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="ofxXmlSettings" + > + <File + RelativePath="..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxXmlSettings\src\ofxXmlSettings.cpp" + > + </File> + <File + RelativePath="..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxXmlSettings\src\ofxXmlSettings.h" + > + </File> + <File + RelativePath="..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxXmlSettings\libs\tinyxml.cpp" + > + </File> + <File + RelativePath="..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxXmlSettings\libs\tinyxml.h" + > + </File> + <File + RelativePath="..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxXmlSettings\libs\tinyxmlerror.cpp" + > + </File> + <File + RelativePath="..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxXmlSettings\libs\tinyxmlparser.cpp" + > + </File> + </Filter> + <Filter + Name="ofxThread" + > + <File + RelativePath="..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxThread\src\ofxThread.cpp" + > + </File> + <File + RelativePath="..\..\..\..\of\of_preRelease_v0062_vs2008_FAT\addons\ofxThread\src\ofxThread.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="portaudio" + > + <File + RelativePath=".\src\portaudio\include\portaudio.h" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Modified: algorhythmicSorting/ofAlgorhythmicSorting/howtobuild.txt =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/howtobuild.txt 2010-11-30 00:55:25 UTC (rev 239) +++ algorhythmicSorting/ofAlgorhythmicSorting/howtobuild.txt 2010-12-05 03:21:31 UTC (rev 240) @@ -1,15 +1,23 @@ -How to build ofAlgorithmicSorting -July 9 2010 -mchinen - -My directory structure is that I have a folder called svncheckouts in my home directory. - -Steps to build: -1.You need to have git installed and place a git clone of my ofxMSA addons at ../../../ofxMSA relative to this directory. -For me that means I type "cd ~/svncheckouts; ls" and I can see ofxMSA there. -1.1. install git if you don't have it with "sudo apt-get install git" or "sudo fink install git" -1.2. cd to the correct directory (for me "cd ~/svncheckouts") -1.3. type "git clone git://github.com/mchinen/ofxMSA.git" - -2.You need to have of installed to a directory that is ../../../../of/of_preRelease_v0061_osx_FAT (relative to this directory) - +How to build ofAlgorithmicSorting +dec 5 2010 +mchinen + +My directory structure is that I have a folder called svncheckouts in my home directory. + +Steps to build: +1.You need to have git installed and place a git clone of my ofxMSA addons at ../../../ofxMSA relative to this directory. +I keep my algorhythmics checkout folder in ~/scm on both mac and windows. So I put the ofxMSA in scm to acheive this. +For me that means I type "cd ~/scm; ls" and I can see ofxMSA there. +1.1. install git if you don't have it on mac with "sudo apt-get install git" or "sudo fink install git" +on pc you can download tortisegit although you first need to download git for windows. +1.2. cd to the correct directory (for me "cd ~/svncheckouts") +1.3. type "git clone git://github.com/mchinen/ofxMSA.git" + +2.You need to have of installed to a directory that is +on mac: +../../../../of/of_preRelease_v0061_osx_FAT +on win: +../../../../of/of_preRelease_v0062_vs2008_FAT +(relative to this directory) + +ttt \ No newline at end of file Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp 2010-11-30 00:55:25 UTC (rev 239) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.cpp 2010-12-05 03:21:31 UTC (rev 240) @@ -274,10 +274,10 @@ for(unsigned int i = 0; i < framesPerBuffer*NUM_CHANNELS; i++) { float f = ((float*)outputBuffer)[i]; - if (f > 1.0) - ((float*)outputBuffer)[i] = f/std::numeric_limits<float>::max(); - else if (f < -1.0) - ((float*)outputBuffer)[i] = f/std::numeric_limits<float>::max(); + if (f > 1.0f) + ((float*)outputBuffer)[i] = 1.0f; + else if (f < -1.0f) + ((float*)outputBuffer)[i] = -1.0f; } return 0; } @@ -347,13 +347,13 @@ void AlgorhythmicAudioIO::LockSortData() { - pthread_mutex_lock(&audioDataMutex); + audioDataMutex.lock(); } void AlgorhythmicAudioIO::unLockSortData() { - pthread_mutex_unlock(&audioDataMutex);// [audioDataMutex unlock]; + audioDataMutex.unlock();// [audioDataMutex unlock]; } void AlgorhythmicAudioIO::PlaySeperator(int depth){ mzsortdata.seperatorDepth = depth; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-11-30 00:55:25 UTC (rev 239) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/AlgorhythmicAudioIO.h 2010-12-05 03:21:31 UTC (rev 240) @@ -14,7 +14,7 @@ #define __AlgorhythmicAudioIO__ #include "portaudio.h" -#include <pthread.h> +#include "ofxMutex.h" struct ssortdata { int* intArray; @@ -92,7 +92,7 @@ bool m_seperatorOn; bool m_notesOn; - pthread_mutex_t audioDataMutex; + ofxMutex audioDataMutex; }; #endif Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-11-30 00:55:25 UTC (rev 239) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.cpp 2010-12-05 03:21:31 UTC (rev 240) @@ -1,6 +1,7 @@ //SortingMANager that manages the threads and GUI settings - +#ifndef WIN32 #include <unistd.h> +#endif #include <string.h> #include "SortingMan.h" #include "AlgorhythmicAudioIO.h" @@ -9,12 +10,33 @@ #include "AlgorhythmicAudioIO.h" #include "handyfuncs.h" +#include "ofxThread.h" + + +void* sortstuffhelper (void * arg); + +class SortThread:public ofxThread { +public: + SortThread(){} + virtual ~SortThread(){} + + void SetPriv(void* p){priv = p;} + protected: + //------------------------------------------------- + //you need to overide this with the function you want to thread + virtual void threadedFunction(){ + sortstuffhelper(priv); + } + + void* priv; +}; + #define kStringSizeLimit 10000 void SortingMan::AppendToOutput(const char* inputString) { // NSString* temp; //this will append the input to this member string. Creates a new reference, so we have to be careful. - pthread_mutex_lock(&stringLock); + stringLock.lock(); if( strlen(m_outputString) + strlen(inputString) < kStringSizeLimit) //size limit { strcat(m_outputString,inputString); @@ -26,7 +48,7 @@ // [NSString stringWithString:inputString]];// encoding:NSASCIIStringEncoding ] ]; // [m_outputString retain]; - pthread_mutex_unlock(&stringLock); + stringLock.unlock(); } @@ -34,14 +56,14 @@ { char* ret; - pthread_mutex_lock (&stringLock); + stringLock.lock(); ret = m_outputString; m_outputString = (char*)malloc(kStringSizeLimit+1); m_outputString[0]=0;//null terminate - pthread_mutex_unlock (&stringLock); + stringLock.unlock(); //has one retain count will be released by refresh view return ret; @@ -50,25 +72,25 @@ void SortingMan::AppendToHistory(double *array, int n) { - pthread_mutex_lock(&stringLock); + stringLock.lock(); double *entry = (double*)malloc(sizeof(double) * n); memcpy(entry, array, sizeof(double) * n); m_history.push_back(entry); - pthread_mutex_unlock(&stringLock); + stringLock.unlock(); } double* SortingMan::PopHistory() { double* ret; //we are recylcing mutexes. - pthread_mutex_lock (&stringLock); + stringLock.lock(); if(m_history.size()) { ret = m_history[0]; m_history.erase(m_history.begin() + 0); } else { ret = NULL; } - pthread_mutex_unlock (&stringLock); + stringLock.unlock(); return ret; } @@ -120,16 +142,21 @@ } -void* sortstuffhelper (void * arg); void SortingMan::SortStuff() { //run the sorting algorithm on a different thread. - pthread_t thread; + //we can only run one at a time because of OF windows i think we need + //to keep the thread ref around (unlike pthreads) + static SortThread thread; - while(ShouldStop()) - usleep(100); + while(ShouldStop()) { +#ifdef WIN32 + Sleep(1); //windows sleep in milliseconds +#else + usleep(100); //mac sleep in microseconds - cooler :) +#endif + } - m_isSorting=true; m_lastSort.size = m_size; m_lastSort.algo = m_type; @@ -142,9 +169,9 @@ m_lastSort.array = new double[m_size]; AlgorhythmicAudioIO::Instance()->unLockSortData(); + thread.SetPriv(&m_lastSort); + thread.startThread(true,false); // sortstuffhelper(&m_lastSort); - pthread_create(&thread, NULL, &sortstuffhelper, &m_lastSort); - } void SortingMan::StopSorting() Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h 2010-11-30 00:55:25 UTC (rev 239) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/SortingMan.h 2010-12-05 03:21:31 UTC (rev 240) @@ -1,7 +1,7 @@ #ifndef __SORTINGMAN__ #define __SORTINGMAN__ -#include <pthread.h> +#include "ofxMutex.h" #include <string> #include <vector> using std::string; @@ -90,7 +90,7 @@ sort_params m_lastSort; bool m_shouldStop; - pthread_mutex_t stringLock ; + ofxMutex stringLock ; }; #endif Added: algorhythmicSorting/ofAlgorhythmicSorting/src/ofxMutex.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ofxMutex.cpp (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ofxMutex.cpp 2010-12-05 03:21:31 UTC (rev 240) @@ -0,0 +1,42 @@ +#include "ofxMutex.h" + +//------------------------------------------------- +ofxMutex::ofxMutex(){ + #ifdef TARGET_WIN32 + InitializeCriticalSection(&critSec); + #else + pthread_mutex_init(&myMutex, NULL); + #endif +} + +//------------------------------------------------- +ofxMutex::~ofxMutex(){ + #ifndef TARGET_WIN32 + pthread_mutex_destroy(&myMutex); + #endif +} + + +//------------------------------------------------- +//returns false if it can't lock +bool ofxMutex::lock(){ + + #ifdef TARGET_WIN32 + EnterCriticalSection(&critSec); + #else + pthread_mutex_lock(&myMutex); + #endif + + return true; +} + +//------------------------------------------------- +bool ofxMutex::unlock(){ + + #ifdef TARGET_WIN32 + LeaveCriticalSection(&critSec); + #else + pthread_mutex_unlock(&myMutex); + #endif + return true; +} \ No newline at end of file Added: algorhythmicSorting/ofAlgorhythmicSorting/src/ofxMutex.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/ofxMutex.h (rev 0) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/ofxMutex.h 2010-12-05 03:21:31 UTC (rev 240) @@ -0,0 +1,31 @@ +//basic blocking mutex + +#ifndef _OFX_MUTEX_H_ +#define _OFX_MUTEX_H_ + +#include "ofConstants.h" + +#ifdef TARGET_WIN32 + #include <process.h> +#else + #include <pthread.h> +#endif + +class ofxMutex{ + + public: + ofxMutex(); + virtual ~ofxMutex(); + bool lock(); + bool unlock(); + + protected: + + #ifdef TARGET_WIN32 + CRITICAL_SECTION critSec; //same as a mutex + #else + pthread_mutex_t myMutex; + #endif +}; + +#endif Added: algorhythmicSorting/ofAlgorhythmicSorting/src/portaudio-v19.lib =================================================================== (Binary files differ) Property changes on: algorhythmicSorting/ofAlgorhythmicSorting/src/portaudio-v19.lib ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/shell.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/shell.cpp 2010-11-30 00:55:25 UTC (rev 239) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/shell.cpp 2010-12-05 03:21:31 UTC (rev 240) @@ -46,7 +46,7 @@ double LOGNB2, t; int i,j,k,l,m,nn; - LOGNB2=(double) floor(log(n)*ALN2I+TINY); + LOGNB2=(double) floor(log((double)n)*ALN2I+TINY); m=n; for (nn=1; nn<=floor(LOGNB2); nn++) { printseperator(0); Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-11-30 00:55:25 UTC (rev 239) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/sorthelp.cpp 2010-12-05 03:21:31 UTC (rev 240) @@ -1,6 +1,9 @@ #include <stdio.h> #include "sorthelp.h" + +#ifndef WIN32 #include <unistd.h> +#endif #include "AlgorhythmicAudioIO.h" #include "handyfuncs.h" @@ -111,8 +114,12 @@ { // play the values (freq) of a block secondsToRest = AlgorhythmicAudioIO::Instance()->PlayDoubleArray(array+focusstart, focussize); // - } - usleep(1000000*(secondsToRest)); + } + #ifdef WIN32 + Sleep(1000*(secondsToRest)); //windows sleep in milliseconds + #else + usleep(1000000*(secondsToRest)); //mac sleep in microseconds - cooler :) + #endif } void printseperator(int depth) @@ -125,7 +132,11 @@ float delayseconds=1; for(i=0; i<size; i++){ printf(" %d ",array[i]); // type (d integer) for float f variable type - usleep(1000000*(delayseconds/size)); + #ifdef WIN32 + Sleep(1000*(delayseconds/size)); //windows sleep in milliseconds + #else + usleep(1000000*(delayseconds/size)); //mac sleep in microseconds - cooler :) + #endif } printf("\n"); Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-11-30 00:55:25 UTC (rev 239) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-12-05 03:21:31 UTC (rev 240) @@ -3,9 +3,8 @@ #include "ofMain.h" +#include "ofxMutex.h" #include <vector> -#include <pthread.h> - enum MouseMode { eMouseModeNone = 0x0000, eMouseModeNoise1 = 0x0001, @@ -133,8 +132,8 @@ float input2ToRRing; //we need to mutex these vectors cause they are added/delted in gui thread and used in audio. - pthread_mutex_t delayMutex; - pthread_mutex_t loopMutex; + ofxMutex delayMutex; + ofxMutex loopMutex; ofTrueTypeFont arrayFont; int currFontSize; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mc...@us...> - 2010-11-30 00:55:31
|
Revision: 239 http://algorhythmics.svn.sourceforge.net/algorhythmics/?rev=239&view=rev Author: mchinen Date: 2010-11-30 00:55:25 +0000 (Tue, 30 Nov 2010) Log Message: ----------- movable drawing function (press '4' to turn all on) Modified Paths: -------------- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-11-29 23:08:54 UTC (rev 238) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.cpp 2010-11-30 00:55:25 UTC (rev 239) @@ -20,6 +20,7 @@ bDrawBars = false; bDrawSquares = false; currFontSize = 10; + drawAll = true; arrayFont.loadFont("Courier New.ttf", currFontSize, true, true); // arrayFont.setLineHeight(10.0f); ofBackground(255,255,255); @@ -93,10 +94,15 @@ //-------------------------------------------------------------- void testApp::draw(){ - drawBars(); - drawSquares(); - drawConsole(); - + if (!drawAll) { + drawBars(0, 0, ofGetWidth(), ofGetHeight()); + drawSquares(0, 0, ofGetWidth(), ofGetHeight()); + drawConsole(0, 0, ofGetWidth(), ofGetHeight()); + } else { + drawBars(ofGetWidth() / 2, 0, ofGetWidth() / 2, ofGetHeight() / 2); + drawSquares(0, 0, ofGetWidth() / 2, ofGetHeight() / 2); + drawConsole(0, ofGetHeight() / 2, ofGetWidth(), ofGetHeight() /2); + } if(drawGUI) gui.draw(); @@ -105,9 +111,9 @@ static char lastDrawString[kArraysStringMaxSize+1]=""; -void testApp::drawBars() +void testApp::drawBars(int x, int y, int width, int height) { - if(!bDrawBars) + if(!bDrawBars && !drawAll) return; //we don't need to worry about thread safety because the array pointer and size is only modified on the main thread. //the values change and there's a chance of corruption, but probably it won't happen and we can take a glitch. @@ -137,14 +143,15 @@ } }else ofSetColor(0x666666); - y1 = ofGetHeight()/2; - y2 = (1.0 + (array[i]/-100.0)) * ofGetHeight()/2; - ofRect(ofGetWidth()*((float)i/len), mymin(y1,y2), - (float)ofGetWidth()/len, fabs(y1-y2)); + y1 = height/2; + y2 = (1.0 + (array[i]/-100.0)) * height/2; + ofRect(x + width * ((float)i/len), y + mymin(y1,y2), + (float)width/len, fabs(y1-y2)); } } -void testApp::drawSquares() +#define kDrawMethodBorder 10 +void testApp::drawSquares(int x, int y, int width, int height) { static vector<double*> history; static int lastlen = -1; @@ -162,8 +169,8 @@ history.push_back(array); } - int viewWidth = ofGetWidth() - 10; - int viewHeight = ofGetHeight() - 10; + int viewWidth = width - kDrawMethodBorder * 2; + int viewHeight = height - kDrawMethodBorder * 2; int squareSize = viewWidth / len; int numRows = viewHeight / squareSize; @@ -173,7 +180,7 @@ } int startRow = numRows - history.size(); - if(bDrawSquares) { + if(bDrawSquares || drawAll) { for(int i = startRow; i < numRows; i++) { for(int j = 0; j < len; j++) { int val; @@ -183,15 +190,16 @@ //copy to other bytes color |= color << 8 | color << 16; ofSetColor(color); - ofRect( 5 + j * squareSize, 5 + i * squareSize, - squareSize, squareSize); + ofRect(x + kDrawMethodBorder + j * squareSize, + y + kDrawMethodBorder + i * squareSize, + squareSize, squareSize); } } } lastlen = len; } -void testApp::drawConsole() +void testApp::drawConsole(int x, int y, int width, int height) { static int bufsize = 0; char* poppedString; @@ -218,21 +226,18 @@ } //compute where we should start -#define kConsoleX 10 -#define kConsoleY 10 - int desiredFontSize = 10; - if(prev_arraysize > 30) - { - desiredFontSize = mymax(10.0 - (prev_arraysize/30.0), 4.0); - } - if(currFontSize!=desiredFontSize) { - arrayFont.loadFont("Courier New.ttf",desiredFontSize,true, true); - currFontSize = desiredFontSize; - } - - int width = ofGetWidth(); - int screenHeight = ofGetHeight() - kConsoleY; + static char test[800]; + memset(test, '1', 800); + test[prev_arraysize*4] = 0; + + do { + arrayFont.loadFont("Courier New.ttf",desiredFontSize,true, true); + currFontSize = desiredFontSize--; + } while (desiredFontSize > 3 && arrayFont.stringWidth(test) > width - 8 * kDrawMethodBorder) + ; + + int viewHeight = height - kDrawMethodBorder; int lineHeight = arrayFont.getLineHeight(); int n = bufsize; lines = 0; @@ -241,7 +246,7 @@ if(lastDrawString[n]=='\n') { lines++; } - if(lines*lineHeight>screenHeight) + if(lines * lineHeight > viewHeight) { n++;//restore n to point after the endline. break; @@ -262,10 +267,10 @@ free(poppedString); - if(lastDrawString && bDrawConsole){ + if(lastDrawString && (bDrawConsole || drawAll)){ ofSetColor(0xFF0000); // ofDrawBitmapString(lastDrawString,kConsoleX,kConsoleY); - arrayFont.drawString(lastDrawString,kConsoleX,kConsoleY); + arrayFont.drawString(lastDrawString, x + kDrawMethodBorder, y + kDrawMethodBorder); } } @@ -366,6 +371,9 @@ volume = MIN(volume, 1); } else if(key == 'c') { drawGUI=!drawGUI; + }else if(key == '4') + { + drawAll = !drawAll; }else if(key == '3') { bDrawSquares = !bDrawSquares; Modified: algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h =================================================================== --- algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-11-29 23:08:54 UTC (rev 238) +++ algorhythmicSorting/ofAlgorhythmicSorting/src/testApp.h 2010-11-30 00:55:25 UTC (rev 239) @@ -69,11 +69,11 @@ void windowResized(int w, int h); protected: - void drawBars(); - void drawConsole(); - void drawSquares(); + void drawBars(int x, int y, int width, int height); + void drawConsole(int x, int y, int width, int height); + void drawSquares(int x, int y, int width, int height); - + vector<double*> mHistory; float pan; int sampleRate; float volume; @@ -83,8 +83,8 @@ int arraysize, prev_arraysize; bool bLoop; + bool drawAll; - float * lAudio; float * rAudio; float * lIn; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |