initial import
This commit is contained in:
commit
0798e9ac17
22 changed files with 3102 additions and 0 deletions
13
Makefile
Normal file
13
Makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Attempt to load a config.make file.
|
||||
# If none is found, project defaults in config.project.make will be used.
|
||||
ifneq ($(wildcard config.make),)
|
||||
include config.make
|
||||
endif
|
||||
|
||||
# make sure the the OF_ROOT location is defined
|
||||
ifndef OF_ROOT
|
||||
OF_ROOT=$(realpath ../../..)
|
||||
endif
|
||||
|
||||
# call the project makefile!
|
||||
include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk
|
0
addons.make
Normal file
0
addons.make
Normal file
BIN
audioInputExample.gif
Normal file
BIN
audioInputExample.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 877 KiB |
74
audioInputExample.qbs
Normal file
74
audioInputExample.qbs
Normal file
|
@ -0,0 +1,74 @@
|
|||
import qbs
|
||||
import qbs.Process
|
||||
import qbs.File
|
||||
import qbs.FileInfo
|
||||
import qbs.TextFile
|
||||
import "../../../libs/openFrameworksCompiled/project/qtcreator/ofApp.qbs" as ofApp
|
||||
|
||||
Project{
|
||||
property string of_root: "../../.."
|
||||
|
||||
ofApp {
|
||||
name: { return FileInfo.baseName(sourceDirectory) }
|
||||
|
||||
files: [
|
||||
"src/mnglitches/glitch.cpp",
|
||||
"src/mnglitches/glitch.h",
|
||||
"src/mnglitches/line.cpp",
|
||||
"src/mnglitches/line.h",
|
||||
"src/mnglitches/randomness.h",
|
||||
"src/main.cpp",
|
||||
"src/ofApp.cpp",
|
||||
"src/ofApp.h",
|
||||
]
|
||||
|
||||
of.addons: [
|
||||
// 'ofxFft','ofxVoronoi2D'
|
||||
'ofxFft'
|
||||
]
|
||||
|
||||
// additional flags for the project. the of module sets some
|
||||
// flags by default to add the core libraries, search paths...
|
||||
// this flags can be augmented through the following properties:
|
||||
of.pkgConfigs: [] // list of additional system pkgs to include
|
||||
of.includePaths: [] // include search paths
|
||||
of.cFlags: [] // flags passed to the c compiler
|
||||
of.cxxFlags: [] // flags passed to the c++ compiler
|
||||
of.linkerFlags: [] // flags passed to the linker
|
||||
of.defines: [] // defines are passed as -D to the compiler
|
||||
// and can be checked with #ifdef or #if in the code
|
||||
of.frameworks: [] // osx only, additional frameworks to link with the project
|
||||
of.staticLibraries: [] // static libraries
|
||||
of.dynamicLibraries: [] // dynamic libraries
|
||||
|
||||
// other flags can be set through the cpp module: http://doc.qt.io/qbs/cpp-module.html
|
||||
// eg: this will enable ccache when compiling
|
||||
//
|
||||
// cpp.compilerWrapper: 'ccache'
|
||||
|
||||
Depends{
|
||||
name: "cpp"
|
||||
}
|
||||
|
||||
// common rules that parse the include search paths, core libraries...
|
||||
Depends{
|
||||
name: "of"
|
||||
}
|
||||
|
||||
// dependency with the OF library
|
||||
Depends{
|
||||
name: "openFrameworks"
|
||||
}
|
||||
}
|
||||
|
||||
property bool makeOF: true // use makfiles to compile the OF library
|
||||
// will compile OF only once for all your projects
|
||||
// otherwise compiled per project with qbs
|
||||
|
||||
|
||||
property bool precompileOfMain: false // precompile ofMain.h
|
||||
// faster to recompile when including ofMain.h
|
||||
// but might use a lot of space per project
|
||||
|
||||
references: [FileInfo.joinPaths(of_root, "/libs/openFrameworksCompiled/project/qtcreator/openFrameworks.qbs")]
|
||||
}
|
283
audioInputExample.qbs.user
Normal file
283
audioInputExample.qbs.user
Normal file
|
@ -0,0 +1,283 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.15.1, 2021-07-13T08:27:24. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{72eb1593-388b-4307-9bc7-5cc6063e004f}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.CTest">false</value>
|
||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
||||
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
|
||||
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
|
||||
<value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.Questionable</value>
|
||||
<valuemap type="QVariantMap" key="ClangTools">
|
||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">2</value>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{182db797-8316-41ba-8d0a-920bd9c70b7a}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/openFrameworks/examples/sound/build-audioInputExample-Desktop-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.BuildStep</value>
|
||||
<valuemap type="QVariantMap" key="Qbs.Configuration">
|
||||
<value type="QString" key="qbs.defaultBuildVariant">debug</value>
|
||||
<value type="QString" key="qbs.profile">qtc_Desktop_253ec7a4</value>
|
||||
<value type="bool" key="qbspm.forceProbes">false</value>
|
||||
</valuemap>
|
||||
<value type="bool" key="Qbs.Install">true</value>
|
||||
<value type="qlonglong" key="Qbs.MaxJobs">4</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.CleanStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges">
|
||||
<value type="QString">LD_LIBRARY_PATH=/opt/openFrameworks/libs/fmod/lib/linux64/</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.QbsBuildConfiguration</value>
|
||||
<value type="QString" key="Qbs.configName">Debug_Desktop_038b678e9426a45b</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/openFrameworks/examples/sound/build-audioInputExample-Desktop-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.BuildStep</value>
|
||||
<valuemap type="QVariantMap" key="Qbs.Configuration">
|
||||
<value type="QString" key="qbs.defaultBuildVariant">release</value>
|
||||
<value type="QString" key="qbs.profile">qtc_Desktop_253ec7a4</value>
|
||||
<value type="bool" key="qbspm.forceProbes">false</value>
|
||||
</valuemap>
|
||||
<value type="bool" key="Qbs.Install">true</value>
|
||||
<value type="qlonglong" key="Qbs.MaxJobs">4</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.CleanStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges">
|
||||
<value type="QString">LD_LIBRARY_PATH=/opt/openFrameworks/libs/fmod/lib/linux64/</value>
|
||||
<value type="QString"><VARIABLE>=<VALUE></value>
|
||||
</valuelist>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.QbsBuildConfiguration</value>
|
||||
<value type="QString" key="Qbs.configName">Release_Desktop_9467cca98300890e</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
||||
<value type="QString">cpu-cycles</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
||||
<value type="QString">-e</value>
|
||||
<value type="QString">cpu-cycles</value>
|
||||
<value type="QString">--call-graph</value>
|
||||
<value type="QString">dwarf,4096</value>
|
||||
<value type="QString">-F</value>
|
||||
<value type="QString">250</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="QString" key="Analyzer.Valgrind.Callgrind.Arguments"></value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.Memcheck.Arguments"></value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindArguments"></value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.RunConfiguration:audioInputExample.</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">audioInputExample.</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/opt/openFrameworks/examples/sound/audioInputExample/bin</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
</qtcreator>
|
0
bin/data/.gitkeep
Normal file
0
bin/data/.gitkeep
Normal file
BIN
bin/libfmod.so
Executable file
BIN
bin/libfmod.so
Executable file
Binary file not shown.
141
config.make
Normal file
141
config.make
Normal file
|
@ -0,0 +1,141 @@
|
|||
################################################################################
|
||||
# CONFIGURE PROJECT MAKEFILE (optional)
|
||||
# This file is where we make project specific configurations.
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# OF ROOT
|
||||
# The location of your root openFrameworks installation
|
||||
# (default) OF_ROOT = ../../..
|
||||
################################################################################
|
||||
# OF_ROOT = ../../../
|
||||
|
||||
################################################################################
|
||||
# PROJECT ROOT
|
||||
# The location of the project - a starting place for searching for files
|
||||
# (default) PROJECT_ROOT = . (this directory)
|
||||
#
|
||||
################################################################################
|
||||
# PROJECT_ROOT = .
|
||||
|
||||
################################################################################
|
||||
# PROJECT SPECIFIC CHECKS
|
||||
# This is a project defined section to create internal makefile flags to
|
||||
# conditionally enable or disable the addition of various features within
|
||||
# this makefile. For instance, if you want to make changes based on whether
|
||||
# GTK is installed, one might test that here and create a variable to check.
|
||||
################################################################################
|
||||
# None
|
||||
|
||||
################################################################################
|
||||
# PROJECT EXTERNAL SOURCE PATHS
|
||||
# These are fully qualified paths that are not within the PROJECT_ROOT folder.
|
||||
# Like source folders in the PROJECT_ROOT, these paths are subject to
|
||||
# exlclusion via the PROJECT_EXLCUSIONS list.
|
||||
#
|
||||
# (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_EXTERNAL_SOURCE_PATHS =
|
||||
|
||||
################################################################################
|
||||
# PROJECT EXCLUSIONS
|
||||
# These makefiles assume that all folders in your current project directory
|
||||
# and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations
|
||||
# to look for source code. The any folders or files that match any of the
|
||||
# items in the PROJECT_EXCLUSIONS list below will be ignored.
|
||||
#
|
||||
# Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
|
||||
# string unless teh user adds a wildcard (%) operator to match subdirectories.
|
||||
# GNU make only allows one wildcard for matching. The second wildcard (%) is
|
||||
# treated literally.
|
||||
#
|
||||
# (default) PROJECT_EXCLUSIONS = (blank)
|
||||
#
|
||||
# Will automatically exclude the following:
|
||||
#
|
||||
# $(PROJECT_ROOT)/bin%
|
||||
# $(PROJECT_ROOT)/obj%
|
||||
# $(PROJECT_ROOT)/%.xcodeproj
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_EXCLUSIONS =
|
||||
|
||||
################################################################################
|
||||
# PROJECT LINKER FLAGS
|
||||
# These flags will be sent to the linker when compiling the executable.
|
||||
#
|
||||
# (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
#
|
||||
# Currently, shared libraries that are needed are copied to the
|
||||
# $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to
|
||||
# add a runtime path to search for those shared libraries, since they aren't
|
||||
# incorporated directly into the final executable application binary.
|
||||
################################################################################
|
||||
# PROJECT_LDFLAGS=-Wl,-rpath=./libs
|
||||
|
||||
################################################################################
|
||||
# PROJECT DEFINES
|
||||
# Create a space-delimited list of DEFINES. The list will be converted into
|
||||
# CFLAGS with the "-D" flag later in the makefile.
|
||||
#
|
||||
# (default) PROJECT_DEFINES = (blank)
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_DEFINES =
|
||||
|
||||
################################################################################
|
||||
# PROJECT CFLAGS
|
||||
# This is a list of fully qualified CFLAGS required when compiling for this
|
||||
# project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
|
||||
# defined in your platform specific core configuration files. These flags are
|
||||
# presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
|
||||
#
|
||||
# (default) PROJECT_CFLAGS = (blank)
|
||||
#
|
||||
# Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
|
||||
# your platform specific configuration file will be applied by default and
|
||||
# further flags here may not be needed.
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
PROJECT_CFLAGS = -DOFX_FFT_USE_FFTW
|
||||
|
||||
################################################################################
|
||||
# PROJECT OPTIMIZATION CFLAGS
|
||||
# These are lists of CFLAGS that are target-specific. While any flags could
|
||||
# be conditionally added, they are usually limited to optimization flags.
|
||||
# These flags are added BEFORE the PROJECT_CFLAGS.
|
||||
#
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets.
|
||||
#
|
||||
# (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank)
|
||||
#
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets.
|
||||
#
|
||||
# (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank)
|
||||
#
|
||||
# Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
|
||||
# PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
|
||||
# file will be applied by default and further optimization flags here may not
|
||||
# be needed.
|
||||
#
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_RELEASE =
|
||||
# PROJECT_OPTIMIZATION_CFLAGS_DEBUG =
|
||||
|
||||
################################################################################
|
||||
# PROJECT COMPILERS
|
||||
# Custom compilers can be set for CC and CXX
|
||||
# (default) PROJECT_CXX = (blank)
|
||||
# (default) PROJECT_CC = (blank)
|
||||
# Note: Leave a leading space when adding list items with the += operator
|
||||
################################################################################
|
||||
# PROJECT_CXX =
|
||||
# PROJECT_CC =
|
1
obj/linux64/Release/.compiler_flags
Normal file
1
obj/linux64/Release/.compiler_flags
Normal file
|
@ -0,0 +1 @@
|
|||
-O3 -DNDEBUG -Wall -Werror=return-type -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -DOFX_FFT_USE_FFTW -Wall -Werror=return-type -std=c++14 -DGCC_HAS_REGEX -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/opus -I/usr/include/AL -I/usr/include/rtaudio -D__LINUX_ALSA__ -D__LINUX_PULSE__ -D__UNIX_JACK__ -D_REENTRANT -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -I/opt/openFrameworks/libs/fmod/include -I/opt/openFrameworks/libs/glm/include -I/opt/openFrameworks/libs/glm/include/glm -I/opt/openFrameworks/libs/glm/include/glm/gtc -I/opt/openFrameworks/libs/glm/include/glm/ext -I/opt/openFrameworks/libs/glm/include/glm/detail -I/opt/openFrameworks/libs/glm/include/glm/gtx -I/opt/openFrameworks/libs/glm/include/glm/simd -I/opt/openFrameworks/libs/json/include -I/opt/openFrameworks/libs/kiss/include -I/opt/openFrameworks/libs/pugixml/include -I/opt/openFrameworks/libs/tess2/include -I/opt/openFrameworks/libs/utf8/include -I/opt/openFrameworks/libs/utf8/include/utf8 -I/opt/openFrameworks/libs/openFrameworks -I/opt/openFrameworks/libs/openFrameworks/math -I/opt/openFrameworks/libs/openFrameworks/3d -I/opt/openFrameworks/libs/openFrameworks/utils -I/opt/openFrameworks/libs/openFrameworks/graphics -I/opt/openFrameworks/libs/openFrameworks/sound -I/opt/openFrameworks/libs/openFrameworks/app -I/opt/openFrameworks/libs/openFrameworks/types -I/opt/openFrameworks/libs/openFrameworks/events -I/opt/openFrameworks/libs/openFrameworks/gl -I/opt/openFrameworks/libs/openFrameworks/video -I/opt/openFrameworks/libs/openFrameworks/communication -I/opt/openFrameworks/examples/sound/audioInputExample/src -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -fuse-ld=gold -L/opt/openFrameworks/libs/fmod/lib/linux64/ -lfmod
|
1064
obj/linux64/Release/src/main.d
Normal file
1064
obj/linux64/Release/src/main.d
Normal file
File diff suppressed because it is too large
Load diff
BIN
obj/linux64/Release/src/main.o
Normal file
BIN
obj/linux64/Release/src/main.o
Normal file
Binary file not shown.
1064
obj/linux64/Release/src/ofApp.d
Normal file
1064
obj/linux64/Release/src/ofApp.d
Normal file
File diff suppressed because it is too large
Load diff
BIN
obj/linux64/Release/src/ofApp.o
Normal file
BIN
obj/linux64/Release/src/ofApp.o
Normal file
Binary file not shown.
38
readme.md
Normal file
38
readme.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
#audioInputExample
|
||||
--
|
||||
![Screenshot of Example](audioInputExample.gif)
|
||||
|
||||
### Learning Objectives
|
||||
|
||||
This openFrameworks example is designed to demonstrate how to access, extract, and draw from your audio input's raw data.
|
||||
|
||||
Studying the code behind this example will help you understand:
|
||||
|
||||
* How to list all available audio devices with `soundStream.printDeviceList()` and set a specific audio input device for OF app with `settings.setInDevice(devices[0])`
|
||||
* How audio functions work independent from draw and update loop by observe `bufferCounter` and `drawCounter`
|
||||
* How to roughly calculate volume by using RMS (root mean square) value in `void audioIn`
|
||||
* How to record data overtime with vector with `vector <float> volHistory`
|
||||
|
||||
|
||||
### Expected Behavior
|
||||
|
||||
When launching this app, you should see
|
||||
|
||||
* Fast moving curve lines on the left, and big circle on the right that reacts to live audio input
|
||||
* Graph of recorded volume data overtime under the big circle
|
||||
* Text that shows difference in draw vs buffer counter
|
||||
|
||||
Instructions for use:
|
||||
|
||||
* make some noise or touch your microphone to see how sound manipulate the drawing.
|
||||
* press `e` to stop live audio input, `s` to continue
|
||||
|
||||
|
||||
|
||||
|
||||
### Classes used in this example
|
||||
|
||||
This example uses the following classes:
|
||||
|
||||
* ``ofSoundStream``
|
||||
* ``ofSoundStreamSettings``
|
14
src/main.cpp
Normal file
14
src/main.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "ofMain.h"
|
||||
#include "ofApp.h"
|
||||
|
||||
//========================================================================
|
||||
int main( ){
|
||||
|
||||
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context
|
||||
|
||||
// this kicks off the running of my app
|
||||
// can be OF_WINDOW or OF_FULLSCREEN
|
||||
// pass in width and height too:
|
||||
ofRunApp( new ofApp());
|
||||
|
||||
}
|
23
src/mnglitches/glitch.cpp
Normal file
23
src/mnglitches/glitch.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "glitch.h"
|
||||
|
||||
Glitch::Glitch()
|
||||
{
|
||||
setX(0);
|
||||
setY(0);
|
||||
}
|
||||
|
||||
Glitch::Glitch(const float & x, const float & y)
|
||||
{
|
||||
setX(x);
|
||||
setY(y);
|
||||
}
|
||||
|
||||
//destructor
|
||||
Glitch::~Glitch() {}
|
||||
|
||||
|
||||
//accessors
|
||||
float Glitch::getX(){ return _x; }
|
||||
float Glitch::getY(){ return _y; }
|
||||
void Glitch::setX(const float & x){_x = x;}
|
||||
void Glitch::setY(const float & y){_y = y;}
|
36
src/mnglitches/glitch.h
Normal file
36
src/mnglitches/glitch.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef GLITCH_H
|
||||
#define GLITCH_H
|
||||
|
||||
|
||||
#include "ofMain.h" // we need to include this to have a reference to the openFrameworks framework
|
||||
#include "randomness.h"
|
||||
class Glitch {
|
||||
|
||||
public: // place public functions or variables declarations here
|
||||
//constructor
|
||||
//const reference pass because the values w and h don't change and reference avoid the time it takes to copy large
|
||||
// objects by value (if there were any)
|
||||
Glitch();
|
||||
Glitch(const float & x, const float & y);
|
||||
|
||||
//destructor
|
||||
virtual ~Glitch();
|
||||
|
||||
//accessors
|
||||
float getX();
|
||||
float getY();
|
||||
void setX(const float & x);
|
||||
void setY(const float & y);
|
||||
|
||||
|
||||
// methods, equivalent to specific functions of your class objects
|
||||
virtual void setup() = 0; // setup method, use this to setup your object's initial state
|
||||
virtual void update(const Randomness *rthings) = 0; // update method, used to refresh your objects properties
|
||||
virtual void draw() = 0; // draw method, this where you'll do the object's drawing
|
||||
|
||||
|
||||
private:
|
||||
float _x, _y;
|
||||
|
||||
};
|
||||
#endif // GLITCH_H
|
30
src/mnglitches/line.cpp
Normal file
30
src/mnglitches/line.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "line.h"
|
||||
#include "randomness.h"
|
||||
#include "glitch.h"
|
||||
|
||||
|
||||
Line::Line()
|
||||
{
|
||||
setX(0);
|
||||
setY(0);
|
||||
}
|
||||
Line::Line(float &x, float &y)
|
||||
{
|
||||
setX(x);
|
||||
setY(y);
|
||||
}
|
||||
|
||||
//destructor
|
||||
Line::~Line() {}
|
||||
|
||||
void Line::setup(){
|
||||
|
||||
};
|
||||
|
||||
void Line::draw(){
|
||||
|
||||
};
|
||||
|
||||
void Line::update(const Randomness *rthings){
|
||||
|
||||
}
|
24
src/mnglitches/line.h
Normal file
24
src/mnglitches/line.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef LINE_H
|
||||
#define LINE_H
|
||||
|
||||
#include "glitch.h"
|
||||
#include "randomness.h"
|
||||
|
||||
class Line : public Glitch
|
||||
{
|
||||
public:
|
||||
//contructor
|
||||
Line();
|
||||
Line(float &x, float &y);
|
||||
|
||||
//destructor
|
||||
~Line();
|
||||
|
||||
|
||||
void setup(); // setup method, use this to setup your object's initial state
|
||||
void update(const Randomness *rthings); // update method, used to refresh your objects properties
|
||||
void draw(); // draw method, this where you'll do the object's drawing
|
||||
|
||||
};
|
||||
|
||||
#endif // LINE_H
|
11
src/mnglitches/randomness.h
Normal file
11
src/mnglitches/randomness.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef RANDOMNESS_H
|
||||
#define RANDOMNESS_H
|
||||
|
||||
class Randomness{
|
||||
|
||||
public:
|
||||
Randomness();
|
||||
|
||||
};
|
||||
|
||||
#endif // RANDOMNESS_H
|
226
src/ofApp.cpp
Normal file
226
src/ofApp.cpp
Normal file
|
@ -0,0 +1,226 @@
|
|||
#include "ofApp.h"
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::setup(){
|
||||
ofSetFrameRate(24);
|
||||
|
||||
// ofEnableAntiAliasing();
|
||||
ofEnableBlendMode(OF_BLENDMODE_ALPHA);
|
||||
// ofEnableSmoothing();
|
||||
// voronoi.setMinDist(std::epsilon<float>());
|
||||
|
||||
ofSetVerticalSync(true);
|
||||
ofSetCircleResolution(80);
|
||||
ofBackground(54, 54, 54);
|
||||
|
||||
soundStream.printDeviceList();
|
||||
|
||||
int bufferSize = 256;
|
||||
|
||||
left.assign(bufferSize, 0.0);
|
||||
right.assign(bufferSize, 0.0);
|
||||
volHistory.assign(400, 0.0);
|
||||
|
||||
bufferCounter = 0;
|
||||
drawCounter = 0;
|
||||
smoothedVol = 0.0;
|
||||
scaledVol = 0.0;
|
||||
|
||||
|
||||
ofSoundStreamSettings settings;
|
||||
|
||||
// // if you want to set the device id to be different than the default
|
||||
|
||||
auto devices = soundStream.getDeviceList(ofSoundDevice::Api::JACK);
|
||||
// // settings.device = devices[4];
|
||||
|
||||
// // you can also get devices for an specific api
|
||||
// // auto devices = soundStream.getDevicesByApi(ofSoundDevice::Api::PULSE);
|
||||
// // settings.device = devices[0];
|
||||
|
||||
// // or get the default device for an specific api:
|
||||
// // settings.api = ofSoundDevice::Api::PULSE;
|
||||
|
||||
// // or by name
|
||||
//// auto devices = soundStream.getMatchingDevices("default");
|
||||
//auto devices = soundStream.getDevicesByApi(ofSoundDevice::Api::JACK);
|
||||
// settings.device = devices[0];
|
||||
|
||||
if(!devices.empty()){
|
||||
settings.setInDevice(devices[0]);
|
||||
}
|
||||
|
||||
settings.setInListener(this);
|
||||
settings.sampleRate = 48000;
|
||||
settings.numOutputChannels = 0;
|
||||
settings.numInputChannels = 2;
|
||||
settings.bufferSize = bufferSize;
|
||||
soundStream.setup(settings);
|
||||
// audioAnalyzer.setup(48000, bufferSize, 2);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::update(){
|
||||
// //lets scale the vol up to a 0-1 range
|
||||
// scaledVol = ofMap(smoothedVol, 0.0, 0.17, 0.0, 1.0, true);
|
||||
|
||||
// //lets record the volume into an array
|
||||
// volHistory.push_back( scaledVol );
|
||||
|
||||
// //if we are bigger the the size we want to record - lets drop the oldest value
|
||||
// if( volHistory.size() >= 400 ){
|
||||
// volHistory.erase(volHistory.begin(), volHistory.begin()+1);
|
||||
// }
|
||||
coinToss= ofRandom(0, 3.0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::draw(){
|
||||
//---------- VONOROI -----------
|
||||
// draw background
|
||||
ofColor centerColor = ofColor(85, 78, 68);
|
||||
ofColor edgeColor(0, 0, 0);
|
||||
ofBackgroundGradient(centerColor, edgeColor, OF_GRADIENT_CIRCULAR);
|
||||
ofSetColor(255,255,255);
|
||||
|
||||
|
||||
if(coinToss <= 1){
|
||||
ofSetLineWidth( map(coinToss,0,3,1,5));
|
||||
ofDrawLine(glm::vec2(ofRandom(0,ofGetWidth()),ofRandom(0,ofGetHeight())),glm::vec2(ofRandom(0,ofGetWidth()),ofRandom(0,ofGetHeight())));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::audioIn(ofSoundBuffer & input){
|
||||
|
||||
float curVol = 0.0;
|
||||
|
||||
// samples are "interleaved"
|
||||
int numCounted = 0;
|
||||
|
||||
//lets go through each sample and calculate the root mean square which is a rough way to calculate volume
|
||||
for (size_t i = 0; i < input.getNumFrames(); i++){
|
||||
left[i] = input[i*2]*0.5;
|
||||
right[i] = input[i*2+1]*0.5;
|
||||
|
||||
curVol += left[i] * left[i];
|
||||
curVol += right[i] * right[i];
|
||||
numCounted+=2;
|
||||
}
|
||||
|
||||
//this is how we get the mean of rms :)
|
||||
curVol /= (float)numCounted;
|
||||
|
||||
// this is how we get the root of rms :)
|
||||
curVol = sqrt( curVol );
|
||||
|
||||
smoothedVol *= 0.93;
|
||||
smoothedVol += 0.07 * curVol;
|
||||
|
||||
bufferCounter++;
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::audioReceived(float* input, int bufferSize, int nChannels) {
|
||||
float maxValue = 0;
|
||||
for(int i = 0; i < bufferSize; i++) {
|
||||
if(abs(input[i]) > maxValue) {
|
||||
maxValue = abs(input[i]);
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < bufferSize; i++) {
|
||||
input[i] /= maxValue;
|
||||
}
|
||||
|
||||
fft->setSignal(input);
|
||||
|
||||
float* curFft = fft->getAmplitude();
|
||||
memcpy(&audioBins[0], curFft, sizeof(float) * fft->getBinSize());
|
||||
|
||||
maxValue = 0;
|
||||
for(int i = 0; i < fft->getBinSize(); i++) {
|
||||
if(abs(audioBins[i]) > maxValue) {
|
||||
maxValue = abs(audioBins[i]);
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < fft->getBinSize(); i++) {
|
||||
audioBins[i] /= maxValue;
|
||||
}
|
||||
|
||||
soundMutex.lock();
|
||||
middleBins = audioBins;
|
||||
soundMutex.unlock();
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::keyPressed (int key){
|
||||
std::cout << "Pressed " << char(key) << " (int=" << key << ")\n";
|
||||
switch(key){
|
||||
|
||||
case 'f':
|
||||
ofToggleFullscreen();
|
||||
break;
|
||||
case 's':
|
||||
soundStream.start();
|
||||
break;
|
||||
case 'e':
|
||||
soundStream.stop();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::keyReleased(int key){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mouseMoved(int x, int y ){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mouseDragged(int x, int y, int button){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mousePressed(int x, int y, int button){
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mouseReleased(int x, int y, int button){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mouseEntered(int x, int y){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::mouseExited(int x, int y){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::windowResized(int w, int h){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::gotMessage(ofMessage msg){
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void ofApp::dragEvent(ofDragInfo dragInfo){
|
||||
|
||||
}
|
||||
|
||||
float ofApp::map(float value, float min1, float max1, float min2, float max2) {
|
||||
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
|
||||
}
|
60
src/ofApp.h
Normal file
60
src/ofApp.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
#pragma once
|
||||
|
||||
#include "ofMain.h"
|
||||
#include "ofxFft.h"
|
||||
//#include "ofxVoronoi2D.h"
|
||||
//#include "ofxAudioAnalyzer.h"
|
||||
|
||||
class ofApp : public ofBaseApp{
|
||||
|
||||
public:
|
||||
|
||||
void setup();
|
||||
void update();
|
||||
void draw();
|
||||
|
||||
void keyPressed(int key);
|
||||
void keyReleased(int key);
|
||||
void mouseMoved(int x, int y );
|
||||
void mouseDragged(int x, int y, int button);
|
||||
void mousePressed(int x, int y, int button);
|
||||
void mouseReleased(int x, int y, int button);
|
||||
void mouseEntered(int x, int y);
|
||||
void mouseExited(int x, int y);
|
||||
void windowResized(int w, int h);
|
||||
void dragEvent(ofDragInfo dragInfo);
|
||||
void gotMessage(ofMessage msg);
|
||||
void plot(vector<float>& buffer, float scale, float offset);
|
||||
void audioReceived(float* input, int bufferSize, int nChannels);
|
||||
void audioIn(ofSoundBuffer & input);
|
||||
protected:
|
||||
float map(float value, float min1, float max1, float min2, float max2);
|
||||
private:
|
||||
vector <float> left;
|
||||
vector <float> right;
|
||||
vector <float> volHistory;
|
||||
|
||||
int bufferCounter;
|
||||
int drawCounter;
|
||||
|
||||
float smoothedVol;
|
||||
float scaledVol;
|
||||
|
||||
ofSoundStream soundStream;
|
||||
|
||||
//FFT
|
||||
ofxFft* fft;
|
||||
|
||||
int plotHeight, bufferSize;
|
||||
|
||||
|
||||
|
||||
ofMutex soundMutex;
|
||||
vector<float> drawBins, middleBins, audioBins;
|
||||
// ofxAudioAnalyzer audioAnalyzer;
|
||||
//glitch
|
||||
float coinToss;
|
||||
|
||||
|
||||
|
||||
};
|
Loading…
Reference in a new issue