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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/* GSequencer - Advanced GTK Sequencer
* Copyright (C) 2005-2018 Joël Krähemann
*
* This file is part of GSequencer.
*
* GSequencer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GSequencer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GSequencer. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <float.h>
int
main(int argc, char **argv)
{
long long int lossy;
long double result;
int digs = 36;
/* s8 conversion */
result = ((2 << 14) - 1) / ((2 << 6) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S8_TO_S16 (%.*LfL)\n", digs, result);
result = ((long double) (2 << 22) - 1) / ((long double) (2 << 6) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S8_TO_S24 (%.*LfL)\n", digs, result);
result = ((long double) ((long long int) 2 << 30) - 1) / ((long double) (2 << 6) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S8_TO_S32 (%.*LfL)\n", digs, result);
result = (long double) ((((long long int) 2 << 62) - 1) / ((2 << 6) - 1));
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S8_TO_S64 (%.*LfL)\n", digs, result);
result = 1.0L / ((2 << 6) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S8_TO_FLOAT (%.*LfL)\n", digs, result);
printf("\n");
/* s16 conversion */
result = 1.0 / (((2 << 14) - 1) * ((2 << 6) - 1));
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S16_TO_S8 (%.*LfL)\n", digs, result);
result = ((2 << 22) - 1) / ((2 << 14) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S16_TO_S24 (%.*LfL)\n", digs, result);
result = (((long long int) 2 << 30) - 1) / ((2 << 14) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S16_TO_S32 (%.*LfL)\n", digs, result);
result = (((long long int) 2 << 62) - 1) / ((2 << 14) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S16_TO_S64 (%.*LfL)\n", digs, result);
result = 1.0L / ((2 << 14) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S16_TO_FLOAT (%.*LfL)\n", digs, result);
printf("\n");
/* s24 conversion */
result = 1.0 / ((2 << 22) - 1) * ((2 << 6) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S24_TO_S8 (%.*LfL)\n", digs, result);
result = 1.0 / ((2 << 22) - 1) * ((2 << 14) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S24_TO_S16 (%.*LfL)\n", digs, result);
result = (((long long int) 2 << 30) - 1) / ((2 << 22) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S24_TO_S32 (%.*LfL)\n", digs, result);
result = (((long long int) 2 << 62) - 1) / ((2 << 22) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S24_TO_S64 (%.*LfL)\n", digs, result);
result = 1.0L / ((2 << 22) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S24_TO_FLOAT (%.*LfL)\n", digs, result);
printf("\n");
/* s32 conversion */
result = 1.0 / (((long long int) 2 << 30) - 1) * ((2 << 6) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S32_TO_S8 (%.*LfL)\n", digs, result);
result = 1.0 / (((long long int) 2 << 30) - 1) * ((2 << 14) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S32_TO_S16 (%.*LfL)\n", digs, result);
result = 1.0 / (((long long int) 2 << 30) - 1) * ((2 << 22) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S32_TO_S24 (%.*LfL)\n", digs, result);
result = (((long long int) 2 << 62) - 1) / (((long long int) 2 << 30) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S32_TO_S64 (%.*LfL)\n", digs, result);
result = 1.0L / (((long long int) 2 << 30) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S32_TO_FLOAT (%.*LfL)\n", digs, result);
printf("\n");
/* s64 conversion */
result = 1.0 / (((long long int) 1 << 61) - 1) / 2.0 * ((2 << 6) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S64_TO_S8 (%.*LfL)\n", digs, result);
result = 1.0 / (((long long int) 1 << 61) - 1) / 2.0 * ((2 << 14) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S64_TO_S16 (%.*LfL)\n", digs, result);
result = 1.0 / (((long long int) 1 << 61) - 1) / 2.0 * ((2 << 22) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S64_TO_S24 (%.*LfL)\n", digs, result);
result = 1.0 / (((long long int) 1 << 61) - 1) / 2.0 * ((2 << 30) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S64_TO_S32 (%.*LfL)\n", digs, result);
result = 1.0L / (((long long int) 2 << 61) - 1) / 2.0;
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_S64_TO_FLOAT (%.*LfL)\n", digs, result);
printf("\n");
/* float conversion */
result = ((2 << 6) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_FLOAT_TO_S8 (%.*LfL)\n", digs, result);
result = ((2 << 14) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_FLOAT_TO_S16 (%.*LfL)\n", digs, result);
result = ((2 << 22) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_FLOAT_TO_S24 (%.*LfL)\n", digs, result);
result = (((long long int) 2 << 30) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_FLOAT_TO_S32 (%.*LfL)\n", digs, result);
result = (((long long int) 2 << 62) - 1);
printf("#define AGS_AUDIO_BUFFER_UTIL_FACTOR_FLOAT_TO_S64 (%.*LfL)\n", digs, result);
printf("\n");
return(0);
}
|