Programming with arts

Jorge j.windmeisser at elogix.info
Sun Sep 14 18:03:02 BST 2003


Hello to all,

I'm trying to develop a telephony program on KDE. How do I pass the ttyI audio data to the arts
server?

I've programmed a server and for testing purpouses I've redirected the ttyI output (uLaw format)
through my server to a file called test. Then I've written the following code:

int main()
{
    arts_stream_t stream;
    unsigned char buffer[1024];
    char byte;
    int bytes;
    int errorcode;
    errorcode = arts_init();
    if (errorcode < 0)
    {
        fprintf(stderr, "arts_init error: %s\n", arts_error_text(errorcode));
        return 1;
    }
    stream = arts_play_stream(8000, 8, 1, "artsctest");
    FILE *input;
    if ((input = fopen( "/var/tmp/testing", "r" ))<0)
       {
       perror("File");
       }
    int i=0;
    byte = getc(input);
    while ( byte != EOF ) 
          {
          byte = getc( input );
          buffer[i]=byte;
          ++i;    
          if (i==sizeof(buffer))
             {
             i=0;
             errorcode = arts_write(stream, buffer, sizeof(buffer));
             if (errorcode < 0)
                {
                fprintf(stderr, "arts_write error: %s\n", arts_error_text(errorcode));
                return 1;
                }
             }
          }
    arts_close_stream(stream);
    arts_free();
    return 0;
}

When I replay the "testing" file, You can hear some "ethereal" sounds with a lot of noise and
clicks in it.

If I redirect the autput of ttyI with e.g. "cat /dev/ttyI > /dev/audio" the sound is OK but delayed.

I've waded through the internet to look for furter information on arts programming, but it seems
that it's very scarce and incomplete.

What I'm doing wrong?

This is the page where my project is located:

http://www.elogix.ch/linux_en.html

Thank you in advance.



More information about the kde-multimedia mailing list