Trout has a portion of the Winamp API built into it for this purpose. ... The following messages are supported:
40001 - Close
40022 - Toggle repeat
40023 - Toggle shuffle
40029 - Add files box
40044 - Previous track
40045 - Play/Pause
40048 - Next track
40058 - Volume up
40059 - Volume down
40144 - Seek backward
40148 - Seek forward
40155 - Add URL
40187 - Add folder box
You can use standard Windows SendMessage commands to control Trout in this way.
Just to clarify: those are WM_COMMAND values. (hex code 0x111) In AutoHotkey it would look like this:
Ok this is useful if I want send a command to the player but if I want to get the title and the infos of a currently played song?
For that you can use WM_USER values of the Winamp API (hex code 0x400).
This already works with Trout:
104 - Returns the status of playback. If 'return' is 1, it's playing. If 'return' is 3, it's paused. Otherwise, playback is stopped.
105 - If 'data' is 0, returns the position in milliseconds
of playback. If 'data' is 1, returns current track length in seconds
An example of message 105 in AHK:
; Get Current Track Lenght
; Get Current Track Posistion
Standard Winamp API has no message for querying the current track title IIRC. (Doesn't mean Trout cannot have one, as a unified approach(?)
If there is a certain message within the Winamp API that you would like to see supported, let me know and I'll see if I can add it.
Skwire, glad you asked. I already thought of asking you for some additions:
40154 - Go to the begin of the playlist immediately [Hmm... shame, this feature doesn't exist in Trout?]
40158 - Go to the end of the playlist immediately [but who would want that?]
122 - Sets the volume to 'data', which can be between 0 (silent) and 255 (maximum)
124 - Returns length of the current playlist, in tracks
125 - Returns the position in the current playlist, in tracks
250 - Query shuffle status: 0=off, 1=on
I use WM_USER 124, 125 and 250 in a frequent used AHK-script, so implementing these is highly appreciated.