@@ -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; | |||