Wohlstand / libADLMIDI

A Software MIDI Synthesizer library with OPL3 (YMF262) emulator
GNU Lesser General Public License v3.0
171 stars 17 forks source link

[XMI 2 MIDI] Implement track spliting #30

Closed Wohlstand closed 9 months ago

Wohlstand commented 6 years ago

Because current converter does merge of all songs inside same XMI file, result becoming too cluncky. As example, music from "System Shock" game is widely uses multi-song XMI files.

XMI2MIDI: https://github.com/Wohlstand/libADLMIDI/blob/master/src/cvt_xmi2mid.hpp

Interrupt commented 6 years ago

This would be great to have, as an experiment I've tried using ADLMIDI to play the XMI music in our System Shock source port but with all the tracks playing at once it's just a cacophony!

WIP here: https://github.com/Interrupt/systemshock/tree/adlmidi

jpcima commented 6 years ago

This is an API proposal to control which of the tracks can be played by the sequencer. It has benefit of not being tied to XMI particularly, so it can work with the rest of formats.

enum ADLMIDI_TrackOptions
{
   ADL_TrackOption_On,
   ADL_TrackOption_Off,
   ADL_TrackOption_Solo,
};

/*Count tracks of current data in sequencer*/
int adl_getTrackCount(struct ADL_MIDIPlayer *device);

/*Set track options in sequencer*/
int adl_setTrackOptions(struct ADL_MIDIPlayer *device, int trackNumber, unsigned trackOptions);

On System Shock side: adl_setTrackOptions(adlDevice, themeID, ADL_TrackOption_Solo)

jpcima commented 6 years ago

@Interrupt you may want to try an update considering @Wohlstand has worked hard to implement a support of XMI loop events. I made some experiments in your adlmidi-xmi branch (before a Music AI commit), and I was able to hear some properly looped music that wasn't before.

I noted some things not supported yet, which I don't know if needed or not.

Interrupt commented 6 years ago

@jpcima thanks for the ping! The 119 callback trigger is definitely needed by System Shock, it uses it to have the game run the Music AI to mute / unmute tracks at loops points.

Wohlstand commented 9 months ago

I forgot to tell, that I already implemented this a while ago. It's possible to play XMI tracks as separated songs and switch between these tracks on the fly.