From 3fb233fd768f3dbce2a3073ba596458871cec93e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 25 Aug 2013 06:14:08 +0000 Subject: set REPLAYGAIN_* vars for source command as documented We documented this behavior in dtas-player.txt but failed to implement it. Now our behavior matches the documentation! --- test/test_rg_integration.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/test_rg_integration.rb b/test/test_rg_integration.rb index d8a8b85..b9ef2b9 100644 --- a/test/test_rg_integration.rb +++ b/test/test_rg_integration.rb @@ -114,4 +114,34 @@ class TestRgIntegration < Minitest::Unit::TestCase stop_playback(default_pid, s) end + + def test_rg_env_in_source + s = client_socket + s.preq("rg mode=album_gain") + assert_equal "OK", s.readpartial(666) + pluck, len = tmp_pluck + cmd = DTAS::Source::SOURCE_DEFAULTS["command"] + fifo = tmpfifo + s.preq("source ed command='env > #{fifo}; #{cmd}'") + assert_equal "OK", s.readpartial(666) + s.preq("sink ed default command='cat >/dev/null' active=true") + assert_equal "OK", s.readpartial(666) + s.preq(%W(enq #{pluck.path})) + assert_equal "OK", s.readpartial(666) + + rg = {} + File.readlines(fifo).each do |line| + line =~ /\AREPLAYGAIN_/ or next + k, v = line.chomp!.split(/=/) + rg[k] = v + end + expect = { + "REPLAYGAIN_TRACK_GAIN" => "-2", + "REPLAYGAIN_ALBUM_GAIN" => "-3.0", + "REPLAYGAIN_TRACK_PEAK" => "0.666", + "REPLAYGAIN_ALBUM_PEAK" => "0.999", + "REPLAYGAIN_REFERENCE_LOUDNESS" => nil + } + assert_equal expect, rg + end end -- cgit v1.2.3-24-ge0c7