Mod Archive Forums Mod Archive Forums
Advanced search  

News:

Please note: Your main modarchive.org account will not work here, you must create a forum account to post on the forums.

Pages: [1]   Go Down

Author Topic: Use of OpenMPT in C program in Linux with libmodplug  (Read 16634 times)

0 Members and 1 Guest are viewing this topic.

zzo38

  • Newbie
  • Offline Offline
  • Posts: 52
  • Registered user
    • View Profile
Use of OpenMPT in C program in Linux with libmodplug
« on: April 08, 2016, 06:24:22 »

Can a C program written for Linux that is currently using libmodplug be made to use the playback routines from OpenMPT? Specifically my "playmod" program
Logged
AmigaMML???

Saga Musix

  • TMA Moderator
  • Top Poster
  • ****
  • Offline Offline
  • Posts: 2571
  • I love OpenMPT! And Modules! And TMA! And Pie! :>
    • View Profile
    • Saga Musix - free module music and more!
Re: Use of OpenMPT in C program in Linux with libmodplug
« Reply #1 on: April 08, 2016, 15:00:32 »

Yes it can: https://lib.openmpt.org/libopenmpt/
Either use the libmodplug emulation layer (not recommended), or change all libmodplug API calls to libopenmpt API calls. The libopenmpt API is much better structured than libmodplug's API anyway.
Logged
» My TMA artist profile
» Visit my music site: https://sagamusix.de/ [de, en]
» Visit my programming website: https://sagagames.de/ [de]
» Open ModPlug Tracker

zzo38

  • Newbie
  • Offline Offline
  • Posts: 52
  • Registered user
    • View Profile
Re: Use of OpenMPT in C program in Linux with libmodplug
« Reply #2 on: April 08, 2016, 19:19:10 »

OK, thanks. However note that this program does sometimes write into the pattern data. Also is libopenmpt compatible with input that might not be seekable? (This does seem possible to do even if not seekable as far as I can tell, but there are also other problems which I cannot find the answer in their documentation.) It would be possible to avoid to write into pattern data if it were possible to write plugins in C codes and link them to channels/instruments in the mixer, so that it can be used to mute channels/instruments or for other purposes; this also I would like so that I can do use such thing.
« Last Edit: April 08, 2016, 19:22:45 by zzo38 »
Logged
AmigaMML???

Saga Musix

  • TMA Moderator
  • Top Poster
  • ****
  • Offline Offline
  • Posts: 2571
  • I love OpenMPT! And Modules! And TMA! And Pie! :>
    • View Profile
    • Saga Musix - free module music and more!
Re: Use of OpenMPT in C program in Linux with libmodplug
« Reply #3 on: April 09, 2016, 02:15:17 »

Currently it is only possible to read and format pattern data, not write to it - writing would give away internal implementation details which may change at any time, hence it is not possible at the moment.
As for your other question, libopenmpt supports both seekable and unseekable streams. Unseekable streams will, depending on the file type, require an internal buffer that is up to the size of the full file though.
Logged
» My TMA artist profile
» Visit my music site: https://sagamusix.de/ [de, en]
» Visit my programming website: https://sagagames.de/ [de]
» Open ModPlug Tracker

zzo38

  • Newbie
  • Offline Offline
  • Posts: 52
  • Registered user
    • View Profile
Re: Use of OpenMPT in C program in Linux with libmodplug
« Reply #4 on: April 09, 2016, 06:23:05 »

As for your other question, libopenmpt supports both seekable and unseekable streams. Unseekable streams will, depending on the file type, require an internal buffer that is up to the size of the full file though.
This is what I have thought.

The reason I have used writing to pattern data is to mute channels/instruments and to tamper with looping, however there may be better ways to do these things (if so, I could not find it in the documentation). In some cases this would be for purposes of mixing separately (which would also require loading multiple copies), although if there are more mixing controls (I could not find it) then that would also be possible (and muting could be implemented by using these extra mixing controls perhaps). (Splitting into two separate programs might also be a way, although it is not what I intended to do.)
Logged
AmigaMML???

Saga Musix

  • TMA Moderator
  • Top Poster
  • ****
  • Offline Offline
  • Posts: 2571
  • I love OpenMPT! And Modules! And TMA! And Pie! :>
    • View Profile
    • Saga Musix - free module music and more!
Re: Use of OpenMPT in C program in Linux with libmodplug
« Reply #5 on: April 09, 2016, 13:49:12 »

You can mute channels and do many other things (such as modifying the tempo) by using the libopenmpt_ext API, but it's currently only usable from C++, not C: https://lib.openmpt.org/doc/libopenmpt_ext_cpp_overview.html
Logged
» My TMA artist profile
» Visit my music site: https://sagamusix.de/ [de, en]
» Visit my programming website: https://sagagames.de/ [de]
» Open ModPlug Tracker

zzo38

  • Newbie
  • Offline Offline
  • Posts: 52
  • Registered user
    • View Profile
Re: Use of OpenMPT in C program in Linux with libmodplug
« Reply #6 on: April 09, 2016, 20:37:21 »

They also say it is experimental API
Logged
AmigaMML???

Saga Musix

  • TMA Moderator
  • Top Poster
  • ****
  • Offline Offline
  • Posts: 2571
  • I love OpenMPT! And Modules! And TMA! And Pie! :>
    • View Profile
    • Saga Musix - free module music and more!
Re: Use of OpenMPT in C program in Linux with libmodplug
« Reply #7 on: April 10, 2016, 14:41:06 »

Yes, I (not they) do. But that doesn't mean that I will remove it at any point though, it just means that the C++ interface is considered to be unstable and may change between versions. But you can expect that the functionality that is there will remain in the interface, only new stuff will be added in the future.
Logged
» My TMA artist profile
» Visit my music site: https://sagamusix.de/ [de, en]
» Visit my programming website: https://sagagames.de/ [de]
» Open ModPlug Tracker
Pages: [1]   Go Up