All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim <terminator356@users.sourceforge.net>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: multi pcm and mmap problem
Date: Fri, 23 Nov 2007 20:31:03 -0500	[thread overview]
Message-ID: <200711232031.03910.terminator356@users.sourceforge.net> (raw)
In-Reply-To: <s5h3auxt4g8.wl%tiwai@suse.de>

Thank you! Thank you! Thank you!
Freaking awesome!
You fixed two bugs in one!
I can now use recent ALSA versions (and linux distros),
 AND I can combine the two cards at 24 bits resolution,
 at any buffer size, instead of 16 bits (because mmap was 
 requiring me to use really small buffers).

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|	I.O.U.
|	One case of <your favourite beverage>
|	Or one bottle of <something special>
|
|	Expires: Never.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

OK, sure, I know I should run out and buy one of the
 newer 24 bit Creative cards so I don't have to convert,
 but hey, there's a lot of SBLive! cards out there...
I need it for the hardware soundfonts only.
Fluidsynth is good but a software solution.

* Anyways, initial tests are good. 
* I will test this weekend and let you know how it goes,
*  and after you can commit the patch for good.

A final 'note':
The envy24control app's Master Clock - Signal/No Signal 
 seems broken again. 
I know the cards are locked, but it still says 'No signal'
 when S/PDIF is selected. 
Some weirdness happening, seems to not actually lock sometimes,
 forcing me to switch back and forth between Int48000 and S/PDIF.
But at least it mostly works.

I really appreciate you listening to me and taking the time to fix things. 
I know that given precise information, you always squash these bugs quickly.
Tim.



On Friday 23 November 2007 09:35:35 am you wrote:
> At Fri, 23 Nov 2007 14:41:43 +0100,
>
> I wrote:
> > Try the patch below.  This should fix the problem.  Now the multi
> > plugin just shadows the slave buffers via mmap.
>
> There was a minor bug in the last patch.  The revised version is
> below.
>
>
> Takashi
>
> diff -r 3539f279ec38 src/pcm/pcm_multi.c
> --- a/src/pcm/pcm_multi.c	Wed Nov 21 12:19:43 2007 +0100
> +++ b/src/pcm/pcm_multi.c	Fri Nov 23 15:34:16 2007 +0100
> @@ -690,13 +690,44 @@ static snd_pcm_sframes_t snd_pcm_multi_m
>  	return size;
>  }
>
> -static int snd_pcm_multi_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
> +static int snd_pcm_multi_munmap(snd_pcm_t *pcm)
>  {
> +	free(pcm->mmap_channels);
> +	free(pcm->running_areas);
> +	pcm->mmap_channels = NULL;
> +	pcm->running_areas = NULL;
>  	return 0;
>  }
>
> -static int snd_pcm_multi_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
> +static int snd_pcm_multi_mmap(snd_pcm_t *pcm)
>  {
> +	snd_pcm_multi_t *multi = pcm->private_data;
> +	unsigned int c;
> +
> +	pcm->mmap_channels = calloc(pcm->channels,
> +				    sizeof(pcm->mmap_channels[0]));
> +	pcm->running_areas = calloc(pcm->channels,
> +				    sizeof(pcm->running_areas[0]));
> +	if (!pcm->mmap_channels || !pcm->running_areas) {
> +		snd_pcm_multi_munmap(pcm);
> +		return -ENOMEM;
> +	}
> +
> +	/* Copy the slave mmapped buffer data */
> +	for (c = 0; c < pcm->channels; c++) {
> +		snd_pcm_multi_channel_t *chan = &multi->channels[c];
> +		snd_pcm_t *slave;
> +		if (chan->slave_idx < 0) {
> +			snd_pcm_multi_munmap(pcm);
> +			return -ENXIO;
> +		}
> +		slave = multi->slaves[chan->slave_idx].pcm;
> +		pcm->mmap_channels[c] =
> +			slave->mmap_channels[chan->slave_channel];
> +		pcm->mmap_channels[c].channel = c;
> +		pcm->running_areas[c] =
> +			slave->running_areas[chan->slave_channel];
> +	}
>  	return 0;
>  }
>
> @@ -850,6 +881,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp,
>  		return err;
>  	}
>  	pcm->mmap_rw = 1;
> +	pcm->mmap_shadow = 1; /* has own mmap method */
>  	pcm->ops = &snd_pcm_multi_ops;
>  	pcm->fast_ops = &snd_pcm_multi_fast_ops;
>  	pcm->private_data = multi;

  reply	other threads:[~2007-11-24  1:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-21  6:58 multi pcm and mmap problem terminator356
2007-11-21 11:01 ` Takashi Iwai
     [not found]   ` <200711211627.52438.terminator356@users.sourceforge.net>
2007-11-23 13:41     ` Takashi Iwai
2007-11-23 14:35       ` Takashi Iwai
2007-11-24  1:31         ` Tim [this message]
2007-11-24 10:16           ` Takashi Iwai
2007-11-25 22:51             ` Tim
2007-11-26 10:38               ` Takashi Iwai
2007-11-26 22:46                 ` Tim
2007-11-27 14:06                   ` Takashi Iwai
2007-12-01 23:33                     ` Tim
2007-12-02 13:40                       ` John Rigg

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=200711232031.03910.terminator356@users.sourceforge.net \
    --to=terminator356@users.sourceforge.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.