PDA

View Full Version : Winamp Plugin and opengl


galactic_fox
27th April 2005, 00:15
Hi guys


I'm newbie when it comes to winamp. I've downloaded the sdk off of the site. I managed to get a glut window and some opengl working. However I can't seem to get the data spectrum or wave data. When I plot them as a line I get a stationary line not a moving wave. here's my basis setup maybe you tell me what I'm doing wrong.

-create a glut window config_getinifn()
-I copy the this_mod(the pointer) to a global pointer
- I also call glutDisplayFunc(render3);,
glutIdleFunc(render3);, glutMainLoop(); there too

void render3
-int x, y;
float i;
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 1.0);
glColor3f(0,1,0);
glLineWidth(2.0);
glBegin(GL_LINES);
for(y=1;y<256;y=y++)
{
for(x=1;x<288;x++)
{
i=globalpointer->waveformData[y][x];
glVertex2i(x,i);
}
}
glEnd();
glutSwapBuffers(); //printf("{%d %d} {%d %d} \n", results->x,results->y,results->x1,results->y1);
return 0;


any suggestions would be great help I've been stuck on this for a long time


thanks in advance

saivert
2nd May 2005, 07:46
Set the waveformData member of the winampVisModule struct to 2.

Then use these for loops instead:

// draw oscilliscope
for (y = 0; y < this_mod->nCh; y ++)
{
int x, y; // x is the horizontal axis, y is channel flag (left = 0, right = 1)

MoveToEx(memDC,0,(y*256)>>(this_mod->nCh-1),NULL);
for (x = 0; x < 288; x ++)
{
LineTo(memDC,x,(y*256 + this_mod->waveformData[y][x]^128)>>(this_mod->nCh-1));
}
}



If that is C you tried to show us, then you should rethink your choice of programming language. Please don't post such code except when you label it as pseudo-code.

Cummi Bare
2nd May 2005, 08:00
Heh, saivert, you sound harsh. Just out of interest can you answer this. Originally posted by saivert
If that is C you tried to show us, then you should rethink your choice of programming language. Why?Originally posted by saivert
Please don't post such code except when you label it as pseudo-code. And why?

Cheers

Cummi Bare
2nd May 2005, 08:32
Holy Shit saivert, you're on a mission this morning. :D

saivert
2nd May 2005, 09:45
@Cummi Bare: Thanks for noticing all my replies this day. :-)

I wrote what I wrote because the code he posted below his questions was terrible. It did not look like real C code at all. And if it is, then I have to start reading those C/C++ programming books again (and again).

I mean, what the h*** is this:

void render3
-int x, y;


You can't declare a function like that (void render3).
It should be this:



void render3()
{
int x, y; // No dash (-) before it.
// ...code...
}


And he did not indent his either. Very hard to read then...

Cummi Bare
2nd May 2005, 10:04
Originally posted by saivert
I wrote what I wrote because the code he posted below his questions was terrible. It did not look like real C code at all.Oh OK, I just assumed he was being ultra sloppy, or off his face, and wasn't posting the actual code he's using.Originally posted by saivert
I mean, what the h*** is this: :D