Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Support for MOD/S3M/XM/IT (modules) music  (Read 6226 times)

0 Members and 1 Guest are viewing this topic.

LTronic

  • Newbie
  • *
  • Posts: 8
    • View Profile
Support for MOD/S3M/XM/IT (modules) music
« on: September 13, 2009, 02:18:19 pm »
Hi !
I thought a nice feature for SFML would be to handle module music files.
I had a look at the Audio subsystem source code, and I think it could be easily added, by using the libmodplug library.

Are any other users interested in ?
I could give it a go, but on which version should I start patching ?

LTronic

  • Newbie
  • *
  • Posts: 8
    • View Profile
Support for MOD/S3M/XM/IT (modules) music
« Reply #1 on: September 13, 2009, 05:34:12 pm »
Well, since I had some time to kill, I give it a go on the standard SFML 1.5 VS2008 SDK sources.

It was rather easy actually, I followed the following steps :

- Hooked up my "basic" libmodplug.lib + modplug.h in the extlibs
- Added a SoundFileMod class in the Audio subsystem, similar to SoundFileOgg
- Hooked up SoundFileMod class in the SoundFile main class

I have now MOD/S3M/XM/IT files playing flawlessly in SFML with great quality, however only "basic" stuff (no loop, volume, etc.. setup but it can easily be added IMHO).

Laurent, are you interested in me sharing that with you ?
Have you some special recommendations on the coding idioms so I can submit a proper "patch" ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Support for MOD/S3M/XM/IT (modules) music
« Reply #2 on: September 13, 2009, 06:57:40 pm »
libmodplug is distributed under GPL isn't it? GPL isn't compatible with the SFML's license.

Moreover, the code you used to patch SFML 1.5 is not valid anymore in SFML 2, the SoundFile classes have been merged into a single class (every format is now handled by the same library).
Laurent Gomila - SFML developer

LTronic

  • Newbie
  • *
  • Posts: 8
    • View Profile
Support for MOD/S3M/XM/IT (modules) music
« Reply #3 on: September 13, 2009, 07:15:49 pm »
libmodplug is licensed under public domain, so no licensing issue should arise...

I will have a look at SFML2 branch to integrate it properly.

EDIT :

Taken from libmodplug-0.8.7.tar.gz COPYING file :

Quote

ModPlug-XMMS and libmodplug are now in the public domain.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Support for MOD/S3M/XM/IT (modules) music
« Reply #4 on: September 13, 2009, 07:22:38 pm »
Yeah, I just downloaded the package and has a look at this file, because I couldn't find clear informations about its license on the web ;)

However, I don't understand this:
Quote
however only "basic" stuff (no loop, volume, etc.. setup but it can easily be added IMHO).

This is handled by SFML, all that the SoundFile class is required to do is to open, close, seek, read and write into a sound file.
So what is the problem?

Quote
I will have a look at SFML2 branch to integrate it properly.

No need to do that. I'll have to make some changes to the base code if I decide to support this library. I don't want you to work for nothing ;)
Laurent Gomila - SFML developer

LTronic

  • Newbie
  • *
  • Posts: 8
    • View Profile
Support for MOD/S3M/XM/IT (modules) music
« Reply #5 on: September 13, 2009, 07:25:03 pm »
No problem so far, but I need to double-check looping since MOD files and similar formats can have "loop points".

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Support for MOD/S3M/XM/IT (modules) music
« Reply #6 on: September 13, 2009, 07:30:22 pm »
Oh, so you're talking about libmodplug supporting or not looping/volume/whatever commands in audio files?

I thought you were talking about support in SFML (Sound::SetVolume, Sound::SetLoop, ...) :)

I don't mind if the support for these formats is not 100% complete, from what I've read I guess it will be improved in the future.
Laurent Gomila - SFML developer

LTronic

  • Newbie
  • *
  • Posts: 8
    • View Profile
Support for MOD/S3M/XM/IT (modules) music
« Reply #7 on: September 13, 2009, 07:38:50 pm »
Nope, the libmodplug support is fairly mature, but I think it might be required to "bridge" SFML loop parameters and the ModPlug one to loop the MOD files correctly.