Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two speakers interfere with each other #144

Open
wellcoming opened this issue Mar 6, 2023 · 1 comment
Open

Two speakers interfere with each other #144

wellcoming opened this issue Mar 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@wellcoming
Copy link

wellcoming commented Mar 6, 2023

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
@wellcoming wellcoming added the bug Something isn't working label Mar 6, 2023
@wellcoming
Copy link
Author

When I use two computers to control the speakers, it can work normally.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant