* VRFS-2605 -tested mixer manifest with latest client with jamtrack offsets and all of that

This commit is contained in:
Seth Call 2015-04-22 14:02:44 -05:00
parent 9217e92372
commit 05b4b8f3fa
1 changed files with 35 additions and 11 deletions

View File

@ -4,6 +4,8 @@ module JamRuby
MAX_MIX_TIME = 7200 # 2 hours
@@log = Logging.logger[Mix]
before_destroy :delete_s3_files
self.primary_key = 'id'
@ -156,25 +158,47 @@ module JamRuby
# how long did the JamTrack play? not needed because we limit on the input tracks, which represents how long the recording is, too
jam_track_play_time = recording_timeline_data["jam_track_play_time"]
if jam_track_recording_start_play_offset < 0
# we don't know how to handle this ! alert ops
AdminMailer.alerts({subject: "negative jam_track_recording_start_play_offset mix.id=#{self.id}"})
jam_track_recording_start_play_offset = 0
end
offset = jam_track_play_start_time - recording_start_time
@@log.debug("base offset = #{offset}")
if offset >= 0
# jamtrack started after recording, so buffer with silence as necessary
jam_track_offset = offset
jam_track_seek = jam_track_seek + jam_track_recording_start_play_offset
# jamtrack started after recording, so buffer with silence as necessary\
if jam_track_recording_start_play_offset < 0
@@log.info("prelude captured. offsetting further by #{-jam_track_recording_start_play_offset}")
# a negative jam_track_recording_start_play_offset indicates prelude, i.e., silence
# so add it to the offset to add more silence as necessary
offset = offset + -jam_track_recording_start_play_offset
jam_track_offset = offset
else
@@log.info("positive jamtrack offset; seeking into jamtrack by #{jam_track_recording_start_play_offset}")
# a positive jam_track_recording_start_play_offset means we need to cut into the jamtrack
jam_track_seek = jam_track_recording_start_play_offset
jam_track_offset = offset
end
else
# jamtrack started before recording, so we can seek into it to make up for the missing parts
jam_track_seek = -offset
if jam_track_recording_start_play_offset < 0
@@log.info("partial prelude captured. offset becomes jamtrack offset#{-jam_track_recording_start_play_offset}")
# a negative jam_track_recording_start_play_offset indicates prelude, i.e., silence
# so add it to the offset to add more silence as necessary
jam_track_offset = -jam_track_recording_start_play_offset
else
@@log.info("no prelude captured. offset becomes jamtrack offset=#{jam_track_recording_start_play_offset}")
jam_track_offset = 0
jam_track_seek = jam_track_recording_start_play_offset
end
# also, ignore jam_track_recording_start_play_offset - it simply matches the offset in this case
end
@@log.info("computed values. jam_track_offset=#{jam_track_offset} jam_track_seek=#{jam_track_seek}")
end
end
@ -184,7 +208,7 @@ module JamRuby
# this 'pick limiter' logic will ensure that we set a limiter on the 1st recorded_track we come across.
pick_limiter = false
if recording.is_jamtrack_recording?
if was_jamtrack_played
# we only use the limiter feature if this is a JamTrack recording
# by setting this to true, the 1st recorded_track in the database will be the limiter
pick_limiter = true