Advertisement
DOGGYWOOF

Untitled

Aug 5th, 2024 (edited)
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. -- Load the dfpwm library and find the speaker
  2. local dfpwm = require("cc.audio.dfpwm")
  3. local speaker = peripheral.find("speaker")
  4.  
  5. -- Function to play sound
  6. local function playSound(filename)
  7. local decoder = dfpwm.make_decoder()
  8. local file = fs.open(filename, "rb")
  9.  
  10. while true do
  11. local chunk = file.read(16 * 1024)
  12. if not chunk then break end
  13. local buffer = decoder(chunk)
  14.  
  15. while not speaker.playAudio(buffer) do
  16. os.pullEvent("speaker_audio_empty")
  17. end
  18. end
  19.  
  20. file.close()
  21. end
  22.  
  23. -- Function to display the Windows 11 boot screen on the computer terminal
  24. local function displayBootScreen()
  25. term.clear()
  26. term.setCursorPos(1, 1)
  27. term.setTextColor(colors.white)
  28. term.setBackgroundColor(colors.black)
  29.  
  30. print("Starting Windows 11...")
  31. print()
  32. print("Please wait while we prepare your system...")
  33. end
  34.  
  35. -- Main function
  36. local function main()
  37. displayBootScreen()
  38. sleep(2) -- Show the boot screen for 2 seconds
  39. playSound("data/sound.dfpwm")
  40. end
  41.  
  42. -- Run the main function
  43. main()
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement