-
Notifications
You must be signed in to change notification settings - Fork 560
Improve API and Web interface #3403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
When a certain specified path contains spaces (such as "..\..\..\..\bin\mpc-hc_x64_Debug Lite\mpc-hc64.exe" that contains a space between "Debug" and "Lite"), then double quotes are required to safely quote the path
Updated `GetMPCCommandName` to include a case for `CMD_DISCONNECT`. Enhanced the default case to return a formatted string with the command's hexadecimal value for better debugging of unknown commands, replacing the previous static "CMD_UNK" return value.
Updated the version number of the "MPC-HC Test API" from 1.0.1.0 to 1.0.2.0 in both the dialog resource and the version information block. Changed the copyright year from 2013 to 2025 in the dialog resource and the version information block.
Updated `GetMPCCommandName` to include `CMD_VERSION` case and modified `OnCopyData` to automatically send `CMD_GETVERSION` upon receiving `CMD_CONNECT`.
Aligned the `<p id="audiotrack">[audiotrack]</p>` element by removing spurious leading space to match the indentation of other elements in the file.
- Added new options to request and receive the current MPC-HC volume through the API. - Cleaned-up some comments.
- Updated the test application with new combobox items - The current volume can be requested by `CMD_GETVOLUME` or sent automatically
… detail These methods existed in the class yet in these places the code was still using the repeated code. The existing methods return the same value.
- Dark mode support - Default viewport for mobile - Transparency for rounded title corners - Added note regarding future updates to index
- Fixed the order of `UpdateData(TRUE);`, it must come before accessing `m_strMPCPath` otherwise the data is not valid yet and you needed to call the function twice for it to take effect. - Updated the OnButtonFindwindow function to format the command line string - Added a simple OnOK function to handle Enter key based on the focused control
Future changes unrelated to MPCTestAPI should be in separate PRs. |
Removed XMP metadata to reduce filesize as well
This comment was marked as resolved.
This comment was marked as resolved.
I'm going to just use a |
- Adds a new command `CMD_SETVOLUME` to manage the current volume and mute state - The command is defined in `MpcApi.h` and implemented in `CMainFrame::ProcessAPICommand` to handle volume and mute updates - The `CPlayerToolBar` class has been updated to provide access to methods for mute state management - Additionally, a conflict with the how `CMD_SETVOLUME` was referenced in the web API has been fixed, where it has been renamed to `CMD_SETVOL` for consistency (It's recommended to rename such cases to `WEBCMD_...` instead to prevent such collisions) - Resource file `MPCTestAPI.rc` has also been updated to add new combobox items in the MPCTestAPI app
Added a new commit (6544c02) that allows changing the volume from the API, which was previously missing. Note: This is kind of off-topic; but sadly there is a noticeable delay from when the volume is changed until is actually reflected, doesn't matter the source (if it was set from either Web or regular API, or from the UI). I hope to investigate and see if I can make this instantaneous for my personal use case. |
I don't like the combination of volume and mute in a single parameter. Just keep it simple and set only volume. For practical purposes a volume of 0 has the same effect a muting. |
This comment was marked as outdated.
This comment was marked as outdated.
option C, separate command for mute. Mute state is already correctly reflected in web interface and its variables. |
This comment was marked as resolved.
This comment was marked as resolved.
C2 |
OK, I'll make a new commit to make the mute state separate from volume for both GET and SET. Edit: Investigating this, I see some issues that needs to be addressed. |
I'm working to improve the MPC-HC's API and Web interface according to the changes in my personal fork, and port my changes changes in order to upstream them.
I would appreciate it if you could have a review. Sorry for having multiple different aspects all integrated in a single PR.
Added features
CMD_CURRENTVOLUME
andCMD_GETVOLUME
(This will be automatically sent upon changes and can also be queried from the host side)
To set the volume, the
CMD_SETVOLUME
with syntax:<volume>|<is_muted>
can be used.(e.g. the
variables.html
page now also displays the variable name in addition to its value using CSS)Fixes and general changes
GetVolume()
andIsMuted()
to make code DRYMpcApi.h
for clarityChanges to be made
Prevent firing
OnPlayVolume()
with duplicated valuesTo replicate this issue, open the MPCTestAPI app and invoke increase/decrease volume commands.
This will cause the event to be fired twice, which is not desirable.
Additionally, dragging the volume bar's handle past zero will fire with the same
0
value repeatedly.Add a new API to query the currently connected host hWnd
This is useful for scripting purposes and/or when dealing with multiple instances (windows) of MPC-HC
Allowing us to query whether a particular MPC-HC window has a host connected or not.
Add a new API to display status messages using the API
Add the missing functionality of sending OSD and Status messages to the MPCTestAPI app(Since the parameters format differ from other API commands, this will be skipped)
Edit
Will move some unrelated feature/improvement tasks to their own issue later:
Make use of Windows 11 rounded corners for the custom dark mode context menus (fix Dark theme has small bug on win 11 #2141)
(Currently they are not rounded)
Re-write the web interface (and the HTTP server) to make use of Web-sockets instead of polling interval to improve user-experience
Completely drop support for Microsoft IE
(Unless someone is still using it instead of modern web browsers)