' And now for something completely different. :-) ' ' With the GTK-server it is possible to open any library from a VBscript, ' without using configfile, as is shown below. ' ' Enjoy nice music from www.modarchive.org! ' ' September 2008, PvE - tested with GTK-server 2.2.7 on Linux. ' '--------------------------------------------------------------------- Option Explicit Function MIKMOD(st) 'Open the pipe and write gtkserver.StdIn.WriteLine st 'Get GTK-server response MIKMOD = gtkserver.StdOut.ReadLine End Function '------------------------------------------------------------------------ 'Declare variables DIM process, gtkserver DIM init, module, active, file, MM ' File to load and play file = "lodoss.xm" 'Define GTK-server process SET process = CreateObject("Wscript.Shell") 'Execute GTK-server SET gtkserver = process.Exec("gtk-server -stdin") ' Open MikMod library MM = MIKMOD("gtk_server_require mikmod.dll") IF MM = "0" THEN MsgBox "Download the mikmod DLL from www.gtk-server.org, and run this demo again.", vbOkOnly OR vbCritical, "Warning" MIKMOD "gtk_server_exit" WScript.Quit(0) END IF ' Define some mikmod calls MIKMOD "gtk_server_define MikMod_Init NONE BOOL 1 STRING" MIKMOD "gtk_server_define MikMod_RegisterAllDrivers NONE NONE 0" MIKMOD "gtk_server_define MikMod_RegisterAllLoaders NONE NONE 0" MIKMOD "gtk_server_define MikMod_Update NONE NONE 0" MIKMOD "gtk_server_define MikMod_Exit NONE NONE 0" MIKMOD "gtk_server_define Player_Load NONE POINTER 3 STRING INT BOOL" MIKMOD "gtk_server_define Player_Start NONE NONE 1 POINTER" MIKMOD "gtk_server_define Player_Active NONE BOOL 0" MIKMOD "gtk_server_define Player_Stop NONE NONE 0" MIKMOD "gtk_server_define Player_Free NONE NONE 1 POINTER" ' Register all the drivers MIKMOD "MikMod_RegisterAllDrivers" ' Register all the module loaders MIKMOD "MikMod_RegisterAllLoaders" ' initialize the library init = MIKMOD("MikMod_Init ''") IF init <> "0" THEN MsgBox "Could not initialize sound!", vbOkOnly OR vbCritical, "Warning" MIKMOD "gtk_server_exit" WScript.Quit(0) END IF ' Load module using 64 channels module = MIKMOD("Player_Load " & file & " 64 0") ' Play music IF module <> "0" THEN ' Start module MIKMOD "Player_Start " & module active = MIKMOD("Player_Active") ' We're playing DO active = MIKMOD("Player_Active") MIKMOD "MikMod_Update" LOOP UNTIL active = "0" MIKMOD "Player_Stop" MIKMOD "Player_Free $module" ELSE MsgBox "Could not play module!", vbOkOnly OR vbCritical, "Warning" END IF ' Give up MIKMOD "MikMod_Exit" ' Exit GTK-server MIKMOD "gtk_server_exit"