SFML community forums

General => Feature requests => Topic started by: Ryan Bram on February 20, 2012, 10:02:43 am

Title: Enhanced Music Control
Post by: Ryan Bram on February 20, 2012, 10:02:43 am
Greetings,

My name is Ryan and I have some request for SFML Developer:

1. Can you add new function for SFML to play Standard MIDI Files format (.mid) and some module music format (.mod, .it, .xm, etc). For Standard MIDI Files, you may use Fluidsynth library with soundfont (.sf2) http://sourceforge.net/apps/trac/fluidsynth/, and for module music format you can use OpenMPT library http://openmpt.org/.

2. Can you add function to make SFML looping the music for certain point by reading something like additional meta tag in music file. In RPG Maker VX, we can add LOOPSTART and LOOPLENGTH then RPG Maker VX will automatically play the music over and over with predefined loop point in meta tag as the reference.

Thanks,
Ryan Bram
Title: Enhanced Music Control
Post by: Laurent on February 20, 2012, 10:12:49 am
Hi

Both features have already been discussed, have you searched the forum and the issue tracker first?
Title: Enhanced Music Control
Post by: Ryan Bram on February 21, 2012, 12:57:25 am
I already search related post and I found it. This http://www.sfml-dev.org/forum/viewtopic.php?t=577&sid=778e7d9f8321dab69d65fa6ab4abd3c5 and http://www.sfml-dev.org/forum/viewtopic.php?t=1659 and http://www.sfml-dev.org/forum/viewtopic.php?p=19539
I'm really sorry but I think I didn't see any progress in SFML development since the last post, so I just want to provide vote for the requests and to refresh the topics.

Thanks for kindly answering my question and hearing your user opinion.
Title: Enhanced Music Control
Post by: Laurent on February 21, 2012, 08:16:48 am
It's not a problem of progress.

Like I say in those threads, MIDI is unlikely to be supported because:
- 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

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.
Title: Enhanced Music Control
Post by: Tenry on February 21, 2012, 01:13:16 pm
Quote from: Laurent
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.

I've implemented the looping point feature myself in an "old" version of SFML 2.0. I think, I only did minor edits in SoundStream.
You're only able to set the loop start point, where to go when the stream ends and looping is enabled.


// SoundStream.hpp //
class SFML_API SoundStream : SoundSource
{
public:
    ...
    ////////////////////////////////////////////////////////////
    /// \brief Set whether or not the stream should loop after reaching the end
    ///
    /// If set, the stream will restart from beginning after
    /// reaching the end and so on, until it is stopped or
    /// SetLoop(false) is called.
    /// The default looping state for streams is false.
    ///
    /// \param loop  True to play in loop, false to play once
    /// \param start Offset of loop start, in milliseconds
    ///
    /// \see GetLoop
    ///
    ////////////////////////////////////////////////////////////
    void SetLoop(bool loop, Uint32 start=0);
    ...
private:
    ...
    bool          myLoop;                     ///< Loop flag (true to loop, false to play once)
    Uint32        myLoopStart;                ///< Start point of loop in milliseconds
    ...
};
 

// SoundSource.cpp //
SoundStream::SoundStream() :
myThread          (&SoundStream::Stream, this),
myIsStreaming     (false),
myChannelsCount   (0),
mySampleRate      (0),
myFormat          (0),
myLoop            (false),
myLoopStart       (0),
mySamplesProcessed(0)
{

}

...

void SoundStream::SetLoop(bool loop, Uint32 start)
{
    myLoop = loop;
    myLoopStart = start;
}

...

bool SoundStream::FillAndPushBuffer(unsigned int bufferNum)
{
    bool requestStop = false;

    // Acquire audio data
    Chunk data = {NULL, 0};
    if (!OnGetData(data))
    {
        // Mark the buffer as the last one (so that we know when to reset the playing position)
        myEndBuffers[bufferNum] = true;

        // Check if the stream must loop or stop
        if (myLoop)
        {
            // Return to the beginning of the stream source
            OnSeek(myLoopStart);

            // If we previously had no data, try to fill the buffer once again
            if (!data.Samples || (data.NbSamples == 0))
            {
                return FillAndPushBuffer(bufferNum);
            }
        }
        else
        {
            // Not looping: request stop
            requestStop = true;
        }
    }

    // Fill the buffer if some data was returned
    if (data.Samples && data.NbSamples)
    {
        unsigned int buffer = myBuffers[bufferNum];

        // Fill the buffer
        ALsizei size = static_cast<ALsizei>(data.NbSamples) * sizeof(Int16);
        ALCheck(alBufferData(buffer, myFormat, data.Samples, size, mySampleRate));

        // Push it into the sound queue
        ALCheck(alSourceQueueBuffers(mySource, 1, &buffer));
    }

    return requestStop;
}
 


Hope it might help.
Title: Enhanced Music Control
Post by: Laurent on February 21, 2012, 01:23:10 pm
Yeah, implementation is easy. In fact I'm more concerned about the design.

Your solution is more like a quick workaround.
Title: Enhanced Music Control
Post by: Tenry on February 21, 2012, 01:35:30 pm
Quote from: "Laurent"
Yeah, implementation is easy. In fact I'm more concerned about the design.

Your solution is more like a quick workaround.

Well, I think, users should set the loop points via a function themselves, so I would do a function for the music "SetLoopPoints" or only "SetLoopStart".

Or what exactly do you mean by design?
Title: Enhanced Music Control
Post by: Laurent on February 21, 2012, 01:52:11 pm
I mean:
So, I mean thinking about a global, smart and efficient solution, that takes all the possible issues in account.
Title: Enhanced Music Control
Post by: Tenry on February 21, 2012, 02:07:57 pm
Quote from: "Laurent"
I mean:
  • 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
So, I mean thinking about a global, smart and efficient solution, that takes all the possible issues in account.



Quote from: "Laurent"
try to enable this feature in sf::Sound too

I think it should be possible to implement it in sf::Sound in a similar way, too. But I'm not sure.
I might take a look into that class later.

Quote from: "Laurent"
think about how many loop points we want/can have

Best would be 2 points: loop start and loop end. More loop points would propably be nonsense.

Quote from: "Laurent"
should they be specified with a timestamp or a sample index?

A good workaround might be that the user can specify which format he uses - whether it's real time or sample index. For my preferences sample index should be best because it provides best precision.

Quote from: "Laurent"
if we have a "start" loop point, is it active right from the start, or only after the first loop?

A loop start point where the music will start is also nonsense, because then the user can discard the part before just from the audio file.
When playing the sound file, just start it from whereever it currently is (might be seeked by the user), and when it reaches the end of stream (or the loop end point) and loop is enabled at all, seek to loop start.

Quote from: "Laurent"
  • 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?

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.

Quote from: "Laurent"
should we investigate metadata to see if we can enable loop points there for some audio formats, in addition to the C++ API

You mean, loop points stored in the audio file itself?
Title: Enhanced Music Control
Post by: Laurent on February 21, 2012, 02:27:38 pm
My point was to show you that even such a simple feature requires to take the time to think about it, gather use cases, talk to people who use it the most, etc.
Like I said I've never needed this feature, so there are probably other users who will have more relevant questions/suggestions/requests.

And when all these questions have an answer, then we need to make sure that the API is still simple and elegant.

Quote
I think it should be possible to implement it in sf::Sound in a similar way, too. But I'm not sure.

It's more difficult because SFML has no control over the playback, it's all done inside OpenAL.
And implementing the end point would be a complex task in sf::SoundStream too, because SFML only has the focus every N samples, where N is big enough so that the difference will be noticeable. Again, playback is controlled by OpenAL and it doesn't provide any way of inserting user code in it.

Quote
A good workaround might be that the user can specify which format he uses

That would make the API more complicated.

Quote
SFML 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)?

Quote
To remove loop points, a good way might be to set loop start and loop end to 0.

0 is a valid timestamp, therefore it is a bad candidate for a special value.

Quote
You 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.
Title: Enhanced Music Control
Post by: Tenry on February 21, 2012, 02:35:32 pm
Quote from: "Laurent"
Quote
SFML 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)?

In my opinion, if loop is disabled, loop points should be ignored and music will continue until the true end.
But let's see whether other people have different opinions.



Quote from: "Laurent"
Quote
You 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?
Title: Enhanced Music Control
Post by: Laurent on February 21, 2012, 02:41:25 pm
Quote
But 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.
Title: Enhanced Music Control
Post by: Tenry on February 21, 2012, 03:01:07 pm
Quote from: "Laurent"
Quote
But 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"?
Title: Enhanced Music Control
Post by: Laurent on February 21, 2012, 03:02:09 pm
Quote
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"?

I have absolutely no idea. I haven't even had a look at them yet. That was just an idea to investigate.
Title: Enhanced Music Control
Post by: Tenry on February 21, 2012, 03:16:36 pm
Quote from: "Laurent"
Quote
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"?

I have absolutely no idea. I haven't even had a look at them yet. That was just an idea to investigate.

I've worked myself with custom metadata in the PNG file for animations and also tried to find a way for OGG streams to define loop positions.

PNG is a very kind format, it allows so called "private" chunks, of which I can choose the inner format myself and I can store the number of frames in the PNG animation strip.

As for OGG I didn't find any convenient way to store such "user data". So I wouldn't "introduce" a way to store it in such a file format.
Title: Enhanced Music Control
Post by: Laurent on February 21, 2012, 04:37:06 pm
I've added a task in the issue tracker, so that this feature won't be forgotten.

https://github.com/SFML/SFML/issues/177
Title: Enhanced Music Control
Post by: Ryan Bram on February 22, 2012, 01:29:29 am
1.
Quote from: "Laurent"

- it's hard to find a library that converts MIDI files to audio samples (most libraries directly play songs)


Have you ever tried OpenMPT? I use it to convert Standard MIDI Files to module music format or even WAV and MP3 format.

2.
Quote from: "Laurent"

- 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


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)

3.
If you didn't want to implement Standard Midi File support for SFML, how about module music format?
Title: Enhanced Music Control
Post by: Laurent on February 22, 2012, 08:09:11 am
Quote
Have you ever tried OpenMPT? I use it to convert Standard MIDI Files to module music format or even WAV and MP3 format.

Ok but it's a software, not a library, right? And I haven't looked at their source code yet.

Quote
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)

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.

Quote
If you didn't want to implement Standard Midi File support for SFML, how about module music format?

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.
Title: Enhanced Music Control
Post by: Ryan Bram on February 22, 2012, 09:19:47 am
1.
Quote from: "Laurent"
think about how many loop points we want/can have


Two loop point. LOOPSTART (for mentioning starting point when the audio loop back) and LOOPLENGTH (for mentioning ending point for the audio to loop back)

2.
Quote from: "Laurent"
if we have a "start" loop point, is it active right from the start, or only after the first loop?


LOOPSTART only active after the first loop

3.
Quote from: "Laurent"
should we investigate metadata to see if we can enable loop points there for some audio formats, in addition to the C++ API?

Yes we should using metadata

4.
Quote from: "Shy Guy"
But is there a standard for some formats specifying the loop points?
For WAV there is, I think, but what's about OGG vorbis?


In RPG Maker VX we can define loop point in OGG Vorbis format by adding "LOOPSTART:<sample index>" and "LOOPLENGTH :<sample index>" in metadata.
For sample music you can inspect metadata from this file http://www.4shared.com/music/RWLsejla/Battle_1__FF_IV_-_DS_.html and play it with RPG Maker VX (Fully Function for 30 days trial).
For tutorial, you can see http://www.rpgrevolution.com/forums/index.php?showtopic=53387 or http://www.youtube.com/watch?v=2dHo2kBkC6Y
Title: Enhanced Music Control
Post by: Ryan Bram on February 22, 2012, 10:04:03 am
1.
Quote from: "Laurent"
Ok but it's a software, not a library, right? And I haven't looked at their source code yet.

I think this software is modular so you can take just its libraries, and if you want to look to its source code, you can go to https://modplug.svn.sourceforge.net/svnroot/modplug/

2.
Quote from: "Laurent"

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 ;)


Roland GS soundfont (about 3 MB in size) is actually same as GM.dls in Microsoft Windows so you can hear it by yourself how good it sounds. Or if you may you can try Synthfont's soundfont (about 1 MB in size) by downloading it at http://www.synthfont.com/SynthFontSetup.exe and play it or inspect the program folder by yourself.

3.
Quote from: "Laurent"
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.


Okay, if 1 MB is a lot for you, so you don't need to embed it to SFML. You can distribute SFML as is, then just let the programmer load their own soundfont as you let them load their own true type font and render it with SFML. Because basically .mid for music format is same as .odt for document format.

4.
Quote from: "Laurent"
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.


It is same case as distributing game with TrueType Fonts. The result may different for every computer, (if the font itself wasn't distributed with the game) but the programmer have more freedom to choose they desired font to distribute within their games.

5.
Quote from: "Laurent"
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.


libmodplug is actually based on OpenMPT, so currently  it is still maintained. It is very good library because libmodplug is used by many music player, for example Audacious to playback module music format.

According to its site, OpenMPT (since OpenMPT 1.17.02.53) is licensed under 3 clause BSD License that was compatible with SFML.
Title: Enhanced Music Control
Post by: Tex Killer on February 22, 2012, 10:22:37 am
Laurent and Ryan Bram, take a look at my updated topic about the loop issue in the General Forum:

http://www.sfml-dev.org/forum/viewtopic.php?t=6213

Laurent, about the MIDI, what do you think of making a SFML "add-on" to the audio module? Can you make SFML detect if the add-on is present?

That way anyone would be able to make add-ons of different instrument banks they find, and the ones that do not want MIDI just do not use any of the add-ons, and they would get the current size of SFML.

I also think that would be a lot of trouble, but it seems to be a good solution...
Title: Enhanced Music Control
Post by: iwflmt on March 02, 2012, 02:42:11 am
Quote
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.

DUMB (http://dumb.sourceforge.net/): cross-platform, BSD-like license, no more maintained (2005), ~200Kb, IT/XM/S3M/MOD support.
libmodplug (http://modplug-xmms.sourceforge.net/): cross-platform, public domain, actively supported, ~300Kb, 22 different mod formats, used by GStreamer/MPD/OpenMPT/VLC, the best one I guess (clean code but no doc).

Modules support could be very interesting, but MIDI support in SFML is just stupid (sorry).
Title: Enhanced Music Control
Post by: Laurent on March 02, 2012, 07:52:23 am
Quote
MIDI support in SFML is just stupid

Can you elaborate on this?
Title: Enhanced Music Control
Post by: iwflmt on March 02, 2012, 01:10:11 pm
MIDI libraries are bigger than SFML itself (plus instruments bank).
OK "stupid" was not appropriated, "unsuitable" is far better (imho).

Btw, you can reduce libmodplug library size dramatically if you just build it with XM, IT, S3M and MOD support only.
Title: Enhanced Music Control
Post by: Laurent on March 02, 2012, 01:17:29 pm
Quote
MIDI libraries are bigger than SFML itself (plus instruments bank).

I think that people who really need MIDI (and there are) don't care about that ;)
Title: Enhanced Music Control
Post by: Tex Killer on March 02, 2012, 07:37:04 pm
That is why it would be better to have optional MIDI support... As a SFML branch, or as an add-on.
Title: Enhanced Music Control
Post by: Gez on March 05, 2012, 09:44:11 pm
Since this topic is relatively recent...
Quote from: "iwflmt"
DUMB (http://dumb.sourceforge.net/): cross-platform, BSD-like license, no more maintained (2005), ~200Kb, IT/XM/S3M/MOD support.


Has anyone successfully interfaced DUMB with SFML? I'm attempting to do something with it, but my flailing efforts are met with an amusing variety of problems.

What I've done is take the dumbout example program from DUMB, insert it as a function, and changed it so that it writes in memory instead of a file. Then I LoadFromMemory() into a sound buffer, and attempt to play it. Even if I got it working (rather than crashing or not playing any sound), it's not an optimal approach since it's not real-time anyway (first render the song, then play it).

If there are examples of working code interfacing the two, I'd like to see them. :)
Title: Enhanced Music Control
Post by: Ryan Bram on March 14, 2012, 08:29:59 am
Quote from: "iwflmt"
MIDI libraries are bigger than SFML itself (plus instruments bank).
OK "stupid" was not appropriated, "unsuitable" is far better (imho).


That's why I said that SFML should let its user to choose they desired soundfont (.sf2) instead of bundled SFML together with soundfont (or instruments bank), like SFML support for TrueType font which doesn't need for SMFL to be bundled together with TrueType Font itself (.ttf).

I think just for MIDI library alone isn't as big as you think, because SFML doesn't need all library to manipulate MIDI. It only need some parts of MIDI library for playback MIDI files like the other music formats. Example: OpenMPT, the MIDI and module music tracker together (and base of libmodplug) only need 1.7 MB in size (http://openmpt.org/download).

And, though including MIDI files support for SFML is stupid for you, but why SDL already support it, even far before SFML not already support MIDI files? Plus, SDL now already licensed its license under Zlib license which was as liberal as SFML license.

If SFML really want to compete with SDL, this feature is necessary and not optional, or SFML will be left by SDL.

Regards,
RyanBram
Title: Enhanced Music Control
Post by: julen26 on March 14, 2012, 10:25:07 am
Quote from: "Ryan Bram"
If SFML really want to compete with SDL

I don't think SFML wants to compete with SDL, it just provides faster results on graphics API and an easier interface.
Title: Re: Enhanced Music Control
Post by: NinjaFighter on May 28, 2012, 11:32:11 pm
Could be easy to do a only function "SetLoopStart(uint32 aLoopStart)"? without need to set LoopEnd, because, the SetLoopStart is more useful for music playback. The loop end, is useful for custom sound effects, like samples or whatever that can change his duration without have to change the pitch.
If OpenAL provides a way for set the loop start point, I think that SFML2 could set this parameter too, if not, I think that's too much unnecesary work. But I think will be very useful if I can set loop start, at least. :)
Title: Re: Enhanced Music Control
Post by: Phanoo on October 30, 2014, 02:29:36 pm
still no loop points available?
Title: Re: Enhanced Music Control
Post by: Laurent on October 30, 2014, 05:43:48 pm
No.
Title: Re: Enhanced Music Control
Post by: Disch on November 22, 2014, 07:24:21 pm
This has been a long-time issue for me with SFML and I always seem to have to create my own workaround for it.

As Ryan Bram previously mentioned, this problem can be resolved with zero interface changes merely by pulling the loop information out of the audio file metadata.

libsndfile already provides the ability to extract some metadata.  While I was unable to extract the exact "LOOPSTART" and "LOOPLENGTH" metadata fields that he mentioned using libsndfile, I was able to extract similar strings by putting them in the "comments" field of the audio file.

Personally, I think a LOOPLENGTH identifier is pointless, since it just adds more complication when you can just use EOF.  All we really need is a LOOPSTART.

The key for the change is in the SoundFile class.  All this class has to do is:

1)  In SoundFile::initialize:  Extract a loop start point from the sound file metadata (start point should be a sample offset for maximum precision and not a time offset)
2)  In SoundFile::read: Once EOF is reached, merely seek the file back to the loop point (if specified)


Both of these steps require minimal code changes (maybe 10-15 lines), do not really impact larger design issues, and do not require any interface changes.  The only externally visible change you'd need is to the documentation to make note of the feature.


I've made a similar change in my local copy of SFML 2.0 and it works great.  I'd be okay with applying the change (after cleaning it up) to the latest SFML bulid... but only if it's going to be welcome.



So what do you guys think?



EDIT:

Laurent mentioned this on the first page:

Quote
Using specific metadata is not an option, since SFML supports many standard audio formats.

This is why I suggest extracting text from the 'comments' field.  This is generic enough to be common across all audio formats.  And the functionality for reading this metadata is already in libsndfile.
Title: Re: Enhanced Music Control
Post by: Laurent on November 22, 2014, 08:29:57 pm
I think you should base any suggestion and/or local change on the feature/no_libsndfile branch. With this branch I think you can do what you want without modifying SFML (until we integrate something directly to the public API).
Title: Re: Enhanced Music Control
Post by: Disch on November 22, 2014, 09:46:45 pm
Hrm... without libsndfile this becomes a lot trickier... since metadata now has to be read from each file type individually.  Which means creating a private interface for reading metadata.

Still no way to do this without modifying SFML that I can see.  To ensure music can be looped properly without breaks in the audio, the change has to be made where the audio data is supplied.

In this branch the most logical place for the change seems to be in Music::onGetData, with a pure virtual addition to SoundFileReader to obtain metadata.  How that metadata function would look is a mystery to me, though.  I'm not familiar enough with the specifics of each individual file format to build a common interface.

Guess I'll stick with my custom 2.0 build for now, and possibly will look into this in the future.
Title: Re: Enhanced Music Control
Post by: Laurent on November 22, 2014, 11:13:51 pm
I thought that the most important thing was to implement loops. If your concern is to read metadata, then yes, you'll still have to modify SFML (but since we don't rely on libsndfile anymore, we now have total control on what we do with metadata).

Wouldn't implementing loops with manual definition be an acceptable solution for you?
Title: Re: Enhanced Music Control
Post by: Disch on November 23, 2014, 12:20:16 am
Quote
Wouldn't implementing loops with manual definition be an acceptable solution for you?

Grah, yeah that would work just fine.  I guess I just had a one-track mind where I was trying to get my previous solution to work in the new setup.

Can this be done with the no_libsndfile branch as it is now?  It doesn't look like it to me.  I see a looping option in SoundStream, but it always loops from the start of the file.  I guess we could add a new 'setLoopPoint' function or something to SoundStream.
Title: Re: Enhanced Music Control
Post by: Laurent on November 23, 2014, 11:24:53 am
You'd have to write your own class, similar to sf::Music. Since sf::InputSoundFile is now public, you can easily implement loop points there.