Skip to contentSkip to conversation

Is snd_pcm_hw_params_set_period_time_near the same as sampling period?

DISCUSSION Guilherme Longo 2 participants 2 messages Jul 23, 2009 – Jul 24, 2009

lore
Share & tools
lore
#0 lore raw

Hi mates.

I am trying to understand a piece of a code I am studing . What does exactly the functions snd_pcm_hw_params_set_period_time_near sets?

In my understand period time should be the time between 2 consecutive samples, but the following code does not appears to be calculating that.

buffer_time = 500000 // What I believe that means 0.5s as US is the unit used.

if (period_time == 0 && period_frames == 0) {
       if (buffer_time > 0)
             period_time = buffer_time / 4;
       else
           period_frames = buffer_frames / 4;
}

Is this period time the same as period describled in here:

http://www.fon.hum.uva.nl/praat/manual/sampling_period.html

Thanks!

#1 lore raw
Quoted 3 lines · Guilherme Longo

I am trying to understand a piece of a code I am studing . What does exactly the functions snd_pcm_hw_params_set_period_time_near sets?

The period time.

Quoted 2 lines

In my understand period time should be the time between 2 consecutive samples,

In ALSA, a period is the interval between consecutive interrupts from the sound card; this is the same as a fragment in OSS.

When the application tries to write/read more than than would be available, ALSA waits until the next period boundary before checking again.

HTH
Clemens