lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
include
panning.h
Go to the documentation of this file.
1
/*
2
* panning.h - declaration of some types, concerning the
3
* panning of a note
4
*
5
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6
*
7
* This file is part of LMMS - https://lmms.io
8
*
9
* This program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public
11
* License as published by the Free Software Foundation; either
12
* version 2 of the License, or (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public
20
* License along with this program (see COPYING); if not, write to the
21
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
* Boston, MA 02110-1301 USA.
23
*
24
*/
25
26
#ifndef LMMS_PANNING_H
27
#define LMMS_PANNING_H
28
29
#include "
LmmsTypes.h
"
30
#include "
Midi.h
"
31
#include "
volume.h
"
32
33
#include <cmath>
34
35
namespace
lmms
36
{
37
38
inline
constexpr
panning_t
PanningRight
= 100;
39
inline
constexpr
panning_t
PanningLeft
= -
PanningRight
;
40
inline
constexpr
panning_t
PanningCenter
= 0;
41
inline
constexpr
panning_t
DefaultPanning
=
PanningCenter
;
42
43
inline
StereoVolumeVector
panningToVolumeVector
(
panning_t
_p,
44
float
_scale = 1.0f )
45
{
46
StereoVolumeVector
v = { { _scale, _scale } };
47
const
float
pf = _p / 100.0f;
48
v.
vol
[_p >=
PanningCenter
? 0 : 1] *= 1.0f - std::abs(pf);
49
return
v;
50
}
51
52
53
inline
int
panningToMidi
(
panning_t
_p )
54
{
55
return
MidiMinPanning
+ (int) (
56
( (
float
)( _p -
PanningLeft
) ) /
57
( (
float
)(
PanningRight
-
PanningLeft
) ) *
58
( (
float
)(
MidiMaxPanning
-
MidiMinPanning
) ) );
59
}
60
61
62
}
// namespace lmms
63
64
#endif
// LMMS_PANNING_H
LmmsTypes.h
Midi.h
lmms
Definition
RemotePluginBase.cpp:34
lmms::DefaultPanning
constexpr panning_t DefaultPanning
Definition
panning.h:41
lmms::PanningLeft
constexpr panning_t PanningLeft
Definition
panning.h:39
lmms::panningToVolumeVector
StereoVolumeVector panningToVolumeVector(panning_t _p, float _scale=1.0f)
Definition
panning.h:43
lmms::panningToMidi
int panningToMidi(panning_t _p)
Definition
panning.h:53
lmms::PanningCenter
constexpr panning_t PanningCenter
Definition
panning.h:40
lmms::MidiMaxPanning
const int MidiMaxPanning
Definition
Midi.h:135
lmms::MidiMinPanning
const int MidiMinPanning
Definition
Midi.h:136
lmms::panning_t
std::int8_t panning_t
Definition
LmmsTypes.h:37
lmms::PanningRight
constexpr panning_t PanningRight
Definition
panning.h:38
lmms::StereoVolumeVector
Definition
volume.h:40
lmms::StereoVolumeVector::vol
float vol[2]
Definition
volume.h:41
volume.h
Generated on
for lmms by
1.18.0