Programming KDEArts, how?

Jorge j.windmeisser at elogix.info
Wed Dec 10 17:04:48 GMT 2003


Hi Arnold,

Am Mittwoch, 10. Dezember 2003 17.21 schrieb Arnold Krille:
> Sorry, didn't notice your first mail on monday. (was busy)

No problem!

> On Wednesday 10 December 2003 17:00, Jorge wrote:
> > I've tried to use KAudioPlayStream, with negative results. The problem is
> > that the whole thing isn't really described, or I haven't found it.
> > Has anyone links to docus for KAudioPlayStream?
>
> Yes. The link is in the reply-to of this mail ;-)

A living docu! :)

> Your are right, KAudioPlayStream isn't fully developed. It just works in
> polling-mode. In that mode the signal requestData( QByteArray ) is emitted
> and you have to fill the array with your data. start and stop should be
> self-explaining, I hope.

Yes, after donwloading kartsserver, kaudiomanagerplay, kaudioplaystream, 
etc..., adapting them so that the thing compiles on my config, I noticed that 
the ::write(...) method was empty! ;) BTW, the QByteArray thing drives me 
crazy! I dunno how to use the beast!

My code looks is:

void Phonelist::playArts()
     {
    arts_stream_t stream;
    char bufferOut[16];
    char out_val;
    int out_int;

    int i=0;

    stream = arts_play_stream( 8012, 8, 1, "artsctest" );

    string data;

    int errorcode;

    while ( sockData->getData(data,16)) /* buffer, bytes */
          {                      
          bzero( bufferOut, sizeof( bufferOut ) );
          for (int index = 0; index < 16; index++)
            {
            out_int = mulaw[(unsigned char)data[i]];   /* mu-law to linear */
            out_int = out_int >> 8;        /* rescale for 8 bit values */
            out_val = out_int+128;         /* convert to .WAV format */
            bufferOut[index] = out_val;     /* write the output byte */
            i++;
            }

          errorcode = arts_write(stream, &bufferOut, sizeof(bufferOut));
          if (errorcode < 0)
             {
             KMessageBox::error(0, i18n( "writing to arts server" ) );
             return;
             }
          }
    arts_close_stream(stream);                    
    }

The problem is that the response isn't very good (the data is coming from a 
server) and that it, obviously, freezes the program until the while is 
finished.

> For a example see the sources of KRec (in kde-multimedia). It uses the
> KAudio*Stream classes...

Hmmm, that means wading through the internet, do you have the relevant 
sources? If you, could you mail them to me?

Thank you for your help. Jorge Windmeisser

> Arnold

-- 
eLogix
Lauigrund
6354 Vitznau

Switzerland

www.elogix.info or www.elogix.ch



More information about the kde-multimedia mailing list