Issues with seek/tell

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
NÖÖB
Prole
Posts: 41
Joined: Thu Jul 31, 2008 10:57 pm
Location: Norway

Issues with seek/tell

Post by NÖÖB »

The attatched .love files behave very differently using ogg and wav; the ogg won't loop at 44100 samples..
Attachments
strmwav.love
using wav
(268.86 KiB) Downloaded 106 times
strm.love
using ogg
(268.86 KiB) Downloaded 120 times
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Issues with seek/tell

Post by miko »

NÖÖB wrote:The attatched .love files behave very differently using ogg and wav; the ogg won't loop at 44100 samples..
The Source object does not have methods like tell or seek (so it generates errors for me). Use something like this:

Code: Select all

function love.load()
  Loop = love.audio.newSource("440.ogg","static")
  Loop:setLooping(true)
  Loop:play()
end

function love.update(dt)
end

function love.draw()
end
You could use Source:rewind(), but is is pointless when the Source is set to looping. BTW, if you do update your Source object, do it inside love.update(), not inside love.draw().

Check out the Source object documentation: http://love2d.org/wiki/Source
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Issues with seek/tell

Post by Robin »

miko wrote:The Source object does not have methods like tell or seek (so it generates errors for me).
See https://bitbucket.org/rude/love/src/9ca ... s.txt#cl-8.

:seek and :tell were added for 0.8.0, so apparently our friend NÖÖB is running that instead of 0.7.2.
Help us help you: attach a .love.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Issues with seek/tell

Post by miko »

Robin wrote:
miko wrote:The Source object does not have methods like tell or seek (so it generates errors for me).
See https://bitbucket.org/rude/love/src/9ca ... s.txt#cl-8.

:seek and :tell were added for 0.8.0, so apparently our friend NÖÖB is running that instead of 0.7.2.
Ops, right (the nickname was misleading ;) ). Anyways, the 0.7.2 solution also works for 0.8.0.
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
NÖÖB
Prole
Posts: 41
Joined: Thu Jul 31, 2008 10:57 pm
Location: Norway

Re: Issues with seek/tell

Post by NÖÖB »

I'm actually trying to keep a record of how many times a sound has looped, which you can't do with setLooping..

Here's some weird stuff.. I was thinking about buffers and how that would effect seamless looping, and I don't know why, but when I increment the offset by 32 every loop, more often than not, it sounds pretty seamless - check the attatched love
Attachments
stream.love
(12.97 KiB) Downloaded 134 times
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests