AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Winamp Visualisierung (Plugin)
Thema durchsuchen
Ansicht
Themen-Optionen

Winamp Visualisierung (Plugin)

Ein Thema von seim · begonnen am 6. Nov 2008 · letzter Beitrag vom 22. Okt 2009
Antwort Antwort
Benutzerbild von seim
seim

Registriert seit: 11. Nov 2007
83 Beiträge
 
#1

Winamp Visualisierung (Plugin)

  Alt 6. Nov 2008, 22:26
Moinsen..

ich hab' hier mal die Beschreibung eines Plugins für die Visualisierung in Winamp.. Das ist ein 1:1 Copy&Paste Zitat von hier, allerdings ist die Seite früher oder später eh wieder down oder umgezogen (so ist das meistens) und dann ist auch der Code weg daher stell ich das nochmal hier für alle rein:

Data Structures

First off you have to create a DLL. winamp expects your DLL to export winampVisGetHeader

exports winampVisGetHeader; Then in the unit containing the rest of the code add the following data structures. Winamp will use this record to pas information to and execute the functions it needs.

Delphi-Quellcode:
type
  PWinampVisModule = ^TwinampVisModule;
  TwinampVisModule = record
    description : PChar; // description of module
    hwndParent : HWND; // parent window (filled in by calling app)
    hDllInstance : HINST; // instance handle to this DLL (filled in by calling app)
    sRate : Cardinal; // sample rate (filled in by calling app)
    nCh : Cardinal; // number of channels (filled in...)
    latencyMs : Cardinal; // latency from call to Render to actual drawing
    delayMs : Cardinal; // delay between calls to Render (in ms)

    // the data is filled in according to the respective Nch entry
    spectrumNCh : Cardinal; // Number of channels
    waveformNCh : Cardinal; // Number of channels
    spectrumData : Array [0..1, 0..575] of Byte; // waveform data (values from 0-255)
    waveformData : Array [0..1, 0..575] of Byte; // spectrum data (values from 0-255)

    // functions that winamp calls to configure the plugin, initialise ...
    Config : procedure(const PVisModule : PwinampVisModule); cdecl;
    Init : function (const PVisModule : PwinampVisModule) : Integer; cdecl;
    Render : function (const PVisModule : PwinampVisModule) : Integer; cdecl;
    Quit : procedure(const PVisModule : PwinampVisModule); cdecl;
    userData : procedure; cdecl; // user data, optional
  end;
  
  PwinampVisHeader = ^TwinampVisHeader;
  TwinampVisHeader = record
    version : Integer;
    description : PChar; // description of library
    getModule : function (Which : Integer) : PwinampVisModule; cdecl;
  end;
I then also added a forward declaration of the functions that will be called by winamp.

Delphi-Quellcode:
  // forward declaration of the procedures
  function GetModule(Which :integer) :PWinAMPVisModule; cdecl;
  procedure Config(const PVisModule : PWinAMPVisModule); cdecl;
  function Init(const PVisModule : PWinAMPVisModule) : integer; cdecl;
  function Render(const PVisModule : PWinAMPVisModule) :integer; cdecl;
  procedure Quit(const PVisModule : PWinAMPVisModule); cdecl;
You also need to add the function that will be exported before you get to the implementation

function winampVisGetHeader : PwinampVisHeader; cdecl; export;
Global Variables

This section might change depending on your implementation of the plugin. For my plugin I created the window using API calls. You could do it using the standard Delphi Forms.

Delphi-Quellcode:
implementation

const
  WND_TITLE = 'Jan OpenGL WinAMP Plugin';
var
  h_Wnd : HWND; // Global window handle
  h_DC : HDC; // Global device context
  h_RC : HGLRC; // OpenGL rendering context
  keys : Array[0..255] of Boolean; // Holds keystrokes
  Active : Boolean = FALSE; // State of the plugin

Functions called by Winamp

This is a list of the functions called by winamp and what they are for.

WinAMPVisGetHeader : Return as pointer to the WinAMPVisHeader

Delphi-Quellcode:
function WinAMPVisGetHeader :PWinAMPVisHeader;
begin
  Result := @HDR; // Return the main header
end;
GetModule : Returns a pointer to the WinampVisModule. A variable containing the plugin information and functions.

Delphi-Quellcode:
function GetModule(Which : integer) : PwinampVisModule;
begin
  if which = 0 then
    Result := @VisModule
  else
    Result := nil;
end;
Config : This function gets called when the user got to the plugin configuration section on winamp. It should display the plugin options like screensize and any other display options. These options should then be stored in the "plugin.ini" file in the winamp plugins folder.

Delphi-Quellcode:
procedure Config(const PVisModule : PWinAMPVisModule);
begin
  Form1 :=TForm1.Create(nil);
  try
    Form1.ShowModal;
  finally
    Form1.Free;
  end;
end;
Init : The initialisation function should get the plugin display options from the "plugin.ini" file in the winamp\plugins folder. All global variable get initialised here. In the code that I use, I create the glWindow here and initialise OpenGL

Delphi-Quellcode:
function Init(const PVisModule :PWinAMPVisModule) :integer;
begin
  ...
  // Get plugin config details
  ...
  // create and initialise the window
  ...
end;
Render : This is the main function where everything happens. The number of times that this function gets called depends on the DelayMS value in the VisModule. A value of 25 will tell winamp to call this function every 25 milliseconds.
Here you would render the image and check for any key presses.

Delphi-Quellcode:
function Render(const PVisModule : PWinAMPVisModule) : Integer;
var LastTime : DWord;
begin
  if Active then
  begin
    glDraw(PVisModule); // Draw the scene
    SwapBuffers(h_DC); // Display the scene

    if (keys[VK_ESCAPE]) then // If user pressed ESC then set finised TRUE
    begin
      Active :=FALSE;
      PostQuitMessage(0);
      Result :=1;
      exit;
    end
    else
      ProcessKeys(PVisModule); // Check for any other key Pressed
  end;
  Result :=0;
end;
Quit : Closes the window.

Delphi-Quellcode:
procedure Quit(const PVisModule : PWinAMPVisModule);
begin
  glKillWnd(PVisModule, AppFullScreen);
end;
That's it. The other functions in my code are there to create the OpenGL window, watch for key presses and to render the GL scene. They were copied from my OpenGL template.
Angehängte Dateien
Dateityp: zip winamp_plugin-orginal_209.zip (165,5 KB, 26x aufgerufen)
Dateityp: zip winamp_plugin_own_576_bars_new_208.zip (227,0 KB, 33x aufgerufen)
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#2

Re: Winamp Visualisierung (Plugin)

  Alt 7. Nov 2008, 04:53
Neu ist das ja nicht mehr
Und außerdem eine uralt Schnittstelle die schon längst überholt ist.
Also nicht Winamp5 kompatibel.

gruss Emil
  Mit Zitat antworten Zitat
Benutzerbild von seim
seim

Registriert seit: 11. Nov 2007
83 Beiträge
 
#3

Re: Winamp Visualisierung (Plugin)

  Alt 7. Nov 2008, 16:18
Komisch bei mir geht das in Winamp5

http://www.youtube.com/watch?v=ruIlt3kZNmk
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#4

Re: Winamp Visualisierung (Plugin)

  Alt 7. Nov 2008, 17:29
Zitat von seim:
Komisch bei mir geht das in Winamp5

http://www.youtube.com/watch?v=ruIlt3kZNmk
Aber nicht im Fenster von Winamp selbst kann auch nicht da es ein
W2 Plugin ist.

gruss Emil
  Mit Zitat antworten Zitat
Benutzerbild von seim
seim

Registriert seit: 11. Nov 2007
83 Beiträge
 
#5

Re: Winamp Visualisierung (Plugin)

  Alt 9. Nov 2008, 16:09
Hmm is mir bei dem Cube nich so aufgefallen, das OpenGL Fenster is für mich nur ein zusätzliches Gimmick für Vorführzwecke.. Naja aber jetz wo du es sagst frag ich mich auch warum das nicht direkt im Winamp drin ist^^
  Mit Zitat antworten Zitat
22. Okt 2009, 09:25
Dieses Thema wurde von "Daniel G" von "Neuen Beitrag zur Code-Library hinzufügen" nach "Multimedia" verschoben.
Keine Eigenleistung, daher nicht für die CodeLib geeignet.
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:08 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz