OpenShot Library | libopenshot-audio
0.2.0
juce_MPEValue.h
1
2
/** @weakgroup juce_audio_basics-mpe
3
* @{
4
*/
5
/*
6
==============================================================================
7
8
This file is part of the JUCE library.
9
Copyright (c) 2017 - ROLI Ltd.
10
11
JUCE is an open source library subject to commercial or open-source
12
licensing.
13
14
The code included in this file is provided under the terms of the ISC license
15
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16
To use, copy, modify, and/or distribute this software for any purpose with or
17
without fee is hereby granted provided that the above copyright notice and
18
this permission notice appear in all copies.
19
20
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22
DISCLAIMED.
23
24
==============================================================================
25
*/
26
27
namespace
juce
28
{
29
30
//==============================================================================
31
/**
32
This class represents a single value for any of the MPE
33
dimensions of control. It supports values with 7-bit or 14-bit resolutions
34
(corresponding to 1 or 2 MIDI bytes, respectively). It also offers helper
35
functions to query the value in a variety of representations that can be
36
useful in an audio or MIDI context.
37
38
@tags{Audio}
39
*/
40
class
JUCE_API
MPEValue
41
{
42
public
:
43
//==============================================================================
44
/** Default constructor.
45
46
Constructs an MPEValue corresponding to the centre value.
47
*/
48
MPEValue
() noexcept;
49
50
/** Constructs an MPEValue from an integer between 0 and 127
51
(using 7-bit precision).
52
*/
53
static
MPEValue
from7BitInt (
int
value) noexcept;
54
55
/** Constructs an MPEValue from an integer between 0 and 16383
56
(using 14-bit precision).
57
*/
58
static
MPEValue
from14BitInt (
int
value) noexcept;
59
60
/** Constructs an MPEValue corresponding to the centre value. */
61
static
MPEValue
centreValue() noexcept;
62
63
/** Constructs an MPEValue corresponding to the minimum value. */
64
static
MPEValue
minValue() noexcept;
65
66
/** Constructs an MPEValue corresponding to the maximum value. */
67
static
MPEValue
maxValue() noexcept;
68
69
/** Retrieves the current value as an integer between 0 and 127.
70
71
Information will be lost if the value was initialised with a precision
72
higher than 7-bit.
73
*/
74
int
as7BitInt()
const
noexcept;
75
76
/** Retrieves the current value as an integer between 0 and 16383.
77
78
Resolution will be lost if the value was initialised with a precision
79
higher than 14-bit.
80
*/
81
int
as14BitInt()
const
noexcept;
82
83
/** Retrieves the current value mapped to a float between -1.0f and 1.0f. */
84
float
asSignedFloat()
const
noexcept;
85
86
/** Retrieves the current value mapped to a float between 0.0f and 1.0f. */
87
float
asUnsignedFloat()
const
noexcept;
88
89
/** Returns true if two values are equal. */
90
bool
operator== (
const
MPEValue
& other)
const
noexcept;
91
92
/** Returns true if two values are not equal. */
93
bool
operator!= (
const
MPEValue
& other)
const
noexcept;
94
95
private
:
96
//==============================================================================
97
MPEValue
(
int
normalisedValue);
98
int
normalisedValue = 8192;
99
};
100
101
}
// namespace juce
102
103
/** @}*/
JUCE_API
#define JUCE_API
This macro is added to all JUCE public class declarations.
Definition:
juce_StandardHeader.h:143
juce::MPEValue
This class represents a single value for any of the MPE dimensions of control.
Definition:
juce_MPEValue.h:40
juce_audio_basics
mpe
juce_MPEValue.h
Generated on Wed Jun 24 2020 20:19:20 for OpenShot Library | libopenshot-audio by
1.8.17