|
@@ -191,14 +191,15 @@ int snd_seq_timer_set_tempo(struct snd_seq_timer * tmr, int tempo)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-/* set current ppq */
|
|
|
-int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq)
|
|
|
+/* set current tempo and ppq in a shot */
|
|
|
+int snd_seq_timer_set_tempo_ppq(struct snd_seq_timer *tmr, int tempo, int ppq)
|
|
|
{
|
|
|
+ int changed;
|
|
|
unsigned long flags;
|
|
|
|
|
|
if (snd_BUG_ON(!tmr))
|
|
|
return -EINVAL;
|
|
|
- if (ppq <= 0)
|
|
|
+ if (tempo <= 0 || ppq <= 0)
|
|
|
return -EINVAL;
|
|
|
spin_lock_irqsave(&tmr->lock, flags);
|
|
|
if (tmr->running && (ppq != tmr->ppq)) {
|
|
@@ -208,9 +209,11 @@ int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq)
|
|
|
pr_debug("ALSA: seq: cannot change ppq of a running timer\n");
|
|
|
return -EBUSY;
|
|
|
}
|
|
|
-
|
|
|
+ changed = (tempo != tmr->tempo) || (ppq != tmr->ppq);
|
|
|
+ tmr->tempo = tempo;
|
|
|
tmr->ppq = ppq;
|
|
|
- snd_seq_timer_set_tick_resolution(tmr);
|
|
|
+ if (changed)
|
|
|
+ snd_seq_timer_set_tick_resolution(tmr);
|
|
|
spin_unlock_irqrestore(&tmr->lock, flags);
|
|
|
return 0;
|
|
|
}
|