voice.c (c1f3ee120bb61045b1c0a3ead620d1d65af47130) voice.c (da3cec35dd3c31d8706db4bf379372ce70d92118)
1/*
2 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
3 * Creative Labs, Inc.
4 * Lee Revell <rlrevell@joe-job.com>
5 * Routines for control of EMU10K1 chips - voice manager
6 *
7 * Rewrote voice allocator for multichannel support - rlrevell 12/2004
8 *

--- 97 unchanged lines hidden (view full) ---

106}
107
108int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int number,
109 struct snd_emu10k1_voice **rvoice)
110{
111 unsigned long flags;
112 int result;
113
1/*
2 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
3 * Creative Labs, Inc.
4 * Lee Revell <rlrevell@joe-job.com>
5 * Routines for control of EMU10K1 chips - voice manager
6 *
7 * Rewrote voice allocator for multichannel support - rlrevell 12/2004
8 *

--- 97 unchanged lines hidden (view full) ---

106}
107
108int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int number,
109 struct snd_emu10k1_voice **rvoice)
110{
111 unsigned long flags;
112 int result;
113
114 snd_assert(rvoice != NULL, return -EINVAL);
115 snd_assert(number, return -EINVAL);
114 if (snd_BUG_ON(!rvoice))
115 return -EINVAL;
116 if (snd_BUG_ON(!number))
117 return -EINVAL;
116
117 spin_lock_irqsave(&emu->voice_lock, flags);
118 for (;;) {
119 result = voice_alloc(emu, type, number, rvoice);
120 if (result == 0 || type == EMU10K1_SYNTH || type == EMU10K1_MIDI)
121 break;
122
123 /* free a voice from synth */

--- 16 unchanged lines hidden (view full) ---

140
141EXPORT_SYMBOL(snd_emu10k1_voice_alloc);
142
143int snd_emu10k1_voice_free(struct snd_emu10k1 *emu,
144 struct snd_emu10k1_voice *pvoice)
145{
146 unsigned long flags;
147
118
119 spin_lock_irqsave(&emu->voice_lock, flags);
120 for (;;) {
121 result = voice_alloc(emu, type, number, rvoice);
122 if (result == 0 || type == EMU10K1_SYNTH || type == EMU10K1_MIDI)
123 break;
124
125 /* free a voice from synth */

--- 16 unchanged lines hidden (view full) ---

142
143EXPORT_SYMBOL(snd_emu10k1_voice_alloc);
144
145int snd_emu10k1_voice_free(struct snd_emu10k1 *emu,
146 struct snd_emu10k1_voice *pvoice)
147{
148 unsigned long flags;
149
148 snd_assert(pvoice != NULL, return -EINVAL);
150 if (snd_BUG_ON(!pvoice))
151 return -EINVAL;
149 spin_lock_irqsave(&emu->voice_lock, flags);
150 pvoice->interrupt = NULL;
151 pvoice->use = pvoice->pcm = pvoice->synth = pvoice->midi = pvoice->efx = 0;
152 pvoice->epcm = NULL;
153 snd_emu10k1_voice_init(emu, pvoice->number);
154 spin_unlock_irqrestore(&emu->voice_lock, flags);
155 return 0;
156}
157
158EXPORT_SYMBOL(snd_emu10k1_voice_free);
152 spin_lock_irqsave(&emu->voice_lock, flags);
153 pvoice->interrupt = NULL;
154 pvoice->use = pvoice->pcm = pvoice->synth = pvoice->midi = pvoice->efx = 0;
155 pvoice->epcm = NULL;
156 snd_emu10k1_voice_init(emu, pvoice->number);
157 spin_unlock_irqrestore(&emu->voice_lock, flags);
158 return 0;
159}
160
161EXPORT_SYMBOL(snd_emu10k1_voice_free);