The online racing simulator
Winamp
1
(47 posts, started )
Winamp
Hy there is anybody who could make an insim program which shows the winamp song title with artist in LFS like a chat message ...

EX: Now Playing in Winamp: 50 Cent - Disco Inferno
A quick google tells that it should be possible to do like this in C++/CInSim

// Get current position in the playlist
int curPos = SendMessage(hWinAmp, WM_WA_IPC, 0, IPC_GETLISTPOS);
// Read the file title
char* title = SendMessage(hWinAmp, WM_WA_IPC, curPos, IPC_GETPLAYLISTTITLE);

strcpy(is_songMessage.Text, title);
insim.send_packet(&is_songMessage);

Where is_songMessage is an IS_MSO struct.

Because the SendMessage call returns a pointer to the string with the song's title, one would have to write this as a WinAmp plugin or use WinAmpMiniMagic (the sample code for that almost made my lunch go back on the plate though).

EDIT: BTW I just noticed the method chaining style in PRISM, pretty neat gotta say
Doing it reliably with WndProc messages is kinda hard, as it does need to run as a WinAmp plugin, but you can hack it together by finding the HWND of the WinAmp window, getting the window text and parsing what you need out. With Win32 you can do this with FindWindow and GetWindowText.

In C# you can just use the System.Diagnostics namespace.

using System.Diagnostics;

static string GetCurrentSongTitle() {
Process process = Process.GetProcessesByName("winamp").SingleOrDefault();
if (process != null) {
string title = process.MainWindowTitle;
if (!String.IsNullOrEmpty(title)) {
int index = title.LastIndexOf(" - ");
if (index > -1) {
return title.Substring(0, index);
}
}
return "Unknown song";
}
return "WinAmp not found";
}

Is the window title way guaranteed to work? It's been a while since I moved away from Winamp, but as I recall it it was quite moddable. As long as Winamp always sets its window title like this, it would probably be a viable solution.
-
(MonkOnHotTinRoof) DELETED by MonkOnHotTinRoof
I gave it a shot and it seems to be working, if there's no way Winamp can change this I might as well release it after I clean the source up a "bit".
Can someone make an "app" or a plugin for winamp from the mentioned solutions above ? Im not a programmer if anybody have a bit free time could make for our happy. It would be so nice while driving and others see the song played at me ... Musics are quiet good discussion when players are not playing just spectating and chatting ! Sorry for my english grammer ... :/
It will probably not handle songs with wrong or non-English characters well, but I really can't be bothered to fix nuances like that. I hate the way it's written, but under the ugly Winamp stuff is something that looks pretty neat so far and I might turn it into high-level C++/Qt based InSim library one day

(The executable is huge because it has half of Qt compiled in statically)
-- LINK REMOVED --
Quote :InSim : password does not match your multiplayer admin password

Didn't found where I can configure that...
Quote from Eclipsed :Didn't found where I can configure that...

Well, you can't. I really didn't expect someone to use this on a host...
That's what I got when tested it in LFS start screen. Both clientside insims Aonio and LFSrelax asks for that admin pass too.

Edit: Deleting admin pass from start new host solved this. But it somehow doesn't show full title,as always the 1st letter from atrist is missing and last 2 letters from song name. Even both are very short and should fit in LFS message.

Edit 2: Same shows in applications main window (about the missing letters)
Quote from MadCatX :Well, you can't. I really didn't expect someone to use this on a host...

Always need to send a password if one is set in LFS, doesn't matter if it's a host or a local instance of the game.
Quote from DarkTimes :Always need to send a password if one is set in LFS, doesn't matter if it's a host or a local instance of the game.

I know, I just didn't expect anyone to have the admin password set as that's something you'd probably want to use only if you run a private server. I put very little effort into this hack so it always assumes that the password is blank
Quote from MadCatX :Is the window title way guaranteed to work? It's been a while since I moved away from Winamp, but as I recall it it was quite moddable. As long as Winamp always sets its window title like this, it would probably be a viable solution.

When I last looked into it, that was the officially recommended (and only, short of writing a proper plugin) way of grabbing the song title from Winamp.

I knocked up a quick implementation in C/C++ using this method a couple of years ago that displays the current track in a button - still works today. It's also possible to use the Winamp API to control Winamp via InSim (if you'd ever want to - I did it as an experiment).

Edit: Of course, this method will break if you set the Winamp window title to scroll.
Quote from MadCatX :Since I discovered a rather stupid bug in the app, I eventually decided to reupload it, this time with the option to enter admin password.
http://dl.dropbox.com/u/37342755/WinAmper2.7z

I have problem: ERROR - Connection Refused

the password is correct, the port is correct ... IDK whats the problem :/
It worked for me, it might your firewall blocking it or for some reason the app cannot connect to LFS through "127.0.0.1". I can't think of anything else ATM.
Quote from MadCatX :It worked for me, it might your firewall blocking it or for some reason the app cannot connect to LFS through "127.0.0.1". I can't think of anything else ATM.

I added the app for firewall exclusion, and I added special rights for the folder but nothing ... o.O If were a log file to show the problem were better !!!
Attached images
errorrrr.png
I might have gone blind but from the screenshot it looks like LFS is not running on your machine so the app has nothing to connect to. You have to start LFS and init InSim first.
Quote from MadCatX :I might have gone blind but from the screenshot it looks like LFS is not running on your machine so the app has nothing to connect to. You have to start LFS and init InSim first.

My LFS is running just is on RocketDock ... not on taskbar !
The only way I can reproduce this issue is by not enabling InSim in LFS. If you're sure you have InSim enabled and it's working with other applications, then I have really no idea what would cause such a problem expect for the statically linked exe being somehow magicowierdly broken...
Quote from MadCatX :The only way I can reproduce this issue is by not enabling InSim in LFS. If you're sure you have InSim enabled and it's working with other applications, then I have really no idea what would cause such a problem expect for the statically linked exe being somehow magicowierdly broken...

I use LFSlapper version 6 and its perfectly working with LFS. Maybe tomorrow I will look the source code of Winamper and if I have luck I will find the problem
Quote from iko.andonow :Special insim for that? That isnt neccessary. Just go to Winamp`s settings and make shortcut buttons (ex. ctrl+alt+p) for "copy song title" and when you press it in the game, just press T and ctrl+v (paste).

I'm not sure it would work like that because LFS would most likely intercept the Winamp shortcut (unless Winamp sets its shortcuts as global which I doubt). You'd also have to do that every time you play a new song, the whole point of this tiny app is to spam the LFS chat with "I'm currently listening to" kind of messages.

The app worked on another W7 machine, so there's got to be something specific about your machine. "Connection refused" usually means that an application is trying to connect to a non-existent address or port, which doesn't appear to be the case here.
Could you change something to make the app to make a log file with error... So with this file we should know why wont connect to LFS. port or something other !

I think maybe here is the problem why I cant connect

<?php 
{
    
m_prefix QString(prefix);
    
LFSPackets::IS_ISI isi(100'\0'0passwd"WinAmper");
    
LFSPackets::IS_VER ver;

    
/* There already is an active InSim connection, close it */
    
if (m_lfsComm.connectionOK())
        
m_lfsComm.close();

    
QString msg m_lfsComm.initialize(QHostAddress("127.0.0.1"), portisiver);

    
/* Could we connect to LFS? */
    
if (QString::localeAwareCompare(msgQString("")) != 0) {
        
QMessageBox(QMessageBox::Critical"InSim connection error"msgQMessageBox::Ok).exec();
        return;
    }

    
qDebug() << ver.Size() << ver.Product() << " " << ver.Version();
?>

If there's an error during connecting, the application displays error returned by QTcpSocket::errorString(). You can see how the connection is created in InSimComm::initialize(), the application creates a socket, tries to connect and blocks for 5 seconds. If a connection is not established by that time or an error is reported, an error string is returned. There's nothing more to log.
This method works fine on two Windows and one Linux box, so unless there's some obscure bug in Qt, I don't see where it could trip.
1

Winamp
(47 posts, started )
FGED GREDG RDFGDR GSFDG