From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.4 required=3.0 tests=AWL,BAYES_00,SPF_PASS shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 023D3633810 for ; Mon, 11 Apr 2016 02:30:34 +0000 (UTC) Received: from localhost ([::1]:43324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apRcX-0005FW-3r for dtas-all@80x24.org; Sun, 10 Apr 2016 22:30:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apRZt-0001UV-Ex for dtas-all@nongnu.org; Sun, 10 Apr 2016 22:27:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apRZq-0001xg-8o for dtas-all@nongnu.org; Sun, 10 Apr 2016 22:27:49 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:32793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apRZq-0001xa-3X for dtas-all@nongnu.org; Sun, 10 Apr 2016 22:27:46 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 88B97205CC; Mon, 11 Apr 2016 02:27:43 +0000 (UTC) Date: Mon, 11 Apr 2016 02:27:43 +0000 From: Eric Wong To: dtas-all@nongnu.org Subject: [RFC] player: "cue prev" reliably hits previous cue breakpoint Message-ID: <20160411022743.GA22090@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 X-Mailman-Approved-At: Sun, 10 Apr 2016 22:30:31 -0400 X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: "dtas-all" Seeking around a track should not be done relative to a previous seek, but should rather be analogous to the "tl prev" command to skip around the tracklist. I'm not sure what drugs I was on when I originally wrote this original version, but I'm fairly certain this is a bugfix and not intentional behavior. --- Thoughts? I'm _pretty_ sure this is the right thing to do; will think about it for a bit... lib/dtas/player/client_handler.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb index 7b33967..8a15974 100644 --- a/lib/dtas/player/client_handler.rb +++ b/lib/dtas/player/client_handler.rb @@ -745,9 +745,9 @@ def __bp_prev_next(io, msg, cur, bp) return io.emit("INVALID TYPE") end fmt = cur.format + ds = __current_decoded_samples case msg[0] when "next" - ds = __current_decoded_samples bp.each do |ci| next if ci.offset_samples(fmt) < ds seek_internal(cur, ci.offset) @@ -756,11 +756,15 @@ def __bp_prev_next(io, msg, cur, bp) # go to the next (real) track if not found __current_drop when "prev" - os = cur.offset_samples # where we currently started + prev = nil bp.reverse_each do |ci| - next if ci.offset_samples(fmt) >= os - seek_internal(cur, ci.offset) - return io.emit("OK") + if prev.nil? + next if ci.offset_samples(fmt) >= ds + prev = ci + else + seek_internal(cur, ci.offset) + return io.emit("OK") + end end # offset may be nil/zero if we couldn't find a previous breakpoint seek_internal(cur, '0') -- EW