Форум: "Начинающим";
Текущий архив: 2006.02.12;
Скачать: [xml.tar.bz2];
ВнизЗапустить и проиграть WinAmp Найти похожие ветки
← →
Бася (2006-01-26 23:30) [0]Добрый вечер Мастера!
Подскажите, плз, как запустить и проиграть выбранный файл в WinAmp?
← →
Eraser © (2006-01-27 00:34) [1]
#define WM_WA_IPC WM_USER
// messages are sent to the winamp window using:
//result = SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command);
/* Messages available to send */
#define IPC_GETVERSION 0
/*
IPC_GETVERSION is sent to the window, and the return value is the version
Version 1.55 = 0x1551
Version 1.6b = 0x16A0
Version 1.60 = 0x16AF
Version 1.61 = 0x16B0
Version 1.62 = 0x16B1
Version 1.64 = 0x16B3
Version 1.666 = 0x16B4
Version 1.69 = 0x16B5
Version 1.7x = 0x170x
Version 1.8x = 0x180x
Version 1.9x = 0x190x
Version 2.0x = 0x200x
the command_data parameter is 0.
so,
if (SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION) != 0x1551)
MessageBox(NULL,"Error, Winamp 1.55 not found","Warning",MB_OK);
*/
#define IPC_PLAYFILE 100
/*
IPC_PLAYFILE is sent to the window for each char of a null terminated string of a file to ADD
to the playlist (it doesn"t change the playing status). Note, if you pass a file with the extension
".m3u" it will be treated as a playlist.
for example:
char *file = "C:\\download\\booga.mp3";
int x;
for (x = 0; x <= strlen(file); x ++)
PostMessage(hwnd_winamp,WM_WA_IPC,(LPARAM)file[x],
IPC_PLAYFILE);
will add "C:\download\booga.mp3" to the end of the playlist
--- superceeded in winamp 1.7:
COPYDATASTRUCT cds;
cds.dwData = IPC_PLAYFILE;
cds.lpData = (void *) file;
cds.cbData = strlen((char *) cds.lpData)+1;
SendMessage(hwnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
*/
#define IPC_DELETE 101
/*
IPC_DELETE deletes the internal Winamp playlist.
SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
*/
#define IPC_STARTPLAY 102
/*
IPC_STARTPLAY starts the playing.
SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
*/
#define IPC_CHDIR 103
/*
IPC_CHDIR is sent to the window for each char of a null terminated string of a directory to change to
for example:
char *dir = "C:\\Download";
int x;
for (x = 0; x <= strlen(file); x ++)
PostMessage(hwnd_winamp,WM_WA_IPC,(LPARAM)dir[x],IPC_PLAYFILE);
will change the winamp process to "C:\download" (useful for relative pathnames and loading playlists)
--- superceeded in winamp 1.7:
COPYDATASTRUCT cds;
cds.dwData = IPC_CHDIR;
cds.lpData = (void *) dir;
cds.cbData = strlen((char *) cds.lpData)+1;
SendMessage(hwnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
*/
#define IPC_ISPLAYING 104
/*
IPC_ISPLAYING returns the status of playback.
If it returns 1, it is playing. if it returns 3, it is paused, if it returns 0, it is not playing.
If it returns something other than 1,3,or 0, something is screwed.
isplaying = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
*/
#define IPC_GETOUTPUTTIME 105
/*
IPC_GETOUTPUTTIME returns the position in milliseconds of the
current song (lParam = 0), or the song length, in seconds (lParam = 1).
Returns -1 if not playing or error.
song_pos = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME);
song_len = SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETOUTPUTTIME);
*/
#define IPC_JUMPTOTIME 106
/*
*ONLY AVAILABLE IN v1.60+*
IPC_JUMPTOTIME sets the position in milliseconds of the current song (approximately)
Returns -1 if not playing, 1 on eof, or 0 if successful
SendMessage(hwnd_winamp,WM_WA_IPC,new_song_pos,IPC_JUMPTOTIME);
*/
#define IPC_WRITEPLAYLIST 120
/*
*ONLY AVAILABLE IN v1.666+*
IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.pl
int cursong = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
(cursong is the index of the current song in the playlist)
*/
// winamp 2.0+ (pre2 0902+)
#define IPC_SETPLAYLISTPOS 121
/* 2.0 + ... wParam == playlist position */
#define IPC_SETVOLUME 122
/* 2.0 + ... wParam == volume 0-255 */
#define IPC_SETPANNING 123
/* 2.0 + ... wParam == pannign 0-255 */
#define IPC_GETLISTLENGTH 124
/* 2.0 + ... returns playlist length in tracks */
// winamp 2.04+, in-process (plug-in or other) ONLY.
#define IPC_SETSKIN 200
// wParam == pointer to skin name, skin directory, or skin
// .zip, or skin .zip w/ directory
#define IPC_GETSKIN 201
// wParam == pointer to buffer of MAX_PATH length to recieve skin directory
// for .zip files this is usually c:\temp\_waskin or something.
// return value: pointer to skin name or zip file name.
#define IPC_EXECPLUG 202
// wParam == visualization plug-in to execute. format is either:
// "vis_whatever.dll"
// "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir)
// "C:\\dir\\vis_whatever.dll,1"
#define IPC_GETPLAYLISTFILE 211
// wParam == index into playlist. returns pointer to the filename of the item,
// NULL or an empty string on error
#define IPC_GETPLAYLISTTITLE 212
// wParam == index into playlist. returns pointer to the title of the item,
// NULL or an empty string on error
// 2.05+
#define IPC_GETLISTPOS 125 // returns list pos
#define IPC_GETINFO 126 // returns srate if wParam==0, brate if wParam==1, nch if wParam == 2
#define IPC_GETEQDATA 127 // get EQ item wParam (10 = preamp, 11=enabled,12=autoload, 0-9 = eq).. range is 0 (+20db) to 63 (-20db)
#define IPC_SETEQDATA 128 // set data.. use after IPC_GETEQDATA
// THESE MIGHT CHANGE in the future :)
//Also, you can send standard WM_COMMAND messages to the Winamp window (for other controls), including
// Send using SendMessage(hwnd_winamp,WM_COMMAND,WINAMP_OPTIONS_EQ/*orwhatever*/,0);
// toggles the EQ window
#define WINAMP_OPTIONS_EQ 40036
// toggles the playlist window
#define WINAMP_OPTIONS_PLEDIT 40040
// turns the volume up a little
#define WINAMP_VOLUMEUP 40058
// turns the volume down a little
#define WINAMP_VOLUMEDOWN 40059
// fast forwards 5 seconds
#define WINAMP_FFWD5S 40060
// rewinds 5 seconds
#define WINAMP_REW5S 40061
// the following are the five main control buttons, with optionally shift or control pressed
// (for the exact functions of each, just try it out)
#define WINAMP_BUTTON1 40044
#define WINAMP_BUTTON2 40045
#define WINAMP_BUTTON3 40046
#define WINAMP_BUTTON4 40047
#define WINAMP_BUTTON5 40048
#define WINAMP_BUTTON1_SHIFT 40144
#define WINAMP_BUTTON2_SHIFT 40145
#define WINAMP_BUTTON3_SHIFT 40146
#define WINAMP_BUTTON4_SHIFT 40147
#define WINAMP_BUTTON5_SHIFT 40148
#define WINAMP_BUTTON1_CTRL 40154
#define WINAMP_BUTTON2_CTRL 40155
#define WINAMP_BUTTON3_CTRL 40156
#define WINAMP_BUTTON4_CTRL 40157
#define WINAMP_BUTTON5_CTRL 40158
// always goes to the previous song (unlike button 1), 1.666+
#define WINAMP_PREVSONG 40198
// pops up the load file(s) box
#define WINAMP_FILE_PLAY 40029
// pops up the preferences
#define WINAMP_OPTIONS_PREFS 40012
// toggles always on top
#define WINAMP_OPTIONS_AOT 40019
// pops up the about box :)
#define WINAMP_HELP_ABOUT 40041
← →
Бася (2006-01-27 13:51) [2]Всем Мастерам и участникам добрый день!
Вчера задался вопросом создать прогу для поиска на компе всех файлов мр3 и проигрывания нужного (выбранного из списка). Удалось тока запустить сам winamp. Но как проиграть - вопрос. Хочу выразить благодарность Мастеру Eraser. Я никогда так много не получал инфы от мастеров. Спасибо! У меня тока один вопрос. По какому принципу работает
запуск мр3 файла из windows? Т.е. В папке "Sound" есть мр3 файлы, клацкаем на нужном - он проигрывается в программе по умолчанию (у меня winamp). Хотелось бы узнать, как это можно реализовать?
С Уважением, Бася
← →
Leshiy © (2006-01-27 15:22) [3]Как вариант:
Запускаешь Winamp с парамертом в виде файла с полным путем.
Например: C:\Progra~1\Winamp\winamp.exe D:\Music\Aria\Вавилон.mp3
← →
Eraser © (2006-01-27 15:39) [4]
> Бася (27.01.06 13:51) [2]
> Хочу выразить благодарность Мастеру Eraser. Я никогда так
> много не получал инфы от мастеров.
кхе.. кхе.. спасибо конечно :)
> о какому принципу работает
> запуск мр3 файла из windows?
см. раздел реестра HKEY_CLASSES_ROOT, пропиши туда своё расширение по аналогии, только прежде чем регистрировать mp3 файлы для запуска своей программой - неплохо спросить у юзера подручными средствами, хочет ли он запускать mp3 твоим приложением.
← →
TUser © (2006-01-27 17:32) [5]
unit UMusAmp;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ShellApi;
type
TTimeDisplayMode = (tdmElapsed, tdmRemaining);
TMusAmp = class
private
WAWindow:hWND;
public
procedure Play;
constructor Create;
procedure Previous;
procedure Next;
procedure Pause;
procedure Stop;
procedure SoftStop;
procedure StopAfter;
//DO NOT USE//
procedure UpStream (Seconds:integer);
procedure DownStream (Seconds:integer);
//DO NOT USE//
//╥хюЁхЄшўхёъш, ¤Єш 2 яЁюЎ√ фюыцэ√
//юЄяЁрты Є№ схуєэюъ тяхЁхф ш эрчрф
//эр чрфрээюх ъюышўхёЄтю ёхъєэф
//═ю эр ёрьюь фхых, юэш юЄяЁрты ■Є шї эр ёъюы№ъю
//шь чрїюўхЄё .
procedure StartOfList;
procedure EndOfList;
procedure SetTimeMode(Mode: TTimeDisplayMode);
procedure WAProperties;
//Open file dialog
procedure OpenFileDlg;
//Open URL dialog
procedure OpenURLDlg;
//File information box
procedure FileInfoDlg;
//Open visualization options
procedure VisOptions;
//Open visualization plug-in options
procedure VisualizePlugInOptions;
//Execute current visualization plug-in
procedure VisualizePlugIn;
//Toggle about box
procedure AboutBox;
//Toggle title autoscrolling
procedure TitleAutoscrolling;
//Toggle always on top
procedure OnTop;
//Toggle Windowshade
procedure WindowShade;
//Toggle Playlist Windowshade
procedure PlaylisWindowShade;
//Toggle doublesize mode
procedure Doublesize;
//Toggle EQ
procedure Equalizer;
//Toggle playlist editor
procedure PlayList;
//Toggle main window visible
procedure MainWindow;
//Toggle minibrowser
procedure MiniBrowser;
//Toggle easymove
procedure EasuMove;
//Toggle repeat
procedure RepeatOnOff;
//Toggle shuffle
procedure Shuffle;
//Open jump to time dialog
procedure JToTime;
//Open jump to file dialog
procedure JToFile;
//Open skin selector
procedure SkinDlg;
//Configure current visualization plug-in
procedure CurrentVisPlugIn;
//Reload the current skin
procedure SkinReload;
//Close Winamp
procedure Close;
//Show the edit bookmarks
procedure EditBMarks;
//Adds current track as a bookmark
procedure SetBMark;
//Play audio CD
procedure AudioCD;
//Load a preset from EQ
procedure LoadEQ;
//Save a preset to EQF
procedure SaveEQ;
//Opens load presets dialog
procedure LoadEQDlg;
//Opens auto-load presets dialog
procedure AuloLoadEQDlg;
//Load default preset
procedure LoadDefaultEQ;
//Opens save preset dialog
procedure SaveDefaultEQ;
//Opens delete preset dialog
procedure DeleteEQDlg;
//Increase volume by value%
procedure IncreaseVol(value: integer);
//Decrease volume by value%
procedure DecreaseVol(value: integer);
//Play list length
function ListLength: integer;
//Reloads WinAmp;
procedure Reload;
// published
end;
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
constructor Create(AOwner: TComponent); override;
{ Public declarations }
end;
var
Form1: TForm1;
Muser:TMusAmp;
implementation
{$R *.dfm}
constructor TForm1.Create(AOwner: TComponent);
begin
inherited Create (AOwner);
Muser:=TMusAmp.Create;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
// Muser.Play;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// muser.IncreaseVol(5);
showmessage(inttostr(muser.ListLength));
muser.AddToBMarks("H:\ьєч√ър\pulja.mp3");
showmessage(inttostr(muser.ListLength));
end;
// TMusAmp code
constructor TMusAmp.Create;
begin
inherited Create;
shellexecute(0,nil,"d:\programs\winamp\winamp.exe",nil,nil,SW_SHOWNORMAL);//SW_SHOWMINIMIZED);
WAWindow:=findWindow("WinAmp v1.x",nil);
end;
procedure TMusAmp.SoftStop;
begin
sendMessage(WAWindow,WM_COMMAND,40147,0);
end;
procedure TMusAmp.Next;
begin
sendMessage(WAWindow,WM_COMMAND,40048,0);
end;
procedure TMusAmp.Pause;
begin
sendMessage(WAWindow,WM_COMMAND,40046,0);
end;
procedure TMusAmp.Play;
begin
sendMessage(WAWindow,WM_COMMAND,40045,0);
end;
procedure TMusAmp.Previous;
begin
sendMessage(WAWindow,WM_COMMAND,40044,0);
end;
procedure TMusAmp.Stop;
begin
sendMessage(WAWindow,WM_COMMAND,40047,0);
end;
← →
TUser © (2006-01-27 17:32) [6]procedure TMusAmp.StopAfter;
begin
sendMessage(WAWindow,WM_COMMAND,40157,0);
end;
procedure TMusAmp.UpStream (Seconds:integer);
var i,j:integer;
begin
j:=trunc(Seconds*60/35);
for i:=1 to j do
sendMessage(WAWindow,WM_COMMAND,40148,0);
end;
procedure TMusAmp.DownStream (Seconds:integer);
var i,j:integer;
begin
j:=trunc(Seconds*60/35);
for i:=1 to j do
sendMessage(WAWindow,WM_COMMAND,40144,0);
end;
procedure TMusAmp.StartOfList;
begin
sendMessage(WAWindow,WM_COMMAND,40154,0);
end;
procedure TMusAmp.EndOfList;
begin
sendMessage(WAWindow,WM_COMMAND,40158,0);
end;
procedure TMusAmp.SetTimeMode(Mode: TTimeDisplayMode);
begin
if Mode=tdmElapsed then sendMessage(WAWindow,WM_COMMAND,40037,0)
else sendMessage(WAWindow,WM_COMMAND,40038,0);
end;
procedure TMusAmp.WAProperties;
begin
sendMessage(Muser.WAWindow,WM_COMMAND,40012,0);
end;
procedure TMusAmp.OpenFileDlg;
begin
sendMessage(WAWindow,WM_COMMAND,40029,0);
end;
procedure TMusAmp.OpenURLDlg;
begin
sendMessage(WAWindow,WM_COMMAND,40155,0);
end;
procedure TMusAmp.FileInfoDlg;
begin
sendMessage(WAWindow,WM_COMMAND,40188,0);
end;
procedure TMusAmp.VisOptions;
begin
sendMessage(WAWindow,WM_COMMAND,40190,0);
end;
procedure TMusAmp.VisualizePlugInOptions;
begin
sendMessage(WAWindow,WM_COMMAND,40191,0);
end;
procedure TMusAmp.VisualizePlugIn;
begin
sendMessage(WAWindow,WM_COMMAND,40192,0);
end;
procedure TMusAmp.AboutBox;
begin
sendMessage(WAWindow,WM_COMMAND,40041,0);
end;
procedure TMusAmp.TitleAutoscrolling;
begin
sendMessage(WAWindow,WM_COMMAND,40189,0);
end;
procedure TMusAmp.OnTop;
begin
sendMessage(WAWindow,WM_COMMAND,40019,0);
end;
procedure TMusAmp.WindowShade;
begin
sendMessage(WAWindow,WM_COMMAND,40064,0);
end;
procedure TMusAmp.PlaylisWindowShade;
begin
sendMessage(WAWindow,WM_COMMAND,40266,0);
end;
procedure TMusAmp.Doublesize;
begin
sendMessage(WAWindow,WM_COMMAND,40165,0);
end;
procedure TMusAmp.Equalizer;
begin
sendMessage(WAWindow,WM_COMMAND,40036,0);
end;
procedure TMusAmp.PlayList;
begin
sendMessage(WAWindow,WM_COMMAND,40040,0);
end;
procedure TMusAmp.MainWindow;
begin
sendMessage(WAWindow,WM_COMMAND,40258,0);
end;
procedure TMusAmp.MiniBrowser;
begin
sendMessage(WAWindow,WM_COMMAND,40298,0);
end;
procedure TMusAmp.EasuMove;
begin
sendMessage(WAWindow,WM_COMMAND,40186,0);
end;
procedure TMusAmp.RepeatOnOff;
begin
sendMessage(WAWindow,WM_COMMAND,40022,0);
end;
procedure TMusAmp.Shuffle;
begin
sendMessage(WAWindow,WM_COMMAND,40023,0);
end;
procedure TMusAmp.JToTime;
begin
sendMessage(WAWindow,WM_COMMAND,40193,0);
end;
procedure TMusAmp.JToFile;
begin
sendMessage(WAWindow,WM_COMMAND,40194,0);
end;
procedure TMusAmp.SkinDlg;
begin
sendMessage(WAWindow,WM_COMMAND,40219,0);
end;
procedure TMusAmp.CurrentVisPlugIn;
begin
sendMessage(WAWindow,WM_COMMAND,40221,0);
end;
procedure TMusAmp.SkinReload;
begin
sendMessage(WAWindow,WM_COMMAND,40291,0);
end;
procedure TMusAmp.Close;
begin
sendMessage(WAWindow,WM_COMMAND,40001,0);
end;
procedure TMusAmp.EditBMarks;
begin
sendMessage(WAWindow,WM_COMMAND,40320,0);
end;
procedure TMusAmp.SetBMark;
begin
sendMessage(WAWindow,WM_COMMAND,40321,0);
end;
procedure TMusAmp.AudioCD;
begin
sendMessage(WAWindow,WM_COMMAND,40323,0);
end;
procedure TMusAmp.LoadEQ;
begin
sendMessage(WAWindow,WM_COMMAND,40253,0);
end;
procedure TMusAmp.SaveEQ;
begin
sendMessage(WAWindow,WM_COMMAND,40254,0);
end;
procedure TMusAmp.LoadEQDlg;
begin
sendMessage(WAWindow,WM_COMMAND,40172,0);
end;
procedure TMusAmp.AuloLoadEQDlg;
begin
sendMessage(WAWindow,WM_COMMAND,40173,0);
end;
procedure TMusAmp.LoadDefaultEQ;
begin
sendMessage(WAWindow,WM_COMMAND,40174,0);
end;
procedure TMusAmp.SaveDefaultEQ;
begin
sendMessage(WAWindow,WM_COMMAND,40175,0);
end;
procedure TMusAmp.DeleteEQDlg;
begin
sendMessage(WAWindow,WM_COMMAND,40178,0);
end;
procedure TMusAmp.IncreaseVol(value: integer);
var i:integer;
begin
for i:=1 to value do
sendMessage(WAWindow,WM_COMMAND,40058,0);
end;
procedure TMusAmp.DecreaseVol(value: integer);
var i:integer;
begin
for i:=1 to value do
sendMessage(WAWindow,WM_COMMAND,40059,0);
end;
function TMusAmp.ListLength: integer;
begin
ListLength:=sendMessage(WAWindow,WM_USER,0,124);
end;
procedure TMusAmp.Reload;
begin
end;
end.
← →
Бася (2006-01-27 20:11) [7]Я кажется разобрался. Спасибо!
Тут немного есть закорючки, но с функциональностью я все понял. Спасибо!
← →
mozgan (2006-01-27 20:53) [8]Здрасте, Мастера!
Тоже искал давно подобной инфы. Просто редкость!
Я как начинающий во многом не разобрался, а именно вот в таком примере, написанном Leshiy....
Как вариант:
Запускаешь Winamp с парамертом в виде файла с полным путем.
Например: C:\Progra~1\Winamp\winamp.exe D:\Music\Aria\Вавилон.mp3
Что тут имелось в виду? Использовние ShellExecute?
Подскажите, пожалуйста!
Страницы: 1 вся ветка
Форум: "Начинающим";
Текущий архив: 2006.02.12;
Скачать: [xml.tar.bz2];
Память: 0.51 MB
Время: 0.041 c