Hmm well ok my code:
int WinAmpOutWrite(char *buf, int len)
bufflength = len;
if (len >0) wabuffer = buf;
writebuf = false;
// 0 on success. Len == bytes to write (<= 8192 always). buf is straight audio data.
// 1 returns not able to write (yet). Non-blocking, always.
signed char FMODStreamCallback(FSOUND_STREAM *stream, void *buff, int len, int param)
signed short *stereo16bitbuffer = (signed short *)buff;
signed short *wabuff = (signed short *)wabuffer;
memcpy(stereo16bitbuffer, wabuff, sizeof(bufflength));
writebuf = true;
As you can see Winamp sends a filled (char *buf) with RAW straight audio data.
The winamp bufflength is 4608 bytes
So when i use memcpy in FMOD it always raises a error 😥
Ehm brett i’m asking this because i don’t know nothing about audiodata.
De winamp RAW data is 44100 hz, stereo and 16bit.
For the rest is don’t know nothing about it 😥
I learned programming myself and never did any data conversions yet.
And RAW = PCM signed raw audio
Here is a PCM format :
1 > 1Byte (8 Bits)
2 > 2byte. (16Bits)
[u:1a1wys6q]In Stereo 8bits :[/u:1a1wys6q]
1L1R1L1R and so on…
[u:1a1wys6q]In Stereo 16Bits :[/u:1a1wys6q]
2L2R2L2R2L2R and so on…
[u:1a1wys6q]In mono 8 bits :[/u:1a1wys6q]
[u:1a1wys6q]In mono 16 bits :[/u:1a1wys6q]
That’s exactly what Brett said….
So, if your WINAMP buffer is the same as the FMOD buffer ( Mono/Stereo 8/16Bits), you can copy maybe like that (i’m not a C specialist) :
CopyMemory( FMODBuff, WINAMPBuf, SizeOf(Buf));
[quote="djmaze":yv860468]Ok tried that already but sizeof(char *buf) always says 4 but the length is 4608.
And it always throws a memmory read error at 0x00000000[/quote:yv860468]
You must have meant sizeof((char*)buf), because it wouldn’t be legal code otherwise. Anyway, sizeof does not give you the size of the memory block that the pointer is pointing to, it gives you the size of the pointer itself, which is always 4 byte on 32bit architectures.
You cannot determine the lenght of a buffer that some function returned to your code, you must have got the lenght somewhere.
I don’t know how winamp input plugins work, i suggest you look at some example code on the net, i’m sure there’s something.
- night answered 14 years ago
Please login first to submit.