382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
# File 'lib/dtas/player.rb', line 382
def next_source(source_spec)
@current.respond_to?(:watch_end) and @current.watch_end(@srv)
@current = nil
if source_spec
case source_spec
when String
pending = try_file(source_spec) or return
msg = %W(file #{pending.infile})
when Array
pending = try_file(*source_spec) or return
msg = %W(file #{pending.infile} #{pending.offset_samples}s)
else
pending = DTAS::Source::Cmd.new(source_spec["command"])
msg = %W(command #{pending.command_string})
end
if ! @bypass.empty? && pending.respond_to?(:format)
new_fmt = bypass_match!(@format.dup, pending.format)
if new_fmt != @format
stop_sinks
format_update!(new_fmt)
end
end
spawn_sinks(source_spec) or return
dst = @sink_buf
pending.dst_assoc(dst)
pending.src_spawn(@format, @rg, out: dst.wr, in: DTAS.null)
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)
else
player_idle
end
end
|