Two speakers interfere with each other
wellcoming opened this issue ยท 1 comments
Minecraft Version
1.19.3
Version
1.102.0
Details
At first I thought there was a certain delay between the two speakers (here), but later I found that the two speakers were not playing audio sequentially. As a result, two or more speakers cannot play audio normally at the same time. This phenomenon only occurs on CCR. CCT works normally.
local dfpwm = require("cc.audio.dfpwm")
local s1=peripheral.wrap("speaker_0")
local s2=peripheral.wrap("speaker_1")
local f1=fs.open("test.dfpwm","rb")
local f2=fs.open("test.dfpwm","rb")
local decoder1 = dfpwm.make_decoder()
local decoder2 = dfpwm.make_decoder()
while true do
local buffer1 = decoder1(f1.read(16* 1024))
local buffer2 = decoder2(f2.read(16* 1024))
while not s1.playAudio(buffer1) do os.pullEvent("speaker_audio_empty") end
while not s2.playAudio(buffer2) do os.pullEvent("speaker_audio_empty") end
end