aboutsummaryrefslogtreecommitdiff
path: root/Src/external_dependencies/openmpt-trunk/soundlib/tuningbase.h
blob: 49988136fb2b80d2b8e1c21dca4893bdc14b2426 (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
/*
 * tuningbase.h
 * ------------
 * Purpose: Alternative sample tuning.
 * 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 <limits>


OPENMPT_NAMESPACE_BEGIN


namespace Tuning {


enum class SerializationResult : int {
	Success = 1,
	NoMagic = 0,
	Failure = -1
};


using NOTEINDEXTYPE = int16;    // Some signed integer-type.
using UNOTEINDEXTYPE = uint16;  // Unsigned NOTEINDEXTYPE.

using RATIOTYPE = float32;      // Some 'real figure' type able to present ratios. If changing RATIOTYPE, serialization methods may need modifications.

// Counter of steps between notes. If there is no 'finetune'(finestepcount == 0),
// then 'step difference' between notes is the
// same as differences in NOTEINDEXTYPE. In a way similar to ticks and rows in pattern -
// ticks <-> STEPINDEX, rows <-> NOTEINDEX
using STEPINDEXTYPE = int32;
using USTEPINDEXTYPE = uint32;

struct NoteRange
{
  NOTEINDEXTYPE first;
  NOTEINDEXTYPE last;
};


// Derived from old IsStepCountRangeSufficient(), this is actually a more
// sensible value than what was calculated in earlier versions.
inline constexpr STEPINDEXTYPE FINESTEPCOUNT_MAX = 0xffff;

inline constexpr auto NOTEINDEXTYPE_MIN = std::numeric_limits<NOTEINDEXTYPE>::min();
inline constexpr auto NOTEINDEXTYPE_MAX = std::numeric_limits<NOTEINDEXTYPE>::max();
inline constexpr auto UNOTEINDEXTYPE_MAX = std::numeric_limits<UNOTEINDEXTYPE>::max();
inline constexpr auto STEPINDEXTYPE_MIN = std::numeric_limits<STEPINDEXTYPE>::min();
inline constexpr auto STEPINDEXTYPE_MAX = std::numeric_limits<STEPINDEXTYPE>::max();
inline constexpr auto USTEPINDEXTYPE_MAX = std::numeric_limits<USTEPINDEXTYPE>::max();


enum class Type : uint16
{
	GENERAL        = 0,
	GROUPGEOMETRIC = 1,
	GEOMETRIC      = 3,
};


class CTuning;


} // namespace Tuning


typedef Tuning::CTuning CTuning;


OPENMPT_NAMESPACE_END