Looping points are an important feature but I have to find a nice way to integrate them to the public API. Using specific metadata is not an option, since SFML supports many standard audio formats.
Yeah, implementation is easy. In fact I'm more concerned about the design.
Your solution is more like a quick workaround.
I mean:So, I mean thinking about a global, smart and efficient solution, that takes all the possible issues in account.
- try to enable this feature in sf::Sound too
- think about how many loop points we want/can have
- should they be specified with a timestamp or a sample index?
- if we have a "start" loop point, is it active right from the start, or only after the first loop?
- how to remove loop points? (using 0 or music.GetDuration() would not be reliable)
- should we add a way to enable/disable loop points without removing them?
- should we investigate metadata to see if we can enable loop points there for some audio formats, in addition to the C++ API?
- ... probably many other questions because I've only thought about it for 5 minutes, and I'm not a typical user of this feature
try to enable this feature in sf::Sound too
think about how many loop points we want/can have
should they be specified with a timestamp or a sample index?
if we have a "start" loop point, is it active right from the start, or only after the first loop?
- how to remove loop points? (using 0 or music.GetDuration() would not be reliable)
- should we add a way to enable/disable loop points without removing them?
should we investigate metadata to see if we can enable loop points there for some audio formats, in addition to the C++ API
I think it should be possible to implement it in sf::Sound in a similar way, too. But I'm not sure.
A good workaround might be that the user can specify which format he uses
SFML already provides a function to enable and disable looping.
To remove loop points, a good way might be to set loop start and loop end to 0.
You mean, loop points stored in the audio file itself?
QuoteSFML already provides a function to enable and disable looping.
Is the end point still active when looping is off (ie. should the music stop there or continue until the true end)?
QuoteYou mean, loop points stored in the audio file itself?
Yes, so that artists can set them. After all, it's not the programer's job.
But is there a standard for some formats specifying the loop points?
For WAV there is, I think, but what's about OGG vorbis?
QuoteBut is there a standard for some formats specifying the loop points?
For WAV there is, I think, but what's about OGG vorbis?
I don't know, that's why I said "investigate" ;)
I don't think that there's a standard that all audio formats would support, but if a non-negligible amount of them support metadata (probably in a different way), it could be an interesting feature.
Hm, metadata... several formats support metadata at all, mostly only text. But I think alsmost none of them support loop points as "metadata".
Are you intending to allow, for example, a comment meta data "loop: 0-52596"?
QuoteHm, metadata... several formats support metadata at all, mostly only text. But I think alsmost none of them support loop points as "metadata".
Are you intending to allow, for example, a comment meta data "loop: 0-52596"?
I have absolutely no idea. I haven't even had a look at them yet. That was just an idea to investigate.
- it's hard to find a library that converts MIDI files to audio samples (most libraries directly play songs)
- MIDI requires an instrument bank, which is usually too big to be embedded in SFML, and not standard enough not to be embedded in SFML
Have you ever tried OpenMPT? I use it to convert Standard MIDI Files to module music format or even WAV and MP3 format.
What the mean of "big" for you? If Roland GS sound font is too big for you (about 3 MB in size) you can use soundfont from Synthfont www.synthfont.com (only about 1 MB in size)
If you didn't want to implement Standard Midi File support for SFML, how about module music format?
think about how many loop points we want/can have
if we have a "start" loop point, is it active right from the start, or only after the first loop?
should we investigate metadata to see if we can enable loop points there for some audio formats, in addition to the C++ API?
But is there a standard for some formats specifying the loop points?
For WAV there is, I think, but what's about OGG vorbis?
Ok but it's a software, not a library, right? And I haven't looked at their source code yet.
I'm not an expert but I heard that a good instrument bank was at least 10 MB. Others are either bad quality or not complete enough. Well, that's what I remember, it may be wrong ;)
But even 1 MB is a lot, it would be embedded inside the sfml-audio library. And I don't even know if it can be embedded properly.
It would also cause problems such as "my music, played by SFML, is not the same as when I created it" -- because the sound bank was a different one.
Same problem, I have to find a library. But if I remember correctly, there was one (libmodplug?). Don't remember if it was good, maintained and had a compatible license though.
Same problem, I have to find a library. But if I remember correctly, there was one (libmodplug?). Don't remember if it was good, maintained and had a compatible license though.
MIDI support in SFML is just stupid
MIDI libraries are bigger than SFML itself (plus instruments bank).
DUMB (http://dumb.sourceforge.net/): cross-platform, BSD-like license, no more maintained (2005), ~200Kb, IT/XM/S3M/MOD support.
MIDI libraries are bigger than SFML itself (plus instruments bank).
OK "stupid" was not appropriated, "unsuitable" is far better (imho).
If SFML really want to compete with SDL
Using specific metadata is not an option, since SFML supports many standard audio formats.
Wouldn't implementing loops with manual definition be an acceptable solution for you?