Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Steven Miers 2015-04-21 18:30:17 -05:00
commit 8f49d7b83f
3 changed files with 48 additions and 20 deletions

View File

@ -139,6 +139,8 @@ module JamRuby
jam_track_offset = 0
jam_track_seek = 0
was_jamtrack_played = false
if recording.timeline
recording_timeline_data = JSON.parse(recording.timeline)
@ -148,27 +150,31 @@ module JamRuby
jam_track_play_start_time = recording_timeline_data["jam_track_play_start_time"]
jam_track_recording_start_play_offset = recording_timeline_data["jam_track_recording_start_play_offset"]
# 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_play_start_time != 0
was_jamtrack_played = true
if jam_track_recording_start_play_offset < 0 && jam_track_isplaying
# 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
# 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"]
offset = jam_track_play_start_time - recording_start_time
if jam_track_recording_start_play_offset < 0 && jam_track_isplaying
# 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
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
else
# jamtrack started before recording, so we can seek into it to make up for the missing parts
jam_track_seek = -offset
offset = jam_track_play_start_time - recording_start_time
# also, ignore jam_track_recording_start_play_offset - it simply matches the offset in this case
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
else
# jamtrack started before recording, so we can seek into it to make up for the missing parts
jam_track_seek = -offset
# also, ignore jam_track_recording_start_play_offset - it simply matches the offset in this case
end
end
end
@ -195,9 +201,9 @@ module JamRuby
mix_params << { "level" => 1.0, "balance" => 0 }
end
if recording.is_jamtrack_recording?
if was_jamtrack_played
recording.recorded_jam_track_tracks.each do |recorded_jam_track_track|
manifest["files"] << { "filename" => recorded_jam_track_track.jam_track_track.sign_url(one_day), "codec" => "vorbis", "offset" => jam_track_offset, "seek" => jam_track_seek }
manifest["files"] << { "filename" => recorded_jam_track_track.jam_track_track.sign_url(one_day, sample_rate=44), "codec" => "vorbis", "offset" => jam_track_offset, "seek" => jam_track_seek }
# let's look for level info from the client
level = 1.0 # default value - means no effect
if recorded_jam_track_track.timeline

View File

@ -202,7 +202,7 @@
positionMs = 0;
}
if(playbackMonitorMode = PLAYBACK_MONITOR_MODE.JAMTRACK) {
if(playbackMonitorMode == PLAYBACK_MONITOR_MODE.JAMTRACK) {
if(isPlaying) {
$jamTrackGetReady.attr('data-current-time', positionMs)

View File

@ -537,6 +537,7 @@
var metronomeMasterMixers = getMetronomeMasterMixers();
if (metronomeMixer == null && metronomeMasterMixers.length > 0) {
logger.debug("monitoring metronome")
playbackControls.startMonitor(context.JK.PLAYBACK_MONITOR_MODE.METRONOME)
}
else if (metronomeMixer != null && metronomeMasterMixers.length == 0) {
@ -550,9 +551,11 @@
// if we have a recording open, then don't go into JamTrack monitor mode even if a JamTrack is open
if (jamTrack == null && (currentSession && currentSession.jam_track != null && currentSession.claimed_recording == null)) {
logger.debug("monitoring jamtrack")
playbackControls.startMonitor(context.JK.PLAYBACK_MONITOR_MODE.JAMTRACK);
}
else if (jamTrack && (currentSession == null || (currentSession.jam_track == null && currentSession.claimed_recording == null))) {
logger.debug("stop monitoring jamtrack")
playbackControls.stopMonitor();
}
jamTrack = currentSession == null ? null : currentSession.jam_track;
@ -561,9 +564,11 @@
function checkBackingTrackTransition(currentSession) {
// handle backing tracks
if (backing_track_path == null && (currentSession && currentSession.backing_track_path != null)) {
logger.debug("monitoring backing track")
playbackControls.startMonitor();
}
else if (backing_track_path && (currentSession == null || currentSession.backing_track_path == null)) {
logger.debug("stop monitoring backing track")
playbackControls.stopMonitor();
}
backing_track_path = currentSession == null ? null : currentSession.backing_track_path;
@ -575,9 +580,11 @@
if (claimedRecording == null && (currentSession && currentSession.claimed_recording != null)) {
// this is a 'started with a claimed_recording' transition.
// we need to start a timer to watch for the state of the play session
logger.debug("monitoring recording")
playbackControls.startMonitor();
}
else if (claimedRecording && (currentSession == null || currentSession.claimed_recording == null)) {
logger.debug("stop monitoring recording")
playbackControls.stopMonitor();
}
claimedRecording = currentSession == null ? null : currentSession.claimed_recording;
@ -2892,6 +2899,12 @@
}
function closeBackingTrack() {
if (sessionModel.recordingModel.isRecording()) {
logger.debug("can't close backing track while recording")
return false;
}
rest.closeBackingTrack({id: sessionModel.id()})
.done(function() {
//sessionModel.refreshCurrentSession(true);
@ -2912,9 +2925,13 @@
}
function closeJamTrack() {
logger.debug("closing recording");
if (sessionModel.recordingModel.isRecording()) {
logger.debug("can't close jamtrack while recording")
return false;
}
if(downloadJamTrack) {
logger.debug("closing DownloadJamTrack widget")
downloadJamTrack.root.remove();
@ -2984,6 +3001,11 @@
function onPause(e, data) {
logger.debug("calling jamClient.SessionStopPlay. endReached:", data.endReached);
// if a JamTrack is open, and the user hits 'pause', we need to automatically stop the recording
if(sessionModel.jamTracks() && sessionModel.recordingModel.isRecording()) {
startStopRecording();
}
if(!data.endReached) {
context.jamClient.SessionStopPlay();
}