diff options
| author | Chris Kiefer <chrisk13fer@gmail.com> | 2012-09-27 13:12:57 +0100 |
|---|---|---|
| committer | Chris Kiefer <chrisk13fer@gmail.com> | 2012-09-27 13:12:57 +0100 |
| commit | 6802f1ada9b136cf9ed1afca6245cafd3c168847 (patch) | |
| tree | a98f8581a31975cb5650280d83efdbec9de60b99 | |
| parent | 82a5813a9332acb54e273d39a84f0fb8a39fa3bf (diff) | |
maxiTimestretch efficiency / stress test
9 files changed, 266 insertions, 13 deletions
diff --git a/maximilianTest.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate b/maximilianTest.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate Binary files differnew file mode 100644 index 0000000..c070d2a --- /dev/null +++ b/maximilianTest.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 0000000..298fcca --- /dev/null +++ b/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Bucket + type = "1" + version = "1.0"> + <FileBreakpoints> + <FileBreakpoint + shouldBeEnabled = "No" + ignoreCount = "0" + continueAfterRunningActions = "No" + filePath = "player.cpp" + timestampString = "335806937.962212" + startingColumnNumber = "9223372036854775807" + endingColumnNumber = "9223372036854775807" + startingLineNumber = "69" + endingLineNumber = "69"> + </FileBreakpoint> + </FileBreakpoints> +</Bucket> diff --git a/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/maximilianTest.xcscheme b/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/maximilianTest.xcscheme new file mode 100644 index 0000000..d891c7f --- /dev/null +++ b/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/maximilianTest.xcscheme @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DD76F620486A84900D96B5E" + BuildableName = "rtaudiotest" + BlueprintName = "maximilianTest" + ReferencedContainer = "container:maximilianTest.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES" + buildConfiguration = "Debug"> + <Testables> + </Testables> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DD76F620486A84900D96B5E" + BuildableName = "rtaudiotest" + BlueprintName = "maximilianTest" + ReferencedContainer = "container:maximilianTest.xcodeproj"> + </BuildableReference> + </MacroExpansion> + </TestAction> + <LaunchAction + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + buildConfiguration = "Debug" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + allowLocationSimulation = "YES"> + <BuildableProductRunnable> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DD76F620486A84900D96B5E" + BuildableName = "rtaudiotest" + BlueprintName = "maximilianTest" + ReferencedContainer = "container:maximilianTest.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + buildConfiguration = "Release" + debugDocumentVersioning = "YES"> + <BuildableProductRunnable> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DD76F620486A84900D96B5E" + BuildableName = "rtaudiotest" + BlueprintName = "maximilianTest" + ReferencedContainer = "container:maximilianTest.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist b/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..f2cc5e9 --- /dev/null +++ b/maximilianTest.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>SchemeUserState</key> + <dict> + <key>maximilianTest.xcscheme</key> + <dict> + <key>orderHint</key> + <integer>0</integer> + </dict> + </dict> + <key>SuppressBuildableAutocreation</key> + <dict> + <key>8DD76F620486A84900D96B5E</key> + <dict> + <key>primary</key> + <true/> + </dict> + </dict> +</dict> +</plist> diff --git a/ofxMaxim/ofxMaxim/libs/maxiGrains.h b/ofxMaxim/ofxMaxim/libs/maxiGrains.h index e3b7664..c4b2ccc 100644 --- a/ofxMaxim/ofxMaxim/libs/maxiGrains.h +++ b/ofxMaxim/ofxMaxim/libs/maxiGrains.h @@ -286,15 +286,17 @@ class maxiTimestretch { protected: double position; public: - long cycles; maxiSample *sample; maxiGrainPlayer *grainPlayer; maxiGrainWindowCache<F> windowCache; double randomOffset; + double looper; + + maxiTimestretch(maxiSample *sample) : sample(sample) { position=0; - cycles=0; + looper = 0; grainPlayer = new maxiGrainPlayer(sample); randomOffset=0; } @@ -303,19 +305,29 @@ public: delete grainPlayer; } + double getNormalisedPosition() { + return position / (double) sample->length; + } + + double getPosition() { + return position; + } + void setPosition(double pos) { - position = pos; + position = pos * sample->length; + position = maxiMap::clamp<double>(position, 0, sample->length-1); } + //play at a speed - double play(double speed, double grainLength, int overlaps, double posMod=0.0) { + inline double play(double speed, double grainLength, int overlaps, double posMod=0.0) { position = position + speed; - cycles++; - if (position > sample->length) position=0; - if (position < 0) position = sample->length; + looper++; + if (position > sample->length) position-= sample->length; + if (position < 0) position += sample->length; double cycleLength = grainLength * maxiSettings::sampleRate / overlaps; - double cycleMod = fmod(cycles, cycleLength + randomOffset); - if (0 == floor(cycleMod)) { + if (looper > cycleLength + randomOffset) { + looper -= (cycleLength + randomOffset); speed = (speed > 0 ? 1 : -1); maxiGrain<F> *g = new maxiGrain<F>(sample, max(min(1.0,(position / sample->length) + posMod),0.0), grainLength, speed, &windowCache); grainPlayer->addGrain(g); @@ -326,10 +338,10 @@ public: //provide your own position iteration - double play2(double pos, double grainLength, int overlaps) { - cycles++; + inline double play2(double pos, double grainLength, int overlaps) { + looper++; pos *= sample->length; - if (0 == floor(fmod(cycles, grainLength * maxiSettings::sampleRate / overlaps))) { + if (0 == floor(fmod(looper, grainLength * maxiSettings::sampleRate / overlaps))) { maxiGrain<F> *g = new maxiGrain<F>(sample, max(min(1.0,(pos / sample->length)),0.0), grainLength, 1, &windowCache); grainPlayer->addGrain(g); } @@ -397,7 +409,6 @@ public: double randomOffset; long loopStart, loopEnd, loopLength; double looper; - long cycles; maxiPitchStretch(maxiSample *sample) : sample(sample) { grainPlayer = new maxiGrainPlayer(sample); @@ -413,6 +424,10 @@ public: return position / (double) sample->length; } + double getPosition() { + return position; + } + void setPosition(double pos) { position = pos * sample->length; position = maxiMap::clamp<double>(position, 0, sample->length-1); diff --git a/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..a96b15e --- /dev/null +++ b/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "self:ofMaximilian_fft.xcodeproj"> + </FileRef> +</Workspace> diff --git a/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate b/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate Binary files differnew file mode 100644 index 0000000..49d9781 --- /dev/null +++ b/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/maximilian_fft.xcscheme b/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/maximilian_fft.xcscheme new file mode 100644 index 0000000..35996e8 --- /dev/null +++ b/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/maximilian_fft.xcscheme @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "E4B69B5A0A3A1756003C02F2" + BuildableName = "maximilian_fft.app" + BlueprintName = "maximilian_fft" + ReferencedContainer = "container:ofMaximilian_fft.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" + shouldUseLaunchSchemeArgsEnv = "YES" + buildConfiguration = "Debug"> + <Testables> + </Testables> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "E4B69B5A0A3A1756003C02F2" + BuildableName = "maximilian_fft.app" + BlueprintName = "maximilian_fft" + ReferencedContainer = "container:ofMaximilian_fft.xcodeproj"> + </BuildableReference> + </MacroExpansion> + </TestAction> + <LaunchAction + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + buildConfiguration = "Debug" + debugDocumentVersioning = "YES" + allowLocationSimulation = "YES"> + <BuildableProductRunnable> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "E4B69B5A0A3A1756003C02F2" + BuildableName = "maximilian_fft.app" + BlueprintName = "maximilian_fft" + ReferencedContainer = "container:ofMaximilian_fft.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + buildConfiguration = "Release" + debugDocumentVersioning = "YES"> + <BuildableProductRunnable> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "E4B69B5A0A3A1756003C02F2" + BuildableName = "maximilian_fft.app" + BlueprintName = "maximilian_fft" + ReferencedContainer = "container:ofMaximilian_fft.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist b/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..552925a --- /dev/null +++ b/ofxMaxim/ofxMaximExamples0062OSX/ofMaxim_example_fft/ofMaximilian_fft.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>SchemeUserState</key> + <dict> + <key>maximilian_fft.xcscheme</key> + <dict> + <key>orderHint</key> + <integer>0</integer> + </dict> + </dict> + <key>SuppressBuildableAutocreation</key> + <dict> + <key>E4B69B5A0A3A1756003C02F2</key> + <dict> + <key>primary</key> + <true/> + </dict> + </dict> +</dict> +</plist> |
