Removing Source rewinding

Issue #572 resolved
created an issue

The only use of rewind I can think of (which stop can't do) is seeking to the start of a paused Source while also wanting it remain in the paused state, that is wanting it to play when resume is called. This seems rare, and it seems it can be achieved using Source:seek(0) if needed.

Comments (10)

  1. hahawoo reporter
    • changed status to open

    I'm actually not so certain! :P

    Why would anyone want rewinding?

    Well, the most obvious reason to me would be for replaying a source which is already playing. And at least in 0.8.0, source:rewind() source:play() seems to be more hazardous than source:stop() source:play(), as seen here.

    Perhaps this has been fixed now, but it's still redundant. "Do I use source:rewind() source:play() or source:stop() source:play()? Does it matter?"

    As for other uses... maybe a stuttering sound, like "C-C-C-COMBO BREAKER!", but even then you'd only be saving one line by going combobreaker:rewind() instead of combobreaker:stop() combobreaker:start(), and even then only if you didn't know the seek method existed.

    And... that's all I can think of!

  2. hahawoo reporter
    • changed status to open

    Sorry for opening this again, but y'know, I gotta prove a point! :D

    Shortcut functions which provide a quicker and easier way to do a certain simple thing which could be done with other functions can be useful. Contrast!
    (select(2, love.window.getMode()))

    Less characters, simpler, and commonly used!,y,w,h),y,x+w,y+h)

    Less characters, simpler, and commonly used!

    Less characters, and I assume commonly used.


    A lot less characters, and I assume commonly used maybe?

    love.filesystem.write(name, data)
        local f = love.filesystem.newFile(name, 'w')

    A lot less characters, simpler, and commonly used.


    More characters, dare I say slightly more complex (seek clearly changes the playback position state, it may not be so obvious what state rewind changes and how), and I can't think of a frequently occurring use case for it.

    Having Source:rewind makes Sources (seem) more complex than they are, and it's misused (I've seen more than one instance of source:stop() source:rewind()).

    So my questions are:

    • What is a frequently occurring use case for Source:seek(0)?
    • Is this use case worth creating a redundant shortcut function which saves minus one characters? ;)
  3. hahawoo reporter

    Yeah, I just mentioned it because when I said that it might not be obvious what state rewind changes and how, I was just speaking theoretically, but then I found an occurrence of the word meaning a different thing.

  4. Log in to comment