MCPcopy Create free account
hub / github.com/FunAudioLLM/Fun-Audio-Chat / initState

Method initState

web_demo/client/src/audio-processor.ts:81–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79 }
80
81 initState() {
82 // 音频队列 - 存储所有待播放的音频帧
83 this.audioQueue = [];
84 this.totalQueuedSamples = 0;
85
86 // 当前帧的播放偏移
87 this.currentFrameOffset = 0;
88
89 // 播放状态
90 this.isPlaying = false;
91 this.startupCountdown = 0; // 启动倒计时
92 this.isFirstOutput = false;
93
94 // 播放位置(已播放的样本数)
95 this.playbackPosition = 0;
96
97 // 统计指标
98 this.totalAudioPlayed = 0; // 总播放时长(含静音)
99 this.actualAudioPlayed = 0; // 实际播放时长
100 this.maxDelay = 0;
101 this.minDelay = 9999;
102
103 // 调试
104 this.packetCount = 0;
105 this.underrunCount = 0;
106
107 console.log("[AudioProcessor] State initialized");
108 }
109
110 timestamp() {
111 return `[${Date.now() % 10000}]`;

Callers 1

constructorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected