blob: 80c4de5c9605a81bac031c7cc4319380ad2c8cfa (
plain) (
blame)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* Autotune.h
* ----------
* Purpose: Class for tuning a sample to a given base note automatically.
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
#include "../soundlib/Snd_defs.h"
#include "resource.h"
OPENMPT_NAMESPACE_BEGIN
struct ModSample;
class Autotune
{
protected:
ModSample &m_sample;
MODTYPE m_modType;
SmpLength m_selectionStart, m_selectionEnd;
int16 *m_sampleData = nullptr;
SmpLength m_sampleLength = 0;
public:
Autotune(ModSample &smp, MODTYPE type, SmpLength selStart, SmpLength selEnd) : m_sample(smp), m_modType(type), m_selectionStart(selStart), m_selectionEnd(selEnd)
{ };
~Autotune()
{
delete[] m_sampleData;
}
bool CanApply() const;
bool Apply(double pitchReference, int targetNote);
protected:
template <class T>
void CopySamples(const T* origSample, SmpLength sampleLoopStart, SmpLength sampleLoopEnd);
bool PrepareSample(SmpLength maxShift);
};
class CAutotuneDlg : public CDialog
{
protected:
static int m_pitchReference; // Pitch reference (440Hz by default)
static int m_targetNote; // Note which the sample should be tuned to (C by default)
CComboBox m_CbnNoteBox;
public:
CAutotuneDlg(CWnd *parent) : CDialog(IDD_AUTOTUNE, parent)
{ };
int GetPitchReference() const { return m_pitchReference; }
int GetTargetNote() const { return m_targetNote; }
protected:
BOOL OnInitDialog() override;
void OnOK() override;
void DoDataExchange(CDataExchange* pDX) override;
};
OPENMPT_NAMESPACE_END
|