Skip to content

Two speakers interfere with each other #144

@wellcoming

Description

@wellcoming

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
2023-03-06.17-47-16.1.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions