From: The Source <thesourcehim@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: sbxfi - What works/doesn't summary
Date: Wed, 29 Oct 2008 19:12:29 +0300 [thread overview]
Message-ID: <49088B6D.3000500@gmail.com> (raw)
In-Reply-To: <s5hiqrblpg9.wl%tiwai@suse.de>
[-- Attachment #1: Type: text/plain, Size: 4576 bytes --]
Takashi Iwai пишет:
> At Wed, 29 Oct 2008 08:15:04 +0300,
> The Source wrote:
>
>> Ok, was able to get hw_params:
>> access: MMAP_INTERLEAVED
>> format: S16_LE
>> subformat: STD
>> channels: 2
>> rate: 48000 (48000/1)
>> period_size: 1088
>> buffer_size: 4352
>>
>> Why so weird values?
>>
>
> Maybe related with the default sample rate 44.1kHz? Who knows...
>
> Does the patch below have any influence?
> This restricts the period/buffer size aligned to 1024 bytes.
> Also, it may fix the PCM pointer calculation somehow.
>
>
> Takashi
>
> ---
> diff --git a/sound/pci/sbxfi/sbxfi.c b/sound/pci/sbxfi/sbxfi.c
> index e67f768..a2d908e 100644
> --- a/sound/pci/sbxfi/sbxfi.c
> +++ b/sound/pci/sbxfi/sbxfi.c
> @@ -122,6 +122,9 @@ struct sbxfi_port {
> /* TLB entry */
> int tlb_index;
> unsigned int tlb_pages;
> + /* buffer pointers */
> + unsigned int start_addr;
> + unsigned int buffer_bytes;
> /* status */
> int state;
> int need_update;
> @@ -527,8 +530,8 @@ static void sbxfi_playback_start(struct sbxfi *chip, struct sbxfi_port *port)
> if (port->tlb_index < 0)
> return;
> runtime = port->substream->runtime;
> - start = port->tlb_index * SBXFI_PAGE_SIZE;
> - loop = start + frames_to_bytes(runtime, runtime->buffer_size);
> + start = port->start_addr;
> + loop = start + port->buffer_bytes;
>
> switch (runtime->rate) {
> case 48000:
> @@ -579,8 +582,8 @@ static void sbxfi_capture_start(struct sbxfi *chip, struct sbxfi_port *port)
> if (port->tlb_index < 0)
> return;
> runtime = port->substream->runtime;
> - start = port->tlb_index * SBXFI_PAGE_SIZE;
> - loop = start + frames_to_bytes(runtime, runtime->buffer_size);
> + start = port->start_addr;
> + loop = start + port->buffer_bytes;
>
> switch (runtime->rate) {
> case 48000:
> @@ -1320,9 +1323,9 @@ static int sbxfi_playback_open(struct snd_pcm_substream *substream)
> set_rate_limit(chip, runtime);
> snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
> snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
> - 128);
> + 1024 /*128*/);
> snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
> - 128);
> + 1024 /*128*/);
> return 0;
> }
>
> @@ -1349,9 +1352,9 @@ static int sbxfi_capture_open(struct snd_pcm_substream *substream)
> set_rate_limit(chip, runtime);
> snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
> snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
> - 128);
> + 1024 /*128*/);
> snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
> - 128);
> + 1024 /*128*/);
> return 0;
> }
>
> @@ -1399,6 +1402,9 @@ static int sbxfi_playback_prepare(struct snd_pcm_substream *substream)
> port->frag_count = runtime->period_size;
> port->need_update = 0;
>
> + port->start_addr = port->tlb_index * SBXFI_PAGE_SIZE;
> + port->buffer_bytes = frames_to_bytes(runtime, runtime->buffer_size);
> +
> sbxfi_setup_play_pitch(chip, port);
> sbxfi_setup_play_mixer(chip, port);
> sbxfi_setup_play_mapper(chip, port);
> @@ -1417,6 +1423,9 @@ static int sbxfi_capture_prepare(struct snd_pcm_substream *substream)
> port->frag_count = runtime->period_size;
> port->need_update = 0;
>
> + port->start_addr = port->tlb_index * SBXFI_PAGE_SIZE;
> + port->buffer_bytes = frames_to_bytes(runtime, runtime->buffer_size);
> +
> sbxfi_init_adc(chip, chip->capsrc, chip->micboost);
>
> sbxfi_setup_capture_mapper(chip, port);
> @@ -1477,10 +1486,12 @@ sbxfi_pcm_pointer(struct snd_pcm_substream *substream)
> unsigned int pos;
>
> pos = sbxfi_read(chip, SRCCA(port->src[0])) & 0x03ffffff;
> - pos -= port->tlb_index * SBXFI_PAGE_SIZE;
> + pos -= port->start_addr;
> /* The pointer is always 128 bytes ahead */
> if (pos >= CA_OFFSET)
> pos -= CA_OFFSET;
> + else
> + pos = pos + port->buffer_bytes - CA_OFFSET;
> pos = bytes_to_frames(runtime, pos);
> pos %= runtime->buffer_size;
> LOG(2, "POINTER = 0x%x\n", pos);
>
>
Patch doesn't help. Though it really makes period and buffer to be
aligned to 1024.
I have discovered however that sound only gets corrupted if wine tries
to use alsa directly.
If it uses pulseaudio (it's eSound emulation), sound is fine. Other apps
(including MPlayer) with pulseaudio work just fine.
dmesg output with debug=2 for the case when wine uses alsa directly is
attached.
[-- Attachment #2: dmesg.out.bz2 --]
[-- Type: application/x-bzip, Size: 1725 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2008-10-29 16:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-28 11:42 sbxfi - What works/doesn't summary Jason Harvey
2008-10-28 12:47 ` The Source
2008-10-28 17:40 ` Jason Harvey
2008-10-28 19:02 ` Takashi Iwai
2008-10-28 19:33 ` Jason Harvey
2008-10-28 19:36 ` Takashi Iwai
2008-10-28 20:15 ` Jason Harvey
2008-10-29 4:28 ` The Source
2008-10-29 4:45 ` The Source
2008-10-29 5:03 ` The Source
2008-10-29 5:07 ` The Source
2008-10-29 5:15 ` The Source
2008-10-29 9:29 ` Takashi Iwai
2008-10-29 16:12 ` The Source [this message]
2008-10-29 9:31 ` Takashi Iwai
2008-10-29 15:55 ` Jason Harvey
[not found] ` <49088718.8000308@jasonline.co.uk>
2008-10-29 15:58 ` Takashi Iwai
2008-10-29 17:01 ` Jason Harvey
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=49088B6D.3000500@gmail.com \
--to=thesourcehim@gmail.com \
--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.