1 /+
2 +            Copyright 2023 – 2024 Aya Partridge
3 + Distributed under the Boost Software License, Version 1.0.
4 +     (See accompanying file LICENSE_1_0.txt or copy at
5 +           http://www.boost.org/LICENSE_1_0.txt)
6 +/
7 module opus.defines;
8 
9 import bindbc.opus.config;
10 import bindbc.opus.codegen;
11 
12 import opus;
13 
14 enum{
15 	OPUS_OK                =  0,
16 	OPUS_BAD_ARG           = -1,
17 	OPUS_BUFFER_TOO_SMALL  = -2,
18 	OPUS_INTERNAL_ERROR    = -3,
19 	OPUS_INVALID_PACKET    = -4,
20 	OPUS_UNIMPLEMENTED     = -5,
21 	OPUS_INVALID_STATE     = -6,
22 	OPUS_ALLOC_FAIL        = -7,
23 }
24 
25 enum{
26 	OPUS_SET_APPLICATION_REQUEST         = 4000,
27 	OPUS_GET_APPLICATION_REQUEST         = 4001,
28 	OPUS_SET_BITRATE_REQUEST             = 4002,
29 	OPUS_GET_BITRATE_REQUEST             = 4003,
30 	OPUS_SET_MAX_BANDWIDTH_REQUEST       = 4004,
31 	OPUS_GET_MAX_BANDWIDTH_REQUEST       = 4005,
32 	OPUS_SET_VBR_REQUEST                 = 4006,
33 	OPUS_GET_VBR_REQUEST                 = 4007,
34 	OPUS_SET_BANDWIDTH_REQUEST           = 4008,
35 	OPUS_GET_BANDWIDTH_REQUEST           = 4009,
36 	OPUS_SET_COMPLEXITY_REQUEST          = 4010,
37 	OPUS_GET_COMPLEXITY_REQUEST          = 4011,
38 	OPUS_SET_INBAND_FEC_REQUEST          = 4012,
39 	OPUS_GET_INBAND_FEC_REQUEST          = 4013,
40 	OPUS_SET_PACKET_LOSS_PERC_REQUEST    = 4014,
41 	OPUS_GET_PACKET_LOSS_PERC_REQUEST    = 4015,
42 	OPUS_SET_DTX_REQUEST                 = 4016,
43 	OPUS_GET_DTX_REQUEST                 = 4017,
44 	OPUS_SET_VBR_CONSTRAINT_REQUEST      = 4020,
45 	OPUS_GET_VBR_CONSTRAINT_REQUEST      = 4021,
46 	OPUS_SET_FORCE_CHANNELS_REQUEST      = 4022,
47 	OPUS_GET_FORCE_CHANNELS_REQUEST      = 4023,
48 	OPUS_SET_SIGNAL_REQUEST              = 4024,
49 	OPUS_GET_SIGNAL_REQUEST              = 4025,
50 	OPUS_GET_LOOKAHEAD_REQUEST           = 4027,
51 	OPUS_GET_SAMPLE_RATE_REQUEST         = 4029,
52 	OPUS_GET_FINAL_RANGE_REQUEST         = 4031,
53 	OPUS_GET_PITCH_REQUEST               = 4033,
54 	OPUS_SET_GAIN_REQUEST                = 4034,
55 	OPUS_GET_GAIN_REQUEST                = 4045,
56 	OPUS_SET_LSB_DEPTH_REQUEST           = 4036,
57 	OPUS_GET_LSB_DEPTH_REQUEST           = 4037,
58 	OPUS_GET_LAST_PACKET_DURATION_REQUEST = 4039,
59 	OPUS_SET_EXPERT_FRAME_DURATION_REQUEST = 4040,
60 	OPUS_GET_EXPERT_FRAME_DURATION_REQUEST = 4041,
61 	OPUS_SET_PREDICTION_DISABLED_REQUEST = 4042,
62 	OPUS_GET_PREDICTION_DISABLED_REQUEST = 4043,
63 	OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST = 4046,
64 	OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST = 4047,
65 	OPUS_GET_IN_DTX_REQUEST              = 4049,
66 	
67 	OPUS_AUTO                            = -1000,
68 	OPUS_BITRATE_MAX                     = -1,
69 	
70 	OPUS_APPLICATION_VOIP                = 2048,
71 	OPUS_APPLICATION_AUDIO               = 2049,
72 	OPUS_APPLICATION_RESTRICTED_LOWDELAY = 2051,
73 	
74 	OPUS_SIGNAL_VOICE                    = 3001,
75 	OPUS_SIGNAL_MUSIC                    = 3002,
76 	OPUS_BANDWIDTH_NARROWBAND            = 1101,
77 	OPUS_BANDWIDTH_MEDIUMBAND            = 1102,
78 	OPUS_BANDWIDTH_WIDEBAND              = 1103,
79 	OPUS_BANDWIDTH_SUPERWIDEBAND         = 1104,
80 	OPUS_BANDWIDTH_FULLBAND              = 1105,
81 	
82 	OPUS_FRAMESIZE_ARG                   = 5000,
83 	OPUS_FRAMESIZE_2_5_MS                = 5001,
84 	OPUS_FRAMESIZE_5_MS                  = 5002,
85 	OPUS_FRAMESIZE_10_MS                 = 5003,
86 	OPUS_FRAMESIZE_20_MS                 = 5004,
87 	OPUS_FRAMESIZE_40_MS                 = 5005,
88 	OPUS_FRAMESIZE_60_MS                 = 5006,
89 	OPUS_FRAMESIZE_80_MS                 = 5007,
90 	OPUS_FRAMESIZE_100_MS                = 5008,
91 	OPUS_FRAMESIZE_120_MS                = 5009,
92 	
93 	OPUS_RESET_STATE                     = 4028,
94 }
95 
96 pragma(inline,true) nothrow @nogc{
97 	auto OPUS_SET_COMPLEXITY(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_COMPLEXITY_REQUEST, x); }
98 	auto OPUS_SET_COMPLEXITY(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_COMPLEXITY_REQUEST, x); }
99 	auto OPUS_GET_COMPLEXITY(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_COMPLEXITY_REQUEST, x); }
100 	auto OPUS_GET_COMPLEXITY(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_COMPLEXITY_REQUEST, x); }
101 	auto OPUS_SET_BITRATE(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_BITRATE_REQUEST, x); }
102 	auto OPUS_SET_BITRATE(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_BITRATE_REQUEST, x); }
103 	auto OPUS_GET_BITRATE(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_BITRATE_REQUEST, x); }
104 	auto OPUS_GET_BITRATE(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_BITRATE_REQUEST, x); }
105 	auto OPUS_SET_VBR(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_VBR_REQUEST, x); }
106 	auto OPUS_SET_VBR(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_VBR_REQUEST, x); }
107 	auto OPUS_GET_VBR(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_VBR_REQUEST, x); }
108 	auto OPUS_GET_VBR(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_VBR_REQUEST, x); }
109 	auto OPUS_SET_VBR_CONSTRAINT(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_VBR_CONSTRAINT_REQUEST, x); }
110 	auto OPUS_SET_VBR_CONSTRAINT(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_VBR_CONSTRAINT_REQUEST, x); }
111 	auto OPUS_GET_VBR_CONSTRAINT(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_VBR_CONSTRAINT_REQUEST, x); }
112 	auto OPUS_GET_VBR_CONSTRAINT(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_VBR_CONSTRAINT_REQUEST, x); }
113 	auto OPUS_SET_FORCE_CHANNELS(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_FORCE_CHANNELS_REQUEST, x); }
114 	auto OPUS_SET_FORCE_CHANNELS(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_FORCE_CHANNELS_REQUEST, x); }
115 	auto OPUS_GET_FORCE_CHANNELS(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_FORCE_CHANNELS_REQUEST, x); }
116 	auto OPUS_GET_FORCE_CHANNELS(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_FORCE_CHANNELS_REQUEST, x); }
117 	auto OPUS_SET_MAX_BANDWIDTH(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_MAX_BANDWIDTH_REQUEST, x); }
118 	auto OPUS_SET_MAX_BANDWIDTH(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_MAX_BANDWIDTH_REQUEST, x); }
119 	auto OPUS_GET_MAX_BANDWIDTH(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_MAX_BANDWIDTH_REQUEST, x); }
120 	auto OPUS_GET_MAX_BANDWIDTH(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_MAX_BANDWIDTH_REQUEST, x); }
121 	auto OPUS_SET_BANDWIDTH(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_BANDWIDTH_REQUEST, x); }
122 	auto OPUS_SET_BANDWIDTH(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_BANDWIDTH_REQUEST, x); }
123 	auto OPUS_SET_SIGNAL(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_SIGNAL_REQUEST, x); }
124 	auto OPUS_SET_SIGNAL(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_SIGNAL_REQUEST, x); }
125 	auto OPUS_GET_SIGNAL(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_SIGNAL_REQUEST, x); }
126 	auto OPUS_GET_SIGNAL(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_SIGNAL_REQUEST, x); }
127 	auto OPUS_SET_APPLICATION(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_APPLICATION_REQUEST, x); }
128 	auto OPUS_SET_APPLICATION(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_APPLICATION_REQUEST, x); }
129 	auto OPUS_GET_APPLICATION(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_APPLICATION_REQUEST, x); }
130 	auto OPUS_GET_APPLICATION(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_APPLICATION_REQUEST, x); }
131 	auto OPUS_GET_LOOKAHEAD(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_LOOKAHEAD_REQUEST, x); }
132 	auto OPUS_GET_LOOKAHEAD(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_LOOKAHEAD_REQUEST, x); }
133 	auto OPUS_SET_INBAND_FEC(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_INBAND_FEC_REQUEST, x); }
134 	auto OPUS_SET_INBAND_FEC(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_INBAND_FEC_REQUEST, x); }
135 	auto OPUS_GET_INBAND_FEC(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_INBAND_FEC_REQUEST, x); }
136 	auto OPUS_GET_INBAND_FEC(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_INBAND_FEC_REQUEST, x); }
137 	auto OPUS_SET_PACKET_LOSS_PERC(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_PACKET_LOSS_PERC_REQUEST, x); }
138 	auto OPUS_SET_PACKET_LOSS_PERC(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_PACKET_LOSS_PERC_REQUEST, x); }
139 	auto OPUS_GET_PACKET_LOSS_PERC(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_PACKET_LOSS_PERC_REQUEST, x); }
140 	auto OPUS_GET_PACKET_LOSS_PERC(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_PACKET_LOSS_PERC_REQUEST, x); }
141 	auto OPUS_SET_DTX(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_DTX_REQUEST, x); }
142 	auto OPUS_SET_DTX(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_DTX_REQUEST, x); }
143 	auto OPUS_GET_DTX(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_DTX_REQUEST, x); }
144 	auto OPUS_GET_DTX(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_DTX_REQUEST, x); }
145 	auto OPUS_SET_LSB_DEPTH(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_LSB_DEPTH_REQUEST, x); }
146 	auto OPUS_SET_LSB_DEPTH(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_LSB_DEPTH_REQUEST, x); }
147 	auto OPUS_GET_LSB_DEPTH(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_LSB_DEPTH_REQUEST, x); }
148 	auto OPUS_GET_LSB_DEPTH(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_LSB_DEPTH_REQUEST, x); }
149 	auto OPUS_SET_EXPERT_FRAME_DURATION(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, x); }
150 	auto OPUS_SET_EXPERT_FRAME_DURATION(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, x); }
151 	auto OPUS_GET_EXPERT_FRAME_DURATION(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, x); }
152 	auto OPUS_GET_EXPERT_FRAME_DURATION(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, x); }
153 	auto OPUS_SET_PREDICTION_DISABLED(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_PREDICTION_DISABLED_REQUEST, x); }
154 	auto OPUS_SET_PREDICTION_DISABLED(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_PREDICTION_DISABLED_REQUEST, x); }
155 	auto OPUS_GET_PREDICTION_DISABLED(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_PREDICTION_DISABLED_REQUEST, x); }
156 	auto OPUS_GET_PREDICTION_DISABLED(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_PREDICTION_DISABLED_REQUEST, x); }
157 	
158 	auto OPUS_GET_FINAL_RANGE(OpusEncoder* st, uint* x){ return opus_encoder_ctl(st, OPUS_GET_FINAL_RANGE_REQUEST, x); }
159 	auto OPUS_GET_FINAL_RANGE(OpusMSEncoder* st, uint* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_FINAL_RANGE_REQUEST, x); }
160 	auto OPUS_GET_FINAL_RANGE(OpusDecoder* st, uint* x){ return opus_decoder_ctl(st, OPUS_GET_FINAL_RANGE_REQUEST, x); }
161 	auto OPUS_GET_FINAL_RANGE(OpusMSDecoder* st, uint* x){ return opus_multistream_decoder_ctl(st, OPUS_GET_FINAL_RANGE_REQUEST, x); }
162 	auto OPUS_GET_BANDWIDTH(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_BANDWIDTH_REQUEST, x); }
163 	auto OPUS_GET_BANDWIDTH(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_BANDWIDTH_REQUEST, x); }
164 	auto OPUS_GET_BANDWIDTH(OpusDecoder* st, int* x){ return opus_decoder_ctl(st, OPUS_GET_BANDWIDTH_REQUEST, x); }
165 	auto OPUS_GET_BANDWIDTH(OpusMSDecoder* st, int* x){ return opus_multistream_decoder_ctl(st, OPUS_GET_BANDWIDTH_REQUEST, x); }
166 	auto OPUS_GET_SAMPLE_RATE(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_SAMPLE_RATE_REQUEST, x); }
167 	auto OPUS_GET_SAMPLE_RATE(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_SAMPLE_RATE_REQUEST, x); }
168 	auto OPUS_GET_SAMPLE_RATE(OpusDecoder* st, int* x){ return opus_decoder_ctl(st, OPUS_GET_SAMPLE_RATE_REQUEST, x); }
169 	auto OPUS_GET_SAMPLE_RATE(OpusMSDecoder* st, int* x){ return opus_multistream_decoder_ctl(st, OPUS_GET_SAMPLE_RATE_REQUEST, x); }
170 	auto OPUS_SET_PHASE_INVERSION_DISABLED(OpusEncoder* st, int x){ return opus_encoder_ctl(st, OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST, x); }
171 	auto OPUS_SET_PHASE_INVERSION_DISABLED(OpusMSEncoder* st, int x){ return opus_multistream_encoder_ctl(st, OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST, x); }
172 	auto OPUS_SET_PHASE_INVERSION_DISABLED(OpusDecoder* st, int x){ return opus_decoder_ctl(st, OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST, x); }
173 	auto OPUS_SET_PHASE_INVERSION_DISABLED(OpusMSDecoder* st, int x){ return opus_multistream_decoder_ctl(st, OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST, x); }
174 	auto OPUS_GET_PHASE_INVERSION_DISABLED(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST, x); }
175 	auto OPUS_GET_PHASE_INVERSION_DISABLED(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST, x); }
176 	auto OPUS_GET_PHASE_INVERSION_DISABLED(OpusDecoder* st, int* x){ return opus_decoder_ctl(st, OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST, x); }
177 	auto OPUS_GET_PHASE_INVERSION_DISABLED(OpusMSDecoder* st, int* x){ return opus_multistream_decoder_ctl(st, OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST, x); }
178 	auto OPUS_GET_IN_DTX(OpusEncoder* st, int* x){ return opus_encoder_ctl(st, OPUS_GET_IN_DTX_REQUEST, x); }
179 	auto OPUS_GET_IN_DTX(OpusMSEncoder* st, int* x){ return opus_multistream_encoder_ctl(st, OPUS_GET_IN_DTX_REQUEST, x); }
180 	auto OPUS_GET_IN_DTX(OpusDecoder* st, int* x){ return opus_decoder_ctl(st, OPUS_GET_IN_DTX_REQUEST, x); }
181 	auto OPUS_GET_IN_DTX(OpusMSDecoder* st, int* x){ return opus_multistream_decoder_ctl(st, OPUS_GET_IN_DTX_REQUEST, x); }
182 	
183 	auto OPUS_SET_GAIN(OpusDecoder* st, int x){ return opus_decoder_ctl(st, OPUS_SET_GAIN_REQUEST, x); }
184 	auto OPUS_SET_GAIN(OpusMSDecoder* st, int x){ return opus_multistream_decoder_ctl(st, OPUS_SET_GAIN_REQUEST, x); }
185 	auto OPUS_GET_GAIN(OpusDecoder* st, int* x){ return opus_decoder_ctl(st, OPUS_GET_GAIN_REQUEST, x); }
186 	auto OPUS_GET_GAIN(OpusMSDecoder* st, int* x){ return opus_multistream_decoder_ctl(st, OPUS_GET_GAIN_REQUEST, x); }
187 	auto OPUS_GET_LAST_PACKET_DURATION(OpusDecoder* st, int* x){ return opus_decoder_ctl(st, OPUS_GET_LAST_PACKET_DURATION_REQUEST, x); }
188 	auto OPUS_GET_LAST_PACKET_DURATION(OpusMSDecoder* st, int* x){ return opus_multistream_decoder_ctl(st, OPUS_GET_LAST_PACKET_DURATION_REQUEST, x); }
189 	auto OPUS_GET_PITCH(OpusDecoder* st, int* x){ return opus_decoder_ctl(st, OPUS_GET_PITCH_REQUEST, x); }
190 	auto OPUS_GET_PITCH(OpusMSDecoder* st, int* x){ return opus_multistream_decoder_ctl(st, OPUS_GET_PITCH_REQUEST, x); }
191 }
192 
193 mixin(joinFnBinds((){
194 	FnBind[] ret = [
195 		{q{const(char)*}, q{opus_strerror}, q{int error}},
196 		{q{const(char)*}, q{opus_get_version_string}, q{}},
197 	];
198 	return ret;
199 }()));