Archive: inform APE of samplerate


21st December 2004 11:22 UTC

inform APE of samplerate
visualization plugins get informed of the samplerate, so APEs should too.


21st December 2004 16:05 UTC

Are you saying there should be an APE that lets you access the sample rate?

Well Mp3's are almost always 44100 samples per second, but more importantly its not very useful information to have availible. Can you be a bit more descriptive?


21st December 2004 16:58 UTC

say we had this, then what would it add to the presets that were made with it compared with those that don't?

Don't get me wrong; I'm not saying it is impossible, but what would be the benefits? I don't get that either


21st December 2004 21:09 UTC

First, I'm not asking for an APE which reports samplerate, I'm asking for the APE API to have samplerate available, so that people making APEs can access it, the same way visualizations plugins can.

So the advantage is clear. You can do frequency specific calculations. I use my own FFT, but I assume the 576 band FTT that's passed to the APE is scaled to the correct samplerate. So a 1khz sine wave played at anything except 44.1 does not look like 1khz to the APE.

Most mp3s are 44.1khz, I agree. But obviously not all of them are, and the majority of low-bandwidth shoutcast streams are 22khz.

I'm facing the difference between my visualization plugin doing the right thing, and my APE plugin not. I would much rather release both, rather than re-implement all of the control AVS gives you over drawing, fullscreen, etc in the visualization plugin to cover my bases.


22nd December 2004 21:13 UTC

You can retrieve it into your APE, just retrieve Winamp's handle then use WM_USER id 126 (with data=0)

here's a piece of code :

HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);
int samplerate = SendMessage(hwndWinamp,WM_USER, 0, 126);

I hope this help .. or maybe I don't understand your wish.


22nd December 2004 22:30 UTC

Good thinking goebish, that works to an extent.
I should mention for anyone that reads this thread that despite the documentation in wa_ipc.h, the IPC_GETINFO (126) message with mode=0 returns the khz sampling rate, for example 44. So if you always multiply the result by 1000 you'll get rates like 44000 and 22000.

So that solves that problem (within <1%).

On a side note, has anyone noticed that the oscilloscope passed to an APE is different from that passed to a visualization plugin? I don't know if it's taking it from a different source, or applying some effect before it gets to the APE, or just dropping out some points, but there is an obvious difference between the two sets of data.


23rd December 2004 10:03 UTC

AVS get audio data in 8 bits/sample format (maybe to prevent high quality ripping ?)


23rd December 2004 21:09 UTC

Visualization plugins also get 8 bits/sample. It's more than just low quality, there's a strange phase relationship between the two channels in AVS, that the visualization plugins do not see.
(I don't see much reason to provide more that 8 bits for visualization. Couldn't you still do high quality ripping by making an output plugin? The thought had crossed my mind though, every player with visualization lets you rip an 8bit copy of whatever you're playing.)