├── .clang-format ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── main.yml │ └── test.yml ├── .gitignore ├── .gitmodules ├── Authors.md ├── CMakeLists.txt ├── ChangeLog.md ├── HowTo-Contribute.md ├── HowTo-NewObject.md ├── HowTo-NewPackage.md ├── HowTo-UpdateTheAPI.md ├── License.md ├── ReadMe-Public.md ├── ReadMe.md ├── docs ├── mc.min.info~.maxref.xml ├── min.beat.pattern.maxref.xml ├── min.beat.random.maxref.xml ├── min.buffer.index~.maxref.xml ├── min.buffer.loop~.maxref.xml ├── min.convolve.maxref.xml ├── min.dict.join.maxref.xml ├── min.edgelow~.maxref.xml ├── min.edge~.maxref.xml ├── min.environment.maxref.xml ├── min.hello-world.maxref.xml ├── min.jit.clamp.maxref.xml ├── min.jit.stencil.maxref.xml ├── min.list.process.maxref.xml ├── min.markdown.maxref.xml ├── min.meter~.maxref.xml ├── min.multitouch.maxref.xml ├── min.note.make.maxref.xml ├── min.pan~.maxref.xml ├── min.patcher.control.maxref.xml ├── min.phasor~.maxref.xml ├── min.pi.maxref.xml ├── min.prefs.maxref.xml ├── min.progress.maxref.xml ├── min.project.maxref.xml ├── min.remote.maxref.xml ├── min.sift~.maxref.xml ├── min.stress~.maxref.xml ├── min.textslider.maxref.xml ├── min.threadcheck.maxref.xml └── min.xfade~.maxref.xml ├── extras └── Min │ └── C++ Object Development Kit.maxpat ├── help ├── mc.min.info~.maxhelp ├── min.beat.pattern.maxhelp ├── min.beat.random.maxhelp ├── min.buffer.index~.maxhelp ├── min.buffer.loop~.maxhelp ├── min.convolve.maxhelp ├── min.dict.join.maxhelp ├── min.edgelow~.maxhelp ├── min.edge~.maxhelp ├── min.edit-button.png ├── min.environment.maxhelp ├── min.hello-world.maxhelp ├── min.jit.clamp.maxhelp ├── min.jit.stencil.maxhelp ├── min.list.process.maxhelp ├── min.markdown.maxhelp ├── min.meter~.maxhelp ├── min.multitouch.maxhelp ├── min.note.make.maxhelp ├── min.patcher.control.maxhelp ├── min.phasor~.maxhelp ├── min.pi.maxhelp ├── min.prefs.maxhelp ├── min.progress.maxhelp ├── min.remote.maxhelp ├── min.sifthelp.aiff ├── min.sift~.maxhelp ├── min.stress~.maxhelp ├── min.textslider.maxhelp └── min.threadcheck.maxhelp ├── icon.png ├── init └── min-objectmappings.txt ├── javascript └── min-package-list.js ├── misc ├── icon.psd └── launcher-arrows.graffle ├── package-info.json.in ├── script ├── ReadMe-Template.md ├── create_package.rb ├── deploy.rb └── doc.rb └── source └── projects ├── mc.min.info_tilde ├── CMakeLists.txt └── mc.min.info_tilde.cpp ├── min.beat.pattern ├── CMakeLists.txt └── min.beat.pattern.cpp ├── min.beat.random ├── CMakeLists.txt ├── min.beat.random.cpp └── min.beat.random_test.cpp ├── min.buffer.index_tilde ├── CMakeLists.txt └── min.buffer.index_tilde.cpp ├── min.buffer.loop_tilde ├── CMakeLists.txt └── min.buffer.loop_tilde.cpp ├── min.convolve ├── CMakeLists.txt ├── min.convolve.cpp └── min.convolve_test.cpp ├── min.dict.join ├── CMakeLists.txt ├── min.dict.join.cpp └── min.dict.join_test.cpp ├── min.edge_tilde ├── CMakeLists.txt ├── min.edge_tilde.cpp └── min.edge_tilde_test.cpp ├── min.edgelow_tilde ├── CMakeLists.txt ├── min.edgelow_tilde.cpp └── min.edgelow_tilde_test.cpp ├── min.environment ├── CMakeLists.txt ├── min.environment.cpp ├── min.environment.mac.cpp └── min.environment.windows.cpp ├── min.hello-world ├── CMakeLists.txt ├── min.hello-world.cpp └── min.hello-world_test.cpp ├── min.jit.clamp ├── CMakeLists.txt └── min.jit.clamp.cpp ├── min.jit.stencil ├── CMakeLists.txt └── min.jit.stencil.cpp ├── min.list.process ├── CMakeLists.txt ├── min.list.process.cpp └── min.list.process_test.cpp ├── min.markdown ├── CMakeLists.txt ├── hoedown │ ├── .editorconfig │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── Makefile.win │ ├── README.md │ ├── bin │ │ ├── common.h │ │ ├── hoedown.c │ │ └── smartypants.c │ ├── hoedown.def │ ├── html_block_names.gperf │ ├── src │ │ ├── autolink.c │ │ ├── autolink.h │ │ ├── buffer.c │ │ ├── buffer.h │ │ ├── document.c │ │ ├── document.h │ │ ├── escape.c │ │ ├── escape.h │ │ ├── html.c │ │ ├── html.h │ │ ├── html_blocks.c │ │ ├── html_smartypants.c │ │ ├── stack.c │ │ ├── stack.h │ │ ├── version.c │ │ └── version.h │ └── test │ │ ├── MarkdownTest_1.0.3 │ │ └── MarkdownTest.pl │ │ ├── config.json │ │ └── runner.py └── min.markdown.cpp ├── min.meter_tilde ├── CMakeLists.txt └── min.meter_tilde.cpp ├── min.multitouch ├── CMakeLists.txt └── min.multitouch.cpp ├── min.note.make ├── CMakeLists.txt ├── min.note.make.cpp └── min.note.make_test.cpp ├── min.pan_tilde ├── CMakeLists.txt ├── min.pan_tilde.cpp └── min.pan_tilde_test.cpp ├── min.patcher.control ├── CMakeLists.txt └── min.patcher.control.cpp ├── min.phasor_tilde ├── CMakeLists.txt ├── min.phasor_tilde.cpp └── min.phasor_tilde_test.cpp ├── min.pi ├── CMakeLists.txt └── min.pi.cpp ├── min.prefs ├── CMakeLists.txt └── min.prefs.cpp ├── min.progress ├── CMakeLists.txt └── min.progress.cpp ├── min.project ├── CMakeLists.txt └── min.project.cpp ├── min.remote ├── CMakeLists.txt └── min.remote.cpp ├── min.sift_tilde ├── CMakeLists.txt └── min.sift_tilde.cpp ├── min.stress_tilde ├── CMakeLists.txt └── min.stress_tilde.cpp ├── min.textslider ├── CMakeLists.txt └── min.textslider.cpp ├── min.threadcheck ├── CMakeLists.txt └── min.threadcheck.cpp ├── min.xfade_tilde ├── CMakeLists.txt ├── min.xfade_tilde.cpp └── min.xfade_tilde_test.cpp └── shared ├── signal_routing_objects.cpp └── signal_routing_objects.h /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: WebKit 2 | SortIncludes: false 3 | ColumnLimit: 140 4 | UseTab: ForContinuationAndIndentation 5 | TabWidth: 4 6 | 7 | BreakBeforeBraces: Attach 8 | 9 | Cpp11BracedListStyle: true 10 | AllowShortFunctionsOnASingleLine: Empty 11 | AlwaysBreakTemplateDeclarations: true 12 | SpaceAfterTemplateKeyword: false 13 | ConstructorInitializerIndentWidth: 0 14 | 15 | NamespaceIndentation: All 16 | CompactNamespaces: true 17 | FixNamespaceComments: true 18 | 19 | SpacesBeforeTrailingComments: 4 20 | 21 | BreakBeforeBraces: Custom 22 | BraceWrapping: 23 | AfterClass: false 24 | AfterControlStatement: false 25 | AfterEnum: false 26 | AfterFunction: false 27 | AfterNamespace: false 28 | AfterObjCDeclaration: false 29 | AfterStruct: false 30 | AfterUnion: false 31 | AfterExternBlock: false 32 | BeforeCatch: true 33 | BeforeElse: true 34 | IndentBraces: false 35 | SplitEmptyFunction: false 36 | SplitEmptyRecord: false 37 | SplitEmptyNamespace: false 38 | 39 | AlignConsecutiveAssignments: true 40 | AlignConsecutiveDeclarations: true 41 | AlignEscapedNewlines: Right 42 | AlignTrailingComments: true 43 | 44 | IndentCaseLabels: true 45 | MaxEmptyLinesToKeep: 2 46 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Before filing a report** 11 | Make sure you are up to date on the latest version of the repository. 12 | 13 | **Describe the bug** 14 | A clear and concise description of what the bug is. 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Screenshots** 23 | If applicable, add screenshots to help explain your problem. 24 | 25 | **OS:** 26 | [e.g. MacOS 10.15.7, Windows 10, etc] 27 | 28 | **Additional context** 29 | For example, which version of CMake? Max? Anything you think would be helpful to share. 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature-request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - develop 8 | pull_request: 9 | branches: 10 | - main 11 | - develop 12 | workflow_dispatch: 13 | 14 | jobs: 15 | test: 16 | name: Build and test 17 | runs-on: ${{ matrix.os }} 18 | strategy: 19 | matrix: 20 | os: [macos-latest, windows-latest] 21 | 22 | steps: 23 | - uses: actions/checkout@v2 24 | with: 25 | submodules: 'recursive' 26 | fetch-depth: '0' 27 | 28 | - name: Configure macOS 29 | if: matrix.os == 'macos-latest' 30 | run: mkdir build && cd build && cmake -G Xcode .. 31 | 32 | - name: Configure Windows 33 | if: matrix.os == 'windows-latest' 34 | run: mkdir build && cd build && cmake .. 35 | 36 | - name: Build Debug 37 | run: cmake --build build --config 'Debug' 38 | 39 | - name: Test Debug 40 | run: cd build && ctest -C 'Debug' . -V 41 | 42 | - name: Build Release 43 | run: cmake --build build --config 'Release' 44 | 45 | - name: Test Release 46 | run: cd build && ctest -C 'Release' . -V 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __* 2 | sysbuild 3 | *.sdf 4 | *.suo 5 | *.sln 6 | *.opensdf 7 | log.txt 8 | externals 9 | extensions 10 | support 11 | build/ 12 | build-*/ 13 | tests 14 | *.o 15 | *.dylib 16 | tmp 17 | .DS_Store 18 | .vs 19 | package-info.json 20 | 21 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "source/min-api"] 2 | path = source/min-api 3 | url = https://github.com/Cycling74/min-api.git 4 | [submodule "source/min-lib"] 5 | path = source/min-lib 6 | url = https://github.com/Cycling74/min-lib.git 7 | -------------------------------------------------------------------------------- /Authors.md: -------------------------------------------------------------------------------- 1 | # Authors 2 | Names should be added to this file with this pattern: 3 | 4 | For individuals: 5 | `Name ` 6 | 7 | For organizations: 8 | `Organization ` 9 | 10 | 11 | 12 | ``` 13 | Cycling '74 <*@cycling74.com> 14 | David Butler 15 | ``` 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.19) 2 | project(Min-DevKit) 3 | 4 | enable_testing() 5 | 6 | string(REGEX REPLACE "(.*)/" "" THIS_PACKAGE_NAME "${CMAKE_CURRENT_SOURCE_DIR}") 7 | 8 | if (APPLE) 9 | if (${CMAKE_GENERATOR} MATCHES "Xcode") 10 | if (${XCODE_VERSION} VERSION_LESS 10) 11 | message(STATUS "Xcode 10 or higher is required. Please install from the Mac App Store.") 12 | return () 13 | elseif(${XCODE_VERSION} VERSION_GREATER_EQUAL 12) 14 | set(C74_BUILD_FAT YES) 15 | endif () 16 | endif () 17 | 18 | if (NOT CMAKE_OSX_ARCHITECTURES) 19 | if(C74_BUILD_FAT) 20 | set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "macOS architecture" FORCE) 21 | else() 22 | set(CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} CACHE STRING "macOS architecture" FORCE) 23 | endif() 24 | message("CMAKE_OSX_ARCHITECTURES set to ${CMAKE_OSX_ARCHITECTURES}") 25 | endif() 26 | endif() 27 | 28 | 29 | # Misc setup and subroutines 30 | include(${CMAKE_CURRENT_SOURCE_DIR}/source/min-api/script/min-package.cmake) 31 | 32 | 33 | # Add the Lib, if it exists 34 | if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/source/min-lib/CMakeLists.txt") 35 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/source/min-lib) 36 | endif () 37 | 38 | 39 | # Generate a project for every folder in the "source/projects" folder 40 | SUBDIRLIST(PROJECT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/source/projects) 41 | foreach (project_dir ${PROJECT_DIRS}) 42 | if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/source/projects/${project_dir}/CMakeLists.txt") 43 | message("Generating: ${project_dir}") 44 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/source/projects/${project_dir}) 45 | endif () 46 | endforeach () 47 | 48 | # Comment the line below if you want automatic cmake regneration enabled 49 | set(CMAKE_SUPPRESS_REGENERATION true) 50 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Min-DevKit 2 | [![Build Status](https://travis-ci.org/Cycling74/min-devkit.svg?branch=master)](https://travis-ci.org/Cycling74/min-devkit) 3 | [![Build status](https://ci.appveyor.com/api/projects/status/0koqc3l3qyfu0l8b/branch/master?svg=true)](https://ci.appveyor.com/project/c74/min-devkit/branch/master) 4 | 5 | Create packages and code objects for Max using C++ 6 | 7 | 8 | 9 | 10 | ## v0.5 11 | 12 | * Updates to support new versions of IDEs: **Xcode 11** and **Visual Studio 2019** 13 | * Introduced support for UI objects to work with **Multitouch interfaces** on Windows 14 | (see the new `min.multitouch` object for an example) 15 | * Introduced **new patcher API** 16 | (see the new `min.patcher.control` and `min.remote` objects for examples) 17 | * **MC examples**: 18 | * new `min.mc.info~` example object 19 | * name change to `min.mc.phasor~` (which maps to `min.phasor~`) 20 | * Added support for **preset**, **pattr**, and **snapshots**. Simply name an attribute "value" and it's state will be available to those state management systems. 21 | * New cwarn class for posting warnings, similar to cout and cerr. 22 | * 23 | * Fix for intermittent crashes when operating in overdrive with non-threadsafe messages and attributes 24 | * Fix for Max crashing if you throw / call error() in a constructor 25 | * Fixes for setting attributes from the inspector where changes previously did not stick 26 | * Fix for crashing in Jitter objects including the `min.jit.clamp` example on Windows 27 | * Fix to the limiter class in min-lib for bug where the gain would be reduced further than desired 28 | * Improvements to templates and scaffolding for new packages and projects 29 | 30 | 31 | -------------------------------------------------------------------------------- /HowTo-Contribute.md: -------------------------------------------------------------------------------- 1 | ## Contributing to the Min API and DevKit 2 | 3 | The Min API and DevKit (Min) is accepting contributions that improve or refine any of the types, functions, content, or documentation in this library. 4 | 5 | Changes should be submitted as Github Pull Request. 6 | 7 | 8 | ## Housekeeping 9 | Your pull request should: 10 | 11 | * Include a description of what your change intends to do 12 | * The final commit of the pull request must pass all tests on all platforms or it will not be considered. It is desirable, but not necessary, for all the tests to pass at each commit. Please see [ReadMe.md](./ReadMe.md) for instructions to build and run the test suite. 13 | * All commits must have clear and unambiguous commit messages, linked to Github issue tracker number (for example, the commit message includes the text "see #1974" to link it to issue number 1974.) 14 | * Include appropriate tests 15 | * Tests should include reasonable permutations of the target fix/change 16 | * Include baseline changes with your change 17 | * All changed code should strive to have 100% code coverage 18 | 19 | 20 | ## Workflow 21 | 22 | The Min codebase is structured in such a way that it is easy to use but contributing changes to it may leave the realm of the familiar if you don't typically work with Git submodules. 23 | 24 | This documentation will use the command line. It should be possible to perform these tasks with a GUI application as well. 25 | 26 | 27 | ### Getting the latest API 28 | 29 | Refer to the [How To Updated the Min API](HowTo-UpdateTheAPI.md) documentation. 30 | 31 | ### Committing Changes in the Max API 32 | 33 | Commiting changes in the top-level Min-DevKit is straigtforward. If your changes are in the Min-API submodule then a little extra care will need to be taken to avoid getting tripped-up. 34 | 35 | #### General Git Trip-Ups 36 | 37 | If you have local changes to files inside of `source/min-api` then you will be able to build and test them as you expect. One those changes are committed, however, the CMake scripts that automatically set the submodule to the specified commit will kick-in and your submodule will set to an older commit. The instructions above on "Getting the latest API" may be helpful to get you back to where you want to be. 38 | 39 | Also, be aware that your submodule (`source/min-api`) may often be set to a commit and not to the HEAD of a branch such as master. If you don't double check (with `git branch` or `git status`) that you are on a branch it is easy to start making commits to a detached-head. 40 | 41 | If you do make commits to a detached-head, make note of the commits (e.g. use `git log`) and then you can cherry-pick them to the branch where you want them. 42 | 43 | Finally, it is **very important** that you push commits to the **Min-API** (the submodule) prior to pushing them to **Min-DevKit** (the host/container). If you push your commits to Github in the opposite order then you essentially push a dangling reference to a non-existant commit when you push the Min-DevKit. 44 | 45 | -------------------------------------------------------------------------------- /HowTo-NewObject.md: -------------------------------------------------------------------------------- 1 | # How to Add a New Object to This Package 2 | 3 | To create a new **Min** external follow these steps... 4 | 5 | 6 | ## 1. Find an object you'd like to use as a starting-point. 7 | Here are some suggestions: 8 | 9 | * `source/projects/min.beat.random` -- a simple Max object 10 | * `source/projects/min.dcblocker_tilde` -- a simple audio object (msp) 11 | * `source/projects/min.jit.stencil` -- a simple matrix operator object (jitter) 12 | * `source/projects/min.dict.join` -- an object using dictionaries 13 | * `source/projects/min.buffer.index_tilde` -- an object using buffers 14 | 15 | ## 2. Duplicate the folder and Rename files 16 | 17 | The folder will typically contain 3 files: 18 | 19 | * The source file for the object (e.g. `hello-world.cpp`) 20 | * The source file for a unit test (e.g. `hello-world_test.cpp`) 21 | * A project file (e.g. `CMakeLists.txt`) 22 | 23 | If you follow the standard convention of the Min-DevKit you will not typically need to open or modify the `CMakeLists.txt` at all. 24 | 25 | The unit test source file is optional (though strongly recommended!) and if it is missing the object will still build. 26 | 27 | The source file for the object is where you will do the editing work to create your new object. 28 | 29 | The steps to follow are these: 30 | 31 | 1. Duplicate the folder of the object you chose as a starting point. 32 | 2. Rename the folder to the name you desire for your object. 33 | 3. Rename the source file for the object to match the name of the folder. 34 | 4. If creating a unit test for your object, rename the source file for the unit test to match the name of the folder but with "_test" added to the end. 35 | 5. Open the source of the unit test and change the `#include` statement that pulls in the source of the object to be tested to the name of your object. 36 | 37 | 38 | ## 3. Use CMake to regenerate project files 39 | 40 | As described in the [ReadMe](https://github.com/Cycling74/min-devkit), run **CMake** to update your Xcode and or Visual Studio projects. 41 | 42 | Build your project before modifying the source code to make sure everything is sane. 43 | 44 | 45 | ## 4. Edit your code! 46 | 47 | Now you can edit your code to make your external object do amazing things. 48 | 49 | 50 | ## 5. Document 51 | 52 | To be an upstanding citizen of the Max ecosystem your object should have both a **help patcher** added to the `help` folder. A reference page will be generated and added to the `docs` folder automatically when you instantiate your object the first time. 53 | 54 | ## 6. Unit Testing 55 | 56 | Unit testing for Min uses [Catch](https://github.com/philsquared/Catch/blob/master/docs/tutorial.md). 57 | 58 | Once your unit test has been written (or at least started), you can run it the Xcode or Visual Studio debugger. 59 | 60 | Alternatively you can run them on the command line using Cmake, for example: 61 | 62 | * `cd ..` 63 | * `cd tests` 64 | * mac example: `./min.dcblocker_tilde_test -s` 65 | * win example: `min.dcblocker_tilde_test.exe -s` 66 | -------------------------------------------------------------------------------- /HowTo-NewPackage.md: -------------------------------------------------------------------------------- 1 | # How to Create a New Package 2 | 3 | To create a new Max package that includes objects written using the [Min API](https://github.com/Cycling74/min-api) you will run a script that provides the requisite scaffolding by copying components from this package and setting up a link to the Min API using Git. 4 | 5 | 6 | ## 1. Run the package creation script 7 | 8 | On the command line run the script passing the path where you wish your new package to be located as an argument. For example, to run the script from the directory where this documentation is located and create package one level up called "foo": 9 | 10 | * `script/create_package.rb ../foo` 11 | 12 | 13 | ## 2. Test the new package by building it 14 | 15 | * `cd ../foo/build` 16 | * run **CMake** as appropriate for your platform (see the [ReadMe](https://github.com/Cycling74/min-devkit) for details) 17 | * **build** as documented in the [ReadMe](https://github.com/Cycling74/min-devkit) 18 | * run **unit tests** in the [ReadMe](https://github.com/Cycling74/min-devkit) 19 | * try the default `foo.hello-world` object in Max to make sure it works using the help patcher 20 | 21 | 22 | ## 3. Begin creating your own objects 23 | 24 | This process is documented in the [How to Add a New Object to This Package](https://github.com/Cycling74/min-devkit/blob/master/HowTo-NewObject.md) documentation. 25 | -------------------------------------------------------------------------------- /HowTo-UpdateTheAPI.md: -------------------------------------------------------------------------------- 1 | #Getting the latest Min API 2 | 3 | The **Min API** is included not as a normal folder/directory but as a Git submodule in the *source* folder of the package. 4 | 5 | A Git submodule is essentially a pointer to a specific commit in another repository. If there have been commits to the other repository since the pointer was last updated then you may wish to update it. As an example, you may be in the **Min DevKit** and want to pull in updates to the Min API. 6 | 7 | ``` 8 | $ cd 9 | $ cd source/min-api 10 | $ git status 11 | ``` 12 | Here it may tell you that you are on branch `master` but it might also tell you that you are on a specific commit, possibly with a "detached HEAD" (because the head of your tree of changes is based on a specific commit rather than the end of the branch). 13 | 14 | To get the latest from the master branch: 15 | 16 | ``` 17 | $ git checkout master 18 | $ git pull 19 | ``` 20 | 21 | Now you have updated to the latest **Min API** version. However, as soon as you run `cmake` or `git submodule update` it will switch your api version back to the specific commit that is pointed to by the **Min DevKit**. So we need to update that pointer to this new version. 22 | 23 | ``` 24 | $ cd ../.. 25 | $ git status 26 | ``` 27 | 28 | You should now see that there is a change to the Min-API. 29 | 30 | ``` 31 | $ git commit source/min-api -m"updating the min-api to get changes related to..." 32 | ``` 33 | 34 | This same proceedure applies to any repository using the Min API, not just the Min DevKit. Furthermore, the same applies to the Max API inside of the Min API though changes to the Max API are much less common. 35 | 36 | 37 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright 2018, The Min-DevKit Authors. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /ReadMe-Public.md: -------------------------------------------------------------------------------- 1 | # Min-DevKit 2 | ![CI](https://github.com/Cycling74/min-devkit/workflows/CI/badge.svg) 3 | 4 | Create packages and code objects for Max using C++ 5 | 6 | 7 | 8 | 9 | ## Two Options 10 | 11 | 1. Open the Launcher and **use Max** to generate new packages, add new objects to existing packages, and launch Xcode / Visual Studio 12 | 2. Take control of the underlying technology stack yourself: **[use Github](https://github.com/Cycling74/min-devkit)** and the instructions in the ReadMe there to get started. 13 | 14 | The information that follow pertains only to the first of these options. 15 | 16 | 17 | 18 | ## Prerequisites 19 | 20 | You can use the objects provided in this package as-is. 21 | 22 | To code your own objects, or to re-compile existing objects, you will need a compiler: 23 | 24 | * On the Mac this means **Xcode 10 or 11** (you can download from the App Store for free). 25 | * On Windows this means **Visual Studio 2019 Community** (you can download from Microsoft for free). 26 | 27 | 28 | 29 | ## Additional Documentation 30 | 31 | * [Min Documentation Hub](http://cycling74.github.io/min-devkit/) For guides, references, and resources 32 | * [Min Wiki](https://github.com/Cycling74/min-devkit/wiki) For additional topics, advanced configuration, and user submissions 33 | 34 | 35 | 36 | 37 | ## Contributors / Acknowledgements 38 | 39 | * See the [GitHub Contributor Graph](https://github.com/Cycling74/min-api/graphs/contributors) for the API 40 | * See the [GitHub Contributor Graph](https://github.com/Cycling74/min-devkit/graphs/contributors) for the DevKit 41 | 42 | 43 | 44 | ## Support 45 | 46 | For support, please use the developer forums at: 47 | http://cycling74.com/forums/ 48 | -------------------------------------------------------------------------------- /docs/mc.min.info~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Analyze a multi-channel signal 10 | Analyze a multi-channel signal. mc.min.info~ provides information about what is happening in the multi-channel signal with sample accuracy. 11 | 12 | 13 | 14 | 15 | 16 | Timothy Place 17 | analysis 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/min.beat.pattern.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Bang at intervals in a repeating pattern 10 | Bang at intervals in a repeating pattern. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | time 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Use a dictionary to define the pattern of bangs produced 34 | Use a dictionary to define the pattern of bangs produced. 35 | 36 | 37 | 38 | Turn on/off the internal timer 39 | Turn on/off the internal timer. 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Turn on/off the internal timer 51 | Turn on/off the internal timer. 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/min.beat.random.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Bang at random intervals 10 | Bang at random intervals. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | time 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Initial lower-bound of generated random interval 27 | Initial lower-bound of generated random interval. 28 | 29 | 30 | 31 | Initial upper-bound of generated random interval 32 | Initial upper-bound of generated random interval. 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Toggle the state of the timer 44 | Toggle the state of the timer. 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | Upper-bound of generated random interval 56 | Upper-bound of generated random interval. 57 | 58 | 59 | 60 | Activate the timer 61 | Activate the timer. 62 | 63 | 64 | 65 | Lower-bound of generated random interval 66 | Lower-bound of generated random interval. 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/min.buffer.index~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Read from a buffer~ 10 | Read from a buffer~. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | audio 18 | sampling 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Initial buffer~ from which to read 28 | Initial buffer~ from which to read. 29 | 30 | 31 | 32 | Initial channel to read from the buffer~ 33 | Initial channel to read from the buffer~. 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Choose a named buffer~ from which to read 45 | Choose a named buffer~ from which to read. 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | Channel to read from the buffer~ 57 | Channel to read from the buffer~. The channel number uses 1-based counting. 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/min.buffer.loop~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Read from a buffer~ 10 | Read from a buffer~. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | audio 18 | sampling 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Initial buffer~ from which to read 28 | Initial buffer~ from which to read. 29 | 30 | 31 | 32 | Initial channel to read from the buffer~ 33 | Initial channel to read from the buffer~. 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Toggle the recording attribute 45 | Toggle the recording attribute. 46 | 47 | 48 | 49 | Choose a named buffer~ from which to read 50 | Choose a named buffer~ from which to read. 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Record into the loop 62 | Record into the loop 63 | 64 | 65 | 66 | Length of the buffer~ in samples 67 | Length of the buffer~ in samples. 68 | 69 | 70 | 71 | Playback speed of the loop 72 | Playback speed of the loop 73 | 74 | 75 | 76 | Length of the buffer~ in milliseconds 77 | Length of the buffer~ in milliseconds. 78 | 79 | 80 | 81 | Channel to read from the buffer~ 82 | Channel to read from the buffer~. 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/min.convolve.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Perform convolution on a list 10 | Perform convolution on a list. For more details on convolution see https://en.wikipedia.org/wiki/Convolution. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | math 18 | lists 19 | operators 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Input to the convolution function 36 | Input to the convolution function. 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | The convolution kernel 48 | The convolution kernel. 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /docs/min.dict.join.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Merge the content of two dictionaries 10 | Merge the content of two dictionaries. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | dictionary 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Define an initial dictionary for joining 27 | Define an initial dictionary for joining. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Dictionary from the second inlet is combined with the dictionary from the first inlet and a new dictionary is sent 39 | Dictionary from the second inlet is combined with the dictionary from the first inlet and a new dictionary is sent 40 | 41 | 42 | 43 | Resend the most recently combined dictionary 44 | Resend the most recently combined dictionary 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /docs/min.edgelow~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Detect logical signal transitions 10 | Detect logical signal transitions. Output at low priority. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | audio 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/min.edge~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Detect logical signal transitions 10 | Detect logical signal transitions. Output at high priority. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | audio 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/min.environment.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Get info about the current max environment 10 | Get info about the current max environment. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | math 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Get info about the current max environment 34 | Get info about the current max environment. 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/min.hello-world.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Post to the Max Console 10 | Post to the Max Console. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | utilities 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Initial value for the greeting attribute 27 | Initial value for the greeting attribute. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Post the greeting 39 | Post the greeting. 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Greeting to be posted 51 | Greeting to be posted. The greeting will be posted to the Max console when a bang is received. 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /docs/min.jit.clamp.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Limit matrix values to a range 10 | Limit matrix values to a range. The range is specified the object's min and max attributes. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | math 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | The maximum value above which clipping occurs 41 | The maximum value above which clipping occurs. 42 | 43 | 44 | 45 | The minimum value below which clipping occurs 46 | The minimum value below which clipping occurs. 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /docs/min.jit.stencil.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Apply a 5-point stencil operation to a matrix 10 | Apply a 5-point stencil operation to a matrix. See https://en.wikipedia.org/wiki/Five-point_stencil for more information. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | video 18 | blur/sharpen 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | The vertical distance from each incoming cell to the source cells used for averaging 42 | The vertical distance from each incoming cell to the source cells used for averaging. 43 | 44 | 45 | 46 | The horizontal distance from each incoming cell to the source cells used for averaging 47 | The horizontal distance from each incoming cell to the source cells used for averaging. 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/min.list.process.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Process lists in various ways 10 | Process lists in various ways. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | lists 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Send out the collected list 34 | Send out the collected list. Only applicable if using the 'collect' operation. 35 | 36 | 37 | 38 | Add content to the collection 39 | Add content to the collection. Only applicable if using the 'collect' operation. 40 | 41 | 42 | 43 | Add content to the collection 44 | Add content to the collection. Only applicable if using the 'collect' operation. 45 | 46 | 47 | 48 | Operate on the list 49 | Operate on the list. Either add it to the collection or calculate the mean. 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Choose the operation to perform with the input 61 | Choose the operation to perform with the input. Collect items into a list or calculate the mean from a list. 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /docs/min.markdown.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Get the approximate value of pi 10 | Get the approximate value of pi. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | math 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Markdown file to read 34 | Markdown file to read 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /docs/min.meter~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Show audio gain levels 10 | Show audio gain levels 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | ui 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /docs/min.multitouch.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Report mouse and multitouch interactions 10 | Report mouse and multitouch interactions 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | ui 18 | multitouch 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/min.note.make.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Generate a note-on/note-off pair 10 | Generate a note-on/note-off pair. Just like the makenote object. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | midi 18 | time 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Initial MIDI velocity 28 | Initial MIDI velocity. 29 | 30 | 31 | 32 | Initial duration in milliseconds 33 | Initial duration in milliseconds. 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | MIDI note information 45 | MIDI note information 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /docs/min.pan~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Pan an input to two outputs 10 | Pan an input to two outputs. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | audio 18 | routing 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Set the normalized position in the function 35 | Set the normalized position in the function. 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Normalized position 47 | Normalized position. This is the position within the function defined by the 'shape' attribute. 48 | 49 | 50 | 51 | Calculation Modality 52 | Calculation Modality. Choose whether to perform calculations on-the-fly for greater accuracy or use a lookup table for greater speed. 53 | 54 | 55 | 56 | Shape of function 57 | Shape of function. Transition across the position using one of several shapes: 'linear', 'equal_power', or 'square_root'. 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /docs/min.patcher.control.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Control or query a patcher 10 | Control or query a patcher 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | developer 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Return the paths of all boxes in this patcher 34 | Return the paths of all boxes in this patcher. 35 | 36 | 37 | 38 | Return the classnames of all boxes in this patcher 39 | Return the classnames of all boxes in this patcher. 40 | 41 | 42 | 43 | Return the total number of boxes in this patcher 44 | Return the total number of boxes in this patcher. 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /docs/min.phasor~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A non-bandlimited sawtooth oscillator (a phasor~ in MSP parlance) 10 | A non-bandlimited sawtooth oscillator (a phasor~ in MSP parlance).This sawtooth waveis typically used as a control signal for phase ramping. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | audio 18 | oscillator 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Initial frequency in hertz 28 | Initial frequency in hertz. 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | Set the frequency in Hz 40 | Set the frequency in Hz. 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Frequency in Hz 52 | Frequency in Hz 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /docs/min.pi.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Get the approximate value of pi 10 | Get the approximate value of pi. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | math 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Return the path to the preferences folder 34 | Return the path to the preferences folder. 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /docs/min.prefs.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Get the path to Max's preferences folder 10 | Get the path to Max's preferences folder. Useful for standalone app makers. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | files 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Return the path to the preferences folder 34 | Return the path to the preferences folder. 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/min.progress.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Demonstrate display of a progress bar 10 | Demonstrate display of a progress bar. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | interface 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Start process 34 | Start process. 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Duration of the process 46 | Duration of the process. 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /docs/min.project.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Create a Min-based package 10 | Create a Min-based package. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | utilities 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Generate IDE projects for the package whose name is passed 34 | Generate IDE projects for the package whose name is passed. 35 | 36 | 37 | 38 | Add a new object to a package 39 | Add a new object to a package. 40 | 41 | 42 | 43 | Generate IDE projects and then open the specified project only 44 | Generate IDE projects and then open the specified project only. 45 | 46 | 47 | 48 | Create a Min-based package 49 | Create a Min-based package. 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/min.remote.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Address an object remotely 10 | Address an object remotely 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | developer 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Send a message to a named object 34 | Send a message to a named object. First argument is the scripting name of the object. Second argument is the name of the message to send. Any additional arguments are passed as arguments to the named object. 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /docs/min.sift~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Remove a specific sample value and convert to float output 10 | Remove a specific sample value and convert to float output. min.sift~ removes a specified sample value (typically zero) as well as repeated sample values from an input signal. It then converts the remaining samples to floating-point output at control rate. 11 | 12 | 13 | 14 | 15 | 16 | Timothy Place 17 | analysis 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Initial value to sift out from the incoming signal 27 | Initial value to sift out from the incoming signal. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Deliver results in the high-priority scheduler thread 46 | Deliver results in the high-priority scheduler thread. If set to false then deliver results in the main thread. 47 | 48 | 49 | 50 | Value to sift out of the incoming signal 51 | Value to sift out of the incoming signal. 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/min.stress~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Eat up a specified percentage of processor time to stress the computer 10 | Eat up a specified percentage of processor time to stress the computer. 11 | 12 | 13 | 14 | 15 | 16 | Timothy Place, Rob Sussman 17 | benchmarking 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Percentage of the CPU to burn 41 | Percentage of the CPU to burn. 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/min.textslider.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Display a text label 10 | Display a text label 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | ui 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Mouse tracking direction 76 | Mouse tracking direction. 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /docs/min.threadcheck.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Report the thread of execution for a message 10 | Report the thread of execution for a message. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | developer 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Message to check 34 | Message to check. 35 | 36 | 37 | 38 | Message to check 39 | Message to check. 40 | 41 | 42 | 43 | Message to check 44 | Message to check. 45 | 46 | 47 | 48 | Message to check 49 | Message to check. 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/min.xfade~.maxref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Crossfade between two signals 10 | Crossfade between two signals. 11 | 12 | 13 | 14 | 15 | 16 | Cycling '74 17 | audio 18 | routing 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Set the normalized position in the function 35 | Set the normalized position in the function. 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Normalized position 47 | Normalized position. This is the position within the function defined by the 'shape' attribute. 48 | 49 | 50 | 51 | Calculation Modality 52 | Calculation Modality. Choose whether to perform calculations on-the-fly for greater accuracy or use a lookup table for greater speed. 53 | 54 | 55 | 56 | Shape of function 57 | Shape of function. Transition across the position using one of several shapes: 'linear', 'equal_power', or 'square_root'. 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /help/min.edit-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cycling74/min-devkit/60c62625ef933ab4ae8af11bf7b5988de50b0308/help/min.edit-button.png -------------------------------------------------------------------------------- /help/min.pi.maxhelp: -------------------------------------------------------------------------------- 1 | { 2 | "patcher" : { 3 | "fileversion" : 1, 4 | "appversion" : { 5 | "major" : 7, 6 | "minor" : 3, 7 | "revision" : 5, 8 | "architecture" : "x64", 9 | "modernui" : 1 10 | } 11 | , 12 | "rect" : [ 63.0, 104.0, 540.0, 384.0 ], 13 | "bglocked" : 0, 14 | "openinpresentation" : 0, 15 | "default_fontsize" : 12.0, 16 | "default_fontface" : 0, 17 | "default_fontname" : "Lato Light", 18 | "gridonopen" : 1, 19 | "gridsize" : [ 5.0, 5.0 ], 20 | "gridsnaponopen" : 2, 21 | "objectsnaponopen" : 0, 22 | "statusbarvisible" : 2, 23 | "toolbarvisible" : 1, 24 | "lefttoolbarpinned" : 2, 25 | "toptoolbarpinned" : 2, 26 | "righttoolbarpinned" : 2, 27 | "bottomtoolbarpinned" : 2, 28 | "toolbars_unpinned_last_save" : 15, 29 | "tallnewobj" : 0, 30 | "boxanimatetime" : 200, 31 | "enablehscroll" : 1, 32 | "enablevscroll" : 1, 33 | "devicewidth" : 0.0, 34 | "description" : "", 35 | "digest" : "", 36 | "tags" : "", 37 | "style" : "tap", 38 | "subpatcher_template" : "tap.template", 39 | "boxes" : [ { 40 | "box" : { 41 | "format" : 6, 42 | "id" : "obj-3", 43 | "maxclass" : "flonum", 44 | "numinlets" : 1, 45 | "numoutlets" : 2, 46 | "outlettype" : [ "", "bang" ], 47 | "parameter_enable" : 0, 48 | "patching_rect" : [ 155.0, 185.0, 75.0, 23.0 ], 49 | "style" : "" 50 | } 51 | 52 | } 53 | , { 54 | "box" : { 55 | "id" : "obj-4", 56 | "maxclass" : "button", 57 | "numinlets" : 1, 58 | "numoutlets" : 1, 59 | "outlettype" : [ "bang" ], 60 | "patching_rect" : [ 155.0, 90.0, 24.0, 24.0 ], 61 | "style" : "" 62 | } 63 | 64 | } 65 | , { 66 | "box" : { 67 | "id" : "obj-2", 68 | "maxclass" : "newobj", 69 | "numinlets" : 1, 70 | "numoutlets" : 1, 71 | "outlettype" : [ "" ], 72 | "patching_rect" : [ 155.0, 140.0, 42.0, 23.0 ], 73 | "style" : "", 74 | "text" : "min.pi" 75 | } 76 | 77 | } 78 | ], 79 | "lines" : [ { 80 | "patchline" : { 81 | "destination" : [ "obj-3", 0 ], 82 | "source" : [ "obj-2", 0 ] 83 | } 84 | 85 | } 86 | , { 87 | "patchline" : { 88 | "destination" : [ "obj-2", 0 ], 89 | "source" : [ "obj-4", 0 ] 90 | } 91 | 92 | } 93 | ], 94 | "dependency_cache" : [ { 95 | "name" : "min.pi.mxo", 96 | "type" : "iLaX" 97 | } 98 | ], 99 | "autosave" : 0, 100 | "styles" : [ { 101 | "name" : "tap", 102 | "default" : { 103 | "fontname" : [ "Lato Light" ] 104 | } 105 | , 106 | "parentstyle" : "", 107 | "multi" : 0 108 | } 109 | ], 110 | "bgfillcolor_type" : "gradient", 111 | "bgfillcolor_color1" : [ 0.376471, 0.384314, 0.4, 1.0 ], 112 | "bgfillcolor_color2" : [ 0.290196, 0.309804, 0.301961, 1.0 ], 113 | "bgfillcolor_color" : [ 0.290196, 0.309804, 0.301961, 1.0 ], 114 | "bgfillcolor_angle" : 270.0, 115 | "bgfillcolor_proportion" : 0.39 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /help/min.progress.maxhelp: -------------------------------------------------------------------------------- 1 | { 2 | "patcher" : { 3 | "fileversion" : 1, 4 | "appversion" : { 5 | "major" : 8, 6 | "minor" : 1, 7 | "revision" : 5, 8 | "architecture" : "x64", 9 | "modernui" : 1 10 | } 11 | , 12 | "classnamespace" : "box", 13 | "rect" : [ 59.0, 104.0, 640.0, 480.0 ], 14 | "bglocked" : 0, 15 | "openinpresentation" : 0, 16 | "default_fontsize" : 12.0, 17 | "default_fontface" : 0, 18 | "default_fontname" : "Arial", 19 | "gridonopen" : 1, 20 | "gridsize" : [ 15.0, 15.0 ], 21 | "gridsnaponopen" : 1, 22 | "objectsnaponopen" : 1, 23 | "statusbarvisible" : 2, 24 | "toolbarvisible" : 1, 25 | "lefttoolbarpinned" : 0, 26 | "toptoolbarpinned" : 0, 27 | "righttoolbarpinned" : 0, 28 | "bottomtoolbarpinned" : 0, 29 | "toolbars_unpinned_last_save" : 0, 30 | "tallnewobj" : 0, 31 | "boxanimatetime" : 200, 32 | "enablehscroll" : 1, 33 | "enablevscroll" : 1, 34 | "devicewidth" : 0.0, 35 | "description" : "", 36 | "digest" : "", 37 | "tags" : "", 38 | "style" : "", 39 | "subpatcher_template" : "", 40 | "assistshowspatchername" : 0, 41 | "boxes" : [ { 42 | "box" : { 43 | "id" : "obj-3", 44 | "maxclass" : "button", 45 | "numinlets" : 1, 46 | "numoutlets" : 1, 47 | "outlettype" : [ "bang" ], 48 | "parameter_enable" : 0, 49 | "patching_rect" : [ 245.0, 138.0, 24.0, 24.0 ] 50 | } 51 | 52 | } 53 | , { 54 | "box" : { 55 | "id" : "obj-1", 56 | "maxclass" : "newobj", 57 | "numinlets" : 1, 58 | "numoutlets" : 0, 59 | "patching_rect" : [ 274.0, 193.0, 78.0, 22.0 ], 60 | "text" : "min.progress" 61 | } 62 | 63 | } 64 | ], 65 | "lines" : [ { 66 | "patchline" : { 67 | "destination" : [ "obj-1", 0 ], 68 | "source" : [ "obj-3", 0 ] 69 | } 70 | 71 | } 72 | ], 73 | "dependency_cache" : [ { 74 | "name" : "min.progress.mxo", 75 | "type" : "iLaX" 76 | } 77 | ], 78 | "autosave" : 0 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /help/min.remote.maxhelp: -------------------------------------------------------------------------------- 1 | { 2 | "patcher" : { 3 | "fileversion" : 1, 4 | "appversion" : { 5 | "major" : 8, 6 | "minor" : 1, 7 | "revision" : 3, 8 | "architecture" : "x64", 9 | "modernui" : 1 10 | } 11 | , 12 | "classnamespace" : "box", 13 | "rect" : [ 59.0, 104.0, 640.0, 480.0 ], 14 | "bglocked" : 0, 15 | "openinpresentation" : 0, 16 | "default_fontsize" : 13.0, 17 | "default_fontface" : 0, 18 | "default_fontname" : "Ableton Sans Light Regular", 19 | "gridonopen" : 1, 20 | "gridsize" : [ 5.0, 5.0 ], 21 | "gridsnaponopen" : 2, 22 | "objectsnaponopen" : 0, 23 | "statusbarvisible" : 2, 24 | "toolbarvisible" : 1, 25 | "lefttoolbarpinned" : 2, 26 | "toptoolbarpinned" : 2, 27 | "righttoolbarpinned" : 2, 28 | "bottomtoolbarpinned" : 2, 29 | "toolbars_unpinned_last_save" : 15, 30 | "tallnewobj" : 0, 31 | "boxanimatetime" : 200, 32 | "enablehscroll" : 1, 33 | "enablevscroll" : 1, 34 | "devicewidth" : 0.0, 35 | "description" : "", 36 | "digest" : "", 37 | "tags" : "", 38 | "style" : "", 39 | "subpatcher_template" : "tap.dark-template", 40 | "boxes" : [ { 41 | "box" : { 42 | "id" : "obj-7", 43 | "maxclass" : "number", 44 | "numinlets" : 1, 45 | "numoutlets" : 2, 46 | "outlettype" : [ "", "bang" ], 47 | "parameter_enable" : 0, 48 | "patching_rect" : [ 285.0, 290.0, 50.0, 24.0 ] 49 | } 50 | 51 | } 52 | , { 53 | "box" : { 54 | "id" : "obj-5", 55 | "maxclass" : "message", 56 | "numinlets" : 2, 57 | "numoutlets" : 1, 58 | "outlettype" : [ "" ], 59 | "patching_rect" : [ 180.0, 130.0, 70.0, 24.0 ], 60 | "text" : "mimi int 60" 61 | } 62 | 63 | } 64 | , { 65 | "box" : { 66 | "id" : "obj-3", 67 | "maxclass" : "newobj", 68 | "numinlets" : 1, 69 | "numoutlets" : 1, 70 | "outlettype" : [ "" ], 71 | "patching_rect" : [ 180.0, 175.0, 72.0, 24.0 ], 72 | "text" : "min.remote" 73 | } 74 | 75 | } 76 | , { 77 | "box" : { 78 | "id" : "obj-2", 79 | "maxclass" : "newobj", 80 | "numinlets" : 3, 81 | "numoutlets" : 0, 82 | "patching_rect" : [ 355.0, 295.0, 52.0, 24.0 ], 83 | "text" : "noteout" 84 | } 85 | 86 | } 87 | , { 88 | "box" : { 89 | "id" : "obj-1", 90 | "maxclass" : "newobj", 91 | "numinlets" : 4, 92 | "numoutlets" : 3, 93 | "outlettype" : [ "float", "float", "float" ], 94 | "patching_rect" : [ 355.0, 240.0, 126.0, 24.0 ], 95 | "text" : "makenote 127 500 1", 96 | "varname" : "mimi" 97 | } 98 | 99 | } 100 | ], 101 | "lines" : [ { 102 | "patchline" : { 103 | "destination" : [ "obj-2", 1 ], 104 | "source" : [ "obj-1", 1 ] 105 | } 106 | 107 | } 108 | , { 109 | "patchline" : { 110 | "destination" : [ "obj-2", 0 ], 111 | "order" : 0, 112 | "source" : [ "obj-1", 0 ] 113 | } 114 | 115 | } 116 | , { 117 | "patchline" : { 118 | "destination" : [ "obj-7", 0 ], 119 | "order" : 1, 120 | "source" : [ "obj-1", 0 ] 121 | } 122 | 123 | } 124 | , { 125 | "patchline" : { 126 | "destination" : [ "obj-3", 0 ], 127 | "source" : [ "obj-5", 0 ] 128 | } 129 | 130 | } 131 | ], 132 | "dependency_cache" : [ { 133 | "name" : "min.remote.mxo", 134 | "type" : "iLaX" 135 | } 136 | ], 137 | "autosave" : 0, 138 | "textcolor" : [ 0.847058823529412, 0.847058823529412, 0.847058823529412, 1.0 ], 139 | "bgcolor" : [ 0.109803921568627, 0.109803921568627, 0.109803921568627, 1.0 ], 140 | "editing_bgcolor" : [ 0.109803921568627, 0.109803921568627, 0.109803921568627, 1.0 ] 141 | } 142 | 143 | } 144 | -------------------------------------------------------------------------------- /help/min.sifthelp.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cycling74/min-devkit/60c62625ef933ab4ae8af11bf7b5988de50b0308/help/min.sifthelp.aiff -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cycling74/min-devkit/60c62625ef933ab4ae8af11bf7b5988de50b0308/icon.png -------------------------------------------------------------------------------- /init/min-objectmappings.txt: -------------------------------------------------------------------------------- 1 | max objectfile min.mc.phasor~ mc.wrapper~ min.phasor~; 2 | max objectfile min.mc.pan~ mc.wrapper~ min.pan~; 3 | max objectfile min.mc.xfade~ mc.wrapper~ min.xfade~; 4 | -------------------------------------------------------------------------------- /javascript/min-package-list.js: -------------------------------------------------------------------------------- 1 | 2 | inlets = 1; 3 | outlets = 1; 4 | 5 | 6 | function bang() { 7 | var p = new Packages; 8 | var paths = p.getsubpaths("source", 1); 9 | 10 | if (typeof(paths) == "string") 11 | look_for_min(paths); 12 | else { 13 | for (var i=0; i" 9 | puts "" 10 | puts "example:" 11 | puts " script/create_package.rb \"~/Documents/Max 7/Packages/my_new_package\"" 12 | puts "" 13 | exit 14 | end 15 | 16 | 17 | 18 | # 1. Find our current directory 19 | if $0.downcase != "create_package.rb".downcase 20 | script_dir = Dir.getwd.chomp + "/" + $0.gsub(/((\/|\\)create_package).*$/i, "") 21 | else 22 | script_dir = "." 23 | end 24 | 25 | olddir = Dir.getwd 26 | Dir.chdir "#{script_dir}/.." # change to libdir so that requires work 27 | source_dir = Dir.getwd.chomp 28 | Dir.chdir olddir 29 | 30 | 31 | 32 | target_dir = ARGV[0] 33 | 34 | require 'fileutils' 35 | FileUtils::mkdir_p "#{target_dir}" 36 | olddir = Dir.getwd 37 | Dir.chdir "#{target_dir}" # change to libdir so that requires work 38 | target_dir = Dir.getwd.chomp 39 | package_name = File.basename(target_dir) 40 | Dir.chdir olddir 41 | 42 | 43 | 44 | puts "" 45 | puts " CREATING PACKAGE #{package_name}" 46 | puts "" 47 | puts " SOURCE DIR: #{source_dir}" 48 | puts " TARGET DIR: #{target_dir}" 49 | puts "" 50 | 51 | 52 | 53 | # 3. Copy everything we want, nothing we don't. 54 | # Git Submodules will be added at the very end. 55 | 56 | hello_world = "#{package_name}.hello-world" 57 | 58 | FileUtils::mkdir_p "#{target_dir}/build" 59 | FileUtils::mkdir_p "#{target_dir}/source/projects/#{hello_world}" 60 | FileUtils::mkdir_p "#{target_dir}/help" 61 | 62 | FileUtils::cp "#{source_dir}/package-info.json.in", "#{target_dir}/package-info.json.in" 63 | FileUtils::cp "#{source_dir}/script/ReadMe-Template.md", "#{target_dir}/ReadMe.md" 64 | FileUtils::cp "#{source_dir}/License.md", "#{target_dir}/License.md" 65 | FileUtils::cp "#{source_dir}/icon.png", "#{target_dir}/icon.png" 66 | FileUtils::cp "#{source_dir}/CMakeLists.txt", "#{target_dir}/CMakeLists.txt" 67 | 68 | FileUtils::cp "#{source_dir}/.gitignore", "#{target_dir}/.gitignore" 69 | 70 | FileUtils::cp "#{source_dir}/source/projects/min.hello-world/min.hello-world.cpp", "#{target_dir}/source/projects/#{hello_world}/#{hello_world}.cpp" 71 | FileUtils::cp "#{source_dir}/source/projects/min.hello-world/min.hello-world_test.cpp", "#{target_dir}/source/projects/#{hello_world}/#{hello_world}_test.cpp" 72 | FileUtils::cp "#{source_dir}/source/projects/min.hello-world/CMakeLists.txt", "#{target_dir}/source/projects/#{hello_world}/CMakeLists.txt" 73 | FileUtils::cp "#{source_dir}/help/min.hello-world.maxhelp", "#{target_dir}/help/#{hello_world}.maxhelp" 74 | 75 | FileUtils::cp "#{source_dir}/HowTo-NewObject.md", "#{target_dir}/HowTo-NewObject.md" 76 | 77 | 78 | def substitute_strings_in_file(file_path, old_string, new_string) 79 | f = File.open("#{file_path}", "r+") 80 | str = f.read 81 | str.gsub!(/#{old_string}/, new_string) 82 | f.rewind 83 | f.write(str) 84 | f.truncate(f.pos) 85 | f.close 86 | end 87 | 88 | 89 | substitute_strings_in_file "#{target_dir}/help/#{hello_world}.maxhelp", "min.hello-world", "#{hello_world}" 90 | substitute_strings_in_file "#{target_dir}/source/projects/#{hello_world}/#{hello_world}_test.cpp", "min.hello-world", "#{hello_world}" 91 | substitute_strings_in_file "#{target_dir}/ReadMe.md", "My Package", "#{package_name}" 92 | 93 | 94 | Dir.chdir "#{target_dir}" 95 | `git init` 96 | `git submodule add https://github.com/Cycling74/min-api.git source/min-api` 97 | `git submodule add https://github.com/Cycling74/min-lib.git source/min-lib` 98 | `git submodule update --init --recursive` 99 | `git commit -m"Min-API and Min-Lib added as git submodules"` 100 | `git tag v0.0.1` 101 | -------------------------------------------------------------------------------- /script/doc.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby -wU 2 | # encoding: utf-8 3 | 4 | 5 | @this_dir = Dir.pwd 6 | `rm -rf "#{@this_dir}/../min-devkit-doc"` 7 | `git clone https://github.com/Cycling74/min-devkit.git "#{@this_dir}/../min-devkit-doc" --branch gh-pages` 8 | Dir.chdir("#{@this_dir}/../min-devkit-doc") 9 | @temp_dir = Dir.pwd 10 | Dir.chdir @this_dir 11 | 12 | 13 | `rm #{@temp_dir}/_guides/*` 14 | `cp #{@this_dir}/source/min-api/doc/Guide*.md #{@temp_dir}/_guides` 15 | 16 | Dir.foreach("#{@temp_dir}/_guides") do |doc| 17 | next if doc == '.' or doc == '..' 18 | title = doc[/GuideTo(.*)\.md/,1] 19 | 20 | str = "---\n"; 21 | str += "title: " + title + "\n"; 22 | str += "permalink: /guide/" + title.downcase + "\n"; 23 | str += "layout: guide\n"; 24 | str += "---\n"; 25 | 26 | f = File.open("#{@temp_dir}/_guides/#{doc}", "r+") 27 | str += f.read 28 | f.rewind 29 | f.write(str) 30 | f.truncate(f.pos) 31 | f.close 32 | end 33 | 34 | `mv #{@temp_dir}/_guides/GuideToWritingObjects.md #{@temp_dir}/_guides/1.GuideToWritingObjects.md` 35 | 36 | 37 | 38 | `rm #{@temp_dir}/_api/*` 39 | `cp #{@this_dir}/source/min-api/doc/API*.md #{@temp_dir}/_api` 40 | 41 | Dir.foreach("#{@temp_dir}/_api") do |doc| 42 | next if doc == '.' or doc == '..' 43 | title = doc[/API-(.*)\.md/,1] 44 | 45 | str = "---\n"; 46 | str += "title: " + title + "\n"; 47 | str += "permalink: /api/" + title.downcase + "\n"; 48 | str += "layout: api\n"; 49 | str += "---\n"; 50 | 51 | f = File.open("#{@temp_dir}/_api/#{doc}", "r+") 52 | str += f.read 53 | f.rewind 54 | f.write(str) 55 | f.truncate(f.pos) 56 | f.close 57 | end 58 | 59 | 60 | Dir.chdir @temp_dir 61 | `git add .` 62 | `git commit -m"doc update performed by doc.rb script."` 63 | `git push origin HEAD` 64 | -------------------------------------------------------------------------------- /source/projects/mc.min.info_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/mc.min.info_tilde/mc.min.info_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class mc_info_tilde : public object, public mc_operator<> { 12 | public: 13 | MIN_DESCRIPTION { "Analyze a multi-channel signal. " 14 | "[mc.min.info~] provides information about what is happening in the multi-channel signal " 15 | "with sample accuracy." }; 16 | MIN_TAGS { "analysis" }; 17 | MIN_AUTHOR { "Timothy Place" }; 18 | MIN_RELATED { "info~, jit.fpsgui~, mc.channelcount~" }; 19 | 20 | inlet<> m_inlet { this, "(multichannelsignal) input to be investigated" }; 21 | outlet<> m_outlet_chans { this, "(signal) channel count", "signal", }; 22 | outlet<> m_outlet_low_n { this, "(signal) channel with the lowest value", "signal", }; 23 | outlet<> m_outlet_high_n { this, "(signal) channel with the highest value", "signal" }; 24 | outlet<> m_outlet_low { this, "(signal) lowest value among the signals", "signal" }; 25 | outlet<> m_outlet_high { this, "(signal) highest value among the signals", "signal" }; 26 | 27 | void operator()(audio_bundle input, audio_bundle output) { 28 | auto out_channels { output.samples(0) }; 29 | auto out_low_n { output.samples(1) }; 30 | auto out_high_n { output.samples(2) }; 31 | auto out_low { output.samples(3) }; 32 | auto out_high { output.samples(4) }; 33 | 34 | for (auto i = 0; i < input.frame_count(); ++i) { 35 | sample low_n { -1 }; 36 | sample high_n { -1 }; 37 | sample low { std::numeric_limits::max() }; 38 | sample high { -std::numeric_limits::max() }; 39 | 40 | for (auto channel = 0; channel < input.channel_count(); ++channel) { 41 | auto in { input.samples(channel)[i] }; 42 | 43 | if (in > high) { 44 | high = in; 45 | high_n = channel; 46 | } 47 | if (in < low) { 48 | low = in; 49 | low_n = channel; 50 | } 51 | } 52 | 53 | out_channels[i] = input.channel_count(); 54 | out_low_n[i] = low_n; 55 | out_high_n[i] = high_n; 56 | out_low[i] = low; 57 | out_high[i] = high; 58 | } 59 | } 60 | 61 | }; 62 | 63 | MIN_EXTERNAL(mc_info_tilde); 64 | -------------------------------------------------------------------------------- /source/projects/min.beat.pattern/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.beat.pattern/min.beat.pattern.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class beat_pattern : public object { 12 | public: 13 | MIN_DESCRIPTION { "Bang at intervals in a repeating pattern." }; 14 | MIN_TAGS { "time" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "min.beat.random, link.beat, metro, tempo, drunk" }; 17 | 18 | inlet<> input { this, "(toggle) on/off" }; 19 | outlet<> bang_out { this, "(bang) triggers at according to specified pattern" }; 20 | outlet<> interval_out { this, "(float) the interval for the current bang" }; 21 | 22 | timer<> metro { this, 23 | MIN_FUNCTION { 24 | double interval = m_sequence[m_index]; 25 | 26 | interval_out.send(interval); 27 | bang_out.send("bang"); 28 | 29 | metro.delay(interval); 30 | 31 | m_index += 1; 32 | 33 | if (m_index == m_sequence.size()) 34 | m_index = 0; 35 | return {}; 36 | } 37 | }; 38 | 39 | attribute on {this, "on", false, 40 | description {"Turn on/off the internal timer."}, 41 | setter { MIN_FUNCTION { 42 | if (args[0] == true) 43 | metro.delay(0.0); // fire the first one straight-away 44 | else 45 | metro.stop(); 46 | return args; 47 | }} 48 | }; 49 | 50 | message<> toggle { this, "int", "Turn on/off the internal timer.", 51 | MIN_FUNCTION { 52 | on = args[0]; 53 | return {}; 54 | } 55 | }; 56 | 57 | 58 | message<> dictionary { this, "dictionary", "Use a dictionary to define the pattern of bangs produced.", 59 | MIN_FUNCTION { 60 | dict d {args[0]}; 61 | 62 | m_sequence = d["pattern"]; 63 | return {}; 64 | } 65 | }; 66 | 67 | private: 68 | int m_index { 0 }; 69 | atoms m_sequence { 250.0, 250.0, 250.0, 250.0, 500.0, 500.0, 500.0, 500.0 }; 70 | }; 71 | 72 | MIN_EXTERNAL(beat_pattern); 73 | -------------------------------------------------------------------------------- /source/projects/min.beat.random/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.beat.random/min.beat.random.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class beat_random : public object { 12 | public: 13 | MIN_DESCRIPTION { "Bang at random intervals." }; 14 | MIN_TAGS { "time" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "min.beat.pattern, link.beat, metro, tempo, drunk" }; 17 | 18 | inlet<> input { this, "(toggle) on/off" }; 19 | outlet<> bang_out { this, "(bang) triggers at randomized interval" }; 20 | outlet<> interval_out { this, "(float) the interval for the current bang" }; 21 | 22 | argument minimum_arg { this, "minimum", "Initial lower-bound of generated random interval.", 23 | MIN_ARGUMENT_FUNCTION { 24 | min = arg; 25 | } 26 | }; 27 | 28 | argument maximum_arg { this, "maximum", "Initial upper-bound of generated random interval.", 29 | MIN_ARGUMENT_FUNCTION { 30 | max = arg; 31 | } 32 | }; 33 | 34 | timer<> metro { this, 35 | MIN_FUNCTION { 36 | auto interval = lib::math::random(min, max); 37 | 38 | interval_out.send(interval); 39 | bang_out.send("bang"); 40 | 41 | metro.delay(interval); 42 | return {}; 43 | } 44 | }; 45 | 46 | 47 | attribute min { this, "min", 250.0, title {"Minimum Interval"}, 48 | description {"Lower-bound of generated random interval."}, 49 | setter { MIN_FUNCTION { 50 | UNUSED(this); // silences compiler warning since we don't access class members 51 | 52 | double value = args[0]; 53 | if (value < 1.0) 54 | value = 1.0; 55 | return {value}; 56 | }}, 57 | category {"Range"}, order {1} 58 | }; 59 | 60 | 61 | attribute max { this, "max", 1500.0, title {"Maximum Interval"}, 62 | description {"Upper-bound of generated random interval."}, 63 | setter { MIN_FUNCTION { 64 | UNUSED(this); // silences compiler warning since we don't access class members 65 | 66 | double value = args[0]; 67 | if (value < 1.0) 68 | value = 1.0; 69 | return {value}; 70 | }}, 71 | category {"Range"}, order {2} 72 | }; 73 | 74 | 75 | attribute on { this, "on", false, title {"On/Off"}, 76 | description {"Activate the timer."}, 77 | setter { MIN_FUNCTION { 78 | if (args[0] == true) 79 | metro.delay(0.0); // fire the first one straight-away 80 | else 81 | metro.stop(); 82 | return args; 83 | }} 84 | }; 85 | 86 | 87 | message<> toggle { this, "int", "Toggle the state of the timer.", 88 | MIN_FUNCTION { 89 | on = args[0]; 90 | return {}; 91 | } 92 | }; 93 | 94 | }; 95 | 96 | 97 | MIN_EXTERNAL(beat_random); 98 | -------------------------------------------------------------------------------- /source/projects/min.beat.random/min.beat.random_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.beat.random.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | 12 | SCENARIO("object produces correct output") { 13 | ext_main(nullptr); // every unit test must call ext_main() once to configure the class 14 | 15 | using namespace std::chrono_literals; 16 | using std::cout; 17 | using std::endl; 18 | 19 | // std::cout << "Hello waiter" << std::endl; 20 | // auto start = std::chrono::high_resolution_clock::now(); 21 | // std::this_thread::sleep_for(2s); 22 | // auto end = std::chrono::high_resolution_clock::now(); 23 | // std::chrono::duration elapsed = end-start; 24 | // std::cout << "Waited " << elapsed.count() << " ms\n"; 25 | 26 | GIVEN("An instance of our object") { 27 | 28 | test_wrapper an_instance; 29 | beat_random& my_object = an_instance; 30 | 31 | // check that default attr values are correct 32 | 33 | REQUIRE(my_object.min == Approx(250.0)); // note: floating-point values may be subject to rounding errors 34 | REQUIRE(my_object.max == Approx(1500.0)); 35 | 36 | // now proceed to testing various sequences of events 37 | 38 | INFO("When the defaults are used nothing is produced by the object after waiting 5 seconds") 39 | 40 | // 1. Wait for 5 seconds 41 | cout << "About to wait for 5 seconds..." << endl; 42 | std::this_thread::sleep_for(5s); 43 | cout << "done!" << endl; 44 | 45 | // 2. See if there was any output 46 | auto& output = *c74::max::object_getoutput(my_object, 0); 47 | REQUIRE(output.size() == 0); 48 | 49 | 50 | INFO("turning it on does produce output after waiting 5 seconds") 51 | 52 | my_object.on = true; 53 | 54 | // 1. Wait for 5 seconds 55 | cout << "About to wait for 5 seconds..." << endl; 56 | std::this_thread::sleep_for(5s); 57 | cout << "done!" << endl; 58 | 59 | // 2. See if there was any output 60 | output = *c74::max::object_getoutput(my_object, 0); 61 | REQUIRE(output.size() > 0); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source/projects/min.buffer.index_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.buffer.index_tilde/min.buffer.index_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class buffer_index : public object, public vector_operator<> { 12 | public: 13 | MIN_DESCRIPTION { "Read from a buffer~." }; 14 | MIN_TAGS { "audio, sampling" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "index~, buffer~, wave~" }; 17 | 18 | inlet<> m_inlet_index { this, "(signal) Sample index" }; 19 | inlet<> m_inlet_channel { this, "(float) Audio channel to use from buffer~" }; 20 | outlet<> m_outlet_main { this, "(signal) Sample value at index", "signal" }; 21 | outlet<> m_outlet_changed { this, "(symbol) Notification that the content of the buffer~ changed." }; 22 | 23 | buffer_reference m_buffer { this, 24 | MIN_FUNCTION { // will receive a symbol arg indicating 'binding', 'unbinding', or 'modified' 25 | m_outlet_changed.send(args); 26 | return {}; 27 | } 28 | }; 29 | 30 | argument m_name_arg {this, "buffer-name", "Initial buffer~ from which to read.", 31 | MIN_ARGUMENT_FUNCTION { 32 | m_buffer.set(arg); 33 | } 34 | }; 35 | 36 | argument m_channel_arg {this, "channel", "Initial channel to read from the buffer~.", 37 | MIN_ARGUMENT_FUNCTION { 38 | m_channel = arg; 39 | } 40 | }; 41 | 42 | message<> m_number { this, "number", "Set the channel to read from the buffer~. The channel number uses 1-based counting.", 43 | MIN_FUNCTION { 44 | if (inlet == 1) 45 | m_channel = args[0]; 46 | return {}; 47 | } 48 | }; 49 | 50 | attribute m_channel {this, "channel", 1, 51 | description {"Channel to read from the buffer~. The channel number uses 1-based counting."}, 52 | range {1, buffer_reference::k_max_channels} 53 | }; 54 | 55 | void operator()(audio_bundle input, audio_bundle output) { 56 | auto in = input.samples(0); // get vector for channel 0 (first channel) 57 | auto out = output.samples(0); // get vector for channel 0 (first channel) 58 | buffer_lock<> b(m_buffer); // gain access to the buffer~ content 59 | auto chan = std::min(m_channel - 1, b.channel_count()); // convert from 1-based indexing to 0-based 60 | 61 | if (b.valid()) { 62 | for (auto i = 0; i < input.frame_count(); ++i) { 63 | auto frame = size_t(in[i] + 0.5); 64 | out[i] = b.lookup(frame, chan); 65 | } 66 | } 67 | else { 68 | output.clear(); 69 | } 70 | } 71 | }; 72 | 73 | 74 | MIN_EXTERNAL(buffer_index); 75 | -------------------------------------------------------------------------------- /source/projects/min.buffer.loop_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.convolve/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.convolve/min.convolve.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | class convolve : public object { 11 | public: 12 | MIN_DESCRIPTION { "Perform convolution on a list. For more details on convolution see " 13 | "https://en.wikipedia.org/wiki/Convolution." }; 14 | MIN_TAGS { "math, lists, operators" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "buffir~, jit.convolve" }; 17 | 18 | inlet<> input {this, "(list) values to convolve" }; 19 | outlet<> output {this, "(list) result of convolution" }; 20 | 21 | 22 | using fvec = vector; 23 | attribute kernel { this, "kernel", {1.0, 0.0}, description {"The convolution kernel."} }; 24 | 25 | 26 | message<> list { this, "list", "Input to the convolution function.", 27 | MIN_FUNCTION { // here we make a local *copy* of the kernel 28 | // for thread-safety 29 | // it looks great because we do one operation and then require locks on the shared data 30 | // but this is *wrong* 31 | // std::vector is not trivially copyable... 32 | // this copy assignment involved multiple operation internally, both memory allocation and copying 33 | // thus the following is not thread-safe! 34 | // as such, we have not marked this message as being thread-safe, and thus it will always execute in the 35 | // main thread. 36 | // 37 | // const vector kernel = this->kernel; 38 | 39 | const fvec& kernel = this->kernel; 40 | atoms result(args.size()); 41 | 42 | for (auto i = 0; i < args.size(); ++i) { 43 | double y = 0.0; 44 | 45 | for (auto k = 0; k < kernel.size(); ++k) { 46 | auto index = i - k; 47 | double x; 48 | 49 | if (index < 0) 50 | x = 0.0; 51 | else 52 | x = args[index]; 53 | 54 | y += x * kernel[k]; // convolve: multiply and accumulate 55 | } 56 | result[i] = y; 57 | } 58 | 59 | output.send(result); 60 | return {}; 61 | } 62 | }; 63 | }; 64 | 65 | MIN_EXTERNAL(convolve); 66 | -------------------------------------------------------------------------------- /source/projects/min.convolve/min.convolve_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.convolve.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | 12 | SCENARIO("object produces correct output") { 13 | ext_main(nullptr); // every unit test must call ext_main() once to configure the class 14 | 15 | GIVEN("An instance of our object") { 16 | 17 | test_wrapper an_instance; 18 | convolve& my_object = an_instance; 19 | 20 | // check that default attr values are correct 21 | std::vector initial_kernel = my_object.kernel; 22 | std::vector reference_kernel {1.0, 0.0}; 23 | REQUIRE((initial_kernel.size() == reference_kernel.size())); 24 | for (auto i = 0; i < initial_kernel.size(); ++i) { 25 | REQUIRE((initial_kernel[i] == Approx(reference_kernel[i]))); 26 | } 27 | 28 | // now proceed to testing various sequences of events 29 | WHEN("the defaults are used") { 30 | THEN("the input is the same as the output") { 31 | atoms input {1.0, 2.0, 3.0, 4.0}; 32 | 33 | my_object.list(input); 34 | auto& output = *c74::max::object_getoutput(my_object, 0); 35 | REQUIRE((output.size() == 1)); 36 | REQUIRE((output[0].size() == input.size())); 37 | for (auto i = 0; i < output.size(); ++i) { 38 | REQUIRE((output[0][i] == Approx(input[i]))); 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /source/projects/min.dict.join/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.dict.join/min.dict.join.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class dict_join : public object { 12 | public: 13 | MIN_DESCRIPTION { "Merge the content of two dictionaries." }; 14 | MIN_TAGS { "dictionary" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "min.beat.pattern, dict.join" }; 17 | 18 | inlet<> left { this, "dictionary to combined with dictionary at right inlet", "" }; 19 | inlet<> right { this, "dictionary to combined with dictionary at left inlet", "dictionary" }; 20 | outlet<> output { this, "dictionary of entries combined from both inlets", "dictionary" }; 21 | 22 | argument name_arg { this, "dictionary-syntax", "Define an initial dictionary for joining." }; 23 | 24 | dict_join(const atoms& args = {}) { 25 | if (!args.empty()) 26 | dict_right = dict(args); 27 | 28 | if (k_sym__pound_d) 29 | cout << "We were created by Max" << endl; 30 | else 31 | cout << "We were not created by Max" << endl; 32 | } 33 | 34 | 35 | message<> bang { this, "bang", "Resend the most recently combined dictionary", 36 | MIN_FUNCTION { 37 | output.send("dictionary", dict_merged.name()); 38 | return {}; 39 | } 40 | }; 41 | 42 | 43 | message<> dictionary { this, "dictionary", 44 | "Dictionary from the second inlet is combined with the dictionary from the first inlet and a new dictionary is sent", 45 | MIN_FUNCTION { 46 | try { 47 | dict d = {args[0]}; 48 | 49 | if (inlet == 0) { 50 | dict_merged = dict_right; // start with our stored dict contents 51 | dict_merged.copyunique(d); // now merge in any keys that are not duplicated in the incoming dict 52 | bang(); // send the dictionary name out the outlet 53 | dict_merged.touch(); // notify anything listening remotely (e.g. dict.view objects) that we changed 54 | } 55 | else { 56 | dict_right = d; 57 | } 58 | } 59 | catch (std::exception& e) { 60 | cerr << e.what() << endl; 61 | } 62 | return {}; 63 | } 64 | }; 65 | 66 | private: 67 | dict dict_right { symbol(true) }; 68 | dict dict_merged { symbol(true) }; 69 | }; 70 | 71 | MIN_EXTERNAL(dict_join); 72 | -------------------------------------------------------------------------------- /source/projects/min.dict.join/min.dict.join_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.dict.join.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | 12 | SCENARIO("object produces correct output") { 13 | ext_main(nullptr); // every unit test must call ext_main() once to configure the class 14 | 15 | GIVEN("An instance of dict_joiner") { 16 | 17 | test_wrapper an_instance; 18 | dict_join& my_object = an_instance; 19 | 20 | // check that the object instantiated successfully 21 | 22 | REQUIRE(my_object.inlets().size() == 2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/projects/min.edge_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.edge_tilde/min.edge_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class edge : public object, public sample_operator<1, 0> { 12 | public: 13 | MIN_DESCRIPTION { "Detect logical signal transitions. Output at high priority." }; 14 | MIN_TAGS { "audio" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "min.edgelow~, min.sift~, edge~" }; 17 | 18 | inlet<> input { this, "(signal) input" }; 19 | outlet output_true { this, "(bang) input is non-zero" }; 20 | outlet output_false { this, "(bang) input is zero" }; 21 | 22 | void operator()(sample x) { 23 | if (x != 0.0 && prev == 0.0) 24 | output_true.send(k_sym_bang); // change from zero to non-zero 25 | else if (x == 0.0 && prev != 0.0) 26 | output_false.send(k_sym_bang); // change from non-zero to zero 27 | prev = x; 28 | } 29 | 30 | private: 31 | sample prev {0.0}; 32 | }; 33 | 34 | MIN_EXTERNAL(edge); 35 | -------------------------------------------------------------------------------- /source/projects/min.edge_tilde/min.edge_tilde_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.edge_tilde.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | -------------------------------------------------------------------------------- /source/projects/min.edgelow_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.edgelow_tilde/min.edgelow_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class edgelow : public object, public sample_operator<1, 0> { 12 | public: 13 | MIN_DESCRIPTION { "Detect logical signal transitions. Output at low priority." }; 14 | MIN_TAGS { "audio" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "min.edge~, min.sift~, edge~" }; 17 | 18 | inlet<> input { this, "(signal) input" }; 19 | outlet output_true { this, "(bang) input is non-zero" }; 20 | outlet output_false { this, "(bang) input is zero" }; 21 | 22 | void operator()(sample x) { 23 | if (x != 0.0 && prev == 0.0) 24 | output_true.send(k_sym_bang); // change from zero to non-zero 25 | else if (x == 0.0 && prev != 0.0) 26 | output_false.send(k_sym_bang); // change from non-zero to zero 27 | prev = x; 28 | } 29 | 30 | private: 31 | sample prev { 0.0 }; 32 | }; 33 | 34 | MIN_EXTERNAL(edgelow); 35 | -------------------------------------------------------------------------------- /source/projects/min.edgelow_tilde/min.edgelow_tilde_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.edgelow_tilde.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | -------------------------------------------------------------------------------- /source/projects/min.environment/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | if (APPLE) 26 | set(SOURCE_FILES ${SOURCE_FILES} min.environment.mac.cpp) 27 | else () 28 | set(SOURCE_FILES ${SOURCE_FILES} min.environment.windows.cpp) 29 | endif () 30 | 31 | 32 | add_library( 33 | ${PROJECT_NAME} 34 | MODULE 35 | ${SOURCE_FILES} 36 | ) 37 | 38 | 39 | if (APPLE) 40 | find_library(CARBON_LIBRARY "Carbon") 41 | target_link_libraries(${PROJECT_NAME} PUBLIC ${CARBON_LIBRARY}) 42 | 43 | find_library(IOKIT_LIBRARY "IOKit") 44 | target_link_libraries(${PROJECT_NAME} PUBLIC ${IOKIT_LIBRARY}) 45 | else() 46 | set(IPHLPAPI_LIBRARY IPHLPAPI.lib) 47 | target_link_libraries(${PROJECT_NAME} PUBLIC ${IPHLPAPI_LIBRARY}) 48 | endif() 49 | 50 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 51 | 52 | 53 | ############################################################# 54 | # UNIT TEST 55 | ############################################################# 56 | 57 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 58 | -------------------------------------------------------------------------------- /source/projects/min.environment/min.environment.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | const char* min_environment_osversionstring(); 9 | const char* min_environment_macaddr(); 10 | std::string min_environment_uniqueid(); 11 | 12 | using namespace c74::min; 13 | 14 | 15 | class environment : public object { 16 | public: 17 | MIN_DESCRIPTION { "Get info about the current max environment." }; 18 | MIN_TAGS { "math" }; 19 | MIN_AUTHOR { "Cycling '74" }; 20 | MIN_RELATED { "gestalt" }; 21 | 22 | inlet<> in { this, "(bang) get info about the current max environment" }; 23 | outlet<> out_platform { this, "(symbol) platform" }; 24 | outlet<> out_arch { this, "(symbol) architecture" }; 25 | outlet<> out_os { this, "(symbol) operating system version" }; 26 | outlet<> out_macaddr { this, "(symbol) primary MAC address" }; 27 | outlet<> out_id { this, "(symbol) unique identifier" }; 28 | 29 | message<> bang {this, "bang", "Get info about the current max environment.", 30 | MIN_FUNCTION { 31 | out_id.send( min_environment_uniqueid() ); 32 | out_macaddr.send( min_environment_macaddr() ); 33 | out_os.send( min_environment_osversionstring() ); 34 | 35 | #ifdef C74_X64 36 | out_arch.send("x86_64"); 37 | #else // 32-bit 38 | out_arch.send("i386"); 39 | #endif 40 | 41 | #ifdef MAC_VERSION 42 | out_platform.send("mac"); 43 | #else // WIN_VERSION 44 | out_platform.send("win"); 45 | #endif 46 | 47 | return {}; 48 | } 49 | }; 50 | }; 51 | 52 | MIN_EXTERNAL(environment); 53 | -------------------------------------------------------------------------------- /source/projects/min.hello-world/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.hello-world/min.hello-world.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class hello_world : public object { 12 | public: 13 | MIN_DESCRIPTION {"Post to the Max Console."}; 14 | MIN_TAGS {"utilities"}; 15 | MIN_AUTHOR {"Cycling '74"}; 16 | MIN_RELATED {"print, jit.print, dict.print"}; 17 | 18 | inlet<> input { this, "(bang) post greeting to the max console" }; 19 | outlet<> output { this, "(anything) output the message which is posted to the max console" }; 20 | 21 | 22 | // define an optional argument for setting the message 23 | argument greeting_arg { this, "greeting", "Initial value for the greeting attribute.", 24 | MIN_ARGUMENT_FUNCTION { 25 | greeting = arg; 26 | } 27 | }; 28 | 29 | 30 | // the actual attribute for the message 31 | attribute greeting { this, "greeting", "hello world", 32 | description { 33 | "Greeting to be posted. " 34 | "The greeting will be posted to the Max console when a bang is received." 35 | } 36 | }; 37 | 38 | 39 | // respond to the bang message to do something 40 | message<> bang { this, "bang", "Post the greeting.", 41 | MIN_FUNCTION { 42 | symbol the_greeting = greeting; // fetch the symbol itself from the attribute named greeting 43 | 44 | cout << the_greeting << endl; // post to the max console 45 | output.send(the_greeting); // send out our outlet 46 | return {}; 47 | } 48 | }; 49 | 50 | 51 | // post to max window == but only when the class is loaded the first time 52 | message<> maxclass_setup { this, "maxclass_setup", 53 | MIN_FUNCTION { 54 | cout << "hello world" << endl; 55 | return {}; 56 | } 57 | }; 58 | 59 | }; 60 | 61 | 62 | MIN_EXTERNAL(hello_world); 63 | -------------------------------------------------------------------------------- /source/projects/min.hello-world/min.hello-world_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.hello-world.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | 12 | SCENARIO("object produces correct output") { 13 | ext_main(nullptr); // every unit test must call ext_main() once to configure the class 14 | 15 | GIVEN("An instance of our object") { 16 | 17 | test_wrapper an_instance; 18 | hello_world& my_object = an_instance; 19 | 20 | // check that default attr values are correct 21 | REQUIRE((my_object.greeting == symbol("hello world"))); 22 | 23 | // now proceed to testing various sequences of events 24 | WHEN("a 'bang' is received") { 25 | my_object.bang(); 26 | THEN("our greeting is produced at the outlet") { 27 | auto& output = *c74::max::object_getoutput(my_object, 0); 28 | REQUIRE((output.size() == 1)); 29 | REQUIRE((output[0].size() == 1)); 30 | REQUIRE((output[0][0] == symbol("hello world"))); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/projects/min.jit.clamp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.jit.clamp/min.jit.clamp.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | class jit_clamp : public object, public matrix_operator<> { 11 | public: 12 | MIN_DESCRIPTION { "Limit matrix values to a range. The range is specified the object's min and max attributes." }; 13 | MIN_TAGS { "math" }; 14 | MIN_AUTHOR { "Cycling '74" }; 15 | MIN_RELATED { "jit.clip" }; 16 | 17 | inlet<> input { this, "(matrix) Input", "matrix" }; 18 | outlet<> output { this, "(matrix) Output", "matrix" }; 19 | 20 | attribute min { this, "min", 0.0, 21 | description {"The minimum value below which clipping occurs."}, 22 | setter { MIN_FUNCTION { 23 | double in = args[0]; 24 | cmin = static_cast(clamp(255.0 * in, 0.0, 255.0)); 25 | return args; 26 | }}, 27 | getter { MIN_GETTER_FUNCTION { 28 | return {cmin / 255.0}; 29 | }} 30 | }; 31 | 32 | attribute max { this, "max", 1.0, 33 | description {"The maximum value above which clipping occurs."}, 34 | setter { MIN_FUNCTION { 35 | double in = args[0]; 36 | cmax = static_cast(clamp(255.0 * in, 0.0, 255.0)); 37 | return args; 38 | }}, 39 | getter { MIN_GETTER_FUNCTION { 40 | return {cmax / 255.0}; 41 | }} 42 | }; 43 | 44 | 45 | // This object process each cell independently 46 | // So we define "calc_cell" instead of "calc_matrix" 47 | 48 | template 49 | matrix_type calc_cell(matrix_type input, const matrix_info& info, matrix_coord& position) { 50 | matrix_type output; 51 | double fmin = min; 52 | double fmax = max; 53 | 54 | for (auto plane = 0; plane < info.plane_count(); ++plane) { 55 | auto dummy = input[plane]; 56 | output[plane] = clamp(input[plane], static_cast(fmin), static_cast(fmax)); 57 | } 58 | return output; 59 | } 60 | 61 | 62 | // We override the case for the char type to use the cached attribute values in the 0-255 range 63 | 64 | pixel calc_cell(pixel input, const matrix_info& info, matrix_coord& position) { 65 | pixel output; 66 | 67 | output[alpha] = clamp(input[alpha], cmin, cmax); 68 | output[red] = clamp(input[red], cmin, cmax); 69 | output[green] = clamp(input[green], cmin, cmax); 70 | output[blue] = clamp(input[blue], cmin, cmax); 71 | 72 | return output; 73 | } 74 | 75 | private: 76 | uchar cmin; 77 | uchar cmax; 78 | }; 79 | 80 | MIN_EXTERNAL(jit_clamp); 81 | -------------------------------------------------------------------------------- /source/projects/min.jit.stencil/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.jit.stencil/min.jit.stencil.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | class jit_stencil : public object, public matrix_operator<> { 11 | public: 12 | MIN_DESCRIPTION { "Apply a 5-point stencil operation to a matrix. See https://en.wikipedia.org/wiki/Five-point_stencil for more information." }; 13 | MIN_TAGS { "video, blur/sharpen" }; 14 | MIN_AUTHOR { "Cycling '74" }; 15 | MIN_RELATED { "jit.avg4" }; 16 | 17 | inlet<> input { this, "(matrix) Input", "matrix" }; 18 | outlet<> output { this, "(matrix) Output", "matrix" }; 19 | 20 | // TODO: mode attr for how to handle the edges 21 | 22 | attribute x {this, "x", 0, 23 | description {"The horizontal distance from each incoming cell to the source cells used for averaging."}, 24 | setter { MIN_FUNCTION { 25 | double value = args[0]; 26 | 27 | if (value < 0) 28 | value = 0; 29 | return {value}; 30 | }} 31 | }; 32 | 33 | attribute y {this, "y", 0, 34 | description {"The vertical distance from each incoming cell to the source cells used for averaging."}, 35 | setter { MIN_FUNCTION { 36 | double value = args[0]; 37 | 38 | if (value < 0) 39 | value = 0; 40 | return {value}; 41 | }} 42 | }; 43 | 44 | template 45 | cell calc_cell(cell input, const matrix_info& info, matrix_coord& position) { 46 | cell output; 47 | 48 | auto c1 = get_cell(info, position.x() + 0, position.y() - y); 49 | auto c2 = get_cell(info, position.x() + x, position.y() + 0); 50 | auto c3 = get_cell(info, position.x() + 0, position.y() + y); 51 | auto c4 = get_cell(info, position.x() - x, position.y() + 0); 52 | 53 | for (auto plane = 0; plane < info.plane_count(); ++plane) 54 | output[plane] = static_cast((input[plane] + c1[plane] + c2[plane] + c3[plane] + c4[plane]) / 5.0); 55 | 56 | return output; 57 | } 58 | 59 | private: 60 | template 61 | cell get_cell(const matrix_info& info, int x, int y) { 62 | auto x1 = clamp(x, 0, info.width() - 1); 63 | auto y1 = clamp(y, 0, info.height() - 1); 64 | auto c = info.in_cell(x1, y1); 65 | return c; 66 | } 67 | }; 68 | 69 | MIN_EXTERNAL(jit_stencil); 70 | -------------------------------------------------------------------------------- /source/projects/min.list.process/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.list.process/min.list.process_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.list.process.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | -------------------------------------------------------------------------------- /source/projects/min.markdown/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | "hoedown/src" 18 | ) 19 | 20 | 21 | if (WIN32) 22 | add_definitions( 23 | -D_CRT_SECURE_NO_WARNINGS 24 | ) 25 | endif () 26 | 27 | 28 | set( SOURCE_FILES 29 | ${PROJECT_NAME}.cpp 30 | "hoedown/src/autolink.c" 31 | "hoedown/src/buffer.c" 32 | "hoedown/src/document.c" 33 | "hoedown/src/escape.c" 34 | "hoedown/src/html.c" 35 | "hoedown/src/html_blocks.c" 36 | "hoedown/src/html_smartypants.c" 37 | "hoedown/src/stack.c" 38 | "hoedown/src/version.c" 39 | ) 40 | 41 | 42 | add_library( 43 | ${PROJECT_NAME} 44 | MODULE 45 | ${SOURCE_FILES} 46 | ) 47 | 48 | 49 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 50 | 51 | 52 | ############################################################# 53 | # UNIT TEST 54 | ############################################################# 55 | 56 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 57 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # Tab indentation (no size specified) 12 | [*.{c,h}] 13 | indent_style = tab 14 | 15 | # 4 space indentation 16 | [*.md] 17 | indent_style = space 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.obj 3 | *.exe 4 | hoedown 5 | hoedown.dll 6 | hoedown.exp 7 | hoedown.lib 8 | smartypants 9 | libhoedown.so* 10 | libhoedown.a 11 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | compiler: 3 | - clang 4 | - gcc 5 | perl: 6 | - "5.12" 7 | before_install: 8 | - sudo apt-get install -qq tidy 9 | script: make test 10 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008, Natacha Porté 2 | Copyright (c) 2011, Vicent Martí 3 | Copyright (c) 2014, Xavier Mendez, Devin Torres and the Hoedown authors 4 | 5 | Permission to use, copy, modify, and distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter 2 | PREFIX = /usr/local 3 | BINDIR = $(PREFIX)/bin 4 | LIBDIR = $(PREFIX)/lib 5 | INCLUDEDIR = $(PREFIX)/include 6 | 7 | HOEDOWN_CFLAGS = $(CFLAGS) -Isrc 8 | ifneq ($(OS),Windows_NT) 9 | HOEDOWN_CFLAGS += -fPIC 10 | endif 11 | 12 | SONAME = -soname 13 | ifeq ($(shell uname -s),Darwin) 14 | SONAME = -install_name 15 | endif 16 | 17 | HOEDOWN_SRC=\ 18 | src/autolink.o \ 19 | src/buffer.o \ 20 | src/document.o \ 21 | src/escape.o \ 22 | src/html.o \ 23 | src/html_blocks.o \ 24 | src/html_smartypants.o \ 25 | src/stack.o \ 26 | src/version.o 27 | 28 | .PHONY: all test test-pl clean 29 | 30 | all: libhoedown.so libhoedown.a hoedown smartypants 31 | 32 | # Libraries 33 | 34 | libhoedown.so: libhoedown.so.3 35 | ln -f -s $^ $@ 36 | 37 | libhoedown.so.3: $(HOEDOWN_SRC) 38 | $(CC) -Wl,$(SONAME),$(@F) -shared $^ $(LDFLAGS) -o $@ 39 | 40 | libhoedown.a: $(HOEDOWN_SRC) 41 | $(AR) rcs libhoedown.a $^ 42 | 43 | # Executables 44 | 45 | hoedown: bin/hoedown.o $(HOEDOWN_SRC) 46 | $(CC) $^ $(LDFLAGS) -o $@ 47 | 48 | smartypants: bin/smartypants.o $(HOEDOWN_SRC) 49 | $(CC) $^ $(LDFLAGS) -o $@ 50 | 51 | # Perfect hashing 52 | 53 | src/html_blocks.c: html_block_names.gperf 54 | gperf -L ANSI-C -N hoedown_find_block_tag -c -C -E -S 1 --ignore-case -m100 $^ > $@ 55 | 56 | # Testing 57 | 58 | test: hoedown 59 | python test/runner.py 60 | 61 | test-pl: hoedown 62 | perl test/MarkdownTest_1.0.3/MarkdownTest.pl \ 63 | --script=./hoedown --testdir=test/MarkdownTest_1.0.3/Tests --tidy 64 | 65 | # Housekeeping 66 | 67 | clean: 68 | $(RM) src/*.o bin/*.o 69 | $(RM) libhoedown.so libhoedown.so.1 libhoedown.a 70 | $(RM) hoedown smartypants hoedown.exe smartypants.exe 71 | 72 | # Installing 73 | 74 | install: 75 | install -m755 -d $(DESTDIR)$(LIBDIR) 76 | install -m755 -d $(DESTDIR)$(BINDIR) 77 | install -m755 -d $(DESTDIR)$(INCLUDEDIR) 78 | 79 | install -m644 libhoedown.a $(DESTDIR)$(LIBDIR) 80 | install -m755 libhoedown.so.3 $(DESTDIR)$(LIBDIR) 81 | ln -f -s libhoedown.so.3 $(DESTDIR)$(LIBDIR)/libhoedown.so 82 | 83 | install -m755 hoedown $(DESTDIR)$(BINDIR) 84 | install -m755 smartypants $(DESTDIR)$(BINDIR) 85 | 86 | install -m755 -d $(DESTDIR)$(INCLUDEDIR)/hoedown 87 | install -m644 src/*.h $(DESTDIR)$(INCLUDEDIR)/hoedown 88 | 89 | # Generic object compilations 90 | 91 | %.o: %.c 92 | $(CC) $(HOEDOWN_CFLAGS) -c -o $@ $< 93 | 94 | src/html_blocks.o: src/html_blocks.c 95 | $(CC) $(HOEDOWN_CFLAGS) -Wno-static-in-inline -c -o $@ $< 96 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/Makefile.win: -------------------------------------------------------------------------------- 1 | CC = cl 2 | CFLAGS = /O2 /sdl /Isrc /D_CRT_SECURE_NO_WARNINGS 3 | 4 | HOEDOWN_SRC = \ 5 | src\autolink.obj \ 6 | src\buffer.obj \ 7 | src\document.obj \ 8 | src\escape.obj \ 9 | src\html.obj \ 10 | src\html_blocks.obj \ 11 | src\html_smartypants.obj \ 12 | src\stack.obj \ 13 | src\version.obj 14 | 15 | all: hoedown.dll hoedown.exe smartypants.exe 16 | 17 | hoedown.dll: $(HOEDOWN_SRC) hoedown.def 18 | $(CC) $(HOEDOWN_SRC) hoedown.def /link /DLL $(LDFLAGS) /out:$@ 19 | 20 | hoedown.exe: bin\hoedown.obj $(HOEDOWN_SRC) 21 | $(CC) bin\hoedown.obj $(HOEDOWN_SRC) /link $(LDFLAGS) /out:$@ 22 | 23 | smartypants.exe: bin\smartypants.obj $(HOEDOWN_SRC) 24 | $(CC) bin\smartypants.obj $(HOEDOWN_SRC) /link $(LDFLAGS) /out:$@ 25 | 26 | # Housekeeping 27 | 28 | clean: 29 | del $(HOEDOWN_SRC) 30 | del hoedown.dll hoedown.exp hoedown.lib 31 | del hoedown.exe smartypants.exe 32 | 33 | # Generic object compilations 34 | 35 | .c.obj: 36 | $(CC) $(CFLAGS) /c $< /Fo$@ 37 | 38 | # Testing 39 | 40 | test: hoedown.exe 41 | python test\runner.py 42 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/bin/common.h: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define str(x) __str(x) 9 | #define __str(x) #x 10 | 11 | #define count_of(arr) (sizeof(arr)/sizeof(0[arr])) 12 | 13 | int 14 | parseint(const char *string, long *result) 15 | { 16 | char *end; 17 | errno = 0; 18 | *result = strtol(string, &end, 10); 19 | return !(*end || errno); 20 | } 21 | 22 | const char * 23 | strprefix(const char *str, const char *prefix) 24 | { 25 | while (*prefix) { 26 | if (!(*str && *str == *prefix)) return 0; 27 | prefix++; str++; 28 | } 29 | return str; 30 | } 31 | 32 | void 33 | print_option(char short_opt, const char *long_opt, const char *description) 34 | { 35 | if (short_opt) 36 | printf(" -%c, ", short_opt); 37 | else 38 | printf(" "); 39 | 40 | printf("--%-13s %s\n", long_opt, description); 41 | } 42 | 43 | void 44 | print_version() 45 | { 46 | printf("Built with Hoedown " HOEDOWN_VERSION ".\n"); 47 | } 48 | 49 | int 50 | parse_options( 51 | int argc, char **argv, 52 | int(*parse_short_option)(char opt, char *next, void *opaque), 53 | int(*parse_long_option)(char *opt, char *next, void *opaque), 54 | int(*parse_argument)(int argn, char *arg, int is_forced, void *opaque), 55 | void *opaque) 56 | { 57 | int result; 58 | int i = 1, regular_args = 0; 59 | 60 | /* Parse options mixed with arguments */ 61 | while (i < argc) { 62 | char *arg = argv[i]; 63 | 64 | if (arg[0] == '-' && arg[1]) { 65 | char *next_arg = (i+1 < argc) ? argv[i+1] : NULL; 66 | 67 | if (arg[1] == '-' && !arg[2]) { 68 | /* '--' signals end of options */ 69 | i++; 70 | break; 71 | } 72 | 73 | if (arg[1] == '-') { 74 | /* Long option */ 75 | result = parse_long_option(arg + 2, next_arg, opaque); 76 | if (!result) return 0; 77 | i += result; 78 | } else { 79 | /* Sequence of short options */ 80 | size_t pos; 81 | for (pos = 1; arg[pos]; pos++) { 82 | char *next = (arg[pos+1]) ? arg + pos+1 : next_arg; 83 | result = parse_short_option(arg[pos], next, opaque); 84 | if (!result) return 0; 85 | if (result == 2) { 86 | if (next == next_arg) i++; 87 | break; 88 | } 89 | } 90 | i++; 91 | } 92 | } else { 93 | /* Argument */ 94 | result = parse_argument(regular_args++, arg, 0, opaque); 95 | if (!result) return 0; 96 | i++; 97 | } 98 | } 99 | 100 | /* Parse rest as forced arguments */ 101 | while (i < argc) { 102 | result = parse_argument(regular_args++, argv[i], 1, opaque); 103 | if (!result) return 0; 104 | i++; 105 | } 106 | 107 | return 1; 108 | } 109 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/hoedown.def: -------------------------------------------------------------------------------- 1 | LIBRARY HOEDOWN 2 | EXPORTS 3 | hoedown_autolink_is_safe 4 | hoedown_autolink__www 5 | hoedown_autolink__email 6 | hoedown_autolink__url 7 | hoedown_buffer_init 8 | hoedown_buffer_new 9 | hoedown_buffer_reset 10 | hoedown_buffer_grow 11 | hoedown_buffer_put 12 | hoedown_buffer_puts 13 | hoedown_buffer_putc 14 | hoedown_buffer_set 15 | hoedown_buffer_sets 16 | hoedown_buffer_eq 17 | hoedown_buffer_eqs 18 | hoedown_buffer_prefix 19 | hoedown_buffer_slurp 20 | hoedown_buffer_cstr 21 | hoedown_buffer_printf 22 | hoedown_buffer_free 23 | hoedown_document_new 24 | hoedown_document_render 25 | hoedown_document_render_inline 26 | hoedown_document_free 27 | hoedown_escape_href 28 | hoedown_escape_html 29 | hoedown_html_smartypants 30 | hoedown_html_is_tag 31 | hoedown_html_renderer_new 32 | hoedown_html_toc_renderer_new 33 | hoedown_html_renderer_free 34 | hoedown_stack_init 35 | hoedown_stack_uninit 36 | hoedown_stack_grow 37 | hoedown_stack_push 38 | hoedown_stack_pop 39 | hoedown_stack_top 40 | hoedown_version 41 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/html_block_names.gperf: -------------------------------------------------------------------------------- 1 | p 2 | dl 3 | h1 4 | h2 5 | h3 6 | h4 7 | h5 8 | h6 9 | ol 10 | ul 11 | del 12 | div 13 | ins 14 | pre 15 | form 16 | math 17 | style 18 | table 19 | figure 20 | iframe 21 | script 22 | fieldset 23 | noscript 24 | blockquote 25 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/src/autolink.h: -------------------------------------------------------------------------------- 1 | /* autolink.h - versatile autolinker */ 2 | 3 | #ifndef HOEDOWN_AUTOLINK_H 4 | #define HOEDOWN_AUTOLINK_H 5 | 6 | #include "buffer.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | /************* 14 | * CONSTANTS * 15 | *************/ 16 | 17 | typedef enum hoedown_autolink_flags { 18 | HOEDOWN_AUTOLINK_SHORT_DOMAINS = (1 << 0) 19 | } hoedown_autolink_flags; 20 | 21 | 22 | /************* 23 | * FUNCTIONS * 24 | *************/ 25 | 26 | /* hoedown_autolink_is_safe: verify that a URL has a safe protocol */ 27 | int hoedown_autolink_is_safe(const uint8_t *data, size_t size); 28 | 29 | /* hoedown_autolink__www: search for the next www link in data */ 30 | size_t hoedown_autolink__www(size_t *rewind_p, hoedown_buffer *link, 31 | uint8_t *data, size_t offset, size_t size, hoedown_autolink_flags flags); 32 | 33 | /* hoedown_autolink__email: search for the next email in data */ 34 | size_t hoedown_autolink__email(size_t *rewind_p, hoedown_buffer *link, 35 | uint8_t *data, size_t offset, size_t size, hoedown_autolink_flags flags); 36 | 37 | /* hoedown_autolink__url: search for the next URL in data */ 38 | size_t hoedown_autolink__url(size_t *rewind_p, hoedown_buffer *link, 39 | uint8_t *data, size_t offset, size_t size, hoedown_autolink_flags flags); 40 | 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /** HOEDOWN_AUTOLINK_H **/ 47 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/src/escape.h: -------------------------------------------------------------------------------- 1 | /* escape.h - escape utilities */ 2 | 3 | #ifndef HOEDOWN_ESCAPE_H 4 | #define HOEDOWN_ESCAPE_H 5 | 6 | #include "buffer.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | /************* 14 | * FUNCTIONS * 15 | *************/ 16 | 17 | /* hoedown_escape_href: escape (part of) a URL inside HTML */ 18 | void hoedown_escape_href(hoedown_buffer *ob, const uint8_t *data, size_t size); 19 | 20 | /* hoedown_escape_html: escape HTML */ 21 | void hoedown_escape_html(hoedown_buffer *ob, const uint8_t *data, size_t size, int secure); 22 | 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif /** HOEDOWN_ESCAPE_H **/ 29 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/src/html.h: -------------------------------------------------------------------------------- 1 | /* html.h - HTML renderer and utilities */ 2 | 3 | #ifndef HOEDOWN_HTML_H 4 | #define HOEDOWN_HTML_H 5 | 6 | #include "document.h" 7 | #include "buffer.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | /************* 15 | * CONSTANTS * 16 | *************/ 17 | 18 | typedef enum hoedown_html_flags { 19 | HOEDOWN_HTML_SKIP_HTML = (1 << 0), 20 | HOEDOWN_HTML_ESCAPE = (1 << 1), 21 | HOEDOWN_HTML_HARD_WRAP = (1 << 2), 22 | HOEDOWN_HTML_USE_XHTML = (1 << 3) 23 | } hoedown_html_flags; 24 | 25 | typedef enum hoedown_html_tag { 26 | HOEDOWN_HTML_TAG_NONE = 0, 27 | HOEDOWN_HTML_TAG_OPEN, 28 | HOEDOWN_HTML_TAG_CLOSE 29 | } hoedown_html_tag; 30 | 31 | 32 | /********* 33 | * TYPES * 34 | *********/ 35 | 36 | struct hoedown_html_renderer_state { 37 | void *opaque; 38 | 39 | struct { 40 | int header_count; 41 | int current_level; 42 | int level_offset; 43 | int nesting_level; 44 | } toc_data; 45 | 46 | hoedown_html_flags flags; 47 | 48 | /* extra callbacks */ 49 | void (*link_attributes)(hoedown_buffer *ob, const hoedown_buffer *url, const hoedown_renderer_data *data); 50 | }; 51 | typedef struct hoedown_html_renderer_state hoedown_html_renderer_state; 52 | 53 | 54 | /************* 55 | * FUNCTIONS * 56 | *************/ 57 | 58 | /* hoedown_html_smartypants: process an HTML snippet using SmartyPants for smart punctuation */ 59 | void hoedown_html_smartypants(hoedown_buffer *ob, const uint8_t *data, size_t size); 60 | 61 | /* hoedown_html_is_tag: checks if data starts with a specific tag, returns the tag type or NONE */ 62 | hoedown_html_tag hoedown_html_is_tag(const uint8_t *data, size_t size, const char *tagname); 63 | 64 | 65 | /* hoedown_html_renderer_new: allocates a regular HTML renderer */ 66 | hoedown_renderer *hoedown_html_renderer_new( 67 | hoedown_html_flags render_flags, 68 | int nesting_level 69 | ) __attribute__ ((malloc)); 70 | 71 | /* hoedown_html_toc_renderer_new: like hoedown_html_renderer_new, but the returned renderer produces the Table of Contents */ 72 | hoedown_renderer *hoedown_html_toc_renderer_new( 73 | int nesting_level 74 | ) __attribute__ ((malloc)); 75 | 76 | /* hoedown_html_renderer_free: deallocate an HTML renderer */ 77 | void hoedown_html_renderer_free(hoedown_renderer *renderer); 78 | 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | #endif /** HOEDOWN_HTML_H **/ 85 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/src/stack.c: -------------------------------------------------------------------------------- 1 | #include "stack.h" 2 | 3 | #include "buffer.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | void 10 | hoedown_stack_init(hoedown_stack *st, size_t initial_size) 11 | { 12 | assert(st); 13 | 14 | st->item = NULL; 15 | st->size = st->asize = 0; 16 | 17 | if (!initial_size) 18 | initial_size = 8; 19 | 20 | hoedown_stack_grow(st, initial_size); 21 | } 22 | 23 | void 24 | hoedown_stack_uninit(hoedown_stack *st) 25 | { 26 | assert(st); 27 | 28 | free(st->item); 29 | } 30 | 31 | void 32 | hoedown_stack_grow(hoedown_stack *st, size_t neosz) 33 | { 34 | assert(st); 35 | 36 | if (st->asize >= neosz) 37 | return; 38 | 39 | st->item = hoedown_realloc(st->item, neosz * sizeof(void *)); 40 | memset(st->item + st->asize, 0x0, (neosz - st->asize) * sizeof(void *)); 41 | 42 | st->asize = neosz; 43 | 44 | if (st->size > neosz) 45 | st->size = neosz; 46 | } 47 | 48 | void 49 | hoedown_stack_push(hoedown_stack *st, void *item) 50 | { 51 | assert(st); 52 | 53 | if (st->size >= st->asize) 54 | hoedown_stack_grow(st, st->size * 2); 55 | 56 | st->item[st->size++] = item; 57 | } 58 | 59 | void * 60 | hoedown_stack_pop(hoedown_stack *st) 61 | { 62 | assert(st); 63 | 64 | if (!st->size) 65 | return NULL; 66 | 67 | return st->item[--st->size]; 68 | } 69 | 70 | void * 71 | hoedown_stack_top(const hoedown_stack *st) 72 | { 73 | assert(st); 74 | 75 | if (!st->size) 76 | return NULL; 77 | 78 | return st->item[st->size - 1]; 79 | } 80 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/src/stack.h: -------------------------------------------------------------------------------- 1 | /* stack.h - simple stacking */ 2 | 3 | #ifndef HOEDOWN_STACK_H 4 | #define HOEDOWN_STACK_H 5 | 6 | #include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | /********* 14 | * TYPES * 15 | *********/ 16 | 17 | struct hoedown_stack { 18 | void **item; 19 | size_t size; 20 | size_t asize; 21 | }; 22 | typedef struct hoedown_stack hoedown_stack; 23 | 24 | 25 | /************* 26 | * FUNCTIONS * 27 | *************/ 28 | 29 | /* hoedown_stack_init: initialize a stack */ 30 | void hoedown_stack_init(hoedown_stack *st, size_t initial_size); 31 | 32 | /* hoedown_stack_uninit: free internal data of the stack */ 33 | void hoedown_stack_uninit(hoedown_stack *st); 34 | 35 | /* hoedown_stack_grow: increase the allocated size to the given value */ 36 | void hoedown_stack_grow(hoedown_stack *st, size_t neosz); 37 | 38 | /* hoedown_stack_push: push an item to the top of the stack */ 39 | void hoedown_stack_push(hoedown_stack *st, void *item); 40 | 41 | /* hoedown_stack_pop: retrieve and remove the item at the top of the stack */ 42 | void *hoedown_stack_pop(hoedown_stack *st); 43 | 44 | /* hoedown_stack_top: retrieve the item at the top of the stack */ 45 | void *hoedown_stack_top(const hoedown_stack *st); 46 | 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /** HOEDOWN_STACK_H **/ 53 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/src/version.c: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | void 4 | hoedown_version(int *major, int *minor, int *revision) 5 | { 6 | *major = HOEDOWN_VERSION_MAJOR; 7 | *minor = HOEDOWN_VERSION_MINOR; 8 | *revision = HOEDOWN_VERSION_REVISION; 9 | } 10 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/src/version.h: -------------------------------------------------------------------------------- 1 | /* version.h - holds Hoedown's version */ 2 | 3 | #ifndef HOEDOWN_VERSION_H 4 | #define HOEDOWN_VERSION_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | 11 | /************* 12 | * CONSTANTS * 13 | *************/ 14 | 15 | #define HOEDOWN_VERSION "3.0.7" 16 | #define HOEDOWN_VERSION_MAJOR 3 17 | #define HOEDOWN_VERSION_MINOR 0 18 | #define HOEDOWN_VERSION_REVISION 7 19 | 20 | 21 | /************* 22 | * FUNCTIONS * 23 | *************/ 24 | 25 | /* hoedown_version: retrieve Hoedown's version numbers */ 26 | void hoedown_version(int *major, int *minor, int *revision); 27 | 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif /** HOEDOWN_VERSION_H **/ 34 | -------------------------------------------------------------------------------- /source/projects/min.markdown/hoedown/test/runner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import difflib 5 | import json 6 | import os 7 | import re 8 | import subprocess 9 | import unittest 10 | 11 | TEST_ROOT = os.path.dirname(__file__) 12 | PROJECT_ROOT = os.path.dirname(TEST_ROOT) 13 | HOEDOWN = [os.path.abspath(os.path.join(PROJECT_ROOT, 'hoedown'))] 14 | TIDY = ['tidy', '--show-body-only', '1', '--show-warnings', '0', 15 | '--quiet', '1'] 16 | CONFIG_PATH = os.path.join(TEST_ROOT, 'config.json') 17 | SLUGIFY_PATTERN = re.compile(r'\W') 18 | 19 | 20 | def with_metaclass(meta, *bases): 21 | """Metaclass injection utility from six. 22 | 23 | See: https://pythonhosted.org/six/ 24 | """ 25 | class metaclass(meta): 26 | def __new__(cls, name, this_bases, d): 27 | return meta(name, bases, d) 28 | return type.__new__(metaclass, 'temporary_class', (), {}) 29 | 30 | 31 | class TestFailed(AssertionError): 32 | def __init__(self, name, expected, got): 33 | super(TestFailed, self).__init__(self) 34 | diff = difflib.unified_diff( 35 | expected.splitlines(), got.splitlines(), 36 | fromfile='Expected', tofile='Got', 37 | ) 38 | self.description = '{name}\n{diff}'.format( 39 | name=name, diff='\n'.join(diff), 40 | ) 41 | 42 | def __str__(self): 43 | return self.description 44 | 45 | 46 | def _test_func(test_case): 47 | flags = test_case.get('flags') or [] 48 | hoedown_proc = subprocess.Popen( 49 | HOEDOWN + flags + [os.path.join(TEST_ROOT, test_case['input'])], 50 | stdout=subprocess.PIPE, 51 | ) 52 | stdoutdata = hoedown_proc.communicate()[0] 53 | 54 | got_tidy_proc = subprocess.Popen( 55 | TIDY, stdin=subprocess.PIPE, stdout=subprocess.PIPE, 56 | ) 57 | got = got_tidy_proc.communicate(input=stdoutdata)[0].strip() 58 | 59 | expected_tidy_proc = subprocess.Popen( 60 | TIDY + [os.path.join(TEST_ROOT, test_case['output'])], 61 | stdout=subprocess.PIPE, 62 | ) 63 | expected = expected_tidy_proc.communicate()[0].strip() 64 | 65 | # Cleanup. 66 | hoedown_proc.stdout.close() 67 | got_tidy_proc.stdout.close() 68 | expected_tidy_proc.stdout.close() 69 | 70 | try: 71 | assert expected == got 72 | except AssertionError: 73 | raise TestFailed(test_case['input'], expected, got) 74 | 75 | 76 | def _make_test(test_case): 77 | return lambda self: _test_func(test_case) 78 | 79 | 80 | class MarkdownTestsMeta(type): 81 | """Meta class for ``MarkdownTestCase`` to inject test cases on the fly. 82 | """ 83 | def __new__(meta, name, bases, attrs): 84 | with open(CONFIG_PATH) as f: 85 | config = json.load(f) 86 | 87 | for test in config['tests']: 88 | input_name = test['input'] 89 | attr_name = 'test_' + SLUGIFY_PATTERN.sub( 90 | '_', os.path.splitext(input_name)[0].lower(), 91 | ) 92 | func = _make_test(test) 93 | func.__doc__ = input_name 94 | if test.get('skip', False): 95 | func = unittest.skip(input_name)(func) 96 | if test.get('fail', False): 97 | func = unittest.expectsFailure(func) 98 | attrs[attr_name] = func 99 | return type.__new__(meta, name, bases, attrs) 100 | 101 | 102 | class MarkdownTests(with_metaclass(MarkdownTestsMeta, unittest.TestCase)): 103 | pass 104 | 105 | 106 | if __name__ == '__main__': 107 | unittest.main() 108 | -------------------------------------------------------------------------------- /source/projects/min.markdown/min.markdown.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | #include "hoedown/src/document.h" 8 | #include "hoedown/src/html.h" 9 | #include 10 | 11 | using namespace c74::min; 12 | 13 | 14 | class markdown : public object { 15 | public: 16 | MIN_DESCRIPTION { "Get the approximate value of pi." }; 17 | MIN_TAGS { "math" }; 18 | MIN_AUTHOR { "Cycling '74" }; 19 | MIN_RELATED { "sin, cos, atan~, jit.op, gen~" }; 20 | 21 | inlet<> input { this, "(bang) get the approximate value of pi" }; 22 | outlet<> output { this, "(number) approximate value of pi" }; 23 | 24 | message<> read { this, "read", "Markdown file to read", 25 | MIN_FUNCTION { 26 | try { 27 | path p {args}; 28 | std::ifstream in {p}; 29 | std::string s {std::istreambuf_iterator(in), std::istreambuf_iterator()}; 30 | hoedown_renderer* renderer {hoedown_html_renderer_new(static_cast(0), 16)}; 31 | hoedown_buffer* buffer {hoedown_buffer_new(100)}; 32 | 33 | static const std::size_t nesting_depth = 16; 34 | int extensions = HOEDOWN_EXT_FENCED_CODE; 35 | auto document = hoedown_document_new(renderer, static_cast(extensions), nesting_depth); 36 | 37 | hoedown_document_render(document, buffer, reinterpret_cast(&s[0]), s.size()); 38 | 39 | string out {hoedown_buffer_cstr(buffer)}; 40 | std::regex rex {"\\\""}; 41 | string out2 {std::regex_replace(out, rex, "'")}; 42 | std::regex rex2 {"src=\""}; 43 | string out3 {std::regex_replace(out2, rex2, "src='")}; 44 | 45 | std::regex rexp {"

"}; 46 | string out4 {std::regex_replace(out3, rexp, "
")}; 47 | std::regex rexp2 {"

"}; 48 | string out5 {std::regex_replace(out4, rexp2, "
")}; 49 | 50 | auto maxstring {c74::max::string_new(out5.c_str())}; 51 | atom a {maxstring}; 52 | 53 | output.send("set", a); 54 | 55 | object_free(maxstring); 56 | hoedown_buffer_free(buffer); 57 | hoedown_html_renderer_free(renderer); 58 | } 59 | catch (...) { 60 | cerr << "Could not read file" << endl; 61 | } 62 | 63 | return {}; 64 | } 65 | }; 66 | 67 | }; 68 | 69 | MIN_EXTERNAL(markdown); 70 | -------------------------------------------------------------------------------- /source/projects/min.meter_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | 4 | set ( MSVC_COMPILER_NAME "MSVC" ) 5 | if (${CMAKE_CXX_COMPILER_ID} STREQUAL ${MSVC_COMPILER_NAME}) 6 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 0 4 MSVC_VERSION_SHORT) 7 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 0 2 MSVC_VERSION_MAJOR) 8 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 3 1 MSVC_VERSION_MINOR) 9 | 10 | if (${MSVC_VERSION_MAJOR} VERSION_LESS 19 OR ${MSVC_VERSION_MAJOR} MATCHES 19 AND ${MSVC_VERSION_MINOR} VERSION_LESS 1) 11 | # message(STATUS "Visual Studio ${MSVC_VERSION_SHORT} detected. Visual Studio 17 (19.1) or greater is required for UI objects.") 12 | message(STATUS "Visual Studio 17 or greater is required for UI objects.") 13 | message(STATUS "SKIPPING!") 14 | return () 15 | endif () 16 | endif () 17 | 18 | 19 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 20 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 21 | 22 | 23 | ############################################################# 24 | # MAX EXTERNAL 25 | ############################################################# 26 | 27 | 28 | include_directories( 29 | "${C74_INCLUDES}" 30 | ) 31 | 32 | 33 | set( SOURCE_FILES 34 | ${PROJECT_NAME}.cpp 35 | ) 36 | 37 | 38 | add_library( 39 | ${PROJECT_NAME} 40 | MODULE 41 | ${SOURCE_FILES} 42 | ) 43 | 44 | 45 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 46 | 47 | 48 | ############################################################# 49 | # UNIT TEST 50 | ############################################################# 51 | 52 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 53 | -------------------------------------------------------------------------------- /source/projects/min.meter_tilde/min.meter_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | using namespace c74::min::ui; 10 | 11 | class min_meter : public object, public ui_operator<140, 24>, public sample_operator<1, 0> { 12 | public: 13 | MIN_DESCRIPTION { "Show audio gain levels" }; 14 | MIN_TAGS { "ui" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "meter~, live.meter~" }; 17 | 18 | inlet<> input { this, "(signal) audio to measure / visualize" }; 19 | outlet<> output { this, "(number) value" }; 20 | 21 | min_meter(const atoms& args = {}) 22 | : ui_operator::ui_operator {this, args} { 23 | m_timer.delay(40); 24 | } 25 | 26 | attribute m_range { this, "range", { {0.0, 1.0}} }; 27 | attribute m_offset { this, "offset", { {10.0, 10.0}} }; 28 | attribute m_label { this, "label", "" }; 29 | attribute m_fontname { this, "fontname", "lato-light" }; 30 | attribute m_fontsize { this, "fontsize", 14.0 }; 31 | attribute m_bgcolor {this, "bgcolor", color::predefined::black, title {"Background Color"}}; 32 | attribute m_elementcolor {this, "elementcolor", color::predefined::white}; 33 | attribute m_knobcolor {this, "knobcolor", color::predefined::gray, title {"Knob Color"}}; 34 | 35 | message<> paint { this, "paint", 36 | MIN_FUNCTION { 37 | target t {args}; 38 | auto value = (m_value - m_range[0]) / (m_range[1] - m_range[0]); 39 | auto pos = ((t.width() - 3) * value) + 1; // one pixel for each border and -1 for counting to N-1 40 | 41 | rect {// background 42 | t, 43 | color {m_bgcolor} 44 | }; 45 | rect<> {// frame 46 | t, 47 | color {{0.3, 0.3, 0.3, 1.0}}, 48 | line_width {3.0} 49 | }; 50 | rect {// active part of the slider 51 | t, 52 | color {m_elementcolor}, 53 | position {1.0, 1.0}, 54 | size {pos, -2.0} 55 | }; 56 | rect {// slider knob 57 | t, 58 | color {m_knobcolor}, 59 | position {pos, 1.0}, 60 | size {4.0, -2.0} 61 | }; 62 | text {// text display 63 | t, color {color::predefined::white}, 64 | position {m_offset[0], m_offset[1] + m_fontsize * 0.5}, 65 | fontface {m_fontname}, 66 | fontsize {m_fontsize}, 67 | content {static_cast(m_label)} 68 | }; 69 | return {}; 70 | } 71 | }; 72 | 73 | timer m_timer { this, 74 | MIN_FUNCTION { 75 | m_value = MIN_CLAMP(m_unclipped_value, m_range[0], m_range[1]); 76 | redraw(); 77 | output.send(m_unclipped_value); 78 | m_timer.delay(40); 79 | return {}; 80 | } 81 | }; 82 | 83 | void operator()(sample input) { 84 | m_unclipped_value = input; 85 | } 86 | 87 | private: 88 | number m_unclipped_value {0.0}; 89 | number m_value; 90 | }; 91 | 92 | MIN_EXTERNAL(min_meter); 93 | -------------------------------------------------------------------------------- /source/projects/min.multitouch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | 4 | set ( MSVC_COMPILER_NAME "MSVC" ) 5 | if (${CMAKE_CXX_COMPILER_ID} STREQUAL ${MSVC_COMPILER_NAME}) 6 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 0 4 MSVC_VERSION_SHORT) 7 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 0 2 MSVC_VERSION_MAJOR) 8 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 3 1 MSVC_VERSION_MINOR) 9 | 10 | if (${MSVC_VERSION_MAJOR} VERSION_LESS 19 OR ${MSVC_VERSION_MAJOR} MATCHES 19 AND ${MSVC_VERSION_MINOR} VERSION_LESS 1) 11 | # message(STATUS "Visual Studio ${MSVC_VERSION_SHORT} detected. Visual Studio 17 (19.1) or greater is required for UI objects.") 12 | message(STATUS "Visual Studio 17 or greater is required for UI objects.") 13 | message(STATUS "SKIPPING!") 14 | return () 15 | endif () 16 | endif () 17 | 18 | 19 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 20 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 21 | 22 | 23 | ############################################################# 24 | # MAX EXTERNAL 25 | ############################################################# 26 | 27 | 28 | include_directories( 29 | "${C74_INCLUDES}" 30 | ) 31 | 32 | 33 | set( SOURCE_FILES 34 | ${PROJECT_NAME}.cpp 35 | ) 36 | 37 | 38 | add_library( 39 | ${PROJECT_NAME} 40 | MODULE 41 | ${SOURCE_FILES} 42 | ) 43 | 44 | 45 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 46 | 47 | 48 | ############################################################# 49 | # UNIT TEST 50 | ############################################################# 51 | 52 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 53 | -------------------------------------------------------------------------------- /source/projects/min.note.make/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.note.make/min.note.make_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.note.make.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | 12 | SCENARIO("object produces correct output") { 13 | ext_main(nullptr); // every unit test must call ext_main() once to configure the class 14 | 15 | GIVEN("An instance of our object") { 16 | 17 | test_wrapper an_instance; 18 | note_make& my_object = an_instance; 19 | 20 | UNUSED(my_object); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/projects/min.pan_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ../shared/signal_routing_objects.h 23 | ../shared/signal_routing_objects.cpp 24 | ) 25 | 26 | 27 | add_library( 28 | ${PROJECT_NAME} 29 | MODULE 30 | ${SOURCE_FILES} 31 | ) 32 | 33 | 34 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 35 | 36 | 37 | ############################################################# 38 | # UNIT TEST 39 | ############################################################# 40 | 41 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 42 | -------------------------------------------------------------------------------- /source/projects/min.pan_tilde/min.pan_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | #include "../shared/signal_routing_objects.h" 8 | 9 | // The xfade~ object inherits all of it's attributes and messages from the signal_routing_base class. 10 | // The panner~ object does exactly the same, allowing us to share the code between the two similar but opposite classes. 11 | 12 | class panner : public signal_routing_base, public sample_operator<2, 2> { 13 | public: 14 | MIN_DESCRIPTION {"Pan an input to two outputs."}; 15 | MIN_TAGS {"audio, routing"}; 16 | MIN_AUTHOR {"Cycling '74"}; 17 | MIN_RELATED {"xfade~, matrix~"}; 18 | 19 | inlet<> in1 {this, "(signal) Input 1"}; 20 | inlet<> in_pos {this, "(signal) Position between them (0..1)"}; 21 | outlet<> out1 {this, "(signal) Left Output", "signal"}; 22 | outlet<> out2 {this, "(signal) Right Output", "signal"}; 23 | 24 | 25 | /// Process one sample 26 | 27 | samples<2> operator()(sample input, sample position = 0.5) { 28 | auto weight1 = this->weight1; 29 | auto weight2 = this->weight2; 30 | 31 | if (in_pos.has_signal_connection()) 32 | std::tie(weight1, weight2) = calculate_weights(mode, position); 33 | 34 | return { {input * weight1, input * weight2}}; 35 | } 36 | }; 37 | 38 | MIN_EXTERNAL(panner); 39 | -------------------------------------------------------------------------------- /source/projects/min.pan_tilde/min.pan_tilde_test.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min_unittest.h" // required unit test header 7 | #include "min.pan_tilde.cpp" // need the source of our object so that we can access it 8 | 9 | // Unit tests are written using the Catch framework as described at 10 | // https://github.com/philsquared/Catch/blob/master/docs/tutorial.md 11 | 12 | SCENARIO("object produces correct output") { 13 | ext_main(nullptr); // every unit test must call ext_main() once to configure the class 14 | 15 | GIVEN("An instance of panner~") { 16 | 17 | test_wrapper an_instance; 18 | panner& my_object = an_instance; 19 | 20 | // check that default attr values are correct 21 | 22 | REQUIRE((my_object.shape == symbol("equal_power"))); // note: symbols can be compared with strings 23 | REQUIRE((my_object.mode == symbol("fast"))); 24 | REQUIRE((my_object.position == Approx(0.5))); // note: floating-point values may be subject to rounding errors 25 | 26 | // now proceed to testing various sequences of events 27 | 28 | WHEN("the defaults are used") { 29 | THEN("the output is equal-power") { 30 | 31 | // args are the audio inputs: source-1, source-2, and position (optional) 32 | 33 | auto result = my_object(1.0); 34 | 35 | // the default mode is 'fast', which means a 512-point lookup table is used 36 | // thus we have 9-bits of resolution and the quantization error for that is -56 dB 37 | // which calculates out to approx 0.00195 -- so we use that as epsilon 38 | // to determine the amount of acceptable deviation in our check below 39 | 40 | REQUIRE(result[0] == Approx(std::sqrt(2.0) / 2.0).epsilon(0.00195)); 41 | REQUIRE(result[1] == Approx(std::sqrt(2.0) / 2.0).epsilon(0.00195)); 42 | } 43 | } 44 | 45 | AND_WHEN("The mode is set to 'precision'") { 46 | THEN("the results are more accurate") { 47 | 48 | // set attributes, including symbol attributes, by simply assigning them 49 | 50 | my_object.mode = "precision"; 51 | 52 | auto result = my_object(1.0); 53 | 54 | // and now we don't need to define a custom epsilon because there is no quantization error 55 | 56 | REQUIRE(result[0] == Approx(std::sqrt(2.0) / 2.0)); 57 | REQUIRE(result[1] == Approx(std::sqrt(2.0) / 2.0)); 58 | } 59 | AND_THEN("due to quantization of the lookup table 'precision' won't be the same as 'fast'") { 60 | 61 | // this is a way we can check that the object is actually doing something different 62 | // internally when we change the attribute value 63 | 64 | my_object.mode = "precision"; 65 | auto result_precision = my_object(1.0)[0]; 66 | 67 | my_object.mode = "fast"; 68 | auto result_fast = my_object(1.0)[0]; 69 | 70 | REQUIRE(result_precision != Approx(result_fast)); 71 | } 72 | } 73 | 74 | AND_WHEN("The shape is set to 'linear'") { 75 | THEN("we produce a roughly -6db downpoint in the middle of the fade for both 'fast' and 'precision' modes") { 76 | 77 | panner a_new_panner_object; // make a fresh object so we don't rely on some messy state from above 78 | 79 | a_new_panner_object.shape = "linear"; 80 | a_new_panner_object.mode = "precision"; 81 | a_new_panner_object.position = 0.5; 82 | 83 | auto result = a_new_panner_object(1.0); 84 | 85 | REQUIRE(result[0] == Approx(0.5)); 86 | REQUIRE(result[1] == Approx(0.5)); 87 | 88 | 89 | a_new_panner_object.mode = "fast"; 90 | 91 | auto result_b = a_new_panner_object(1.0); 92 | 93 | REQUIRE(result_b[0] == Approx(0.5).epsilon(std::numeric_limits::epsilon()*100000)); 94 | REQUIRE(result_b[1] == Approx(0.5).epsilon(std::numeric_limits::epsilon()*100000)); 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /source/projects/min.patcher.control/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.patcher.control/min.patcher.control.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2020 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class patcher_control : public object { 12 | public: 13 | MIN_DESCRIPTION { "Control or query a patcher" }; 14 | MIN_TAGS { "developer" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "pcontrol, thispatcher" }; 17 | 18 | inlet<> m_in { this, "(anything) query or control the patcher" }; 19 | outlet<> m_out { this, "(anything) query responses" }; 20 | 21 | 22 | message<> m_box_count { this, "box_count", "Return the total number of boxes in this patcher.", 23 | MIN_FUNCTION { 24 | auto p = patcher(); 25 | auto boxes = p.boxes(); 26 | 27 | m_out.send(boxes.size()); 28 | return {}; 29 | } 30 | }; 31 | 32 | message<> m_classnames { this, "classnames", "Return the classnames of all boxes in this patcher.", 33 | MIN_FUNCTION { 34 | auto p = patcher(); 35 | auto boxes = p.boxes(); 36 | atoms as {}; 37 | 38 | for (const auto& b : boxes) 39 | as.push_back(b.classname()); 40 | m_out.send(as); 41 | return {}; 42 | } 43 | }; 44 | 45 | message<> m_boxpaths { this, "boxpaths", "Return the paths of all boxes in this patcher.", 46 | MIN_FUNCTION { 47 | auto p = patcher(); 48 | auto boxes = p.boxes(); 49 | atoms as {}; 50 | 51 | for (const auto& b : boxes) 52 | as.push_back(b.path()); 53 | m_out.send(as); 54 | return {}; 55 | } 56 | }; 57 | 58 | 59 | 60 | private: 61 | 62 | }; 63 | 64 | MIN_EXTERNAL(patcher_control); 65 | -------------------------------------------------------------------------------- /source/projects/min.phasor_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.phasor_tilde/min.phasor_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class phasor : public object, public sample_operator<0, 1> { 12 | private: 13 | lib::sync m_oscillator; // note: must be created prior to any attributes that might set parameters below 14 | 15 | public: 16 | MIN_DESCRIPTION { "A non-bandlimited sawtooth oscillator (a phasor~ in MSP parlance)." 17 | "This sawtooth wave" 18 | "is typically used as a control signal for phase ramping." }; 20 | MIN_TAGS { "audio, oscillator" }; 21 | MIN_AUTHOR { "Cycling '74" }; 22 | MIN_RELATED { "phasor~, saw~" }; 23 | 24 | inlet<> in1 {this, "(number) frequency"}; 25 | outlet<> out1 {this, "(signal) ramp wave", "signal"}; 26 | 27 | argument frequency_arg { this, "frequency", "Initial frequency in hertz.", 28 | MIN_ARGUMENT_FUNCTION { 29 | frequency = arg; 30 | } 31 | }; 32 | 33 | message<> m_number { this, "number", "Set the frequency in Hz.", 34 | MIN_FUNCTION { 35 | frequency = args; 36 | return {}; 37 | } 38 | }; 39 | 40 | attribute frequency { this, "frequency", 1.0, 41 | description {"Frequency in Hz"}, 42 | setter { MIN_FUNCTION { 43 | m_oscillator.frequency(args[0], samplerate()); 44 | return args; 45 | }} 46 | }; 47 | 48 | sample operator()() { 49 | return m_oscillator(); 50 | } 51 | }; 52 | 53 | MIN_EXTERNAL(phasor); 54 | -------------------------------------------------------------------------------- /source/projects/min.pi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.pi/min.pi.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | class pi : public object { 11 | public: 12 | MIN_DESCRIPTION { "Get the approximate value of pi." }; 13 | MIN_TAGS { "math" }; 14 | MIN_AUTHOR { "Cycling '74" }; 15 | MIN_RELATED { "sin, cos, atan~, jit.op, gen~" }; 16 | 17 | inlet<> input { this, "(bang) get the approximate value of pi" }; 18 | outlet<> output { this, "(number) approximate value of pi" }; 19 | 20 | message<> bang { this, "bang", "Return the approximate value of pi.", 21 | MIN_FUNCTION { 22 | output.send(M_PI); 23 | return {}; 24 | } 25 | }; 26 | }; 27 | 28 | MIN_EXTERNAL(pi); 29 | -------------------------------------------------------------------------------- /source/projects/min.prefs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.prefs/min.prefs.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | class prefs : public object { 11 | public: 12 | MIN_DESCRIPTION { "Get the path to Max's preferences folder. Useful for standalone app makers." }; 13 | MIN_TAGS { "files" }; 14 | MIN_AUTHOR { "Cycling '74" }; 15 | MIN_RELATED { "conformpath" }; 16 | 17 | inlet<> input { this, "(bang) get the path to the preferences folder" }; 18 | outlet<> output { this, "(symbol) preferences folder path" }; 19 | 20 | message<> bang { this, "bang", "Return the path to the preferences folder.", 21 | MIN_FUNCTION { 22 | std::string str = p; 23 | output.send(str); 24 | return {}; 25 | } 26 | }; 27 | 28 | private: 29 | path p { path::system::preferences }; 30 | }; 31 | 32 | MIN_EXTERNAL(prefs); 33 | -------------------------------------------------------------------------------- /source/projects/min.progress/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.progress/min.progress.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2020 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | class progress : public object { 11 | private: 12 | number m_current_progress {}; 13 | number m_stepsize {}; 14 | 15 | public: 16 | MIN_DESCRIPTION { "Demonstrate display of a progress bar." }; 17 | MIN_TAGS { "interface" }; 18 | MIN_AUTHOR { "Cycling '74" }; 19 | MIN_RELATED { "stretch~" }; 20 | 21 | inlet<> m_inlet { this, "(list) values to convolve" }; 22 | 23 | 24 | attribute m_duration { this, "duration", 3000.0, description {"Duration of the process."} }; 25 | 26 | 27 | message<> m_bang { this, "bang", "Start process.", 28 | MIN_FUNCTION { 29 | m_current_progress = 0.0; 30 | m_stepsize = 1.0 / m_duration; 31 | 32 | auto b = box(); 33 | b("startprogress", &m_current_progress); 34 | 35 | m_timer.delay(1.0); 36 | return {}; 37 | } 38 | }; 39 | 40 | 41 | timer m_timer { this, MIN_FUNCTION { 42 | if (m_current_progress >= 1.0) { 43 | auto b = box(); 44 | b("stopprogress"); 45 | } 46 | else { 47 | m_current_progress += m_stepsize; 48 | m_timer.delay(1.0); 49 | } 50 | return {}; 51 | }}; 52 | }; 53 | 54 | MIN_EXTERNAL(progress); 55 | -------------------------------------------------------------------------------- /source/projects/min.project/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | if (APPLE) 33 | find_library(CARBON_LIBRARY "Carbon") 34 | target_link_libraries(${PROJECT_NAME} PUBLIC ${CARBON_LIBRARY}) 35 | # target_link_libraries(${PROJECT_NAME} "-framework ${CARBON_LIBRARY}") 36 | endif () 37 | 38 | 39 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 40 | 41 | 42 | ############################################################# 43 | # UNIT TEST 44 | ############################################################# 45 | 46 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 47 | -------------------------------------------------------------------------------- /source/projects/min.remote/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.remote/min.remote.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2020 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class remote : public object { 12 | public: 13 | MIN_DESCRIPTION { "Address an object remotely" }; 14 | MIN_TAGS { "developer" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "thispatcher, send, forward, pattr" }; 17 | 18 | inlet<> m_in { this, "(anything) send messages to an object" }; 19 | outlet<> m_out { this, "(anything) query responses" }; 20 | 21 | 22 | message<> m_classnames { this, "anything", 23 | "Send a message to a named object. " 24 | "First argument is the scripting name of the object. " 25 | "Second argument is the name of the message to send. " 26 | "Any additional arguments are passed as arguments to the named object. ", 27 | 28 | MIN_FUNCTION { 29 | auto p = patcher(); 30 | auto boxes = p.boxes(); 31 | atoms as {}; 32 | 33 | for (auto& b : boxes) { 34 | if (b.name() == args[0]) 35 | b(args[1], args[2]); 36 | } 37 | //m_out.send(as); 38 | return {}; 39 | } 40 | }; 41 | 42 | 43 | private: 44 | 45 | }; 46 | 47 | MIN_EXTERNAL(remote); 48 | -------------------------------------------------------------------------------- /source/projects/min.sift_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.sift_tilde/min.sift_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | class tap_sift_tilde : public object, public sample_operator<1, 0> { 11 | public: 12 | MIN_DESCRIPTION { "Remove a specific sample value and convert to float output. " 13 | "[min.sift~] removes a specified sample value (typically zero) as well as repeated sample values " 14 | "from an input signal. " 15 | "It then converts the remaining samples to floating-point output at control rate." }; 16 | MIN_TAGS { "analysis" }; 17 | MIN_AUTHOR { "Timothy Place" }; 18 | MIN_RELATED { "min.edge~, min.edgelow~, edge~, snapshot~, ==~" }; 19 | 20 | inlet<> input { this, "(signal) to be sifted" }; 21 | outlet<> output { this, "(numbers) remaining values after the sift" }; 22 | 23 | argument value_arg { this, "value", "Initial value to sift out from the incoming signal.", 24 | MIN_ARGUMENT_FUNCTION { 25 | value = arg; 26 | } 27 | }; 28 | 29 | attribute value { this, "value", 0.0, 30 | description {"Value to sift out of the incoming signal."} 31 | }; 32 | 33 | attribute high_priority { this, "high_priority", true, 34 | description {"Deliver results in the high-priority scheduler thread. " 35 | "If set to false then deliver results in the main thread. " 36 | } 37 | }; 38 | 39 | void operator()(sample x) { 40 | if (x != value && x != m_last) { 41 | m_fifo.try_enqueue(x); 42 | deliverer.delay(0); 43 | } 44 | m_last = x; 45 | } 46 | 47 | timer<> deliverer { this, 48 | MIN_FUNCTION { 49 | if (high_priority) 50 | drain_the_fifo(); 51 | else 52 | deferrer.set(); 53 | return {}; 54 | } 55 | }; 56 | 57 | queue<> deferrer { this, 58 | MIN_FUNCTION { 59 | drain_the_fifo(); 60 | return {}; 61 | } 62 | }; 63 | 64 | private: 65 | sample m_last { 0.0 }; ///< last value output 66 | fifo m_fifo { 100 }; ///< queue with space for 100 items 67 | 68 | void drain_the_fifo() { 69 | number x; 70 | while (m_fifo.try_dequeue(x)) 71 | output.send(x); 72 | } 73 | }; 74 | 75 | MIN_EXTERNAL(tap_sift_tilde); 76 | -------------------------------------------------------------------------------- /source/projects/min.stress_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.stress_tilde/min.stress_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class stress : public object, public vector_operator<> { 12 | public: 13 | MIN_DESCRIPTION { "Eat up a specified percentage of processor time to stress the computer." }; 14 | MIN_TAGS { "benchmarking" }; 15 | MIN_AUTHOR { "Timothy Place, Rob Sussman" }; 16 | 17 | attribute target { this, "target", 0.0, 18 | range {0.0, 100.0}, 19 | description {"Percentage of the CPU to burn."} 20 | }; 21 | 22 | void operator()(audio_bundle input, audio_bundle output) { 23 | auto svtime_ms {vector_size() / samplerate() * 1000.0}; 24 | auto spintime {svtime_ms * target / 100.0}; 25 | auto intime {c74::max::systimer_gettime()}; 26 | auto outtime {intime + spintime}; 27 | size_t spincount {}; 28 | 29 | while (c74::max::systimer_gettime() < outtime) 30 | ++spincount; 31 | } 32 | 33 | }; 34 | 35 | MIN_EXTERNAL(stress); 36 | -------------------------------------------------------------------------------- /source/projects/min.textslider/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | 4 | set ( MSVC_COMPILER_NAME "MSVC" ) 5 | if (${CMAKE_CXX_COMPILER_ID} STREQUAL ${MSVC_COMPILER_NAME}) 6 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 0 4 MSVC_VERSION_SHORT) 7 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 0 2 MSVC_VERSION_MAJOR) 8 | string (SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 3 1 MSVC_VERSION_MINOR) 9 | 10 | if (${MSVC_VERSION_MAJOR} VERSION_LESS 19 OR ${MSVC_VERSION_MAJOR} MATCHES 19 AND ${MSVC_VERSION_MINOR} VERSION_LESS 1) 11 | # message(STATUS "Visual Studio ${MSVC_VERSION_SHORT} detected. Visual Studio 17 (19.1) or greater is required for UI objects.") 12 | message(STATUS "Visual Studio 17 or greater is required for UI objects.") 13 | message(STATUS "SKIPPING!") 14 | return () 15 | endif () 16 | endif () 17 | 18 | 19 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 20 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 21 | 22 | 23 | ############################################################# 24 | # MAX EXTERNAL 25 | ############################################################# 26 | 27 | 28 | include_directories( 29 | "${C74_INCLUDES}" 30 | ) 31 | 32 | 33 | set( SOURCE_FILES 34 | ${PROJECT_NAME}.cpp 35 | ) 36 | 37 | 38 | add_library( 39 | ${PROJECT_NAME} 40 | MODULE 41 | ${SOURCE_FILES} 42 | ) 43 | 44 | 45 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 46 | 47 | 48 | ############################################################# 49 | # UNIT TEST 50 | ############################################################# 51 | 52 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 53 | -------------------------------------------------------------------------------- /source/projects/min.threadcheck/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ) 23 | 24 | 25 | add_library( 26 | ${PROJECT_NAME} 27 | MODULE 28 | ${SOURCE_FILES} 29 | ) 30 | 31 | 32 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 33 | 34 | 35 | ############################################################# 36 | # UNIT TEST 37 | ############################################################# 38 | 39 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 40 | -------------------------------------------------------------------------------- /source/projects/min.threadcheck/min.threadcheck.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | 8 | using namespace c74::min; 9 | 10 | 11 | class threadcheck : public object { 12 | public: 13 | MIN_DESCRIPTION { "Report the thread of execution for a message." }; 14 | MIN_TAGS { "developer" }; 15 | MIN_AUTHOR { "Cycling '74" }; 16 | MIN_RELATED { "dspstress~" }; 17 | 18 | inlet<> input { this, "(anything) message to check" }; 19 | outlet<> outlet_main { this, "(bang) message received on main thread" }; 20 | outlet<> outlet_sched { this, "(bang) message received on scheduler thread" }; 21 | outlet<> outlet_audio { this, "(bang) message received on audio thread" }; 22 | outlet<> outlet_other { this, "(bang) message received on unknown thread" }; 23 | 24 | c74::min::function check = MIN_FUNCTION { 25 | // check scheduler last because it might be running in main or audio threads depending on settings 26 | if (c74::max::systhread_ismainthread()) 27 | outlet_main.send(k_sym_bang); 28 | else if (c74::max::systhread_isaudiothread()) 29 | outlet_audio.send(k_sym_bang); 30 | else if (c74::max::systhread_istimerthread()) 31 | outlet_sched.send(k_sym_bang); 32 | else 33 | outlet_other.send(k_sym_bang); 34 | return {}; 35 | }; 36 | 37 | message list { this, "list", "Message to check.", check }; 38 | message anything { this, "anything", "Message to check.", check }; 39 | message number { this, "number", "Message to check.", check }; 40 | message bang { this, "bang", "Message to check.", check }; 41 | }; 42 | 43 | MIN_EXTERNAL(threadcheck); 44 | -------------------------------------------------------------------------------- /source/projects/min.xfade_tilde/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Min-DevKit Authors. All rights reserved. 2 | # Use of this source code is governed by the MIT License found in the License.md file. 3 | 4 | cmake_minimum_required(VERSION 3.0) 5 | 6 | set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api) 7 | include(${C74_MIN_API_DIR}/script/min-pretarget.cmake) 8 | 9 | 10 | ############################################################# 11 | # MAX EXTERNAL 12 | ############################################################# 13 | 14 | 15 | include_directories( 16 | "${C74_INCLUDES}" 17 | ) 18 | 19 | 20 | set( SOURCE_FILES 21 | ${PROJECT_NAME}.cpp 22 | ../shared/signal_routing_objects.h 23 | ../shared/signal_routing_objects.cpp 24 | ) 25 | 26 | 27 | add_library( 28 | ${PROJECT_NAME} 29 | MODULE 30 | ${SOURCE_FILES} 31 | ) 32 | 33 | 34 | include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) 35 | 36 | 37 | ############################################################# 38 | # UNIT TEST 39 | ############################################################# 40 | 41 | include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) 42 | -------------------------------------------------------------------------------- /source/projects/min.xfade_tilde/min.xfade_tilde.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "c74_min.h" 7 | #include "../shared/signal_routing_objects.h" 8 | 9 | // The xfade~ object inherits all of it's attributes and messages from the signal_routing_base class. 10 | // The panner~ object does exactly the same, allowing us to share the code between the two similar but opposite classes. 11 | 12 | class xfade : public signal_routing_base, public sample_operator<3, 1> { 13 | public: 14 | MIN_DESCRIPTION {"Crossfade between two signals."}; 15 | MIN_TAGS {"audio, routing"}; 16 | MIN_AUTHOR {"Cycling '74"}; 17 | MIN_RELATED {"panner~, matrix~"}; 18 | 19 | // above we inherited from sample_operator<3,1> which means 3 inputs and 1 output for our calculate method 20 | // we still need to create the interface for the object though, which includes the assistance strings... 21 | 22 | inlet<> in1 {this, "(signal) Input 1"}; 23 | inlet<> in2 {this, "(signal) Input 2"}; 24 | inlet<> in_pos {this, "(signal) Position between them (0..1)"}; 25 | outlet<> output {this, "(signal) Output", "signal"}; 26 | 27 | 28 | /// Call operator: process a single sample 29 | /// Note that it takes three samples as input because we defined this class to inherit from sample_operator<3,1> 30 | 31 | sample operator()(sample in1, sample in2, sample position = 0.5) { 32 | auto weight1 = this->weight1; 33 | auto weight2 = this->weight2; 34 | 35 | if (in_pos.has_signal_connection()) 36 | std::tie(weight1, weight2) = calculate_weights(mode, position); 37 | return in1 * weight1 + in2 * weight2; 38 | } 39 | }; 40 | 41 | MIN_EXTERNAL(xfade); 42 | -------------------------------------------------------------------------------- /source/projects/shared/signal_routing_objects.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// @ingroup minexamples 3 | /// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved. 4 | /// @license Use of this source code is governed by the MIT License found in the License.md file. 5 | 6 | #include "signal_routing_objects.h" 7 | 8 | 9 | lookup_tables g_tables; 10 | 11 | 12 | lookup_tables::lookup_tables() { 13 | linear.resize(size); 14 | equal_power.resize(size); 15 | sqrt.resize(size); 16 | 17 | for (auto i = 0; i < size; ++i) { 18 | double normalized_index = static_cast(i) / (size - 1); 19 | 20 | linear[i] = normalized_index; 21 | equal_power[i] = std::sin(normalized_index * M_PI_2); 22 | sqrt[i] = std::sqrt(normalized_index); 23 | } 24 | } 25 | 26 | 27 | lookup_table* lookup_tables::get(const symbol& name) { 28 | if (name == shapes::equal_power) 29 | return &equal_power; 30 | else if (name == shapes::square_root) 31 | return &sqrt; 32 | else 33 | return &linear; 34 | } 35 | --------------------------------------------------------------------------------