1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-13 19:50:31 +00:00
CC-Tweaked/doc/events
Jonathan Coates b048b6666d
Add arbitrary audio support to speakers (#982)
Speakers can now play arbitrary PCM audio, sampled at 48kHz and with a
resolution of 8 bits. Programs can build up buffers of audio locally,
play it using `speaker.playAudio`, where it is encoded to DFPWM, sent
across the network, decoded, and played on the client.

`speaker.playAudio` may return false when a chunk of audio has been
submitted but not yet sent to the client. In this case, the program
should wait for a speaker_audio_empty event and try again, repeating
until it works.

While the API is a little odd, this gives us fantastic flexibility (we
can play arbitrary streams of audio) while still being resilient in the
presence of server lag (either TPS or on the computer thread).

Some other notes:
 - There is a significant buffer on both the client and server, which
   means that sound take several seconds to finish after playing has
   started. One can force it to be stopped playing with the new
  `speaker.stop` call.

 - This also adds a `cc.audio.dfpwm` module, which allows encoding and
   decoding DFPWM1a audio files.

 - I spent so long writing the documentation for this. Who knows if it'll
   be helpful!
2021-12-13 22:56:59 +00:00
..
alarm.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
char.md Add some initial documentation for events 2021-01-14 18:37:20 +00:00
computer_command.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
disk_eject.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
disk.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
http_check.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
http_failure.md Migrate all examples to use tweaked.cc 2021-01-23 14:58:08 +00:00
http_success.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
key_up.md Add some initial documentation for events 2021-01-14 18:37:20 +00:00
key.md Add a pre commit hook to lint code 2021-04-28 21:24:27 +01:00
modem_message.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
monitor_resize.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
monitor_touch.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
mouse_click.md Add some initial documentation for events 2021-01-14 18:37:20 +00:00
mouse_drag.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
mouse_scroll.md Add some initial documentation for events 2021-01-14 18:37:20 +00:00
mouse_up.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
paste.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
peripheral_detach.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
peripheral.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
rednet_message.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
redstone.md Allow peripherals to have multiple types (#963) 2021-11-29 17:37:30 +00:00
speaker_audio_empty.md Add arbitrary audio support to speakers (#982) 2021-12-13 22:56:59 +00:00
task_complete.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
term_resize.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
terminate.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
timer.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
turtle_inventory.md Finish the rest of the event documentation (#683) 2021-01-19 09:20:52 +00:00
websocket_closed.md Migrate all examples to use tweaked.cc 2021-01-23 14:58:08 +00:00
websocket_failure.md Migrate all examples to use tweaked.cc 2021-01-23 14:58:08 +00:00
websocket_message.md Added binary flag to websocket_message docs 2021-09-23 15:20:19 -04:00
websocket_success.md Migrate all examples to use tweaked.cc 2021-01-23 14:58:08 +00:00