Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Raymond <rayau@netvigator.com>
To: alsa-devel@lists.sourceforge.net
Subject: Re: au88x0_synth
Date: Wed, 20 Apr 2005 17:33:49 +0800	[thread overview]
Message-ID: <426621FD.2060209@netvigator.com> (raw)
In-Reply-To: <s5h64yjcdg7.wl@alsa2.suse.de>

If I am using 16 SRC (hw:0,0) to play 16 voices instead of 64 voices WT 
engine, Is it possible to create a snd_pcm_substream_t for each voice in 
snd-au8830-synth and calling snd_vortex_pcm_open(), 
snd_vortex_pcm_hw_params(), snd_vortex_pcm_prepare(), 
snd_vortex_pcm_hw_free(), snd_vortex_pcm_close() in snd-au8830 ?


Takashi Iwai wrote:
> Raymond wrote:
> 
>>4) Can those snd_vortex_synth_alloc(), snd_vortex_synth_free(),
>>snd_vortex_synth_bzero() replaced by kmalloc(), kfree(), ... instead of
>>implementing a Memory blocks Management system with those fuctions in
>>util_mem.c ?
> 
> 
> The functions in util_mem.c are used to allocate/free blocks in a
> (virtually) linear address space dynamically.  These functions
> themselves are no replacement for kmalloc/kfree at all.
> 

http://www.mail-archive.com/alsa-devel@lists.sourceforge.net/msg06924.html

http://www.mail-archive.com/alsa-devel@lists.sourceforge.net/msg11687.html

Do we need to align the samples at 4K boundary ?

If yes, how do we implement offset_ptr(,,) and vortex_memblk_t ?

#define PAGE SIZE 4096

#define get_aligned_page(offset)	((offset) >> 12)
#define aligned_page_offset(page)	((page) << 12)

#define snd_vortex_synth_alloc(vortex,size)
snd_util_mem_alloc(vortex->memhdr, size)

#define snd_vortex_synth_free(vortex,blk)
snd_util_mem_free(vortex->memhdr,blk)

int snd_vortex_synth_bzero(vortex_t *vortex, snd_util_memblk_t *blk, int
offset, int size)
{
	int page, nextofs, end_offset, temp, temp1;
	void *ptr;
	vortex_memblk_t *p = (vortex_memblk_t *)blk;

	offset += blk->offset & (PAGE_SIZE - 1);
	end_offset = offset + size;
	page = get_aligned_page(offset);
	do {
		nextofs = aligned_page_offset(page + 1);
		temp = nextofs - offset;
		temp1 = end_offset - offset;
		if (temp1 < temp)
			temp = temp1;
		ptr = offset_ptr(vortex, page + p->first_page, offset);
		if (ptr)
			memset(ptr, 0, temp);
		offset = nextofs;
		page++;
	} while (offset < end_offset);
	return 0;
}

/*
  * copy_from_user(blk + offset, data, size)
  */
int snd_vortex_synth_copy_from_user(vortex_t *vortex, snd_util_memblk_t
*blk, int offset, const char __user *data, int size)
{
	int page, nextofs, end_offset, temp, temp1;

	offset += blk->offset;
	end_offset = offset + size;
	page = get_aligned_page(offset) + 1;
	do {
		nextofs = aligned_page_offset(page);
		temp = nextofs - offset;
		temp1 = end_offset - offset;
		if (temp1 < temp)
			temp = temp1;
		if (copy_from_user(offset_ptr(vortex, offset), data, temp))
			return -EFAULT;
		offset = nextofs;
		data += temp;
		page++;
	} while (offset < end_offset);
	return 0;
}













-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728

  reply	other threads:[~2005-04-20  9:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-20  1:11 au88x0_synth Raymond
2005-03-21 20:00 ` au88x0_synth Takashi Iwai
2005-03-30  8:04   ` au88x0_synth Raymond
2005-03-30  8:09     ` au88x0_synth Clemens Ladisch
2005-04-12 14:14       ` au88x0_synth Raymond
2005-04-14 15:31       ` au88x0_synth Raymond
2005-04-15 13:07         ` au88x0_synth Takashi Iwai
2005-04-19  8:39           ` au88x0_synth Raymond
2005-04-19  9:39             ` au88x0_synth Takashi Iwai
2005-04-20  9:33               ` Raymond [this message]
2005-05-07 12:27               ` au88x0_synth Raymond
2005-03-30  8:13     ` au88x0_synth Alien
2005-03-30 10:08       ` Takashi Iwai
2005-03-30 10:21         ` Alien
2005-03-30 10:27           ` Takashi Iwai
2005-04-23  4:04       ` au88x0_synth Raymond
2005-04-23  7:28         ` au88x0_synth Alien
2005-04-28 10:21           ` au88x0_synth Raymond
2005-05-13 14:05           ` au88x0_synth Raymond
2005-05-13 14:27             ` au88x0_synth Alien
2005-05-14  8:12               ` au88x0_synth Raymond
2005-05-15 12:41                 ` au88x0_synth Alien
2005-06-06  2:56                   ` au88x0_synth Raymond
2005-06-06  8:49                     ` au88x0_synth Alien
2005-06-06  8:56                       ` Suspicious Attachment phiber
2005-06-06 11:03                       ` au88x0_synth Raymond
2005-06-06 14:35                         ` au88x0_synth Alien
2005-06-07 13:44                           ` au88x0_synth Raymond
2005-06-07 15:03                             ` au88x0_synth Alien
2005-03-31 22:52     ` au88x0_synth Manuel Jander
2005-07-01 13:42   ` au88x0_synth Raymond
2005-03-24 14:34 ` au88x0_synth Manuel Jander
2005-03-31  9:23   ` au88x0_synth Raymond
2005-03-31 10:40     ` au88x0_synth Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=426621FD.2060209@netvigator.com \
    --to=rayau@netvigator.com \
    --cc=alsa-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox