samplerate

git-svn-id: svn://elaine/murooma/trunk@307 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-10-16 05:40:17 +00:00
parent b715396832
commit 42ef09e726
5 changed files with 103 additions and 42 deletions

View file

@ -121,14 +121,15 @@ void Player::stop()
void Player::worker()
{
unsigned int pcm;
snd_pcm_sframes_t avail;
snd_pcm_sframes_t delay;
snd_pcm_sframes_t framesAvail;
snd_pcm_sframes_t framesDelay;
active_ = true;
while (active_)
{
snd_pcm_avail_delay(pcm_handle, &avail, &delay);
if (stream_->getPlayerChunk(buff, chronos::usec((chronos::usec::rep)(1000 * (double)delay / stream_->format.msRate())), frames))
snd_pcm_avail_delay(pcm_handle, &framesAvail, &framesDelay);
chronos::usec delay((chronos::usec::rep)(1000 * (double)framesDelay / stream_->format.msRate()));
if (stream_->getPlayerChunk(buff, delay, frames))
{
if ((pcm = snd_pcm_writei(pcm_handle, buff, frames)) == -EPIPE)
{