Seeing xmplay looping behaviour for plugins being discussed in the xmp-libxmp thread, I decided to chime in here.
Do you mean when looping? If so, you signify the end by delivering less data than requested in your Process function, and then XMPlay will call your SetPosition function to go back to the start. If you include XMPIN_FLAG_LOOP in the plugin's flags, then the XMPIN_POS_LOOP or XMPIN_POS_AUTOLOOP value will be used in the SetPosition function to request looping or auto-looping. In the auto-looping case, the function should only loop when a loop has been detected, and otherwise return -1. If the time of the loop start position is known, that should be returned, otherwise -2 can be returned to let the time run on.
@Ian: For libopenmpt/xmp-openmpt, the current XMPlay looping model seems to not fit at all. Libopenmpt needs to know a-priori (or while playing back) the desired looping behaviour. The reason being, libopenmpt does, in general, not stop playback right at the point when the module finishes, but instead fades out the song using some volume ramping in order to avoid clicks on song end. XMPlay currently can only notify xmp-openmpt that we actually want to loop the module after this fadeout has already hapened, but obviously this is too late for libopenmpt because we already transmitted the fadeout pcm data. Currently, we completely ignore the XMPlay looping and provide a looping setting in our plugin settings dialog.
We could avoid our own setting if XMPlay can provide either a call to the plugin that sets the desired looping behaviour (which could be done, for example, directly after loading a file and when the setting changes) OR a way to query the XMPlay looping settings. I'm not aware of a way to query the XMPlay settings directly (I might be missing something).
If there is no such way, can you add this or something equivalent to the plugin API? Another XMPIN_FLAG_something is probably also required in order to signal to XMPlay that the plugin uses a different looping model than the default.
The libopenmpt looping model supports "none"/"infinite"/"number of repeats as integer". Libopenmpt (currently) can not support the XMPlay-style auto-looping. However, for future extensibility, this setting could also be made available to plugins.
Querying other XMPlay settings would also be useful in general. We could potentially avoid our own interpolation and volume ramping settings. These are less important from my point of view, though.