diff options
author | David Robillard <d@drobilla.net> | 2006-08-31 19:17:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-08-31 19:17:00 +0000 |
commit | 017e16c530bb1a9f186aa81893089dc79b4ddc24 (patch) | |
tree | 0b4343d96214148623cf631c4cd513026de69a6e /libs/ardour/utils.cc | |
parent | 0c3d8378f3a3a7333f3095e67050b62022281275 (diff) |
Merged with trunk R879
git-svn-id: svn://localhost/ardour2/branches/midi@880 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/utils.cc')
-rw-r--r-- | libs/ardour/utils.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 26b5966086..8d9d799a44 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -259,7 +259,7 @@ path_expand (string path) #endif } -#ifdef HAVE_COREAUDIO +#if defined(HAVE_COREAUDIO) || defined(HAVE_AUDIOUNITS) string CFStringRefToStdString(CFStringRef stringRef) { @@ -277,3 +277,29 @@ CFStringRefToStdString(CFStringRef stringRef) return result; } #endif // HAVE_COREAUDIO + +void +compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out) +{ + double step; + + step = 1.0/nframes; + + in[0] = 0.0f; + + for (int i = 1; i < nframes - 1; ++i) { + in[i] = in[i-1] + step; + } + + in[nframes-1] = 1.0; + + const float pan_law_attenuation = -3.0f; + const float scale = 2.0f - 4.0f * powf (10.0f,pan_law_attenuation/20.0f); + + for (unsigned long n = 0; n < nframes; ++n) { + float inVal = in[n]; + float outVal = 1 - inVal; + out[n] = outVal * (scale * outVal + 1.0f - scale); + in[n] = inVal * (scale * inVal + 1.0f - scale); + } +} |