diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2010-01-18 09:40:56 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-01-18 10:38:30 -0500 |
commit | a32f66746c635ebf2341d99b3d4c0cc1c11b2cbf (patch) | |
tree | 3393a6d953af90a9b931058b4f180e5b32f40577 /sound/core | |
parent | ed69c6a8eef679f2783848ed624897a937a434ac (diff) |
sound: seq_timer: simplify snd_seq_timer_set_tick_resolution() parameters
As snd_seq_timer_set_tick_resolution() is always called with the same
three fields of struct snd_seq_timer, it suffices to give that as the
only parameter.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/seq/seq_timer.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index f745c317d6af..160b1bd0cd62 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c | |||
@@ -33,22 +33,21 @@ | |||
33 | 33 | ||
34 | #define SKEW_BASE 0x10000 /* 16bit shift */ | 34 | #define SKEW_BASE 0x10000 /* 16bit shift */ |
35 | 35 | ||
36 | static void snd_seq_timer_set_tick_resolution(struct snd_seq_timer_tick *tick, | 36 | static void snd_seq_timer_set_tick_resolution(struct snd_seq_timer *tmr) |
37 | int tempo, int ppq) | ||
38 | { | 37 | { |
39 | if (tempo < 1000000) | 38 | if (tmr->tempo < 1000000) |
40 | tick->resolution = (tempo * 1000) / ppq; | 39 | tmr->tick.resolution = (tmr->tempo * 1000) / tmr->ppq; |
41 | else { | 40 | else { |
42 | /* might overflow.. */ | 41 | /* might overflow.. */ |
43 | unsigned int s; | 42 | unsigned int s; |
44 | s = tempo % ppq; | 43 | s = tmr->tempo % tmr->ppq; |
45 | s = (s * 1000) / ppq; | 44 | s = (s * 1000) / tmr->ppq; |
46 | tick->resolution = (tempo / ppq) * 1000; | 45 | tmr->tick.resolution = (tmr->tempo / tmr->ppq) * 1000; |
47 | tick->resolution += s; | 46 | tmr->tick.resolution += s; |
48 | } | 47 | } |
49 | if (tick->resolution <= 0) | 48 | if (tmr->tick.resolution <= 0) |
50 | tick->resolution = 1; | 49 | tmr->tick.resolution = 1; |
51 | snd_seq_timer_update_tick(tick, 0); | 50 | snd_seq_timer_update_tick(&tmr->tick, 0); |
52 | } | 51 | } |
53 | 52 | ||
54 | /* create new timer (constructor) */ | 53 | /* create new timer (constructor) */ |
@@ -96,7 +95,7 @@ void snd_seq_timer_defaults(struct snd_seq_timer * tmr) | |||
96 | /* setup defaults */ | 95 | /* setup defaults */ |
97 | tmr->ppq = 96; /* 96 PPQ */ | 96 | tmr->ppq = 96; /* 96 PPQ */ |
98 | tmr->tempo = 500000; /* 120 BPM */ | 97 | tmr->tempo = 500000; /* 120 BPM */ |
99 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq); | 98 | snd_seq_timer_set_tick_resolution(tmr); |
100 | tmr->running = 0; | 99 | tmr->running = 0; |
101 | 100 | ||
102 | tmr->type = SNDRV_SEQ_TIMER_ALSA; | 101 | tmr->type = SNDRV_SEQ_TIMER_ALSA; |
@@ -180,7 +179,7 @@ int snd_seq_timer_set_tempo(struct snd_seq_timer * tmr, int tempo) | |||
180 | spin_lock_irqsave(&tmr->lock, flags); | 179 | spin_lock_irqsave(&tmr->lock, flags); |
181 | if ((unsigned int)tempo != tmr->tempo) { | 180 | if ((unsigned int)tempo != tmr->tempo) { |
182 | tmr->tempo = tempo; | 181 | tmr->tempo = tempo; |
183 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq); | 182 | snd_seq_timer_set_tick_resolution(tmr); |
184 | } | 183 | } |
185 | spin_unlock_irqrestore(&tmr->lock, flags); | 184 | spin_unlock_irqrestore(&tmr->lock, flags); |
186 | return 0; | 185 | return 0; |
@@ -205,7 +204,7 @@ int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq) | |||
205 | } | 204 | } |
206 | 205 | ||
207 | tmr->ppq = ppq; | 206 | tmr->ppq = ppq; |
208 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq); | 207 | snd_seq_timer_set_tick_resolution(tmr); |
209 | spin_unlock_irqrestore(&tmr->lock, flags); | 208 | spin_unlock_irqrestore(&tmr->lock, flags); |
210 | return 0; | 209 | return 0; |
211 | } | 210 | } |