forked from Sneeds-Feed-and-Seed/sneedacity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCrossFade.h
60 lines (39 loc) · 1.21 KB
/
CrossFade.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**********************************************************************
Sneedacity: A Digital Audio Editor
CrossFade.h
(c) 2005 The Sneedacity Team
Licensed under the GPL version 2.0
**********************************************************************/
#ifndef __SNEEDACITY_CROSSFADE__
#define __SNEEDACITY_CROSSFADE__
/// This defines a crossfader class that
/// accepts a list of WaveClips and can do a mini-mixing
/// to produce the desired crossfading
#include "WaveClip.h"
enum FadeType
{
FT_MIX,
FT_TRIANGULAR,
FT_EXPONENTIAL
};
class CrossFader
{
public:
CrossFader();
~CrossFader();
//This sets a crossfade mode where the overlapping
//tracks are simply mixed equally.
void SetMixCrossFade(){mType = FT_MIX;};
void SetTriangularCrossFade(){mType = FT_TRIANGULAR;};
void SetExponentialCrossFade(){mType = FT_EXPONENTIAL;};
void ClearClips();
//Produces samples according to crossfading rules.
bool GetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, size_t len);
protected:
WaveClipHolders mClips;
private:
bool CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, size_t len);
FadeType mType;
};
#endif