Beispiel #1
0
/* This function waits until it is possible to write a full sound buffer */
static void NAS_WaitAudio(_THIS)
{
	while ( this->hidden->buf_free < this->hidden->mixlen ) {
		AuEvent ev;
		AuNextEvent(this->hidden->aud, AuTrue, &ev);
		AuDispatchEvent(this->hidden->aud, &ev);
	}
}
Beispiel #2
0
static void
NAS_flush (GstNasSink * sink)
{
    AuEvent ev;

    AuNextEvent (sink->audio, AuTrue, &ev);
    AuDispatchEvent (sink->audio, &ev);
}
Beispiel #3
0
static void flush_nas(out123_handle *ao)
{
    AuEvent         ev;
    
    while ((!info.data_sent) && (!info.finished)) {
        AuNextEvent(info.aud, AuTrue, &ev);
        AuDispatchEvent(info.aud, &ev);
    }
    info.data_sent = AuFalse;
}
static void nas_flush()
{
	AuEvent ev;

	_D(_D_INFO "flush");

	while (!info.data_sent && !info.finished) {
		AuNextEvent(info.aud, AuTrue, &ev);
		AuDispatchEvent(info.aud, &ev);
	}
	info.data_sent = AuFalse;
}
Beispiel #5
0
static int
nas_empty_event_queue(snsd_t *snsd)
{
	AuEvent ev;
	int result = 0;

	while (AuScanForTypedEvent(
		       snsd->snd->aud, AuEventsQueuedAfterFlush,
		       AuTrue, AuEventTypeElementNotify, &ev)) {
		AuDispatchEvent(snsd->snd->aud, &ev);
		result = 1;
	}
	return result;
}
Beispiel #6
0
static int nas_close(WINE_WAVEOUT* wwo)
{
  AuEvent ev;

  nas_free(wwo);

  AuStopFlow(wwo->AuServ, wwo->AuFlow, NULL);
  AuDestroyFlow(wwo->AuServ, wwo->AuFlow, NULL);
  AuFlush(wwo->AuServ);
  AuNextEvent(wwo->AuServ, AuTrue, &ev);
  AuDispatchEvent(wwo->AuServ, &ev);

  wwo->AuFlow = 0;
  wwo->open = 0;
  wwo->BufferUsed = 0;
  wwo->freeBytes = 0;
  wwo->SoundBuffer = NULL;
  return 1;
}
Beispiel #7
0
void
audio_play(int n,short *data)
{
 int endian = 1;
#define little_endian ((*((char *)&endian) == 1))
 int priv = 0;
 AuEvent ev;
 Sound s = SoundCreate(SoundFileFormatNone, little_endian ?
                       AuFormatLinearSigned16LSB : AuFormatLinearSigned16MSB,
                       1, samp_rate, n, "Chit chat");
 if (aud)
  {
#ifdef USE_ALL_ARGS
   AuStatus ret_status;
   AuFlowID flow = 0;
   int monitor = 0;
   int multiplier = 0;
   if (!AuSoundPlayFromData(aud, s, data, AuNone,
                            AuFixedPointFromFraction(volume, 100),
                            done, &priv,
                            &flow, &multiplier,
                            &monitor, &ret_status))
#else
   if (!AuSoundPlayFromData(aud, s, data, AuNone,
                            AuFixedPointFromFraction(volume, 100),
                            done, &priv,
                            NULL, NULL, NULL, NULL))
#endif
    perror("problems playing data");
   else
    {
     while (1)
      {
       AuNextEvent(aud, AuTrue, &ev);
       AuDispatchEvent(aud, &ev);
       if (priv)
        break;
      }
    }
  }
 SoundDestroy(s);
}
Beispiel #8
0
static void NAS_PlayAudio(_THIS)
{
	while (this->hidden->mixlen > this->hidden->buf_free) { /* We think the buffer is full? Yikes! Ask the server for events,
				    in the hope that some of them is LowWater events telling us more
				    of the buffer is free now than what we think. */
		AuEvent ev;
		AuNextEvent(this->hidden->aud, AuTrue, &ev);
		AuDispatchEvent(this->hidden->aud, &ev);
	}
	this->hidden->buf_free -= this->hidden->mixlen;

	/* Write the audio data */
	AuWriteElement(this->hidden->aud, this->hidden->flow, 0, this->hidden->mixlen, this->hidden->mixbuf, AuFalse, NULL);

	this->hidden->written += this->hidden->mixlen;
	
#ifdef DEBUG_AUDIO
	fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen);
#endif
}