├── .gitattributes ├── .gitignore ├── Builds ├── VisualStudio2010 │ ├── Obxd.sln │ ├── Obxd.vcxproj │ ├── Obxd.vcxproj.filters │ └── resources.rc └── WAM │ ├── Makefile │ ├── build.sh │ ├── encode-wasm.js │ └── post.js ├── JuceLibraryCode ├── AppConfig.h └── JuceHeader.h ├── README.md ├── Source ├── Engine │ ├── APInterpolator.h │ ├── AdsrEnvelope.h │ ├── AudioUtils.h │ ├── BlepData.h │ ├── Decimator.h │ ├── DelayLine.h │ ├── Filter.h │ ├── Lfo.h │ ├── Motherboard.h │ ├── ObxdBank.h │ ├── ObxdOscillatorB.h │ ├── ObxdVoice.h │ ├── ParamSmoother.h │ ├── Params.h │ ├── ParamsEnum.h │ ├── PulseOsc.h │ ├── SawOsc.h │ ├── SynthEngine.h │ ├── TriangleOsc.h │ ├── VoiceQueue.h │ └── midiMap.h ├── Gui │ ├── ButtonList.h │ ├── Knob.h │ ├── TooglableButton.h │ ├── res.cpp │ └── res.h ├── PluginEditor.cpp ├── PluginEditor.h ├── PluginProcessor.cpp └── PluginProcessor.h ├── WAM ├── cpp │ ├── obxd.cpp │ └── obxd.h └── web │ ├── index.html │ ├── libs │ ├── keys.js │ ├── wam-controller.js │ ├── wam-knob.js │ ├── wam-processor.js │ ├── wam-toggle.js │ └── webcomponents-lite.js │ ├── obxd.html │ ├── obxd.js │ ├── presets │ └── factory.fxb │ ├── skin │ ├── background.png │ ├── button.png │ ├── knoblsd.png │ ├── knobssd.png │ ├── legato.png │ └── voices.png │ └── worklet │ ├── obxd-awp.js │ ├── obxd.emsc.js │ └── obxd.wasm.js └── license.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /Builds/VisualStudio2010/Obxd.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 2012 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Obxd", "Obxd.vcxproj", "{45C99F43-10AB-46E5-BDBB-9EC865322E3D}" 4 | EndProject 5 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8F7DCE87-BF53-48EF-AA17-0A5804F2D929}" 6 | ProjectSection(SolutionItems) = preProject 7 | Performance1.psess = Performance1.psess 8 | EndProjectSection 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Mixed Platforms = Debug|Mixed Platforms 13 | Debug|Win32 = Debug|Win32 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|Mixed Platforms = Release|Mixed Platforms 17 | Release|Win32 = Release|Win32 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 23 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 24 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Debug|Win32.Build.0 = Debug|Win32 26 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Debug|x64.ActiveCfg = Debug|Win32 27 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Debug|x64.Build.0 = Debug|Win32 28 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Debug|x86.ActiveCfg = Debug|Win32 29 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Debug|x86.Build.0 = Debug|Win32 30 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 31 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Release|Mixed Platforms.Build.0 = Release|Win32 32 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Release|Win32.ActiveCfg = Release|Win32 33 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Release|Win32.Build.0 = Release|Win32 34 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Release|x64.ActiveCfg = Release|x64 35 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Release|x64.Build.0 = Release|x64 36 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Release|x86.ActiveCfg = Release|Win32 37 | {45C99F43-10AB-46E5-BDBB-9EC865322E3D}.Release|x86.Build.0 = Release|Win32 38 | EndGlobalSection 39 | GlobalSection(SolutionProperties) = preSolution 40 | HideSolutionNode = FALSE 41 | EndGlobalSection 42 | GlobalSection(Performance) = preSolution 43 | HasPerformanceSessions = true 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /Builds/VisualStudio2010/resources.rc: -------------------------------------------------------------------------------- 1 | #ifdef JUCE_USER_DEFINED_RC_FILE 2 | #include JUCE_USER_DEFINED_RC_FILE 3 | #else 4 | 5 | #undef WIN32_LEAN_AND_MEAN 6 | #define WIN32_LEAN_AND_MEAN 7 | #include 8 | 9 | VS_VERSION_INFO VERSIONINFO 10 | FILEVERSION 1,0,0,0 11 | BEGIN 12 | BLOCK "StringFileInfo" 13 | BEGIN 14 | BLOCK "040904E4" 15 | BEGIN 16 | VALUE "CompanyName", "Datsounds\0" 17 | VALUE "FileDescription", "Obxd\0" 18 | VALUE "FileVersion", "1.0.0\0" 19 | VALUE "ProductName", "Obxd\0" 20 | VALUE "ProductVersion", "1.0.0\0" 21 | END 22 | END 23 | 24 | BLOCK "VarFileInfo" 25 | BEGIN 26 | VALUE "Translation", 0x409, 65001 27 | END 28 | END 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Builds/WAM/Makefile: -------------------------------------------------------------------------------- 1 | # Web Audio Modules (WAMs) 2 | # wasm makefile for obxd 3 | # Jari Kleimola 2017-2018 (jari@webaudiomodules.org) 4 | 5 | # -- point this to the local copy of https://github.com/jariseon/JUCE 6 | JUCELIB = /path/to/juce/wasm/repo 7 | 8 | TARGET = ./obxd.js 9 | WAM = ../../WAM/cpp 10 | SRC = ../../Source 11 | JUCE = ../../JuceLibraryCode 12 | 13 | SOURCES = \ 14 | $(SRC)/PluginProcessor.cpp \ 15 | $(WAM)/obxd.cpp \ 16 | $(JUCELIB)/wasm/wamsdk/processor.cpp 17 | 18 | INC = -I$(WAM)/wamsdk -I$(SRC)/Engine -I$(JUCELIB) -I$(JUCELIB)/modules -I$(JUCELIB)/wasm/wamsdk -I$(JUCE) 19 | LIBS = $(JUCELIB)/wasm/lib/juce-audioworklet.bc 20 | 21 | Wno = -Wno-implicit-conversion-floating-point-to-bool 22 | JUCEFLAGS = -DJUCE_AUDIOPROCESSOR_NO_GUI=1 -DJUCE_STANDALONE_APPLICATION=0 -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 23 | CFLAGS = -std=c++11 -DWASM -DAUDIOWORKLET $(Wno) $(INC) 24 | LDFLAGS = -O2 25 | JSFLAGS = --post-js post.js -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall','cwrap','setValue']" -s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -s BINARYEN_ASYNC_COMPILATION=0 -s EXPORT_NAME="'AudioWorkletGlobalScope.WAM.OBXD'" 26 | 27 | $(TARGET): $(OBJECTS) 28 | $(CC) $(CFLAGS) $(JUCEFLAGS) $(LDFLAGS) $(JSFLAGS) $(LIBS) -o $@ $(SOURCES) 29 | -------------------------------------------------------------------------------- /Builds/WAM/build.sh: -------------------------------------------------------------------------------- 1 | emmake make 2 | node encode-wasm.js obxd.wasm OBXD 3 | mv obxd.js ../../WAM/web/worklet/obxd.emsc.js 4 | mv obxd.wasm.js ../../WAM/web/worklet/ 5 | rm obxd.wasm 6 | -------------------------------------------------------------------------------- /Builds/WAM/encode-wasm.js: -------------------------------------------------------------------------------- 1 | if (process.argv.length != 4) { 2 | console.log("usage: node encode-wasm.js mymodule.wasm MYMODULE"); 3 | return; 4 | } 5 | 6 | let wasmName = process.argv[2]; 7 | let name = process.argv[3]; 8 | 9 | // thanks to Steven Yi / Csound 10 | // 11 | fs = require('fs'); 12 | let wasmData = fs.readFileSync(wasmName); 13 | let wasmStr = wasmData.join(","); 14 | 15 | let wasmOut = "AudioWorkletGlobalScope.WAM = AudioWorkletGlobalScope.WAM || {}\n"; 16 | wasmOut += "AudioWorkletGlobalScope.WAM['" + name + "'] = { ENVIRONMENT: 'WEB' }\n"; 17 | wasmOut += "AudioWorkletGlobalScope.WAM['" + name + "'].wasmBinary = new Uint8Array([" + wasmStr + "]);"; 18 | fs.writeFileSync(wasmName + ".js", wasmOut); 19 | 20 | -------------------------------------------------------------------------------- /Builds/WAM/post.js: -------------------------------------------------------------------------------- 1 | function _emscripten_get_now_is_monotonic () { return true; } 2 | -------------------------------------------------------------------------------- /JuceLibraryCode/AppConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IMPORTANT! This file is auto-generated each time you save your 4 | project - if you alter its contents, your changes may be overwritten! 5 | 6 | There's a section below where you can add your own custom code safely, and the 7 | Introjucer will preserve the contents of that block, but the best way to change 8 | any of these definitions is by using the Introjucer's project settings. 9 | 10 | Any commented-out settings will assume their default values. 11 | 12 | */ 13 | 14 | #ifndef __JUCE_APPCONFIG_PNBAGX__ 15 | #define __JUCE_APPCONFIG_PNBAGX__ 16 | 17 | //============================================================================== 18 | // [BEGIN_USER_CODE_SECTION] 19 | 20 | // (You can add your own code in this section, and the Introjucer will not overwrite it) 21 | 22 | // [END_USER_CODE_SECTION] 23 | 24 | //============================================================================== 25 | #define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 26 | #define JUCE_MODULE_AVAILABLE_juce_audio_devices 1 27 | #define JUCE_MODULE_AVAILABLE_juce_audio_formats 1 28 | #define JUCE_MODULE_AVAILABLE_juce_audio_plugin_client 1 29 | #define JUCE_MODULE_AVAILABLE_juce_audio_processors 1 30 | #define JUCE_MODULE_AVAILABLE_juce_core 1 31 | #define JUCE_MODULE_AVAILABLE_juce_cryptography 1 32 | #define JUCE_MODULE_AVAILABLE_juce_data_structures 1 33 | #define JUCE_MODULE_AVAILABLE_juce_events 1 34 | #define JUCE_MODULE_AVAILABLE_juce_graphics 1 35 | #define JUCE_MODULE_AVAILABLE_juce_gui_basics 1 36 | #define JUCE_MODULE_AVAILABLE_juce_gui_extra 1 37 | #define JUCE_MODULE_AVAILABLE_juce_opengl 1 38 | #define JUCE_MODULE_AVAILABLE_juce_video 1 39 | 40 | //============================================================================== 41 | // juce_audio_devices flags: 42 | 43 | #ifndef JUCE_ASIO 44 | //#define JUCE_ASIO 45 | #endif 46 | 47 | #ifndef JUCE_WASAPI 48 | //#define JUCE_WASAPI 49 | #endif 50 | 51 | #ifndef JUCE_DIRECTSOUND 52 | //#define JUCE_DIRECTSOUND 53 | #endif 54 | 55 | #ifndef JUCE_ALSA 56 | //#define JUCE_ALSA 57 | #endif 58 | 59 | #ifndef JUCE_JACK 60 | //#define JUCE_JACK 61 | #endif 62 | 63 | #ifndef JUCE_USE_ANDROID_OPENSLES 64 | //#define JUCE_USE_ANDROID_OPENSLES 65 | #endif 66 | 67 | #ifndef JUCE_USE_CDREADER 68 | //#define JUCE_USE_CDREADER 69 | #endif 70 | 71 | #ifndef JUCE_USE_CDBURNER 72 | //#define JUCE_USE_CDBURNER 73 | #endif 74 | 75 | //============================================================================== 76 | // juce_audio_formats flags: 77 | 78 | #ifndef JUCE_USE_FLAC 79 | //#define JUCE_USE_FLAC 80 | #endif 81 | 82 | #ifndef JUCE_USE_OGGVORBIS 83 | //#define JUCE_USE_OGGVORBIS 84 | #endif 85 | 86 | #ifndef JUCE_USE_MP3AUDIOFORMAT 87 | //#define JUCE_USE_MP3AUDIOFORMAT 88 | #endif 89 | 90 | #ifndef JUCE_USE_LAME_AUDIO_FORMAT 91 | //#define JUCE_USE_LAME_AUDIO_FORMAT 92 | #endif 93 | 94 | #ifndef JUCE_USE_WINDOWS_MEDIA_FORMAT 95 | //#define JUCE_USE_WINDOWS_MEDIA_FORMAT 96 | #endif 97 | 98 | //============================================================================== 99 | // juce_audio_processors flags: 100 | 101 | #ifndef JUCE_PLUGINHOST_VST 102 | //#define JUCE_PLUGINHOST_VST 103 | #endif 104 | 105 | #ifndef JUCE_PLUGINHOST_AU 106 | //#define JUCE_PLUGINHOST_AU 107 | #endif 108 | 109 | //============================================================================== 110 | // juce_core flags: 111 | 112 | #ifndef JUCE_FORCE_DEBUG 113 | //#define JUCE_FORCE_DEBUG 114 | #endif 115 | 116 | #ifndef JUCE_LOG_ASSERTIONS 117 | //#define JUCE_LOG_ASSERTIONS 118 | #endif 119 | 120 | #ifndef JUCE_CHECK_MEMORY_LEAKS 121 | //#define JUCE_CHECK_MEMORY_LEAKS 122 | #endif 123 | 124 | #ifndef JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES 125 | //#define JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES 126 | #endif 127 | 128 | //============================================================================== 129 | // juce_graphics flags: 130 | 131 | #ifndef JUCE_USE_COREIMAGE_LOADER 132 | //#define JUCE_USE_COREIMAGE_LOADER 133 | #endif 134 | 135 | #ifndef JUCE_USE_DIRECTWRITE 136 | //#define JUCE_USE_DIRECTWRITE 137 | #endif 138 | 139 | //============================================================================== 140 | // juce_gui_basics flags: 141 | 142 | #ifndef JUCE_ENABLE_REPAINT_DEBUGGING 143 | //#define JUCE_ENABLE_REPAINT_DEBUGGING 144 | #endif 145 | 146 | #ifndef JUCE_USE_XSHM 147 | //#define JUCE_USE_XSHM 148 | #endif 149 | 150 | #ifndef JUCE_USE_XRENDER 151 | //#define JUCE_USE_XRENDER 152 | #endif 153 | 154 | #ifndef JUCE_USE_XCURSOR 155 | //#define JUCE_USE_XCURSOR 156 | #endif 157 | 158 | //============================================================================== 159 | // juce_gui_extra flags: 160 | 161 | #ifndef JUCE_WEB_BROWSER 162 | //#define JUCE_WEB_BROWSER 163 | #endif 164 | 165 | //============================================================================== 166 | // juce_video flags: 167 | 168 | #ifndef JUCE_DIRECTSHOW 169 | //#define JUCE_DIRECTSHOW 170 | #endif 171 | 172 | #ifndef JUCE_MEDIAFOUNDATION 173 | //#define JUCE_MEDIAFOUNDATION 174 | #endif 175 | 176 | #ifndef JUCE_QUICKTIME 177 | #define JUCE_QUICKTIME 0 178 | #endif 179 | 180 | #ifndef JUCE_USE_CAMERA 181 | //#define JUCE_USE_CAMERA 182 | #endif 183 | 184 | 185 | //============================================================================== 186 | // Audio plugin settings.. 187 | 188 | #ifndef JucePlugin_Build_VST 189 | #define JucePlugin_Build_VST 1 190 | #endif 191 | #ifndef JucePlugin_Build_AU 192 | #define JucePlugin_Build_AU 1 193 | #endif 194 | #ifndef JucePlugin_Build_RTAS 195 | #define JucePlugin_Build_RTAS 0 196 | #endif 197 | #ifndef JucePlugin_Build_AAX 198 | #define JucePlugin_Build_AAX 0 199 | #endif 200 | #ifndef JucePlugin_Name 201 | #define JucePlugin_Name "Obxd" 202 | #endif 203 | #ifndef JucePlugin_Desc 204 | #define JucePlugin_Desc "Obxd" 205 | #endif 206 | #ifndef JucePlugin_Manufacturer 207 | #define JucePlugin_Manufacturer "Datsounds" 208 | #endif 209 | #ifndef JucePlugin_ManufacturerCode 210 | #define JucePlugin_ManufacturerCode '2DaT' 211 | #endif 212 | #ifndef JucePlugin_PluginCode 213 | #define JucePlugin_PluginCode 'Obxd' 214 | #endif 215 | #ifndef JucePlugin_MaxNumInputChannels 216 | #define JucePlugin_MaxNumInputChannels 0 217 | #endif 218 | #ifndef JucePlugin_MaxNumOutputChannels 219 | #define JucePlugin_MaxNumOutputChannels 2 220 | #endif 221 | #ifndef JucePlugin_PreferredChannelConfigurations 222 | #define JucePlugin_PreferredChannelConfigurations {1, 1}, {2, 2} 223 | #endif 224 | #ifndef JucePlugin_IsSynth 225 | #define JucePlugin_IsSynth 1 226 | #endif 227 | #ifndef JucePlugin_WantsMidiInput 228 | #define JucePlugin_WantsMidiInput 1 229 | #endif 230 | #ifndef JucePlugin_ProducesMidiOutput 231 | #define JucePlugin_ProducesMidiOutput 0 232 | #endif 233 | #ifndef JucePlugin_SilenceInProducesSilenceOut 234 | #define JucePlugin_SilenceInProducesSilenceOut 0 235 | #endif 236 | #ifndef JucePlugin_EditorRequiresKeyboardFocus 237 | #define JucePlugin_EditorRequiresKeyboardFocus 0 238 | #endif 239 | #ifndef JucePlugin_Version 240 | #define JucePlugin_Version 1.1.0 241 | #endif 242 | #ifndef JucePlugin_VersionCode 243 | #define JucePlugin_VersionCode 0x11000 244 | #endif 245 | #ifndef JucePlugin_VersionString 246 | #define JucePlugin_VersionString "1.1.0" 247 | #endif 248 | #ifndef JucePlugin_VSTUniqueID 249 | #define JucePlugin_VSTUniqueID JucePlugin_PluginCode 250 | #endif 251 | #ifndef JucePlugin_VSTCategory 252 | #define JucePlugin_VSTCategory kPlugCategEffect 253 | #endif 254 | #ifndef JucePlugin_AUMainType 255 | #define JucePlugin_AUMainType kAudioUnitType_Effect 256 | #endif 257 | #ifndef JucePlugin_AUSubType 258 | #define JucePlugin_AUSubType JucePlugin_PluginCode 259 | #endif 260 | #ifndef JucePlugin_AUExportPrefix 261 | #define JucePlugin_AUExportPrefix ObxdAU 262 | #endif 263 | #ifndef JucePlugin_AUExportPrefixQuoted 264 | #define JucePlugin_AUExportPrefixQuoted "ObxdAU" 265 | #endif 266 | #ifndef JucePlugin_AUManufacturerCode 267 | #define JucePlugin_AUManufacturerCode JucePlugin_ManufacturerCode 268 | #endif 269 | #ifndef JucePlugin_CFBundleIdentifier 270 | #define JucePlugin_CFBundleIdentifier com.yourcompany.Obxd 271 | #endif 272 | #ifndef JucePlugin_RTASCategory 273 | #define JucePlugin_RTASCategory ePlugInCategory_None 274 | #endif 275 | #ifndef JucePlugin_RTASManufacturerCode 276 | #define JucePlugin_RTASManufacturerCode JucePlugin_ManufacturerCode 277 | #endif 278 | #ifndef JucePlugin_RTASProductId 279 | #define JucePlugin_RTASProductId JucePlugin_PluginCode 280 | #endif 281 | #ifndef JucePlugin_RTASDisableBypass 282 | #define JucePlugin_RTASDisableBypass 0 283 | #endif 284 | #ifndef JucePlugin_RTASDisableMultiMono 285 | #define JucePlugin_RTASDisableMultiMono 0 286 | #endif 287 | #ifndef JucePlugin_AAXIdentifier 288 | #define JucePlugin_AAXIdentifier com.yourcompany.Obxd 289 | #endif 290 | #ifndef JucePlugin_AAXManufacturerCode 291 | #define JucePlugin_AAXManufacturerCode JucePlugin_ManufacturerCode 292 | #endif 293 | #ifndef JucePlugin_AAXProductId 294 | #define JucePlugin_AAXProductId JucePlugin_PluginCode 295 | #endif 296 | #ifndef JucePlugin_AAXPluginId 297 | #define JucePlugin_AAXPluginId JucePlugin_PluginCode 298 | #endif 299 | #ifndef JucePlugin_AAXCategory 300 | #define JucePlugin_AAXCategory AAX_ePlugInCategory_Dynamics 301 | #endif 302 | #ifndef JucePlugin_AAXDisableBypass 303 | #define JucePlugin_AAXDisableBypass 0 304 | #endif 305 | 306 | #endif // __JUCE_APPCONFIG_PNBAGX__ 307 | -------------------------------------------------------------------------------- /JuceLibraryCode/JuceHeader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | 4 | IMPORTANT! This file is auto-generated each time you save your 5 | project - if you alter its contents, your changes may be overwritten! 6 | 7 | This is the header file that your files should include in order to get all the 8 | JUCE library headers. You should avoid including the JUCE headers directly in 9 | your own source files, because that wouldn't pick up the correct configuration 10 | options for your app. 11 | 12 | */ 13 | 14 | #ifndef __APPHEADERFILE_PNBAGX__ 15 | #define __APPHEADERFILE_PNBAGX__ 16 | 17 | 18 | #include "AppConfig.h" 19 | #include "modules/juce_audio_basics/juce_audio_basics.h" 20 | #include "modules/juce_audio_devices/juce_audio_devices.h" 21 | #include "modules/juce_audio_formats/juce_audio_formats.h" 22 | #include "modules/juce_audio_processors/juce_audio_processors.h" 23 | #include "modules/juce_audio_plugin_client/juce_audio_plugin_client.h" 24 | #include "modules/juce_core/juce_core.h" 25 | #include "modules/juce_cryptography/juce_cryptography.h" 26 | #include "modules/juce_data_structures/juce_data_structures.h" 27 | #include "modules/juce_events/juce_events.h" 28 | #include "modules/juce_graphics/juce_graphics.h" 29 | #include "modules/juce_gui_basics/juce_gui_basics.h" 30 | #include "modules/juce_gui_extra/juce_gui_extra.h" 31 | #ifndef WASM 32 | #include "modules/juce_opengl/juce_opengl.h" 33 | #endif 34 | #include "modules/juce_video/juce_video.h" 35 | 36 | #if ! DONT_SET_USING_JUCE_NAMESPACE 37 | // If your code uses a lot of JUCE classes, then this will obviously save you 38 | // a lot of typing, but can be disabled by setting DONT_SET_USING_JUCE_NAMESPACE. 39 | using namespace juce; 40 | #endif 41 | 42 | namespace ProjectInfo 43 | { 44 | const char* const projectName = "Obxd"; 45 | const char* const versionString = "1.1.0"; 46 | const int versionNumber = 0x10000; 47 | } 48 | 49 | #endif // __APPHEADERFILE_PNBAGX__ 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # webOBXD (AudioWorklet/WASM edition) 2 | Oberheim OB-X inspired synth in a browser, powered by AudioWorklets, WebAssembly and Web Audio Modules (WAMs) project. Ported from 2Dat's original [OBXD](https://github.com/2DaT/Obxd) JUCE Plugin. 3 | 4 | demos: [webOBXD](https://webaudiomodules.org/wamsynths/obxd) and other WAMs at [webaudiomodules.org/wamsynths](https://webaudiomodules.org/wamsynths/). Currently runs best in Chrome. 5 | 6 | ## prerequisites 7 | download and install [node.js](https://nodejs.org/en/download/) and WASM [toolchain](http://webassembly.org/getting-started/developers-guide/), then clone/download JUCE WASM library repository from [here](https://github.com/jariseon/JUCE). 8 | 9 | ## building 10 | open `Builds/WAM/Makefile` in a text editor and edit the line below to point into the folder where you downloaded the JUCE WASM library repository: 11 | 12 | ``` 13 | JUCELIB = /path/to/juce/wasm/repo 14 | ``` 15 | 16 | then open console and give the following commands: 17 | 18 | ``` 19 | export PATH=$PATH:/to/emsdk/where/emmake/resides 20 | cd Builds/WAM 21 | sh build.sh 22 | ``` 23 | 24 | the compilation step creates `obxd.wasm.js` and `obxd.emsc.js` files in `WAM/web/worklet` folder. The first file is the WASM binary and the second file contains its loader/support code. 25 | 26 | ## running 27 | serve files from repository root using a localhost http server, and then browse to [http://localhost/WAM/web/index.html](http://localhost/WAM/web/index.html) (requires Chrome). 28 | 29 | ## porting 30 | porting procedure is detailed in this wiki [page](https://github.com/jariseon/webOBXD/wiki/Porting). -------------------------------------------------------------------------------- /Source/Engine/APInterpolator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/APInterpolator.h -------------------------------------------------------------------------------- /Source/Engine/AdsrEnvelope.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/AdsrEnvelope.h -------------------------------------------------------------------------------- /Source/Engine/AudioUtils.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/AudioUtils.h -------------------------------------------------------------------------------- /Source/Engine/BlepData.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/BlepData.h -------------------------------------------------------------------------------- /Source/Engine/Decimator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | //MusicDsp 3 | // T.Rochebois 4 | //still indev 5 | class Decimator17 6 | { 7 | private: 8 | const float h0,h1,h3,h5,h7,h9,h11,h13,h15,h17; 9 | float R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15,R16,R17; 10 | public: 11 | Decimator17() : 12 | h17(5.18944944e-005), 13 | h15(-0.000572688237), 14 | h13(0.00207426259), 15 | h11(-0.00543170841), 16 | h9(0.0120250406), 17 | h7(-0.0240881704), 18 | h5(0.0463142134), 19 | h3(-0.0947515890), 20 | h1(0.314356238), 21 | h0(0.5) 22 | { 23 | R1=R2=R3=R4=R5=R6=R7=R8=R9=R10=R11=R12=R13=R14=R15=R16=R17=0; 24 | } 25 | float Calc(const float x0,const float x1) 26 | { 27 | float h17x0 = h17 *x0; 28 | float h15x0 = h15 *x0; 29 | float h13x0 = h13 *x0; 30 | float h11x0= h11 *x0; 31 | float h9x0=h9*x0; 32 | float h7x0=h7*x0; 33 | float h5x0=h5*x0; 34 | float h3x0=h3*x0; 35 | float h1x0=h1*x0; 36 | float R18=R17+h17x0; 37 | R17 = R16 + h15x0; 38 | R16 = R15 + h13x0; 39 | R15 = R14 + h11x0; 40 | R14 = R13 + h9x0; 41 | R13 = R12 + h7x0; 42 | R12 = R11 + h5x0; 43 | R11 = R10 + h3x0; 44 | R10 = R9 + h1x0; 45 | R9 = R8 + h1x0 + h0*x1; 46 | R8 = R7 + h3x0; 47 | R7 = R6 + h5x0; 48 | R6 = R5 + h7x0; 49 | R5 = R4 + h9x0; 50 | R4 = R3 + h11x0; 51 | R3 = R2 + h13x0; 52 | R2 = R1 + h15x0; 53 | R1 = h17x0; 54 | return R18; 55 | } 56 | }; 57 | class Decimator9 58 | { 59 | private: 60 | const float h0,h1,h3,h5,h7,h9; 61 | float R1,R2,R3,R4,R5,R6,R7,R8,R9; 62 | public: 63 | Decimator9() : h0(8192/16384.0f),h1(5042/16384.0f),h3(-1277/16384.0f),h5(429/16384.0f),h7(-116/16384.0f),h9(18/16384.0f) 64 | { 65 | R1=R2=R3=R4=R5=R6=R7=R8=R9=0.0f; 66 | } 67 | inline float Calc(const float x0,const float x1) 68 | { 69 | float h9x0=h9*x0; 70 | float h7x0=h7*x0; 71 | float h5x0=h5*x0; 72 | float h3x0=h3*x0; 73 | float h1x0=h1*x0; 74 | float R10=R9+h9x0; 75 | R9=R8+h7x0; 76 | R8=R7+h5x0; 77 | R7=R6+h3x0; 78 | R6=R5+h1x0; 79 | R5=R4+h1x0+h0*x1; 80 | R4=R3+h3x0; 81 | R3=R2+h5x0; 82 | R2=R1+h7x0; 83 | R1=h9x0; 84 | return R10; 85 | } 86 | }; 87 | -------------------------------------------------------------------------------- /Source/Engine/DelayLine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/DelayLine.h -------------------------------------------------------------------------------- /Source/Engine/Filter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/Filter.h -------------------------------------------------------------------------------- /Source/Engine/Lfo.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/Lfo.h -------------------------------------------------------------------------------- /Source/Engine/Motherboard.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/Motherboard.h -------------------------------------------------------------------------------- /Source/Engine/ObxdBank.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/ObxdBank.h -------------------------------------------------------------------------------- /Source/Engine/ObxdOscillatorB.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/ObxdOscillatorB.h -------------------------------------------------------------------------------- /Source/Engine/ObxdVoice.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/ObxdVoice.h -------------------------------------------------------------------------------- /Source/Engine/ParamSmoother.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/ParamSmoother.h -------------------------------------------------------------------------------- /Source/Engine/Params.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/Params.h -------------------------------------------------------------------------------- /Source/Engine/ParamsEnum.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/ParamsEnum.h -------------------------------------------------------------------------------- /Source/Engine/PulseOsc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/PulseOsc.h -------------------------------------------------------------------------------- /Source/Engine/SawOsc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/SawOsc.h -------------------------------------------------------------------------------- /Source/Engine/SynthEngine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/SynthEngine.h -------------------------------------------------------------------------------- /Source/Engine/TriangleOsc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/TriangleOsc.h -------------------------------------------------------------------------------- /Source/Engine/VoiceQueue.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/VoiceQueue.h -------------------------------------------------------------------------------- /Source/Engine/midiMap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Engine/midiMap.h -------------------------------------------------------------------------------- /Source/Gui/ButtonList.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Gui/ButtonList.h -------------------------------------------------------------------------------- /Source/Gui/Knob.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Gui/Knob.h -------------------------------------------------------------------------------- /Source/Gui/TooglableButton.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Gui/TooglableButton.h -------------------------------------------------------------------------------- /Source/Gui/res.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/Gui/res.h -------------------------------------------------------------------------------- /Source/PluginEditor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file was auto-generated by the Introjucer! 5 | 6 | It contains the basic startup code for a Juce application. 7 | 8 | ============================================================================== 9 | */ 10 | #include "PluginProcessor.h" 11 | #include "PluginEditor.h" 12 | #include "Gui/res.h" 13 | 14 | 15 | //============================================================================== 16 | ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor* ownerFilter) 17 | : AudioProcessorEditor (ownerFilter) 18 | { 19 | // This is where our plugin's editor size is set. 20 | setSize (1087, 442); 21 | cutoffKnob = addNormalKnob(577,40,ownerFilter,CUTOFF,"Cutoff",0.4); 22 | resonanceKnob = addNormalKnob(638,40,ownerFilter,RESONANCE,"Resonance",0); 23 | filterEnvelopeAmtKnob = addNormalKnob(699,40,ownerFilter,ENVELOPE_AMT,"Envelope",0); 24 | multimodeKnob = addTinyKnob(643,106,ownerFilter,MULTIMODE,"Multimode",0.5); 25 | 26 | volumeKnob = addNormalKnob(53,120,ownerFilter,VOLUME,"Volume",0.4); 27 | portamentoKnob = addNormalKnob(175,241,ownerFilter,PORTAMENTO,"Portamento",0); 28 | osc1PitchKnob = addNormalKnob(271,40,ownerFilter,OSC1P,"Osc1Pitch",0); 29 | pulseWidthKnob = addNormalKnob(334,40,ownerFilter,PW,"PW",0); 30 | osc2PitchKnob = addNormalKnob(397,40,ownerFilter,OSC2P,"Osc2Pitch",0); 31 | 32 | osc1MixKnob = addNormalKnob(490,40,ownerFilter,OSC1MIX,"Osc1",1); 33 | osc2MixKnob = addNormalKnob(490,132,ownerFilter,OSC2MIX,"Osc2",1); 34 | noiseMixKnob = addNormalKnob(490,224,ownerFilter,NOISEMIX,"Noise",0); 35 | 36 | xmodKnob = addNormalKnob(334,168,ownerFilter,XMOD,"Xmod",0); 37 | osc2DetuneKnob = addNormalKnob(334,104,ownerFilter,OSC2_DET,"Detune",0); 38 | 39 | envPitchModKnob = addNormalKnob(376,232,ownerFilter,ENVPITCH,"PEnv",0); 40 | brightnessKnob = addNormalKnob(291,232,ownerFilter,BRIGHTNESS,"Bri",1); 41 | 42 | attackKnob = addNormalKnob(791,132,ownerFilter,LATK,"Atk",0); 43 | decayKnob = addNormalKnob(853,132,ownerFilter,LDEC,"Dec",0); 44 | sustainKnob = addNormalKnob(916,132,ownerFilter,LSUS,"Sus",1); 45 | releaseKnob = addNormalKnob(980,132,ownerFilter,LREL,"Rel",0); 46 | 47 | fattackKnob = addNormalKnob(791,40,ownerFilter,FATK,"Atk",0); 48 | fdecayKnob = addNormalKnob(853,40,ownerFilter,FDEC,"Dec",0); 49 | fsustainKnob = addNormalKnob(916,40,ownerFilter,FSUS,"Sus",1); 50 | freleaseKnob = addNormalKnob(980,40,ownerFilter,FREL,"Rel",0); 51 | 52 | lfoFrequencyKnob = addNormalKnob(576,207,ownerFilter,LFOFREQ,"Freq",0); 53 | lfoAmt1Knob = addNormalKnob(640,207,ownerFilter,LFO1AMT,"Pitch",0); 54 | lfoAmt2Knob = addNormalKnob(704,207,ownerFilter,LFO2AMT,"PWM",0); 55 | 56 | lfoSinButton = addNormalTooglableButton(587,269,ownerFilter,LFOSINWAVE,"Sin"); 57 | lfoSquareButton = addNormalTooglableButton(587,323,ownerFilter,LFOSQUAREWAVE,"SQ"); 58 | lfoSHButton = addNormalTooglableButton(587,378,ownerFilter,LFOSHWAVE,"S&H"); 59 | 60 | lfoOsc1Button = addNormalTooglableButton(651,269,ownerFilter,LFOOSC1,"Osc1"); 61 | lfoOsc2Button = addNormalTooglableButton(651,323,ownerFilter,LFOOSC2,"Osc2"); 62 | lfoFilterButton = addNormalTooglableButton(651,378,ownerFilter,LFOFILTER,"Filt"); 63 | 64 | lfoPwm1Button = addNormalTooglableButton(714,269,ownerFilter,LFOPW1,"Osc1"); 65 | lfoPwm2Button = addNormalTooglableButton(714,323,ownerFilter,LFOPW2,"Osc2"); 66 | 67 | hardSyncButton = addNormalTooglableButton(282,178,ownerFilter,OSC2HS,"Sync"); 68 | osc1SawButton = addNormalTooglableButton(265,114,ownerFilter,OSC1Saw,"S"); 69 | osc2SawButton = addNormalTooglableButton(394,114,ownerFilter,OSC2Saw,"S"); 70 | 71 | osc1PulButton = addNormalTooglableButton(296,114,ownerFilter,OSC1Pul,"P"); 72 | osc2PulButton = addNormalTooglableButton(425,114,ownerFilter,OSC2Pul,"P"); 73 | 74 | pitchQuantButton = addNormalTooglableButton(407,178,ownerFilter,OSCQuantize,"Step"); 75 | 76 | filterBPBlendButton = addNormalTooglableButton(697,110,ownerFilter,BANDPASS,"Bp"); 77 | fourPoleButton = addNormalTooglableButton(728,110,ownerFilter,FOURPOLE,"24"); 78 | filterHQButton = addNormalTooglableButton(604,110,ownerFilter,FILTER_WARM,"HQ"); 79 | 80 | filterKeyFollowButton = addNormalTooglableButton(573,110,ownerFilter,FLT_KF,"Key"); 81 | unisonButton = addNormalTooglableButton(125,251,ownerFilter,UNISON,"Uni"); 82 | tuneKnob = addNormalKnob(114,120,ownerFilter,TUNE,"Tune",0.5); 83 | voiceDetuneKnob =addNormalKnob(53,241,ownerFilter,UDET,"VoiceDet",0); 84 | 85 | veloAmpEnvKnob = addNormalKnob(486,345,ownerFilter,VAMPENV,"VAE",0); 86 | veloFltEnvKnob = addNormalKnob(428,345,ownerFilter,VFLTENV,"VFE",0); 87 | midiLearnButton = addNormalTooglableButton(126,372,ownerFilter,MIDILEARN,"LEA"); 88 | midiUnlearnButton = addNormalTooglableButton(185,372,ownerFilter,UNLEARN,"UNL"); 89 | transposeKnob = addNormalKnob(176,120,ownerFilter,OCTAVE,"Transpose",0.5); 90 | 91 | pan1Knob = addTinyKnob(796,318,ownerFilter,PAN1,"1",0.5); 92 | pan2Knob = addTinyKnob(858,318,ownerFilter,PAN2,"2",0.5); 93 | pan3Knob = addTinyKnob(921,318,ownerFilter,PAN3,"3",0.5); 94 | pan4Knob = addTinyKnob(984,318,ownerFilter,PAN4,"4",0.5); 95 | 96 | pan5Knob = addTinyKnob(796,371,ownerFilter,PAN5,"5",0.5); 97 | pan6Knob = addTinyKnob(858,371,ownerFilter,PAN6,"6",0.5); 98 | pan7Knob = addTinyKnob(921,371,ownerFilter,PAN7,"7",0.5); 99 | pan8Knob = addTinyKnob(984,371,ownerFilter,PAN8,"8",0.5); 100 | 101 | bendOsc2OnlyButton = addNormalTooglableButton(321,354,ownerFilter,BENDOSC2,"Osc2"); 102 | bendRangeButton = addNormalTooglableButton(267,354,ownerFilter,BENDRANGE,"12"); 103 | asPlayedAllocButton = addNormalTooglableButton(65,372,ownerFilter,ASPLAYEDALLOCATION,"APA"); 104 | 105 | filterDetuneKnob = addTinyKnob(817,240,ownerFilter,FILTERDER,"Flt",0.2); 106 | envelopeDetuneKnob = addTinyKnob(963,240,ownerFilter,ENVDER,"Env",0.2); 107 | portamentoDetuneKnob = addTinyKnob(890,240,ownerFilter,PORTADER,"Port",0.2); 108 | 109 | bendLfoRateKnob = addNormalKnob(364,345,ownerFilter,BENDLFORATE,"ModRate",0.4); 110 | 111 | voiceSwitch = addNormalButtonList(172,321,38,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromMemory(res::voices_png,res::voices_pngSize)); 112 | voiceSwitch ->addChoise("1"); 113 | voiceSwitch ->addChoise("2"); 114 | voiceSwitch ->addChoise("3"); 115 | voiceSwitch ->addChoise("4"); 116 | voiceSwitch ->addChoise("5"); 117 | voiceSwitch ->addChoise("6"); 118 | voiceSwitch ->addChoise("7"); 119 | voiceSwitch ->addChoise("8"); 120 | voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification); 121 | 122 | legatoSwitch = addNormalButtonList(65,321,95,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromMemory(res::legato_png,res::legato_pngSize)); 123 | legatoSwitch ->addChoise("Keep all"); 124 | legatoSwitch ->addChoise("Keep fenv"); 125 | legatoSwitch ->addChoise("Keep aenv"); 126 | legatoSwitch ->addChoise("Retrig"); 127 | legatoSwitch ->setValue(ownerFilter->getParameter(LEGATOMODE),dontSendNotification); 128 | 129 | 130 | ownerFilter->addChangeListener(this); 131 | } 132 | void ObxdAudioProcessorEditor::placeLabel(int x , int y , String text) 133 | { 134 | Label* lab = new Label(); 135 | lab->setBounds(x,y,110,20); 136 | lab->setJustificationType(Justification::centred); 137 | lab->setText(text,dontSendNotification);lab->setInterceptsMouseClicks(false,true); 138 | addAndMakeVisible(lab); 139 | } 140 | ButtonList* ObxdAudioProcessorEditor::addNormalButtonList(int x, int y,int width, ObxdAudioProcessor* filter, int parameter,String name,Image img) 141 | { 142 | ButtonList *bl = new ButtonList(img,32); 143 | bl->setBounds(x, y, width, 32); 144 | //bl->setValue(filter->getParameter(parameter),dontSendNotification); 145 | addAndMakeVisible(bl); 146 | bl->addListener (this); 147 | return bl; 148 | 149 | } 150 | ObxdAudioProcessorEditor::~ObxdAudioProcessorEditor() 151 | { 152 | getFilter()->removeChangeListener(this); 153 | deleteAllChildren(); 154 | } 155 | Knob* ObxdAudioProcessorEditor::addNormalKnob(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval) 156 | { 157 | Knob* knob = new Knob(ImageCache::getFromMemory(res::knoblsd_png,res::knoblsd_pngSize),48); 158 | //Label* knobl = new Label(); 159 | knob->setSliderStyle(Slider::RotaryVerticalDrag); 160 | knob->setTextBoxStyle(knob->NoTextBox,true,0,0); 161 | knob->setRange(0,1); 162 | addAndMakeVisible(knob); 163 | //addAndMakeVisible(knobl); 164 | knob->setBounds(x, y, 48,48); 165 | knob->setValue(filter->getParameter(parameter),dontSendNotification); 166 | //knobl->setJustificationType(Justification::centred); 167 | //knobl->setInterceptsMouseClicks(false,true); 168 | //knobl->setBounds(x-10,y+40,60,10); 169 | //knobl->setText(name,dontSendNotification); 170 | knob->setTextBoxIsEditable(false); 171 | knob->setDoubleClickReturnValue(true,defval); 172 | knob->addListener (this); 173 | return knob; 174 | } 175 | Knob* ObxdAudioProcessorEditor::addTinyKnob(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval) 176 | { 177 | Knob* knob = new Knob(ImageCache::getFromMemory(res::knobssd_png,res::knobssd_pngSize),42); 178 | //Label* knobl = new Label(); 179 | knob->setSliderStyle(Slider::RotaryVerticalDrag); 180 | knob->setTextBoxStyle(knob->NoTextBox,true,0,0); 181 | knob->setRange(0,1); 182 | addAndMakeVisible(knob); 183 | //addAndMakeVisible(knobl); 184 | knob->setBounds(x, y, 42,42); 185 | knob->setValue(filter->getParameter(parameter),dontSendNotification); 186 | //knobl->setJustificationType(Justification::centred); 187 | //knobl->setInterceptsMouseClicks(false,true); 188 | //knobl->setBounds(x-10,y+25,50,10); 189 | //knobl->setText(name,dontSendNotification); 190 | knob->setTextBoxIsEditable(false); 191 | knob->setDoubleClickReturnValue(true,defval); 192 | knob->addListener (this); 193 | return knob; 194 | } 195 | TooglableButton* ObxdAudioProcessorEditor::addNormalTooglableButton(int x , int y , ObxdAudioProcessor* filter,int parameter,String name) 196 | { 197 | TooglableButton* button = new TooglableButton(ImageCache::getFromMemory(res::button_png,res::button_pngSize)); 198 | // button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel); 199 | addAndMakeVisible(button); 200 | button->setBounds(x,y,28,35); 201 | button->setButtonText(name); 202 | button->setValue(filter->getParameter(parameter),0); 203 | button->addListener(this); 204 | return button; 205 | } 206 | TooglableButton* ObxdAudioProcessorEditor::addTinyTooglableButton(int x , int y , ObxdAudioProcessor* filter,int parameter,String name) 207 | { 208 | TooglableButton* button = new TooglableButton(ImageCache::getFromMemory(res::button_png,res::button_pngSize)); 209 | // button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel); 210 | addAndMakeVisible(button); 211 | button->setBounds(x,y,20,20); 212 | button->setButtonText(name); 213 | button->setValue(filter->getParameter(parameter),0); 214 | button->addListener(this); 215 | return button; 216 | } 217 | void ObxdAudioProcessorEditor::buttonClicked(Button * b) 218 | { 219 | TooglableButton* tb = (TooglableButton*)(b); 220 | ObxdAudioProcessor* flt = getFilter(); 221 | #define bp(T) {flt->setParameterNotifyingHost(T,tb->getValue());} 222 | #define handleBParam(K,T) if (tb == K) {bp(T)} else 223 | handleBParam(hardSyncButton,OSC2HS) 224 | handleBParam(osc1SawButton,OSC1Saw) 225 | handleBParam(osc2SawButton,OSC2Saw) 226 | handleBParam(osc1PulButton,OSC1Pul) 227 | handleBParam(osc2PulButton,OSC2Pul) 228 | handleBParam(filterKeyFollowButton,FLT_KF) 229 | handleBParam(pitchQuantButton,OSCQuantize) 230 | handleBParam(unisonButton,UNISON) 231 | handleBParam(filterHQButton,FILTER_WARM) 232 | handleBParam(filterBPBlendButton,BANDPASS) 233 | 234 | handleBParam(lfoSinButton,LFOSINWAVE) 235 | handleBParam(lfoSquareButton,LFOSQUAREWAVE) 236 | handleBParam(lfoSHButton,LFOSHWAVE) 237 | 238 | handleBParam(lfoOsc1Button,LFOOSC1) 239 | handleBParam(lfoOsc2Button,LFOOSC2) 240 | handleBParam(lfoFilterButton,LFOFILTER) 241 | handleBParam(lfoPwm1Button,LFOPW1) 242 | handleBParam(lfoPwm2Button,LFOPW2) 243 | handleBParam(bendOsc2OnlyButton,BENDOSC2) 244 | handleBParam(bendRangeButton,BENDRANGE) 245 | handleBParam(fourPoleButton,FOURPOLE) 246 | handleBParam(asPlayedAllocButton,ASPLAYEDALLOCATION) 247 | handleBParam(midiLearnButton,MIDILEARN) 248 | handleBParam(midiUnlearnButton,UNLEARN) 249 | {}; 250 | 251 | } 252 | void ObxdAudioProcessorEditor::comboBoxChanged (ComboBox* cb) 253 | { 254 | ButtonList* bl = (ButtonList*)(cb); 255 | ObxdAudioProcessor* flt = getFilter(); 256 | #define cp(T) {flt->setParameterNotifyingHost(T,bl->getValue());} 257 | #define handleCParam(K,T) if (bl == K) {cp(T)} else 258 | handleCParam(voiceSwitch,VOICE_COUNT) 259 | handleCParam(legatoSwitch,LEGATOMODE) 260 | {}; 261 | } 262 | void ObxdAudioProcessorEditor::sliderValueChanged (Slider* c) 263 | { 264 | ObxdAudioProcessor* flt = getFilter(); 265 | #define sp(T) {flt->setParameterNotifyingHost(T,c->getValue());} 266 | #define handleSParam(K,T) if (c == K) {sp(T)} else 267 | handleSParam(cutoffKnob,CUTOFF) 268 | handleSParam(resonanceKnob,RESONANCE) 269 | handleSParam(volumeKnob,VOLUME) 270 | handleSParam(osc1PitchKnob,OSC1P) 271 | handleSParam(osc2PitchKnob,OSC2P) 272 | handleSParam(osc2DetuneKnob,OSC2_DET) 273 | handleSParam(portamentoKnob,PORTAMENTO) 274 | handleSParam(filterEnvelopeAmtKnob,ENVELOPE_AMT) 275 | handleSParam(pulseWidthKnob,PW) 276 | handleSParam(xmodKnob,XMOD) 277 | handleSParam(multimodeKnob,MULTIMODE) 278 | 279 | handleSParam(attackKnob,LATK) 280 | handleSParam(decayKnob,LDEC) 281 | handleSParam(sustainKnob,LSUS) 282 | handleSParam(releaseKnob,LREL) 283 | 284 | handleSParam(fattackKnob,FATK) 285 | handleSParam(fdecayKnob,FDEC) 286 | handleSParam(fsustainKnob,FSUS) 287 | handleSParam(freleaseKnob,FREL) 288 | 289 | handleSParam(osc1MixKnob,OSC1MIX) 290 | handleSParam(osc2MixKnob,OSC2MIX) 291 | handleSParam(noiseMixKnob,NOISEMIX) 292 | handleSParam(voiceDetuneKnob,UDET) 293 | 294 | handleSParam(filterDetuneKnob,FILTERDER) 295 | handleSParam(envelopeDetuneKnob,ENVDER) 296 | handleSParam(portamentoDetuneKnob,PORTADER) 297 | 298 | handleSParam(lfoFrequencyKnob,LFOFREQ) 299 | handleSParam(lfoAmt1Knob,LFO1AMT) 300 | handleSParam(lfoAmt2Knob,LFO2AMT) 301 | 302 | handleSParam(pan1Knob,PAN1) 303 | handleSParam(pan2Knob,PAN2) 304 | handleSParam(pan3Knob,PAN3) 305 | handleSParam(pan4Knob,PAN4) 306 | handleSParam(pan5Knob,PAN5) 307 | handleSParam(pan6Knob,PAN6) 308 | handleSParam(pan7Knob,PAN7) 309 | handleSParam(pan8Knob,PAN8) 310 | 311 | handleSParam(tuneKnob,TUNE) 312 | handleSParam(brightnessKnob,BRIGHTNESS) 313 | handleSParam(envPitchModKnob,ENVPITCH) 314 | 315 | handleSParam(bendLfoRateKnob,BENDLFORATE) 316 | handleSParam(veloAmpEnvKnob,VAMPENV) 317 | handleSParam(veloFltEnvKnob,VFLTENV) 318 | handleSParam(transposeKnob,OCTAVE) 319 | //magic crystal 320 | {}; 321 | 322 | 323 | 324 | //else if(c == cutoffKnob) 325 | //{sp(CUTOFF);} 326 | //else if(c == resonanceKnob) 327 | //{sp(RESONANCE);} 328 | //else if(c == portamentoKnob) 329 | //{sp(PORTAMENTO);} 330 | //else if(c == volumeKnob) 331 | //{sp(VOLUME);} 332 | //else if(c == osc1PitchKnob) 333 | //{sp(OSC1P);} 334 | //else if (c == osc2PitchKnob) 335 | //{sp(OSC2P);} 336 | } 337 | //============================================================================== 338 | void ObxdAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster* source) 339 | { 340 | ObxdAudioProcessor* filter = getFilter(); 341 | float pr[PARAM_COUNT]; 342 | filter->getCallbackLock().enter(); 343 | for(int i = 0 ; i < PARAM_COUNT;++i) 344 | pr[i] = filter->programs.currentProgramPtr->values[i]; 345 | filter->getCallbackLock().exit(); 346 | #define rn(T,P) (T->setValue(pr[P],dontSendNotification)); 347 | rn(cutoffKnob,CUTOFF) 348 | rn(resonanceKnob,RESONANCE) 349 | rn(volumeKnob,VOLUME) 350 | rn(osc1PitchKnob,OSC1P) 351 | rn(osc2PitchKnob,OSC2P) 352 | rn(osc2DetuneKnob,OSC2_DET) 353 | rn(portamentoKnob,PORTAMENTO) 354 | rn(filterEnvelopeAmtKnob,ENVELOPE_AMT) 355 | rn(pulseWidthKnob,PW) 356 | rn(xmodKnob,XMOD) 357 | rn(multimodeKnob,MULTIMODE) 358 | rn(brightnessKnob,BRIGHTNESS) 359 | rn(envPitchModKnob,ENVPITCH) 360 | 361 | rn(attackKnob,LATK) 362 | rn(decayKnob,LDEC) 363 | rn(sustainKnob,LSUS) 364 | rn(releaseKnob,LREL) 365 | 366 | rn(fattackKnob,FATK) 367 | rn(fdecayKnob,FDEC) 368 | rn(fsustainKnob,FSUS) 369 | rn(freleaseKnob,FREL) 370 | 371 | rn(osc1MixKnob,OSC1MIX) 372 | rn(osc2MixKnob,OSC2MIX) 373 | rn(noiseMixKnob,NOISEMIX) 374 | rn(voiceDetuneKnob,UDET) 375 | 376 | rn(lfoFrequencyKnob,LFOFREQ) 377 | rn(lfoAmt1Knob,LFO1AMT) 378 | rn(lfoAmt2Knob,LFO2AMT) 379 | rn(tuneKnob,TUNE) 380 | rn(bendLfoRateKnob,BENDLFORATE) 381 | rn(veloAmpEnvKnob,VAMPENV) 382 | rn(veloFltEnvKnob,VFLTENV) 383 | //buttons 384 | rn(hardSyncButton,OSC2HS) 385 | rn(osc1SawButton,OSC1Saw) 386 | rn(osc2SawButton,OSC2Saw) 387 | rn(osc1PulButton,OSC1Pul) 388 | rn(osc2PulButton,OSC2Pul) 389 | 390 | rn(filterKeyFollowButton,FLT_KF) 391 | rn(pitchQuantButton,OSCQuantize) 392 | rn(unisonButton,UNISON) 393 | 394 | rn(filterDetuneKnob,FILTERDER) 395 | rn(envelopeDetuneKnob,ENVDER) 396 | rn(portamentoDetuneKnob,PORTADER) 397 | 398 | rn(filterHQButton,FILTER_WARM) 399 | rn(filterBPBlendButton,BANDPASS) 400 | rn(lfoSinButton,LFOSINWAVE) 401 | rn(lfoSquareButton,LFOSQUAREWAVE) 402 | rn(lfoSHButton,LFOSHWAVE) 403 | 404 | rn(bendOsc2OnlyButton,BENDOSC2) 405 | rn(bendRangeButton,BENDRANGE) 406 | 407 | rn(lfoOsc1Button,LFOOSC1) 408 | rn(lfoOsc2Button,LFOOSC2) 409 | rn(lfoFilterButton,LFOFILTER) 410 | rn(lfoPwm1Button,LFOPW1) 411 | rn(lfoPwm2Button,LFOPW2) 412 | rn(fourPoleButton,FOURPOLE) 413 | 414 | rn(transposeKnob,OCTAVE) 415 | 416 | rn(pan1Knob,PAN1) 417 | rn(pan2Knob,PAN2) 418 | rn(pan3Knob,PAN3) 419 | rn(pan4Knob,PAN4) 420 | rn(pan5Knob,PAN5) 421 | rn(pan6Knob,PAN6) 422 | rn(pan7Knob,PAN7) 423 | rn(pan8Knob,PAN8) 424 | 425 | rn(voiceSwitch,VOICE_COUNT) 426 | rn(legatoSwitch,LEGATOMODE) 427 | rn(asPlayedAllocButton,ASPLAYEDALLOCATION) 428 | rn(midiLearnButton,MIDILEARN) 429 | rn(midiUnlearnButton,UNLEARN) 430 | 431 | } 432 | void ObxdAudioProcessorEditor::paint (Graphics& g) 433 | { 434 | g.fillAll (Colours::white); 435 | 436 | const Image image = ImageCache::getFromMemory(res::background_png,res::background_pngSize); 437 | g.drawImage (image, 438 | 0, 0, image.getWidth(), image.getHeight(), 439 | 0, 0, image.getWidth(), image.getHeight()); 440 | } -------------------------------------------------------------------------------- /Source/PluginEditor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | ============================================================================== 4 | 5 | This file was auto-generated by the Introjucer! 6 | 7 | It contains the basic startup code for a Juce application. 8 | 9 | ============================================================================== 10 | */ 11 | 12 | #ifndef PLUGINEDITOR_H_INCLUDED 13 | #define PLUGINEDITOR_H_INCLUDED 14 | 15 | #include "JuceHeader.h" 16 | #include "PluginProcessor.h" 17 | #include "Gui/Knob.h" 18 | #include "Gui/TooglableButton.h" 19 | #include "Gui/ButtonList.h" 20 | 21 | 22 | //============================================================================== 23 | /** 24 | */ 25 | class ObxdAudioProcessorEditor : 26 | public AudioProcessorEditor, 27 | public ChangeListener, 28 | public Slider::Listener, 29 | public Button::Listener, 30 | public ComboBox::Listener//, 31 | // public AudioProcessorListener 32 | 33 | { 34 | public: 35 | ObxdAudioProcessorEditor (ObxdAudioProcessor* ownerFilter); 36 | ~ObxdAudioProcessorEditor(); 37 | 38 | //============================================================================== 39 | /** Our demo filter is a ChangeBroadcaster, and will call us back when one of 40 | its parameters changes. 41 | */ 42 | void changeListenerCallback (ChangeBroadcaster* source); 43 | //int changeListenerCallback (void*){return 0;}; 44 | 45 | 46 | 47 | 48 | Knob* addNormalKnob(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval); 49 | Knob* addTinyKnob(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval); 50 | void placeLabel(int x , int y,String text); 51 | TooglableButton* addNormalTooglableButton(int x , int y , ObxdAudioProcessor* filter,int parameter,String name); 52 | TooglableButton* addTinyTooglableButton(int x , int y , ObxdAudioProcessor* filter,int parameter,String name); 53 | 54 | ButtonList* addNormalButtonList(int x , int y ,int width, ObxdAudioProcessor* filter,int parameter,String name,Image img); 55 | void sliderValueChanged (Slider*); 56 | void buttonClicked (Button *); 57 | void comboBoxChanged(ComboBox*); 58 | 59 | //============================================================================== 60 | /** Standard Juce paint callback. */ 61 | void paint (Graphics& g); 62 | 63 | /** Standard Juce resize callback. */ 64 | //void resized(); 65 | Knob* cutoffKnob,*resonanceKnob,*osc1PitchKnob,*osc2PitchKnob,*osc2DetuneKnob,*volumeKnob, 66 | *portamentoKnob,*voiceDetuneKnob,*filterEnvelopeAmtKnob,*pulseWidthKnob,*xmodKnob,*multimodeKnob,*attackKnob,*decayKnob,*sustainKnob,*releaseKnob, 67 | *fattackKnob,*fdecayKnob,*fsustainKnob,*freleaseKnob,*osc1MixKnob,*osc2MixKnob,*noiseMixKnob, 68 | *filterDetuneKnob,*envelopeDetuneKnob,*portamentoDetuneKnob, 69 | *tuneKnob, 70 | *lfoFrequencyKnob,*lfoAmt1Knob,*lfoAmt2Knob, 71 | *pan1Knob,*pan2Knob,*pan3Knob,*pan4Knob,*pan5Knob,*pan6Knob,*pan7Knob,*pan8Knob, 72 | *brightnessKnob,*envPitchModKnob, 73 | *bendLfoRateKnob 74 | ,*veloAmpEnvKnob,*veloFltEnvKnob,*transposeKnob; 75 | 76 | TooglableButton* hardSyncButton,*osc1SawButton,*osc2SawButton,*osc1PulButton,*osc2PulButton,*filterKeyFollowButton,*unisonButton,*pitchQuantButton, 77 | *filterHQButton,*filterBPBlendButton, 78 | *lfoSinButton,*lfoSquareButton,*lfoSHButton,*lfoOsc1Button,*lfoOsc2Button,*lfoFilterButton, 79 | *lfoPwm1Button,*lfoPwm2Button, 80 | *bendRangeButton,*bendOsc2OnlyButton, 81 | *fourPoleButton,*asPlayedAllocButton,*midiLearnButton,*midiUnlearnButton; 82 | 83 | ButtonList *voiceSwitch,*legatoSwitch; 84 | //============================================================================== 85 | // This is just a standard Juce paint method... 86 | // void paint (Graphics& g); 87 | ObxdAudioProcessor* getFilter() noexcept { return (ObxdAudioProcessor*)getAudioProcessor();} 88 | }; 89 | 90 | 91 | #endif // PLUGINEDITOR_H_INCLUDED 92 | -------------------------------------------------------------------------------- /Source/PluginProcessor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file was auto-generated! 5 | 6 | It contains the basic startup code for a Juce application. 7 | 8 | ============================================================================== 9 | */ 10 | #include "PluginProcessor.h" 11 | #include "PluginEditor.h" 12 | #include "Engine/Params.h" 13 | //only sse2 version on windows 14 | #ifdef _WINDOWS 15 | #define __SSE2__ 16 | #define __SSE__ 17 | #endif 18 | 19 | #ifdef __SSE2__ 20 | #include 21 | #endif 22 | 23 | //============================================================================== 24 | #define S(T) (juce::String(T)) 25 | ObxdAudioProcessor::ObxdAudioProcessor() : bindings(),programs() 26 | { 27 | isHostAutomatedChange = true; 28 | midiControlledParamSet = false; 29 | lastMovedController = 0; 30 | lastUsedParameter = 0; 31 | //synth = new SynthEngine(); 32 | synth.setSampleRate(44100); 33 | initAllParams(); 34 | } 35 | 36 | ObxdAudioProcessor::~ObxdAudioProcessor() 37 | { 38 | //delete synth; 39 | } 40 | //============================================================================== 41 | void ObxdAudioProcessor::initAllParams() 42 | { 43 | for(int i = 0 ; i < PARAM_COUNT;i++) 44 | setParameter(i,programs.currentProgramPtr->values[i]); 45 | } 46 | //============================================================================== 47 | const String ObxdAudioProcessor::getName() const 48 | { 49 | return JucePlugin_Name; 50 | } 51 | 52 | int ObxdAudioProcessor::getNumParameters() 53 | { 54 | return PARAM_COUNT; 55 | } 56 | 57 | float ObxdAudioProcessor::getParameter (int index) 58 | { 59 | return programs.currentProgramPtr->values[index]; 60 | } 61 | 62 | void ObxdAudioProcessor::setParameter (int index, float newValue) 63 | { 64 | if(!midiControlledParamSet || index==MIDILEARN || index==UNLEARN) 65 | lastUsedParameter = index; 66 | programs.currentProgramPtr->values[index] = newValue; 67 | switch(index) 68 | { 69 | case SELF_OSC_PUSH: 70 | synth.processSelfOscPush(newValue); 71 | break; 72 | case PW_ENV_BOTH: 73 | synth.processPwEnvBoth(newValue); 74 | break; 75 | case PW_OSC2_OFS: 76 | synth.processPwOfs(newValue); 77 | break; 78 | case ENV_PITCH_BOTH: 79 | synth.processPitchModBoth(newValue); 80 | break; 81 | case FENV_INVERT: 82 | synth.processInvertFenv(newValue); 83 | break; 84 | case LEVEL_DIF: 85 | synth.processLoudnessDetune(newValue); 86 | break; 87 | case PW_ENV: 88 | synth.processPwEnv(newValue); 89 | break; 90 | case LFO_SYNC: 91 | synth.procLfoSync(newValue); 92 | break; 93 | case ECONOMY_MODE: 94 | synth.procEconomyMode(newValue); 95 | break; 96 | case VAMPENV: 97 | synth.procAmpVelocityAmount(newValue); 98 | break; 99 | case VFLTENV: 100 | synth.procFltVelocityAmount(newValue); 101 | break; 102 | case ASPLAYEDALLOCATION: 103 | synth.procAsPlayedAlloc(newValue); 104 | break; 105 | case BENDLFORATE: 106 | synth.procModWheelFrequency(newValue); 107 | break; 108 | case FOURPOLE: 109 | synth.processFourPole(newValue); 110 | break; 111 | case LEGATOMODE: 112 | synth.processLegatoMode(newValue); 113 | break; 114 | case ENVPITCH: 115 | synth.processEnvelopeToPitch(newValue); 116 | break; 117 | case OSCQuantize: 118 | synth.processPitchQuantization(newValue); 119 | break; 120 | case VOICE_COUNT: 121 | synth.setVoiceCount(newValue); 122 | break; 123 | case BANDPASS: 124 | synth.processBandpassSw(newValue); 125 | break; 126 | case FILTER_WARM: 127 | synth.processOversampling(newValue); 128 | break; 129 | case BENDOSC2: 130 | synth.procPitchWheelOsc2Only(newValue); 131 | break; 132 | case BENDRANGE: 133 | synth.procPitchWheelAmount(newValue); 134 | break; 135 | case NOISEMIX: 136 | synth.processNoiseMix(newValue); 137 | break; 138 | case OCTAVE: 139 | synth.processOctave(newValue); 140 | break; 141 | case TUNE: 142 | synth.processTune(newValue); 143 | break; 144 | case BRIGHTNESS: 145 | synth.processBrightness(newValue); 146 | break; 147 | case MULTIMODE: 148 | synth.processMultimode(newValue); 149 | break; 150 | case LFOFREQ: 151 | synth.processLfoFrequency(newValue); 152 | break; 153 | case LFO1AMT: 154 | synth.processLfoAmt1(newValue); 155 | break; 156 | case LFO2AMT: 157 | synth.processLfoAmt2(newValue); 158 | break; 159 | case LFOSINWAVE: 160 | synth.processLfoSine(newValue); 161 | break; 162 | case LFOSQUAREWAVE: 163 | synth.processLfoSquare(newValue); 164 | break; 165 | case LFOSHWAVE: 166 | synth.processLfoSH(newValue); 167 | break; 168 | case LFOFILTER: 169 | synth.processLfoFilter(newValue); 170 | break; 171 | case LFOOSC1: 172 | synth.processLfoOsc1(newValue); 173 | break; 174 | case LFOOSC2: 175 | synth.processLfoOsc2(newValue); 176 | break; 177 | case LFOPW1: 178 | synth.processLfoPw1(newValue); 179 | break; 180 | case LFOPW2: 181 | synth.processLfoPw2(newValue); 182 | break; 183 | case PORTADER: 184 | synth.processPortamentoDetune(newValue); 185 | break; 186 | case FILTERDER: 187 | synth.processFilterDetune(newValue); 188 | break; 189 | case ENVDER: 190 | synth.processEnvelopeDetune(newValue); 191 | break; 192 | case XMOD: 193 | synth.processOsc2Xmod(newValue); 194 | break; 195 | case OSC2HS: 196 | synth.processOsc2HardSync(newValue); 197 | break; 198 | case OSC2P: 199 | synth.processOsc2Pitch(newValue); 200 | break; 201 | case OSC1P: 202 | synth.processOsc1Pitch(newValue); 203 | break; 204 | case PORTAMENTO: 205 | synth.processPortamento(newValue); 206 | break; 207 | case UNISON: 208 | synth.processUnison(newValue); 209 | break; 210 | case FLT_KF: 211 | synth.processFilterKeyFollow(newValue); 212 | break; 213 | case OSC1MIX: 214 | synth.processOsc1Mix(newValue); 215 | break; 216 | case OSC2MIX: 217 | synth.processOsc2Mix(newValue); 218 | break; 219 | case PW: 220 | synth.processPulseWidth(newValue); 221 | break; 222 | case OSC1Saw: 223 | synth.processOsc1Saw(newValue); 224 | break; 225 | case OSC2Saw: 226 | synth.processOsc2Saw(newValue); 227 | break; 228 | case OSC1Pul: 229 | synth.processOsc1Pulse(newValue); 230 | break; 231 | case OSC2Pul: 232 | synth.processOsc2Pulse(newValue); 233 | break; 234 | case VOLUME: 235 | synth.processVolume(newValue); 236 | break; 237 | case UDET: 238 | synth.processDetune(newValue); 239 | break; 240 | case OSC2_DET: 241 | synth.processOsc2Det(newValue); 242 | break; 243 | case CUTOFF: 244 | synth.processCutoff(newValue); 245 | break; 246 | case RESONANCE: 247 | synth.processResonance(newValue); 248 | break; 249 | case ENVELOPE_AMT: 250 | synth.processFilterEnvelopeAmt(newValue); 251 | break; 252 | case LATK: 253 | synth.processLoudnessEnvelopeAttack(newValue); 254 | break; 255 | case LDEC: 256 | synth.processLoudnessEnvelopeDecay(newValue); 257 | break; 258 | case LSUS: 259 | synth.processLoudnessEnvelopeSustain(newValue); 260 | break; 261 | case LREL: 262 | synth.processLoudnessEnvelopeRelease(newValue); 263 | break; 264 | case FATK: 265 | synth.processFilterEnvelopeAttack(newValue); 266 | break; 267 | case FDEC: 268 | synth.processFilterEnvelopeDecay(newValue); 269 | break; 270 | case FSUS: 271 | synth.processFilterEnvelopeSustain(newValue); 272 | break; 273 | case FREL: 274 | synth.processFilterEnvelopeRelease(newValue); 275 | break; 276 | case PAN1: 277 | synth.processPan(newValue,1); 278 | break; 279 | case PAN2: 280 | synth.processPan(newValue,2); 281 | break; 282 | case PAN3: 283 | synth.processPan(newValue,3); 284 | break; 285 | case PAN4: 286 | synth.processPan(newValue,4); 287 | break; 288 | case PAN5: 289 | synth.processPan(newValue,5); 290 | break; 291 | case PAN6: 292 | synth.processPan(newValue,6); 293 | break; 294 | case PAN7: 295 | synth.processPan(newValue,7); 296 | break; 297 | case PAN8: 298 | synth.processPan(newValue,8); 299 | break; 300 | } 301 | //DIRTY HACK 302 | //This should be checked to avoid stalling on gui update 303 | //It is needed because some hosts do wierd stuff 304 | if(isHostAutomatedChange) 305 | sendChangeMessage(); 306 | } 307 | const String ObxdAudioProcessor::getParameterName (int index) 308 | { 309 | switch(index) 310 | { 311 | case SELF_OSC_PUSH: 312 | return S("SelfOscPush"); 313 | case ENV_PITCH_BOTH: 314 | return S("EnvPitchBoth"); 315 | case FENV_INVERT: 316 | return S("FenvInvert"); 317 | case PW_OSC2_OFS: 318 | return S("PwOfs"); 319 | case LEVEL_DIF: 320 | return S("LevelDif"); 321 | case PW_ENV_BOTH: 322 | return S("PwEnvBoth"); 323 | case PW_ENV: 324 | return S("PwEnv"); 325 | case LFO_SYNC: 326 | return S("LfoSync"); 327 | case ECONOMY_MODE: 328 | return S("EconomyMode"); 329 | case UNLEARN: 330 | return S("MidiUnlearn"); 331 | case MIDILEARN: 332 | return S("MidiLearn"); 333 | case VAMPENV: 334 | return S("VAmpFactor"); 335 | case VFLTENV: 336 | return S("VFltFactor"); 337 | case ASPLAYEDALLOCATION: 338 | return S("AsPlayedAllocation"); 339 | case BENDLFORATE: 340 | return S("VibratoRate"); 341 | case FOURPOLE: 342 | return S("FourPole"); 343 | case LEGATOMODE: 344 | return S("LegatoMode"); 345 | case ENVPITCH: 346 | return S("EnvelopeToPitch"); 347 | case OSCQuantize: 348 | return S("PitchQuant"); 349 | case VOICE_COUNT: 350 | return S("VoiceCount"); 351 | case BANDPASS: 352 | return S("BandpassBlend"); 353 | case FILTER_WARM: 354 | return S("Filter_Warm"); 355 | case BENDRANGE: 356 | return S("BendRange"); 357 | case BENDOSC2: 358 | return S("BendOsc2Only"); 359 | case OCTAVE: 360 | return S("Octave"); 361 | case TUNE: 362 | return S("Tune"); 363 | case BRIGHTNESS: 364 | return S("Brightness"); 365 | case NOISEMIX: 366 | return S("NoiseMix"); 367 | case OSC1MIX: 368 | return S("Osc1Mix"); 369 | case OSC2MIX: 370 | return S("Osc2Mix"); 371 | case MULTIMODE: 372 | return S("Multimode"); 373 | case LFOSHWAVE: 374 | return S("LfoSampleHoldWave"); 375 | case LFOSINWAVE: 376 | return S("LfoSineWave"); 377 | case LFOSQUAREWAVE: 378 | return S("LfoSquareWave"); 379 | case LFO1AMT: 380 | return S("LfoAmount1"); 381 | case LFO2AMT: 382 | return S("LfoAmount2"); 383 | case LFOFILTER: 384 | return S("LfoFilter"); 385 | case LFOOSC1: 386 | return S("LfoOsc1"); 387 | case LFOOSC2: 388 | return S("LfoOsc2"); 389 | case LFOFREQ: 390 | return S("LfoFrequency"); 391 | case LFOPW1: 392 | return S("LfoPw1"); 393 | case LFOPW2: 394 | return S("LfoPw2"); 395 | case PORTADER: 396 | return S("PortamentoDetune"); 397 | case FILTERDER: 398 | return S("FilterDetune"); 399 | case ENVDER: 400 | return S("EnvelopeDetune"); 401 | case PAN1: 402 | return S("Pan1"); 403 | case PAN2: 404 | return S("Pan2"); 405 | case PAN3: 406 | return S("Pan3"); 407 | case PAN4: 408 | return S("Pan4"); 409 | case PAN5: 410 | return S("Pan5"); 411 | case PAN6: 412 | return S("Pan6"); 413 | case PAN7: 414 | return S("Pan7"); 415 | case PAN8: 416 | return S("Pan8"); 417 | case XMOD: 418 | return S("Xmod"); 419 | case OSC2HS: 420 | return S("Osc2HardSync"); 421 | case OSC1P: 422 | return S("Osc1Pitch"); 423 | case OSC2P: 424 | return S("Osc2Pitch"); 425 | case PORTAMENTO: 426 | return S("Portamento"); 427 | case UNISON: 428 | return S("Unison"); 429 | case FLT_KF: 430 | return S("FilterKeyFollow"); 431 | case PW: 432 | return S("PulseWidth"); 433 | case OSC2Saw: 434 | return S("Osc2Saw"); 435 | case OSC1Saw: 436 | return S("Osc1Saw"); 437 | case OSC1Pul: 438 | return S("Osc1Pulse"); 439 | case OSC2Pul: 440 | return S("Osc2Pulse"); 441 | case VOLUME: 442 | return S("Volume"); 443 | case UDET: 444 | return S("VoiceDetune"); 445 | case OSC2_DET: 446 | return S("Oscillator2detune"); 447 | case CUTOFF: 448 | return S("Cutoff"); 449 | case RESONANCE: 450 | return S("Resonance"); 451 | case ENVELOPE_AMT: 452 | return S("FilterEnvAmount"); 453 | case LATK: 454 | return S("Attack"); 455 | case LDEC: 456 | return S("Decay"); 457 | case LSUS: 458 | return S("Sustain"); 459 | case LREL: 460 | return S("Release"); 461 | case FATK: 462 | return S("FilterAttack"); 463 | case FDEC: 464 | return S("FilterDecay"); 465 | case FSUS: 466 | return S("FilterSustain"); 467 | case FREL: 468 | return S("FilterRelease"); 469 | } 470 | return String::empty; 471 | } 472 | 473 | const String ObxdAudioProcessor::getParameterText (int index) 474 | { 475 | return String(programs.currentProgramPtr->values[index],2); 476 | } 477 | 478 | const String ObxdAudioProcessor::getInputChannelName (int channelIndex) const 479 | { 480 | return String (channelIndex + 1); 481 | } 482 | 483 | const String ObxdAudioProcessor::getOutputChannelName (int channelIndex) const 484 | { 485 | return String (channelIndex + 1); 486 | } 487 | 488 | bool ObxdAudioProcessor::isInputChannelStereoPair (int index) const 489 | { 490 | return true; 491 | } 492 | 493 | bool ObxdAudioProcessor::isOutputChannelStereoPair (int index) const 494 | { 495 | return true; 496 | } 497 | 498 | bool ObxdAudioProcessor::acceptsMidi() const 499 | { 500 | #if JucePlugin_WantsMidiInput 501 | return true; 502 | #else 503 | return false; 504 | #endif 505 | } 506 | 507 | bool ObxdAudioProcessor::producesMidi() const 508 | { 509 | #if JucePlugin_ProducesMidiOutput 510 | return true; 511 | #else 512 | return false; 513 | #endif 514 | } 515 | 516 | bool ObxdAudioProcessor::silenceInProducesSilenceOut() const 517 | { 518 | return false; 519 | } 520 | 521 | double ObxdAudioProcessor::getTailLengthSeconds() const 522 | { 523 | return 0.0; 524 | } 525 | int ObxdAudioProcessor::getNumPrograms() 526 | { 527 | return PROGRAMCOUNT; 528 | } 529 | 530 | int ObxdAudioProcessor::getCurrentProgram() 531 | { 532 | return programs.currentProgram; 533 | } 534 | 535 | void ObxdAudioProcessor::setCurrentProgram (int index) 536 | { 537 | programs.currentProgram = index; 538 | programs.currentProgramPtr = programs.programs + programs.currentProgram; 539 | isHostAutomatedChange = false; 540 | for(int i = 0 ; i < PARAM_COUNT;i++) 541 | setParameter(i,programs.currentProgramPtr->values[i]); 542 | isHostAutomatedChange = true; 543 | sendSynchronousChangeMessage(); 544 | } 545 | 546 | const String ObxdAudioProcessor::getProgramName (int index) 547 | { 548 | return programs.programs[index].name; 549 | } 550 | 551 | void ObxdAudioProcessor::changeProgramName (int index, const String& newName) 552 | { 553 | programs.programs[index].name = newName; 554 | } 555 | 556 | //============================================================================== 557 | void ObxdAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) 558 | { 559 | // Use this method as the place to do any pre-playback 560 | // initialisation that you need.. 561 | nextMidi= new MidiMessage(0xF0); 562 | midiMsg = new MidiMessage(0xF0); 563 | synth.setSampleRate(sampleRate); 564 | } 565 | 566 | void ObxdAudioProcessor::releaseResources() 567 | { 568 | 569 | } 570 | inline void ObxdAudioProcessor::processMidiPerSample(MidiBuffer::Iterator* iter,const int samplePos) 571 | { 572 | while (getNextEvent(iter, samplePos)) 573 | { 574 | if(midiMsg->isNoteOn()) 575 | { 576 | synth.procNoteOn(midiMsg->getNoteNumber(),midiMsg->getFloatVelocity()); 577 | } 578 | if (midiMsg->isNoteOff()) 579 | { 580 | synth.procNoteOff(midiMsg->getNoteNumber()); 581 | } 582 | if(midiMsg->isPitchWheel()) 583 | { 584 | // [0..16383] center = 8192; 585 | synth.procPitchWheel((midiMsg->getPitchWheelValue()-8192) / 8192.0); 586 | } 587 | if(midiMsg->isController() && midiMsg->getControllerNumber()==1) 588 | synth.procModWheel(midiMsg->getControllerValue() / 127.0); 589 | if(midiMsg->isController()) 590 | { 591 | lastMovedController = midiMsg->getControllerNumber(); 592 | if(programs.currentProgramPtr->values[MIDILEARN] > 0.5) 593 | bindings.controllers[lastMovedController] = lastUsedParameter; 594 | if(programs.currentProgramPtr->values[UNLEARN] >0.5) 595 | { 596 | midiControlledParamSet = true; 597 | bindings.controllers[lastMovedController] = 0; 598 | setParameter(UNLEARN,0); 599 | lastMovedController = 0; 600 | lastUsedParameter = 0; 601 | midiControlledParamSet = false; 602 | } 603 | 604 | if(bindings.controllers[lastMovedController] > 0) 605 | { 606 | midiControlledParamSet = true; 607 | setParameter(bindings.controllers[lastMovedController],midiMsg->getControllerValue() / 127.0); 608 | setParameter(MIDILEARN,0); 609 | lastMovedController = 0; 610 | lastUsedParameter = 0; 611 | 612 | midiControlledParamSet = false; 613 | } 614 | 615 | } 616 | if(midiMsg->isSustainPedalOn()) 617 | { 618 | synth.sustainOn(); 619 | } 620 | if(midiMsg->isSustainPedalOff() || midiMsg->isAllNotesOff()||midiMsg->isAllSoundOff()) 621 | { 622 | synth.sustainOff(); 623 | } 624 | if(midiMsg->isAllNotesOff()) 625 | { 626 | synth.allNotesOff(); 627 | } 628 | if(midiMsg->isAllSoundOff()) 629 | { 630 | synth.allSoundOff(); 631 | } 632 | 633 | } 634 | } 635 | bool ObxdAudioProcessor::getNextEvent(MidiBuffer::Iterator* iter,const int samplePos) 636 | { 637 | if (hasMidiMessage && midiEventPos <= samplePos) 638 | { 639 | *midiMsg = *nextMidi; 640 | hasMidiMessage = iter->getNextEvent(*nextMidi, midiEventPos); 641 | return true; 642 | } 643 | return false; 644 | } 645 | void ObxdAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) 646 | { 647 | //SSE flags set 648 | #ifdef __SSE__ 649 | _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); 650 | #endif 651 | #ifdef __SSE2__ 652 | _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); 653 | #endif 654 | MidiBuffer::Iterator ppp(midiMessages); 655 | hasMidiMessage = ppp.getNextEvent(*nextMidi,midiEventPos); 656 | int samplePos = 0; 657 | int numSamples = buffer.getNumSamples(); 658 | float* channelData1 = (float*)buffer.getReadPointer(0); 659 | float* channelData2 = (float*)buffer.getReadPointer(1); 660 | AudioPlayHead::CurrentPositionInfo pos; 661 | if (getPlayHead() != 0 && getPlayHead()->getCurrentPosition (pos)) 662 | { 663 | synth.setPlayHead(pos.bpm,pos.ppqPosition); 664 | } 665 | while (samplePos < numSamples) 666 | { 667 | processMidiPerSample(&ppp,samplePos); 668 | 669 | synth.processSample(channelData1+samplePos,channelData2+samplePos); 670 | 671 | samplePos++; 672 | } 673 | } 674 | 675 | //============================================================================== 676 | bool ObxdAudioProcessor::hasEditor() const 677 | { 678 | return true; // (change this to false if you choose to not supply an editor) 679 | } 680 | 681 | AudioProcessorEditor* ObxdAudioProcessor::createEditor() 682 | { 683 | #ifdef JUCE_AUDIOPROCESSOR_NO_GUI 684 | return nullptr; 685 | #else 686 | return new ObxdAudioProcessorEditor (this); 687 | #endif 688 | } 689 | 690 | //============================================================================== 691 | void ObxdAudioProcessor::getStateInformation (MemoryBlock& destData) 692 | { 693 | //XmlElement* const xmlState = getXmlFromBinary(; 694 | // You should use this method to store your parameters in the memory block. 695 | // You could do that either as raw data, or use the XML or ValueTree classes 696 | // as intermediaries to make it easy to save and load complex data. 697 | XmlElement xmlState = XmlElement("Datsounds"); 698 | xmlState.setAttribute(S("currentProgram"),programs.currentProgram); 699 | XmlElement* xprogs= new XmlElement("programs"); 700 | for(int i = 0 ; i < PROGRAMCOUNT;i++) 701 | { 702 | XmlElement* xpr = new XmlElement("program"); 703 | xpr->setAttribute(S("programName"),programs.programs[i].name); 704 | for(int k = 0 ; k < PARAM_COUNT;k++) 705 | { 706 | xpr->setAttribute(String(k), programs.programs[i].values[k]); 707 | } 708 | xprogs->addChildElement(xpr); 709 | } 710 | xmlState.addChildElement(xprogs); 711 | for(int i = 0 ; i < 255;i++) 712 | { 713 | xmlState.setAttribute(String(i),bindings.controllers[i]); 714 | } 715 | copyXmlToBinary(xmlState,destData); 716 | } 717 | 718 | void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes) 719 | { 720 | // You should use this method to restore your parameters from this memory block, 721 | // whose contents will have been created by the getStateInformation() call. 722 | XmlElement* const xmlState = getXmlFromBinary(data,sizeInBytes); 723 | XmlElement* xprogs = xmlState->getFirstChildElement(); 724 | if(xprogs->hasTagName(S("programs"))) 725 | { 726 | int i = 0 ; 727 | forEachXmlChildElement (*xprogs, e) 728 | { 729 | programs.programs[i].setDefaultValues(); 730 | for(int k = 0 ; k < PARAM_COUNT;k++) 731 | { 732 | programs.programs[i].values[k] = e->getDoubleAttribute(String(k),programs.programs[i].values[k]); 733 | } 734 | programs.programs[i].name= e->getStringAttribute(S("programName"),S("Default")); 735 | i++; 736 | } 737 | } 738 | for(int i = 0 ; i < 255;i++) 739 | { 740 | bindings.controllers[i] = xmlState->getIntAttribute(String(i),0); 741 | } 742 | setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"),0)); 743 | delete xmlState; 744 | } 745 | void ObxdAudioProcessor::setCurrentProgramStateInformation(const void* data,int sizeInBytes) 746 | { 747 | #ifdef WASM 748 | programs.currentProgramPtr->setDefaultValues(); 749 | float* patch = (float*)data; 750 | for(int k = 0 ; k < PARAM_COUNT;k++) { 751 | programs.currentProgramPtr->values[k] = patch[k]; 752 | } 753 | setCurrentProgram(programs.currentProgram); 754 | #else 755 | XmlElement* const e = getXmlFromBinary(data,sizeInBytes); 756 | programs.currentProgramPtr->setDefaultValues(); 757 | for(int k = 0 ; k < PARAM_COUNT;k++) 758 | { 759 | programs.currentProgramPtr->values[k] = e->getDoubleAttribute(String(k),programs.currentProgramPtr->values[k]); 760 | } 761 | programs.currentProgramPtr->name = e->getStringAttribute(S("programName"),S("Default")); 762 | setCurrentProgram(programs.currentProgram); 763 | delete e; 764 | #endif 765 | } 766 | void ObxdAudioProcessor::getCurrentProgramStateInformation(MemoryBlock& destData) 767 | { 768 | XmlElement xmlState = XmlElement("Datsounds"); 769 | for(int k = 0 ; k < PARAM_COUNT;k++) 770 | { 771 | xmlState.setAttribute(String(k), programs.currentProgramPtr->values[k]); 772 | } 773 | xmlState.setAttribute(S("programName"),programs.currentProgramPtr->name); 774 | copyXmlToBinary(xmlState,destData); 775 | } 776 | //============================================================================== 777 | // This creates new instances of the plugin.. 778 | AudioProcessor* JUCE_CALLTYPE createPluginFilter() 779 | { 780 | return new ObxdAudioProcessor(); 781 | } 782 | -------------------------------------------------------------------------------- /Source/PluginProcessor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/Source/PluginProcessor.h -------------------------------------------------------------------------------- /WAM/cpp/obxd.cpp: -------------------------------------------------------------------------------- 1 | // Web Audio Modules (WAMs) 2 | // WAM wrapper for obxd 3 | // Jari Kleimola 2017-2018 (jari@webaudiomodules.org) 4 | // 5 | #include "obxd.h" 6 | #include "JuceHeader.h" 7 | 8 | extern juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter(); 9 | 10 | extern "C" { EMSCRIPTEN_KEEPALIVE void* createModule() { return new OBXD(); } } 11 | 12 | const char* OBXD::init(uint32_t bufsize, uint32_t sr, void* desc) 13 | { 14 | // -- create JUCE PluginProcessor descendant 15 | m_proc = createPluginFilter(); 16 | if (!m_proc) return nullptr; 17 | 18 | // -- no input channels, stereo out 19 | m_icount = 0; 20 | m_ocount = 2; 21 | m_bufsize = bufsize; 22 | 23 | // -- JUCE buffers for audio and midi 24 | m_audiobufs = new AudioSampleBuffer(m_icount + m_ocount, bufsize); 25 | m_midibuf = new MidiBuffer(); 26 | m_proc->prepareToPlay(sr, bufsize); 27 | 28 | // -- our descriptor resides at JS side, so we don't return anything here 29 | return nullptr; 30 | } 31 | 32 | void OBXD::terminate() 33 | { 34 | m_proc->releaseResources(); 35 | delete (AudioSampleBuffer*)m_audiobufs; 36 | delete m_midibuf; 37 | } 38 | 39 | // sample accurate rendering is coming soon to WAMs 40 | // 41 | void OBXD::onMidi(byte status, byte data1, byte data2) 42 | { 43 | if ((status & 0xF0) == 0xC0) 44 | m_proc->setCurrentProgram(data1); 45 | else if (status != 0xF0) 46 | { 47 | unsigned char msg[3] = { status, data1, data2 }; 48 | m_midibuf->addEvent(msg, 3, 0); 49 | } 50 | } 51 | 52 | // set preset data 53 | // 54 | void OBXD::onPatch(void* patch, uint32_t size) 55 | { 56 | m_proc->setCurrentProgramStateInformation(patch, size); 57 | } 58 | 59 | // called when user tweaks a GUI control 60 | // 61 | void OBXD::onParam(uint32_t idparam, double value) 62 | { 63 | m_proc->setParameter((int)idparam, (float)value); 64 | } 65 | 66 | // render (stereo 32-bit floats) 67 | // 68 | void OBXD::onProcess(AudioBus* audio, void* data) 69 | { 70 | // -- JUCE 71 | AudioBuffer& buffer = *(AudioSampleBuffer*)m_audiobufs; 72 | buffer.clear(); 73 | m_proc->processBlock(buffer, *m_midibuf); 74 | m_midibuf->clear(); 75 | 76 | // -- copy to Web Audio API AudioBus 77 | const float* obxdL = buffer.getReadPointer(m_icount + 0); 78 | const float* obxdR = buffer.getReadPointer(m_icount + 1); 79 | memcpy(audio->outputs[0], obxdL, m_bufsize * sizeof(float)); 80 | memcpy(audio->outputs[1], obxdR, m_bufsize * sizeof(float)); 81 | } 82 | -------------------------------------------------------------------------------- /WAM/cpp/obxd.h: -------------------------------------------------------------------------------- 1 | // Web Audio Modules (WAMs) 2 | // WAM wrapper for obxd 3 | // Jari Kleimola 2017-2018 (jari@webaudiomodules.org) 4 | // 5 | #ifndef obxd_h 6 | #define obxd_h 7 | 8 | #include "processor.h" 9 | using namespace WAM; 10 | 11 | namespace juce { 12 | class AudioProcessor; 13 | class MidiBuffer; 14 | } 15 | 16 | class OBXD : public WAM::Processor 17 | { 18 | public: 19 | virtual const char* init(uint32_t bufsize, uint32_t sr, void* desc); 20 | virtual void terminate(); 21 | virtual void onProcess(AudioBus* audio, void* data); 22 | virtual void onMidi(byte status, byte data1, byte data2); 23 | virtual void onPatch(void* patch, uint32_t size); 24 | virtual void onParam(uint32_t idparam, double value); 25 | private: 26 | juce::AudioProcessor* m_proc; 27 | juce::MidiBuffer* m_midibuf; 28 | void* m_audiobufs; 29 | uint32_t m_bufsize; 30 | uint32_t m_icount,m_ocount; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /WAM/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | webOBXD 5 | 6 | 7 | 8 | 9 | 10 | 40 | 41 |
42 |
43 |
44 |
45 | 46 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /WAM/web/libs/keys.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Qwerty Hancock keyboard library v0.4.3 3 | * The web keyboard for now people. 4 | * Copyright 2012-14, Stuart Memo 5 | * 6 | * Licensed under the MIT License 7 | * http://opensource.org/licenses/mit-license.php 8 | * 9 | * http://stuartmemo.com/qwerty-hancock 10 | */ 11 | 12 | (function (window, undefined) { 13 | 14 | var self = this; 15 | var notes = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]; 16 | var midimap = { 17 | 90:0, 88:2, 67:4, 86:5, 66:7, 78:9, 77:11, 44:12, 46:14, 45:16, 18 | 83:1, 68:3, 71:6, 72:8, 74:10, 76:13, 246:15, 19 | 81:12, 87:14, 69:16, 82:17, 84:19, 89:21, 85:23, 73:24, 79:26, 80:28, 229:29, 20 | 50:13, 51:15, 53:18, 54:20, 55:22, 57:25, 48:27 21 | }; 22 | function getMidiKey(keyCode) { return midimap[keyCode]; } 23 | 24 | var version = '0.4.3', 25 | settings = {}, 26 | mouse_is_down = false, 27 | keysDown = {}, 28 | key_map = { 29 | 65: 'Cl', 30 | 87: 'C#l', 31 | 83: 'Dl', 32 | 69: 'D#l', 33 | 68: 'El', 34 | 70: 'Fl', 35 | 84: 'F#l', 36 | 71: 'Gl', 37 | 89: 'G#l', 38 | 90: 'G#l', 39 | 72: 'Al', 40 | 85: 'A#l', 41 | 74: 'Bl', 42 | 75: 'Cu', 43 | 79: 'C#u', 44 | 76: 'Du', 45 | 80: 'D#u', 46 | 59: 'Eu', 47 | 186: 'Eu', 48 | 222: 'Fu', 49 | 221: 'F#u', 50 | 220: 'Gu' 51 | }, 52 | keyDownCallback, 53 | keyUpCallback; 54 | 55 | /** 56 | * Calculate width of white key. 57 | * @return {number} Width of a single white key in pixels. 58 | */ 59 | var getWhiteKeyWidth = function (number_of_white_keys) { 60 | // JJK return Math.floor((settings.width - number_of_white_keys) / number_of_white_keys); 61 | return (settings.width - 2) / number_of_white_keys; 62 | }; 63 | 64 | /** 65 | * Merge user settings with defaults. 66 | * @param {object} user_settings 67 | */ 68 | var init = function (us) { 69 | var container; 70 | 71 | user_settings = us || {}; 72 | 73 | settings = { 74 | id: user_settings.id || 'keyboard', 75 | octaves: user_settings.octaves || 3, 76 | width: user_settings.width, 77 | height: user_settings.height, 78 | startNote: user_settings.startNote || 'A3', 79 | whiteKeyColour: user_settings.whiteKeyColour || '#fff', 80 | blackKeyColour: user_settings.blackKeyColour || '#000', 81 | activeColour: user_settings.activeColour || 'yellow', 82 | borderColour: user_settings.borderColour || '#000', 83 | keyboardLayout: user_settings.keyboardLayout || 'en' 84 | }; 85 | 86 | // JJK 87 | // container = document.getElementById(settings.id); 88 | settings.container = user_settings.container; 89 | settings.margin = user_settings.margin; 90 | settings.oct = user_settings.oct; 91 | 92 | if (typeof settings.width === 'undefined') { 93 | settings.width = settings.container.offsetWidth; 94 | } 95 | 96 | if (typeof settings.height === 'undefined') { 97 | settings.height = settings.container.offsetHeight; 98 | } 99 | 100 | settings.startOctave = parseInt(settings.startNote.charAt(1), 10); 101 | 102 | createKeyboard(); 103 | addListeners.call(this, settings.container); 104 | }; 105 | 106 | /** 107 | * Get frequency of a given note. 108 | * @param {string} note Musical note to convert into hertz. 109 | * @return {number} Frequency of note in hertz. 110 | */ 111 | var getFrequencyOfNote = function (note) { 112 | var notes = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'], 113 | key_number, 114 | octave; 115 | 116 | if (note.length === 3) { 117 | octave = note.charAt(2); 118 | } else { 119 | octave = note.charAt(1); 120 | } 121 | 122 | key_number = notes.indexOf(note.slice(0, -1)); 123 | 124 | if (key_number < 3) { 125 | key_number = key_number + 12 + ((octave - 1) * 12) + 1; 126 | } else { 127 | key_number = key_number + ((octave - 1) * 12) + 1; 128 | } 129 | 130 | return 440 * Math.pow(2, (key_number - 49) / 12); 131 | }; 132 | 133 | /** 134 | * Lighten up man. Change the colour of a key. 135 | * @param {element} el DOM element to change colour of. 136 | */ 137 | var lightenUp = function lightenUp (el) { 138 | // JJK 139 | if (el !== null && el.localName == "li") { 140 | el.style.backgroundColor = settings.activeColour; 141 | } 142 | }; 143 | 144 | /** 145 | * Revert key to original colour. 146 | * @param {element} el DOM element to change colour of. 147 | */ 148 | var darkenDown = function darkenDown (el) { 149 | if (el !== null && el.localName == "li") { // JJK 150 | if (el.getAttribute('data-note-type') === 'white') { 151 | el.style.backgroundColor = settings.whiteKeyColour; 152 | } else { 153 | el.style.backgroundColor = settings.blackKeyColour; 154 | } 155 | } 156 | }; 157 | 158 | /** 159 | * Order notes into order defined by starting key in settings. 160 | * @param {array} notes_to_order Notes to be ordered. 161 | * @return {array{ ordered_notes Ordered notes. 162 | */ 163 | var orderNotes = function (notes_to_order) { 164 | var i, 165 | keyOffset = 0, 166 | number_of_notes_to_order = notes_to_order.length, 167 | ordered_notes = []; 168 | 169 | for (i = 0; i < number_of_notes_to_order; i++) { 170 | if (settings.startNote.charAt(0) === notes_to_order[i]) { 171 | keyOffset = i; 172 | break; 173 | } 174 | } 175 | 176 | for (i = 0; i < number_of_notes_to_order; i++) { 177 | if (i + keyOffset > number_of_notes_to_order - 1) { 178 | ordered_notes[i] = notes_to_order[i + keyOffset - number_of_notes_to_order]; 179 | } else { 180 | ordered_notes[i] = notes_to_order[i + keyOffset]; 181 | } 182 | } 183 | 184 | return ordered_notes; 185 | }; 186 | 187 | /** 188 | * Add styling to individual white key. 189 | * @param {element} el White key DOM element. 190 | */ 191 | var styleWhiteKey = function (key) { 192 | key.el.style.backgroundColor = settings.whiteKeyColour; 193 | key.el.style.border = '1px solid ' + settings.borderColour; 194 | key.el.style.borderRight = 0; 195 | key.el.style.height = settings.height + 'px'; 196 | key.el.style.width = key.width + 'px'; 197 | key.el.style.borderRadius = '0 0 3px 3px'; 198 | }; 199 | 200 | /** 201 | * Add styling to individual black key. 202 | * @param {element} el Black key DOM element. 203 | */ 204 | var styleBlackKey = function (key) { 205 | var white_key_width = getWhiteKeyWidth(getTotalWhiteKeys()), 206 | black_key_width = Math.floor(white_key_width / 2); 207 | 208 | key.el.style.backgroundColor = settings.blackKeyColour; 209 | key.el.style.border = '1px solid ' + settings.borderColour; 210 | key.el.style.position = 'absolute'; 211 | // JJK key.el.style.left = Math.floor(((white_key_width + 1) * (key.noteNumber + 1)) - (black_key_width / 2)) + 'px'; 212 | key.el.style.left = (white_key_width * (key.noteNumber + 1)) - (black_key_width / 2) + 'px'; 213 | key.el.style.width = black_key_width + 'px'; 214 | key.el.style.height = (settings.height / 1.5) + 'px'; 215 | key.el.style.borderRadius = '0 0 3px 3px'; 216 | }; 217 | 218 | /** 219 | * Add styling to individual key on keyboard. 220 | * @param {object} key Element of key. 221 | */ 222 | var styleKey = function (key) { 223 | key.el.style.display = 'inline-block'; 224 | key.el.style['-webkit-user-select'] = 'none'; 225 | key.el.style.boxSizing = "border-box"; 226 | 227 | if (key.colour === 'white') { 228 | styleWhiteKey(key); 229 | } else { 230 | styleBlackKey(key); 231 | } 232 | }; 233 | 234 | /** 235 | * Reset styles on keyboard container and list element. 236 | * @param {element} keyboard Keyboard container DOM element. 237 | */ 238 | var styleKeyboard = function (keyboard) { 239 | var styleElement = function (el) { 240 | el.style.cursor = 'default'; 241 | el.style.fontSize = '0px'; 242 | el.style.position = 'relative'; 243 | el.style.listStyle = 'none'; 244 | el.style['-webkit-user-select'] = 'none'; 245 | }; 246 | 247 | styleElement(keyboard.container); 248 | styleElement(keyboard.el); 249 | // JJK 250 | keyboard.el.style.margin = 0; 251 | keyboard.el.style.marginLeft = settings.margin + "px"; 252 | keyboard.el.style.padding = 0; 253 | keyboard.el.style.width = settings.width + 'px'; 254 | keyboard.el.style.height = settings.height + 'px'; 255 | keyboard.el.style.border = "1px solid #000"; 256 | keyboard.el.style.boxSizing = "border-box"; 257 | }; 258 | 259 | function name2note(name) 260 | { 261 | var oct = name.slice(-1); 262 | name = name.substring(0, name.length - 1); 263 | var i = notes.indexOf(name); 264 | var note = i + oct * 12; 265 | return note; 266 | } 267 | 268 | /** 269 | * Call user's mouseDown event. 270 | */ 271 | var mouseDown = function (element, callback) { 272 | mouse_is_down = true; 273 | lightenUp(element); 274 | callback(name2note(element.title), element.title); 275 | }; 276 | 277 | /** 278 | * Call user's mouseUp event. 279 | */ 280 | var mouseUp = function (element, callback) { 281 | mouse_is_down = false; 282 | darkenDown(element); 283 | callback(name2note(element.title), element.title); 284 | }; 285 | 286 | /** 287 | * Call user's mouseDown if required. 288 | */ 289 | var mouseOver = function (element, callback) { 290 | if (mouse_is_down) { 291 | lightenUp(element); 292 | callback(name2note(element.title), element.title); 293 | } 294 | }; 295 | 296 | /** 297 | * Call user's mouseUp if required. 298 | */ 299 | var mouseOut = function (element, callback) { 300 | if (mouse_is_down) { 301 | darkenDown(element); 302 | callback(name2note(element.title), element.title); 303 | } 304 | }; 305 | 306 | /** 307 | * Create key DOM element. 308 | * @return {object} Key DOM element. 309 | */ 310 | var createKey = function (key) { 311 | key.el = document.createElement('li'); 312 | key.el.id = key.id; 313 | key.el.title = key.id; 314 | key.el.setAttribute('data-note-type', key.colour); 315 | 316 | styleKey(key); 317 | 318 | return key; 319 | }; 320 | 321 | var getTotalWhiteKeys = function () { 322 | return settings.octaves * 7; 323 | }; 324 | 325 | var createKeys = function () { 326 | var that = this, 327 | i, 328 | key, 329 | keys = [], 330 | note_counter = 0, 331 | octave_counter = settings.startOctave, 332 | total_white_keys = getTotalWhiteKeys(); 333 | 334 | for (i = 0; i < total_white_keys; i++) { 335 | 336 | if (i % this.whiteNotes.length === 0) { 337 | note_counter = 0; 338 | } 339 | 340 | bizarre_note_counter = this.whiteNotes[note_counter]; 341 | 342 | if ((bizarre_note_counter === 'C') && (i !== 0)) { 343 | octave_counter++; 344 | } 345 | 346 | key = createKey({ 347 | colour: 'white', 348 | octave: octave_counter, 349 | width: getWhiteKeyWidth(total_white_keys), 350 | id: this.whiteNotes[note_counter] + octave_counter, 351 | noteNumber: i 352 | }); 353 | 354 | keys.push(key.el); 355 | 356 | if (i !== total_white_keys - 1) { 357 | this.notesWithSharps.forEach(function (note, index) { 358 | if (note === that.whiteNotes[note_counter]) { 359 | key = createKey({ 360 | colour: 'black', 361 | octave: octave_counter, 362 | width: getWhiteKeyWidth(total_white_keys) / 2, 363 | id: that.whiteNotes[note_counter] + '#' + octave_counter, 364 | noteNumber: i 365 | }); 366 | 367 | keys.push(key.el); 368 | } 369 | }); 370 | } 371 | note_counter++; 372 | } 373 | 374 | return keys; 375 | }; 376 | 377 | var addKeysToKeyboard = function (keyboard) { 378 | keyboard.keys.forEach(function (key) { 379 | keyboard.el.appendChild(key); 380 | }); 381 | }; 382 | 383 | var setKeyPressOffset = function (sorted_white_notes) { 384 | settings.keyPressOffset = sorted_white_notes[0] === 'C' ? 0 : 1; 385 | }; 386 | 387 | var createKeyboard = function () { 388 | var keyboard = { 389 | container: settings.container, // JJK document.getElementById(settings.id), 390 | el: document.createElement('ul'), 391 | whiteNotes: orderNotes(['C', 'D', 'E', 'F', 'G', 'A', 'B']), 392 | notesWithSharps: orderNotes(['C', 'D', 'F', 'G', 'A']), 393 | }; 394 | 395 | keyboard.keys = createKeys.call(keyboard); 396 | 397 | setKeyPressOffset(keyboard.whiteNotes); 398 | styleKeyboard(keyboard); 399 | 400 | // Add keys to keyboard, and keyboard to container. 401 | addKeysToKeyboard(keyboard); 402 | 403 | keyboard.container.appendChild(keyboard.el); 404 | 405 | return keyboard; 406 | }; 407 | 408 | var getKeyPressed = function (keyCode) { 409 | return key_map[keyCode] 410 | .replace('l', parseInt(settings.startOctave, 10) + settings.keyPressOffset) 411 | .replace('u', (parseInt(settings.startOctave, 10) + settings.keyPressOffset + 1) 412 | .toString()); 413 | }; 414 | 415 | /** 416 | * Handle a keyboard key being pressed. 417 | * @param {object} key The keyboard event of the currently pressed key. 418 | * @param {callback} callback The user's noteDown function. 419 | */ 420 | var keyboardDown = function (key, callback) 421 | { 422 | if (key.keyIdentifier) { 423 | var unicode = key.keyIdentifier.substring(2); 424 | var i = parseInt(unicode,16); } 425 | else var i = key.keyCode; 426 | if (isNaN(i)) return; 427 | var midinote = getMidiKey(i); 428 | if (midinote == undefined) return; 429 | midinote += settings.oct*12; 430 | 431 | if (midinote in keysDown) return; 432 | keysDown[midinote] = true; 433 | 434 | var keyname = notes[midinote % 12] + ((midinote/12)|0); 435 | callback(midinote, keyname); 436 | lightenUp(document.getElementById(keyname)); 437 | }; 438 | 439 | /** 440 | * Handle a keyboard key being released. 441 | * @param {element} key The DOM element of the key that was released. 442 | * @param {callback} callback The user's noteDown function. 443 | */ 444 | var keyboardUp = function (key, callback) 445 | { 446 | if (key.keyIdentifier) { 447 | var unicode = key.keyIdentifier.substring(2); 448 | var i = parseInt(unicode,16); } 449 | else var i = key.keyCode; 450 | if (isNaN(i)) return; 451 | var midinote = getMidiKey(i); 452 | if (midinote == undefined) return; 453 | midinote += settings.oct*12; 454 | 455 | delete keysDown[midinote]; 456 | 457 | var keyname = notes[midinote % 12] + ((midinote/12)|0); 458 | callback(midinote, keyname); 459 | darkenDown(document.getElementById(keyname)); 460 | }; 461 | 462 | /** 463 | * Add event listeners to keyboard. 464 | * @param {element} keyboard_element 465 | */ 466 | var addListeners = function (keyboard_element) { 467 | var that = this; 468 | 469 | // Key is pressed down on keyboard. 470 | window.addEventListener('keydown', function (key) { 471 | keyboardDown(key, that.keyDown); 472 | }); 473 | 474 | // Key is released on keyboard. 475 | window.addEventListener('keyup', function (key) { 476 | keyboardUp(key, that.keyUp); 477 | }); 478 | 479 | // Mouse is clicked down on keyboard element. 480 | keyboard_element.addEventListener('mousedown', function (event) { 481 | mouseDown(event.target, that.keyDown); 482 | }); 483 | 484 | // Mouse is released from keyboard element. 485 | keyboard_element.addEventListener('mouseup', function (event) { 486 | mouseUp(event.target, that.keyUp); 487 | }); 488 | 489 | // Mouse is moved over keyboard element. 490 | keyboard_element.addEventListener('mouseover', function (event) { 491 | mouseOver(event.target, that.keyDown); 492 | }); 493 | 494 | // Mouse is moved out of keyvoard element. 495 | keyboard_element.addEventListener('mouseout', function (event) { 496 | mouseOut(event.target, that.keyUp); 497 | }); 498 | 499 | // Device supports touch events. 500 | if ('ontouchstart' in document.documentElement) { 501 | keyboard_element.addEventListener('touchstart', function (event) { 502 | mouseDown(event.target, that.keyDown); 503 | }); 504 | 505 | keyboard_element.addEventListener('touchend', function (event) { 506 | mouseUp(event.target, that.keyUp); 507 | }); 508 | 509 | keyboard_element.addEventListener('touchleave', function (event) { 510 | mouseOut(event.target, that.keyUp); 511 | }); 512 | 513 | keyboard_element.addEventListener('touchcancel', function (event) { 514 | mouseOut(event.target, that.keyUp); 515 | }); 516 | } 517 | }; 518 | 519 | /** 520 | * Qwerty Hancock constructor. 521 | * @param {object} settings Optional user settings. 522 | */ 523 | var QwertyHancock = function (settings) { 524 | this.version = version; 525 | 526 | this.keyDown = function () { 527 | // Placeholder function. 528 | }; 529 | 530 | this.keyUp = function () { 531 | // Placeholder function. 532 | }; 533 | 534 | init.call(this, settings); 535 | }; 536 | 537 | window.QwertyHancock = QwertyHancock; 538 | })(window); 539 | -------------------------------------------------------------------------------- /WAM/web/libs/wam-controller.js: -------------------------------------------------------------------------------- 1 | // WAM AudioWorkletController 2 | // Jari Kleimola 2017-18 (jari@webaudiomodules.org) 3 | // work in progress 4 | 5 | class WAMController extends AudioWorkletNode 6 | { 7 | constructor(context, processorName, options) { 8 | super(context, processorName, options); 9 | } 10 | 11 | setParam(key,value) { 12 | this.port.postMessage({ type:"param", key:key, value:value }); 13 | } 14 | 15 | setPatch(patch) { 16 | this.port.postMessage({ type:"patch", data:patch }); 17 | } 18 | 19 | setSysex(sysex) { 20 | this.port.postMessage({ type:"sysex", data:sysex }); 21 | } 22 | 23 | onMidi(msg) { 24 | this.port.postMessage({ type:"midi", data:msg }); 25 | } 26 | 27 | set midiIn (port) { 28 | if (this._midiInPort) { 29 | this._midiInPort.close(); 30 | this._midiInPort.onmidimessage = null; 31 | } 32 | this._midiInPort = port; 33 | this._midiInPort.onmidimessage = function (msg) { 34 | this.port.postMessage({ type:"midi", data:msg.data }); 35 | }.bind(this); 36 | } 37 | 38 | sendMessage(verb, prop, data) { 39 | this.port.postMessage({ type:"msg", verb:verb, prop:prop, data:data }); 40 | } 41 | 42 | get gui () { return null; } 43 | } 44 | -------------------------------------------------------------------------------- /WAM/web/libs/wam-knob.js: -------------------------------------------------------------------------------- 1 | // WAM Knob control 2 | // Jari Kleimola 2018 (jari@webaudiomodules.org) 3 | 4 | var WAM = WAM || {} 5 | if (!WAM.Knob) { 6 | 7 | WAM.Knob = class WamKnob extends HTMLElement 8 | { 9 | constructor() { 10 | super(); 11 | this._ = { value:0, states:1, height:0 }; 12 | } 13 | 14 | connectedCallback() { 15 | var temp = document.querySelector("#wam-knob-template"); 16 | if (!temp) { 17 | temp = document.createElement("template"); 18 | temp.id = "wam-knob-template"; 19 | temp.innerHTML = ` 20 |
21 | 22 |
` 23 | } 24 | var node = temp.content.cloneNode(true); 25 | var div = node.querySelector("div"); 26 | var img = node.querySelector("img"); 27 | img.onload = function (e) { 28 | this._.height = img.clientHeight / this.getAttribute("states"); 29 | div.style.height = this._.height + "px"; 30 | if (this.hasAttribute("pos")) { 31 | var pos = this.getAttribute("pos").split(","); 32 | if (pos.length == 2) { 33 | this.style.position = "absolute"; 34 | this.style.left = pos[0] + "px"; 35 | this.style.top = pos[1] + "px"; 36 | } 37 | } 38 | if (this.hasAttribute("value")) 39 | this._.value = parseFloat(this.getAttribute("value")); 40 | this.updateKnob(); 41 | }.bind(this); 42 | if (this.hasAttribute("strip")) 43 | img.src = this.getAttribute("strip"); 44 | this._.mouseHandler = this.onmouse.bind(this); 45 | div.onmousedown = this._.mouseHandler; 46 | this.appendChild(node); 47 | } 48 | 49 | static get observedAttributes() { 50 | return ["strip","states","value"]; 51 | } 52 | 53 | attributeChangedCallback(name, oldValue, newValue) { 54 | switch (name) { 55 | case "strip": 56 | var img = this.querySelector("img"); 57 | if (img) img.src = newValue; 58 | break; 59 | case "states": 60 | this._.states = newValue|0; 61 | break; 62 | case "value": 63 | this._.value = parseFloat(newValue); 64 | this.updateKnob(); 65 | break; 66 | } 67 | } 68 | 69 | get value () { return this._.value; } 70 | set value (v) { this._.value = v; this.setAttribute("value", v); } 71 | set strip (v) { this.setAttribute("strip", v); } 72 | set states (v) { this.setAttribute("states", v); } 73 | 74 | onmouse (e) { 75 | if (e.type == "mousedown") { 76 | this._.prevy = e.clientY; 77 | window.addEventListener("mousemove", this._.mouseHandler, false); 78 | window.addEventListener("mouseup", this._.mouseHandler, false); 79 | e.preventDefault(); 80 | } 81 | else if (e.type == "mousemove") { 82 | var dy = this._.prevy - e.clientY; 83 | if (dy != 0) { 84 | var v = parseFloat((this._.value + dy/100).toFixed(2)); 85 | if (v < 0) v = 0; else if (v > 1) v = 1; 86 | if (v != this._.value) { 87 | this.value = v; 88 | this.fire(); 89 | } 90 | this._.prevy = e.clientY; 91 | } 92 | } 93 | else { 94 | window.removeEventListener("mousemove", this._.mouseHandler, false); 95 | window.removeEventListener("mouseup", this._.mouseHandler, false); 96 | this.fire(true); 97 | } 98 | } 99 | 100 | fire (finish) { 101 | var detail = { id:this.id, value:this.value, final:(finish===true) } 102 | var event = new CustomEvent("change", { detail:detail }); 103 | this.dispatchEvent(event); 104 | } 105 | 106 | updateKnob () { 107 | if (this._.states > 1) { // image strip 108 | var img = this.querySelector("img"); 109 | if (img) { 110 | var index = Math.round(this._.value * (this._.states-1)); 111 | img.style.transform = "translateY(-" + (index * this._.height) + "px)"; 112 | } 113 | } 114 | } 115 | } 116 | 117 | window.customElements.define("wam-knob", WAM.Knob); 118 | } -------------------------------------------------------------------------------- /WAM/web/libs/wam-processor.js: -------------------------------------------------------------------------------- 1 | // WAM AudioWorkletProcessor 2 | // Jari Kleimola 2017-18 (jari@webaudiomodules.org) 3 | // 4 | // work in progress 5 | // helper class for WASM data marshalling and C function call binding 6 | // also provides midi, patch data, parameter and arbitrary message support 7 | 8 | if (!AudioWorkletGlobalScope.WAMProcessor) { 9 | 10 | class WAMProcessor extends AudioWorkletProcessor 11 | { 12 | static get parameterDescriptors() { 13 | return []; 14 | } 15 | 16 | constructor(options) { 17 | options = options || {} 18 | if (options.numberOfInputs === undefined) options.numberOfInputs = 0; 19 | if (options.numberOfOutputs === undefined) options.numberOfOutputs = 1; 20 | if (options.inputChannelCount === undefined) options.inputChannelCount = []; 21 | if (options.outputChannelCount === undefined) options.outputChannelCount = [1]; 22 | if (options.inputChannelCount.length != options.numberOfInputs) throw new Error("InvalidArgumentException"); 23 | if (options.outputChannelCount.length != options.numberOfOutputs) throw new Error("InvalidArgumentException"); 24 | 25 | super(options); 26 | this.bufsize = 128; 27 | this.sr = AudioWorkletGlobalScope.sampleRate || sampleRate; 28 | this.audiobufs = [[],[]]; 29 | 30 | var WAM = options.mod; 31 | this.WAM = WAM; 32 | WAM.port = this.port; 33 | 34 | // -- construction C function wrappers 35 | var wam_ctor = WAM.cwrap("createModule", 'number', []); 36 | var wam_init = WAM.cwrap("wam_init", null, ['number','number','number','string']); 37 | 38 | // -- runtime C function wrappers 39 | this.wam_terminate = WAM.cwrap("wam_terminate", null, ['number']); 40 | this.wam_onmidi = WAM.cwrap("wam_onmidi", null, ['number','number','number','number']); 41 | this.wam_onpatch = WAM.cwrap("wam_onpatch", null, ['number','number','number']); 42 | this.wam_onprocess = WAM.cwrap("wam_onprocess", 'number', ['number','number','number']); 43 | this.wam_onparam = WAM.cwrap("wam_onparam", null, ['number','number','number']); 44 | this.wam_onsysex = WAM.cwrap("wam_onsysex", null, ['number','number','number']); 45 | this.wam_onmessageN = WAM.cwrap("wam_onmessageN", null, ['number','string','string','number']); 46 | this.wam_onmessageS = WAM.cwrap("wam_onmessageS", null, ['number','string','string','string']); 47 | 48 | // -- supress warnings for older WAMs 49 | if (WAM["_wam_onmessageA"]) 50 | this.wam_onmessageA = WAM.cwrap("wam_onmessageA", null, ['number','string','string','number','number']); 51 | 52 | this.inst = wam_ctor(); 53 | var desc = wam_init(this.inst, this.bufsize, this.sr, ""); 54 | 55 | // -- audio io configuration 56 | this.numInputs = options.numberOfInputs; 57 | this.numOutputs = options.numberOfOutputs; 58 | this.numInChannels = options.inputChannelCount; 59 | this.numOutChannels = options.outputChannelCount; 60 | 61 | var ibufs = this.numInputs > 0 ? WAM._malloc(this.numInputs) : 0; 62 | var obufs = this.numOutputs > 0 ? WAM._malloc(this.numOutputs) : 0; 63 | this.audiobus = WAM._malloc(2*4); 64 | WAM.setValue(this.audiobus, ibufs, 'i32'); 65 | WAM.setValue(this.audiobus+4, obufs, 'i32'); 66 | 67 | for (var i=0; i 21 | 22 | ` 23 | } 24 | var node = temp.content.cloneNode(true); 25 | var div = node.querySelector("div"); 26 | var img = node.querySelector("img"); 27 | img.onload = function (e) { 28 | this._.height = img.clientHeight / this._.states; 29 | div.style.height = this._.height + "px"; 30 | if (this.hasAttribute("pos")) { 31 | var pos = this.getAttribute("pos").split(","); 32 | if (pos.length == 2) { 33 | this.style.position = "absolute"; 34 | this.style.left = pos[0] + "px"; 35 | this.style.top = pos[1] + "px"; 36 | } 37 | } 38 | if (this.hasAttribute("value")) 39 | this._.value = parseFloat(this.getAttribute("value")); 40 | this.updateToggle(); 41 | }.bind(this); 42 | if (this.hasAttribute("strip")) 43 | img.src = this.getAttribute("strip"); 44 | div.onclick = this.onclick.bind(this); 45 | this.appendChild(node); 46 | } 47 | 48 | static get observedAttributes() { 49 | return ["strip","states","value"]; 50 | } 51 | 52 | attributeChangedCallback(name, oldValue, newValue) { 53 | switch (name) { 54 | case "strip": 55 | var img = this.querySelector("img"); 56 | if (img) img.src = newValue; 57 | break; 58 | case "states": 59 | this._.states = newValue|0; 60 | break; 61 | case "value": 62 | this._.value = parseFloat(newValue); 63 | if (this._.value > 1.1) this._.value = 0; 64 | else if (this._.value > 1) this._.value = 1; 65 | this.updateToggle(); 66 | break; 67 | } 68 | } 69 | 70 | get value () { return this._.value; } 71 | get states () { return this._.states; } 72 | set value (v) { this.setAttribute("value", v); } 73 | set strip (v) { this.setAttribute("strip", v); } 74 | set states (v) { this.setAttribute("states", v); } 75 | 76 | onclick (e) { 77 | var v = this._.value + 1 / (this._.states-1); 78 | this.value = v; 79 | this.fire(true); 80 | if (this.classList.contains("oneshot")) setTimeout( function () { 81 | this.value = 0; 82 | }.bind(this), 200); 83 | } 84 | 85 | fire (finish) { 86 | var detail = { id:this.id, value:this.value, final:(finish===true) } 87 | var event = new CustomEvent("change", { detail:detail }); 88 | this.dispatchEvent(event); 89 | } 90 | 91 | updateToggle () { 92 | var img = this.querySelector("img"); 93 | if (img) { 94 | var index = Math.round(this._.value * (this._.states-1)); 95 | img.style.transform = "translateY(-" + (index * this._.height) + "px)"; 96 | } 97 | } 98 | } 99 | 100 | window.customElements.define("wam-toggle", WAM.Toggle); 101 | } 102 | -------------------------------------------------------------------------------- /WAM/web/obxd.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 103 | 104 | 105 | 106 | 107 | 188 | -------------------------------------------------------------------------------- /WAM/web/obxd.js: -------------------------------------------------------------------------------- 1 | // OBXD WAM Controller 2 | // Jari Kleimola 2017-2018 (jari@webaudiomodules.org) 3 | 4 | var WAM = WAM || {} 5 | 6 | WAM.OBXD = class OBXD extends WAMController 7 | { 8 | constructor (actx, options) { 9 | options = options || {}; 10 | options.numberOfInputs = 0; 11 | options.numberOfOutputs = 1; 12 | options.outputChannelCount = [2]; 13 | // options.ioConfiguration = { outputs:[1] }; 14 | 15 | super(actx, "OBXD", options); 16 | this.patches = []; 17 | this.bank = []; 18 | this.ipatch = 0; 19 | } 20 | 21 | // -- scripts need to be loaded first, and in order 22 | // 23 | static async importScripts (actx) { 24 | await actx.audioWorklet.addModule("worklet/obxd.wasm.js"); 25 | await actx.audioWorklet.addModule("worklet/obxd.emsc.js"); 26 | await actx.audioWorklet.addModule("libs/wam-processor.js"); 27 | await actx.audioWorklet.addModule("worklet/obxd-awp.js"); 28 | } 29 | 30 | // -- gui is implemented as a web component 31 | // -- and currently imported using HTML imports 32 | // -- skin is a relative folder name, containing pngs 33 | // 34 | loadGUI (skin) { 35 | var self = this; 36 | return new Promise((resolve,reject) => { 37 | let link = document.createElement('link'); 38 | link.rel = 'import'; 39 | link.href = "obxd.html"; 40 | link.onload = () => { 41 | self._gui = document.createElement("wam-obxd"); 42 | self._gui.plug = self; 43 | self._gui.skin = skin || "skin"; 44 | resolve(self._gui); 45 | } 46 | document.head.appendChild(link); 47 | }); 48 | } 49 | 50 | // -- url gives the filename to an fxb format bank of presets 51 | // 52 | loadBank (url) { 53 | var self = this; 54 | return new Promise( (resolve,reject) => { 55 | fetch(url).then(resp => { 56 | resp.arrayBuffer().then(data => { 57 | 58 | self.patches = []; 59 | self.bank = []; 60 | self.bank.url = url; 61 | self.bank.name = url.substr(url.lastIndexOf("/") + 1); 62 | var arr = new Uint8Array(data); 63 | 64 | // -- oh dear, cannot use DOMParser since fxb attribute names start with a number 65 | var s = ""; 66 | try { s = String.fromCharCode.apply(null, arr.subarray(168, arr.length-1)); } 67 | catch(e) { s = new TextDecoder("utf-8").decode(arr.subarray(168, arr.length-1)); } 68 | var i1 = s.indexOf(""); 69 | var i2 = s.indexOf(""); 70 | if (i1 > 0 && i2 > 0) 71 | { 72 | s = s.slice(i1+10,i2); 73 | i2 = 0; 74 | i1 = s.indexOf("programName"); 75 | var patchCount = 0; 76 | while (i1 > 0 && patchCount++ < 128) 77 | { 78 | var n1 = s.indexOf('\"',i1); 79 | var n2 = s.indexOf('\"',n1+1); 80 | if (n1 < 0 || n2 < 0) break; 81 | self.patches.push(s.slice(n1+1,n2)); 82 | i2 = s.indexOf("/>", n2); 83 | if (i2 > 0) 84 | { 85 | var s2 = s.slice(n2+2,i2); 86 | var tokens = s2.split(' '); 87 | if (tokens.length == 71) 88 | { 89 | var patch = []; 90 | for (var i=0; i { 137 | let reader = new FileReader(); 138 | reader.addEventListener("loadend", async () => { 139 | let state = JSON.parse(reader.result); 140 | await self.loadBank(state.bank); 141 | self.selectPatch(state.patchIndex); 142 | self.setPatch(state.data); 143 | resolve(); 144 | }); 145 | if (blob.type == "application/json") 146 | reader.readAsText(blob); 147 | else reject(); 148 | }); 149 | } 150 | 151 | // -- gui calls this method when tweaking a knob/toggle 152 | // -- update current patch state, and pass to DSP 153 | // 154 | setParam (key,value) { 155 | this.patch[key] = value; 156 | super.setParam(key,value); 157 | } 158 | } 159 | 160 | WAM.OBXD.title = "webOBXD"; 161 | -------------------------------------------------------------------------------- /WAM/web/presets/factory.fxb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/WAM/web/presets/factory.fxb -------------------------------------------------------------------------------- /WAM/web/skin/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/WAM/web/skin/background.png -------------------------------------------------------------------------------- /WAM/web/skin/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/WAM/web/skin/button.png -------------------------------------------------------------------------------- /WAM/web/skin/knoblsd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/WAM/web/skin/knoblsd.png -------------------------------------------------------------------------------- /WAM/web/skin/knobssd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/WAM/web/skin/knobssd.png -------------------------------------------------------------------------------- /WAM/web/skin/legato.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/WAM/web/skin/legato.png -------------------------------------------------------------------------------- /WAM/web/skin/voices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jariseon/webOBXD/31c7150edf99072782765a9de8c1c53c5d5f7830/WAM/web/skin/voices.png -------------------------------------------------------------------------------- /WAM/web/worklet/obxd-awp.js: -------------------------------------------------------------------------------- 1 | // OBXD WAM Processor 2 | // Jari Kleimola 2017-2018 (jari@webaudiomodules.org) 3 | 4 | class OBXDAWP extends AudioWorkletGlobalScope.WAMProcessor 5 | { 6 | constructor(options) { 7 | options = options || {} 8 | options.mod = AudioWorkletGlobalScope.WAM.OBXD; 9 | super(options); 10 | this.numOutChannels = [2]; 11 | } 12 | } 13 | 14 | registerProcessor("OBXD", OBXDAWP); 15 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------