0
0

Does someone know how to move/convert the RAW data of the winamp input plugins (char *buf) to a FMOD streamcallback buffer (void *buff) ?

  • You must to post comments
0
0

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

  • You must to post comments
0
0

HI DjMaze,

Here is a PCM format :
L= Left,
R= Right.
M= Mono
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]
1M1M1M1M1M1M ….

[u:1a1wys6q]In mono 16 bits :[/u:1a1wys6q]
2M2M2M2M2M2M ….

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));

  • You must to post comments
0
0

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

  • You must to post comments
0
0

[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.

  • You must to post comments
0
0

Hmm well ok my code:

[code:2l2hn10b]char *wabuffer;
int bufflength;
bool writebuf;

int WinAmpOutWrite(char *buf, int len)
{
bufflength = len;
if (len >0) wabuffer = buf;
else Form1->EMCFMOD1->FMOD->FSOUND_Stream_Stop(fStream);
writebuf = false;
Sleep(0);
return 0;
// 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;
return 1;
}[/code:2l2hn10b]

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 ๐Ÿ˜ฅ

  • You must to post comments
0
0

What’s your FMOD buffer length ? if less, that’s normal…

Gregggg
PS : Oups…. SizeOf… 8)

  • You must to post comments
0
0

FMOD buffer length is also 4608

BTW i’ve found the memcpy error.
The first winampoutwrite was 0 bytes and i did a nasty memcpy with 4608 bytes.

memcpy works now but the sound plays very slow ๐Ÿ˜•

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.