import { AudioFrame } from "@livekit/rtc-node";
import { traceTypes } from "../telemetry/index.js";
function createSilenceFrame(duration, sampleRate, numChannels = 1) {
  const samples = Math.floor(duration * sampleRate / 1e3);
  return new AudioFrame(new Int16Array(samples * numChannels), sampleRate, numChannels, samples);
}
function createSilenceFrameLike(frame) {
  return new AudioFrame(
    new Int16Array(frame.samplesPerChannel * frame.channels),
    frame.sampleRate,
    frame.channels,
    frame.samplesPerChannel
  );
}
function setParticipantSpanAttributes(span, participant) {
  if (participant.sid) {
    span.setAttribute(traceTypes.ATTR_PARTICIPANT_ID, participant.sid);
  }
  span.setAttribute(traceTypes.ATTR_PARTICIPANT_IDENTITY, participant.identity);
  span.setAttribute(traceTypes.ATTR_PARTICIPANT_KIND, participantKindName(participant.kind));
}
function participantKindName(kind) {
  const names = {
    0: "STANDARD",
    1: "INGRESS",
    2: "EGRESS",
    3: "SIP",
    4: "AGENT",
    5: "CONNECTOR"
  };
  return names[kind] ?? String(kind);
}
export {
  createSilenceFrame,
  createSilenceFrameLike,
  setParticipantSpanAttributes
};
//# sourceMappingURL=utils.js.map