Author Topic: Crossfade Toggle (hotkey)  (Read 365 times)

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1139
  • Heal The World
Download it from the add-on link here

In the future, I will convert this plugin to a generalized hotkey provider, as and when the requests come up.
The crossfade hotkey was requested a while back - I found this link from a recent wishlist request from another separate topic which I haven't linked here.

Maybe I'm missing something, but I couldn't find the Toggle Crossfade hotkey in the list.




The entire code for anyone interested in taking a peak.
Code
using System;

namespace MusicBeePlugin
{
    public partial class Plugin
    {
        private MusicBeeApiInterface mbApiInterface;
        private PluginInfo about = new PluginInfo();

        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            mbApiInterface = new MusicBeeApiInterface();
            mbApiInterface.Initialise(apiInterfacePtr);
            about.PluginInfoVersion = PluginInfoVersion;
            about.Name = "Crossfade Hotkey Toggle";
            about.Description = "Toggles the on and off state of the crossfade sound effect";
            about.Author = "Mayibongwe";
            about.TargetApplication = "";
            about.Type = PluginType.General;
            about.VersionMajor = 1;
            about.VersionMinor = 0;
            about.Revision = 0;
            about.MinInterfaceVersion = MinInterfaceVersion;
            about.MinApiRevision = MinApiRevision;
            about.ReceiveNotifications = ReceiveNotificationFlags.StartupOnly;
            about.ConfigurationPanelHeight = -1;

            return about;
        }

        public void ReceiveNotification(string sourceFileUrl, NotificationType type)
        {
            switch (type)
            {
                case NotificationType.PluginStartup:
                mbApiInterface.MB_AddMenuItem(null, "Player: Toggle Crossfade On/Off", hotkeyHandler);
                break;
            }
        }

        public void hotkeyHandler(object sender, EventArgs e)
        {
            bool isCrossfadeOn = mbApiInterface.Player_GetCrossfade();
            switch (isCrossfadeOn)
            {
               case true:
               mbApiInterface.Player_SetCrossfade(false);
               break;

               case false:
               mbApiInterface.Player_SetCrossfade(true);
               break;
            }
        }

        public bool Configure(IntPtr panelHandle)
        {
            return false;
        }
    }
}
The source code to any of my contributions is available on the same download link as the add-ons

aktor

  • Full Member
  • ***
  • Posts: 160
can you make plugin for show/hide hotkey top track panel?

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1139
  • Heal The World
can you make plugin for show/hide hotkey top track panel?
That won't be possible, I'm afraid.
The current API does not support any modifications to MusicBee's internal panels.

You will unfortunately just have to hope your wishlist request gets fulfilled some day.
Is there a reason why you have to constantly enable and disable it?

A button or aa hot key option in music explorer to make appear and disappear Top Tracks Panel.
This is an excellent option. What about hotkey for show/hide top track panel?
The source code to any of my contributions is available on the same download link as the add-ons

aktor

  • Full Member
  • ***
  • Posts: 160
i like clean look and it takes too much space to be visible all the time,

KangNi

  • Full Member
  • ***
  • Posts: 192