ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: LostVint on Mar 07, 2021, 12:49 PM

Title: Multiple Wireless Speakers
Post by: LostVint on Mar 07, 2021, 12:49 PM
I'm trying to make it so I can have multiple wireless speakers throughout my base, and they would all play the same sound at the same time from my jukebox program. The problem I'm running into is that only the speaker closest to the computer sending the rednet message is playing any sound. How would I make multiple speakers all play at the same time?
Title: Multiple Wireless Speakers
Post by: Lupus590 on Mar 07, 2021, 01:51 PM
How are you getting a wireless speaker setup? Peripherals cannot be wireless without using workarounds.

Once you have all the speakers connected to the jukebox computer (either via a workaround or wired) you should just need to send the same signal to all the speakers whenever you send it to one. You could do this via a fake peripheral, which is basically what the workaround for wireless peripherals does. This fake peripheral would replicate the action acted onto it on each of the real peripherals that it's wrapped.
Title: Multiple Wireless Speakers
Post by: LostVint on Mar 08, 2021, 07:17 AM
Quote from: Lupus590 on Mar 07, 2021, 01:51 PMHow are you getting a wireless speaker setup? Peripherals cannot be wireless without using workarounds.

Once you have all the speakers connected to the jukebox computer (either via a workaround or wired) you should just need to send the same signal to all the speakers whenever you send it to one. You could do this via a fake peripheral, which is basically what the workaround for wireless peripherals does. This fake peripheral would replicate the action acted onto it on each of the real peripherals that it's wrapped.

Right now I have it set up so that there is a different computer connected to each speaker that receives messages wirelessly from the jukebox computer and plays a song based on the message it received. It seems to only play sound on the computer+speaker closest to the jukebox computer.
Title: Multiple Wireless Speakers
Post by: Lupus590 on Mar 08, 2021, 02:16 PM
Post your code and I'll look at it.
Title: Multiple Wireless Speakers
Post by: LostVint on Mar 09, 2021, 10:03 AM
Quote from: Lupus590 on Mar 08, 2021, 02:16 PMPost your code and I'll look at it.

https://github.com/LostVint/CCbaseDJ/tree/main

Here it is, I'm only 2 weeks into lua and 3 months into coding so it's probably way longer and jankier than it needs to be.
Title: Multiple Wireless Speakers
Post by: Lupus590 on Mar 09, 2021, 03:46 PM
I'm going to assume that you have the peripherals in the right places.

I've also realised that if you have your base at very low y levels then you might be hitting the wireless modem distance limit, You could try having a few computers with the repeat program around.

I'm not seeing any obvious issues with the code, There are some places where it could be made cleaner, but that shouldn't be causing the issues that you are having.