esd help



why doesn't this code work?  output is:
	mark1
but 'mark2' is not printed out.  it seems to hang at esd_get_latency.

#include <iostream>
#include <esd.h>
#include <stdlib.h>
#include <unistd.h>

void main(){
  esd_format_t format = ESD_BITS16 | ESD_STEREO | ESD_STREAM | ESD_PLAY;
  int _fd = esd_play_stream_fallback(format, 8000, NULL, NULL);

  //write to esound
  //short buffer = calloc(256, (sizeof)short);
  int    elements = 512;
  short* buffer = (short*) calloc (elements,sizeof(short));
  size_t size = elements * sizeof(short);
  int wrote = write(_fd, buffer, size);

  //flush(_fd);

  cerr << "mark1\n";
  int lag = esd_get_latency(_fd);
  cerr << "lag = " << lag << "\n";

  cerr << "mark2\n";
}


-Tim




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]