xmp-songlimit general plugin for XMPlay

Started by bauxite69,

bauxite69

xmp-songlimit general plugin

Features:
- Control the playback time of songs
- Loop section of a song

- Configuration dialog to :
  · set songs and subsongs playback time limit in milliseconds
  · set custom start and end in milliseconds of playback looping

History:
v1.4, 2026-08-29
 · changed playback time limit granularity units from second to milliseconds
 · new : Loop section of a song
 · added configuration settings to set custom start and end in milliseconds of playback looping

v1.3.0, 2024-05-12
 · added configuration setting to toggle support for subsongs time limit
 
v1.2.0, 2023-07-16
 · fixed: didn't work properly if there is only one song in the playlist

v1.1.0, 2023-03-19
 · new config dialog

v1.0.0, 2019-10-28
 · initial release


Download (OneDrive)

Ian @ un4seen

That's an interesting plugin, and seems to be working well. Nice work :)

It looks like the config options would need to be accessed while playing a track. To make that easier for the user, I would suggest making the config window a modeless (rather than modal) dialog and adding a shortcut key option to open it, so that it can be opened/closed independently of XMPlay's "Options" window. XMPlay 4.1 added a GetPopupParent function for hosting modeless dialogs. For example, you could do something like this:

HWND confwin; // config window

BOOL CALLBACK ConfigDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
...
        case WM_INITDIALOG:
            confwin = hWnd;
...
        case WM_DESTROY:
            confwin = 0;
...
}

void WINAPI DSP_Config(void *inst, HWND win)
{
    if (confwin) // config already open
        SetForegroundWindow(confwin); // bring to front
    else {
        HWND parent;
        if (xmpfmisc->GetVersion() >= 0x04010000) // XMPlay 4.1
            parent = xmpfmisc->GetPopupParent();
        else
            parent = xmpfmisc->GetWindow()
        CreateDialog(hInstance, lpName, parent, ConfigDialogProc); // create modeless dialog
    }
}

void WINAPI Shortcut_Config()
{
    if (enabled) DSP_Config(0, 0); // open config window if plugin is activated
}

XMPDSP *WINAPI XMPDSP_GetInterface2(DWORD face, InterfaceProc faceproc)
{
...
    static XMPSHORTCUT shortcut = { 0x22000, "Song Limit - Config", Shortcut_Config };
    xmpfmisc->RegisterShortcut(&shortcut);
...
}

Note that shortcut IDs needs to be unique amongst all plugins. You can have the 0x22000-0x22FFF block for your plugins.

bauxite69

Quote from: Ian @ un4seenThat's an interesting plugin, and seems to be working well. Nice work :)

It looks like the config options would need to be accessed while playing a track. To make that easier for the user, I would suggest making the config window a modeless (rather than modal) dialog and adding a shortcut key option to open it, so that it can be opened/closed independently of XMPlay's "Options" window. XMPlay 4.1 added a GetPopupParent function for hosting modeless dialogs.


Good idea !

Thank you for your advice, it will be very useful to me.  :)

I'll do my best to make it works.