Skip to content

Commit 25a65b4

Browse files
committed
Add non_supported_format_id_name
1 parent aacd94b commit 25a65b4

File tree

6 files changed

+206
-57
lines changed

6 files changed

+206
-57
lines changed

drivers/apple/microphone_driver_avfoundation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#pragma once
3232

33+
#ifdef COREAUDIO_ENABLED
34+
3335
#include "servers/microphone/microphone_driver.h"
3436

3537
#include "core/object/ref_counted.h"
@@ -104,3 +106,5 @@ class MicrophoneDriverAVFoundation : public MicrophoneDriver {
104106
- (void)cleanup;
105107

106108
@end
109+
110+
#endif // COREAUDIO_ENABLED

drivers/apple/microphone_driver_avfoundation.mm

Lines changed: 67 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@
2929
/**************************************************************************/
3030

3131
#include "microphone_driver_avfoundation.h"
32+
#include "drivers/apple/foundation_helpers.h"
33+
#include <CoreFoundation/CFString.h>
34+
#include <CoreFoundation/CFStringEncodingExt.h>
35+
36+
#ifdef COREAUDIO_ENABLED
3237

3338
#include "core/error/error_macros.h"
3439
#include "servers/microphone/microphone_feed.h"
3540
#include "servers/microphone/microphone_server.h"
3641

3742
#include <AVFAudio/AVFAudio.h>
43+
#include <AudioToolbox/AudioToolbox.h>
44+
#include <AudioUnit/AudioUnit.h>
3845
#include <CoreAudioTypes/CoreAudioBaseTypes.h>
3946

4047
MicrophoneDriverAVFoundation::FeedEntry *MicrophoneDriverAVFoundation::get_feed_entry_from_feed(const Ref<MicrophoneFeed> p_feed) const {
@@ -50,34 +57,67 @@
5057
AVCaptureDeviceFormat *active_format = p_device.activeFormat;
5158
CMFormatDescriptionRef format_description = active_format.formatDescription;
5259
ERR_FAIL_COND(CMFormatDescriptionGetMediaType(format_description) != kCMMediaType_Audio);
53-
const AudioStreamBasicDescription *audio_format_stream_basic_description = CMAudioFormatDescriptionGetStreamBasicDescription(format_description);
54-
ERR_FAIL_COND(audio_format_stream_basic_description == nullptr);
60+
const AudioStreamBasicDescription *audio_format_description = CMAudioFormatDescriptionGetStreamBasicDescription(format_description);
61+
AudioStreamBasicDescription audio_stream_basic_description{
62+
.mSampleRate = audio_format_description->mSampleRate,
63+
.mFormatID = audio_format_description->mFormatID,
64+
.mFormatFlags = audio_format_description->mFormatFlags,
65+
.mBytesPerPacket = audio_format_description->mBytesPerPacket,
66+
.mFramesPerPacket = audio_format_description->mFramesPerPacket,
67+
.mBytesPerFrame = audio_format_description->mBytesPerFrame,
68+
.mChannelsPerFrame = audio_format_description->mChannelsPerFrame,
69+
.mBitsPerChannel = audio_format_description->mBitsPerChannel,
70+
.mReserved = audio_format_description->mReserved,
71+
};
5572

5673
p_feed->set_name(String::utf8(p_device.localizedName.UTF8String));
5774
p_feed->set_description(String::utf8(p_device.description.UTF8String));
5875

59-
p_feed->set_sample_rate(audio_format_stream_basic_description->mSampleRate);
60-
p_feed->set_channels_per_frame(audio_format_stream_basic_description->mChannelsPerFrame);
61-
p_feed->set_bit_depth(audio_format_stream_basic_description->mBitsPerChannel);
76+
p_feed->set_sample_rate(audio_stream_basic_description.mSampleRate);
77+
p_feed->set_channels(audio_stream_basic_description.mChannelsPerFrame);
78+
p_feed->set_bit_depth(audio_stream_basic_description.mBitsPerChannel);
79+
80+
CFStringRef format_name;
81+
uint32_t format_name_size = sizeof(CFStringRef);
82+
OSStatus os_status = AudioFormatGetProperty(kAudioFormatProperty_FormatName, sizeof(audio_stream_basic_description), &audio_stream_basic_description, &format_name_size, &format_name);
83+
ERR_FAIL_COND_MSG(os_status != noErr, vformat("AudioFormatGetProperty() resulted in an error: %s", String::utf8([NSError errorWithDomain:NSOSStatusErrorDomain code:os_status userInfo:nil].description.UTF8String)));
84+
String format_name_str = conv::to_string((__bridge NSString *)format_name);
85+
CFRelease(format_name);
86+
87+
switch (audio_stream_basic_description.mFormatID) {
88+
case kAudioFormatALaw: {
89+
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_ALAW_PCM);
90+
} break;
91+
case kAudioFormatULaw: {
92+
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_ULAW_PCM);
93+
} break;
94+
case kAudioFormatLinearPCM: {
95+
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_LINEAR_PCM);
96+
} break;
97+
default: {
98+
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_NOT_SUPPORTED);
99+
p_feed->set_not_supported_format_id_name(format_name_str);
100+
} break;
101+
}
62102

63103
BitField<MicrophoneFeed::FormatFlag> feed_flags = MicrophoneFeed::FORMAT_FLAG_NONE;
64104

65-
#define HAS_FLAG(flag) audio_format_stream_basic_description->mFormatFlags &flag
66-
#define SET_IF_HAS_FLAG(apple_flag, microphone_feed_flag) \
67-
if (HAS_FLAG(apple_flag)) { \
68-
feed_flags.set_flag(MicrophoneFeed::microphone_feed_flag); \
69-
} \
105+
#define HAS_FLAG(flag) audio_stream_basic_description.mFormatFlags &flag
106+
#define SET_FLAG_IF_HAS_FLAG_EQUAL(apple_flag, microphone_feed_flag, target) \
107+
if ((HAS_FLAG(apple_flag)) == target) { \
108+
feed_flags.set_flag(MicrophoneFeed::microphone_feed_flag); \
109+
} \
70110
(void)0
71111

72-
SET_IF_HAS_FLAG(kAudioFormatFlagIsAlignedHigh, FORMAT_FLAG_IS_ALIGNED_HIGH);
73-
SET_IF_HAS_FLAG(kAudioFormatFlagIsBigEndian, FORMAT_FLAG_IS_BIG_ENDIAN);
74-
SET_IF_HAS_FLAG(kAudioFormatFlagIsFloat, FORMAT_FLAG_IS_FLOAT);
75-
SET_IF_HAS_FLAG(kAudioFormatFlagIsNonInterleaved, FORMAT_FLAG_IS_NON_INTERLEAVED);
76-
SET_IF_HAS_FLAG(kAudioFormatFlagIsNonMixable, FORMAT_FLAG_IS_NON_MIXABLE);
77-
SET_IF_HAS_FLAG(kAudioFormatFlagIsPacked, FORMAT_FLAG_IS_PACKED);
78-
SET_IF_HAS_FLAG(kAudioFormatFlagIsSignedInteger, FORMAT_FLAG_IS_SIGNED_INTEGER);
112+
SET_FLAG_IF_HAS_FLAG_EQUAL(kAudioFormatFlagIsAlignedHigh, FORMAT_FLAG_IS_ALIGNED_HIGH, true);
113+
SET_FLAG_IF_HAS_FLAG_EQUAL(kAudioFormatFlagIsBigEndian, FORMAT_FLAG_IS_BIG_ENDIAN, true);
114+
SET_FLAG_IF_HAS_FLAG_EQUAL(kAudioFormatFlagIsFloat, FORMAT_FLAG_IS_FLOAT, true);
115+
SET_FLAG_IF_HAS_FLAG_EQUAL(kAudioFormatFlagIsNonInterleaved, FORMAT_FLAG_IS_INTERLEAVED, false);
116+
SET_FLAG_IF_HAS_FLAG_EQUAL(kAudioFormatFlagIsNonMixable, FORMAT_FLAG_IS_MIXABLE, false);
117+
SET_FLAG_IF_HAS_FLAG_EQUAL(kAudioFormatFlagIsPacked, FORMAT_FLAG_IS_PACKED, true);
118+
SET_FLAG_IF_HAS_FLAG_EQUAL(kAudioFormatFlagIsSignedInteger, FORMAT_FLAG_IS_SIGNED_INTEGER, true);
79119

80-
#undef SET_IF_HAS_FLAG
120+
#undef SET_FLAG_IF_HAS_FLAG_EQUAL
81121
#undef HAS_FLAG
82122

83123
p_feed->set_format_flags(feed_flags);
@@ -342,28 +382,29 @@ - (id)initForFeed:(Ref<MicrophoneFeed>)pFeed
342382
settings = @{
343383
AVFormatIDKey : [NSNumber numberWithInt:kAudioFormatLinearPCM],
344384
AVSampleRateKey : [NSNumber numberWithFloat:feed->get_sample_rate()],
345-
AVNumberOfChannelsKey : [NSNumber numberWithInt:feed->get_channels_per_frame()],
385+
AVNumberOfChannelsKey : [NSNumber numberWithInt:feed->get_channels()],
346386
AVLinearPCMIsBigEndianKey : [NSNumber numberWithBool:feedFlags.has_flag(MicrophoneFeed::FORMAT_FLAG_IS_BIG_ENDIAN)],
347387
AVLinearPCMIsFloatKey : [NSNumber numberWithBool:feedFlags.has_flag(MicrophoneFeed::FORMAT_FLAG_IS_FLOAT)],
348-
AVLinearPCMIsNonInterleavedKey : [NSNumber numberWithBool:feedFlags.has_flag(MicrophoneFeed::FORMAT_FLAG_IS_NON_INTERLEAVED)],
388+
AVLinearPCMIsNonInterleavedKey : [NSNumber numberWithBool:feedFlags.has_flag(MicrophoneFeed::FORMAT_FLAG_IS_INTERLEAVED)],
349389
AVLinearPCMBitDepthKey : [NSNumber numberWithInt:feed->get_bit_depth()],
350390
};
351391
} break;
352-
case MicrophoneFeed::FORMAT_ID_ALAW: {
392+
case MicrophoneFeed::FORMAT_ID_ALAW_PCM: {
353393
settings = @{
354394
AVFormatIDKey : [NSNumber numberWithInt:kAudioFormatALaw],
355395
AVSampleRateKey : [NSNumber numberWithFloat:feed->get_sample_rate()],
356-
AVNumberOfChannelsKey : [NSNumber numberWithInt:feed->get_channels_per_frame()]
396+
AVNumberOfChannelsKey : [NSNumber numberWithInt:feed->get_channels()]
357397
};
358398
} break;
359-
case MicrophoneFeed::FORMAT_ID_ULAW: {
399+
case MicrophoneFeed::FORMAT_ID_ULAW_PCM: {
360400
settings = @{
361401
AVFormatIDKey : [NSNumber numberWithInt:kAudioFormatULaw],
362402
AVSampleRateKey : [NSNumber numberWithFloat:feed->get_sample_rate()],
363-
AVNumberOfChannelsKey : [NSNumber numberWithInt:feed->get_channels_per_frame()]
403+
AVNumberOfChannelsKey : [NSNumber numberWithInt:feed->get_channels()]
364404
};
365405
} break;
366406
case MicrophoneFeed::FORMAT_ID_UNDEFINED:
407+
case MicrophoneFeed::FORMAT_ID_NOT_SUPPORTED:
367408
case MicrophoneFeed::FORMAT_ID_MAX: {
368409
ERR_FAIL_V(nil);
369410
} break;
@@ -458,3 +499,5 @@ - (void)cleanup {
458499
}
459500

460501
@end
502+
503+
#endif // COREAUDIO_ENABLED

drivers/pulseaudio/microphone_driver_pulseaudio.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ Error _microphone_feed_to_pa_sample_spec(Ref<MicrophoneFeed> p_feed, pa_sample_s
5252
ERR_FAIL_V_MSG(ERR_CANT_CREATE, vformat("unsupported format for PulseAudio: %s", error_string))
5353

5454
switch (p_feed->get_format_id()) {
55-
case MicrophoneFeed::FORMAT_ID_ALAW:
56-
case MicrophoneFeed::FORMAT_ID_ULAW: {
57-
bool is_alaw = p_feed->get_format_id() == MicrophoneFeed::FORMAT_ID_ALAW;
55+
case MicrophoneFeed::FORMAT_ID_ALAW_PCM:
56+
case MicrophoneFeed::FORMAT_ID_ULAW_PCM: {
57+
bool is_alaw = p_feed->get_format_id() == MicrophoneFeed::FORMAT_ID_ALAW_PCM;
5858
String format_name = is_alaw ? "ALAW" : "ULAW";
5959
#define FORMAT_ERROR_LAW(str) \
60-
FORMAT_ERROR(vformat("doesn't support %s %s samples", format_name, str))
60+
FORMAT_ERROR(vformat("doesn't support %s PCM %s samples", format_name, str))
6161

6262
if (HAS_FLAG(FORMAT_FLAG_IS_FLOAT)) {
6363
FORMAT_ERROR_LAW("float");
@@ -150,9 +150,9 @@ void MicrophoneDriverPulseAudio::setup_feed_to_source_settings(Ref<MicrophoneFee
150150
BitField<MicrophoneFeed::FormatFlag> format_flags = MicrophoneFeed::FORMAT_FLAG_NONE;
151151

152152
#define FORMAT_ALAW() \
153-
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_ALAW)
153+
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_ALAW_PCM)
154154
#define FORMAT_ULAW() \
155-
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_ULAW)
155+
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_ULAW_PCM)
156156
#define FORMAT_LINEAR_PCM() \
157157
p_feed->set_format_id(MicrophoneFeed::FORMAT_ID_LINEAR_PCM)
158158

@@ -259,7 +259,7 @@ void MicrophoneDriverPulseAudio::setup_feed_to_source_settings(Ref<MicrophoneFee
259259
p_feed->set_format_flags(format_flags);
260260

261261
p_feed->set_sample_rate(p_pa_source_info->sample_spec.rate);
262-
p_feed->set_channels_per_frame(p_pa_source_info->sample_spec.channels);
262+
p_feed->set_channels(p_pa_source_info->sample_spec.channels);
263263

264264
#undef SAMPLE_U8
265265
#undef SAMPLE_ALAW
@@ -445,7 +445,7 @@ bool MicrophoneDriverPulseAudio::activate_feed_entry(FeedEntry *p_feed_entry) co
445445

446446
int input_latency = 30;
447447
int input_buffer_frames = nearest_shift(uint32_t(float(input_latency) * feed->get_sample_rate() / 1000.0));
448-
int input_buffer_size = input_buffer_frames * feed->get_channels_per_frame();
448+
int input_buffer_size = input_buffer_frames * feed->get_channels();
449449

450450
pa_buffer_attr _pa_stream_attributes = {};
451451
_pa_stream_attributes.maxlength = (uint32_t)-1;

platform/macos/detect.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ def configure(env: "SConsEnvironment"):
215215
"-framework",
216216
"AudioUnit",
217217
"-framework",
218+
"AudioToolbox",
219+
"-framework",
218220
"CoreAudio",
219221
"-framework",
220222
"CoreMIDI",

servers/microphone/microphone_feed.cpp

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@
3232

3333
#include "core/object/class_db.h"
3434
#include "core/object/object.h"
35+
#include "core/string/string_builder.h"
3536
#include "servers/microphone/microphone_driver.h"
3637
#include "servers/microphone/microphone_server.h"
3738

3839
void MicrophoneFeed::update_ring_buffer_size() {
39-
uint64_t new_ring_buffer_size = (uint64_t)(buffer_length * sample_rate) * channels_per_frame * (bit_depth / 8);
40+
uint64_t new_ring_buffer_size = (uint64_t)(buffer_length * sample_rate) * channels * (bit_depth / 8);
4041
if (new_ring_buffer_size == ring_buffer_size) {
4142
return;
4243
}
@@ -78,9 +79,61 @@ void MicrophoneFeed::deactivate_feed() {
7879
MicrophoneDriver::get_singleton()->deactivate_feed(this);
7980
}
8081

82+
String MicrophoneFeed::get_human_readable_explanation() {
83+
const String INDENT = String(" ").repeat(2);
84+
const String YES = "yes";
85+
const String NO = "no";
86+
#define BOOL_TO_YES_NO(value) (value ? YES : NO)
87+
#define FORMAT_FLAG_TO_YES_NO(flag) BOOL_TO_YES_NO(format_flags.has_flag(MicrophoneFeed::FormatFlag::flag))
88+
89+
StringBuilder root_builder;
90+
root_builder.append(vformat("Name: %s\n", name));
91+
root_builder.append(vformat("Description: %s\n", description));
92+
root_builder.append(vformat("Sample rate: %s\n", sample_rate));
93+
root_builder.append(vformat("Channels: %s\n", channels));
94+
root_builder.append(vformat("Bit depth: %s\n", bit_depth));
95+
String format_id_string;
96+
switch (format_id) {
97+
case FORMAT_ID_UNDEFINED: {
98+
format_id_string = "UNDEFINED [invalid value]";
99+
} break;
100+
case FORMAT_ID_NOT_SUPPORTED: {
101+
format_id_string = vformat("NOT SUPPORTED (%s) [invalid value]", not_supported_format_id_name);
102+
} break;
103+
case FORMAT_ID_ALAW_PCM: {
104+
format_id_string = "A-law PCM";
105+
} break;
106+
case FORMAT_ID_ULAW_PCM: {
107+
format_id_string = "μ-law PCM";
108+
} break;
109+
case FORMAT_ID_LINEAR_PCM: {
110+
format_id_string = "Linear PCM";
111+
} break;
112+
case FORMAT_ID_MAX: {
113+
format_id_string = "MAX [invalid value]";
114+
} break;
115+
}
116+
root_builder.append(vformat("Format id: %s\n", format_id_string));
117+
root_builder.append("Format flags: \n");
118+
StringBuilder flags_builder;
119+
flags_builder.append(vformat("Aligned high: %s\n", FORMAT_FLAG_TO_YES_NO(FORMAT_FLAG_IS_ALIGNED_HIGH)));
120+
flags_builder.append(vformat("Big endian: %s\n", FORMAT_FLAG_TO_YES_NO(FORMAT_FLAG_IS_BIG_ENDIAN)));
121+
flags_builder.append(vformat("Float: %s\n", FORMAT_FLAG_TO_YES_NO(FORMAT_FLAG_IS_FLOAT)));
122+
flags_builder.append(vformat("Interleaved: %s\n", FORMAT_FLAG_TO_YES_NO(FORMAT_FLAG_IS_INTERLEAVED)));
123+
flags_builder.append(vformat("Mixable: %s\n", FORMAT_FLAG_TO_YES_NO(FORMAT_FLAG_IS_MIXABLE)));
124+
flags_builder.append(vformat("Packed: %s\n", FORMAT_FLAG_TO_YES_NO(FORMAT_FLAG_IS_PACKED)));
125+
flags_builder.append(vformat("Signed integer: %s\n", FORMAT_FLAG_TO_YES_NO(FORMAT_FLAG_IS_SIGNED_INTEGER)));
126+
root_builder.append(flags_builder.as_string().indent(INDENT));
127+
128+
return root_builder.as_string();
129+
130+
#undef FORMAT_FLAG_TO_YES_NO
131+
#undef BOOL_TO_YES_NO
132+
}
133+
81134
MicrophoneFeed::MicrophoneFeed() {
82135
id = -1;
83-
name = "???";
136+
name = "<uninitialized>";
84137
}
85138

86139
MicrophoneFeed::~MicrophoneFeed() {
@@ -100,47 +153,57 @@ void MicrophoneFeed::_bind_methods() {
100153
ClassDB::bind_method(D_METHOD("set_format_id", "format_id"), &MicrophoneFeed::set_format_id);
101154
ClassDB::bind_method(D_METHOD("get_format_flags"), &MicrophoneFeed::get_format_flags);
102155
ClassDB::bind_method(D_METHOD("set_format_flags", "format_flags"), &MicrophoneFeed::set_format_flags);
156+
ClassDB::bind_method(D_METHOD("get_not_supported_format_id_name"), &MicrophoneFeed::get_not_supported_format_id_name);
157+
ClassDB::bind_method(D_METHOD("set_not_supported_format_id_name", "not_supported_format_id_name"), &MicrophoneFeed::set_not_supported_format_id_name);
103158

104159
ClassDB::bind_method(D_METHOD("get_sample_rate"), &MicrophoneFeed::get_sample_rate);
105160
ClassDB::bind_method(D_METHOD("set_sample_rate", "sample_rate"), &MicrophoneFeed::set_sample_rate);
106161
ClassDB::bind_method(D_METHOD("get_buffer_length"), &MicrophoneFeed::get_buffer_length);
107162
ClassDB::bind_method(D_METHOD("set_buffer_length", "buffer_length"), &MicrophoneFeed::set_buffer_length);
108-
ClassDB::bind_method(D_METHOD("get_channels_per_frame"), &MicrophoneFeed::get_channels_per_frame);
109-
ClassDB::bind_method(D_METHOD("set_channels_per_frame", "channels_per_frame"), &MicrophoneFeed::set_channels_per_frame);
163+
ClassDB::bind_method(D_METHOD("get_channels"), &MicrophoneFeed::get_channels);
164+
ClassDB::bind_method(D_METHOD("set_channels", "channels"), &MicrophoneFeed::set_channels);
110165
ClassDB::bind_method(D_METHOD("get_bit_depth"), &MicrophoneFeed::get_bit_depth);
111166
ClassDB::bind_method(D_METHOD("set_bit_depth", "bit_depth"), &MicrophoneFeed::set_bit_depth);
112167
ClassDB::bind_method(D_METHOD("get_bytes_per_frame"), &MicrophoneFeed::get_bytes_per_frame);
113168

114169
ClassDB::bind_method(D_METHOD("get_buffer"), &MicrophoneFeed::get_buffer);
115170
ClassDB::bind_method(D_METHOD("clear_buffer"), &MicrophoneFeed::clear_buffer);
116171

172+
ClassDB::bind_method(D_METHOD("get_human_readable_explanation"), &MicrophoneFeed::get_human_readable_explanation);
173+
117174
GDVIRTUAL_BIND(_activate_feed);
118175
GDVIRTUAL_BIND(_deactivate_feed);
119176

120177
ADD_PROPERTY(PropertyInfo(Variant::STRING, "name"), "set_name", "get_name");
121178
ADD_PROPERTY(PropertyInfo(Variant::STRING, "description"), "set_description", "get_description");
122179

180+
ADD_PROPERTY(PropertyInfo(Variant::INT, "format_id", PROPERTY_HINT_ENUM, "Undefined,Not Supported,A-law PCM,μ-law PCM,Linear PCM"), "set_format_id", "get_format_id");
181+
ADD_PROPERTY(PropertyInfo(Variant::INT, "format_flags", PROPERTY_HINT_FLAGS, "Is Aligned High,Is Big Endian,Is Float,Is Interleaved,Is Mixable,Is Packed,Is Signed Integer"), "set_format_flags", "get_format_flags");
182+
ADD_PROPERTY(PropertyInfo(Variant::STRING, "not_supported_format_id_name", PROPERTY_HINT_FLAGS), "set_not_supported_format_id_name", "get_not_supported_format_id_name");
183+
123184
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sample_rate"), "set_sample_rate", "get_sample_rate");
124185
ADD_PROPERTY(PropertyInfo(Variant::INT, "buffer_length"), "set_buffer_length", "get_buffer_length");
125-
ADD_PROPERTY(PropertyInfo(Variant::INT, "channels_per_frame"), "set_channels_per_frame", "get_channels_per_frame");
186+
ADD_PROPERTY(PropertyInfo(Variant::INT, "channels"), "set_channels", "get_channels");
126187
ADD_PROPERTY(PropertyInfo(Variant::INT, "bit_depth"), "set_bit_depth", "get_bit_depth");
127188

128189
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "is_active");
129190

130191
ADD_SIGNAL(MethodInfo(SNAME("activated")));
131192
ADD_SIGNAL(MethodInfo(SNAME("deactivated")));
132193

133-
BIND_ENUM_CONSTANT(FORMAT_ID_ALAW);
134-
BIND_ENUM_CONSTANT(FORMAT_ID_ULAW);
194+
BIND_ENUM_CONSTANT(FORMAT_ID_UNDEFINED);
195+
BIND_ENUM_CONSTANT(FORMAT_ID_NOT_SUPPORTED);
196+
BIND_ENUM_CONSTANT(FORMAT_ID_ALAW_PCM);
197+
BIND_ENUM_CONSTANT(FORMAT_ID_ULAW_PCM);
135198
BIND_ENUM_CONSTANT(FORMAT_ID_LINEAR_PCM);
136199
BIND_ENUM_CONSTANT(FORMAT_ID_MAX);
137200

138201
BIND_BITFIELD_FLAG(FORMAT_FLAG_NONE);
139202
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_ALIGNED_HIGH);
140203
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_BIG_ENDIAN);
141204
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_FLOAT);
142-
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_NON_INTERLEAVED);
143-
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_NON_MIXABLE);
205+
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_INTERLEAVED);
206+
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_MIXABLE);
144207
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_PACKED);
145208
BIND_BITFIELD_FLAG(FORMAT_FLAG_IS_SIGNED_INTEGER);
146209
BIND_BITFIELD_FLAG(FORMAT_FLAG_ALL);

0 commit comments

Comments
 (0)