0
0

Hello !

first, excuse my for my bad english :)

I would like to send sound via the network, an i need some help, it’s my first time dealing with fmod so be tolerant :p

I’m programming in C, and i did this :

  • On the talker side : from the example of “write to file”, i think it is good idea :

    record
    lock
    sendto (exactly like fwrite.. i think..)
    unlock
    record

  • On the listener side : i have a problem :( :

    // my buffer :
    long buf[RECORDRATE /2];(i have tested with * too)
    // my sample :
    samp = FSOUND_Sample_Alloc(FSOUND_UNMANAGED, RECORDRATE / 4, FSOUND_NORMAL , RECORDRATE, 255, 128, 255);
    // Here i receive in the buffer : (it works, i receive the lenght of bytes i sent from the talker)
    recvfrom(*sockreceveur, buf, (RECORDRATE/2) , 0,(struct sockaddr *)&blabla_addr, &addr_len)) == -1);
    // Here i upload the buffer to the sample :
    FSOUND_StopSound(channel);
    if (!FSOUND_Sample_Upload(samp,buf,FSOUND_16BITS | FSOUND_MONO | FSOUND_SIGNED))
    {
    printf(“%s\n”, FMOD_ErrorString(FSOUND_GetError()));
    }
    // Here i play the sample :
    channel = FSOUND_PlaySound(FSOUND_FREE, samp);
    ..

BUT sample_upload raise an error : An invalid parameter was passed to this function

I don’t find the reason :( Please can a generous roxor help me ? :)
Or also advice me on a better way to resolve my problem ? :)

thanks a lot

  • You must to post comments
0
0

[code:ucknn85i]
// my buffer :
long *buf[RECORDRATE /2];
[/code:ucknn85i]

Change to

[code:ucknn85i]
// my buffer :
long buf[RECORDRATE /2];
[/code:ucknn85i]

An array is a pointer so a pointer to an array is a double pointer.

  • You must to post comments
0
0

Hum.

In fact, of course I have tested many things before to post my probleme in here, and yes the *buf is a garbage from those tests :p thx for alerting me on this problem :)
But
With * or not, the result is the same :(

// my buffer :
long buf*[RECORDRATE /2]; –> long buf[RECORDRATE /2];

any other idea please ?

  • You must to post comments
0
0

hoo in fact maybe something is missing, and a propos i have a question :

my C program creates 2 threads with fork(), one for the talker, and one for the listener, do i need to put init for input and output in the talker code, and init for output on the listener code ?? well OK your answer make me understand this, i’ll try :)

thx :)

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.