Advertisement
Marlingaming

CC Tweaked Movie Projector

Feb 24th, 2022 (edited)
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. local tArg = {...}
  2. local FolderPath = tArg[2]
  3. local FrameRate = 1
  4. local Frames = {}
  5. local Audio
  6. local monitor = peripheral.find("monitor")
  7. term.clear()
  8.  
  9. function Play()
  10. for i = 1, #List do
  11. local Image = paintutils.loadImage(fs.combine(FolderPath,List[i]))
  12. paintutils.drawImage(Image,1,1)
  13. os.sleep(FrameRate)
  14. end
  15. end
  16.  
  17. function PlayAudio()
  18. local dfpwm = require "cc.audio.dfpwm"
  19. local decoder = dfpwm.make_decoder()
  20. local speaker = peripheral.find("speaker")
  21. for input in io.lines(Audio, 16 * 1024) do
  22. local decoded = decoder(input)
  23. rednet.broadcast(textutils.serialize(decoded))
  24. end
  25. end
  26.  
  27. function Movie()
  28. term.redirect(monitor)
  29. parallel.waitForAll(Play,PlayAudio)
  30. end
  31.  
  32. function GetFile()
  33. local Path = fs.open(fs.combine(FolderPath,"Data.txt"),"r")
  34. FrameRate = file.readLine()
  35. Audio = file.readLine()
  36. local Content
  37. repeat
  38. Content = file.readLine()
  39. Frames[#Frames + 1] = Content
  40. until Content == nil
  41. Movie()
  42. end
  43.  
  44. rednet.open("top")
  45. GetFile()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement