soundData:getSample() keeps returning 0

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
fegnouche
Prole
Posts: 1
Joined: Sat Oct 31, 2020 5:55 pm

soundData:getSample() keeps returning 0

Post by fegnouche »

i dont know why but when i try to do

Code: Select all

soundData:getSample(audio:tell(),1)
it keeps returning 0 (even though there is actually sound playing)
User avatar
pgimeno
Party member
Posts: 3640
Joined: Sun Oct 18, 2015 2:58 pm

Re: soundData:getSample() keeps returning 0

Post by pgimeno »

Hi welcome to the forums. With that information there's very little anyone can do to help. I can only suggest you to double check that the audio corresponds to the soundData.

Edit: Maybe also check that it's a stereo track and that the second channel has data.
User avatar
slime
Solid Snayke
Posts: 3160
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: soundData:getSample() keeps returning 0

Post by slime »

The unit returned by Source:tell is seconds by default, whereas SoundData:getSample takes a sample index. You can use Source:tell("samples") to get the current playback position of the Source in the same unit that SoundData:getSample needs.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests