@livekit/rtc-node 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,166 @@
1
+ // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import { AudioFrame } from './audio_frame';
5
+ import { FfiClient, FfiHandle } from './ffi_client';
6
+ import type {
7
+ FlushSoxResamplerResponse,
8
+ NewSoxResamplerResponse,
9
+ PushSoxResamplerResponse,
10
+ } from './proto/audio_frame_pb';
11
+ import {
12
+ FlushSoxResamplerRequest,
13
+ NewSoxResamplerRequest,
14
+ PushSoxResamplerRequest,
15
+ SoxQualityRecipe,
16
+ SoxResamplerDataType,
17
+ } from './proto/audio_frame_pb';
18
+
19
+ /**
20
+ * Resampler quality. Higher quality settings result in better audio quality but require more
21
+ * processing power.
22
+ */
23
+ export enum AudioResamplerQuality {
24
+ QUICK = SoxQualityRecipe.SOXR_QUALITY_QUICK,
25
+ LOW = SoxQualityRecipe.SOXR_QUALITY_LOW,
26
+ MEDIUM = SoxQualityRecipe.SOXR_QUALITY_MEDIUM,
27
+ HIGH = SoxQualityRecipe.SOXR_QUALITY_HIGH,
28
+ VERY_HIGH = SoxQualityRecipe.SOXR_QUALITY_VERYHIGH,
29
+ }
30
+
31
+ /**
32
+ * AudioResampler provides functionality to resample audio data from an input sample rate to
33
+ * an output sample rate using the Sox resampling library. It supports multiple channels and
34
+ * configurable resampling quality.
35
+ */
36
+ export class AudioResampler {
37
+ #inputRate: number;
38
+ #outputRate: number;
39
+ #channels: number;
40
+ #ffiHandle: FfiHandle;
41
+
42
+ /**
43
+ * Initializes a new AudioResampler.
44
+ *
45
+ * @param inputRate - The sample rate of the input audio data (in Hz).
46
+ * @param outputRate - The desired sample rate of the output audio data (in Hz).
47
+ * @param channels - The number of audio channels (e.g., 1 for mono, 2 for stereo). Defaults to 1.
48
+ * @param quality - The quality setting for the resampler. Defaults to
49
+ * `AudioResamplerQuality.MEDIUM`.
50
+ */
51
+ constructor(
52
+ inputRate: number,
53
+ outputRate: number,
54
+ channels = 1,
55
+ quality = AudioResamplerQuality.MEDIUM,
56
+ ) {
57
+ this.#inputRate = inputRate;
58
+ this.#outputRate = outputRate;
59
+ this.#channels = channels;
60
+
61
+ const req = new NewSoxResamplerRequest({
62
+ inputRate,
63
+ outputRate,
64
+ numChannels: channels,
65
+ qualityRecipe: quality as unknown as SoxQualityRecipe,
66
+ inputDataType: SoxResamplerDataType.SOXR_DATATYPE_INT16I,
67
+ outputDataType: SoxResamplerDataType.SOXR_DATATYPE_INT16I,
68
+ flags: 0,
69
+ });
70
+
71
+ const res = FfiClient.instance.request<NewSoxResamplerResponse>({
72
+ message: {
73
+ case: 'newSoxResampler',
74
+ value: req,
75
+ },
76
+ });
77
+
78
+ if (res.error) {
79
+ throw new Error(res.error);
80
+ }
81
+
82
+ this.#ffiHandle = new FfiHandle(res.resampler.handle.id);
83
+ }
84
+
85
+ /**
86
+ * Push audio data into the resampler and retrieve any available resampled data.
87
+ *
88
+ * This method accepts audio data, resamples it according to the configured input and output rates,
89
+ * and returns any resampled data that is available after processing the input.
90
+ *
91
+ * @param data - The audio frame to resample
92
+ *
93
+ * @returns A list of {@link AudioFrame} objects containing the resampled audio data. The list may
94
+ * be empty if no output data is available yet.
95
+ */
96
+ push(data: AudioFrame): AudioFrame[] {
97
+ const req = new PushSoxResamplerRequest({
98
+ resamplerHandle: this.#ffiHandle.handle,
99
+ dataPtr: data.protoInfo().dataPtr,
100
+ size: data.data.length,
101
+ });
102
+
103
+ const res = FfiClient.instance.request<PushSoxResamplerResponse>({
104
+ message: {
105
+ case: 'pushSoxResampler',
106
+ value: req,
107
+ },
108
+ });
109
+
110
+ if (res.error) {
111
+ throw new Error(res.error);
112
+ }
113
+
114
+ if (res.outputPtr) {
115
+ return [];
116
+ }
117
+
118
+ const outputData = FfiClient.instance.copyBuffer(res.outputPtr, res.size);
119
+ return [
120
+ new AudioFrame(
121
+ new Int16Array(outputData.subarray()),
122
+ this.#outputRate,
123
+ this.#channels,
124
+ Math.trunc(outputData.length / this.#channels / 2),
125
+ ),
126
+ ];
127
+ }
128
+
129
+ /**
130
+ * Flush any remaining audio data through the resampler and retrieve the resampled data.
131
+ *
132
+ * @remarks
133
+ * This method should be called when no more input data will be provided to ensure that all
134
+ * internal buffers are processed and all resampled data is output.
135
+ */
136
+ flush(): AudioFrame[] {
137
+ const req = new FlushSoxResamplerRequest({
138
+ resamplerHandle: this.#ffiHandle.handle,
139
+ });
140
+
141
+ const res = FfiClient.instance.request<FlushSoxResamplerResponse>({
142
+ message: {
143
+ case: 'flushSoxResampler',
144
+ value: req,
145
+ },
146
+ });
147
+
148
+ if (res.error) {
149
+ throw new Error(res.error);
150
+ }
151
+
152
+ if (res.outputPtr) {
153
+ return [];
154
+ }
155
+
156
+ const outputData = FfiClient.instance.copyBuffer(res.outputPtr, res.size);
157
+ return [
158
+ new AudioFrame(
159
+ new Int16Array(outputData.subarray()),
160
+ this.#outputRate,
161
+ this.#channels,
162
+ Math.trunc(outputData.length / this.#channels / 2),
163
+ ),
164
+ ];
165
+ }
166
+ }
@@ -22,6 +22,122 @@ import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
22
22
  import { TrackSource } from "./track_pb.js";
23
23
  import { FfiOwnedHandle } from "./handle_pb.js";
24
24
 
25
+ /**
26
+ * @generated from enum livekit.proto.SoxResamplerDataType
27
+ */
28
+ export enum SoxResamplerDataType {
29
+ /**
30
+ * TODO(theomonnom): support other datatypes (shouldn't really be needed)
31
+ *
32
+ * @generated from enum value: SOXR_DATATYPE_INT16I = 0;
33
+ */
34
+ SOXR_DATATYPE_INT16I = 0,
35
+
36
+ /**
37
+ * @generated from enum value: SOXR_DATATYPE_INT16S = 1;
38
+ */
39
+ SOXR_DATATYPE_INT16S = 1,
40
+ }
41
+ // Retrieve enum metadata with: proto3.getEnumType(SoxResamplerDataType)
42
+ proto3.util.setEnumType(SoxResamplerDataType, "livekit.proto.SoxResamplerDataType", [
43
+ { no: 0, name: "SOXR_DATATYPE_INT16I" },
44
+ { no: 1, name: "SOXR_DATATYPE_INT16S" },
45
+ ]);
46
+
47
+ /**
48
+ * @generated from enum livekit.proto.SoxQualityRecipe
49
+ */
50
+ export enum SoxQualityRecipe {
51
+ /**
52
+ * @generated from enum value: SOXR_QUALITY_QUICK = 0;
53
+ */
54
+ SOXR_QUALITY_QUICK = 0,
55
+
56
+ /**
57
+ * @generated from enum value: SOXR_QUALITY_LOW = 1;
58
+ */
59
+ SOXR_QUALITY_LOW = 1,
60
+
61
+ /**
62
+ * @generated from enum value: SOXR_QUALITY_MEDIUM = 2;
63
+ */
64
+ SOXR_QUALITY_MEDIUM = 2,
65
+
66
+ /**
67
+ * @generated from enum value: SOXR_QUALITY_HIGH = 3;
68
+ */
69
+ SOXR_QUALITY_HIGH = 3,
70
+
71
+ /**
72
+ * @generated from enum value: SOXR_QUALITY_VERYHIGH = 4;
73
+ */
74
+ SOXR_QUALITY_VERYHIGH = 4,
75
+ }
76
+ // Retrieve enum metadata with: proto3.getEnumType(SoxQualityRecipe)
77
+ proto3.util.setEnumType(SoxQualityRecipe, "livekit.proto.SoxQualityRecipe", [
78
+ { no: 0, name: "SOXR_QUALITY_QUICK" },
79
+ { no: 1, name: "SOXR_QUALITY_LOW" },
80
+ { no: 2, name: "SOXR_QUALITY_MEDIUM" },
81
+ { no: 3, name: "SOXR_QUALITY_HIGH" },
82
+ { no: 4, name: "SOXR_QUALITY_VERYHIGH" },
83
+ ]);
84
+
85
+ /**
86
+ * @generated from enum livekit.proto.SoxFlagBits
87
+ */
88
+ export enum SoxFlagBits {
89
+ /**
90
+ * 1 << 0
91
+ *
92
+ * @generated from enum value: SOXR_ROLLOFF_SMALL = 0;
93
+ */
94
+ SOXR_ROLLOFF_SMALL = 0,
95
+
96
+ /**
97
+ * 1 << 1
98
+ *
99
+ * @generated from enum value: SOXR_ROLLOFF_MEDIUM = 1;
100
+ */
101
+ SOXR_ROLLOFF_MEDIUM = 1,
102
+
103
+ /**
104
+ * 1 << 2
105
+ *
106
+ * @generated from enum value: SOXR_ROLLOFF_NONE = 2;
107
+ */
108
+ SOXR_ROLLOFF_NONE = 2,
109
+
110
+ /**
111
+ * 1 << 3
112
+ *
113
+ * @generated from enum value: SOXR_HIGH_PREC_CLOCK = 3;
114
+ */
115
+ SOXR_HIGH_PREC_CLOCK = 3,
116
+
117
+ /**
118
+ * 1 << 4
119
+ *
120
+ * @generated from enum value: SOXR_DOUBLE_PRECISION = 4;
121
+ */
122
+ SOXR_DOUBLE_PRECISION = 4,
123
+
124
+ /**
125
+ * 1 << 5
126
+ *
127
+ * @generated from enum value: SOXR_VR = 5;
128
+ */
129
+ SOXR_VR = 5,
130
+ }
131
+ // Retrieve enum metadata with: proto3.getEnumType(SoxFlagBits)
132
+ proto3.util.setEnumType(SoxFlagBits, "livekit.proto.SoxFlagBits", [
133
+ { no: 0, name: "SOXR_ROLLOFF_SMALL" },
134
+ { no: 1, name: "SOXR_ROLLOFF_MEDIUM" },
135
+ { no: 2, name: "SOXR_ROLLOFF_NONE" },
136
+ { no: 3, name: "SOXR_HIGH_PREC_CLOCK" },
137
+ { no: 4, name: "SOXR_DOUBLE_PRECISION" },
138
+ { no: 5, name: "SOXR_VR" },
139
+ ]);
140
+
25
141
  /**
26
142
  * @generated from enum livekit.proto.AudioStreamType
27
143
  */
@@ -707,6 +823,318 @@ export class RemixAndResampleResponse extends Message<RemixAndResampleResponse>
707
823
  }
708
824
  }
709
825
 
826
+ /**
827
+ * @generated from message livekit.proto.NewSoxResamplerRequest
828
+ */
829
+ export class NewSoxResamplerRequest extends Message<NewSoxResamplerRequest> {
830
+ /**
831
+ * @generated from field: double input_rate = 1;
832
+ */
833
+ inputRate = 0;
834
+
835
+ /**
836
+ * @generated from field: double output_rate = 2;
837
+ */
838
+ outputRate = 0;
839
+
840
+ /**
841
+ * @generated from field: uint32 num_channels = 3;
842
+ */
843
+ numChannels = 0;
844
+
845
+ /**
846
+ * @generated from field: livekit.proto.SoxResamplerDataType input_data_type = 4;
847
+ */
848
+ inputDataType = SoxResamplerDataType.SOXR_DATATYPE_INT16I;
849
+
850
+ /**
851
+ * @generated from field: livekit.proto.SoxResamplerDataType output_data_type = 5;
852
+ */
853
+ outputDataType = SoxResamplerDataType.SOXR_DATATYPE_INT16I;
854
+
855
+ /**
856
+ * @generated from field: livekit.proto.SoxQualityRecipe quality_recipe = 6;
857
+ */
858
+ qualityRecipe = SoxQualityRecipe.SOXR_QUALITY_QUICK;
859
+
860
+ /**
861
+ * @generated from field: uint32 flags = 7;
862
+ */
863
+ flags = 0;
864
+
865
+ constructor(data?: PartialMessage<NewSoxResamplerRequest>) {
866
+ super();
867
+ proto3.util.initPartial(data, this);
868
+ }
869
+
870
+ static readonly runtime: typeof proto3 = proto3;
871
+ static readonly typeName = "livekit.proto.NewSoxResamplerRequest";
872
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
873
+ { no: 1, name: "input_rate", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ },
874
+ { no: 2, name: "output_rate", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ },
875
+ { no: 3, name: "num_channels", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
876
+ { no: 4, name: "input_data_type", kind: "enum", T: proto3.getEnumType(SoxResamplerDataType) },
877
+ { no: 5, name: "output_data_type", kind: "enum", T: proto3.getEnumType(SoxResamplerDataType) },
878
+ { no: 6, name: "quality_recipe", kind: "enum", T: proto3.getEnumType(SoxQualityRecipe) },
879
+ { no: 7, name: "flags", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
880
+ ]);
881
+
882
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): NewSoxResamplerRequest {
883
+ return new NewSoxResamplerRequest().fromBinary(bytes, options);
884
+ }
885
+
886
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): NewSoxResamplerRequest {
887
+ return new NewSoxResamplerRequest().fromJson(jsonValue, options);
888
+ }
889
+
890
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): NewSoxResamplerRequest {
891
+ return new NewSoxResamplerRequest().fromJsonString(jsonString, options);
892
+ }
893
+
894
+ static equals(a: NewSoxResamplerRequest | PlainMessage<NewSoxResamplerRequest> | undefined, b: NewSoxResamplerRequest | PlainMessage<NewSoxResamplerRequest> | undefined): boolean {
895
+ return proto3.util.equals(NewSoxResamplerRequest, a, b);
896
+ }
897
+ }
898
+
899
+ /**
900
+ * @generated from message livekit.proto.NewSoxResamplerResponse
901
+ */
902
+ export class NewSoxResamplerResponse extends Message<NewSoxResamplerResponse> {
903
+ /**
904
+ * @generated from field: livekit.proto.OwnedSoxResampler resampler = 1;
905
+ */
906
+ resampler?: OwnedSoxResampler;
907
+
908
+ /**
909
+ * @generated from field: optional string error = 2;
910
+ */
911
+ error?: string;
912
+
913
+ constructor(data?: PartialMessage<NewSoxResamplerResponse>) {
914
+ super();
915
+ proto3.util.initPartial(data, this);
916
+ }
917
+
918
+ static readonly runtime: typeof proto3 = proto3;
919
+ static readonly typeName = "livekit.proto.NewSoxResamplerResponse";
920
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
921
+ { no: 1, name: "resampler", kind: "message", T: OwnedSoxResampler },
922
+ { no: 2, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
923
+ ]);
924
+
925
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): NewSoxResamplerResponse {
926
+ return new NewSoxResamplerResponse().fromBinary(bytes, options);
927
+ }
928
+
929
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): NewSoxResamplerResponse {
930
+ return new NewSoxResamplerResponse().fromJson(jsonValue, options);
931
+ }
932
+
933
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): NewSoxResamplerResponse {
934
+ return new NewSoxResamplerResponse().fromJsonString(jsonString, options);
935
+ }
936
+
937
+ static equals(a: NewSoxResamplerResponse | PlainMessage<NewSoxResamplerResponse> | undefined, b: NewSoxResamplerResponse | PlainMessage<NewSoxResamplerResponse> | undefined): boolean {
938
+ return proto3.util.equals(NewSoxResamplerResponse, a, b);
939
+ }
940
+ }
941
+
942
+ /**
943
+ * @generated from message livekit.proto.PushSoxResamplerRequest
944
+ */
945
+ export class PushSoxResamplerRequest extends Message<PushSoxResamplerRequest> {
946
+ /**
947
+ * @generated from field: uint64 resampler_handle = 1;
948
+ */
949
+ resamplerHandle = protoInt64.zero;
950
+
951
+ /**
952
+ * *const i16
953
+ *
954
+ * @generated from field: uint64 data_ptr = 2;
955
+ */
956
+ dataPtr = protoInt64.zero;
957
+
958
+ /**
959
+ * in bytes
960
+ *
961
+ * @generated from field: uint32 size = 3;
962
+ */
963
+ size = 0;
964
+
965
+ constructor(data?: PartialMessage<PushSoxResamplerRequest>) {
966
+ super();
967
+ proto3.util.initPartial(data, this);
968
+ }
969
+
970
+ static readonly runtime: typeof proto3 = proto3;
971
+ static readonly typeName = "livekit.proto.PushSoxResamplerRequest";
972
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
973
+ { no: 1, name: "resampler_handle", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
974
+ { no: 2, name: "data_ptr", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
975
+ { no: 3, name: "size", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
976
+ ]);
977
+
978
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PushSoxResamplerRequest {
979
+ return new PushSoxResamplerRequest().fromBinary(bytes, options);
980
+ }
981
+
982
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PushSoxResamplerRequest {
983
+ return new PushSoxResamplerRequest().fromJson(jsonValue, options);
984
+ }
985
+
986
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PushSoxResamplerRequest {
987
+ return new PushSoxResamplerRequest().fromJsonString(jsonString, options);
988
+ }
989
+
990
+ static equals(a: PushSoxResamplerRequest | PlainMessage<PushSoxResamplerRequest> | undefined, b: PushSoxResamplerRequest | PlainMessage<PushSoxResamplerRequest> | undefined): boolean {
991
+ return proto3.util.equals(PushSoxResamplerRequest, a, b);
992
+ }
993
+ }
994
+
995
+ /**
996
+ * @generated from message livekit.proto.PushSoxResamplerResponse
997
+ */
998
+ export class PushSoxResamplerResponse extends Message<PushSoxResamplerResponse> {
999
+ /**
1000
+ * *const i16 (could be null)
1001
+ *
1002
+ * @generated from field: uint64 output_ptr = 1;
1003
+ */
1004
+ outputPtr = protoInt64.zero;
1005
+
1006
+ /**
1007
+ * in bytes
1008
+ *
1009
+ * @generated from field: uint32 size = 2;
1010
+ */
1011
+ size = 0;
1012
+
1013
+ /**
1014
+ * @generated from field: optional string error = 3;
1015
+ */
1016
+ error?: string;
1017
+
1018
+ constructor(data?: PartialMessage<PushSoxResamplerResponse>) {
1019
+ super();
1020
+ proto3.util.initPartial(data, this);
1021
+ }
1022
+
1023
+ static readonly runtime: typeof proto3 = proto3;
1024
+ static readonly typeName = "livekit.proto.PushSoxResamplerResponse";
1025
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1026
+ { no: 1, name: "output_ptr", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
1027
+ { no: 2, name: "size", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
1028
+ { no: 3, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
1029
+ ]);
1030
+
1031
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PushSoxResamplerResponse {
1032
+ return new PushSoxResamplerResponse().fromBinary(bytes, options);
1033
+ }
1034
+
1035
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PushSoxResamplerResponse {
1036
+ return new PushSoxResamplerResponse().fromJson(jsonValue, options);
1037
+ }
1038
+
1039
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PushSoxResamplerResponse {
1040
+ return new PushSoxResamplerResponse().fromJsonString(jsonString, options);
1041
+ }
1042
+
1043
+ static equals(a: PushSoxResamplerResponse | PlainMessage<PushSoxResamplerResponse> | undefined, b: PushSoxResamplerResponse | PlainMessage<PushSoxResamplerResponse> | undefined): boolean {
1044
+ return proto3.util.equals(PushSoxResamplerResponse, a, b);
1045
+ }
1046
+ }
1047
+
1048
+ /**
1049
+ * @generated from message livekit.proto.FlushSoxResamplerRequest
1050
+ */
1051
+ export class FlushSoxResamplerRequest extends Message<FlushSoxResamplerRequest> {
1052
+ /**
1053
+ * @generated from field: uint64 resampler_handle = 1;
1054
+ */
1055
+ resamplerHandle = protoInt64.zero;
1056
+
1057
+ constructor(data?: PartialMessage<FlushSoxResamplerRequest>) {
1058
+ super();
1059
+ proto3.util.initPartial(data, this);
1060
+ }
1061
+
1062
+ static readonly runtime: typeof proto3 = proto3;
1063
+ static readonly typeName = "livekit.proto.FlushSoxResamplerRequest";
1064
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1065
+ { no: 1, name: "resampler_handle", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
1066
+ ]);
1067
+
1068
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FlushSoxResamplerRequest {
1069
+ return new FlushSoxResamplerRequest().fromBinary(bytes, options);
1070
+ }
1071
+
1072
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): FlushSoxResamplerRequest {
1073
+ return new FlushSoxResamplerRequest().fromJson(jsonValue, options);
1074
+ }
1075
+
1076
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): FlushSoxResamplerRequest {
1077
+ return new FlushSoxResamplerRequest().fromJsonString(jsonString, options);
1078
+ }
1079
+
1080
+ static equals(a: FlushSoxResamplerRequest | PlainMessage<FlushSoxResamplerRequest> | undefined, b: FlushSoxResamplerRequest | PlainMessage<FlushSoxResamplerRequest> | undefined): boolean {
1081
+ return proto3.util.equals(FlushSoxResamplerRequest, a, b);
1082
+ }
1083
+ }
1084
+
1085
+ /**
1086
+ * @generated from message livekit.proto.FlushSoxResamplerResponse
1087
+ */
1088
+ export class FlushSoxResamplerResponse extends Message<FlushSoxResamplerResponse> {
1089
+ /**
1090
+ * *const i16 (could be null)
1091
+ *
1092
+ * @generated from field: uint64 output_ptr = 1;
1093
+ */
1094
+ outputPtr = protoInt64.zero;
1095
+
1096
+ /**
1097
+ * in bytes
1098
+ *
1099
+ * @generated from field: uint32 size = 2;
1100
+ */
1101
+ size = 0;
1102
+
1103
+ /**
1104
+ * @generated from field: optional string error = 3;
1105
+ */
1106
+ error?: string;
1107
+
1108
+ constructor(data?: PartialMessage<FlushSoxResamplerResponse>) {
1109
+ super();
1110
+ proto3.util.initPartial(data, this);
1111
+ }
1112
+
1113
+ static readonly runtime: typeof proto3 = proto3;
1114
+ static readonly typeName = "livekit.proto.FlushSoxResamplerResponse";
1115
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1116
+ { no: 1, name: "output_ptr", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
1117
+ { no: 2, name: "size", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
1118
+ { no: 3, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
1119
+ ]);
1120
+
1121
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FlushSoxResamplerResponse {
1122
+ return new FlushSoxResamplerResponse().fromBinary(bytes, options);
1123
+ }
1124
+
1125
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): FlushSoxResamplerResponse {
1126
+ return new FlushSoxResamplerResponse().fromJson(jsonValue, options);
1127
+ }
1128
+
1129
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): FlushSoxResamplerResponse {
1130
+ return new FlushSoxResamplerResponse().fromJsonString(jsonString, options);
1131
+ }
1132
+
1133
+ static equals(a: FlushSoxResamplerResponse | PlainMessage<FlushSoxResamplerResponse> | undefined, b: FlushSoxResamplerResponse | PlainMessage<FlushSoxResamplerResponse> | undefined): boolean {
1134
+ return proto3.util.equals(FlushSoxResamplerResponse, a, b);
1135
+ }
1136
+ }
1137
+
710
1138
  /**
711
1139
  * @generated from message livekit.proto.AudioFrameBufferInfo
712
1140
  */
@@ -1214,3 +1642,77 @@ export class OwnedAudioResampler extends Message<OwnedAudioResampler> {
1214
1642
  }
1215
1643
  }
1216
1644
 
1645
+ /**
1646
+ * @generated from message livekit.proto.SoxResamplerInfo
1647
+ */
1648
+ export class SoxResamplerInfo extends Message<SoxResamplerInfo> {
1649
+ constructor(data?: PartialMessage<SoxResamplerInfo>) {
1650
+ super();
1651
+ proto3.util.initPartial(data, this);
1652
+ }
1653
+
1654
+ static readonly runtime: typeof proto3 = proto3;
1655
+ static readonly typeName = "livekit.proto.SoxResamplerInfo";
1656
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1657
+ ]);
1658
+
1659
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SoxResamplerInfo {
1660
+ return new SoxResamplerInfo().fromBinary(bytes, options);
1661
+ }
1662
+
1663
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SoxResamplerInfo {
1664
+ return new SoxResamplerInfo().fromJson(jsonValue, options);
1665
+ }
1666
+
1667
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SoxResamplerInfo {
1668
+ return new SoxResamplerInfo().fromJsonString(jsonString, options);
1669
+ }
1670
+
1671
+ static equals(a: SoxResamplerInfo | PlainMessage<SoxResamplerInfo> | undefined, b: SoxResamplerInfo | PlainMessage<SoxResamplerInfo> | undefined): boolean {
1672
+ return proto3.util.equals(SoxResamplerInfo, a, b);
1673
+ }
1674
+ }
1675
+
1676
+ /**
1677
+ * @generated from message livekit.proto.OwnedSoxResampler
1678
+ */
1679
+ export class OwnedSoxResampler extends Message<OwnedSoxResampler> {
1680
+ /**
1681
+ * @generated from field: livekit.proto.FfiOwnedHandle handle = 1;
1682
+ */
1683
+ handle?: FfiOwnedHandle;
1684
+
1685
+ /**
1686
+ * @generated from field: livekit.proto.SoxResamplerInfo info = 2;
1687
+ */
1688
+ info?: SoxResamplerInfo;
1689
+
1690
+ constructor(data?: PartialMessage<OwnedSoxResampler>) {
1691
+ super();
1692
+ proto3.util.initPartial(data, this);
1693
+ }
1694
+
1695
+ static readonly runtime: typeof proto3 = proto3;
1696
+ static readonly typeName = "livekit.proto.OwnedSoxResampler";
1697
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1698
+ { no: 1, name: "handle", kind: "message", T: FfiOwnedHandle },
1699
+ { no: 2, name: "info", kind: "message", T: SoxResamplerInfo },
1700
+ ]);
1701
+
1702
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): OwnedSoxResampler {
1703
+ return new OwnedSoxResampler().fromBinary(bytes, options);
1704
+ }
1705
+
1706
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): OwnedSoxResampler {
1707
+ return new OwnedSoxResampler().fromJson(jsonValue, options);
1708
+ }
1709
+
1710
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): OwnedSoxResampler {
1711
+ return new OwnedSoxResampler().fromJsonString(jsonString, options);
1712
+ }
1713
+
1714
+ static equals(a: OwnedSoxResampler | PlainMessage<OwnedSoxResampler> | undefined, b: OwnedSoxResampler | PlainMessage<OwnedSoxResampler> | undefined): boolean {
1715
+ return proto3.util.equals(OwnedSoxResampler, a, b);
1716
+ }
1717
+ }
1718
+