From a462961df2088af99e2e815ad60b8d838c9d062d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 28 Dec 2014 00:43:07 +0000 Subject: source/splitfx: restart source on YAML modifications Since splitfx YAML files are intended to be frequently edited and modified by the user, we'll support automatically restarting the source when the user saves changes via their favorite $EDITOR This change is only for Linux users. However, sleepy_penguin supports kqueue nowadays so a patch to support such functionality would be appreciated. --- lib/dtas/player.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/dtas/player.rb') diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb index 0ae8cef..ea48926 100644 --- a/lib/dtas/player.rb +++ b/lib/dtas/player.rb @@ -385,6 +385,7 @@ class DTAS::Player # :nodoc: end def next_source(source_spec) + @current.respond_to?(:watch_end) and @current.watch_end(@srv) @current = nil if source_spec case source_spec @@ -413,6 +414,12 @@ class DTAS::Player # :nodoc: dst = @sink_buf pending.dst_assoc(dst) pending.spawn(@format, @rg, out: dst.wr, in: "/dev/null") + + # watch and restart on modifications + pending.respond_to?(:watch_begin) and + @srv.wait_ctl(pending.watch_begin(method(:__current_requeue)), + :wait_readable) + @current = pending @srv.wait_ctl(dst, :wait_readable) wall(msg) -- cgit v1.2.3-24-ge0c7