So the main song is from the beginning to a certain sample, and looping that is no problem. What I am trying to do here is I have a wav file that has two different parts that I want to loop and transition between. With this method, I can't seem to seek forward in the docoder. However, I have another problem, which I realize I didn't fully specify I was trying to do this in the initial post. Local temp = (yourLoopPoint - smpCounter, mSource:getSampleRate(), mSource:getBitDepth(),įor i=0, (yourLoopPoint - smpCounter - 1) do only queue part of the buffer, and then seek to the starting point (or to the loop start if you have such a thing) with the Decoder. SmpCounter = smpCounter + Buffer:getSampleCount() If yourLoopPoint > smpCounter+Buffer:getSampleCount() then ![]() MSource:seek(0) - or whatever your starting point would be If yourLoopPoint = smpCounter + Buffer:getSampleCount() then ![]() Local Buffer = mSource:decode() - You'll get a 2048 (by default) sized SoundData QSource = (mSource:getSampleRate(), mSource:getBitDepth(), mSource:getChannelCount(), 8) - default it's not as correct as libopenmpt though (which löve should really update to ), but it works.Ĭode: Select all mSource = ('path/to/music/song.mp3', 2048) - Default, but this should be smaller, imo. On a final note, i've been working on an app, soon to be a lib, that can load and play back tracker files with more options, although it only supports s3m files at the moment (and cave story/organya files). That said, tracker file loop points should be respected, and if they're not, then either libmodplug has a bug, or your xm file has the looping defined wrong. a song with a chill part and a part that is more intense when you encounter enemies, both of which have transitions between the parts so the music flows from one mood into the other smoothly)Īnyone have any input as to how I can accomplish this?įirst of all, :tell depends on your vsync setting since there's only one "game loop", so if that's enabled, you can't get the granularity you could otherwise but even with that, there's no guarantee you can exactly control the loop down to the samplepoint with :tell and :seek only.Īs raidho said, using a short sounddata as a buffer (and a decoder since you don't want to load your whole song into memory as uncompressed samplepoints), and a queueable source, you can, since you need to manually go over all samplepoints, and when you reached a specific smp count, which is the loop end point, you can set it back to the loop start point (with seeking the decoder back there) and it will work completely seamlessly.Īs for more fine grained control with tracker formats, while löve does use libmodplug, which would allow such things, it's not utilized by löve due to how the devs wanted the implementation to basically mirror the non-notational formats as well, effectively treating all sound formats the same, like if they were bitstreams. Have songs with multiple parts that the game transitions to based on what's happening (i.e. Have songs with intros that don't loop the introĢ. I am also wondering if anyone knows of a way to control tracker things in love like muting tracks or other things one could do with a tracker.īasically, what I am trying to do falls under these two categories:ġ. So I still have the same problem with loops here. xm files that I can play the music from, but it doesn't seem to respect the loop settings saved in the xm file, it just loops the entire thing instead of looping back to the pattern specified in the tracker file. On the same topic, I create my music in a tracker, and so I have. So my question is, why is this coming back in these increments? Is there a way to increase the granularity of the value returned? This is when playing from a wav file. This is not fine grained enough for me to control the music precisely and I get skips and jumps and overall inconsistent looping when I try to loop based on samples. So I'll get something like this when I call it each frame (notice the repeated values): What I have noticed is that the :tell("samples") call gives me samples in 1024 increments instead of the exact value at the time that I call the function. ![]() The issue I have with this is that it is not fine grained enough for me to get the music to loop perfectly. So with the looping issue, I have tried what various other people have said in this forum, which is to use :tell and :seek on the music source object to get and set the play position in order to control how the music loops. However, I have so far been unable to accomplish what I am wanting to do in regards to controlling music, specifically controlling the looping of it, and I am also wondering if anybody knows of a way to use tracker files (.xm in this case) with more control such as being able to turn on and off tracks, etc. I've been developing on Love for the last 6 months or so and I love it (no pun intended).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |