@@ -1,4 +1,4 @@ | |||
# Doxyfile 1.8.9.1 | |||
# Doxyfile 1.8.12 | |||
# This file describes the settings to be used by the documentation system | |||
# doxygen (www.doxygen.org) for a project. | |||
@@ -228,7 +228,27 @@ TAB_SIZE = 4 | |||
# "Side Effects:". You can put \n's in the value part of an alias to insert | |||
# newlines. | |||
####################################################################################################################### | |||
ALIASES = "topictag{1}=\1" \ | |||
"box{1}=<dl class=\"section attention\"><dt>\1</dt><dd>" \ | |||
"endbox=</dd></dl>" \ | |||
"c_void=@s_code{void}" \ | |||
"c_bool=@s_code{bool}" \ | |||
"c_char=@s_code{char}" \ | |||
"c_float=@s_code{float}" \ | |||
"c_double=@s_code{double}" \ | |||
"c_int=@s_code{int}" \ | |||
"c_nullptr=@s_code{nullptr}" \ | |||
"c_for=@s_code{for()}" \ | |||
"c_if=@s_code{if()}" \ | |||
"c_ifelse=@s_code{if..else}" \ | |||
"c_while=@s_code{while()}" \ | |||
"c_true=@s_code{true}" \ | |||
"c_false=@s_code{false}" \ | |||
"c_enum=@s_code{enum}" \ | |||
"c_switch=@s_code{switch..case}" \ | |||
"c_static=@s_code{static}" \ | |||
"c_new=@s_code{new}" \ | |||
"c_typedef=@s_code{typedef}" | |||
# This tag can be used to specify a number of word-keyword mappings (TCL only). | |||
# A mapping has the form "name=value". For example adding "class=itcl::class" | |||
@@ -293,6 +313,15 @@ EXTENSION_MAPPING = | |||
MARKDOWN_SUPPORT = YES | |||
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up | |||
# to that level are automatically included in the table of contents, even if | |||
# they do not have an id attribute. | |||
# Note: This feature currently applies only to Markdown headings. | |||
# Minimum value: 0, maximum value: 99, default value: 0. | |||
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. | |||
TOC_INCLUDE_HEADINGS = 0 | |||
# When enabled doxygen tries to link words that correspond to documented | |||
# classes, or namespaces to their corresponding documentation. Such a link can | |||
# be prevented in individual cases by putting a % sign in front of the word or | |||
@@ -343,6 +372,13 @@ IDL_PROPERTY_SUPPORT = YES | |||
DISTRIBUTE_GROUP_DOC = NO | |||
# If one adds a struct or class to a group and this option is enabled, then also | |||
# any nested class or struct is added to the same group. By default this option | |||
# is disabled and one has to add nested compounds explicitly via \ingroup. | |||
# The default value is: NO. | |||
GROUP_NESTED_COMPOUNDS = YES | |||
# Set the SUBGROUPING tag to YES to allow class member groups of the same type | |||
# (for instance a group of public functions) to be put as a subgroup of that | |||
# type (e.g. under the Public Functions section). Set it to NO to prevent | |||
@@ -571,7 +607,7 @@ SORT_MEMBERS_CTORS_1ST = NO | |||
# appear in their defined order. | |||
# The default value is: NO. | |||
SORT_GROUP_NAMES = NO | |||
SORT_GROUP_NAMES = YES | |||
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by | |||
# fully-qualified names, including namespaces. If set to NO, the class list will | |||
@@ -732,6 +768,12 @@ WARN_IF_DOC_ERROR = YES | |||
WARN_NO_PARAMDOC = NO | |||
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when | |||
# a warning is encountered. | |||
# The default value is: NO. | |||
WARN_AS_ERROR = NO | |||
# The WARN_FORMAT tag determines the format of the warning messages that doxygen | |||
# can produce. The string should contain the $file, $line, and $text tags, which | |||
# will be replaced by the file and line number from which the warning originated | |||
@@ -755,10 +797,10 @@ WARN_LOGFILE = | |||
# The INPUT tag is used to specify the files and/or directories that contain | |||
# documented source files. You may enter file names like myfile.cpp or | |||
# directories like /usr/src/myproject. Separate the files or directories with | |||
# spaces. | |||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING | |||
# Note: If this tag is empty the current directory is searched. | |||
INPUT = ../modules | |||
INPUT = build | |||
# This tag can be used to specify the character encoding of the source files | |||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses | |||
@@ -771,12 +813,17 @@ INPUT_ENCODING = UTF-8 | |||
# If the value of the INPUT tag contains directories, you can use the | |||
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and | |||
# *.h) to filter out the source-files in the directories. If left blank the | |||
# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, | |||
# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, | |||
# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, | |||
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, | |||
# *.qsf, *.as and *.js. | |||
# *.h) to filter out the source-files in the directories. | |||
# | |||
# Note that for custom extensions or not directly supported extensions you also | |||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not | |||
# read by doxygen. | |||
# | |||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, | |||
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, | |||
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, | |||
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, | |||
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. | |||
FILE_PATTERNS = juce_*.h \ | |||
juce_*.dox | |||
@@ -794,51 +841,21 @@ RECURSIVE = YES | |||
# Note that relative paths are relative to the directory from which doxygen is | |||
# run. | |||
EXCLUDE = ../modules/juce_graphics/image_formats \ | |||
../modules/juce_core/zip/zlib \ | |||
../modules/juce_audio_formats/codecs/flac \ | |||
../modules/juce_audio_formats/codecs/oggvorbis \ | |||
../modules/juce_audio_basics/juce_audio_basics.h \ | |||
../modules/juce_audio_basics/juce_audio_basics.cpp \ | |||
../modules/juce_audio_devices/juce_audio_devices.h \ | |||
../modules/juce_audio_devices/juce_audio_devices.cpp \ | |||
../modules/juce_audio_devices/native \ | |||
../modules/juce_audio_formats/juce_audio_formats.h \ | |||
../modules/juce_audio_formats/juce_audio_formats.cpp \ | |||
../modules/juce_audio_plugin_client/juce_audio_plugin_client.h \ | |||
../modules/juce_audio_plugin_client/AU/CoreAudioUtilityClasses \ | |||
../modules/juce_audio_processors/juce_audio_processors.h \ | |||
../modules/juce_audio_processors/juce_audio_processors.cpp \ | |||
../modules/juce_audio_utils/juce_audio_utils.h \ | |||
../modules/juce_audio_utils/juce_audio_utils.cpp \ | |||
../modules/juce_browser_plugin_client/juce_browser_plugin.h \ | |||
../modules/juce_browser_plugin_client/juce_browser_plugin.cpp \ | |||
../modules/juce_core/juce_core.h \ | |||
../modules/juce_core/juce_core.cpp \ | |||
../modules/juce_core/native \ | |||
../modules/juce_cryptography/juce_cryptography.h \ | |||
../modules/juce_cryptography/juce_cryptography.cpp \ | |||
../modules/juce_data_structures/juce_data_structures.h \ | |||
../modules/juce_data_structures/juce_data_structures.cpp \ | |||
../modules/juce_events/juce_events.h \ | |||
../modules/juce_events/juce_events.cpp \ | |||
../modules/juce_events/native \ | |||
../modules/juce_graphics/juce_graphics.h \ | |||
../modules/juce_graphics/juce_graphics.cpp \ | |||
../modules/juce_graphics/native \ | |||
../modules/juce_gui_basics/juce_gui_basics.h \ | |||
../modules/juce_gui_basics/juce_gui_basics.cpp \ | |||
../modules/juce_gui_basics/native \ | |||
../modules/juce_gui_extra/juce_gui_extra.h \ | |||
../modules/juce_gui_extra/juce_gui_extra.cpp \ | |||
../modules/juce_gui_extra/native \ | |||
../modules/juce_opengl/juce_opengl.h \ | |||
../modules/juce_opengl/juce_opengl.cpp \ | |||
../modules/juce_opengl/native \ | |||
../modules/juce_tracktion_marketplace/juce_tracktion_marketplace.h \ | |||
../modules/juce_video/juce_video.h \ | |||
../modules/juce_video/juce_video.cpp \ | |||
../modules/juce_video/native | |||
EXCLUDE = build/juce_graphics/image_formats \ | |||
build/juce_core/zip/zlib \ | |||
build/juce_audio_formats/codecs/flac \ | |||
build/juce_audio_formats/codecs/oggvorbis \ | |||
build/juce_audio_devices/native \ | |||
build/juce_audio_plugin_client/AU/CoreAudioUtilityClasses \ | |||
build/juce_browser_plugin_client/juce_browser_plugin.h \ | |||
build/juce_core/native \ | |||
build/juce_events/native \ | |||
build/juce_graphics/native \ | |||
build/juce_gui_basics/native \ | |||
build/juce_gui_extra/native \ | |||
build/juce_opengl/native \ | |||
build/juce_video/native \ | |||
build/juce_dsp/native | |||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or | |||
# directories that are symbolic links (a Unix file system feature) are excluded | |||
@@ -888,7 +905,7 @@ EXAMPLE_PATTERNS = | |||
# irrespective of the value of the RECURSIVE tag. | |||
# The default value is: NO. | |||
EXAMPLE_RECURSIVE = NO | |||
EXAMPLE_RECURSIVE = YES | |||
# The IMAGE_PATH tag can be used to specify one or more files or directories | |||
# that contain images that are to be included in the documentation (see the | |||
@@ -910,6 +927,10 @@ IMAGE_PATH = | |||
# Note that the filter must not add or remove lines; it is applied before the | |||
# code is scanned, but not when the output code is generated. If lines are added | |||
# or removed, the anchors will not be placed correctly. | |||
# | |||
# Note that for custom extensions or not directly supported extensions you also | |||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not | |||
# properly processed by doxygen. | |||
INPUT_FILTER = | |||
@@ -919,6 +940,10 @@ INPUT_FILTER = | |||
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how | |||
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the | |||
# patterns match the file name, INPUT_FILTER is applied. | |||
# | |||
# Note that for custom extensions or not directly supported extensions you also | |||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not | |||
# properly processed by doxygen. | |||
FILTER_PATTERNS = | |||
@@ -1127,7 +1152,7 @@ HTML_HEADER = | |||
# that doxygen normally uses. | |||
# This tag requires that the tag GENERATE_HTML is set to YES. | |||
HTML_FOOTER = footer.html | |||
HTML_FOOTER = | |||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style | |||
# sheet that is used by each HTML page. It can be used to fine-tune the look of | |||
@@ -1196,8 +1221,9 @@ HTML_COLORSTYLE_GAMMA = 80 | |||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML | |||
# page will contain the date and time when the page was generated. Setting this | |||
# to NO can help when comparing the output of multiple runs. | |||
# The default value is: YES. | |||
# to YES can help to show when doxygen was last run and thus if the | |||
# documentation is up to date. | |||
# The default value is: NO. | |||
# This tag requires that the tag GENERATE_HTML is set to YES. | |||
HTML_TIMESTAMP = YES | |||
@@ -1208,7 +1234,7 @@ HTML_TIMESTAMP = YES | |||
# The default value is: NO. | |||
# This tag requires that the tag GENERATE_HTML is set to YES. | |||
HTML_DYNAMIC_SECTIONS = YES | |||
HTML_DYNAMIC_SECTIONS = NO | |||
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries | |||
# shown in the various tree structured indices initially; the user can expand | |||
@@ -1221,7 +1247,7 @@ HTML_DYNAMIC_SECTIONS = YES | |||
# Minimum value: 0, maximum value: 9999, default value: 100. | |||
# This tag requires that the tag GENERATE_HTML is set to YES. | |||
HTML_INDEX_NUM_ENTRIES = 100 | |||
HTML_INDEX_NUM_ENTRIES = 0 | |||
# If the GENERATE_DOCSET tag is set to YES, additional index files will be | |||
# generated that can be used as input for Apple's Xcode 3 integrated development | |||
@@ -1290,7 +1316,7 @@ GENERATE_HTMLHELP = NO | |||
# written to the html output directory. | |||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. | |||
CHM_FILE = juce.chm | |||
CHM_FILE = | |||
# The HHC_LOCATION tag can be used to specify the location (absolute path | |||
# including file name) of the HTML help compiler (hhc.exe). If non-empty, | |||
@@ -1671,9 +1697,12 @@ COMPACT_LATEX = NO | |||
PAPER_TYPE = a4wide | |||
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names | |||
# that should be included in the LaTeX output. To get the times font for | |||
# instance you can specify | |||
# EXTRA_PACKAGES=times | |||
# that should be included in the LaTeX output. The package can be specified just | |||
# by its name or with the correct syntax as to be used with the LaTeX | |||
# \usepackage command. To get the times font for instance you can specify : | |||
# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} | |||
# To use the option intlimits with the amsmath package you can specify: | |||
# EXTRA_PACKAGES=[intlimits]{amsmath} | |||
# If left blank no extra packages will be included. | |||
# This tag requires that the tag GENERATE_LATEX is set to YES. | |||
@@ -1776,6 +1805,14 @@ LATEX_SOURCE_CODE = NO | |||
LATEX_BIB_STYLE = plain | |||
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated | |||
# page will contain the date and time when the page was generated. Setting this | |||
# to NO can help when comparing the output of multiple runs. | |||
# The default value is: NO. | |||
# This tag requires that the tag GENERATE_LATEX is set to YES. | |||
LATEX_TIMESTAMP = NO | |||
#--------------------------------------------------------------------------- | |||
# Configuration options related to the RTF output | |||
#--------------------------------------------------------------------------- | |||
@@ -2176,7 +2213,7 @@ HIDE_UNDOC_RELATIONS = YES | |||
# set to NO | |||
# The default value is: NO. | |||
HAVE_DOT = NO | |||
HAVE_DOT = YES | |||
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed | |||
# to run in parallel. When set to 0 doxygen will base this on the number of | |||
@@ -2288,7 +2325,8 @@ INCLUDED_BY_GRAPH = NO | |||
# | |||
# Note that enabling this option will significantly increase the time of a run. | |||
# So in most cases it will be better to enable call graphs for selected | |||
# functions only using the \callgraph command. | |||
# functions only using the \callgraph command. Disabling a call graph can be | |||
# accomplished by means of the command \hidecallgraph. | |||
# The default value is: NO. | |||
# This tag requires that the tag HAVE_DOT is set to YES. | |||
@@ -2299,7 +2337,8 @@ CALL_GRAPH = NO | |||
# | |||
# Note that enabling this option will significantly increase the time of a run. | |||
# So in most cases it will be better to enable caller graphs for selected | |||
# functions only using the \callergraph command. | |||
# functions only using the \callergraph command. Disabling a caller graph can be | |||
# accomplished by means of the command \hidecallergraph. | |||
# The default value is: NO. | |||
# This tag requires that the tag HAVE_DOT is set to YES. | |||
@@ -2322,15 +2361,19 @@ GRAPHICAL_HIERARCHY = NO | |||
DIRECTORY_GRAPH = NO | |||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images | |||
# generated by dot. | |||
# generated by dot. For an explanation of the image formats see the section | |||
# output formats in the documentation of the dot tool (Graphviz (see: | |||
# http://www.graphviz.org/)). | |||
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order | |||
# to make the SVG files visible in IE 9+ (other browsers do not have this | |||
# requirement). | |||
# Possible values are: png, jpg, gif and svg. | |||
# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, | |||
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and | |||
# png:gdiplus:gdiplus. | |||
# The default value is: png. | |||
# This tag requires that the tag HAVE_DOT is set to YES. | |||
DOT_IMAGE_FORMAT = png | |||
DOT_IMAGE_FORMAT = svg | |||
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to | |||
# enable generation of interactive SVG images that allow zooming and panning. | |||
@@ -2348,7 +2391,7 @@ INTERACTIVE_SVG = NO | |||
# found. If left blank, it is assumed the dot tool can be found in the path. | |||
# This tag requires that the tag HAVE_DOT is set to YES. | |||
DOT_PATH = | |||
DOT_PATH = | |||
# The DOTFILE_DIRS tag can be used to specify one or more directories that | |||
# contain dot files that are included in the documentation (see the \dotfile | |||
@@ -2416,7 +2459,7 @@ MAX_DOT_GRAPH_DEPTH = 0 | |||
# The default value is: NO. | |||
# This tag requires that the tag HAVE_DOT is set to YES. | |||
DOT_TRANSPARENT = NO | |||
DOT_TRANSPARENT = YES | |||
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output | |||
# files in one run (i.e. multiple -o and -T options on the command line). This | |||
@@ -2433,7 +2476,7 @@ DOT_MULTI_TARGETS = NO | |||
# The default value is: YES. | |||
# This tag requires that the tag HAVE_DOT is set to YES. | |||
GENERATE_LEGEND = YES | |||
GENERATE_LEGEND = NO | |||
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot | |||
# files that are used to generate the various graphs. | |||
@@ -6,5 +6,5 @@ How to: | |||
1. install doxygen | |||
2. cd into this directory on the command line | |||
3. run doxygen (no additional arguments needed) | |||
4. doxygen will create a new subfolder "doc". Open doc/index.html in your browser to access the generated HTML documentation. | |||
3. run `make` | |||
4. doxygen will create a new subfolder "doc" - open doc/index.html in your browser to access the generated HTML documentation |
@@ -0,0 +1,152 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#pragma once | |||
//============================================================================== | |||
/** | |||
A subclass of AudioPlayHead can supply information about the position and | |||
status of a moving play head during audio playback. | |||
One of these can be supplied to an AudioProcessor object so that it can find | |||
out about the position of the audio that it is rendering. | |||
@see AudioProcessor::setPlayHead, AudioProcessor::getPlayHead | |||
*/ | |||
class JUCE_API AudioPlayHead | |||
{ | |||
protected: | |||
//============================================================================== | |||
AudioPlayHead() {} | |||
public: | |||
virtual ~AudioPlayHead() {} | |||
//============================================================================== | |||
/** Frame rate types. */ | |||
enum FrameRateType | |||
{ | |||
fps24 = 0, | |||
fps25 = 1, | |||
fps2997 = 2, | |||
fps30 = 3, | |||
fps2997drop = 4, | |||
fps30drop = 5, | |||
fps60 = 6, | |||
fps60drop = 7, | |||
fpsUnknown = 99 | |||
}; | |||
//============================================================================== | |||
/** This structure is filled-in by the AudioPlayHead::getCurrentPosition() method. | |||
*/ | |||
struct JUCE_API CurrentPositionInfo | |||
{ | |||
/** The tempo in BPM */ | |||
double bpm; | |||
/** Time signature numerator, e.g. the 3 of a 3/4 time sig */ | |||
int timeSigNumerator; | |||
/** Time signature denominator, e.g. the 4 of a 3/4 time sig */ | |||
int timeSigDenominator; | |||
/** The current play position, in samples from the start of the edit. */ | |||
int64 timeInSamples; | |||
/** The current play position, in seconds from the start of the edit. */ | |||
double timeInSeconds; | |||
/** For timecode, the position of the start of the edit, in seconds from 00:00:00:00. */ | |||
double editOriginTime; | |||
/** The current play position, in pulses-per-quarter-note. */ | |||
double ppqPosition; | |||
/** The position of the start of the last bar, in pulses-per-quarter-note. | |||
This is the time from the start of the edit to the start of the current | |||
bar, in ppq units. | |||
Note - this value may be unavailable on some hosts, e.g. Pro-Tools. If | |||
it's not available, the value will be 0. | |||
*/ | |||
double ppqPositionOfLastBarStart; | |||
/** The video frame rate, if applicable. */ | |||
FrameRateType frameRate; | |||
/** True if the transport is currently playing. */ | |||
bool isPlaying; | |||
/** True if the transport is currently recording. | |||
(When isRecording is true, then isPlaying will also be true). | |||
*/ | |||
bool isRecording; | |||
/** The current cycle start position in pulses-per-quarter-note. | |||
Note that not all hosts or plugin formats may provide this value. | |||
@see isLooping | |||
*/ | |||
double ppqLoopStart; | |||
/** The current cycle end position in pulses-per-quarter-note. | |||
Note that not all hosts or plugin formats may provide this value. | |||
@see isLooping | |||
*/ | |||
double ppqLoopEnd; | |||
/** True if the transport is currently looping. */ | |||
bool isLooping; | |||
//============================================================================== | |||
bool operator== (const CurrentPositionInfo& other) const noexcept; | |||
bool operator!= (const CurrentPositionInfo& other) const noexcept; | |||
void resetToDefault(); | |||
}; | |||
//============================================================================== | |||
/** Fills-in the given structure with details about the transport's | |||
position at the start of the current processing block. If this method returns | |||
false then the current play head position is not available and the given | |||
structure will be undefined. | |||
You can ONLY call this from your processBlock() method! Calling it at other | |||
times will produce undefined behaviour, as the host may not have any context | |||
in which a time would make sense, and some hosts will almost certainly have | |||
multithreading issues if it's not called on the audio thread. | |||
*/ | |||
virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0; | |||
/** Returns true if this object can control the transport. */ | |||
virtual bool canControlTransport() { return false; } | |||
/** Starts or stops the audio. */ | |||
virtual void transportPlay (bool shouldStartPlaying) { ignoreUnused (shouldStartPlaying); } | |||
/** Starts or stops recording the audio. */ | |||
virtual void transportRecord (bool shouldStartRecording) { ignoreUnused (shouldStartRecording); } | |||
/** Rewinds the audio. */ | |||
virtual void transportRewind() {} | |||
}; |
@@ -2,33 +2,30 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
AudioChannelSet::AudioChannelSet (uint32 c) : channels (c) {} | |||
AudioChannelSet::AudioChannelSet (const Array<ChannelType>& c) | |||
{ | |||
for (auto channel : c) | |||
addChannel (channel); | |||
} | |||
bool AudioChannelSet::operator== (const AudioChannelSet& other) const noexcept { return channels == other.channels; } | |||
bool AudioChannelSet::operator!= (const AudioChannelSet& other) const noexcept { return channels != other.channels; } | |||
@@ -37,7 +34,7 @@ bool AudioChannelSet::operator< (const AudioChannelSet& other) const noexcept | |||
String AudioChannelSet::getChannelTypeName (AudioChannelSet::ChannelType type) | |||
{ | |||
if (type >= discreteChannel0) | |||
return String ("Discrete ") + String (type - discreteChannel0 + 1); | |||
return "Discrete " + String (type - discreteChannel0 + 1); | |||
switch (type) | |||
{ | |||
@@ -62,8 +59,8 @@ String AudioChannelSet::getChannelTypeName (AudioChannelSet::ChannelType type) | |||
case wideLeft: return NEEDS_TRANS("Wide Left"); | |||
case wideRight: return NEEDS_TRANS("Wide Right"); | |||
case LFE2: return NEEDS_TRANS("LFE 2"); | |||
case leftSurroundSide: return NEEDS_TRANS ("Left Surround Side"); | |||
case rightSurroundSide: return NEEDS_TRANS ("Right Surround Side"); | |||
case leftSurroundSide: return NEEDS_TRANS("Left Surround Side"); | |||
case rightSurroundSide: return NEEDS_TRANS("Right Surround Side"); | |||
case ambisonicW: return NEEDS_TRANS("Ambisonic W"); | |||
case ambisonicX: return NEEDS_TRANS("Ambisonic X"); | |||
case ambisonicY: return NEEDS_TRANS("Ambisonic Y"); | |||
@@ -111,7 +108,7 @@ String AudioChannelSet::getAbbreviatedChannelTypeName (AudioChannelSet::ChannelT | |||
default: break; | |||
} | |||
return ""; | |||
return {}; | |||
} | |||
AudioChannelSet::ChannelType AudioChannelSet::getChannelTypeFromAbbreviation (const String& abbr) | |||
@@ -120,33 +117,33 @@ AudioChannelSet::ChannelType AudioChannelSet::getChannelTypeFromAbbreviation (co | |||
return static_cast<AudioChannelSet::ChannelType> (static_cast<int> (discreteChannel0) | |||
+ abbr.getIntValue() + 1); | |||
if (abbr == "L") return left; | |||
else if (abbr == "R") return right; | |||
else if (abbr == "C") return centre; | |||
else if (abbr == "Lfe") return LFE; | |||
else if (abbr == "Ls") return leftSurround; | |||
else if (abbr == "Rs") return rightSurround; | |||
else if (abbr == "Lc") return leftCentre; | |||
else if (abbr == "Rc") return rightCentre; | |||
else if (abbr == "Cs") return centreSurround; | |||
else if (abbr == "Lrs") return leftSurroundRear; | |||
else if (abbr == "Rrs") return rightSurroundRear; | |||
else if (abbr == "Tm") return topMiddle; | |||
else if (abbr == "Tfl") return topFrontLeft; | |||
else if (abbr == "Tfc") return topFrontCentre; | |||
else if (abbr == "Tfr") return topFrontRight; | |||
else if (abbr == "Trl") return topRearLeft; | |||
else if (abbr == "Trc") return topRearCentre; | |||
else if (abbr == "Trr") return topRearRight; | |||
else if (abbr == "Wl") return wideLeft; | |||
else if (abbr == "Wr") return wideRight; | |||
else if (abbr == "Lfe2") return LFE2; | |||
else if (abbr == "Lss") return leftSurroundSide; | |||
else if (abbr == "Rss") return rightSurroundSide; | |||
else if (abbr == "W") return ambisonicW; | |||
else if (abbr == "X") return ambisonicX; | |||
else if (abbr == "Y") return ambisonicY; | |||
else if (abbr == "Z") return ambisonicZ; | |||
if (abbr == "L") return left; | |||
if (abbr == "R") return right; | |||
if (abbr == "C") return centre; | |||
if (abbr == "Lfe") return LFE; | |||
if (abbr == "Ls") return leftSurround; | |||
if (abbr == "Rs") return rightSurround; | |||
if (abbr == "Lc") return leftCentre; | |||
if (abbr == "Rc") return rightCentre; | |||
if (abbr == "Cs") return centreSurround; | |||
if (abbr == "Lrs") return leftSurroundRear; | |||
if (abbr == "Rrs") return rightSurroundRear; | |||
if (abbr == "Tm") return topMiddle; | |||
if (abbr == "Tfl") return topFrontLeft; | |||
if (abbr == "Tfc") return topFrontCentre; | |||
if (abbr == "Tfr") return topFrontRight; | |||
if (abbr == "Trl") return topRearLeft; | |||
if (abbr == "Trc") return topRearCentre; | |||
if (abbr == "Trr") return topRearRight; | |||
if (abbr == "Wl") return wideLeft; | |||
if (abbr == "Wr") return wideRight; | |||
if (abbr == "Lfe2") return LFE2; | |||
if (abbr == "Lss") return leftSurroundSide; | |||
if (abbr == "Rss") return rightSurroundSide; | |||
if (abbr == "W") return ambisonicW; | |||
if (abbr == "X") return ambisonicX; | |||
if (abbr == "Y") return ambisonicY; | |||
if (abbr == "Z") return ambisonicZ; | |||
return unknown; | |||
} | |||
@@ -154,11 +151,10 @@ AudioChannelSet::ChannelType AudioChannelSet::getChannelTypeFromAbbreviation (co | |||
String AudioChannelSet::getSpeakerArrangementAsString() const | |||
{ | |||
StringArray speakerTypes; | |||
Array<AudioChannelSet::ChannelType> speakers = getChannelTypes(); | |||
for (int i = 0; i < speakers.size(); ++i) | |||
for (auto& speaker : getChannelTypes()) | |||
{ | |||
String name = getAbbreviatedChannelTypeName (speakers.getReference (i)); | |||
auto name = getAbbreviatedChannelTypeName (speaker); | |||
if (name.isNotEmpty()) | |||
speakerTypes.add (name); | |||
@@ -169,12 +165,11 @@ String AudioChannelSet::getSpeakerArrangementAsString() const | |||
AudioChannelSet AudioChannelSet::fromAbbreviatedString (const String& str) | |||
{ | |||
StringArray abbr = StringArray::fromTokens(str, true); | |||
AudioChannelSet set; | |||
for (int i = 0; i < abbr.size(); ++i) | |||
for (auto& abbr : StringArray::fromTokens (str, true)) | |||
{ | |||
AudioChannelSet::ChannelType type = getChannelTypeFromAbbreviation (abbr[i]); | |||
auto type = getChannelTypeFromAbbreviation (abbr); | |||
if (type != unknown) | |||
set.addChannel (type); | |||
@@ -185,7 +180,7 @@ AudioChannelSet AudioChannelSet::fromAbbreviatedString (const String& str) | |||
String AudioChannelSet::getDescription() const | |||
{ | |||
if (isDiscreteLayout()) return String ("Discrete #") + String (size()); | |||
if (isDiscreteLayout()) return "Discrete #" + String (size()); | |||
if (*this == disabled()) return "Disabled"; | |||
if (*this == mono()) return "Mono"; | |||
if (*this == stereo()) return "Stereo"; | |||
@@ -194,16 +189,16 @@ String AudioChannelSet::getDescription() const | |||
if (*this == createLRS()) return "LRS"; | |||
if (*this == createLCRS()) return "LCRS"; | |||
if (*this == create5point0()) return "5.1 Surround"; | |||
if (*this == create5point1()) return "5.1 Surround (+Lfe)"; | |||
if (*this == create6point0()) return "6.1 Surround"; | |||
if (*this == create6point1()) return "6.1 Surround (+Lfe)"; | |||
if (*this == create6point0Music()) return "6.1 (Music) Surround"; | |||
if (*this == create6point1Music()) return "6.1 (Music) Surround (+Lfe)"; | |||
if (*this == create7point0()) return "7.1 Surround"; | |||
if (*this == create7point1()) return "7.1 Surround (Lfe)"; | |||
if (*this == create7point0SDDS()) return "7.1 Surround SDDS"; | |||
if (*this == create7point1SDDS()) return "7.1 Surround SDDS (+Lfe)"; | |||
if (*this == create5point0()) return "5.0 Surround"; | |||
if (*this == create5point1()) return "5.1 Surround"; | |||
if (*this == create6point0()) return "6.0 Surround"; | |||
if (*this == create6point1()) return "6.1 Surround"; | |||
if (*this == create6point0Music()) return "6.0 (Music) Surround"; | |||
if (*this == create6point1Music()) return "6.1 (Music) Surround"; | |||
if (*this == create7point0()) return "7.0 Surround"; | |||
if (*this == create7point1()) return "7.1 Surround"; | |||
if (*this == create7point0SDDS()) return "7.0 Surround SDDS"; | |||
if (*this == create7point1SDDS()) return "7.1 Surround SDDS"; | |||
if (*this == quadraphonic()) return "Quadraphonic"; | |||
if (*this == pentagonal()) return "Pentagonal"; | |||
@@ -211,19 +206,16 @@ String AudioChannelSet::getDescription() const | |||
if (*this == octagonal()) return "Octagonal"; | |||
if (*this == ambisonic()) return "Ambisonic"; | |||
return "Unknown"; | |||
} | |||
bool AudioChannelSet::isDiscreteLayout() const noexcept | |||
{ | |||
Array<AudioChannelSet::ChannelType> speakers = getChannelTypes(); | |||
for (int i = 0; i < speakers.size(); ++i) | |||
if (speakers.getReference (i) > ambisonicZ) | |||
return true; | |||
for (auto& speaker : getChannelTypes()) | |||
if (speaker <= ambisonicZ) | |||
return false; | |||
return false; | |||
return true; | |||
} | |||
int AudioChannelSet::size() const noexcept | |||
@@ -244,6 +236,7 @@ AudioChannelSet::ChannelType AudioChannelSet::getTypeOfChannel (int index) const | |||
int AudioChannelSet::getChannelIndexForType (AudioChannelSet::ChannelType type) const noexcept | |||
{ | |||
int idx = 0; | |||
for (int bit = channels.findNextSetBit (0); bit >= 0; bit = channels.findNextSetBit (bit + 1)) | |||
{ | |||
if (static_cast<ChannelType> (bit) == type) | |||
@@ -279,27 +272,27 @@ void AudioChannelSet::removeChannel (ChannelType newChannel) | |||
channels.clearBit (bit); | |||
} | |||
AudioChannelSet AudioChannelSet::disabled() { return AudioChannelSet(); } | |||
AudioChannelSet AudioChannelSet::disabled() { return {}; } | |||
AudioChannelSet AudioChannelSet::mono() { return AudioChannelSet (1u << centre); } | |||
AudioChannelSet AudioChannelSet::stereo() { return AudioChannelSet ((1u << left) | (1u << right)); } | |||
AudioChannelSet AudioChannelSet::createLCR() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre)); } | |||
AudioChannelSet AudioChannelSet::createLRS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << surround)); } | |||
AudioChannelSet AudioChannelSet::createLCRS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << surround)); } | |||
AudioChannelSet AudioChannelSet::create5point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround)); } | |||
AudioChannelSet AudioChannelSet::create5point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << LFE)); } | |||
AudioChannelSet AudioChannelSet::create5point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround)); } | |||
AudioChannelSet AudioChannelSet::create6point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround)); } | |||
AudioChannelSet AudioChannelSet::create6point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround) | (1u << LFE)); } | |||
AudioChannelSet AudioChannelSet::create6point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround)); } | |||
AudioChannelSet AudioChannelSet::create6point0Music() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide)); } | |||
AudioChannelSet AudioChannelSet::create6point1Music() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << LFE)); } | |||
AudioChannelSet AudioChannelSet::create6point1Music() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide)); } | |||
AudioChannelSet AudioChannelSet::create7point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | |||
AudioChannelSet AudioChannelSet::create7point0SDDS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre)); } | |||
AudioChannelSet AudioChannelSet::create7point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear) | (1u << LFE)); } | |||
AudioChannelSet AudioChannelSet::create7point1SDDS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre) | (1u << LFE)); } | |||
AudioChannelSet AudioChannelSet::create7point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | |||
AudioChannelSet AudioChannelSet::create7point1SDDS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre)); } | |||
AudioChannelSet AudioChannelSet::ambisonic() { return AudioChannelSet ((1u << ambisonicW) | (1u << ambisonicX) | (1u << ambisonicY) | (1u << ambisonicZ)); } | |||
AudioChannelSet AudioChannelSet::quadraphonic() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround)); } | |||
AudioChannelSet AudioChannelSet::pentagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | |||
AudioChannelSet AudioChannelSet::hexagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurroundRear) | (1u << rightSurroundRear) | (1u << centre) | (1u << centreSurround)); } | |||
AudioChannelSet AudioChannelSet::octagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround) | (1u << centre) | (1u << centreSurround) | (1u << wideLeft) | (1u << wideRight)); } | |||
AudioChannelSet AudioChannelSet::hexagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << centreSurround) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | |||
AudioChannelSet AudioChannelSet::octagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround) | (1u << wideLeft) | (1u << wideRight)); } | |||
AudioChannelSet AudioChannelSet::discreteChannels (int numChannels) | |||
@@ -311,30 +304,30 @@ AudioChannelSet AudioChannelSet::discreteChannels (int numChannels) | |||
AudioChannelSet AudioChannelSet::canonicalChannelSet (int numChannels) | |||
{ | |||
if (numChannels == 1) return AudioChannelSet::mono(); | |||
if (numChannels == 2) return AudioChannelSet::stereo(); | |||
if (numChannels == 3) return AudioChannelSet::createLCR(); | |||
if (numChannels == 4) return AudioChannelSet::quadraphonic(); | |||
if (numChannels == 5) return AudioChannelSet::create5point0(); | |||
if (numChannels == 6) return AudioChannelSet::create5point1(); | |||
if (numChannels == 7) return AudioChannelSet::create7point0(); | |||
if (numChannels == 8) return AudioChannelSet::create7point1(); | |||
if (numChannels == 1) return AudioChannelSet::mono(); | |||
if (numChannels == 2) return AudioChannelSet::stereo(); | |||
if (numChannels == 3) return AudioChannelSet::createLCR(); | |||
if (numChannels == 4) return AudioChannelSet::quadraphonic(); | |||
if (numChannels == 5) return AudioChannelSet::create5point0(); | |||
if (numChannels == 6) return AudioChannelSet::create5point1(); | |||
if (numChannels == 7) return AudioChannelSet::create7point0(); | |||
if (numChannels == 8) return AudioChannelSet::create7point1(); | |||
return discreteChannels (numChannels); | |||
} | |||
AudioChannelSet AudioChannelSet::namedChannelSet (int numChannels) | |||
{ | |||
if (numChannels == 1) return AudioChannelSet::mono(); | |||
if (numChannels == 2) return AudioChannelSet::stereo(); | |||
if (numChannels == 3) return AudioChannelSet::createLCR(); | |||
if (numChannels == 4) return AudioChannelSet::quadraphonic(); | |||
if (numChannels == 5) return AudioChannelSet::create5point0(); | |||
if (numChannels == 6) return AudioChannelSet::create5point1(); | |||
if (numChannels == 7) return AudioChannelSet::create7point0(); | |||
if (numChannels == 8) return AudioChannelSet::create7point1(); | |||
return AudioChannelSet(); | |||
if (numChannels == 1) return AudioChannelSet::mono(); | |||
if (numChannels == 2) return AudioChannelSet::stereo(); | |||
if (numChannels == 3) return AudioChannelSet::createLCR(); | |||
if (numChannels == 4) return AudioChannelSet::quadraphonic(); | |||
if (numChannels == 5) return AudioChannelSet::create5point0(); | |||
if (numChannels == 6) return AudioChannelSet::create5point1(); | |||
if (numChannels == 7) return AudioChannelSet::create7point0(); | |||
if (numChannels == 8) return AudioChannelSet::create7point1(); | |||
return {}; | |||
} | |||
Array<AudioChannelSet> AudioChannelSet::channelSetsWithNumberOfChannels (int numChannels) | |||
@@ -393,3 +386,31 @@ Array<AudioChannelSet> AudioChannelSet::channelSetsWithNumberOfChannels (int num | |||
return retval; | |||
} | |||
AudioChannelSet JUCE_CALLTYPE AudioChannelSet::channelSetWithChannels (const Array<ChannelType>& channelArray) | |||
{ | |||
AudioChannelSet set; | |||
for (auto ch : channelArray) | |||
{ | |||
jassert (! set.channels[static_cast<int> (ch)]); | |||
set.addChannel (ch); | |||
} | |||
return set; | |||
} | |||
//============================================================================== | |||
AudioChannelSet JUCE_CALLTYPE AudioChannelSet::fromWaveChannelMask (int32 dwChannelMask) | |||
{ | |||
return AudioChannelSet (static_cast<uint32> ((dwChannelMask & ((1 << 18) - 1)) << 1)); | |||
} | |||
int32 AudioChannelSet::getWaveChannelMask() const noexcept | |||
{ | |||
if (channels.getHighestBit() > topRearRight) | |||
return -1; | |||
return (channels.toInteger() >> 1); | |||
} |
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_AUDIOCHANNELSET_H_INCLUDED | |||
#define JUCE_AUDIOCHANNELSET_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -60,21 +51,21 @@ public: | |||
/** Creates a zero-channel set which can be used to indicate that a | |||
bus is disabled. */ | |||
static AudioChannelSet disabled(); | |||
static AudioChannelSet JUCE_CALLTYPE disabled(); | |||
//============================================================================== | |||
/** Creates a one-channel mono set (centre). | |||
Is equivalent to: kMonoAAX (VST), AAX_eStemFormat_Mono (AAX), kAudioChannelLayoutTag_Mono (CoreAudio) | |||
*/ | |||
static AudioChannelSet mono(); | |||
static AudioChannelSet JUCE_CALLTYPE mono(); | |||
/** Creates a set containing a stereo set (left, right). | |||
Is equivalent to: kStereo (VST), AAX_eStemFormat_Stereo (AAX), kAudioChannelLayoutTag_Stereo (CoreAudio) | |||
*/ | |||
static AudioChannelSet stereo(); | |||
static AudioChannelSet JUCE_CALLTYPE stereo(); | |||
//============================================================================== | |||
@@ -85,7 +76,7 @@ public: | |||
This format is referred to as "LRC" in Cubase. | |||
This format is referred to as "LCR" in Pro Tools. | |||
*/ | |||
static AudioChannelSet createLCR(); | |||
static AudioChannelSet JUCE_CALLTYPE createLCR(); | |||
/** Creates a set containing an LRS set (left, right, surround). | |||
@@ -94,7 +85,7 @@ public: | |||
This format is referred to as "LRS" in Cubase. | |||
*/ | |||
static AudioChannelSet createLRS(); | |||
static AudioChannelSet JUCE_CALLTYPE createLRS(); | |||
/** Creates a set containing an LCRS set (left, right, centre, surround). | |||
@@ -105,7 +96,7 @@ public: | |||
This format is referred to as "LRCS" in Cubase. | |||
This format is referred to as "LCRS" in Pro Tools. | |||
*/ | |||
static AudioChannelSet createLCRS(); | |||
static AudioChannelSet JUCE_CALLTYPE createLCRS(); | |||
//============================================================================== | |||
@@ -116,7 +107,7 @@ public: | |||
This format is referred to as "5.0" in Cubase. | |||
This format is referred to as "5.0" in Pro Tools. | |||
*/ | |||
static AudioChannelSet create5point0(); | |||
static AudioChannelSet JUCE_CALLTYPE create5point0(); | |||
/** Creates a set for a 5.1 surround setup (left, right, centre, leftSurround, rightSurround, LFE). | |||
@@ -127,7 +118,7 @@ public: | |||
This format is referred to as "5.1" in Cubase. | |||
This format is referred to as "5.1" in Pro Tools. | |||
*/ | |||
static AudioChannelSet create5point1(); | |||
static AudioChannelSet JUCE_CALLTYPE create5point1(); | |||
/** Creates a set for a 6.0 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround). | |||
@@ -138,7 +129,7 @@ public: | |||
This format is referred to as "6.0 Cine" in Cubase. | |||
This format is referred to as "6.0" in Pro Tools. | |||
*/ | |||
static AudioChannelSet create6point0(); | |||
static AudioChannelSet JUCE_CALLTYPE create6point0(); | |||
/** Creates a set for a 6.1 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround, LFE). | |||
@@ -147,7 +138,7 @@ public: | |||
This format is referred to as "6.1" in Pro Tools. | |||
*/ | |||
static AudioChannelSet create6point1(); | |||
static AudioChannelSet JUCE_CALLTYPE create6point1(); | |||
/** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide). | |||
@@ -156,14 +147,14 @@ public: | |||
This format is referred to as "6.0 Music" in Cubase. | |||
*/ | |||
static AudioChannelSet create6point0Music(); | |||
static AudioChannelSet JUCE_CALLTYPE create6point0Music(); | |||
/** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide, LFE). | |||
Is equivalent to: k61Music (VST), n/a (AAX), kAudioChannelLayoutTag_DTS_6_1_A (CoreAudio) | |||
*/ | |||
static AudioChannelSet create6point1Music(); | |||
static AudioChannelSet JUCE_CALLTYPE create6point1Music(); | |||
/** Creates a set for a DTS 7.0 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear). | |||
@@ -172,7 +163,7 @@ public: | |||
This format is referred to as "7.0" in Pro Tools. | |||
*/ | |||
static AudioChannelSet create7point0(); | |||
static AudioChannelSet JUCE_CALLTYPE create7point0(); | |||
/** Creates a set for a SDDS 7.0 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre). | |||
@@ -181,7 +172,7 @@ public: | |||
This format is referred to as "7.0 SDDS" in Pro Tools. | |||
*/ | |||
static AudioChannelSet create7point0SDDS(); | |||
static AudioChannelSet JUCE_CALLTYPE create7point0SDDS(); | |||
/** Creates a set for a DTS 7.1 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE). | |||
@@ -191,7 +182,7 @@ public: | |||
This format is referred to as "7.1 (3/4.1)" in Logic Pro. | |||
This format is referred to as "7.1" in Pro Tools. | |||
*/ | |||
static AudioChannelSet create7point1(); | |||
static AudioChannelSet JUCE_CALLTYPE create7point1(); | |||
/** Creates a set for a 7.1 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre, LFE). | |||
@@ -201,7 +192,7 @@ public: | |||
This format is referred to as "7.1 (SDDS)" in Logic Pro. | |||
This format is referred to as "7.1 SDDS" in Pro Tools. | |||
*/ | |||
static AudioChannelSet create7point1SDDS(); | |||
static AudioChannelSet JUCE_CALLTYPE create7point1SDDS(); | |||
//============================================================================== | |||
@@ -209,7 +200,7 @@ public: | |||
Is equivalent to: kBFormat (VST), n/a (AAX), kAudioChannelLayoutTag_Ambisonic_B_Format (CoreAudio) | |||
*/ | |||
static AudioChannelSet ambisonic(); | |||
static AudioChannelSet JUCE_CALLTYPE ambisonic(); | |||
/** Creates a set for quadraphonic surround setup (left, right, leftSurround, rightSurround) | |||
@@ -220,45 +211,45 @@ public: | |||
This format is referred to as "Quadro" in Cubase. | |||
This format is referred to as "Quad" in Pro Tools. | |||
*/ | |||
static AudioChannelSet quadraphonic(); | |||
static AudioChannelSet JUCE_CALLTYPE quadraphonic(); | |||
/** Creates a set for pentagonal surround setup (left, right, centre, leftSurroundRear, rightSurroundRear). | |||
Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Pentagonal (CoreAudio) | |||
*/ | |||
static AudioChannelSet pentagonal(); | |||
static AudioChannelSet JUCE_CALLTYPE pentagonal(); | |||
/** Creates a set for hexagonal surround setup (left, right, leftSurroundRear, rightSurroundRear, centre, surroundCentre). | |||
Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Hexagonal (CoreAudio) | |||
*/ | |||
static AudioChannelSet hexagonal(); | |||
static AudioChannelSet JUCE_CALLTYPE hexagonal(); | |||
/** Creates a set for octagonal surround setup (left, right, leftSurround, rightSurround, centre, centreSurround, wideLeft, wideRight). | |||
Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Octagonal (CoreAudio) | |||
*/ | |||
static AudioChannelSet octagonal(); | |||
static AudioChannelSet JUCE_CALLTYPE octagonal(); | |||
//============================================================================== | |||
/** Creates a set of untyped discrete channels. */ | |||
static AudioChannelSet discreteChannels (int numChannels); | |||
static AudioChannelSet JUCE_CALLTYPE discreteChannels (int numChannels); | |||
/** Create a canonical channel set for a given number of channels. | |||
For example, numChannels = 1 will return mono, numChannels = 2 will return stereo, etc. */ | |||
static AudioChannelSet canonicalChannelSet (int numChannels); | |||
static AudioChannelSet JUCE_CALLTYPE canonicalChannelSet (int numChannels); | |||
/** Create a channel set for a given number of channels which is non-discrete. | |||
If numChannels is larger than the number of channels of the surround format | |||
with the maximum amount of channels (currently 7.1 Surround), then this | |||
function returns an empty set.*/ | |||
static AudioChannelSet namedChannelSet (int numChannels); | |||
static AudioChannelSet JUCE_CALLTYPE namedChannelSet (int numChannels); | |||
/** Return an array of channel sets which have a given number of channels */ | |||
static Array<AudioChannelSet> channelSetsWithNumberOfChannels (int numChannels); | |||
static Array<AudioChannelSet> JUCE_CALLTYPE channelSetsWithNumberOfChannels (int numChannels); | |||
//============================================================================== | |||
/** Represents different audio channel types. */ | |||
@@ -303,13 +294,13 @@ public: | |||
}; | |||
/** Returns the name of a given channel type. For example, this method may return "Surround Left". */ | |||
static String getChannelTypeName (ChannelType); | |||
static String JUCE_CALLTYPE getChannelTypeName (ChannelType); | |||
/** Returns the abbreviated name of a channel type. For example, this method may return "Ls". */ | |||
static String getAbbreviatedChannelTypeName (ChannelType); | |||
static String JUCE_CALLTYPE getAbbreviatedChannelTypeName (ChannelType); | |||
/** Returns the channel type from an abbreviated name. */ | |||
static ChannelType getChannelTypeFromAbbreviation (const String& abbreviation); | |||
static ChannelType JUCE_CALLTYPE getChannelTypeFromAbbreviation (const String& abbreviation); | |||
//============================================================================== | |||
enum | |||
@@ -360,16 +351,40 @@ public: | |||
/** Intersect two channel layouts. */ | |||
void intersect (const AudioChannelSet& other) { channels &= other.channels; } | |||
/** Creates a channel set for a list of channel types. This function will assert | |||
if you supply a duplicate channel. | |||
Note that this method ignores the order in which the channels are given, i.e. | |||
two arrays with the same elements but in a different order will still result | |||
in the same channel set. | |||
*/ | |||
static AudioChannelSet JUCE_CALLTYPE channelSetWithChannels (const Array<ChannelType>&); | |||
//============================================================================== | |||
// Conversion between wave and juce channel layout identifiers | |||
/** Create an AudioChannelSet from a WAVEFORMATEXTENSIBLE channelMask (typically used | |||
in .wav files). */ | |||
static AudioChannelSet JUCE_CALLTYPE fromWaveChannelMask (int32 dwChannelMask); | |||
/** Returns a WAVEFORMATEXTENSIBLE channelMask representation (typically used in .wav | |||
files) of the receiver. | |||
Returns -1 if the receiver cannot be represented in a WAVEFORMATEXTENSIBLE channelMask | |||
representation. | |||
*/ | |||
int32 getWaveChannelMask() const noexcept; | |||
//============================================================================== | |||
bool operator== (const AudioChannelSet&) const noexcept; | |||
bool operator!= (const AudioChannelSet&) const noexcept; | |||
bool operator< (const AudioChannelSet&) const noexcept; | |||
private: | |||
//============================================================================== | |||
BigInteger channels; | |||
//============================================================================== | |||
explicit AudioChannelSet (uint32); | |||
explicit AudioChannelSet (const Array<ChannelType>&); | |||
}; | |||
#endif // JUCE_AUDIOCHANNELSET_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -483,7 +475,7 @@ void AudioDataConverters::deinterleaveSamples (const float* const source, | |||
class AudioConversionTests : public UnitTest | |||
{ | |||
public: | |||
AudioConversionTests() : UnitTest ("Audio data conversion") {} | |||
AudioConversionTests() : UnitTest ("Audio data conversion", "Audio") {} | |||
template <class F1, class E1, class F2, class E2> | |||
struct Test5 | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_AUDIODATACONVERTERS_H_INCLUDED | |||
#define JUCE_AUDIODATACONVERTERS_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -371,7 +362,7 @@ public: | |||
{ | |||
// If you're using interleaved data, call the other constructor! If you're using non-interleaved data, | |||
// you should pass NonInterleaved as the template parameter for the interleaving type! | |||
static_jassert (InterleavingType::isInterleavedType == 0); | |||
static_assert (InterleavingType::isInterleavedType == 0, "Incorrect constructor for interleaved data"); | |||
} | |||
/** Creates a pointer from some raw data in the appropriate format with the specified number of interleaved channels. | |||
@@ -411,7 +402,8 @@ public: | |||
*/ | |||
inline void setAsFloat (float newValue) noexcept | |||
{ | |||
static_jassert (Constness::isConst == 0); // trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||
// trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||
static_assert (Constness::isConst == 0, "Attempt to write to a const pointer"); | |||
Endianness::setAsFloat (data, newValue); | |||
} | |||
@@ -428,7 +420,8 @@ public: | |||
*/ | |||
inline void setAsInt32 (int32 newValue) noexcept | |||
{ | |||
static_jassert (Constness::isConst == 0); // trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||
// trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||
static_assert (Constness::isConst == 0, "Attempt to write to a const pointer"); | |||
Endianness::setAsInt32 (data, newValue); | |||
} | |||
@@ -446,7 +439,8 @@ public: | |||
*/ | |||
void convertSamples (Pointer source, int numSamples) const noexcept | |||
{ | |||
static_jassert (Constness::isConst == 0); // trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||
// trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||
static_assert (Constness::isConst == 0, "Attempt to write to a const pointer"); | |||
for (Pointer dest (*this); --numSamples >= 0;) | |||
{ | |||
@@ -462,7 +456,8 @@ public: | |||
template <class OtherPointerType> | |||
void convertSamples (OtherPointerType source, int numSamples) const noexcept | |||
{ | |||
static_jassert (Constness::isConst == 0); // trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||
// trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||
static_assert (Constness::isConst == 0, "Attempt to write to a const pointer"); | |||
Pointer dest (*this); | |||
@@ -713,6 +708,3 @@ private: | |||
AudioDataConverters(); | |||
JUCE_DECLARE_NON_COPYABLE (AudioDataConverters) | |||
}; | |||
#endif // JUCE_AUDIODATACONVERTERS_H_INCLUDED |
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED | |||
#define JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -62,13 +53,11 @@ public: | |||
throw a std::bad_alloc exception. | |||
*/ | |||
AudioBuffer (int numChannelsToAllocate, | |||
int numSamplesToAllocate) noexcept | |||
int numSamplesToAllocate) | |||
: numChannels (numChannelsToAllocate), | |||
size (numSamplesToAllocate) | |||
{ | |||
jassert (size >= 0); | |||
jassert (numChannels >= 0); | |||
jassert (size >= 0 && numChannels >= 0); | |||
allocateData(); | |||
} | |||
@@ -89,7 +78,7 @@ public: | |||
*/ | |||
AudioBuffer (Type* const* dataToReferTo, | |||
int numChannelsToUse, | |||
int numSamples) noexcept | |||
int numSamples) | |||
: numChannels (numChannelsToUse), | |||
size (numSamples), | |||
allocatedBytes (0) | |||
@@ -118,7 +107,7 @@ public: | |||
AudioBuffer (Type* const* dataToReferTo, | |||
int numChannelsToUse, | |||
int startSample, | |||
int numSamples) noexcept | |||
int numSamples) | |||
: numChannels (numChannelsToUse), | |||
size (numSamples), | |||
allocatedBytes (0), | |||
@@ -135,7 +124,7 @@ public: | |||
using an external data buffer, in which case boths buffers will just point to the same | |||
shared block of data. | |||
*/ | |||
AudioBuffer (const AudioBuffer& other) noexcept | |||
AudioBuffer (const AudioBuffer& other) | |||
: numChannels (other.numChannels), | |||
size (other.size), | |||
allocatedBytes (other.allocatedBytes) | |||
@@ -163,7 +152,7 @@ public: | |||
/** Copies another buffer onto this one. | |||
This buffer's size will be changed to that of the other buffer. | |||
*/ | |||
AudioBuffer& operator= (const AudioBuffer& other) noexcept | |||
AudioBuffer& operator= (const AudioBuffer& other) | |||
{ | |||
if (this != &other) | |||
{ | |||
@@ -190,7 +179,6 @@ public: | |||
*/ | |||
~AudioBuffer() noexcept {} | |||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||
/** Move constructor */ | |||
AudioBuffer (AudioBuffer&& other) noexcept | |||
: numChannels (other.numChannels), | |||
@@ -221,16 +209,15 @@ public: | |||
other.allocatedBytes = 0; | |||
return *this; | |||
} | |||
#endif | |||
//============================================================================== | |||
/** Returns the number of channels of audio data that this buffer contains. | |||
@see getSampleData | |||
@see getNumSamples, getReadPointer, getWritePointer | |||
*/ | |||
int getNumChannels() const noexcept { return numChannels; } | |||
/** Returns the number of samples allocated in each of the buffer's channels. | |||
@see getSampleData | |||
@see getNumChannels, getReadPointer, getWritePointer | |||
*/ | |||
int getNumSamples() const noexcept { return size; } | |||
@@ -244,7 +231,7 @@ public: | |||
const Type* getReadPointer (int channelNumber) const noexcept | |||
{ | |||
jassert (isPositiveAndBelow (channelNumber, numChannels)); | |||
return channels [channelNumber]; | |||
return channels[channelNumber]; | |||
} | |||
/** Returns a pointer to an array of read-only samples in one of the buffer's channels. | |||
@@ -258,7 +245,7 @@ public: | |||
{ | |||
jassert (isPositiveAndBelow (channelNumber, numChannels)); | |||
jassert (isPositiveAndBelow (sampleIndex, size)); | |||
return channels [channelNumber] + sampleIndex; | |||
return channels[channelNumber] + sampleIndex; | |||
} | |||
/** Returns a writeable pointer to one of the buffer's channels. | |||
@@ -271,7 +258,7 @@ public: | |||
{ | |||
jassert (isPositiveAndBelow (channelNumber, numChannels)); | |||
isClear = false; | |||
return channels [channelNumber]; | |||
return channels[channelNumber]; | |||
} | |||
/** Returns a writeable pointer to one of the buffer's channels. | |||
@@ -285,7 +272,7 @@ public: | |||
jassert (isPositiveAndBelow (channelNumber, numChannels)); | |||
jassert (isPositiveAndBelow (sampleIndex, size)); | |||
isClear = false; | |||
return channels [channelNumber] + sampleIndex; | |||
return channels[channelNumber] + sampleIndex; | |||
} | |||
/** Returns an array of pointers to the channels in the buffer. | |||
@@ -326,27 +313,27 @@ public: | |||
int newNumSamples, | |||
bool keepExistingContent = false, | |||
bool clearExtraSpace = false, | |||
bool avoidReallocating = false) noexcept | |||
bool avoidReallocating = false) | |||
{ | |||
jassert (newNumChannels >= 0); | |||
jassert (newNumSamples >= 0); | |||
if (newNumSamples != size || newNumChannels != numChannels) | |||
{ | |||
const size_t allocatedSamplesPerChannel = ((size_t) newNumSamples + 3) & ~3u; | |||
const size_t channelListSize = ((sizeof (Type*) * (size_t) (newNumChannels + 1)) + 15) & ~15u; | |||
const size_t newTotalBytes = ((size_t) newNumChannels * (size_t) allocatedSamplesPerChannel * sizeof (Type)) | |||
+ channelListSize + 32; | |||
const auto allocatedSamplesPerChannel = ((size_t) newNumSamples + 3) & ~3u; | |||
const auto channelListSize = ((sizeof (Type*) * (size_t) (newNumChannels + 1)) + 15) & ~15u; | |||
const auto newTotalBytes = ((size_t) newNumChannels * (size_t) allocatedSamplesPerChannel * sizeof (Type)) | |||
+ channelListSize + 32; | |||
if (keepExistingContent) | |||
{ | |||
HeapBlock<char, true> newData; | |||
newData.allocate (newTotalBytes, clearExtraSpace || isClear); | |||
const size_t numSamplesToCopy = (size_t) jmin (newNumSamples, size); | |||
auto numSamplesToCopy = (size_t) jmin (newNumSamples, size); | |||
Type** const newChannels = reinterpret_cast<Type**> (newData.getData()); | |||
Type* newChan = reinterpret_cast<Type*> (newData + channelListSize); | |||
auto newChannels = reinterpret_cast<Type**> (newData.getData()); | |||
auto newChan = reinterpret_cast<Type*> (newData + channelListSize); | |||
for (int j = 0; j < newNumChannels; ++j) | |||
{ | |||
@@ -356,7 +343,8 @@ public: | |||
if (! isClear) | |||
{ | |||
const int numChansToCopy = jmin (numChannels, newNumChannels); | |||
auto numChansToCopy = jmin (numChannels, newNumChannels); | |||
for (int i = 0; i < numChansToCopy; ++i) | |||
FloatVectorOperations::copy (newChannels[i], channels[i], (int) numSamplesToCopy); | |||
} | |||
@@ -379,7 +367,8 @@ public: | |||
channels = reinterpret_cast<Type**> (allocatedData.getData()); | |||
} | |||
Type* chan = reinterpret_cast<Type*> (allocatedData + channelListSize); | |||
auto* chan = reinterpret_cast<Type*> (allocatedData + channelListSize); | |||
for (int i = 0; i < newNumChannels; ++i) | |||
{ | |||
channels[i] = chan; | |||
@@ -387,7 +376,7 @@ public: | |||
} | |||
} | |||
channels [newNumChannels] = 0; | |||
channels[newNumChannels] = 0; | |||
size = newNumSamples; | |||
numChannels = newNumChannels; | |||
} | |||
@@ -408,12 +397,14 @@ public: | |||
it when the buffer is deleted or resized. | |||
@param newNumChannels the number of channels to use - this must correspond to the | |||
number of elements in the array passed in | |||
@param newStartSample the offset within the arrays at which the data begins | |||
@param newNumSamples the number of samples to use - this must correspond to the | |||
size of the arrays passed in | |||
*/ | |||
void setDataToReferTo (Type** dataToReferTo, | |||
const int newNumChannels, | |||
const int newNumSamples) noexcept | |||
int newNumChannels, | |||
int newStartSample, | |||
int newNumSamples) | |||
{ | |||
jassert (dataToReferTo != nullptr); | |||
jassert (newNumChannels >= 0 && newNumSamples >= 0); | |||
@@ -427,10 +418,35 @@ public: | |||
numChannels = newNumChannels; | |||
size = newNumSamples; | |||
allocateChannels (dataToReferTo, 0); | |||
allocateChannels (dataToReferTo, newStartSample); | |||
jassert (! isClear); | |||
} | |||
/** Makes this buffer point to a pre-allocated set of channel data arrays. | |||
There's also a constructor that lets you specify arrays like this, but this | |||
lets you change the channels dynamically. | |||
Note that if the buffer is resized or its number of channels is changed, it | |||
will re-allocate memory internally and copy the existing data to this new area, | |||
so it will then stop directly addressing this memory. | |||
@param dataToReferTo a pre-allocated array containing pointers to the data | |||
for each channel that should be used by this buffer. The | |||
buffer will only refer to this memory, it won't try to delete | |||
it when the buffer is deleted or resized. | |||
@param newNumChannels the number of channels to use - this must correspond to the | |||
number of elements in the array passed in | |||
@param newNumSamples the number of samples to use - this must correspond to the | |||
size of the arrays passed in | |||
*/ | |||
void setDataToReferTo (Type** dataToReferTo, | |||
int newNumChannels, | |||
int newNumSamples) | |||
{ | |||
setDataToReferTo (dataToReferTo, newNumChannels, 0, newNumSamples); | |||
} | |||
/** Resizes this buffer to match the given one, and copies all of its content across. | |||
The source buffer can contain a different floating point type, so this can be used to | |||
convert between 32 and 64 bit float buffer types. | |||
@@ -446,10 +462,12 @@ public: | |||
} | |||
else | |||
{ | |||
isClear = false; | |||
for (int chan = 0; chan < numChannels; ++chan) | |||
{ | |||
Type* const dest = channels[chan]; | |||
const OtherType* const src = other.getReadPointer (chan); | |||
auto* dest = channels[chan]; | |||
auto* src = other.getReadPointer (chan); | |||
for (int i = 0; i < size; ++i) | |||
dest[i] = static_cast<Type> (src[i]); | |||
@@ -475,10 +493,9 @@ public: | |||
For speed, this doesn't check whether the channel and sample number | |||
are in-range, so be careful! | |||
*/ | |||
void clear (int startSample, | |||
int numSamples) noexcept | |||
void clear (int startSample, int numSamples) noexcept | |||
{ | |||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||
if (! isClear) | |||
{ | |||
@@ -495,15 +512,13 @@ public: | |||
For speed, this doesn't check whether the channel and sample number | |||
are in-range, so be careful! | |||
*/ | |||
void clear (int channel, | |||
int startSample, | |||
int numSamples) noexcept | |||
void clear (int channel, int startSample, int numSamples) noexcept | |||
{ | |||
jassert (isPositiveAndBelow (channel, numChannels)); | |||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||
if (! isClear) | |||
FloatVectorOperations::clear (channels [channel] + startSample, numSamples); | |||
FloatVectorOperations::clear (channels[channel] + startSample, numSamples); | |||
} | |||
/** Returns true if the buffer has been entirely cleared. | |||
@@ -524,7 +539,7 @@ public: | |||
{ | |||
jassert (isPositiveAndBelow (channel, numChannels)); | |||
jassert (isPositiveAndBelow (sampleIndex, size)); | |||
return *(channels [channel] + sampleIndex); | |||
return *(channels[channel] + sampleIndex); | |||
} | |||
/** Sets a sample in the buffer. | |||
@@ -536,7 +551,7 @@ public: | |||
{ | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (isPositiveAndBelow (destSample, size)); | |||
*(channels [destChannel] + destSample) = newValue; | |||
*(channels[destChannel] + destSample) = newValue; | |||
isClear = false; | |||
} | |||
@@ -549,7 +564,7 @@ public: | |||
{ | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (isPositiveAndBelow (destSample, size)); | |||
*(channels [destChannel] + destSample) += valueToAdd; | |||
*(channels[destChannel] + destSample) += valueToAdd; | |||
isClear = false; | |||
} | |||
@@ -558,19 +573,16 @@ public: | |||
For speed, this doesn't check whether the channel and sample number | |||
are in-range, so be careful! | |||
*/ | |||
void applyGain (int channel, | |||
int startSample, | |||
int numSamples, | |||
Type gain) noexcept | |||
void applyGain (int channel, int startSample, int numSamples, Type gain) noexcept | |||
{ | |||
jassert (isPositiveAndBelow (channel, numChannels)); | |||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||
if (gain != 1.0f && ! isClear) | |||
if (gain != (Type) 1 && ! isClear) | |||
{ | |||
Type* const d = channels [channel] + startSample; | |||
auto* d = channels[channel] + startSample; | |||
if (gain == 0.0f) | |||
if (gain == 0) | |||
FloatVectorOperations::clear (d, numSamples); | |||
else | |||
FloatVectorOperations::multiply (d, gain, numSamples); | |||
@@ -582,9 +594,7 @@ public: | |||
For speed, this doesn't check whether the sample numbers | |||
are in-range, so be careful! | |||
*/ | |||
void applyGain (int startSample, | |||
int numSamples, | |||
Type gain) noexcept | |||
void applyGain (int startSample, int numSamples, Type gain) noexcept | |||
{ | |||
for (int i = 0; i < numChannels; ++i) | |||
applyGain (i, startSample, numSamples, gain); | |||
@@ -605,11 +615,8 @@ public: | |||
For speed, this doesn't check whether the sample numbers | |||
are in-range, so be careful! | |||
*/ | |||
void applyGainRamp (int channel, | |||
int startSample, | |||
int numSamples, | |||
Type startGain, | |||
Type endGain) noexcept | |||
void applyGainRamp (int channel, int startSample, int numSamples, | |||
Type startGain, Type endGain) noexcept | |||
{ | |||
if (! isClear) | |||
{ | |||
@@ -620,10 +627,10 @@ public: | |||
else | |||
{ | |||
jassert (isPositiveAndBelow (channel, numChannels)); | |||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||
const Type increment = (endGain - startGain) / numSamples; | |||
Type* d = channels [channel] + startSample; | |||
const auto increment = (endGain - startGain) / numSamples; | |||
auto* d = channels[channel] + startSample; | |||
while (--numSamples >= 0) | |||
{ | |||
@@ -643,10 +650,8 @@ public: | |||
For speed, this doesn't check whether the sample numbers | |||
are in-range, so be careful! | |||
*/ | |||
void applyGainRamp (int startSample, | |||
int numSamples, | |||
Type startGain, | |||
Type endGain) noexcept | |||
void applyGainRamp (int startSample, int numSamples, | |||
Type startGain, Type endGain) noexcept | |||
{ | |||
for (int i = 0; i < numChannels; ++i) | |||
applyGainRamp (i, startSample, numSamples, startGain, endGain); | |||
@@ -675,27 +680,27 @@ public: | |||
{ | |||
jassert (&source != this || sourceChannel != destChannel); | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||
jassert (isPositiveAndBelow (sourceChannel, source.numChannels)); | |||
jassert (sourceStartSample >= 0 && sourceStartSample + numSamples <= source.size); | |||
if (gainToApplyToSource != 0.0f && numSamples > 0 && ! source.isClear) | |||
if (gainToApplyToSource != 0 && numSamples > 0 && ! source.isClear) | |||
{ | |||
Type* const d = channels [destChannel] + destStartSample; | |||
const Type* const s = source.channels [sourceChannel] + sourceStartSample; | |||
auto* d = channels[destChannel] + destStartSample; | |||
auto* s = source.channels[sourceChannel] + sourceStartSample; | |||
if (isClear) | |||
{ | |||
isClear = false; | |||
if (gainToApplyToSource != 1.0f) | |||
if (gainToApplyToSource != (Type) 1) | |||
FloatVectorOperations::copyWithMultiply (d, s, gainToApplyToSource, numSamples); | |||
else | |||
FloatVectorOperations::copy (d, s, numSamples); | |||
} | |||
else | |||
{ | |||
if (gainToApplyToSource != 1.0f) | |||
if (gainToApplyToSource != (Type) 1) | |||
FloatVectorOperations::addWithMultiply (d, s, gainToApplyToSource, numSamples); | |||
else | |||
FloatVectorOperations::add (d, s, numSamples); | |||
@@ -722,25 +727,25 @@ public: | |||
Type gainToApplyToSource = (Type) 1) noexcept | |||
{ | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||
jassert (source != nullptr); | |||
if (gainToApplyToSource != 0.0f && numSamples > 0) | |||
if (gainToApplyToSource != 0 && numSamples > 0) | |||
{ | |||
Type* const d = channels [destChannel] + destStartSample; | |||
auto* d = channels[destChannel] + destStartSample; | |||
if (isClear) | |||
{ | |||
isClear = false; | |||
if (gainToApplyToSource != 1.0f) | |||
if (gainToApplyToSource != (Type) 1) | |||
FloatVectorOperations::copyWithMultiply (d, source, gainToApplyToSource, numSamples); | |||
else | |||
FloatVectorOperations::copy (d, source, numSamples); | |||
} | |||
else | |||
{ | |||
if (gainToApplyToSource != 1.0f) | |||
if (gainToApplyToSource != (Type) 1) | |||
FloatVectorOperations::addWithMultiply (d, source, gainToApplyToSource, numSamples); | |||
else | |||
FloatVectorOperations::add (d, source, numSamples); | |||
@@ -767,21 +772,21 @@ public: | |||
Type startGain, | |||
Type endGain) noexcept | |||
{ | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
jassert (source != nullptr); | |||
if (startGain == endGain) | |||
{ | |||
addFrom (destChannel, destStartSample, source, numSamples, startGain); | |||
} | |||
else | |||
{ | |||
if (numSamples > 0 && (startGain != 0.0f || endGain != 0.0f)) | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||
jassert (source != nullptr); | |||
if (numSamples > 0) | |||
{ | |||
isClear = false; | |||
const Type increment = (endGain - startGain) / numSamples; | |||
Type* d = channels [destChannel] + destStartSample; | |||
const auto increment = (endGain - startGain) / numSamples; | |||
auto* d = channels[destChannel] + destStartSample; | |||
while (--numSamples >= 0) | |||
{ | |||
@@ -814,20 +819,20 @@ public: | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
jassert (isPositiveAndBelow (sourceChannel, source.numChannels)); | |||
jassert (sourceStartSample >= 0 && sourceStartSample + numSamples <= source.size); | |||
jassert (sourceStartSample >= 0 && numSamples >= 0 && sourceStartSample + numSamples <= source.size); | |||
if (numSamples > 0) | |||
{ | |||
if (source.isClear) | |||
{ | |||
if (! isClear) | |||
FloatVectorOperations::clear (channels [destChannel] + destStartSample, numSamples); | |||
FloatVectorOperations::clear (channels[destChannel] + destStartSample, numSamples); | |||
} | |||
else | |||
{ | |||
isClear = false; | |||
FloatVectorOperations::copy (channels [destChannel] + destStartSample, | |||
source.channels [sourceChannel] + sourceStartSample, | |||
FloatVectorOperations::copy (channels[destChannel] + destStartSample, | |||
source.channels[sourceChannel] + sourceStartSample, | |||
numSamples); | |||
} | |||
} | |||
@@ -848,13 +853,13 @@ public: | |||
int numSamples) noexcept | |||
{ | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||
jassert (source != nullptr); | |||
if (numSamples > 0) | |||
{ | |||
isClear = false; | |||
FloatVectorOperations::copy (channels [destChannel] + destStartSample, source, numSamples); | |||
FloatVectorOperations::copy (channels[destChannel] + destStartSample, source, numSamples); | |||
} | |||
} | |||
@@ -875,14 +880,14 @@ public: | |||
Type gain) noexcept | |||
{ | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||
jassert (source != nullptr); | |||
if (numSamples > 0) | |||
{ | |||
Type* const d = channels [destChannel] + destStartSample; | |||
auto* d = channels[destChannel] + destStartSample; | |||
if (gain != 1.0f) | |||
if (gain != (Type) 1) | |||
{ | |||
if (gain == 0) | |||
{ | |||
@@ -923,21 +928,21 @@ public: | |||
Type startGain, | |||
Type endGain) noexcept | |||
{ | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
jassert (source != nullptr); | |||
if (startGain == endGain) | |||
{ | |||
copyFrom (destChannel, destStartSample, source, numSamples, startGain); | |||
} | |||
else | |||
{ | |||
if (numSamples > 0 && (startGain != 0.0f || endGain != 0.0f)) | |||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||
jassert (source != nullptr); | |||
if (numSamples > 0) | |||
{ | |||
isClear = false; | |||
const Type increment = (endGain - startGain) / numSamples; | |||
Type* d = channels [destChannel] + destStartSample; | |||
const auto increment = (endGain - startGain) / numSamples; | |||
auto* d = channels[destChannel] + destStartSample; | |||
while (--numSamples >= 0) | |||
{ | |||
@@ -954,41 +959,35 @@ public: | |||
@param startSample the start sample within the channel | |||
@param numSamples the number of samples to check | |||
*/ | |||
Range<Type> findMinMax (int channel, | |||
int startSample, | |||
int numSamples) const noexcept | |||
Range<Type> findMinMax (int channel, int startSample, int numSamples) const noexcept | |||
{ | |||
jassert (isPositiveAndBelow (channel, numChannels)); | |||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||
if (isClear) | |||
return Range<Type>(); | |||
return {}; | |||
return FloatVectorOperations::findMinAndMax (channels [channel] + startSample, numSamples); | |||
return FloatVectorOperations::findMinAndMax (channels[channel] + startSample, numSamples); | |||
} | |||
/** Finds the highest absolute sample value within a region of a channel. */ | |||
Type getMagnitude (int channel, | |||
int startSample, | |||
int numSamples) const noexcept | |||
Type getMagnitude (int channel, int startSample, int numSamples) const noexcept | |||
{ | |||
jassert (isPositiveAndBelow (channel, numChannels)); | |||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||
if (isClear) | |||
return 0.0f; | |||
return {}; | |||
const Range<Type> r (findMinMax (channel, startSample, numSamples)); | |||
auto r = findMinMax (channel, startSample, numSamples); | |||
return jmax (r.getStart(), -r.getStart(), r.getEnd(), -r.getEnd()); | |||
} | |||
/** Finds the highest absolute sample value within a region on all channels. */ | |||
Type getMagnitude (int startSample, | |||
int numSamples) const noexcept | |||
Type getMagnitude (int startSample, int numSamples) const noexcept | |||
{ | |||
Type mag = 0.0f; | |||
Type mag = 0; | |||
if (! isClear) | |||
for (int i = 0; i < numChannels; ++i) | |||
@@ -998,22 +997,20 @@ public: | |||
} | |||
/** Returns the root mean squared level for a region of a channel. */ | |||
Type getRMSLevel (int channel, | |||
int startSample, | |||
int numSamples) const noexcept | |||
Type getRMSLevel (int channel, int startSample, int numSamples) const noexcept | |||
{ | |||
jassert (isPositiveAndBelow (channel, numChannels)); | |||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||
if (numSamples <= 0 || channel < 0 || channel >= numChannels || isClear) | |||
return 0.0f; | |||
return {}; | |||
const Type* const data = channels [channel] + startSample; | |||
auto* data = channels[channel] + startSample; | |||
double sum = 0.0; | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
const Type sample = data [i]; | |||
const Type sample = data[i]; | |||
sum += sample * sample; | |||
} | |||
@@ -1024,7 +1021,7 @@ public: | |||
void reverse (int channel, int startSample, int numSamples) const noexcept | |||
{ | |||
jassert (isPositiveAndBelow (channel, numChannels)); | |||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||
if (! isClear) | |||
std::reverse (channels[channel] + startSample, | |||
@@ -1045,28 +1042,29 @@ private: | |||
size_t allocatedBytes; | |||
Type** channels; | |||
HeapBlock<char, true> allocatedData; | |||
Type* preallocatedChannelSpace [32]; | |||
Type* preallocatedChannelSpace[32]; | |||
bool isClear; | |||
void allocateData() | |||
{ | |||
const size_t channelListSize = sizeof (Type*) * (size_t) (numChannels + 1); | |||
jassert (size >= 0); | |||
auto channelListSize = sizeof (Type*) * (size_t) (numChannels + 1); | |||
allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32; | |||
allocatedData.malloc (allocatedBytes); | |||
channels = reinterpret_cast<Type**> (allocatedData.getData()); | |||
auto* chan = (Type*) (allocatedData + channelListSize); | |||
Type* chan = (Type*) (allocatedData + channelListSize); | |||
for (int i = 0; i < numChannels; ++i) | |||
{ | |||
channels[i] = chan; | |||
chan += size; | |||
} | |||
channels [numChannels] = nullptr; | |||
channels[numChannels] = nullptr; | |||
isClear = false; | |||
} | |||
void allocateChannels (Type* const* const dataToReferTo, int offset) | |||
void allocateChannels (Type* const* dataToReferTo, int offset) | |||
{ | |||
jassert (offset >= 0); | |||
@@ -1089,7 +1087,7 @@ private: | |||
channels[i] = dataToReferTo[i] + offset; | |||
} | |||
channels [numChannels] = nullptr; | |||
channels[numChannels] = nullptr; | |||
isClear = false; | |||
} | |||
@@ -1107,6 +1105,3 @@ private: | |||
@see AudioBuffer | |||
*/ | |||
typedef AudioBuffer<float> AudioSampleBuffer; | |||
#endif // JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -697,9 +689,13 @@ void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (float* dest, const fl | |||
void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (double* dest, const double* src, double multiplier, int num) noexcept | |||
{ | |||
#if JUCE_USE_VDSP_FRAMEWORK | |||
vDSP_vsmaD (src, 1, &multiplier, dest, 1, dest, 1, (vDSP_Length) num); | |||
#else | |||
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] += src[i] * multiplier, Mode::add (d, Mode::mul (mult, s)), | |||
JUCE_LOAD_SRC_DEST, JUCE_INCREMENT_SRC_DEST, | |||
const Mode::ParallelType mult = Mode::load1 (multiplier);) | |||
#endif | |||
} | |||
void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (float* dest, const float* src1, const float* src2, int num) noexcept | |||
@@ -724,6 +720,34 @@ void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (double* dest, const d | |||
#endif | |||
} | |||
void JUCE_CALLTYPE FloatVectorOperations::subtractWithMultiply (float* dest, const float* src, float multiplier, int num) noexcept | |||
{ | |||
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] -= src[i] * multiplier, Mode::sub (d, Mode::mul (mult, s)), | |||
JUCE_LOAD_SRC_DEST, JUCE_INCREMENT_SRC_DEST, | |||
const Mode::ParallelType mult = Mode::load1 (multiplier);) | |||
} | |||
void JUCE_CALLTYPE FloatVectorOperations::subtractWithMultiply (double* dest, const double* src, double multiplier, int num) noexcept | |||
{ | |||
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] -= src[i] * multiplier, Mode::sub (d, Mode::mul (mult, s)), | |||
JUCE_LOAD_SRC_DEST, JUCE_INCREMENT_SRC_DEST, | |||
const Mode::ParallelType mult = Mode::load1 (multiplier);) | |||
} | |||
void JUCE_CALLTYPE FloatVectorOperations::subtractWithMultiply (float* dest, const float* src1, const float* src2, int num) noexcept | |||
{ | |||
JUCE_PERFORM_VEC_OP_SRC1_SRC2_DEST_DEST (dest[i] -= src1[i] * src2[i], Mode::sub (d, Mode::mul (s1, s2)), | |||
JUCE_LOAD_SRC1_SRC2_DEST, | |||
JUCE_INCREMENT_SRC1_SRC2_DEST, ) | |||
} | |||
void JUCE_CALLTYPE FloatVectorOperations::subtractWithMultiply (double* dest, const double* src1, const double* src2, int num) noexcept | |||
{ | |||
JUCE_PERFORM_VEC_OP_SRC1_SRC2_DEST_DEST (dest[i] -= src1[i] * src2[i], Mode::sub (d, Mode::mul (s1, s2)), | |||
JUCE_LOAD_SRC1_SRC2_DEST, | |||
JUCE_INCREMENT_SRC1_SRC2_DEST, ) | |||
} | |||
void JUCE_CALLTYPE FloatVectorOperations::multiply (float* dest, const float* src, int num) noexcept | |||
{ | |||
#if JUCE_USE_VDSP_FRAMEWORK | |||
@@ -1024,7 +1048,7 @@ void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport() noe | |||
class FloatVectorOperationsTests : public UnitTest | |||
{ | |||
public: | |||
FloatVectorOperationsTests() : UnitTest ("FloatVectorOperations") {} | |||
FloatVectorOperationsTests() : UnitTest ("FloatVectorOperations", "Audio") {} | |||
template <typename ValueType> | |||
struct TestRunner | |||
@@ -2,35 +2,31 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_FLOATVECTOROPERATIONS_H_INCLUDED | |||
#define JUCE_FLOATVECTOROPERATIONS_H_INCLUDED | |||
#pragma once | |||
#if JUCE_INTEL | |||
#define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8f || n > 1.0e-8f)) n = 0; | |||
#else | |||
#define JUCE_SNAP_TO_ZERO(n) | |||
#endif | |||
//============================================================================== | |||
/** | |||
@@ -113,6 +109,18 @@ public: | |||
/** Multiplies each source1 value by the corresponding source2 value, then adds it to the destination value. */ | |||
static void JUCE_CALLTYPE addWithMultiply (double* dest, const double* src1, const double* src2, int num) noexcept; | |||
/** Multiplies each source value by the given multiplier, then subtracts it to the destination value. */ | |||
static void JUCE_CALLTYPE subtractWithMultiply (float* dest, const float* src, float multiplier, int numValues) noexcept; | |||
/** Multiplies each source value by the given multiplier, then subtracts it to the destination value. */ | |||
static void JUCE_CALLTYPE subtractWithMultiply (double* dest, const double* src, double multiplier, int numValues) noexcept; | |||
/** Multiplies each source1 value by the corresponding source2 value, then subtracts it to the destination value. */ | |||
static void JUCE_CALLTYPE subtractWithMultiply (float* dest, const float* src1, const float* src2, int num) noexcept; | |||
/** Multiplies each source1 value by the corresponding source2 value, then subtracts it to the destination value. */ | |||
static void JUCE_CALLTYPE subtractWithMultiply (double* dest, const double* src1, const double* src2, int num) noexcept; | |||
/** Multiplies the destination values by the source values. */ | |||
static void JUCE_CALLTYPE multiply (float* dest, const float* src, int numValues) noexcept; | |||
@@ -211,6 +219,3 @@ public: | |||
*/ | |||
static void JUCE_CALLTYPE disableDenormalisedNumberSupport() noexcept; | |||
}; | |||
#endif // JUCE_FLOATVECTOROPERATIONS_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_DECIBELS_H_INCLUDED | |||
#define JUCE_DECIBELS_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -105,6 +96,3 @@ private: | |||
Decibels(); // This class can't be instantiated, it's just a holder for static methods.. | |||
JUCE_DECLARE_NON_COPYABLE (Decibels) | |||
}; | |||
#endif // JUCE_DECIBELS_H_INCLUDED |
@@ -2,38 +2,24 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#if JUCE_INTEL | |||
#define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8f || n > 1.0e-8f)) n = 0; | |||
#else | |||
#define JUCE_SNAP_TO_ZERO(n) | |||
#endif | |||
//============================================================================== | |||
IIRCoefficients::IIRCoefficients() noexcept | |||
{ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_IIRFILTER_H_INCLUDED | |||
#define JUCE_IIRFILTER_H_INCLUDED | |||
#pragma once | |||
class IIRFilter; | |||
@@ -214,6 +205,3 @@ protected: | |||
IIRFilter& operator= (const IIRFilter&); | |||
JUCE_LEAK_DETECTOR (IIRFilter) | |||
}; | |||
#endif // JUCE_IIRFILTER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_LINEARSMOOTHEDVALUE_H_INCLUDED | |||
#define JUCE_LINEARSMOOTHEDVALUE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -45,18 +36,20 @@ class LinearSmoothedValue | |||
public: | |||
/** Constructor. */ | |||
LinearSmoothedValue() noexcept | |||
: currentValue (0), target (0), step (0), countdown (0), stepsToTarget (0) | |||
{ | |||
} | |||
/** Constructor. */ | |||
LinearSmoothedValue (FloatType initialValue) noexcept | |||
: currentValue (initialValue), target (initialValue), step (0), countdown (0), stepsToTarget (0) | |||
: currentValue (initialValue), target (initialValue) | |||
{ | |||
} | |||
//============================================================================== | |||
/** Reset to a new sample rate and ramp length. */ | |||
/** Reset to a new sample rate and ramp length. | |||
@param sampleRate The sampling rate | |||
@param rampLengthInSeconds The duration of the ramp in seconds | |||
*/ | |||
void reset (double sampleRate, double rampLengthInSeconds) noexcept | |||
{ | |||
jassert (sampleRate > 0 && rampLengthInSeconds >= 0); | |||
@@ -65,7 +58,10 @@ public: | |||
countdown = 0; | |||
} | |||
/** Set a new target value. */ | |||
//============================================================================== | |||
/** Set a new target value. | |||
@param newValue New target value | |||
*/ | |||
void setValue (FloatType newValue) noexcept | |||
{ | |||
if (target != newValue) | |||
@@ -80,7 +76,10 @@ public: | |||
} | |||
} | |||
/** Compute the next value. */ | |||
//============================================================================== | |||
/** Compute the next value. | |||
@returns Smoothed value | |||
*/ | |||
FloatType getNextValue() noexcept | |||
{ | |||
if (countdown <= 0) | |||
@@ -103,11 +102,83 @@ public: | |||
return target; | |||
} | |||
private: | |||
//============================================================================== | |||
FloatType currentValue, target, step; | |||
int countdown, stepsToTarget; | |||
}; | |||
/** Applies a linear smoothed gain to a stream of samples | |||
S[i] *= gain | |||
@param samples Pointer to a raw array of samples | |||
@param numSamples Length of array of samples | |||
*/ | |||
void applyGain (FloatType* samples, int numSamples) noexcept | |||
{ | |||
jassert(numSamples >= 0); | |||
if (isSmoothing()) | |||
{ | |||
for (int i = 0; i < numSamples; i++) | |||
samples[i] *= getNextValue(); | |||
} | |||
else | |||
{ | |||
FloatVectorOperations::multiply (samples, target, numSamples); | |||
} | |||
} | |||
//============================================================================== | |||
/** Computes output as linear smoothed gain applied to a stream of samples. | |||
Sout[i] = Sin[i] * gain | |||
@param samplesOut A pointer to a raw array of output samples | |||
@param samplesIn A pointer to a raw array of input samples | |||
@param numSamples The length of the array of samples | |||
*/ | |||
void applyGain (FloatType* samplesOut, const FloatType* samplesIn, int numSamples) noexcept | |||
{ | |||
jassert (numSamples >= 0); | |||
#endif // JUCE_LINEARSMOOTHEDVALUE_H_INCLUDED | |||
if (isSmoothing()) | |||
{ | |||
for (int i = 0; i < numSamples; i++) | |||
samplesOut[i] = samplesIn[i] * getNextValue(); | |||
} | |||
else | |||
{ | |||
FloatVectorOperations::multiply (samplesOut, samplesIn, target, numSamples); | |||
} | |||
} | |||
//============================================================================== | |||
/** Applies a linear smoothed gain to a buffer */ | |||
void applyGain (AudioBuffer<FloatType>& buffer, int numSamples) noexcept | |||
{ | |||
jassert (numSamples >= 0); | |||
if (isSmoothing()) | |||
{ | |||
if (buffer.getNumChannels() == 1) | |||
{ | |||
FloatType* samples = buffer.getWritePointer(0); | |||
for (int i = 0; i < numSamples; i++) | |||
samples[i] *= getNextValue(); | |||
} | |||
else | |||
{ | |||
for (int i = 0; i < numSamples; i++) | |||
{ | |||
const FloatType gain = getNextValue(); | |||
for (int channel = 0; channel < buffer.getNumChannels(); channel++) | |||
buffer.setSample (channel, i, buffer.getSample (channel, i) * gain); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
buffer.applyGain (0, numSamples, target); | |||
} | |||
} | |||
private: | |||
//============================================================================== | |||
FloatType currentValue = 0, target = 0, step = 0; | |||
int countdown = 0, stepsToTarget = 0; | |||
}; |
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_REVERB_H_INCLUDED | |||
#define JUCE_REVERB_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -325,6 +316,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Reverb) | |||
}; | |||
#endif // JUCE_REVERB_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -37,8 +29,6 @@ | |||
#error "Incorrect use of JUCE cpp file" | |||
#endif | |||
#include "AppConfig.h" | |||
#include "juce_audio_basics.h" | |||
#if JUCE_MINGW && ! defined (__SSE2__) | |||
@@ -96,7 +86,6 @@ namespace juce | |||
#include "effects/juce_IIRFilterOld.cpp" | |||
#include "effects/juce_LagrangeInterpolator.cpp" | |||
#include "effects/juce_CatmullRomInterpolator.cpp" | |||
#include "effects/juce_FFT.cpp" | |||
#include "midi/juce_MidiBuffer.cpp" | |||
#include "midi/juce_MidiFile.cpp" | |||
#include "midi/juce_MidiKeyboardState.cpp" | |||
@@ -115,6 +104,7 @@ namespace juce | |||
#include "sources/juce_BufferingAudioSource.cpp" | |||
#include "sources/juce_ChannelRemappingAudioSource.cpp" | |||
#include "sources/juce_IIRFilterAudioSource.cpp" | |||
#include "sources/juce_MemoryAudioSource.cpp" | |||
#include "sources/juce_MixerAudioSource.cpp" | |||
#include "sources/juce_ResamplingAudioSource.cpp" | |||
#include "sources/juce_ReverbAudioSource.cpp" | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -39,7 +31,7 @@ | |||
ID: juce_audio_basics | |||
vendor: juce | |||
version: 4.3.1 | |||
version: 5.1.1 | |||
name: JUCE audio and MIDI data classes | |||
description: Classes for audio buffer manipulation, midi message handling, synthesis, etc. | |||
website: http://www.juce.com/juce | |||
@@ -54,10 +46,10 @@ | |||
*******************************************************************************/ | |||
#ifndef JUCE_AUDIO_BASICS_H_INCLUDED | |||
#pragma once | |||
#define JUCE_AUDIO_BASICS_H_INCLUDED | |||
#include "juce_core/juce_core.h" | |||
#include <juce_core/juce_core.h> | |||
namespace juce | |||
{ | |||
@@ -74,7 +66,6 @@ namespace juce | |||
#include "effects/juce_IIRFilterOld.h" | |||
#include "effects/juce_LagrangeInterpolator.h" | |||
#include "effects/juce_CatmullRomInterpolator.h" | |||
#include "effects/juce_FFT.h" | |||
#include "effects/juce_LinearSmoothedValue.h" | |||
#include "effects/juce_Reverb.h" | |||
#include "midi/juce_MidiMessage.h" | |||
@@ -97,12 +88,12 @@ namespace juce | |||
#include "sources/juce_BufferingAudioSource.h" | |||
#include "sources/juce_ChannelRemappingAudioSource.h" | |||
#include "sources/juce_IIRFilterAudioSource.h" | |||
#include "sources/juce_MemoryAudioSource.h" | |||
#include "sources/juce_MixerAudioSource.h" | |||
#include "sources/juce_ResamplingAudioSource.h" | |||
#include "sources/juce_ReverbAudioSource.h" | |||
#include "sources/juce_ToneGeneratorAudioSource.h" | |||
#include "synthesisers/juce_Synthesiser.h" | |||
#include "audio_play_head/juce_AudioPlayHead.h" | |||
} | |||
#endif // JUCE_AUDIO_BASICS_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIBUFFER_H_INCLUDED | |||
#define JUCE_MIDIBUFFER_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -236,6 +227,3 @@ public: | |||
private: | |||
JUCE_LEAK_DETECTOR (MidiBuffer) | |||
}; | |||
#endif // JUCE_MIDIBUFFER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIFILE_H_INCLUDED | |||
#define JUCE_MIDIFILE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -187,6 +178,3 @@ private: | |||
JUCE_LEAK_DETECTOR (MidiFile) | |||
}; | |||
#endif // JUCE_MIDIFILE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIKEYBOARDSTATE_H_INCLUDED | |||
#define JUCE_MIDIKEYBOARDSTATE_H_INCLUDED | |||
#pragma once | |||
class MidiKeyboardState; | |||
@@ -206,6 +197,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiKeyboardState) | |||
}; | |||
#endif // JUCE_MIDIKEYBOARDSTATE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -44,6 +36,9 @@ namespace MidiHelpers | |||
//============================================================================== | |||
uint8 MidiMessage::floatValueToMidiByte (const float v) noexcept | |||
{ | |||
jassert (v >= 0 && v <= 1.0f); // if your value is > 1, maybe you're passing an | |||
// integer value to a float method by mistake? | |||
return MidiHelpers::validVelocity (roundToInt (v * 127.0f)); | |||
} | |||
@@ -100,7 +95,7 @@ int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) noexcept | |||
//============================================================================== | |||
MidiMessage::MidiMessage() noexcept | |||
: timeStamp (0), size (2) | |||
: size (2) | |||
{ | |||
packedData.asBytes[0] = 0xf0; | |||
packedData.asBytes[1] = 0xf7; | |||
@@ -168,12 +163,12 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||
double t, bool sysexHasEmbeddedLength) | |||
: timeStamp (t) | |||
{ | |||
const uint8* src = static_cast<const uint8*> (srcData); | |||
unsigned int byte = (unsigned int) *src; | |||
auto src = static_cast<const uint8*> (srcData); | |||
auto byte = (unsigned int) *src; | |||
if (byte < 0x80) | |||
{ | |||
byte = (unsigned int) (uint8) lastStatusByte; | |||
byte = (unsigned int) lastStatusByte; | |||
numBytesUsed = -1; | |||
} | |||
else | |||
@@ -187,7 +182,7 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||
{ | |||
if (byte == 0xf0) | |||
{ | |||
const uint8* d = src; | |||
auto d = src; | |||
bool haveReadAllLengthBytes = ! sysexHasEmbeddedLength; | |||
int numVariableLengthSysexBytes = 0; | |||
@@ -218,11 +213,11 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||
src += numVariableLengthSysexBytes; | |||
size = 1 + (int) (d - src); | |||
uint8* dest = allocateSpace (size); | |||
auto dest = allocateSpace (size); | |||
*dest = (uint8) byte; | |||
memcpy (dest + 1, src, (size_t) (size - 1)); | |||
numBytesUsed += numVariableLengthSysexBytes; // (these aren't counted in the size) | |||
numBytesUsed += (numVariableLengthSysexBytes + size); // (these aren't counted in the size) | |||
} | |||
else if (byte == 0xff) | |||
{ | |||
@@ -230,9 +225,11 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||
const int bytesLeft = readVariableLengthVal (src + 1, n); | |||
size = jmin (sz + 1, n + 2 + bytesLeft); | |||
uint8* dest = allocateSpace (size); | |||
auto dest = allocateSpace (size); | |||
*dest = (uint8) byte; | |||
memcpy (dest + 1, src, (size_t) size - 1); | |||
numBytesUsed += size; | |||
} | |||
else | |||
{ | |||
@@ -241,14 +238,14 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||
if (size > 1) | |||
{ | |||
packedData.asBytes[1] = src[0]; | |||
packedData.asBytes[1] = (sz > 0 ? src[0] : 0); | |||
if (size > 2) | |||
packedData.asBytes[2] = src[1]; | |||
packedData.asBytes[2] = (sz > 1 ? src[1] : 0); | |||
} | |||
} | |||
numBytesUsed += size; | |||
numBytesUsed += jmin (size, sz + 1); | |||
} | |||
} | |||
else | |||
{ | |||
@@ -285,7 +282,6 @@ MidiMessage& MidiMessage::operator= (const MidiMessage& other) | |||
return *this; | |||
} | |||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||
MidiMessage::MidiMessage (MidiMessage&& other) noexcept | |||
: timeStamp (other.timeStamp), size (other.size) | |||
{ | |||
@@ -301,7 +297,6 @@ MidiMessage& MidiMessage::operator= (MidiMessage&& other) noexcept | |||
other.size = 0; | |||
return *this; | |||
} | |||
#endif | |||
MidiMessage::~MidiMessage() noexcept | |||
{ | |||
@@ -313,7 +308,7 @@ uint8* MidiMessage::allocateSpace (int bytes) | |||
{ | |||
if (bytes > (int) sizeof (packedData)) | |||
{ | |||
uint8* d = static_cast<uint8*> (std::malloc ((size_t) bytes)); | |||
auto d = static_cast<uint8*> (std::malloc ((size_t) bytes)); | |||
packedData.allocatedData = d; | |||
return d; | |||
} | |||
@@ -348,7 +343,7 @@ String MidiMessage::getDescription() const | |||
int MidiMessage::getChannel() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
if ((data[0] & 0xf0) != 0xf0) | |||
return (data[0] & 0xf) + 1; | |||
@@ -360,7 +355,7 @@ bool MidiMessage::isForChannel (const int channel) const noexcept | |||
{ | |||
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return ((data[0] & 0xf) == channel - 1) | |||
&& ((data[0] & 0xf0) != 0xf0); | |||
@@ -370,7 +365,7 @@ void MidiMessage::setChannel (const int channel) noexcept | |||
{ | |||
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 | |||
uint8* const data = getData(); | |||
auto data = getData(); | |||
if ((data[0] & 0xf0) != (uint8) 0xf0) | |||
data[0] = (uint8) ((data[0] & (uint8) 0xf0) | |||
@@ -379,7 +374,7 @@ void MidiMessage::setChannel (const int channel) noexcept | |||
bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return ((data[0] & 0xf0) == 0x90) | |||
&& (returnTrueForVelocity0 || data[2] != 0); | |||
@@ -387,7 +382,7 @@ bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const noexcept | |||
bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return ((data[0] & 0xf0) == 0x80) | |||
|| (returnTrueForNoteOnVelocity0 && (data[2] == 0) && ((data[0] & 0xf0) == 0x90)); | |||
@@ -395,9 +390,7 @@ bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const noex | |||
bool MidiMessage::isNoteOnOrOff() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
const int d = data[0] & 0xf0; | |||
auto d = getRawData()[0] & 0xf0; | |||
return (d == 0x90) || (d == 0x80); | |||
} | |||
@@ -435,7 +428,7 @@ void MidiMessage::multiplyVelocity (const float scaleFactor) noexcept | |||
{ | |||
if (isNoteOnOrOff()) | |||
{ | |||
uint8* const data = getData(); | |||
auto data = getData(); | |||
data[2] = MidiHelpers::validVelocity (roundToInt (scaleFactor * data[2])); | |||
} | |||
} | |||
@@ -519,7 +512,7 @@ bool MidiMessage::isPitchWheel() const noexcept | |||
int MidiMessage::getPitchWheelValue() const noexcept | |||
{ | |||
jassert (isPitchWheel()); | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return data[1] | (data[2] << 7); | |||
} | |||
@@ -539,7 +532,7 @@ bool MidiMessage::isController() const noexcept | |||
bool MidiMessage::isControllerOfType (const int controllerType) const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return (data[0] & 0xf0) == 0xb0 && data[1] == controllerType; | |||
} | |||
@@ -607,7 +600,7 @@ MidiMessage MidiMessage::allNotesOff (const int channel) noexcept | |||
bool MidiMessage::isAllNotesOff() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return (data[0] & 0xf0) == 0xb0 && data[1] == 123; | |||
} | |||
@@ -618,8 +611,8 @@ MidiMessage MidiMessage::allSoundOff (const int channel) noexcept | |||
bool MidiMessage::isAllSoundOff() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
return (data[0] & 0xf0) == 0xb0 && data[1] == 120; | |||
auto data = getRawData(); | |||
return data[1] == 120 && (data[0] & 0xf0) == 0xb0; | |||
} | |||
MidiMessage MidiMessage::allControllersOff (const int channel) noexcept | |||
@@ -629,14 +622,9 @@ MidiMessage MidiMessage::allControllersOff (const int channel) noexcept | |||
MidiMessage MidiMessage::masterVolume (const float volume) | |||
{ | |||
const int vol = jlimit (0, 0x3fff, roundToInt (volume * 0x4000)); | |||
const uint8 buf[] = { 0xf0, 0x7f, 0x7f, 0x04, 0x01, | |||
(uint8) (vol & 0x7f), | |||
(uint8) (vol >> 7), | |||
0xf7 }; | |||
auto vol = jlimit (0, 0x3fff, roundToInt (volume * 0x4000)); | |||
return MidiMessage (buf, 8); | |||
return { 0xf0, 0x7f, 0x7f, 0x04, 0x01, vol & 0x7f, vol >> 7, 0xf7 }; | |||
} | |||
//============================================================================== | |||
@@ -672,13 +660,14 @@ bool MidiMessage::isActiveSense() const noexcept { return *getRawData() == 0x | |||
int MidiMessage::getMetaEventType() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return *data != 0xff ? -1 : data[1]; | |||
} | |||
int MidiMessage::getMetaEventLength() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
if (*data == 0xff) | |||
{ | |||
int n; | |||
@@ -693,7 +682,7 @@ const uint8* MidiMessage::getMetaEventData() const noexcept | |||
jassert (isMetaEvent()); | |||
int n; | |||
const uint8* d = getRawData() + 2; | |||
auto d = getRawData() + 2; | |||
readVariableLengthVal (d, n); | |||
return d + n; | |||
} | |||
@@ -703,13 +692,14 @@ bool MidiMessage::isEndOfTrackMetaEvent() const noexcept { return getMetaEven | |||
bool MidiMessage::isTextMetaEvent() const noexcept | |||
{ | |||
const int t = getMetaEventType(); | |||
auto t = getMetaEventType(); | |||
return t > 0 && t < 16; | |||
} | |||
String MidiMessage::getTextFromTextMetaEvent() const | |||
{ | |||
const char* const textData = reinterpret_cast<const char*> (getMetaEventData()); | |||
auto textData = reinterpret_cast<const char*> (getMetaEventData()); | |||
return String (CharPointer_UTF8 (textData), | |||
CharPointer_UTF8 (textData + getMetaEventLength())); | |||
} | |||
@@ -736,7 +726,7 @@ MidiMessage MidiMessage::textMetaEvent (int type, StringRef text) | |||
const size_t headerLen = sizeof (header) - n; | |||
const int totalSize = (int) (headerLen + textSize); | |||
uint8* const dest = result.allocateSpace (totalSize); | |||
auto dest = result.allocateSpace (totalSize); | |||
result.size = totalSize; | |||
memcpy (dest, header + n, headerLen); | |||
@@ -745,9 +735,9 @@ MidiMessage MidiMessage::textMetaEvent (int type, StringRef text) | |||
return result; | |||
} | |||
bool MidiMessage::isTrackNameEvent() const noexcept { const uint8* data = getRawData(); return (data[1] == 3) && (*data == 0xff); } | |||
bool MidiMessage::isTempoMetaEvent() const noexcept { const uint8* data = getRawData(); return (data[1] == 81) && (*data == 0xff); } | |||
bool MidiMessage::isMidiChannelMetaEvent() const noexcept { const uint8* data = getRawData(); return (data[1] == 0x20) && (*data == 0xff) && (data[2] == 1); } | |||
bool MidiMessage::isTrackNameEvent() const noexcept { auto data = getRawData(); return (data[1] == 3) && (*data == 0xff); } | |||
bool MidiMessage::isTempoMetaEvent() const noexcept { auto data = getRawData(); return (data[1] == 81) && (*data == 0xff); } | |||
bool MidiMessage::isMidiChannelMetaEvent() const noexcept { auto data = getRawData(); return (data[1] == 0x20) && (*data == 0xff) && (data[2] == 1); } | |||
int MidiMessage::getMidiChannelMetaEventChannel() const noexcept | |||
{ | |||
@@ -760,7 +750,7 @@ double MidiMessage::getTempoSecondsPerQuarterNote() const noexcept | |||
if (! isTempoMetaEvent()) | |||
return 0.0; | |||
const uint8* const d = getMetaEventData(); | |||
auto d = getMetaEventData(); | |||
return (((unsigned int) d[0] << 16) | |||
| ((unsigned int) d[1] << 8) | |||
@@ -777,37 +767,33 @@ double MidiMessage::getTempoMetaEventTickLength (const short timeFormat) const n | |||
return getTempoSecondsPerQuarterNote() / timeFormat; | |||
} | |||
else | |||
{ | |||
const int frameCode = (-timeFormat) >> 8; | |||
double framesPerSecond; | |||
switch (frameCode) | |||
{ | |||
case 24: framesPerSecond = 24.0; break; | |||
case 25: framesPerSecond = 25.0; break; | |||
case 29: framesPerSecond = 29.97; break; | |||
case 30: framesPerSecond = 30.0; break; | |||
default: framesPerSecond = 30.0; break; | |||
} | |||
const int frameCode = (-timeFormat) >> 8; | |||
double framesPerSecond; | |||
return (1.0 / framesPerSecond) / (timeFormat & 0xff); | |||
switch (frameCode) | |||
{ | |||
case 24: framesPerSecond = 24.0; break; | |||
case 25: framesPerSecond = 25.0; break; | |||
case 29: framesPerSecond = 30.0 * 1000.0 / 1001.0; break; | |||
case 30: framesPerSecond = 30.0; break; | |||
default: framesPerSecond = 30.0; break; | |||
} | |||
return (1.0 / framesPerSecond) / (timeFormat & 0xff); | |||
} | |||
MidiMessage MidiMessage::tempoMetaEvent (int microsecondsPerQuarterNote) noexcept | |||
{ | |||
const uint8 d[] = { 0xff, 81, 3, | |||
(uint8) (microsecondsPerQuarterNote >> 16), | |||
(uint8) (microsecondsPerQuarterNote >> 8), | |||
(uint8) microsecondsPerQuarterNote }; | |||
return MidiMessage (d, 6, 0.0); | |||
return { 0xff, 81, 3, | |||
(uint8) (microsecondsPerQuarterNote >> 16), | |||
(uint8) (microsecondsPerQuarterNote >> 8), | |||
(uint8) microsecondsPerQuarterNote }; | |||
} | |||
bool MidiMessage::isTimeSignatureMetaEvent() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return (data[1] == 0x58) && (*data == (uint8) 0xff); | |||
} | |||
@@ -815,7 +801,7 @@ void MidiMessage::getTimeSignatureInfo (int& numerator, int& denominator) const | |||
{ | |||
if (isTimeSignatureMetaEvent()) | |||
{ | |||
const uint8* const d = getMetaEventData(); | |||
auto d = getMetaEventData(); | |||
numerator = d[0]; | |||
denominator = 1 << d[1]; | |||
} | |||
@@ -837,14 +823,12 @@ MidiMessage MidiMessage::timeSignatureMetaEvent (const int numerator, const int | |||
++powerOfTwo; | |||
} | |||
const uint8 d[] = { 0xff, 0x58, 0x04, (uint8) numerator, (uint8) powerOfTwo, 1, 96 }; | |||
return MidiMessage (d, 7, 0.0); | |||
return { 0xff, 0x58, 0x04, numerator, powerOfTwo, 1, 96 }; | |||
} | |||
MidiMessage MidiMessage::midiChannelMetaEvent (const int channel) noexcept | |||
{ | |||
const uint8 d[] = { 0xff, 0x20, 0x01, (uint8) jlimit (0, 0xff, channel - 1) }; | |||
return MidiMessage (d, 4, 0.0); | |||
return { 0xff, 0x20, 0x01, jlimit (0, 0xff, channel - 1) }; | |||
} | |||
bool MidiMessage::isKeySignatureMetaEvent() const noexcept | |||
@@ -866,37 +850,36 @@ MidiMessage MidiMessage::keySignatureMetaEvent (int numberOfSharpsOrFlats, bool | |||
{ | |||
jassert (numberOfSharpsOrFlats >= -7 && numberOfSharpsOrFlats <= 7); | |||
const uint8 d[] = { 0xff, 0x59, 0x02, (uint8) numberOfSharpsOrFlats, isMinorKey ? (uint8) 1 : (uint8) 0 }; | |||
return MidiMessage (d, 5, 0.0); | |||
return { 0xff, 0x59, 0x02, numberOfSharpsOrFlats, isMinorKey ? 1 : 0 }; | |||
} | |||
MidiMessage MidiMessage::endOfTrack() noexcept | |||
{ | |||
return MidiMessage (0xff, 0x2f, 0, 0.0); | |||
return { 0xff, 0x2f, 0x00 }; | |||
} | |||
//============================================================================== | |||
bool MidiMessage::isSongPositionPointer() const noexcept { return *getRawData() == 0xf2; } | |||
int MidiMessage::getSongPositionPointerMidiBeat() const noexcept { const uint8* data = getRawData(); return data[1] | (data[2] << 7); } | |||
int MidiMessage::getSongPositionPointerMidiBeat() const noexcept { auto data = getRawData(); return data[1] | (data[2] << 7); } | |||
MidiMessage MidiMessage::songPositionPointer (const int positionInMidiBeats) noexcept | |||
{ | |||
return MidiMessage (0xf2, | |||
positionInMidiBeats & 127, | |||
(positionInMidiBeats >> 7) & 127); | |||
return { 0xf2, | |||
positionInMidiBeats & 127, | |||
(positionInMidiBeats >> 7) & 127 }; | |||
} | |||
bool MidiMessage::isMidiStart() const noexcept { return *getRawData() == 0xfa; } | |||
MidiMessage MidiMessage::midiStart() noexcept { return MidiMessage (0xfa); } | |||
bool MidiMessage::isMidiStart() const noexcept { return *getRawData() == 0xfa; } | |||
MidiMessage MidiMessage::midiStart() noexcept { return MidiMessage (0xfa); } | |||
bool MidiMessage::isMidiContinue() const noexcept { return *getRawData() == 0xfb; } | |||
MidiMessage MidiMessage::midiContinue() noexcept { return MidiMessage (0xfb); } | |||
bool MidiMessage::isMidiContinue() const noexcept { return *getRawData() == 0xfb; } | |||
MidiMessage MidiMessage::midiContinue() noexcept { return MidiMessage (0xfb); } | |||
bool MidiMessage::isMidiStop() const noexcept { return *getRawData() == 0xfc; } | |||
MidiMessage MidiMessage::midiStop() noexcept { return MidiMessage (0xfc); } | |||
bool MidiMessage::isMidiStop() const noexcept { return *getRawData() == 0xfc; } | |||
MidiMessage MidiMessage::midiStop() noexcept { return MidiMessage (0xfc); } | |||
bool MidiMessage::isMidiClock() const noexcept { return *getRawData() == 0xf8; } | |||
MidiMessage MidiMessage::midiClock() noexcept { return MidiMessage (0xf8); } | |||
bool MidiMessage::isMidiClock() const noexcept { return *getRawData() == 0xf8; } | |||
MidiMessage MidiMessage::midiClock() noexcept { return MidiMessage (0xf8); } | |||
bool MidiMessage::isQuarterFrame() const noexcept { return *getRawData() == 0xf1; } | |||
int MidiMessage::getQuarterFrameSequenceNumber() const noexcept { return ((int) getRawData()[1]) >> 4; } | |||
@@ -909,7 +892,7 @@ MidiMessage MidiMessage::quarterFrame (const int sequenceNumber, const int value | |||
bool MidiMessage::isFullFrame() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return data[0] == 0xf0 | |||
&& data[1] == 0x7f | |||
@@ -923,7 +906,7 @@ void MidiMessage::getFullFrameParameters (int& hours, int& minutes, int& seconds | |||
{ | |||
jassert (isFullFrame()); | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
timecodeType = (SmpteTimecodeType) (data[5] >> 5); | |||
hours = data[5] & 0x1f; | |||
minutes = data[6]; | |||
@@ -931,23 +914,19 @@ void MidiMessage::getFullFrameParameters (int& hours, int& minutes, int& seconds | |||
frames = data[8]; | |||
} | |||
MidiMessage MidiMessage::fullFrame (const int hours, const int minutes, | |||
const int seconds, const int frames, | |||
MidiMessage MidiMessage::fullFrame (int hours, int minutes, int seconds, int frames, | |||
MidiMessage::SmpteTimecodeType timecodeType) | |||
{ | |||
const uint8 d[] = { 0xf0, 0x7f, 0x7f, 0x01, 0x01, | |||
(uint8) ((hours & 0x01f) | (timecodeType << 5)), | |||
(uint8) minutes, | |||
(uint8) seconds, | |||
(uint8) frames, | |||
0xf7 }; | |||
return MidiMessage (d, 10, 0.0); | |||
return { 0xf0, 0x7f, 0x7f, 0x01, 0x01, | |||
(hours & 0x01f) | (timecodeType << 5), | |||
minutes, seconds, frames, | |||
0xf7 }; | |||
} | |||
bool MidiMessage::isMidiMachineControlMessage() const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
return data[0] == 0xf0 | |||
&& data[1] == 0x7f | |||
&& data[3] == 0x06 | |||
@@ -963,15 +942,14 @@ MidiMessage::MidiMachineControlCommand MidiMessage::getMidiMachineControlCommand | |||
MidiMessage MidiMessage::midiMachineControlCommand (MidiMessage::MidiMachineControlCommand command) | |||
{ | |||
const uint8 d[] = { 0xf0, 0x7f, 0, 6, (uint8) command, 0xf7 }; | |||
return MidiMessage (d, 6, 0.0); | |||
return { 0xf0, 0x7f, 0, 6, command, 0xf7 }; | |||
} | |||
//============================================================================== | |||
bool MidiMessage::isMidiMachineControlGoto (int& hours, int& minutes, int& seconds, int& frames) const noexcept | |||
{ | |||
const uint8* const data = getRawData(); | |||
auto data = getRawData(); | |||
if (size >= 12 | |||
&& data[0] == 0xf0 | |||
&& data[1] == 0x7f | |||
@@ -993,14 +971,7 @@ bool MidiMessage::isMidiMachineControlGoto (int& hours, int& minutes, int& secon | |||
MidiMessage MidiMessage::midiMachineControlGoto (int hours, int minutes, int seconds, int frames) | |||
{ | |||
const uint8 d[] = { 0xf0, 0x7f, 0, 6, 0x44, 6, 1, | |||
(uint8) hours, | |||
(uint8) minutes, | |||
(uint8) seconds, | |||
(uint8) frames, | |||
0xf7 }; | |||
return MidiMessage (d, 12, 0.0); | |||
return { 0xf0, 0x7f, 0, 6, 0x44, 6, 1, hours, minutes, seconds, frames, 0xf7 }; | |||
} | |||
//============================================================================== | |||
@@ -1020,7 +991,7 @@ String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includeOctav | |||
return s; | |||
} | |||
return String(); | |||
return {}; | |||
} | |||
double MidiMessage::getMidiNoteInHertz (const int noteNumber, const double frequencyOfA) noexcept | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIMESSAGE_H_INCLUDED | |||
#define JUCE_MIDIMESSAGE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -69,6 +60,18 @@ public: | |||
*/ | |||
MidiMessage (int byte1, double timeStamp = 0) noexcept; | |||
/** Creates a midi message from a list of bytes. */ | |||
template <typename... Data> | |||
MidiMessage (int byte1, int byte2, int byte3, Data... otherBytes) : size (3 + sizeof... (otherBytes)) | |||
{ | |||
// this checks that the length matches the data.. | |||
jassert (size > 3 || byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == size); | |||
const uint8 data[] = { (uint8) byte1, (uint8) byte2, (uint8) byte3, static_cast<uint8> (otherBytes)... }; | |||
memcpy (allocateSpace (size), data, (size_t) size); | |||
} | |||
/** Creates a midi message from a block of data. */ | |||
MidiMessage (const void* data, int numBytes, double timeStamp = 0); | |||
@@ -115,10 +118,11 @@ public: | |||
/** Copies this message from another one. */ | |||
MidiMessage& operator= (const MidiMessage& other); | |||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||
/** Move constructor */ | |||
MidiMessage (MidiMessage&&) noexcept; | |||
/** Move assignment operator */ | |||
MidiMessage& operator= (MidiMessage&&) noexcept; | |||
#endif | |||
//============================================================================== | |||
/** Returns a pointer to the raw midi data. | |||
@@ -473,7 +477,6 @@ public: | |||
bool isControllerOfType (int controllerType) const noexcept; | |||
/** Creates a controller message. | |||
@param channel the midi channel, in the range 1 to 16 | |||
@param controllerType the type of controller | |||
@param value the controller value | |||
@@ -494,21 +497,18 @@ public: | |||
bool isAllSoundOff() const noexcept; | |||
/** Creates an all-notes-off message. | |||
@param channel the midi channel, in the range 1 to 16 | |||
@see isAllNotesOff | |||
*/ | |||
static MidiMessage allNotesOff (int channel) noexcept; | |||
/** Creates an all-sound-off message. | |||
@param channel the midi channel, in the range 1 to 16 | |||
@see isAllSoundOff | |||
*/ | |||
static MidiMessage allSoundOff (int channel) noexcept; | |||
/** Creates an all-controllers-off message. | |||
@param channel the midi channel, in the range 1 to 16 | |||
*/ | |||
static MidiMessage allControllersOff (int channel) noexcept; | |||
@@ -928,7 +928,7 @@ private: | |||
}; | |||
PackedData packedData; | |||
double timeStamp; | |||
double timeStamp = 0; | |||
int size; | |||
#endif | |||
@@ -936,5 +936,3 @@ private: | |||
inline uint8* getData() const noexcept { return isHeapAllocated() ? packedData.allocatedData : (uint8*) packedData.asBytes; } | |||
uint8* allocateSpace (int); | |||
}; | |||
#endif // JUCE_MIDIMESSAGE_H_INCLUDED |
@@ -2,32 +2,30 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (const MidiMessage& mm) : message (mm) {} | |||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (MidiMessage&& mm) : message (static_cast<MidiMessage&&> (mm)) {} | |||
MidiMessageSequence::MidiEventHolder::~MidiEventHolder() {} | |||
//============================================================================== | |||
MidiMessageSequence::MidiMessageSequence() | |||
{ | |||
} | |||
@@ -45,15 +43,25 @@ MidiMessageSequence& MidiMessageSequence::operator= (const MidiMessageSequence& | |||
return *this; | |||
} | |||
void MidiMessageSequence::swapWith (MidiMessageSequence& other) noexcept | |||
MidiMessageSequence::MidiMessageSequence (MidiMessageSequence&& other) noexcept | |||
: list (static_cast<OwnedArray<MidiEventHolder>&&> (other.list)) | |||
{} | |||
MidiMessageSequence& MidiMessageSequence::operator= (MidiMessageSequence&& other) noexcept | |||
{ | |||
list.swapWith (other.list); | |||
list = static_cast<OwnedArray<MidiEventHolder>&&> (other.list); | |||
return *this; | |||
} | |||
MidiMessageSequence::~MidiMessageSequence() | |||
{ | |||
} | |||
void MidiMessageSequence::swapWith (MidiMessageSequence& other) noexcept | |||
{ | |||
list.swapWith (other.list); | |||
} | |||
void MidiMessageSequence::clear() | |||
{ | |||
list.clear(); | |||
@@ -64,34 +72,37 @@ int MidiMessageSequence::getNumEvents() const noexcept | |||
return list.size(); | |||
} | |||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::getEventPointer (const int index) const noexcept | |||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::getEventPointer (int index) const noexcept | |||
{ | |||
return list [index]; | |||
return list[index]; | |||
} | |||
double MidiMessageSequence::getTimeOfMatchingKeyUp (const int index) const noexcept | |||
MidiMessageSequence::MidiEventHolder** MidiMessageSequence::begin() const noexcept { return list.begin(); } | |||
MidiMessageSequence::MidiEventHolder** MidiMessageSequence::end() const noexcept { return list.end(); } | |||
double MidiMessageSequence::getTimeOfMatchingKeyUp (int index) const noexcept | |||
{ | |||
if (const MidiEventHolder* const meh = list [index]) | |||
if (auto* meh = list[index]) | |||
if (meh->noteOffObject != nullptr) | |||
return meh->noteOffObject->message.getTimeStamp(); | |||
return 0.0; | |||
} | |||
int MidiMessageSequence::getIndexOfMatchingKeyUp (const int index) const noexcept | |||
int MidiMessageSequence::getIndexOfMatchingKeyUp (int index) const noexcept | |||
{ | |||
if (const MidiEventHolder* const meh = list [index]) | |||
if (auto* meh = list [index]) | |||
return list.indexOf (meh->noteOffObject); | |||
return -1; | |||
} | |||
int MidiMessageSequence::getIndexOf (const MidiEventHolder* const event) const noexcept | |||
int MidiMessageSequence::getIndexOf (const MidiEventHolder* event) const noexcept | |||
{ | |||
return list.indexOf (event); | |||
} | |||
int MidiMessageSequence::getNextIndexAtTime (const double timeStamp) const noexcept | |||
int MidiMessageSequence::getNextIndexAtTime (double timeStamp) const noexcept | |||
{ | |||
const int numEvents = list.size(); | |||
@@ -116,32 +127,38 @@ double MidiMessageSequence::getEndTime() const noexcept | |||
double MidiMessageSequence::getEventTime (const int index) const noexcept | |||
{ | |||
if (const MidiEventHolder* const meh = list [index]) | |||
if (auto* meh = list [index]) | |||
return meh->message.getTimeStamp(); | |||
return 0.0; | |||
} | |||
//============================================================================== | |||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (const MidiMessage& newMessage, | |||
double timeAdjustment) | |||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (MidiEventHolder* newEvent, double timeAdjustment) | |||
{ | |||
MidiEventHolder* const newOne = new MidiEventHolder (newMessage); | |||
timeAdjustment += newMessage.getTimeStamp(); | |||
newOne->message.setTimeStamp (timeAdjustment); | |||
newEvent->message.addToTimeStamp (timeAdjustment); | |||
auto time = newEvent->message.getTimeStamp(); | |||
int i; | |||
for (i = list.size(); --i >= 0;) | |||
if (list.getUnchecked(i)->message.getTimeStamp() <= timeAdjustment) | |||
if (list.getUnchecked(i)->message.getTimeStamp() <= time) | |||
break; | |||
list.insert (i + 1, newOne); | |||
return newOne; | |||
list.insert (i + 1, newEvent); | |||
return newEvent; | |||
} | |||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (const MidiMessage& newMessage, double timeAdjustment) | |||
{ | |||
return addEvent (new MidiEventHolder (newMessage), timeAdjustment); | |||
} | |||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (MidiMessage&& newMessage, double timeAdjustment) | |||
{ | |||
return addEvent (new MidiEventHolder (static_cast<MidiMessage&&> (newMessage)), timeAdjustment); | |||
} | |||
void MidiMessageSequence::deleteEvent (const int index, | |||
const bool deleteMatchingNoteUp) | |||
void MidiMessageSequence::deleteEvent (int index, bool deleteMatchingNoteUp) | |||
{ | |||
if (isPositiveAndBelow (index, list.size())) | |||
{ | |||
@@ -152,23 +169,11 @@ void MidiMessageSequence::deleteEvent (const int index, | |||
} | |||
} | |||
struct MidiMessageSequenceSorter | |||
{ | |||
static int compareElements (const MidiMessageSequence::MidiEventHolder* const first, | |||
const MidiMessageSequence::MidiEventHolder* const second) noexcept | |||
{ | |||
const double diff = first->message.getTimeStamp() - second->message.getTimeStamp(); | |||
return (diff > 0) - (diff < 0); | |||
} | |||
}; | |||
void MidiMessageSequence::addSequence (const MidiMessageSequence& other, double timeAdjustment) | |||
{ | |||
for (int i = 0; i < other.list.size(); ++i) | |||
for (auto* m : other) | |||
{ | |||
const MidiMessage& m = other.list.getUnchecked(i)->message; | |||
MidiEventHolder* const newOne = new MidiEventHolder (m); | |||
auto newOne = new MidiEventHolder (m->message); | |||
newOne->message.addToTimeStamp (timeAdjustment); | |||
list.add (newOne); | |||
} | |||
@@ -181,16 +186,14 @@ void MidiMessageSequence::addSequence (const MidiMessageSequence& other, | |||
double firstAllowableTime, | |||
double endOfAllowableDestTimes) | |||
{ | |||
for (int i = 0; i < other.list.size(); ++i) | |||
for (auto* m : other) | |||
{ | |||
const MidiMessage& m = other.list.getUnchecked(i)->message; | |||
const double t = m.getTimeStamp() + timeAdjustment; | |||
auto t = m->message.getTimeStamp() + timeAdjustment; | |||
if (t >= firstAllowableTime && t < endOfAllowableDestTimes) | |||
{ | |||
MidiEventHolder* const newOne = new MidiEventHolder (m); | |||
auto newOne = new MidiEventHolder (m->message); | |||
newOne->message.setTimeStamp (t); | |||
list.add (newOne); | |||
} | |||
} | |||
@@ -198,7 +201,16 @@ void MidiMessageSequence::addSequence (const MidiMessageSequence& other, | |||
sort(); | |||
} | |||
//============================================================================== | |||
struct MidiMessageSequenceSorter | |||
{ | |||
static int compareElements (const MidiMessageSequence::MidiEventHolder* first, | |||
const MidiMessageSequence::MidiEventHolder* second) noexcept | |||
{ | |||
auto diff = first->message.getTimeStamp() - second->message.getTimeStamp(); | |||
return (diff > 0) - (diff < 0); | |||
} | |||
}; | |||
void MidiMessageSequence::sort() noexcept | |||
{ | |||
MidiMessageSequenceSorter sorter; | |||
@@ -209,30 +221,32 @@ void MidiMessageSequence::updateMatchedPairs() noexcept | |||
{ | |||
for (int i = 0; i < list.size(); ++i) | |||
{ | |||
MidiEventHolder* const meh = list.getUnchecked(i); | |||
const MidiMessage& m1 = meh->message; | |||
auto* meh = list.getUnchecked(i); | |||
auto& m1 = meh->message; | |||
if (m1.isNoteOn()) | |||
{ | |||
meh->noteOffObject = nullptr; | |||
const int note = m1.getNoteNumber(); | |||
const int chan = m1.getChannel(); | |||
const int len = list.size(); | |||
auto note = m1.getNoteNumber(); | |||
auto chan = m1.getChannel(); | |||
auto len = list.size(); | |||
for (int j = i + 1; j < len; ++j) | |||
{ | |||
const MidiMessage& m = list.getUnchecked(j)->message; | |||
auto* meh2 = list.getUnchecked(j); | |||
auto& m = meh2->message; | |||
if (m.getNoteNumber() == note && m.getChannel() == chan) | |||
{ | |||
if (m.isNoteOff()) | |||
{ | |||
meh->noteOffObject = list[j]; | |||
meh->noteOffObject = meh2; | |||
break; | |||
} | |||
else if (m.isNoteOn()) | |||
if (m.isNoteOn()) | |||
{ | |||
MidiEventHolder* const newEvent = new MidiEventHolder (MidiMessage::noteOff (chan, note)); | |||
auto newEvent = new MidiEventHolder (MidiMessage::noteOff (chan, note)); | |||
list.insert (j, newEvent); | |||
newEvent->message.setTimeStamp (m.getTimeStamp()); | |||
meh->noteOffObject = newEvent; | |||
@@ -244,13 +258,11 @@ void MidiMessageSequence::updateMatchedPairs() noexcept | |||
} | |||
} | |||
void MidiMessageSequence::addTimeToMessages (const double delta) noexcept | |||
void MidiMessageSequence::addTimeToMessages (double delta) noexcept | |||
{ | |||
for (int i = list.size(); --i >= 0;) | |||
{ | |||
MidiMessage& mm = list.getUnchecked(i)->message; | |||
mm.setTimeStamp (mm.getTimeStamp() + delta); | |||
} | |||
if (delta != 0) | |||
for (auto* m : list) | |||
m->message.addToTimeStamp (delta); | |||
} | |||
//============================================================================== | |||
@@ -258,24 +270,17 @@ void MidiMessageSequence::extractMidiChannelMessages (const int channelNumberToE | |||
MidiMessageSequence& destSequence, | |||
const bool alsoIncludeMetaEvents) const | |||
{ | |||
for (int i = 0; i < list.size(); ++i) | |||
{ | |||
const MidiMessage& mm = list.getUnchecked(i)->message; | |||
if (mm.isForChannel (channelNumberToExtract) || (alsoIncludeMetaEvents && mm.isMetaEvent())) | |||
destSequence.addEvent (mm); | |||
} | |||
for (auto* meh : list) | |||
if (meh->message.isForChannel (channelNumberToExtract) | |||
|| (alsoIncludeMetaEvents && meh->message.isMetaEvent())) | |||
destSequence.addEvent (meh->message); | |||
} | |||
void MidiMessageSequence::extractSysExMessages (MidiMessageSequence& destSequence) const | |||
{ | |||
for (int i = 0; i < list.size(); ++i) | |||
{ | |||
const MidiMessage& mm = list.getUnchecked(i)->message; | |||
if (mm.isSysEx()) | |||
destSequence.addEvent (mm); | |||
} | |||
for (auto* meh : list) | |||
if (meh->message.isSysEx()) | |||
destSequence.addEvent (meh->message); | |||
} | |||
void MidiMessageSequence::deleteMidiChannelMessages (const int channelNumberToRemove) | |||
@@ -293,15 +298,15 @@ void MidiMessageSequence::deleteSysExMessages() | |||
} | |||
//============================================================================== | |||
void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumber, const double time, Array<MidiMessage>& dest) | |||
void MidiMessageSequence::createControllerUpdatesForTime (int channelNumber, double time, Array<MidiMessage>& dest) | |||
{ | |||
bool doneProg = false; | |||
bool donePitchWheel = false; | |||
bool doneControllers[128] = { 0 }; | |||
bool doneControllers[128] = {}; | |||
for (int i = list.size(); --i >= 0;) | |||
{ | |||
const MidiMessage& mm = list.getUnchecked(i)->message; | |||
auto& mm = list.getUnchecked(i)->message; | |||
if (mm.isForChannel (channelNumber) && mm.getTimeStamp() <= time) | |||
{ | |||
@@ -329,14 +334,3 @@ void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumbe | |||
} | |||
} | |||
} | |||
//============================================================================== | |||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (const MidiMessage& mm) | |||
: message (mm), noteOffObject (nullptr) | |||
{ | |||
} | |||
MidiMessageSequence::MidiEventHolder::~MidiEventHolder() | |||
{ | |||
} |
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED | |||
#define JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -54,17 +45,11 @@ public: | |||
/** Replaces this sequence with another one. */ | |||
MidiMessageSequence& operator= (const MidiMessageSequence&); | |||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||
MidiMessageSequence (MidiMessageSequence&& other) noexcept | |||
: list (static_cast<OwnedArray<MidiEventHolder>&&> (other.list)) | |||
{} | |||
/** Move constructor */ | |||
MidiMessageSequence (MidiMessageSequence&&) noexcept; | |||
MidiMessageSequence& operator= (MidiMessageSequence&& other) noexcept | |||
{ | |||
list = static_cast<OwnedArray<MidiEventHolder>&&> (other.list); | |||
return *this; | |||
} | |||
#endif | |||
/** Move assignment operator */ | |||
MidiMessageSequence& operator= (MidiMessageSequence&&) noexcept; | |||
/** Destructor. */ | |||
~MidiMessageSequence(); | |||
@@ -95,12 +80,13 @@ public: | |||
note-offs up-to-date after events have been moved around in the sequence | |||
or deleted. | |||
*/ | |||
MidiEventHolder* noteOffObject; | |||
MidiEventHolder* noteOffObject = nullptr; | |||
private: | |||
//============================================================================== | |||
friend class MidiMessageSequence; | |||
MidiEventHolder (const MidiMessage&); | |||
MidiEventHolder (MidiMessage&&); | |||
JUCE_LEAK_DETECTOR (MidiEventHolder) | |||
}; | |||
@@ -114,6 +100,12 @@ public: | |||
/** Returns a pointer to one of the events. */ | |||
MidiEventHolder* getEventPointer (int index) const noexcept; | |||
/** Iterator for the list of MidiEventHolders */ | |||
MidiEventHolder** begin() const noexcept; | |||
/** Iterator for the list of MidiEventHolders */ | |||
MidiEventHolder** end() const noexcept; | |||
/** Returns the time of the note-up that matches the note-on at this index. | |||
If the event at this index isn't a note-on, it'll just return 0. | |||
@see MidiMessageSequence::MidiEventHolder::noteOffObject | |||
@@ -164,8 +156,21 @@ public: | |||
that will be inserted | |||
@see updateMatchedPairs | |||
*/ | |||
MidiEventHolder* addEvent (const MidiMessage& newMessage, | |||
double timeAdjustment = 0); | |||
MidiEventHolder* addEvent (const MidiMessage& newMessage, double timeAdjustment = 0); | |||
/** Inserts a midi message into the sequence. | |||
The index at which the new message gets inserted will depend on its timestamp, | |||
because the sequence is kept sorted. | |||
Remember to call updateMatchedPairs() after adding note-on events. | |||
@param newMessage the new message to add (an internal copy will be made) | |||
@param timeAdjustment an optional value to add to the timestamp of the message | |||
that will be inserted | |||
@see updateMatchedPairs | |||
*/ | |||
MidiEventHolder* addEvent (MidiMessage&& newMessage, double timeAdjustment = 0); | |||
/** Deletes one of the events in the sequence. | |||
@@ -285,8 +290,7 @@ private: | |||
friend class MidiFile; | |||
OwnedArray<MidiEventHolder> list; | |||
MidiEventHolder* addEvent (MidiEventHolder*, double); | |||
JUCE_LEAK_DETECTOR (MidiMessageSequence) | |||
}; | |||
#endif // JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -171,7 +163,7 @@ MidiBuffer MidiRPNGenerator::generate (int midiChannel, | |||
class MidiRPNDetectorTests : public UnitTest | |||
{ | |||
public: | |||
MidiRPNDetectorTests() : UnitTest ("MidiRPNDetector class") {} | |||
MidiRPNDetectorTests() : UnitTest ("MidiRPNDetector class", "MIDI/MPE") {} | |||
void runTest() override | |||
{ | |||
@@ -313,7 +305,7 @@ static MidiRPNDetectorTests MidiRPNDetectorUnitTests; | |||
class MidiRPNGeneratorTests : public UnitTest | |||
{ | |||
public: | |||
MidiRPNGeneratorTests() : UnitTest ("MidiRPNGenerator class") {} | |||
MidiRPNGeneratorTests() : UnitTest ("MidiRPNGenerator class", "MIDI/MPE") {} | |||
void runTest() override | |||
{ | |||
@@ -369,7 +361,7 @@ private: | |||
expectEquals (result.channel, expected.channel); | |||
expectEquals (result.parameterNumber, expected.parameterNumber); | |||
expectEquals (result.value, expected.value); | |||
expect (result.isNRPN == expected.isNRPN), | |||
expect (result.isNRPN == expected.isNRPN); | |||
expect (result.is14BitValue == expected.is14BitValue); | |||
} | |||
}; | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIRPNDETECTOR_H_INCLUDED | |||
#define JUCE_MIDIRPNDETECTOR_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -153,6 +144,3 @@ public: | |||
bool isNRPN = false, | |||
bool use14BitValue = true); | |||
}; | |||
#endif // JUCE_MIDIRPNDETECTOR_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -703,7 +695,7 @@ class MPEInstrumentTests : public UnitTest | |||
{ | |||
public: | |||
MPEInstrumentTests() | |||
: UnitTest ("MPEInstrument class") | |||
: UnitTest ("MPEInstrument class", "MIDI/MPE") | |||
{ | |||
// using two MPE zones with the following layout for testing | |||
// | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPEINSTRUMENT_H_INCLUDED | |||
#define JUCE_MPEINSTRUMENT_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -383,6 +374,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPEInstrument) | |||
}; | |||
#endif // JUCE_MPE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -79,7 +71,7 @@ MidiBuffer MPEMessages::setZoneLayout (const MPEZoneLayout& layout) | |||
class MPEMessagesTests : public UnitTest | |||
{ | |||
public: | |||
MPEMessagesTests() : UnitTest ("MPEMessages class") {} | |||
MPEMessagesTests() : UnitTest ("MPEMessages class", "MIDI/MPE") {} | |||
void runTest() override | |||
{ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPEMESSAGES_H_INCLUDED | |||
#define JUCE_MPEMESSAGES_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -96,7 +87,3 @@ public: | |||
*/ | |||
static const int zoneLayoutMessagesRpnNumber = 6; | |||
}; | |||
#endif // JUCE_MPEMESSAGES_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -107,7 +99,7 @@ bool MPENote::operator!= (const MPENote& other) const noexcept | |||
class MPENoteTests : public UnitTest | |||
{ | |||
public: | |||
MPENoteTests() : UnitTest ("MPENote class") {} | |||
MPENoteTests() : UnitTest ("MPENote class", "MIDI/MPE") {} | |||
//============================================================================== | |||
void runTest() override | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPENOTE_H_INCLUDED | |||
#define JUCE_MPENOTE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -181,6 +172,3 @@ struct JUCE_API MPENote | |||
/** Returns true if two notes are different notes, determined by their unique ID. */ | |||
bool operator!= (const MPENote& other) const noexcept; | |||
}; | |||
#endif // JUCE_MPENOTE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -32,7 +24,7 @@ MPESynthesiser::MPESynthesiser() | |||
{ | |||
} | |||
MPESynthesiser::MPESynthesiser (MPEInstrument* instrument) : MPESynthesiserBase (instrument) | |||
MPESynthesiser::MPESynthesiser (MPEInstrument* mpeInstrument) : MPESynthesiserBase (mpeInstrument) | |||
{ | |||
} | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPESynthesiser_H_INCLUDED | |||
#define JUCE_MPESynthesiser_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -314,6 +305,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiser) | |||
}; | |||
#endif // JUCE_MPESynthesiser_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPESynthesiserBase_H_INCLUDED | |||
#define JUCE_MPESynthesiserBase_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -213,6 +204,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserBase) | |||
}; | |||
#endif // JUCE_MPESynthesiserBase_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPEVoice_H_INCLUDED | |||
#define JUCE_MPEVoice_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
/** | |||
@@ -192,6 +183,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserVoice) | |||
}; | |||
#endif // JUCE_MPEVoice_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -97,7 +89,7 @@ bool MPEValue::operator!= (const MPEValue& other) const noexcept | |||
class MPEValueTests : public UnitTest | |||
{ | |||
public: | |||
MPEValueTests() : UnitTest ("MPEValue class") {} | |||
MPEValueTests() : UnitTest ("MPEValue class", "MIDI/MPE") {} | |||
void runTest() override | |||
{ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPEVALUE_H_INCLUDED | |||
#define JUCE_MPEVALUE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -97,6 +88,3 @@ private: | |||
MPEValue (int normalisedValue); | |||
int normalisedValue; | |||
}; | |||
#endif // JUCE_MPEVALUE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -171,7 +163,7 @@ bool MPEZone::operator!= (const MPEZone& other) const noexcept | |||
class MPEZoneTests : public UnitTest | |||
{ | |||
public: | |||
MPEZoneTests() : UnitTest ("MPEZone class") {} | |||
MPEZoneTests() : UnitTest ("MPEZone class", "MIDI/MPE") {} | |||
void runTest() override | |||
{ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPEZONE_H_INCLUDED | |||
#define JUCE_MPEZONE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -147,6 +138,3 @@ private: | |||
int perNotePitchbendRange; | |||
int masterPitchbendRange; | |||
}; | |||
#endif // JUCE_MPEZONE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -212,7 +204,7 @@ void MPEZoneLayout::removeListener (Listener* const listenerToRemove) noexcept | |||
class MPEZoneLayoutTests : public UnitTest | |||
{ | |||
public: | |||
MPEZoneLayoutTests() : UnitTest ("MPEZoneLayout class") {} | |||
MPEZoneLayoutTests() : UnitTest ("MPEZoneLayout class", "MIDI/MPE") {} | |||
void runTest() override | |||
{ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MPEZONELAYOUT_H_INCLUDED | |||
#define JUCE_MPEZONELAYOUT_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -166,6 +157,3 @@ private: | |||
void processZoneLayoutRpnMessage (MidiRPNMessage); | |||
void processPitchbendRangeRpnMessage (MidiRPNMessage); | |||
}; | |||
#endif // JUCE_MPEZONELAYOUT_H_INCLUDED |
@@ -0,0 +1,307 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#pragma once | |||
#if JUCE_MAC || JUCE_IOS | |||
struct CoreAudioLayouts | |||
{ | |||
//============================================================================== | |||
/** Convert CoreAudio's native AudioChannelLayout to JUCE's AudioChannelSet. | |||
Note that this method cannot preserve the order of channels. | |||
*/ | |||
static AudioChannelSet fromCoreAudio (const AudioChannelLayout& layout) | |||
{ | |||
return AudioChannelSet::channelSetWithChannels (getCoreAudioLayoutChannels (layout)); | |||
} | |||
/** Convert JUCE's AudioChannelSet to CoreAudio's AudioChannelLayoutTag. | |||
Note that this method cannot preserve the order of channels. | |||
*/ | |||
static AudioChannelLayoutTag toCoreAudio (const AudioChannelSet& set) | |||
{ | |||
for (auto* tbl = SpeakerLayoutTable::get(); tbl->tag != 0; ++tbl) | |||
{ | |||
AudioChannelSet caSet; | |||
for (int i = 0; i < numElementsInArray (tbl->channelTypes) | |||
&& tbl->channelTypes[i] != AudioChannelSet::unknown; ++i) | |||
caSet.addChannel (tbl->channelTypes[i]); | |||
if (caSet == set) | |||
return tbl->tag; | |||
} | |||
return kAudioChannelLayoutTag_DiscreteInOrder | static_cast<AudioChannelLayoutTag> (set.size()); | |||
} | |||
static const Array<AudioChannelLayoutTag>& getKnownCoreAudioTags() | |||
{ | |||
static Array<AudioChannelLayoutTag> tags (createKnownCoreAudioTags()); | |||
return tags; | |||
} | |||
//============================================================================== | |||
/** Convert CoreAudio's native AudioChannelLayout to an array of JUCE ChannelTypes. */ | |||
static Array<AudioChannelSet::ChannelType> getCoreAudioLayoutChannels (const AudioChannelLayout& layout) | |||
{ | |||
switch (layout.mChannelLayoutTag) | |||
{ | |||
case kAudioChannelLayoutTag_UseChannelBitmap: | |||
return AudioChannelSet::fromWaveChannelMask (static_cast<int> (layout.mChannelBitmap)).getChannelTypes(); | |||
case kAudioChannelLayoutTag_UseChannelDescriptions: | |||
{ | |||
Array<AudioChannelSet::ChannelType> channels; | |||
for (UInt32 i = 0; i < layout.mNumberChannelDescriptions; ++i) | |||
channels.addIfNotAlreadyThere (getChannelTypeFromAudioChannelLabel (layout.mChannelDescriptions[i].mChannelLabel)); | |||
// different speaker mappings may point to the same JUCE speaker so fill up | |||
// this array with discrete channels | |||
for (int j = 0; channels.size() < static_cast<int> (layout.mNumberChannelDescriptions); ++j) | |||
channels.addIfNotAlreadyThere (static_cast<AudioChannelSet::ChannelType> (AudioChannelSet::discreteChannel0 + j)); | |||
return channels; | |||
} | |||
case kAudioChannelLayoutTag_DiscreteInOrder: | |||
return AudioChannelSet::discreteChannels (static_cast<int> (layout.mChannelLayoutTag) & 0xffff).getChannelTypes(); | |||
default: | |||
break; | |||
} | |||
return getSpeakerLayoutForCoreAudioTag (layout.mChannelLayoutTag); | |||
} | |||
//============================================================================== | |||
/* Convert between a CoreAudio and JUCE channel indices - and vice versa. */ | |||
// TODO: Fabian remove this | |||
// static int convertChannelIndex (const AudioChannelLayout& caLayout, const AudioChannelSet& juceLayout, int index, bool fromJUCE) | |||
// { | |||
// auto coreAudioChannels = getCoreAudioLayoutChannels (caLayout); | |||
// | |||
// jassert (juceLayout.size() == coreAudioChannels.size()); | |||
// jassert (index >= 0 && index < juceLayout.size()); | |||
// | |||
// return (fromJUCE ? coreAudioChannels.indexOf (juceLayout.getTypeOfChannel (index)) | |||
// : juceLayout.getChannelIndexForType (coreAudioChannels.getReference (index))); | |||
// } | |||
private: | |||
//============================================================================== | |||
struct LayoutTagSpeakerList | |||
{ | |||
AudioChannelLayoutTag tag; | |||
AudioChannelSet::ChannelType channelTypes[16]; | |||
}; | |||
static Array<AudioChannelSet::ChannelType> getSpeakerLayoutForCoreAudioTag (AudioChannelLayoutTag tag) | |||
{ | |||
Array<AudioChannelSet::ChannelType> speakers; | |||
for (auto* tbl = SpeakerLayoutTable::get(); tbl->tag != 0; ++tbl) | |||
{ | |||
if (tag == tbl->tag) | |||
{ | |||
for (int i = 0; i < numElementsInArray (tbl->channelTypes) | |||
&& tbl->channelTypes[i] != AudioChannelSet::unknown; ++i) | |||
speakers.add (tbl->channelTypes[i]); | |||
return speakers; | |||
} | |||
} | |||
auto numChannels = tag & 0xffff; | |||
for (UInt32 i = 0; i < numChannels; ++i) | |||
speakers.add (static_cast<AudioChannelSet::ChannelType> (AudioChannelSet::discreteChannel0 + i)); | |||
return speakers; | |||
} | |||
static Array<AudioChannelLayoutTag> createKnownCoreAudioTags() | |||
{ | |||
Array<AudioChannelLayoutTag> tags; | |||
for (auto* tbl = SpeakerLayoutTable::get(); tbl->tag != 0; ++tbl) | |||
tags.addIfNotAlreadyThere (tbl->tag); | |||
return tags; | |||
} | |||
//============================================================================== | |||
// This list has been derived from https://pastebin.com/24dQ4BPJ | |||
// Apple channel labels have been replaced by JUCE channel names | |||
// This means that some layouts will be identical in JUCE but not in CoreAudio | |||
// In Apple's official definition the following tags exist with the same speaker layout and order | |||
// even when *not* represented in JUCE channels | |||
// kAudioChannelLayoutTag_Binaural = kAudioChannelLayoutTag_Stereo | |||
// kAudioChannelLayoutTag_MPEG_5_0_B = kAudioChannelLayoutTag_Pentagonal | |||
// kAudioChannelLayoutTag_ITU_2_2 = kAudioChannelLayoutTag_Quadraphonic | |||
// kAudioChannelLayoutTag_AudioUnit_6_0 = kAudioChannelLayoutTag_Hexagonal | |||
struct SpeakerLayoutTable : AudioChannelSet // save us some typing | |||
{ | |||
static LayoutTagSpeakerList* get() noexcept | |||
{ | |||
static LayoutTagSpeakerList tbl[] = { | |||
// list layouts for which there is a corresponding named AudioChannelSet first | |||
{ kAudioChannelLayoutTag_Mono, { centre } }, | |||
{ kAudioChannelLayoutTag_Stereo, { left, right } }, | |||
{ kAudioChannelLayoutTag_MPEG_3_0_A, { left, right, centre } }, | |||
{ kAudioChannelLayoutTag_ITU_2_1, { left, right, centreSurround } }, | |||
{ kAudioChannelLayoutTag_MPEG_4_0_A, { left, right, centre, centreSurround } }, | |||
{ kAudioChannelLayoutTag_MPEG_5_0_A, { left, right, centre, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_MPEG_5_1_A, { left, right, centre, LFE, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_AudioUnit_6_0, { left, right, leftSurround, rightSurround, centre, centreSurround } }, | |||
{ kAudioChannelLayoutTag_MPEG_6_1_A, { left, right, centre, LFE, leftSurround, rightSurround, centreSurround } }, | |||
{ kAudioChannelLayoutTag_DTS_6_0_A, { leftSurroundSide, rightSurroundSide, left, right, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_DTS_6_1_A, { leftSurroundSide, rightSurroundSide, left, right, leftSurround, rightSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_AudioUnit_7_0, { left, right, leftSurroundSide, rightSurroundSide, centre, leftSurroundRear, rightSurroundRear } }, | |||
{ kAudioChannelLayoutTag_AudioUnit_7_0_Front, { left, right, leftSurround, rightSurround, centre, leftCentre, rightCentre } }, | |||
{ kAudioChannelLayoutTag_MPEG_7_1_C, { left, right, centre, LFE, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear } }, | |||
{ kAudioChannelLayoutTag_MPEG_7_1_A, { left, right, centre, LFE, leftSurround, rightSurround, leftCentre, rightCentre } }, | |||
{ kAudioChannelLayoutTag_Ambisonic_B_Format, { ambisonicW, ambisonicX, ambisonicY, ambisonicZ } }, | |||
{ kAudioChannelLayoutTag_Quadraphonic, { left, right, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_Pentagonal, { left, right, leftSurroundRear, rightSurroundRear, centre } }, | |||
{ kAudioChannelLayoutTag_Hexagonal, { left, right, leftSurroundRear, rightSurroundRear, centre, centreSurround } }, | |||
{ kAudioChannelLayoutTag_Octagonal, { left, right, leftSurround, rightSurround, centre, centreSurround, wideLeft, wideRight } }, | |||
// more uncommon layouts | |||
{ kAudioChannelLayoutTag_StereoHeadphones, { left, right } }, | |||
{ kAudioChannelLayoutTag_MatrixStereo, { left, right } }, | |||
{ kAudioChannelLayoutTag_MidSide, { centre, discreteChannel0 } }, | |||
{ kAudioChannelLayoutTag_XY, { ambisonicX, ambisonicY } }, | |||
{ kAudioChannelLayoutTag_Binaural, { left, right } }, | |||
{ kAudioChannelLayoutTag_Cube, { left, right, leftSurround, rightSurround, topFrontLeft, topFrontRight, topRearLeft, topRearRight } }, | |||
{ kAudioChannelLayoutTag_MPEG_3_0_B, { centre, left, right } }, | |||
{ kAudioChannelLayoutTag_MPEG_4_0_B, { centre, left, right, centreSurround } }, | |||
{ kAudioChannelLayoutTag_MPEG_5_0_B, { left, right, leftSurround, rightSurround, centre } }, | |||
{ kAudioChannelLayoutTag_MPEG_5_0_C, { left, centre, right, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_MPEG_5_0_D, { centre, left, right, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_MPEG_5_1_B, { left, right, leftSurround, rightSurround, centre, LFE } }, | |||
{ kAudioChannelLayoutTag_MPEG_5_1_C, { left, centre, right, leftSurround, rightSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_MPEG_5_1_D, { centre, left, right, leftSurround, rightSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_MPEG_7_1_B, { centre, leftCentre, rightCentre, left, right, leftSurround, rightSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_Emagic_Default_7_1, { left, right, leftSurround, rightSurround, centre, LFE, leftCentre, rightCentre } }, | |||
{ kAudioChannelLayoutTag_SMPTE_DTV, { left, right, centre, LFE, leftSurround, rightSurround, discreteChannel0 /* leftMatrixTotal */, (ChannelType) (discreteChannel0 + 1) /* rightMatrixTotal */} }, | |||
{ kAudioChannelLayoutTag_ITU_2_2, { left, right, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_DVD_4, { left, right, LFE } }, | |||
{ kAudioChannelLayoutTag_DVD_5, { left, right, LFE, centreSurround } }, | |||
{ kAudioChannelLayoutTag_DVD_6, { left, right, LFE, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_DVD_10, { left, right, centre, LFE } }, | |||
{ kAudioChannelLayoutTag_DVD_11, { left, right, centre, LFE, centreSurround } }, | |||
{ kAudioChannelLayoutTag_DVD_18, { left, right, leftSurround, rightSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_AAC_6_0, { centre, left, right, leftSurround, rightSurround, centreSurround } }, | |||
{ kAudioChannelLayoutTag_AAC_6_1, { centre, left, right, leftSurround, rightSurround, centreSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_AAC_7_0, { centre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear } }, | |||
{ kAudioChannelLayoutTag_AAC_7_1_B, { centre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, LFE } }, | |||
{ kAudioChannelLayoutTag_AAC_7_1_C, { centre, left, right, leftSurround, rightSurround, LFE, topFrontLeft, topFrontRight } }, | |||
{ kAudioChannelLayoutTag_AAC_Octagonal, { centre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, centreSurround } }, | |||
{ kAudioChannelLayoutTag_TMH_10_2_std, { left, right, centre, topFrontCentre, leftSurroundSide, rightSurroundSide, leftSurround, rightSurround, topFrontLeft, topFrontRight, wideLeft, wideRight, topRearCentre, centreSurround, LFE, LFE2 } }, | |||
{ kAudioChannelLayoutTag_AC3_1_0_1, { centre, LFE } }, | |||
{ kAudioChannelLayoutTag_AC3_3_0, { left, centre, right } }, | |||
{ kAudioChannelLayoutTag_AC3_3_1, { left, centre, right, centreSurround } }, | |||
{ kAudioChannelLayoutTag_AC3_3_0_1, { left, centre, right, LFE } }, | |||
{ kAudioChannelLayoutTag_AC3_2_1_1, { left, right, centreSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_AC3_3_1_1, { left, centre, right, centreSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_EAC_6_0_A, { left, centre, right, leftSurround, rightSurround, centreSurround } }, | |||
{ kAudioChannelLayoutTag_EAC_7_0_A, { left, centre, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear } }, | |||
{ kAudioChannelLayoutTag_EAC3_6_1_A, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround } }, | |||
{ kAudioChannelLayoutTag_EAC3_6_1_B, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround } }, | |||
{ kAudioChannelLayoutTag_EAC3_6_1_C, { left, centre, right, leftSurround, rightSurround, LFE, topFrontCentre } }, | |||
{ kAudioChannelLayoutTag_EAC3_7_1_A, { left, centre, right, leftSurround, rightSurround, LFE, leftSurroundRear, rightSurroundRear } }, | |||
{ kAudioChannelLayoutTag_EAC3_7_1_B, { left, centre, right, leftSurround, rightSurround, LFE, leftCentre, rightCentre } }, | |||
{ kAudioChannelLayoutTag_EAC3_7_1_C, { left, centre, right, leftSurround, rightSurround, LFE, leftSurroundSide, rightSurroundSide } }, | |||
{ kAudioChannelLayoutTag_EAC3_7_1_D, { left, centre, right, leftSurround, rightSurround, LFE, wideLeft, wideRight } }, | |||
{ kAudioChannelLayoutTag_EAC3_7_1_E, { left, centre, right, leftSurround, rightSurround, LFE, topFrontLeft, topFrontRight } }, | |||
{ kAudioChannelLayoutTag_EAC3_7_1_F, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround, topMiddle } }, | |||
{ kAudioChannelLayoutTag_EAC3_7_1_G, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround, topFrontCentre } }, | |||
{ kAudioChannelLayoutTag_EAC3_7_1_H, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround, topFrontCentre } }, | |||
{ kAudioChannelLayoutTag_DTS_3_1, { centre, left, right, LFE } }, | |||
{ kAudioChannelLayoutTag_DTS_4_1, { centre, left, right, centreSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_DTS_6_0_B, { centre, left, right, leftSurroundRear, rightSurroundRear, centreSurround } }, | |||
{ kAudioChannelLayoutTag_DTS_6_0_C, { centre, centreSurround, left, right, leftSurroundRear, rightSurroundRear } }, | |||
{ kAudioChannelLayoutTag_DTS_6_1_B, { centre, left, right, leftSurroundRear, rightSurroundRear, centreSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_DTS_6_1_C, { centre, centreSurround, left, right, leftSurroundRear, rightSurroundRear, LFE } }, | |||
{ kAudioChannelLayoutTag_DTS_6_1_D, { centre, left, right, leftSurround, rightSurround, LFE, centreSurround } }, | |||
{ kAudioChannelLayoutTag_DTS_7_0, { leftCentre, centre, rightCentre, left, right, leftSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_DTS_7_1, { leftCentre, centre, rightCentre, left, right, leftSurround, rightSurround, LFE } }, | |||
{ kAudioChannelLayoutTag_DTS_8_0_A, { leftCentre, rightCentre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear } }, | |||
{ kAudioChannelLayoutTag_DTS_8_0_B, { leftCentre, centre, rightCentre, left, right, leftSurround, centreSurround, rightSurround } }, | |||
{ kAudioChannelLayoutTag_DTS_8_1_A, { leftCentre, rightCentre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, LFE } }, | |||
{ kAudioChannelLayoutTag_DTS_8_1_B, { leftCentre, centre, rightCentre, left, right, leftSurround, centreSurround, rightSurround, LFE } }, | |||
{ 0, {} } | |||
}; | |||
return tbl; | |||
} | |||
}; | |||
//============================================================================== | |||
static AudioChannelSet::ChannelType getChannelTypeFromAudioChannelLabel (AudioChannelLabel label) noexcept | |||
{ | |||
if (label >= kAudioChannelLabel_Discrete_0 && label <= kAudioChannelLabel_Discrete_65535) | |||
{ | |||
const unsigned int discreteChannelNum = label - kAudioChannelLabel_Discrete_0; | |||
return static_cast<AudioChannelSet::ChannelType> (AudioChannelSet::discreteChannel0 + discreteChannelNum); | |||
} | |||
switch (label) | |||
{ | |||
case kAudioChannelLabel_Center: | |||
case kAudioChannelLabel_Mono: return AudioChannelSet::centre; | |||
case kAudioChannelLabel_Left: | |||
case kAudioChannelLabel_HeadphonesLeft: return AudioChannelSet::left; | |||
case kAudioChannelLabel_Right: | |||
case kAudioChannelLabel_HeadphonesRight: return AudioChannelSet::right; | |||
case kAudioChannelLabel_LFEScreen: return AudioChannelSet::LFE; | |||
case kAudioChannelLabel_LeftSurround: return AudioChannelSet::leftSurround; | |||
case kAudioChannelLabel_RightSurround: return AudioChannelSet::rightSurround; | |||
case kAudioChannelLabel_LeftCenter: return AudioChannelSet::leftCentre; | |||
case kAudioChannelLabel_RightCenter: return AudioChannelSet::rightCentre; | |||
case kAudioChannelLabel_CenterSurround: return AudioChannelSet::surround; | |||
case kAudioChannelLabel_LeftSurroundDirect: return AudioChannelSet::leftSurroundSide; | |||
case kAudioChannelLabel_RightSurroundDirect: return AudioChannelSet::rightSurroundSide; | |||
case kAudioChannelLabel_TopCenterSurround: return AudioChannelSet::topMiddle; | |||
case kAudioChannelLabel_VerticalHeightLeft: return AudioChannelSet::topFrontLeft; | |||
case kAudioChannelLabel_VerticalHeightRight: return AudioChannelSet::topFrontRight; | |||
case kAudioChannelLabel_VerticalHeightCenter: return AudioChannelSet::topFrontCentre; | |||
case kAudioChannelLabel_TopBackLeft: return AudioChannelSet::topRearLeft; | |||
case kAudioChannelLabel_RearSurroundLeft: return AudioChannelSet::leftSurroundRear; | |||
case kAudioChannelLabel_TopBackRight: return AudioChannelSet::topRearRight; | |||
case kAudioChannelLabel_RearSurroundRight: return AudioChannelSet::rightSurroundRear; | |||
case kAudioChannelLabel_TopBackCenter: return AudioChannelSet::topRearCentre; | |||
case kAudioChannelLabel_LFE2: return AudioChannelSet::LFE2; | |||
case kAudioChannelLabel_LeftWide: return AudioChannelSet::wideLeft; | |||
case kAudioChannelLabel_RightWide: return AudioChannelSet::wideRight; | |||
case kAudioChannelLabel_Ambisonic_W: return AudioChannelSet::ambisonicW; | |||
case kAudioChannelLabel_Ambisonic_X: return AudioChannelSet::ambisonicX; | |||
case kAudioChannelLabel_Ambisonic_Y: return AudioChannelSet::ambisonicY; | |||
case kAudioChannelLabel_Ambisonic_Z: return AudioChannelSet::ambisonicZ; | |||
default: return AudioChannelSet::unknown; | |||
} | |||
} | |||
}; | |||
#endif |
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_AUDIOSOURCE_H_INCLUDED | |||
#define JUCE_AUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -182,6 +173,3 @@ public: | |||
*/ | |||
virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0; | |||
}; | |||
#endif // JUCE_AUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_BUFFERINGAUDIOSOURCE_H_INCLUDED | |||
#define JUCE_BUFFERINGAUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -122,6 +113,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BufferingAudioSource) | |||
}; | |||
#endif // JUCE_BUFFERINGAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED | |||
#define JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -144,6 +135,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChannelRemappingAudioSource) | |||
}; | |||
#endif // JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_IIRFILTERAUDIOSOURCE_H_INCLUDED | |||
#define JUCE_IIRFILTERAUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -71,6 +62,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (IIRFilterAudioSource) | |||
}; | |||
#endif // JUCE_IIRFILTERAUDIOSOURCE_H_INCLUDED |
@@ -0,0 +1,66 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
//============================================================================== | |||
MemoryAudioSource::MemoryAudioSource (AudioBuffer<float>& bufferToUse, bool copyMemory, bool shouldLoop) | |||
: isLooping (shouldLoop) | |||
{ | |||
if (copyMemory) | |||
buffer.makeCopyOf (bufferToUse); | |||
else | |||
buffer.setDataToReferTo (bufferToUse.getArrayOfWritePointers(), | |||
bufferToUse.getNumChannels(), | |||
bufferToUse.getNumSamples()); | |||
} | |||
//============================================================================== | |||
void MemoryAudioSource::prepareToPlay (int /*samplesPerBlockExpected*/, double /*sampleRate*/) | |||
{ | |||
position = 0; | |||
} | |||
void MemoryAudioSource::releaseResources() {} | |||
void MemoryAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) | |||
{ | |||
auto& dst = *bufferToFill.buffer; | |||
auto channels = jmin (dst.getNumChannels(), buffer.getNumChannels()); | |||
auto max = 0, pos = 0; | |||
auto n = buffer.getNumSamples(), m = bufferToFill.numSamples; | |||
for (auto i = position; (i < n || isLooping) && (pos < m); i += max) | |||
{ | |||
max = jmin (m - pos, n - (i % n)); | |||
int ch = 0; | |||
for (; ch < channels; ++ch) | |||
dst.copyFrom (ch, bufferToFill.startSample + pos, buffer, ch, i % n, max); | |||
for (; ch < dst.getNumChannels(); ++ch) | |||
dst.clear (ch, bufferToFill.startSample + pos, max); | |||
pos += max; | |||
} | |||
if (pos < m) | |||
dst.clear (bufferToFill.startSample + pos, m - pos); | |||
} |
@@ -0,0 +1,61 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#pragma once | |||
//============================================================================== | |||
/** | |||
An AudioSource which takes some float audio data as an input. | |||
*/ | |||
class JUCE_API MemoryAudioSource : public AudioSource | |||
{ | |||
public: | |||
//============================================================================== | |||
/** Creates a MemoryAudioSource by providing an audio buffer. | |||
If copyMemory is true then the buffer will be copied into an internal | |||
buffer which will be owned by the MemoryAudioSource. If copyMemory is | |||
false, then you must ensure that the lifetime of the audio buffer is | |||
at least as long as the MemoryAudioSource. | |||
*/ | |||
MemoryAudioSource (AudioBuffer<float>& audioBuffer, bool copyMemory, bool shouldLoop = false); | |||
//============================================================================== | |||
/** Implementation of the AudioSource method. */ | |||
void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override; | |||
/** Implementation of the AudioSource method. */ | |||
void releaseResources() override; | |||
/** Implementation of the AudioSource method. */ | |||
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override; | |||
private: | |||
//============================================================================== | |||
AudioBuffer<float> buffer; | |||
int position = 0; | |||
bool isLooping; | |||
//============================================================================== | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MemoryAudioSource) | |||
}; |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIXERAUDIOSOURCE_H_INCLUDED | |||
#define JUCE_MIXERAUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -102,6 +93,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MixerAudioSource) | |||
}; | |||
#endif // JUCE_MIXERAUDIOSOURCE_H_INCLUDED |
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_POSITIONABLEAUDIOSOURCE_H_INCLUDED | |||
#define JUCE_POSITIONABLEAUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -79,6 +70,3 @@ public: | |||
/** Tells the source whether you'd like it to play in a loop. */ | |||
virtual void setLooping (bool shouldLoop) { ignoreUnused (shouldLoop); } | |||
}; | |||
#endif // JUCE_POSITIONABLEAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_RESAMPLINGAUDIOSOURCE_H_INCLUDED | |||
#define JUCE_RESAMPLINGAUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -108,6 +99,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ResamplingAudioSource) | |||
}; | |||
#endif // JUCE_RESAMPLINGAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_REVERBAUDIOSOURCE_H_INCLUDED | |||
#define JUCE_REVERBAUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -77,6 +68,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ReverbAudioSource) | |||
}; | |||
#endif // JUCE_REVERBAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_TONEGENERATORAUDIOSOURCE_H_INCLUDED | |||
#define JUCE_TONEGENERATORAUDIOSOURCE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -74,6 +65,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToneGeneratorAudioSource) | |||
}; | |||
#endif // JUCE_TONEGENERATORAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_SYNTHESISER_H_INCLUDED | |||
#define JUCE_SYNTHESISER_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -641,6 +632,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Synthesiser) | |||
}; | |||
#endif // JUCE_SYNTHESISER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -442,7 +434,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup | |||
jassert (&newSetup != ¤tSetup); // this will have no effect | |||
if (newSetup == currentSetup && currentAudioDevice != nullptr) | |||
return String(); | |||
return {}; | |||
if (! (newSetup == currentSetup)) | |||
sendChangeMessage(); | |||
@@ -462,7 +454,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup | |||
if (treatAsChosenDevice) | |||
updateXml(); | |||
return String(); | |||
return {}; | |||
} | |||
if (currentSetup.inputDeviceName != newInputDeviceName | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_AUDIODEVICEMANAGER_H_INCLUDED | |||
#define JUCE_AUDIODEVICEMANAGER_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -527,5 +518,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceManager) | |||
}; | |||
#endif // JUCE_AUDIODEVICEMANAGER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_AUDIOIODEVICE_H_INCLUDED | |||
#define JUCE_AUDIOIODEVICE_H_INCLUDED | |||
#pragma once | |||
class AudioIODevice; | |||
@@ -310,6 +301,3 @@ protected: | |||
/** @internal */ | |||
String name, typeName; | |||
}; | |||
#endif // JUCE_AUDIOIODEVICE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_AUDIOIODEVICETYPE_H_INCLUDED | |||
#define JUCE_AUDIOIODEVICETYPE_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -183,6 +174,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE (AudioIODeviceType) | |||
}; | |||
#endif // JUCE_AUDIOIODEVICETYPE_H_INCLUDED |
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_SYSTEMAUDIOVOLUME_H_INCLUDED | |||
#define JUCE_SYSTEMAUDIOVOLUME_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -62,6 +53,3 @@ private: | |||
SystemAudioVolume(); // Don't instantiate this class, just call its static fns. | |||
JUCE_DECLARE_NON_COPYABLE (SystemAudioVolume) | |||
}; | |||
#endif // JUCE_SYSTEMAUDIOVOLUME_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -37,14 +29,20 @@ | |||
#error "Incorrect use of JUCE cpp file" | |||
#endif | |||
#include "AppConfig.h" | |||
#define JUCE_CORE_INCLUDE_OBJC_HELPERS 1 | |||
#define JUCE_CORE_INCLUDE_COM_SMART_PTR 1 | |||
#define JUCE_CORE_INCLUDE_JNI_HELPERS 1 | |||
#define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1 | |||
#define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1 | |||
#ifndef JUCE_USE_WINRT_MIDI | |||
#define JUCE_USE_WINRT_MIDI 0 | |||
#endif | |||
#if JUCE_USE_WINRT_MIDI | |||
#define JUCE_EVENTS_INCLUDE_WINRT_WRAPPER 1 | |||
#endif | |||
#include "juce_audio_devices.h" | |||
//============================================================================== | |||
@@ -72,6 +70,30 @@ | |||
#include <mmreg.h> | |||
#endif | |||
#if JUCE_USE_WINRT_MIDI | |||
/* If you cannot find any of the header files below then you are probably | |||
attempting to use the Windows 10 Bluetooth Low Energy API. For this to work you | |||
need to install version 10.0.14393.0 of the Windows Standalone SDK and add the | |||
path to the WinRT headers to your build system. This path should have the form | |||
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt". | |||
Also please note that Microsoft's Bluetooth MIDI stack has multiple issues, so | |||
this API is EXPERIMENTAL - use at your own risk! | |||
*/ | |||
#include <windows.devices.h> | |||
#include <windows.devices.midi.h> | |||
#include <windows.devices.enumeration.h> | |||
#include <wrl/event.h> | |||
#if JUCE_MSVC | |||
#pragma warning (push) | |||
#pragma warning (disable: 4467) | |||
#endif | |||
#include <robuffer.h> | |||
#if JUCE_MSVC | |||
#pragma warning (pop) | |||
#endif | |||
#endif | |||
#if JUCE_ASIO | |||
/* This is very frustrating - we only need to use a handful of definitions from | |||
a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -39,7 +31,7 @@ | |||
ID: juce_audio_devices | |||
vendor: juce | |||
version: 4.3.1 | |||
version: 5.1.1 | |||
name: JUCE audio and MIDI I/O device classes | |||
description: Classes to play and record from audio and MIDI I/O devices | |||
website: http://www.juce.com/juce | |||
@@ -56,12 +48,16 @@ | |||
*******************************************************************************/ | |||
#ifndef JUCE_AUDIO_DEVICES_H_INCLUDED | |||
#pragma once | |||
#define JUCE_AUDIO_DEVICES_H_INCLUDED | |||
#include <juce_events/juce_events.h> | |||
#include <juce_audio_basics/juce_audio_basics.h> | |||
#if JUCE_MODULE_AVAILABLE_juce_graphics | |||
#include <juce_graphics/juce_graphics.h> | |||
#endif | |||
//============================================================================== | |||
/** Config: JUCE_ASIO | |||
Enables ASIO audio devices (MS Windows only). | |||
@@ -123,20 +119,42 @@ | |||
#endif | |||
#endif | |||
/** Config: JUCE_USE_WINRT_MIDI | |||
*** | |||
EXPERIMENTAL - Microsoft's Bluetooth MIDI stack has multiple issues, | |||
use at your own risk! | |||
*** | |||
Enables the use of the Windows Runtime API for MIDI, which supports | |||
Bluetooth Low Energy connections on computers with the Anniversary Update | |||
of Windows 10. | |||
To compile with this flag requires version 10.0.14393.0 of the Windows | |||
Standalone SDK and you must add the path to the WinRT headers. This path | |||
should be something similar to | |||
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt". | |||
*/ | |||
#ifndef JUCE_USE_WINRT_MIDI | |||
#define JUCE_USE_WINRT_MIDI 0 | |||
#endif | |||
//============================================================================== | |||
namespace juce | |||
{ | |||
#include "audio_io/juce_AudioIODevice.h" | |||
#include "audio_io/juce_AudioIODeviceType.h" | |||
#include "audio_io/juce_SystemAudioVolume.h" | |||
#include "midi_io/juce_MidiInput.h" | |||
#include "midi_io/juce_MidiMessageCollector.h" | |||
#include "midi_io/juce_MidiOutput.h" | |||
#include "audio_io/juce_AudioIODevice.h" | |||
#include "audio_io/juce_AudioIODeviceType.h" | |||
#include "audio_io/juce_SystemAudioVolume.h" | |||
#include "sources/juce_AudioSourcePlayer.h" | |||
#include "sources/juce_AudioTransportSource.h" | |||
#include "audio_io/juce_AudioDeviceManager.h" | |||
} | |||
#if JUCE_IOS | |||
#include "native/juce_ios_Audio.h" | |||
#endif | |||
#endif // JUCE_AUDIO_DEVICES_H_INCLUDED | |||
} |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIINPUT_H_INCLUDED | |||
#define JUCE_MIDIINPUT_H_INCLUDED | |||
#pragma once | |||
class MidiInput; | |||
@@ -173,13 +164,10 @@ public: | |||
private: | |||
//============================================================================== | |||
String name; | |||
void* internal; | |||
void* internal = nullptr; | |||
// The input objects are created with the openDevice() method. | |||
explicit MidiInput (const String&); | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiInput) | |||
}; | |||
#endif // JUCE_MIDIINPUT_H_INCLUDED |
@@ -2,35 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
MidiMessageCollector::MidiMessageCollector() | |||
: lastCallbackTime (0), | |||
sampleRate (44100.0001) | |||
{ | |||
} | |||
@@ -44,6 +34,9 @@ void MidiMessageCollector::reset (const double newSampleRate) | |||
jassert (newSampleRate > 0); | |||
const ScopedLock sl (midiCallbackLock); | |||
#if JUCE_DEBUG | |||
hasCalledReset = true; | |||
#endif | |||
sampleRate = newSampleRate; | |||
incomingMessages.clear(); | |||
lastCallbackTime = Time::getMillisecondCounterHiRes(); | |||
@@ -51,8 +44,9 @@ void MidiMessageCollector::reset (const double newSampleRate) | |||
void MidiMessageCollector::addMessageToQueue (const MidiMessage& message) | |||
{ | |||
// you need to call reset() to set the correct sample rate before using this object | |||
jassert (sampleRate != 44100.0001); | |||
#if JUCE_DEBUG | |||
jassert (hasCalledReset); // you need to call reset() to set the correct sample rate before using this object | |||
#endif | |||
// the messages that come in here need to be time-stamped correctly - see MidiInput | |||
// for details of what the number should be. | |||
@@ -60,8 +54,7 @@ void MidiMessageCollector::addMessageToQueue (const MidiMessage& message) | |||
const ScopedLock sl (midiCallbackLock); | |||
const int sampleNumber | |||
= (int) ((message.getTimeStamp() - 0.001 * lastCallbackTime) * sampleRate); | |||
auto sampleNumber = (int) ((message.getTimeStamp() - 0.001 * lastCallbackTime) * sampleRate); | |||
incomingMessages.addEvent (message, sampleNumber); | |||
@@ -74,12 +67,14 @@ void MidiMessageCollector::addMessageToQueue (const MidiMessage& message) | |||
void MidiMessageCollector::removeNextBlockOfMessages (MidiBuffer& destBuffer, | |||
const int numSamples) | |||
{ | |||
// you need to call reset() to set the correct sample rate before using this object | |||
jassert (sampleRate != 44100.0001); | |||
#if JUCE_DEBUG | |||
jassert (hasCalledReset); // you need to call reset() to set the correct sample rate before using this object | |||
#endif | |||
jassert (numSamples > 0); | |||
const double timeNow = Time::getMillisecondCounterHiRes(); | |||
const double msElapsed = timeNow - lastCallbackTime; | |||
auto timeNow = Time::getMillisecondCounterHiRes(); | |||
auto msElapsed = timeNow - lastCallbackTime; | |||
const ScopedLock sl (midiCallbackLock); | |||
lastCallbackTime = timeNow; | |||
@@ -87,7 +82,6 @@ void MidiMessageCollector::removeNextBlockOfMessages (MidiBuffer& destBuffer, | |||
if (! incomingMessages.isEmpty()) | |||
{ | |||
int numSourceSamples = jmax (1, roundToInt (msElapsed * 0.001 * sampleRate)); | |||
int startSample = 0; | |||
int scale = 1 << 16; | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIMESSAGECOLLECTOR_H_INCLUDED | |||
#define JUCE_MIDIMESSAGECOLLECTOR_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -98,13 +89,13 @@ public: | |||
private: | |||
//============================================================================== | |||
double lastCallbackTime; | |||
double lastCallbackTime = 0; | |||
CriticalSection midiCallbackLock; | |||
MidiBuffer incomingMessages; | |||
double sampleRate; | |||
double sampleRate = 44100.0; | |||
#if JUCE_DEBUG | |||
bool hasCalledReset = false; | |||
#endif | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiMessageCollector) | |||
}; | |||
#endif // JUCE_MIDIMESSAGECOLLECTOR_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -38,7 +30,7 @@ struct MidiOutput::PendingMessage | |||
PendingMessage* next; | |||
}; | |||
MidiOutput::MidiOutput(const String& midiName) | |||
MidiOutput::MidiOutput (const String& midiName) | |||
: Thread ("midi out"), | |||
internal (nullptr), | |||
firstMessage (nullptr), | |||
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIOUTPUT_H_INCLUDED | |||
#define JUCE_MIDIOUTPUT_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
@@ -137,17 +128,14 @@ public: | |||
private: | |||
//============================================================================== | |||
void* internal; | |||
void* internal = nullptr; | |||
CriticalSection lock; | |||
struct PendingMessage; | |||
PendingMessage* firstMessage; | |||
String name; | |||
MidiOutput(const String& midiName); // These objects are created with the openDevice() method. | |||
MidiOutput (const String& midiName); // These objects are created with the openDevice() method. | |||
void run() override; | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiOutput) | |||
}; | |||
#endif // JUCE_MIDIOUTPUT_H_INCLUDED |
@@ -2,34 +2,25 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#ifndef JUCE_MIDIDATACONCATENATOR_H_INCLUDED | |||
#define JUCE_MIDIDATACONCATENATOR_H_INCLUDED | |||
#pragma once | |||
//============================================================================== | |||
/** | |||
@@ -196,5 +187,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE (MidiDataConcatenator) | |||
}; | |||
#endif // JUCE_MIDIDATACONCATENATOR_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -199,7 +191,7 @@ public: | |||
numDeviceOutputChannels = 2; | |||
outputDevice = GlobalRef (env->NewObject (AudioTrack, AudioTrack.constructor, | |||
STREAM_MUSIC, sampleRate, CHANNEL_OUT_STEREO, ENCODING_PCM_16BIT, | |||
(jint) (minBufferSizeOut * numDeviceOutputChannels * sizeof (int16)), MODE_STREAM)); | |||
(jint) (minBufferSizeOut * numDeviceOutputChannels * static_cast<int> (sizeof (int16))), MODE_STREAM)); | |||
int outputDeviceState = env->CallIntMethod (outputDevice, AudioTrack.getState); | |||
if (outputDeviceState > 0) | |||
@@ -232,7 +224,7 @@ public: | |||
0 /* (default audio source) */, sampleRate, | |||
numDeviceInputChannelsAvailable > 1 ? CHANNEL_IN_STEREO : CHANNEL_IN_MONO, | |||
ENCODING_PCM_16BIT, | |||
(jint) (minBufferSizeIn * numDeviceInputChannels * sizeof (int16)))); | |||
(jint) (minBufferSizeIn * numDeviceInputChannels * static_cast<int> (sizeof (int16))))); | |||
int inputDeviceState = env->CallIntMethod (inputDevice, AudioRecord.getState); | |||
if (inputDeviceState > 0) | |||
@@ -441,9 +433,9 @@ public: | |||
//============================================================================== | |||
void scanForDevices() {} | |||
StringArray getDeviceNames (bool wantInputNames) const { return StringArray (javaAudioTypeName); } | |||
int getDefaultDeviceIndex (bool forInput) const { return 0; } | |||
int getIndexOfDevice (AudioIODevice* device, bool asInput) const { return device != nullptr ? 0 : -1; } | |||
StringArray getDeviceNames (bool) const { return StringArray (javaAudioTypeName); } | |||
int getDefaultDeviceIndex (bool) const { return 0; } | |||
int getIndexOfDevice (AudioIODevice* device, bool) const { return device != nullptr ? 0 : -1; } | |||
bool hasSeparateInputsAndOutputs() const { return false; } | |||
AudioIODevice* createDevice (const String& outputDeviceName, | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -96,8 +88,8 @@ public: | |||
jassert (byteArray != nullptr); | |||
jbyte* data = getEnv()->GetByteArrayElements (byteArray, nullptr); | |||
HeapBlock<uint8> buffer (len); | |||
std::memcpy (buffer.getData(), data + offset, len); | |||
HeapBlock<uint8> buffer (static_cast<size_t> (len)); | |||
std::memcpy (buffer.getData(), data + offset, static_cast<size_t> (len)); | |||
midiConcatenator.pushMidiData (buffer.getData(), | |||
len, static_cast<double> (timestamp) * 1.0e-9, | |||
@@ -109,8 +101,8 @@ public: | |||
private: | |||
MidiInput* juceMidiInput; | |||
MidiInputCallback* callback; | |||
GlobalRef javaMidiDevice; | |||
MidiDataConcatenator midiConcatenator; | |||
GlobalRef javaMidiDevice; | |||
}; | |||
//============================================================================== | |||
@@ -144,7 +136,7 @@ private: | |||
}; | |||
JUCE_JNI_CALLBACK (JUCE_JOIN_MACRO (JUCE_ANDROID_ACTIVITY_CLASSNAME, _00024JuceMidiInputPort), handleReceive, | |||
void, (JNIEnv* env, jobject device, jlong host, jbyteArray byteArray, | |||
void, (JNIEnv* env, jobject, jlong host, jbyteArray byteArray, | |||
jint offset, jint count, jlong timestamp)) | |||
{ | |||
// Java may create a Midi thread which JUCE doesn't know about and this callback may be | |||
@@ -172,7 +164,7 @@ public: | |||
return juceString (string); | |||
} | |||
return String(); | |||
return {}; | |||
} | |||
String getOutputPortNameForJuceIndex (int idx) | |||
@@ -183,7 +175,7 @@ public: | |||
return juceString (string); | |||
} | |||
return String(); | |||
return {}; | |||
} | |||
StringArray getDevices (bool input) | |||
@@ -200,7 +192,7 @@ public: | |||
return javaStringArrayToJuce (devices); | |||
} | |||
return StringArray(); | |||
return {}; | |||
} | |||
AndroidMidiInput* openMidiInputPortWithIndex (int idx, MidiInput* juceMidiInput, juce::MidiInputCallback* callback) | |||
@@ -302,7 +294,7 @@ void MidiOutput::sendMessageNow (const MidiMessage& message) | |||
jbyteArray content = messageContent.get(); | |||
jbyte* rawBytes = env->GetByteArrayElements (content, nullptr); | |||
std::memcpy (rawBytes, message.getRawData(), messageSize); | |||
std::memcpy (rawBytes, message.getRawData(), static_cast<size_t> (messageSize)); | |||
env->ReleaseByteArrayElements (content, rawBytes, 0); | |||
androidMidi->send (content, (jint) 0, (jint) messageSize); | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -33,14 +25,18 @@ class iOSAudioIODevice; | |||
static const char* const iOSAudioDeviceName = "iOS Audio"; | |||
//============================================================================== | |||
struct AudioSessionHolder | |||
struct AudioSessionHolder : public AsyncUpdater | |||
{ | |||
AudioSessionHolder(); | |||
~AudioSessionHolder(); | |||
void handleAsyncUpdate() override; | |||
void handleStatusChange (bool enabled, const char* reason) const; | |||
void handleRouteChange (const char* reason) const; | |||
void handleRouteChange (const char* reason); | |||
CriticalSection routeChangeLock; | |||
String lastRouteChangeReason; | |||
Array<iOSAudioIODevice*> activeDevices; | |||
id nativeSession; | |||
@@ -210,35 +206,27 @@ static void logNSError (NSError* e) | |||
#define JUCE_NSERROR_CHECK(X) { NSError* error = nil; X; logNSError (error); } | |||
#if JUCE_MODULE_AVAILABLE_juce_graphics | |||
#include <juce_graphics/native/juce_mac_CoreGraphicsHelpers.h> | |||
#endif | |||
//============================================================================== | |||
class iOSAudioIODevice : public AudioIODevice | |||
struct iOSAudioIODevice::Pimpl : public AudioPlayHead, | |||
public AsyncUpdater | |||
{ | |||
public: | |||
iOSAudioIODevice (const String& deviceName) | |||
: AudioIODevice (deviceName, iOSAudioDeviceName) | |||
Pimpl (iOSAudioIODevice& ioDevice) | |||
: owner (ioDevice) | |||
{ | |||
sessionHolder->activeDevices.add (this); | |||
updateSampleRateAndAudioInput(); | |||
} | |||
sessionHolder->activeDevices.add (&owner); | |||
~iOSAudioIODevice() | |||
{ | |||
sessionHolder->activeDevices.removeFirstMatchingValue (this); | |||
close(); | |||
} | |||
StringArray getOutputChannelNames() override | |||
{ | |||
return { "Left", "Right" }; | |||
updateSampleRateAndAudioInput(); | |||
} | |||
StringArray getInputChannelNames() override | |||
~Pimpl() | |||
{ | |||
if (audioInputIsAvailable) | |||
return { "Left", "Right" }; | |||
sessionHolder->activeDevices.removeFirstMatchingValue (&owner); | |||
return {}; | |||
close(); | |||
} | |||
static void setAudioSessionActive (bool enabled) | |||
@@ -255,8 +243,10 @@ public: | |||
return session.sampleRate; | |||
} | |||
Array<double> getAvailableSampleRates() override | |||
Array<double> getAvailableSampleRates() | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
Array<double> rates; | |||
// Important: the supported audio sample rates change on the iPhone 6S | |||
@@ -265,7 +255,7 @@ public: | |||
AudioUnitRemovePropertyListenerWithUserData (audioUnit, | |||
kAudioUnitProperty_StreamFormat, | |||
handleStreamFormatChangeCallback, | |||
dispatchAudioUnitPropertyChange, | |||
this); | |||
const double lowestRate = trySampleRate (4000); | |||
@@ -275,27 +265,24 @@ public: | |||
{ | |||
const double supportedRate = trySampleRate (rate); | |||
rates.addIfNotAlreadyThere (supportedRate); | |||
if (rates.addIfNotAlreadyThere (supportedRate)) | |||
JUCE_IOS_AUDIO_LOG ("available rate = " + String (supportedRate, 0) + "Hz"); | |||
rate = jmax (rate, supportedRate); | |||
} | |||
trySampleRate (getCurrentSampleRate()); | |||
trySampleRate (sampleRate); | |||
updateCurrentBufferSize(); | |||
AudioUnitAddPropertyListener (audioUnit, | |||
kAudioUnitProperty_StreamFormat, | |||
handleStreamFormatChangeCallback, | |||
dispatchAudioUnitPropertyChange, | |||
this); | |||
for (auto r : rates) | |||
{ | |||
ignoreUnused (r); | |||
JUCE_IOS_AUDIO_LOG ("available rate = " + String (r, 0) + "Hz"); | |||
} | |||
return rates; | |||
} | |||
Array<int> getAvailableBufferSizes() override | |||
Array<int> getAvailableBufferSizes() | |||
{ | |||
Array<int> r; | |||
@@ -305,24 +292,26 @@ public: | |||
return r; | |||
} | |||
int getDefaultBufferSize() override | |||
void updateSampleRateAndAudioInput() | |||
{ | |||
#if TARGET_IPHONE_SIMULATOR | |||
return 512; | |||
#else | |||
return 256; | |||
#endif | |||
auto session = [AVAudioSession sharedInstance]; | |||
sampleRate = session.sampleRate; | |||
audioInputIsAvailable = session.isInputAvailable; | |||
actualBufferSize = roundToInt (sampleRate * session.IOBufferDuration); | |||
JUCE_IOS_AUDIO_LOG ("AVAudioSession: sampleRate: " << sampleRate | |||
<< " Hz, audioInputAvailable: " << (int) audioInputIsAvailable | |||
<< ", buffer size: " << actualBufferSize); | |||
} | |||
String open (const BigInteger& inputChannelsWanted, | |||
const BigInteger& outputChannelsWanted, | |||
double targetSampleRate, int bufferSize) override | |||
double targetSampleRate, int bufferSize) | |||
{ | |||
close(); | |||
lastError.clear(); | |||
preferredBufferSize = bufferSize <= 0 ? getDefaultBufferSize() | |||
: bufferSize; | |||
preferredBufferSize = bufferSize <= 0 ? defaultBufferSize : bufferSize; | |||
// xxx set up channel mapping | |||
@@ -372,7 +361,7 @@ public: | |||
return lastError; | |||
} | |||
void close() override | |||
void close() | |||
{ | |||
if (isRunning) | |||
{ | |||
@@ -389,31 +378,19 @@ public: | |||
} | |||
} | |||
bool isOpen() override { return isRunning; } | |||
int getCurrentBufferSizeSamples() override { return actualBufferSize; } | |||
double getCurrentSampleRate() override { return sampleRate; } | |||
int getCurrentBitDepth() override { return 16; } | |||
BigInteger getActiveOutputChannels() const override { return activeOutputChans; } | |||
BigInteger getActiveInputChannels() const override { return activeInputChans; } | |||
int getOutputLatencyInSamples() override { return roundToInt (getCurrentSampleRate() * [AVAudioSession sharedInstance].outputLatency); } | |||
int getInputLatencyInSamples() override { return roundToInt (getCurrentSampleRate() * [AVAudioSession sharedInstance].inputLatency); } | |||
void start (AudioIODeviceCallback* newCallback) override | |||
void start (AudioIODeviceCallback* newCallback) | |||
{ | |||
if (isRunning && callback != newCallback) | |||
{ | |||
if (newCallback != nullptr) | |||
newCallback->audioDeviceAboutToStart (this); | |||
newCallback->audioDeviceAboutToStart (&owner); | |||
const ScopedLock sl (callbackLock); | |||
callback = newCallback; | |||
} | |||
} | |||
void stop() override | |||
void stop() | |||
{ | |||
if (isRunning) | |||
{ | |||
@@ -430,10 +407,7 @@ public: | |||
} | |||
} | |||
bool isPlaying() override { return isRunning && callback != nullptr; } | |||
String getLastError() override { return lastError; } | |||
bool setAudioPreprocessingEnabled (bool enable) override | |||
bool setAudioPreprocessingEnabled (bool enable) | |||
{ | |||
auto session = [AVAudioSession sharedInstance]; | |||
@@ -446,6 +420,166 @@ public: | |||
return session.mode == mode; | |||
} | |||
//============================================================================== | |||
bool canControlTransport() override { return interAppAudioConnected; } | |||
void transportPlay (bool shouldSartPlaying) override | |||
{ | |||
if (! canControlTransport()) | |||
return; | |||
HostCallbackInfo callbackInfo; | |||
fillHostCallbackInfo (callbackInfo); | |||
Boolean hostIsPlaying = NO; | |||
OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, | |||
&hostIsPlaying, | |||
nullptr, | |||
nullptr, | |||
nullptr, | |||
nullptr, | |||
nullptr, | |||
nullptr); | |||
ignoreUnused (err); | |||
jassert (err == noErr); | |||
if (hostIsPlaying != shouldSartPlaying) | |||
handleAudioTransportEvent (kAudioUnitRemoteControlEvent_TogglePlayPause); | |||
} | |||
void transportRecord (bool shouldStartRecording) override | |||
{ | |||
if (! canControlTransport()) | |||
return; | |||
HostCallbackInfo callbackInfo; | |||
fillHostCallbackInfo (callbackInfo); | |||
Boolean hostIsRecording = NO; | |||
OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, | |||
nullptr, | |||
&hostIsRecording, | |||
nullptr, | |||
nullptr, | |||
nullptr, | |||
nullptr, | |||
nullptr); | |||
ignoreUnused (err); | |||
jassert (err == noErr); | |||
if (hostIsRecording != shouldStartRecording) | |||
handleAudioTransportEvent (kAudioUnitRemoteControlEvent_ToggleRecord); | |||
} | |||
void transportRewind() override | |||
{ | |||
if (canControlTransport()) | |||
handleAudioTransportEvent (kAudioUnitRemoteControlEvent_Rewind); | |||
} | |||
bool getCurrentPosition (CurrentPositionInfo& result) override | |||
{ | |||
if (! canControlTransport()) | |||
return false; | |||
zerostruct (result); | |||
HostCallbackInfo callbackInfo; | |||
fillHostCallbackInfo (callbackInfo); | |||
if (callbackInfo.hostUserData == nullptr) | |||
return false; | |||
Boolean hostIsPlaying = NO; | |||
Boolean hostIsRecording = NO; | |||
Float64 hostCurrentSampleInTimeLine = 0; | |||
Boolean hostIsCycling = NO; | |||
Float64 hostCycleStartBeat = 0; | |||
Float64 hostCycleEndBeat = 0; | |||
OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, | |||
&hostIsPlaying, | |||
&hostIsRecording, | |||
nullptr, | |||
&hostCurrentSampleInTimeLine, | |||
&hostIsCycling, | |||
&hostCycleStartBeat, | |||
&hostCycleEndBeat); | |||
if (err == kAUGraphErr_CannotDoInCurrentContext) | |||
return false; | |||
jassert (err == noErr); | |||
result.timeInSamples = (int64) hostCurrentSampleInTimeLine; | |||
result.isPlaying = hostIsPlaying; | |||
result.isRecording = hostIsRecording; | |||
result.isLooping = hostIsCycling; | |||
result.ppqLoopStart = hostCycleStartBeat; | |||
result.ppqLoopEnd = hostCycleEndBeat; | |||
result.timeInSeconds = result.timeInSamples / sampleRate; | |||
Float64 hostBeat = 0; | |||
Float64 hostTempo = 0; | |||
err = callbackInfo.beatAndTempoProc (callbackInfo.hostUserData, | |||
&hostBeat, | |||
&hostTempo); | |||
jassert (err == noErr); | |||
result.ppqPosition = hostBeat; | |||
result.bpm = hostTempo; | |||
Float32 hostTimeSigNumerator = 0; | |||
UInt32 hostTimeSigDenominator = 0; | |||
Float64 hostCurrentMeasureDownBeat = 0; | |||
err = callbackInfo.musicalTimeLocationProc (callbackInfo.hostUserData, | |||
nullptr, | |||
&hostTimeSigNumerator, | |||
&hostTimeSigDenominator, | |||
&hostCurrentMeasureDownBeat); | |||
jassert (err == noErr); | |||
result.ppqPositionOfLastBarStart = hostCurrentMeasureDownBeat; | |||
result.timeSigNumerator = (int) hostTimeSigNumerator; | |||
result.timeSigDenominator = (int) hostTimeSigDenominator; | |||
result.frameRate = AudioPlayHead::fpsUnknown; | |||
return true; | |||
} | |||
//============================================================================== | |||
#if JUCE_MODULE_AVAILABLE_juce_graphics | |||
Image getIcon (int size) | |||
{ | |||
if (interAppAudioConnected) | |||
{ | |||
UIImage* hostUIImage = AudioOutputUnitGetHostIcon (audioUnit, size); | |||
if (hostUIImage != nullptr) | |||
return juce_createImageFromUIImage (hostUIImage); | |||
} | |||
return Image(); | |||
} | |||
#endif | |||
void switchApplication() | |||
{ | |||
if (! interAppAudioConnected) | |||
return; | |||
CFURLRef hostUrl; | |||
UInt32 dataSize = sizeof (hostUrl); | |||
OSStatus err = AudioUnitGetProperty(audioUnit, | |||
kAudioUnitProperty_PeerURL, | |||
kAudioUnitScope_Global, | |||
0, | |||
&hostUrl, | |||
&dataSize); | |||
if (err == noErr) | |||
[[UIApplication sharedApplication] openURL:(NSURL*)hostUrl]; | |||
} | |||
//============================================================================== | |||
void invokeAudioDeviceErrorCallback (const String& reason) | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
@@ -481,50 +615,74 @@ public: | |||
fixAudioRouteIfSetToReceiver(); | |||
if (isRunning) | |||
{ | |||
invokeAudioDeviceErrorCallback (reason); | |||
updateSampleRateAndAudioInput(); | |||
updateCurrentBufferSize(); | |||
createAudioUnit(); | |||
setAudioSessionActive (true); | |||
restart(); | |||
} | |||
if (audioUnit != 0) | |||
void handleAudioUnitPropertyChange (AudioUnit, | |||
AudioUnitPropertyID propertyID, | |||
AudioUnitScope scope, | |||
AudioUnitElement element) | |||
{ | |||
JUCE_IOS_AUDIO_LOG ("handleAudioUnitPropertyChange: propertyID: " << String (propertyID) | |||
<< " scope: " << String (scope) | |||
<< " element: " << String (element)); | |||
switch (propertyID) | |||
{ | |||
case kAudioUnitProperty_IsInterAppConnected: | |||
handleInterAppAudioConnectionChange(); | |||
return; | |||
case kAudioUnitProperty_StreamFormat: | |||
if (scope == kAudioUnitScope_Output && element == 0) | |||
handleStreamFormatChange(); | |||
return; | |||
default: | |||
jassertfalse; | |||
return; | |||
} | |||
} | |||
void handleInterAppAudioConnectionChange() | |||
{ | |||
UInt32 connected; | |||
UInt32 dataSize = sizeof (connected); | |||
OSStatus err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_IsInterAppConnected, | |||
kAudioUnitScope_Global, 0, &connected, &dataSize); | |||
ignoreUnused (err); | |||
jassert (err == noErr); | |||
JUCE_IOS_AUDIO_LOG ("handleInterAppAudioConnectionChange: " << (connected ? "connected" | |||
: "disconnected")); | |||
if (connected != interAppAudioConnected) | |||
{ | |||
const ScopedLock myScopedLock (callbackLock); | |||
interAppAudioConnected = connected; | |||
UIApplicationState appstate = [UIApplication sharedApplication].applicationState; | |||
bool inForeground = (appstate != UIApplicationStateBackground); | |||
if (interAppAudioConnected || inForeground) | |||
{ | |||
UInt32 formatSize = sizeof (format); | |||
AudioUnitGetProperty (audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &format, &formatSize); | |||
setAudioSessionActive (true); | |||
AudioOutputUnitStart (audioUnit); | |||
} | |||
if (callback != nullptr) | |||
if (callback != nullptr) | |||
callback->audioDeviceAboutToStart (&owner); | |||
} | |||
else if (! inForeground) | |||
{ | |||
callback->audioDeviceStopped(); | |||
callback->audioDeviceAboutToStart (this); | |||
AudioOutputUnitStop (audioUnit); | |||
setAudioSessionActive (false); | |||
} | |||
} | |||
} | |||
private: | |||
//============================================================================== | |||
SharedResourcePointer<AudioSessionHolder> sessionHolder; | |||
CriticalSection callbackLock; | |||
NSTimeInterval sampleRate = 0; | |||
int numInputChannels = 2, numOutputChannels = 2; | |||
int preferredBufferSize = 0, actualBufferSize = 0; | |||
bool isRunning = false; | |||
String lastError; | |||
AudioStreamBasicDescription format; | |||
AudioUnit audioUnit {}; | |||
bool audioInputIsAvailable = false; | |||
AudioIODeviceCallback* callback = nullptr; | |||
BigInteger activeOutputChans, activeInputChans; | |||
AudioSampleBuffer floatData; | |||
float* inputChannels[3]; | |||
float* outputChannels[3]; | |||
bool monoInputChannelNumber, monoOutputChannelNumber; | |||
void prepareFloatBuffers (int bufferSize) | |||
{ | |||
if (numInputChannels + numOutputChannels > 0) | |||
@@ -623,18 +781,6 @@ private: | |||
return err; | |||
} | |||
void updateSampleRateAndAudioInput() | |||
{ | |||
auto session = [AVAudioSession sharedInstance]; | |||
sampleRate = session.sampleRate; | |||
audioInputIsAvailable = session.isInputAvailable; | |||
actualBufferSize = roundToInt (sampleRate * session.IOBufferDuration); | |||
JUCE_IOS_AUDIO_LOG ("AVAudioSession: sampleRate: " << sampleRate | |||
<< " Hz, audioInputAvailable: " << (int) audioInputIsAvailable | |||
<< ", buffer size: " << actualBufferSize); | |||
} | |||
void updateCurrentBufferSize() | |||
{ | |||
NSTimeInterval bufferDuration = sampleRate > 0 ? (NSTimeInterval) ((preferredBufferSize + 1) / sampleRate) : 0.0; | |||
@@ -649,7 +795,7 @@ private: | |||
UInt32 /*busNumber*/, UInt32 numFrames, AudioBufferList* data) | |||
{ | |||
return static_cast<iOSAudioIODevice*> (client)->process (flags, time, numFrames, data); | |||
return static_cast<Pimpl*> (client)->process (flags, time, numFrames, data); | |||
} | |||
//============================================================================== | |||
@@ -687,6 +833,31 @@ private: | |||
if (audioUnit == 0) | |||
return false; | |||
#if JucePlugin_Enable_IAA | |||
AudioComponentDescription appDesc; | |||
appDesc.componentType = JucePlugin_IAAType; | |||
appDesc.componentSubType = JucePlugin_IAASubType; | |||
appDesc.componentManufacturer = JucePlugin_ManufacturerCode; | |||
appDesc.componentFlags = 0; | |||
appDesc.componentFlagsMask = 0; | |||
OSStatus err = AudioOutputUnitPublish (&appDesc, | |||
CFSTR(JucePlugin_IAAName), | |||
JucePlugin_VersionCode, | |||
audioUnit); | |||
// This assert will be hit if the Inter-App Audio entitlement has not | |||
// been enabled, or the description being published with | |||
// AudioOutputUnitPublish is different from any in the AudioComponents | |||
// array in this application's .plist file. | |||
jassert (err == noErr); | |||
err = AudioUnitAddPropertyListener (audioUnit, | |||
kAudioUnitProperty_IsInterAppConnected, | |||
dispatchAudioUnitPropertyChange, | |||
this); | |||
jassert (err == noErr); | |||
#endif | |||
if (numInputChannels > 0) | |||
{ | |||
const UInt32 one = 1; | |||
@@ -726,11 +897,33 @@ private: | |||
prepareFloatBuffers (static_cast<int> (framesPerSlice)); | |||
} | |||
AudioUnitAddPropertyListener (audioUnit, kAudioUnitProperty_StreamFormat, handleStreamFormatChangeCallback, this); | |||
AudioUnitAddPropertyListener (audioUnit, kAudioUnitProperty_StreamFormat, dispatchAudioUnitPropertyChange, this); | |||
return true; | |||
} | |||
void fillHostCallbackInfo (HostCallbackInfo& callbackInfo) | |||
{ | |||
zerostruct (callbackInfo); | |||
UInt32 dataSize = sizeof (HostCallbackInfo); | |||
OSStatus err = AudioUnitGetProperty (audioUnit, | |||
kAudioUnitProperty_HostCallbacks, | |||
kAudioUnitScope_Global, | |||
0, | |||
&callbackInfo, | |||
&dataSize); | |||
ignoreUnused (err); | |||
jassert (err == noErr); | |||
} | |||
void handleAudioTransportEvent (AudioUnitRemoteControlEvent event) | |||
{ | |||
OSStatus err = AudioUnitSetProperty (audioUnit, kAudioOutputUnitProperty_RemoteControlToHost, | |||
kAudioUnitScope_Global, 0, &event, sizeof (event)); | |||
ignoreUnused (err); | |||
jassert (err == noErr); | |||
} | |||
// If the routing is set to go through the receiver (i.e. the speaker, but quiet), this re-routes it | |||
// to make it loud. Needed because by default when using an input + output, the output is kept quiet. | |||
static void fixAudioRouteIfSetToReceiver() | |||
@@ -757,6 +950,36 @@ private: | |||
} | |||
} | |||
void restart() | |||
{ | |||
if (isRunning) | |||
{ | |||
updateSampleRateAndAudioInput(); | |||
updateCurrentBufferSize(); | |||
createAudioUnit(); | |||
setAudioSessionActive (true); | |||
if (audioUnit != 0) | |||
{ | |||
UInt32 formatSize = sizeof (format); | |||
AudioUnitGetProperty (audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &format, &formatSize); | |||
AudioOutputUnitStart (audioUnit); | |||
} | |||
if (callback != nullptr) | |||
{ | |||
callback->audioDeviceStopped(); | |||
callback->audioDeviceAboutToStart (&owner); | |||
} | |||
} | |||
} | |||
void handleAsyncUpdate() override | |||
{ | |||
restart(); | |||
} | |||
void handleStreamFormatChange() | |||
{ | |||
AudioStreamBasicDescription desc; | |||
@@ -768,36 +991,127 @@ private: | |||
0, | |||
&desc, | |||
&dataSize); | |||
if (desc.mSampleRate != getCurrentSampleRate()) | |||
if (desc.mSampleRate != sampleRate) | |||
{ | |||
updateSampleRateAndAudioInput(); | |||
const ScopedLock sl (callbackLock); | |||
if (callback != nullptr) | |||
{ | |||
callback->audioDeviceStopped(); | |||
callback->audioDeviceAboutToStart (this); | |||
} | |||
JUCE_IOS_AUDIO_LOG ("handleStreamFormatChange: sample rate " << desc.mSampleRate); | |||
triggerAsyncUpdate(); | |||
} | |||
} | |||
static void handleStreamFormatChangeCallback (void* device, | |||
AudioUnit, | |||
AudioUnitPropertyID, | |||
AudioUnitScope scope, | |||
AudioUnitElement element) | |||
static void dispatchAudioUnitPropertyChange (void* data, AudioUnit unit, AudioUnitPropertyID propertyID, | |||
AudioUnitScope scope, AudioUnitElement element) | |||
{ | |||
static_cast<Pimpl*> (data)->handleAudioUnitPropertyChange (unit, propertyID, scope, element); | |||
} | |||
void handleMidiMessage (MidiMessage msg) | |||
{ | |||
if (messageCollector != nullptr) | |||
messageCollector->addMessageToQueue (msg); | |||
} | |||
static void midiEventCallback (void *client, UInt32 status, UInt32 data1, UInt32 data2, UInt32) | |||
{ | |||
if (scope == kAudioUnitScope_Output && element == 0) | |||
static_cast<iOSAudioIODevice*> (device)->handleStreamFormatChange(); | |||
return static_cast<Pimpl*> (client)->handleMidiMessage (MidiMessage ((int) status, | |||
(int) data1, | |||
(int) data2, | |||
Time::getMillisecondCounter() / 1000.0)); | |||
} | |||
JUCE_DECLARE_NON_COPYABLE (iOSAudioIODevice) | |||
bool isRunning = false; | |||
AudioIODeviceCallback* callback = nullptr; | |||
String lastError; | |||
bool audioInputIsAvailable = false; | |||
const int defaultBufferSize = | |||
#if TARGET_IPHONE_SIMULATOR | |||
512; | |||
#else | |||
256; | |||
#endif | |||
double sampleRate = 0; | |||
int numInputChannels = 2, numOutputChannels = 2; | |||
int preferredBufferSize = 0, actualBufferSize = 0; | |||
bool interAppAudioConnected = false; | |||
BigInteger activeOutputChans, activeInputChans; | |||
MidiMessageCollector* messageCollector = nullptr; | |||
iOSAudioIODevice& owner; | |||
SharedResourcePointer<AudioSessionHolder> sessionHolder; | |||
CriticalSection callbackLock; | |||
AudioStreamBasicDescription format; | |||
AudioUnit audioUnit {}; | |||
AudioSampleBuffer floatData; | |||
float* inputChannels[3]; | |||
float* outputChannels[3]; | |||
bool monoInputChannelNumber, monoOutputChannelNumber; | |||
JUCE_DECLARE_NON_COPYABLE (Pimpl) | |||
}; | |||
//============================================================================== | |||
class iOSAudioIODeviceType : public AudioIODeviceType | |||
iOSAudioIODevice::iOSAudioIODevice (const String& deviceName) | |||
: AudioIODevice (deviceName, iOSAudioDeviceName), | |||
pimpl (new Pimpl (*this)) | |||
{} | |||
//============================================================================== | |||
String iOSAudioIODevice::open (const BigInteger& inChans, const BigInteger& outChans, | |||
double requestedSampleRate, int requestedBufferSize) | |||
{ | |||
return pimpl->open (inChans, outChans, requestedSampleRate, requestedBufferSize); | |||
} | |||
void iOSAudioIODevice::close() { pimpl->close(); } | |||
void iOSAudioIODevice::start (AudioIODeviceCallback* callbackToUse) { pimpl->start (callbackToUse); } | |||
void iOSAudioIODevice::stop() { pimpl->stop(); } | |||
Array<double> iOSAudioIODevice::getAvailableSampleRates() { return pimpl->getAvailableSampleRates(); } | |||
Array<int> iOSAudioIODevice::getAvailableBufferSizes() { return pimpl->getAvailableBufferSizes(); } | |||
bool iOSAudioIODevice::setAudioPreprocessingEnabled (bool enabled) { return pimpl->setAudioPreprocessingEnabled (enabled); } | |||
bool iOSAudioIODevice::isPlaying() { return pimpl->isRunning && pimpl->callback != nullptr; } | |||
bool iOSAudioIODevice::isOpen() { return pimpl->isRunning; } | |||
String iOSAudioIODevice::getLastError() { return pimpl->lastError; } | |||
StringArray iOSAudioIODevice::getOutputChannelNames() { return { "Left", "Right" }; } | |||
StringArray iOSAudioIODevice::getInputChannelNames() { return pimpl->audioInputIsAvailable ? getOutputChannelNames() : StringArray(); } | |||
int iOSAudioIODevice::getDefaultBufferSize() { return pimpl->defaultBufferSize; } | |||
int iOSAudioIODevice::getCurrentBufferSizeSamples() { return pimpl->actualBufferSize; } | |||
double iOSAudioIODevice::getCurrentSampleRate() { return pimpl->sampleRate; } | |||
int iOSAudioIODevice::getCurrentBitDepth() { return 16; } | |||
BigInteger iOSAudioIODevice::getActiveOutputChannels() const { return pimpl->activeOutputChans; } | |||
BigInteger iOSAudioIODevice::getActiveInputChannels() const { return pimpl->activeInputChans; } | |||
int iOSAudioIODevice::getOutputLatencyInSamples() { return roundToInt (pimpl->sampleRate * [AVAudioSession sharedInstance].outputLatency); } | |||
int iOSAudioIODevice::getInputLatencyInSamples() { return roundToInt (pimpl->sampleRate * [AVAudioSession sharedInstance].inputLatency); } | |||
void iOSAudioIODevice::setMidiMessageCollector (MidiMessageCollector* collector) { pimpl->messageCollector = collector; } | |||
AudioPlayHead* iOSAudioIODevice::getAudioPlayHead() const { return pimpl; } | |||
bool iOSAudioIODevice::isInterAppAudioConnected() const { return pimpl->interAppAudioConnected; } | |||
#if JUCE_MODULE_AVAILABLE_juce_graphics | |||
Image iOSAudioIODevice::getIcon (int size) { return pimpl->getIcon (size); } | |||
#endif | |||
void iOSAudioIODevice::switchApplication() { return pimpl->switchApplication(); } | |||
//============================================================================== | |||
struct iOSAudioIODeviceType : public AudioIODeviceType | |||
{ | |||
public: | |||
iOSAudioIODeviceType() : AudioIODeviceType (iOSAudioDeviceName) {} | |||
void scanForDevices() {} | |||
@@ -814,7 +1128,6 @@ public: | |||
return nullptr; | |||
} | |||
private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (iOSAudioIODeviceType) | |||
}; | |||
@@ -828,32 +1141,24 @@ AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_iOSAudio() | |||
AudioSessionHolder::AudioSessionHolder() { nativeSession = [[iOSAudioSessionNative alloc] init: this]; } | |||
AudioSessionHolder::~AudioSessionHolder() { [nativeSession release]; } | |||
void AudioSessionHolder::handleStatusChange (bool enabled, const char* reason) const | |||
void AudioSessionHolder::handleAsyncUpdate() | |||
{ | |||
const ScopedLock sl (routeChangeLock); | |||
for (auto device: activeDevices) | |||
device->handleStatusChange (enabled, reason); | |||
device->pimpl->handleRouteChange (lastRouteChangeReason.toRawUTF8()); | |||
} | |||
void AudioSessionHolder::handleRouteChange (const char* reason) const | |||
void AudioSessionHolder::handleStatusChange (bool enabled, const char* reason) const | |||
{ | |||
struct RouteChangeMessage : public CallbackMessage | |||
{ | |||
RouteChangeMessage (Array<iOSAudioIODevice*> devs, const char* r) | |||
: devices (devs), changeReason (r) | |||
{ | |||
} | |||
void messageCallback() override | |||
{ | |||
for (auto device: devices) | |||
device->handleRouteChange (changeReason); | |||
} | |||
Array<iOSAudioIODevice*> devices; | |||
const char* changeReason; | |||
}; | |||
for (auto device: activeDevices) | |||
device->pimpl->handleStatusChange (enabled, reason); | |||
} | |||
(new RouteChangeMessage (activeDevices, reason))->post(); | |||
void AudioSessionHolder::handleRouteChange (const char* reason) | |||
{ | |||
const ScopedLock sl (routeChangeLock); | |||
lastRouteChangeReason = reason; | |||
triggerAsyncUpdate(); | |||
} | |||
#undef JUCE_NSERROR_CHECK |
@@ -0,0 +1,88 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#pragma once | |||
struct iOSAudioIODeviceType; | |||
class iOSAudioIODevice : public AudioIODevice | |||
{ | |||
public: | |||
//============================================================================== | |||
String open (const BigInteger&, const BigInteger&, double, int) override; | |||
void close() override; | |||
void start (AudioIODeviceCallback*) override; | |||
void stop() override; | |||
Array<double> getAvailableSampleRates() override; | |||
Array<int> getAvailableBufferSizes() override; | |||
bool setAudioPreprocessingEnabled (bool) override; | |||
//============================================================================== | |||
bool isPlaying() override; | |||
bool isOpen() override; | |||
String getLastError() override; | |||
//============================================================================== | |||
StringArray getOutputChannelNames() override; | |||
StringArray getInputChannelNames() override; | |||
int getDefaultBufferSize() override; | |||
int getCurrentBufferSizeSamples() override; | |||
double getCurrentSampleRate() override; | |||
int getCurrentBitDepth() override; | |||
BigInteger getActiveOutputChannels() const override; | |||
BigInteger getActiveInputChannels() const override; | |||
int getOutputLatencyInSamples() override; | |||
int getInputLatencyInSamples() override; | |||
//============================================================================== | |||
void setMidiMessageCollector (MidiMessageCollector*); | |||
AudioPlayHead* getAudioPlayHead() const; | |||
//============================================================================== | |||
bool isInterAppAudioConnected() const; | |||
#if JUCE_MODULE_AVAILABLE_juce_graphics | |||
Image getIcon (int size); | |||
#endif | |||
void switchApplication(); | |||
private: | |||
//============================================================================== | |||
iOSAudioIODevice (const String&); | |||
//============================================================================== | |||
friend struct iOSAudioIODeviceType; | |||
friend struct AudioSessionHolder; | |||
struct Pimpl; | |||
friend struct Pimpl; | |||
ScopedPointer<Pimpl> pimpl; | |||
JUCE_DECLARE_NON_COPYABLE (iOSAudioIODevice) | |||
}; |
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -31,118 +23,276 @@ | |||
#if JUCE_ALSA | |||
// You can define these strings in your app if you want to override the default names: | |||
#ifndef JUCE_ALSA_MIDI_INPUT_NAME | |||
#define JUCE_ALSA_MIDI_INPUT_NAME "Juce Midi Input" | |||
#endif | |||
#ifndef JUCE_ALSA_MIDI_OUTPUT_NAME | |||
#define JUCE_ALSA_MIDI_OUTPUT_NAME "Juce Midi Output" | |||
#ifndef JUCE_ALSA_MIDI_NAME | |||
#define JUCE_ALSA_MIDI_NAME JUCEApplicationBase::getInstance()->getApplicationName().toUTF8() | |||
#endif | |||
//============================================================================== | |||
namespace | |||
{ | |||
class AlsaPortAndCallback; | |||
//============================================================================== | |||
class AlsaClient : public ReferenceCountedObject | |||
{ | |||
public: | |||
typedef ReferenceCountedObjectPtr<AlsaClient> Ptr; | |||
static Ptr getInstance (bool forInput) | |||
//============================================================================== | |||
// represents an input or output port of the supplied AlsaClient | |||
class Port | |||
{ | |||
AlsaClient*& instance = (forInput ? inInstance : outInstance); | |||
if (instance == nullptr) | |||
instance = new AlsaClient (forInput); | |||
public: | |||
Port (AlsaClient& c, bool forInput) noexcept | |||
: portId (-1), | |||
callbackEnabled (false), | |||
client (c), | |||
isInput (forInput), | |||
callback (nullptr), | |||
maxEventSize (4 * 1024), | |||
midiInput (nullptr) | |||
{} | |||
~Port() | |||
{ | |||
if (isValid()) | |||
{ | |||
if (isInput) | |||
enableCallback (false); | |||
else | |||
snd_midi_event_free (midiParser); | |||
return instance; | |||
} | |||
snd_seq_delete_simple_port (client.get(), portId); | |||
} | |||
} | |||
bool isInput() const noexcept { return input; } | |||
void connectWith (int sourceClient, int sourcePort) const noexcept | |||
{ | |||
if (isInput) | |||
snd_seq_connect_from (client.get(), portId, sourceClient, sourcePort); | |||
else | |||
snd_seq_connect_to (client.get(), portId, sourceClient, sourcePort); | |||
} | |||
void registerCallback (AlsaPortAndCallback* cb) | |||
{ | |||
if (cb != nullptr) | |||
bool isValid() const noexcept | |||
{ | |||
return client.get() != nullptr && portId >= 0; | |||
} | |||
void setupInput(MidiInput* input, MidiInputCallback* cb) | |||
{ | |||
jassert (cb && input); | |||
callback = cb; | |||
midiInput = input; | |||
} | |||
void setupOutput() | |||
{ | |||
jassert (! isInput); | |||
snd_midi_event_new ((size_t) maxEventSize, &midiParser); | |||
} | |||
void enableCallback (bool enable) | |||
{ | |||
if (callbackEnabled != enable) | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
activeCallbacks.add (cb); | |||
callbackEnabled = enable; | |||
if (inputThread == nullptr) | |||
inputThread = new MidiInputThread (*this); | |||
if (enable) | |||
client.registerCallback(); | |||
else | |||
client.unregisterCallback(); | |||
} | |||
} | |||
inputThread->startThread(); | |||
bool sendMessageNow (const MidiMessage& message) | |||
{ | |||
if (message.getRawDataSize() > maxEventSize) | |||
{ | |||
maxEventSize = message.getRawDataSize(); | |||
snd_midi_event_free (midiParser); | |||
snd_midi_event_new ((size_t) maxEventSize, &midiParser); | |||
} | |||
snd_seq_event_t event; | |||
snd_seq_ev_clear (&event); | |||
long numBytes = (long) message.getRawDataSize(); | |||
const uint8* data = message.getRawData(); | |||
snd_seq_t* seqHandle = client.get(); | |||
bool success = true; | |||
while (numBytes > 0) | |||
{ | |||
const long numSent = snd_midi_event_encode (midiParser, data, numBytes, &event); | |||
if (numSent <= 0) | |||
{ | |||
success = numSent == 0; | |||
break; | |||
} | |||
numBytes -= numSent; | |||
data += numSent; | |||
snd_seq_ev_set_source (&event, portId); | |||
snd_seq_ev_set_subs (&event); | |||
snd_seq_ev_set_direct (&event); | |||
if (snd_seq_event_output_direct (seqHandle, &event) < 0) | |||
{ | |||
success = false; | |||
break; | |||
} | |||
} | |||
snd_midi_event_reset_encode (midiParser); | |||
return success; | |||
} | |||
bool operator== (const Port& lhs) const noexcept | |||
{ | |||
return portId != -1 && portId == lhs.portId; | |||
} | |||
int portId; | |||
bool callbackEnabled; | |||
private: | |||
friend class AlsaClient; | |||
AlsaClient& client; | |||
bool isInput; | |||
MidiInputCallback* callback; | |||
snd_midi_event_t* midiParser; | |||
int maxEventSize; | |||
MidiInput* midiInput; | |||
void createPort (const String& name, bool enableSubscription) | |||
{ | |||
if (snd_seq_t* seqHandle = client.get()) | |||
{ | |||
const unsigned int caps = | |||
isInput | |||
? (SND_SEQ_PORT_CAP_WRITE | (enableSubscription ? SND_SEQ_PORT_CAP_SUBS_WRITE : 0)) | |||
: (SND_SEQ_PORT_CAP_WRITE | (enableSubscription ? SND_SEQ_PORT_CAP_SUBS_READ : 0)); | |||
portId = snd_seq_create_simple_port (seqHandle, name.toUTF8(), caps, | |||
SND_SEQ_PORT_TYPE_MIDI_GENERIC | | |||
SND_SEQ_PORT_TYPE_APPLICATION); | |||
} | |||
} | |||
void handleIncomingMidiMessage (const MidiMessage& message) const | |||
{ | |||
callback->handleIncomingMidiMessage (midiInput, message); | |||
} | |||
void handlePartialSysexMessage (const uint8* messageData, int numBytesSoFar, double timeStamp) | |||
{ | |||
callback->handlePartialSysexMessage (midiInput, messageData, numBytesSoFar, timeStamp); | |||
} | |||
}; | |||
static Ptr getInstance() | |||
{ | |||
if (instance == nullptr) | |||
instance = new AlsaClient(); | |||
return instance; | |||
} | |||
void unregisterCallback (AlsaPortAndCallback* cb) | |||
void registerCallback() | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
if (inputThread == nullptr) | |||
inputThread = new MidiInputThread (*this); | |||
jassert (activeCallbacks.contains (cb)); | |||
activeCallbacks.removeAllInstancesOf (cb); | |||
if (++activeCallbacks - 1 == 0) | |||
inputThread->startThread(); | |||
} | |||
if (activeCallbacks.size() == 0 && inputThread->isThreadRunning()) | |||
void unregisterCallback() | |||
{ | |||
jassert (activeCallbacks.get() > 0); | |||
if (--activeCallbacks == 0 && inputThread->isThreadRunning()) | |||
inputThread->signalThreadShouldExit(); | |||
} | |||
void handleIncomingMidiMessage (snd_seq_event*, const MidiMessage&); | |||
void handlePartialSysexMessage (snd_seq_event*, const uint8*, int, double); | |||
void handleIncomingMidiMessage (snd_seq_event* event, const MidiMessage& message) | |||
{ | |||
if (event->dest.port < ports.size() | |||
&& ports[event->dest.port]->callbackEnabled) | |||
ports[event->dest.port]->handleIncomingMidiMessage (message); | |||
} | |||
void handlePartialSysexMessage (snd_seq_event* event, const uint8* messageData, int numBytesSoFar, double timeStamp) | |||
{ | |||
if (event->dest.port < ports.size() | |||
&& ports[event->dest.port]->callbackEnabled) | |||
ports[event->dest.port]->handlePartialSysexMessage (messageData, numBytesSoFar, timeStamp); | |||
} | |||
snd_seq_t* get() const noexcept { return handle; } | |||
int getId() const noexcept { return clientId; } | |||
Port* createPort (const String& name, bool forInput, bool enableSubscription) | |||
{ | |||
Port* port = new Port (*this, forInput); | |||
port->createPort (name, enableSubscription); | |||
ports.set (port->portId, port); | |||
incReferenceCount(); | |||
return port; | |||
} | |||
void deletePort (Port* port) | |||
{ | |||
ports.remove (port->portId); | |||
decReferenceCount(); | |||
} | |||
private: | |||
bool input; | |||
snd_seq_t* handle; | |||
Array<AlsaPortAndCallback*> activeCallbacks; | |||
int clientId; | |||
OwnedArray<Port> ports; | |||
Atomic<int> activeCallbacks; | |||
CriticalSection callbackLock; | |||
static AlsaClient* inInstance; | |||
static AlsaClient* outInstance; | |||
static AlsaClient* instance; | |||
//============================================================================== | |||
friend class ReferenceCountedObjectPtr<AlsaClient>; | |||
friend struct ContainerDeletePolicy<AlsaClient>; | |||
AlsaClient (bool forInput) | |||
: input (forInput), handle (nullptr) | |||
AlsaClient() | |||
: handle (nullptr), | |||
inputThread (nullptr) | |||
{ | |||
AlsaClient*& instance = (input ? inInstance : outInstance); | |||
jassert (instance == nullptr); | |||
instance = this; | |||
snd_seq_open (&handle, "default", SND_SEQ_OPEN_DUPLEX, 0); | |||
snd_seq_nonblock (handle, SND_SEQ_NONBLOCK); | |||
snd_seq_set_client_name (handle, JUCE_ALSA_MIDI_NAME); | |||
clientId = snd_seq_client_id(handle); | |||
snd_seq_open (&handle, "default", forInput ? SND_SEQ_OPEN_INPUT | |||
: SND_SEQ_OPEN_OUTPUT, 0); | |||
snd_seq_set_client_name (handle, forInput ? JUCE_ALSA_MIDI_INPUT_NAME | |||
: JUCE_ALSA_MIDI_OUTPUT_NAME); | |||
// It's good idea to pre-allocate a good number of elements | |||
ports.ensureStorageAllocated (32); | |||
} | |||
~AlsaClient() | |||
{ | |||
AlsaClient*& instance = (input ? inInstance : outInstance); | |||
jassert (instance != nullptr); | |||
instance = nullptr; | |||
if (handle != nullptr) | |||
{ | |||
snd_seq_close (handle); | |||
handle = nullptr; | |||
} | |||
jassert (activeCallbacks.size() == 0); | |||
jassert (activeCallbacks.get() == 0); | |||
if (inputThread) | |||
{ | |||
inputThread->stopThread (3000); | |||
inputThread = nullptr; | |||
} | |||
} | |||
//============================================================================== | |||
@@ -152,7 +302,7 @@ private: | |||
MidiInputThread (AlsaClient& c) | |||
: Thread ("Juce MIDI Input"), client (c), concatenator (2048) | |||
{ | |||
jassert (client.input && client.get() != nullptr); | |||
jassert (client.get() != nullptr); | |||
} | |||
void run() override | |||
@@ -176,8 +326,6 @@ private: | |||
if (threadShouldExit()) | |||
break; | |||
snd_seq_nonblock (seqHandle, 1); | |||
do | |||
{ | |||
snd_seq_event_t* inputEvent = nullptr; | |||
@@ -203,7 +351,7 @@ private: | |||
snd_midi_event_free (midiParser); | |||
} | |||
}; | |||
} | |||
private: | |||
AlsaClient& client; | |||
@@ -213,202 +361,91 @@ private: | |||
ScopedPointer<MidiInputThread> inputThread; | |||
}; | |||
AlsaClient* AlsaClient::inInstance = nullptr; | |||
AlsaClient* AlsaClient::outInstance = nullptr; | |||
AlsaClient* AlsaClient::instance = nullptr; | |||
//============================================================================== | |||
// represents an input or output port of the supplied AlsaClient | |||
class AlsaPort | |||
static AlsaClient::Port* iterateMidiClient (const AlsaClient::Ptr& client, | |||
snd_seq_client_info_t* clientInfo, | |||
const bool forInput, | |||
StringArray& deviceNamesFound, | |||
const int deviceIndexToOpen) | |||
{ | |||
public: | |||
AlsaPort() noexcept : portId (-1) {} | |||
AlsaPort (const AlsaClient::Ptr& c, int port) noexcept : client (c), portId (port) {} | |||
void createPort (const AlsaClient::Ptr& c, const String& name, bool forInput) | |||
{ | |||
client = c; | |||
if (snd_seq_t* handle = client->get()) | |||
portId = snd_seq_create_simple_port (handle, name.toUTF8(), | |||
forInput ? (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE) | |||
: (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ), | |||
SND_SEQ_PORT_TYPE_MIDI_GENERIC); | |||
} | |||
void deletePort() | |||
{ | |||
if (isValid()) | |||
{ | |||
snd_seq_delete_simple_port (client->get(), portId); | |||
portId = -1; | |||
} | |||
} | |||
AlsaClient::Port* port = nullptr; | |||
void connectWith (int sourceClient, int sourcePort) | |||
{ | |||
if (client->isInput()) | |||
snd_seq_connect_from (client->get(), portId, sourceClient, sourcePort); | |||
else | |||
snd_seq_connect_to (client->get(), portId, sourceClient, sourcePort); | |||
} | |||
bool isValid() const noexcept | |||
{ | |||
return client != nullptr && client->get() != nullptr && portId >= 0; | |||
} | |||
AlsaClient::Ptr client; | |||
int portId; | |||
}; | |||
snd_seq_t* seqHandle = client->get(); | |||
snd_seq_port_info_t* portInfo = nullptr; | |||
//============================================================================== | |||
class AlsaPortAndCallback | |||
{ | |||
public: | |||
AlsaPortAndCallback (AlsaPort p, MidiInput* in, MidiInputCallback* cb) | |||
: port (p), midiInput (in), callback (cb), callbackEnabled (false) | |||
{ | |||
} | |||
snd_seq_port_info_alloca (&portInfo); | |||
jassert (portInfo); | |||
int numPorts = snd_seq_client_info_get_num_ports (clientInfo); | |||
const int sourceClient = snd_seq_client_info_get_client (clientInfo); | |||
~AlsaPortAndCallback() | |||
{ | |||
enableCallback (false); | |||
port.deletePort(); | |||
} | |||
snd_seq_port_info_set_client (portInfo, sourceClient); | |||
snd_seq_port_info_set_port (portInfo, -1); | |||
void enableCallback (bool enable) | |||
while (--numPorts >= 0) | |||
{ | |||
if (callbackEnabled != enable) | |||
if (snd_seq_query_next_port (seqHandle, portInfo) == 0 | |||
&& (snd_seq_port_info_get_capability (portInfo) | |||
& (forInput ? SND_SEQ_PORT_CAP_SUBS_WRITE : SND_SEQ_PORT_CAP_SUBS_READ)) != 0) | |||
{ | |||
callbackEnabled = enable; | |||
if (enable) | |||
port.client->registerCallback (this); | |||
else | |||
port.client->unregisterCallback (this); | |||
} | |||
} | |||
void handleIncomingMidiMessage (const MidiMessage& message) const | |||
{ | |||
callback->handleIncomingMidiMessage (midiInput, message); | |||
} | |||
void handlePartialSysexMessage (const uint8* messageData, int numBytesSoFar, double timeStamp) | |||
{ | |||
callback->handlePartialSysexMessage (midiInput, messageData, numBytesSoFar, timeStamp); | |||
} | |||
private: | |||
AlsaPort port; | |||
MidiInput* midiInput; | |||
MidiInputCallback* callback; | |||
bool callbackEnabled; | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AlsaPortAndCallback) | |||
}; | |||
void AlsaClient::handleIncomingMidiMessage (snd_seq_event_t* event, const MidiMessage& message) | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
if (AlsaPortAndCallback* const cb = activeCallbacks[event->dest.port]) | |||
cb->handleIncomingMidiMessage (message); | |||
} | |||
void AlsaClient::handlePartialSysexMessage (snd_seq_event* event, const uint8* messageData, int numBytesSoFar, double timeStamp) | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
if (AlsaPortAndCallback* const cb = activeCallbacks[event->dest.port]) | |||
cb->handlePartialSysexMessage (messageData, numBytesSoFar, timeStamp); | |||
} | |||
//============================================================================== | |||
static AlsaPort iterateMidiClient (const AlsaClient::Ptr& seq, | |||
snd_seq_client_info_t* clientInfo, | |||
const bool forInput, | |||
StringArray& deviceNamesFound, | |||
const int deviceIndexToOpen) | |||
{ | |||
AlsaPort port; | |||
snd_seq_t* seqHandle = seq->get(); | |||
snd_seq_port_info_t* portInfo = nullptr; | |||
const String portName = snd_seq_port_info_get_name(portInfo); | |||
if (snd_seq_port_info_malloc (&portInfo) == 0) | |||
{ | |||
int numPorts = snd_seq_client_info_get_num_ports (clientInfo); | |||
const int client = snd_seq_client_info_get_client (clientInfo); | |||
snd_seq_port_info_set_client (portInfo, client); | |||
snd_seq_port_info_set_port (portInfo, -1); | |||
deviceNamesFound.add (portName); | |||
while (--numPorts >= 0) | |||
{ | |||
if (snd_seq_query_next_port (seqHandle, portInfo) == 0 | |||
&& (snd_seq_port_info_get_capability (portInfo) & (forInput ? SND_SEQ_PORT_CAP_READ | |||
: SND_SEQ_PORT_CAP_WRITE)) != 0) | |||
if (deviceNamesFound.size() == deviceIndexToOpen + 1) | |||
{ | |||
const String clientName = snd_seq_client_info_get_name (clientInfo); | |||
const String portName = snd_seq_port_info_get_name(portInfo); | |||
if (clientName == portName) | |||
deviceNamesFound.add (clientName); | |||
else | |||
deviceNamesFound.add (clientName + ": " + portName); | |||
if (deviceNamesFound.size() == deviceIndexToOpen + 1) | |||
const int sourcePort = snd_seq_port_info_get_port (portInfo); | |||
if (sourcePort != -1) | |||
{ | |||
const int sourcePort = snd_seq_port_info_get_port (portInfo); | |||
if (sourcePort != -1) | |||
{ | |||
const int sourceClient = snd_seq_client_info_get_client (clientInfo); | |||
port.createPort (seq, portName, forInput); | |||
port.connectWith (sourceClient, sourcePort); | |||
} | |||
port = client->createPort (portName, forInput, false); | |||
jassert (port->isValid()); | |||
port->connectWith (sourceClient, sourcePort); | |||
break; | |||
} | |||
} | |||
} | |||
snd_seq_port_info_free (portInfo); | |||
} | |||
return port; | |||
} | |||
static AlsaPort iterateMidiDevices (const bool forInput, | |||
StringArray& deviceNamesFound, | |||
const int deviceIndexToOpen) | |||
static AlsaClient::Port* iterateMidiDevices (const bool forInput, | |||
StringArray& deviceNamesFound, | |||
const int deviceIndexToOpen) | |||
{ | |||
AlsaPort port; | |||
const AlsaClient::Ptr client (AlsaClient::getInstance (forInput)); | |||
AlsaClient::Port* port = nullptr; | |||
const AlsaClient::Ptr client (AlsaClient::getInstance()); | |||
if (snd_seq_t* const seqHandle = client->get()) | |||
{ | |||
snd_seq_system_info_t* systemInfo = nullptr; | |||
snd_seq_client_info_t* clientInfo = nullptr; | |||
if (snd_seq_system_info_malloc (&systemInfo) == 0) | |||
snd_seq_system_info_alloca (&systemInfo); | |||
jassert(systemInfo); | |||
if (snd_seq_system_info (seqHandle, systemInfo) == 0) | |||
{ | |||
if (snd_seq_system_info (seqHandle, systemInfo) == 0 | |||
&& snd_seq_client_info_malloc (&clientInfo) == 0) | |||
{ | |||
int numClients = snd_seq_system_info_get_cur_clients (systemInfo); | |||
snd_seq_client_info_alloca (&clientInfo); | |||
jassert(clientInfo); | |||
int numClients = snd_seq_system_info_get_cur_clients (systemInfo); | |||
while (--numClients >= 0 && ! port.isValid()) | |||
if (snd_seq_query_next_client (seqHandle, clientInfo) == 0) | |||
while (--numClients >= 0) | |||
{ | |||
if (snd_seq_query_next_client (seqHandle, clientInfo) == 0) | |||
{ | |||
const int sourceClient = snd_seq_client_info_get_client (clientInfo); | |||
if (sourceClient != client->getId() | |||
&& sourceClient != SND_SEQ_CLIENT_SYSTEM) | |||
{ | |||
port = iterateMidiClient (client, clientInfo, forInput, | |||
deviceNamesFound, deviceIndexToOpen); | |||
snd_seq_client_info_free (clientInfo); | |||
if (port) | |||
break; | |||
} | |||
} | |||
} | |||
snd_seq_system_info_free (systemInfo); | |||
} | |||
} | |||
deviceNamesFound.appendNumbersToDuplicates (true, true); | |||
@@ -416,80 +453,6 @@ static AlsaPort iterateMidiDevices (const bool forInput, | |||
return port; | |||
} | |||
//============================================================================== | |||
class MidiOutputDevice | |||
{ | |||
public: | |||
MidiOutputDevice (MidiOutput* const output, const AlsaPort& p) | |||
: midiOutput (output), port (p), | |||
maxEventSize (16 * 1024) | |||
{ | |||
jassert (port.isValid() && midiOutput != nullptr); | |||
snd_midi_event_new ((size_t) maxEventSize, &midiParser); | |||
} | |||
~MidiOutputDevice() | |||
{ | |||
snd_midi_event_free (midiParser); | |||
port.deletePort(); | |||
} | |||
bool sendMessageNow (const MidiMessage& message) | |||
{ | |||
if (message.getRawDataSize() > maxEventSize) | |||
{ | |||
maxEventSize = message.getRawDataSize(); | |||
snd_midi_event_free (midiParser); | |||
snd_midi_event_new ((size_t) maxEventSize, &midiParser); | |||
} | |||
snd_seq_event_t event; | |||
snd_seq_ev_clear (&event); | |||
long numBytes = (long) message.getRawDataSize(); | |||
const uint8* data = message.getRawData(); | |||
snd_seq_t* seqHandle = port.client->get(); | |||
bool success = true; | |||
while (numBytes > 0) | |||
{ | |||
const long numSent = snd_midi_event_encode (midiParser, data, numBytes, &event); | |||
if (numSent <= 0) | |||
{ | |||
success = numSent == 0; | |||
break; | |||
} | |||
numBytes -= numSent; | |||
data += numSent; | |||
snd_seq_ev_set_source (&event, port.portId); | |||
snd_seq_ev_set_subs (&event); | |||
snd_seq_ev_set_direct (&event); | |||
if (snd_seq_event_output_direct (seqHandle, &event) < 0) | |||
{ | |||
success = false; | |||
break; | |||
} | |||
} | |||
snd_midi_event_reset_encode (midiParser); | |||
return success; | |||
} | |||
private: | |||
MidiOutput* const midiOutput; | |||
AlsaPort port; | |||
snd_midi_event_t* midiParser; | |||
int maxEventSize; | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiOutputDevice) | |||
}; | |||
} // namespace | |||
StringArray MidiOutput::getDevices() | |||
@@ -509,13 +472,16 @@ MidiOutput* MidiOutput::openDevice (int deviceIndex) | |||
MidiOutput* newDevice = nullptr; | |||
StringArray devices; | |||
AlsaPort port (iterateMidiDevices (false, devices, deviceIndex)); | |||
AlsaClient::Port* port = iterateMidiDevices (false, devices, deviceIndex); | |||
if (port.isValid()) | |||
{ | |||
newDevice = new MidiOutput (devices [deviceIndex]); | |||
newDevice->internal = new MidiOutputDevice (newDevice, port); | |||
} | |||
if (port == nullptr) | |||
return nullptr; | |||
jassert (port->isValid()); | |||
newDevice = new MidiOutput (devices [deviceIndex]); | |||
port->setupOutput(); | |||
newDevice->internal = port; | |||
return newDevice; | |||
} | |||
@@ -523,17 +489,16 @@ MidiOutput* MidiOutput::openDevice (int deviceIndex) | |||
MidiOutput* MidiOutput::createNewDevice (const String& deviceName) | |||
{ | |||
MidiOutput* newDevice = nullptr; | |||
AlsaPort port; | |||
const AlsaClient::Ptr client (AlsaClient::getInstance (false)); | |||
const AlsaClient::Ptr client (AlsaClient::getInstance()); | |||
port.createPort (client, deviceName, false); | |||
AlsaClient::Port* port = client->createPort (deviceName, false, true); | |||
if (port.isValid()) | |||
{ | |||
newDevice = new MidiOutput (deviceName); | |||
newDevice->internal = new MidiOutputDevice (newDevice, port); | |||
} | |||
jassert (port->isValid()); | |||
newDevice = new MidiOutput (deviceName); | |||
port->setupOutput(); | |||
newDevice->internal = port; | |||
return newDevice; | |||
} | |||
@@ -542,12 +507,13 @@ MidiOutput::~MidiOutput() | |||
{ | |||
stopBackgroundThread(); | |||
delete static_cast<MidiOutputDevice*> (internal); | |||
AlsaClient::Ptr client (AlsaClient::getInstance()); | |||
client->deletePort (static_cast<AlsaClient::Port*> (internal)); | |||
} | |||
void MidiOutput::sendMessageNow (const MidiMessage& message) | |||
{ | |||
static_cast<MidiOutputDevice*> (internal)->sendMessageNow (message); | |||
static_cast<AlsaClient::Port*> (internal)->sendMessageNow (message); | |||
} | |||
//============================================================================== | |||
@@ -559,17 +525,18 @@ MidiInput::MidiInput (const String& nm) | |||
MidiInput::~MidiInput() | |||
{ | |||
stop(); | |||
delete static_cast<AlsaPortAndCallback*> (internal); | |||
AlsaClient::Ptr client (AlsaClient::getInstance()); | |||
client->deletePort (static_cast<AlsaClient::Port*> (internal)); | |||
} | |||
void MidiInput::start() | |||
{ | |||
static_cast<AlsaPortAndCallback*> (internal)->enableCallback (true); | |||
static_cast<AlsaClient::Port*> (internal)->enableCallback (true); | |||
} | |||
void MidiInput::stop() | |||
{ | |||
static_cast<AlsaPortAndCallback*> (internal)->enableCallback (false); | |||
static_cast<AlsaClient::Port*> (internal)->enableCallback (false); | |||
} | |||
int MidiInput::getDefaultDeviceIndex() | |||
@@ -589,13 +556,16 @@ MidiInput* MidiInput::openDevice (int deviceIndex, MidiInputCallback* callback) | |||
MidiInput* newDevice = nullptr; | |||
StringArray devices; | |||
AlsaPort port (iterateMidiDevices (true, devices, deviceIndex)); | |||
AlsaClient::Port* port = iterateMidiDevices (true, devices, deviceIndex); | |||
if (port.isValid()) | |||
{ | |||
newDevice = new MidiInput (devices [deviceIndex]); | |||
newDevice->internal = new AlsaPortAndCallback (port, newDevice, callback); | |||
} | |||
if (port == nullptr) | |||
return nullptr; | |||
jassert (port->isValid()); | |||
newDevice = new MidiInput (devices [deviceIndex]); | |||
port->setupInput (newDevice, callback); | |||
newDevice->internal = port; | |||
return newDevice; | |||
} | |||
@@ -603,17 +573,16 @@ MidiInput* MidiInput::openDevice (int deviceIndex, MidiInputCallback* callback) | |||
MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallback* callback) | |||
{ | |||
MidiInput* newDevice = nullptr; | |||
AlsaPort port; | |||
const AlsaClient::Ptr client (AlsaClient::getInstance (true)); | |||
AlsaClient::Ptr client (AlsaClient::getInstance()); | |||
port.createPort (client, deviceName, true); | |||
AlsaClient::Port* port = client->createPort (deviceName, true, true); | |||
if (port.isValid()) | |||
{ | |||
newDevice = new MidiInput (deviceName); | |||
newDevice->internal = new AlsaPortAndCallback (port, newDevice, callback); | |||
} | |||
jassert (port->isValid()); | |||
newDevice = new MidiInput (deviceName); | |||
port->setupInput (newDevice, callback); | |||
newDevice->internal = port; | |||
return newDevice; | |||
} | |||
@@ -624,7 +593,7 @@ MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallba | |||
// (These are just stub functions if ALSA is unavailable...) | |||
StringArray MidiOutput::getDevices() { return StringArray(); } | |||
StringArray MidiOutput::getDevices() { return {}; } | |||
int MidiOutput::getDefaultDeviceIndex() { return 0; } | |||
MidiOutput* MidiOutput::openDevice (int) { return nullptr; } | |||
MidiOutput* MidiOutput::createNewDevice (const String&) { return nullptr; } | |||
@@ -636,7 +605,7 @@ MidiInput::~MidiInput() {} | |||
void MidiInput::start() {} | |||
void MidiInput::stop() {} | |||
int MidiInput::getDefaultDeviceIndex() { return 0; } | |||
StringArray MidiInput::getDevices() { return StringArray(); } | |||
StringArray MidiInput::getDevices() { return {}; } | |||
MidiInput* MidiInput::openDevice (int, MidiInputCallback*) { return nullptr; } | |||
MidiInput* MidiInput::createNewDevice (const String&, MidiInputCallback*) { return nullptr; } | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -921,7 +913,6 @@ public: | |||
isStarted (false) | |||
{ | |||
CoreAudioInternal* device = nullptr; | |||
if (outputDeviceId == 0 || outputDeviceId == inputDeviceId) | |||
{ | |||
jassert (inputDeviceId != 0); | |||
@@ -931,9 +922,9 @@ public: | |||
{ | |||
device = new CoreAudioInternal (*this, outputDeviceId, false, true); | |||
} | |||
jassert (device != nullptr); | |||
internal = device; | |||
jassert (device != nullptr); | |||
AudioObjectPropertyAddress pa; | |||
pa.mSelector = kAudioObjectPropertySelectorWildcard; | |||
@@ -1004,14 +995,6 @@ public: | |||
internal->stop (false); | |||
} | |||
void restart() | |||
{ | |||
JUCE_COREAUDIOLOG ("Restarting"); | |||
AudioIODeviceCallback* oldCallback = internal->callback; | |||
stop(); | |||
start (oldCallback); | |||
} | |||
BigInteger getActiveOutputChannels() const override { return internal->activeOutputChans; } | |||
BigInteger getActiveInputChannels() const override { return internal->activeInputChans; } | |||
@@ -1074,6 +1057,19 @@ public: | |||
deviceType.audioDeviceListChanged(); | |||
} | |||
void restart() | |||
{ | |||
JUCE_COREAUDIOLOG ("Restarting"); | |||
AudioIODeviceCallback* oldCallback = internal->callback; | |||
stop(); | |||
start (oldCallback); | |||
} | |||
bool setCurrentSampleRate (double newSampleRate) | |||
{ | |||
return internal->setNominalSampleRate (newSampleRate); | |||
} | |||
CoreAudioIODeviceType& deviceType; | |||
int inputIndex, outputIndex; | |||
@@ -1107,10 +1103,10 @@ class AudioIODeviceCombiner : public AudioIODevice, | |||
private Thread | |||
{ | |||
public: | |||
AudioIODeviceCombiner (const String& deviceName) | |||
AudioIODeviceCombiner (const String& deviceName, CoreAudioIODeviceType& deviceType) | |||
: AudioIODevice (deviceName, "CoreAudio"), | |||
Thread (deviceName), callback (nullptr), | |||
currentSampleRate (0), currentBufferSize (0), active (false) | |||
Thread (deviceName), | |||
owner (deviceType) | |||
{ | |||
} | |||
@@ -1120,7 +1116,7 @@ public: | |||
devices.clear(); | |||
} | |||
void addDevice (AudioIODevice* device, bool useInputs, bool useOutputs) | |||
void addDevice (CoreAudioIODevice* device, bool useInputs, bool useOutputs) | |||
{ | |||
jassert (device != nullptr); | |||
jassert (! isOpen()); | |||
@@ -1280,7 +1276,7 @@ public: | |||
fifos.clear(); | |||
startThread (9); | |||
return String(); | |||
return {}; | |||
} | |||
void close() override | |||
@@ -1370,21 +1366,7 @@ public: | |||
} | |||
} | |||
void stop() override | |||
{ | |||
AudioIODeviceCallback* lastCallback = nullptr; | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
std::swap (callback, lastCallback); | |||
} | |||
for (int i = 0; i < devices.size(); ++i) | |||
devices.getUnchecked(i)->device->stop(); | |||
if (lastCallback != nullptr) | |||
lastCallback->audioDeviceStopped(); | |||
} | |||
void stop() override { shutdown ({}); } | |||
String getLastError() override | |||
{ | |||
@@ -1392,11 +1374,12 @@ public: | |||
} | |||
private: | |||
CoreAudioIODeviceType& owner; | |||
CriticalSection callbackLock; | |||
AudioIODeviceCallback* callback; | |||
double currentSampleRate; | |||
int currentBufferSize; | |||
bool active; | |||
AudioIODeviceCallback* callback = nullptr; | |||
double currentSampleRate = 0; | |||
int currentBufferSize = 0; | |||
bool active = false; | |||
String lastError; | |||
AudioSampleBuffer fifos; | |||
@@ -1459,6 +1442,27 @@ private: | |||
} | |||
} | |||
void shutdown (const String& error) | |||
{ | |||
AudioIODeviceCallback* lastCallback = nullptr; | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
std::swap (callback, lastCallback); | |||
} | |||
for (int i = 0; i < devices.size(); ++i) | |||
devices.getUnchecked(i)->device->stop(); | |||
if (lastCallback != nullptr) | |||
{ | |||
if (error.isNotEmpty()) | |||
lastCallback->audioDeviceError (error); | |||
else | |||
lastCallback->audioDeviceStopped(); | |||
} | |||
} | |||
void reset() | |||
{ | |||
for (int i = 0; i < devices.size(); ++i) | |||
@@ -1551,10 +1555,49 @@ private: | |||
} | |||
} | |||
void handleAudioDeviceAboutToStart (AudioIODevice* device) | |||
{ | |||
const ScopedLock sl (callbackLock); | |||
auto newSampleRate = device->getCurrentSampleRate(); | |||
auto commonRates = getAvailableSampleRates(); | |||
if (! commonRates.contains (newSampleRate)) | |||
{ | |||
commonRates.sort(); | |||
if (newSampleRate < commonRates.getFirst() || newSampleRate > commonRates.getLast()) | |||
newSampleRate = jlimit (commonRates.getFirst(), commonRates.getLast(), newSampleRate); | |||
else | |||
for (auto it = commonRates.begin(); it < commonRates.end() - 1; ++it) | |||
if (it[0] < newSampleRate && it[1] > newSampleRate) | |||
{ | |||
newSampleRate = newSampleRate - it[0] < it[1] - newSampleRate ? it[0] : it[1]; | |||
break; | |||
} | |||
} | |||
currentSampleRate = newSampleRate; | |||
bool anySampleRateChanges = false; | |||
for (int i = 0; i < devices.size(); ++i) | |||
if (devices.getUnchecked(i)->getCurrentSampleRate() != currentSampleRate) | |||
{ | |||
devices.getUnchecked(i)->setCurrentSampleRate (currentSampleRate); | |||
anySampleRateChanges = true; | |||
} | |||
if (anySampleRateChanges) | |||
owner.audioDeviceListChanged(); | |||
if (callback != nullptr) | |||
callback->audioDeviceAboutToStart (device); | |||
} | |||
void handleAudioDeviceStopped() { shutdown ({}); } | |||
void handleAudioDeviceError (const String& errorMessage) { shutdown (errorMessage.isNotEmpty() ? errorMessage : String ("unknown")); } | |||
//============================================================================== | |||
struct DeviceWrapper : private AudioIODeviceCallback | |||
{ | |||
DeviceWrapper (AudioIODeviceCombiner& cd, AudioIODevice* d, bool useIns, bool useOuts) | |||
DeviceWrapper (AudioIODeviceCombiner& cd, CoreAudioIODevice* d, bool useIns, bool useOuts) | |||
: owner (cd), device (d), inputIndex (0), outputIndex (0), | |||
useInputs (useIns), useOutputs (useOuts), | |||
inputFifo (32), outputFifo (32), done (false) | |||
@@ -1732,19 +1775,15 @@ private: | |||
owner.notify(); | |||
} | |||
void audioDeviceAboutToStart (AudioIODevice*) override {} | |||
void audioDeviceStopped() override {} | |||
void audioDeviceError (const String& errorMessage) override | |||
{ | |||
const ScopedLock sl (owner.callbackLock); | |||
double getCurrentSampleRate() { return device->getCurrentSampleRate(); } | |||
bool setCurrentSampleRate (double newSampleRate) { return device->setCurrentSampleRate (newSampleRate); } | |||
if (owner.callback != nullptr) | |||
owner.callback->audioDeviceError (errorMessage); | |||
} | |||
void audioDeviceAboutToStart (AudioIODevice* d) override { owner.handleAudioDeviceAboutToStart (d); } | |||
void audioDeviceStopped() override { owner.handleAudioDeviceStopped(); } | |||
void audioDeviceError (const String& errorMessage) override { owner.handleAudioDeviceError (errorMessage); } | |||
AudioIODeviceCombiner& owner; | |||
ScopedPointer<AudioIODevice> device; | |||
ScopedPointer<CoreAudioIODevice> device; | |||
int inputIndex, numInputChans, outputIndex, numOutputChans; | |||
bool useInputs, useOutputs; | |||
AbstractFifo inputFifo, outputFifo; | |||
@@ -1942,7 +1981,7 @@ public: | |||
if (in == nullptr) return out.release(); | |||
if (out == nullptr) return in.release(); | |||
ScopedPointer<AudioIODeviceCombiner> combo (new AudioIODeviceCombiner (combinedName)); | |||
ScopedPointer<AudioIODeviceCombiner> combo (new AudioIODeviceCombiner (combinedName, *this)); | |||
combo->addDevice (in.release(), true, false); | |||
combo->addDevice (out.release(), false, true); | |||
return combo.release(); | |||
@@ -1998,7 +2037,7 @@ private: | |||
static OSStatus hardwareListenerProc (AudioDeviceID, UInt32, const AudioObjectPropertyAddress*, void* clientData) | |||
{ | |||
static_cast<CoreAudioIODeviceType*> (clientData)->audioDeviceListChanged(); | |||
static_cast<CoreAudioIODeviceType*> (clientData)->triggerAsyncAudioDeviceListChange(); | |||
return noErr; | |||
} | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
@@ -74,6 +66,22 @@ namespace CoreMidiHelpers | |||
return result; | |||
} | |||
void enableSimulatorMidiSession() | |||
{ | |||
#if TARGET_OS_SIMULATOR | |||
static bool hasEnabledNetworkSession = false; | |||
if (! hasEnabledNetworkSession) | |||
{ | |||
MIDINetworkSession* session = [MIDINetworkSession defaultSession]; | |||
session.enabled = YES; | |||
session.connectionPolicy = MIDINetworkConnectionPolicy_Anyone; | |||
hasEnabledNetworkSession = true; | |||
} | |||
#endif | |||
} | |||
static String getEndpointName (MIDIEndpointRef endpoint, bool isExternal) | |||
{ | |||
String result (getMidiObjectName (endpoint)); | |||
@@ -181,6 +189,8 @@ namespace CoreMidiHelpers | |||
// search for devices. It's safest to use the message thread for calling this. | |||
jassert (MessageManager::getInstance()->isThisTheMessageThread()); | |||
enableSimulatorMidiSession(); | |||
const ItemCount num = forInput ? MIDIGetNumberOfSources() | |||
: MIDIGetNumberOfDestinations(); | |||
StringArray s; | |||
@@ -226,13 +236,7 @@ namespace CoreMidiHelpers | |||
// correctly when called from the message thread! | |||
jassert (MessageManager::getInstance()->isThisTheMessageThread()); | |||
#if TARGET_OS_SIMULATOR | |||
// Enable MIDI for iOS simulator | |||
MIDINetworkSession* session = [MIDINetworkSession defaultSession]; | |||
session.enabled = YES; | |||
session.connectionPolicy = MIDINetworkConnectionPolicy_Anyone; | |||
#endif | |||
enableSimulatorMidiSession(); | |||
CoreMidiHelpers::ScopedCFString name; | |||
name.cfString = getGlobalMidiClientName().toCFString(); | |||
@@ -2,28 +2,20 @@ | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2016 - ROLI Ltd. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
Permission is granted to use this software under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
OF THIS SOFTWARE. | |||
----------------------------------------------------------------------------- | |||
To release a closed-source product which uses other parts of JUCE not | |||
licensed under the ISC terms, commercial licenses are available: visit | |||
www.juce.com for more information. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||