Exemplo n.º 1
0
/* Feed Sound Data */
void SoundFeedStreamData(unsigned char* pSound,long lBytes)
{
    //LOG_ENTER();
#ifndef NOSOUND

    //LOGD("ENTER SoundFeedStreamData(%p, %d), enable_audio=%d", pSound, lBytes, enable_audio);

  //u32 render_ticks;
	if( enable_audio == 0 ) return;
  
  if(pSound == NULL || lBytes <= 0 || lBytes > 32768) // || sound_new_buffer != 0) 
  {
    //LOG_LEAVE();
    return;
  }

  //memcpy(sound_buffer, pSound, lBytes);
  //sound_buffer_bytes = lBytes;
  //pthread_cond_signal(&sound_cond);

#ifdef TIGER_KING
   extern int stop;
   if(!stop) {
	   render_audio((s16*)pSound, lBytes);
   }
#else
  render_audio((s16*)pSound, lBytes);
#endif
  
#if 0
	if(last_render_ticks == 0)
	{
	  last_render_ticks = timeGetTime_spu();
	}
	
  render_ticks = timeGetTime_spu();
	if(render_ticks < last_render_ticks + 5)
	{
    u32 render_delta = (last_render_ticks + 5) - render_ticks;
    if(render_delta < 5)
    {
      usleep(render_delta * 1000);
    }
	}
	last_render_ticks = timeGetTime_spu();
#endif
#endif

    //LOG_LEAVE();
}
Exemplo n.º 2
0
unsigned long SoundGetBytesBuffered(void)
{
	if( enable_audio == 0 ) return TESTSIZE+1;
	
	if(last_ticks == 0)
	{
	  last_ticks = timeGetTime_spu();
	}
	
	if(timeGetTime_spu() >= last_ticks + 2)
	{
	  last_ticks = timeGetTime_spu();
    return 0;
	}
	
  return TESTSIZE+1;
}