All of lore.kernel.org
 help / color / mirror / Atom feed
* Stream Synchronization of VXPocket 440 card
@ 2004-10-07 20:44 Hanbiao Wang
  2004-10-08 10:05 ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Hanbiao Wang @ 2004-10-07 20:44 UTC (permalink / raw)
  To: alsa-devel

Hi all,
    VXPocket 440 card has two stereo input streams. Can these two streams be
synchronized by calling snd_pcm_link()?
    According to the ALSA project webpage, streams can synched only if the
hardware supports this feature. The ALSA project webpage, the
snd_pcm_info_get_sync() function returns synchronization ID -
snd_pcm_sync_id_t, which is equal for hardware synchronized streams.
I examined the sync IDs of these two streams of the VXPocket 440 card as
follows:
1. call snd_pcm_open() on hw:0,0 in order to get pcm handle h0
2. call snd_pcm_info() on pcm handle h0 to get pcm info f0
3. call snd_pcm_info_get_sync() on f0 to get sync ID0 of hw:0,0

4. call snd_pcm_open() on hw:0,1 in order to get pcm handle h1
5. call snd_pcm_info() on pcm handle h1 to get pcm info f1
3. call snd_pcm_info_get_sync() on f1 to get sync ID1 of hw:0,1

snd_pcm_sync_id_t has three data fields:
unsigned char 	id [16]
unsigned short 	id16 [8]
unsigned int 	id32 [4]

    ID0.id is "-1073743584" while ID1.id is "-1073743600". These sync IDs
are apparently not identical. So these two streams look like not synched
by the hardware. However, the manufacture of VXPocket 440 cards told me
that these two input streams share the same internal hardware clock. So
there is no obvious reason for the hardware not to synchronizes these two
input streams. The is a contradiction to me. Is there anything wrong in my
examination code? Please help me on this issue if you have any experience
related to my question. Thanks a lot in advance.


Hanbiao


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Stream Synchronization of VXPocket 440 card
  2004-10-07 20:44 Stream Synchronization of VXPocket 440 card Hanbiao Wang
@ 2004-10-08 10:05 ` Takashi Iwai
  2004-10-08 17:00   ` Hanbiao Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2004-10-08 10:05 UTC (permalink / raw)
  To: Hanbiao Wang; +Cc: alsa-devel

At Thu, 7 Oct 2004 13:44:04 -0700 (PDT),
Hanbiao Wang wrote:
> 
> Hi all,
>     VXPocket 440 card has two stereo input streams. Can these two streams be
> synchronized by calling snd_pcm_link()?
>     According to the ALSA project webpage, streams can synched only if the
> hardware supports this feature. The ALSA project webpage, the
> snd_pcm_info_get_sync() function returns synchronization ID -
> snd_pcm_sync_id_t, which is equal for hardware synchronized streams.
> I examined the sync IDs of these two streams of the VXPocket 440 card as
> follows:
> 1. call snd_pcm_open() on hw:0,0 in order to get pcm handle h0
> 2. call snd_pcm_info() on pcm handle h0 to get pcm info f0
> 3. call snd_pcm_info_get_sync() on f0 to get sync ID0 of hw:0,0
> 
> 4. call snd_pcm_open() on hw:0,1 in order to get pcm handle h1
> 5. call snd_pcm_info() on pcm handle h1 to get pcm info f1
> 3. call snd_pcm_info_get_sync() on f1 to get sync ID1 of hw:0,1
> 
> snd_pcm_sync_id_t has three data fields:
> unsigned char 	id [16]
> unsigned short 	id16 [8]
> unsigned int 	id32 [4]
> 
>     ID0.id is "-1073743584" while ID1.id is "-1073743600". These sync IDs
> are apparently not identical. So these two streams look like not synched
> by the hardware. However, the manufacture of VXPocket 440 cards told me
> that these two input streams share the same internal hardware clock. So
> there is no obvious reason for the hardware not to synchronizes these two
> input streams. The is a contradiction to me. Is there anything wrong in my
> examination code? Please help me on this issue if you have any experience
> related to my question. Thanks a lot in advance.

You're not wrong.  The h/w sync feature is not implemented (yet) on
ALSA vx drivers :)  You can still use software sync with
snd_pcm_link(), though.


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Stream Synchronization of VXPocket 440 card
  2004-10-08 10:05 ` Takashi Iwai
@ 2004-10-08 17:00   ` Hanbiao Wang
  2004-10-11 10:38     ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Hanbiao Wang @ 2004-10-08 17:00 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On Fri, 8 Oct 2004, Takashi Iwai wrote:

> At Thu, 7 Oct 2004 13:44:04 -0700 (PDT),
> Hanbiao Wang wrote:
> >
> > Hi all,
> >     VXPocket 440 card has two stereo input streams. Can these two streams be
> > synchronized by calling snd_pcm_link()?
> >     According to the ALSA project webpage, streams can synched only if the
> > hardware supports this feature. The ALSA project webpage, the
> > snd_pcm_info_get_sync() function returns synchronization ID -
> > snd_pcm_sync_id_t, which is equal for hardware synchronized streams.
> > I examined the sync IDs of these two streams of the VXPocket 440 card as
> > follows:
> > 1. call snd_pcm_open() on hw:0,0 in order to get pcm handle h0
> > 2. call snd_pcm_info() on pcm handle h0 to get pcm info f0
> > 3. call snd_pcm_info_get_sync() on f0 to get sync ID0 of hw:0,0
> >
> > 4. call snd_pcm_open() on hw:0,1 in order to get pcm handle h1
> > 5. call snd_pcm_info() on pcm handle h1 to get pcm info f1
> > 3. call snd_pcm_info_get_sync() on f1 to get sync ID1 of hw:0,1
> >
> > snd_pcm_sync_id_t has three data fields:
> > unsigned char 	id [16]
> > unsigned short 	id16 [8]
> > unsigned int 	id32 [4]
> >
> >     ID0.id is "-1073743584" while ID1.id is "-1073743600". These sync IDs
> > are apparently not identical. So these two streams look like not synched
> > by the hardware. However, the manufacture of VXPocket 440 cards told me
> > that these two input streams share the same internal hardware clock. So
> > there is no obvious reason for the hardware not to synchronizes these two
> > input streams. The is a contradiction to me. Is there anything wrong in my
> > examination code? Please help me on this issue if you have any experience
> > related to my question. Thanks a lot in advance.
>
> You're not wrong.  The h/w sync feature is not implemented (yet) on
> ALSA vx drivers :)  You can still use software sync with
> snd_pcm_link(), though.
>
>
> Takashi
>
Takashi,
    Thanks a lot. Your answer is very helpful. I have a related question.
I first run snd_pcm_link() on the PCM handles of hw:0,0 and hw:0,0 of
VXPocket 440, and then start them by calling snd_pcm_start().
Then I use snd_pcm_status_get_trigger_tstamp() to examine the tigger time
of both PCM. I found that the difference of tigger time between these two
PCM is 3 us. Does this number look reasonable to you?

In addition, I'm not clear what exactly is the tigger time defined. PCM
start probably is one of the scenarios in which "trigger is involved".
However, other than that, are there any more scenarios that could be
regarded as "triggerred"? Thanks a lot.


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Stream Synchronization of VXPocket 440 card
  2004-10-08 17:00   ` Hanbiao Wang
@ 2004-10-11 10:38     ` Takashi Iwai
  2004-10-11 16:52       ` Hanbiao Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2004-10-11 10:38 UTC (permalink / raw)
  To: Hanbiao Wang; +Cc: alsa-devel

At Fri, 8 Oct 2004 10:00:08 -0700 (PDT),
Hanbiao Wang wrote:
> 
> On Fri, 8 Oct 2004, Takashi Iwai wrote:
> 
> > At Thu, 7 Oct 2004 13:44:04 -0700 (PDT),
> > Hanbiao Wang wrote:
> > >
> > > Hi all,
> > >     VXPocket 440 card has two stereo input streams. Can these two streams be
> > > synchronized by calling snd_pcm_link()?
> > >     According to the ALSA project webpage, streams can synched only if the
> > > hardware supports this feature. The ALSA project webpage, the
> > > snd_pcm_info_get_sync() function returns synchronization ID -
> > > snd_pcm_sync_id_t, which is equal for hardware synchronized streams.
> > > I examined the sync IDs of these two streams of the VXPocket 440 card as
> > > follows:
> > > 1. call snd_pcm_open() on hw:0,0 in order to get pcm handle h0
> > > 2. call snd_pcm_info() on pcm handle h0 to get pcm info f0
> > > 3. call snd_pcm_info_get_sync() on f0 to get sync ID0 of hw:0,0
> > >
> > > 4. call snd_pcm_open() on hw:0,1 in order to get pcm handle h1
> > > 5. call snd_pcm_info() on pcm handle h1 to get pcm info f1
> > > 3. call snd_pcm_info_get_sync() on f1 to get sync ID1 of hw:0,1
> > >
> > > snd_pcm_sync_id_t has three data fields:
> > > unsigned char 	id [16]
> > > unsigned short 	id16 [8]
> > > unsigned int 	id32 [4]
> > >
> > >     ID0.id is "-1073743584" while ID1.id is "-1073743600". These sync IDs
> > > are apparently not identical. So these two streams look like not synched
> > > by the hardware. However, the manufacture of VXPocket 440 cards told me
> > > that these two input streams share the same internal hardware clock. So
> > > there is no obvious reason for the hardware not to synchronizes these two
> > > input streams. The is a contradiction to me. Is there anything wrong in my
> > > examination code? Please help me on this issue if you have any experience
> > > related to my question. Thanks a lot in advance.
> >
> > You're not wrong.  The h/w sync feature is not implemented (yet) on
> > ALSA vx drivers :)  You can still use software sync with
> > snd_pcm_link(), though.
> >
> >
> > Takashi
> >
> Takashi,
>     Thanks a lot. Your answer is very helpful. I have a related question.
> I first run snd_pcm_link() on the PCM handles of hw:0,0 and hw:0,0 of
> VXPocket 440,

You mean hw:0,0 and hw:0,1?

> and then start them by calling snd_pcm_start().
> Then I use snd_pcm_status_get_trigger_tstamp() to examine the tigger time
> of both PCM. I found that the difference of tigger time between these two
> PCM is 3 us. Does this number look reasonable to you?

3 us much smaller than the sample resolution, so it wouldn't be a
problem in practice.  But it seems higher than I thought.


> In addition, I'm not clear what exactly is the tigger time defined. PCM
> start probably is one of the scenarios in which "trigger is involved".
> However, other than that, are there any more scenarios that could be
> regarded as "triggerred"? Thanks a lot.

The trigger timestamp is put when any DMA status action is done such
as start, stop, pause, suspend and resume.  The timestamp is taken
after the trigger action is finished, i.e. starting DMA, stopping DMA,
etc.  In the case of linked streams, DMA on each stream is operated
first for all streams, then the timestamp is taken for each stream,
like below:

	for_each_stream {
		trigger_DMA(stream)
	}
	for_each_stream {
		get_timestamp(stream)
	}


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Stream Synchronization of VXPocket 440 card
  2004-10-11 10:38     ` Takashi Iwai
@ 2004-10-11 16:52       ` Hanbiao Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Hanbiao Wang @ 2004-10-11 16:52 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi
   This is awesome. Thanks a lot for your help.

Hanbiao

On Mon, 11 Oct 2004, Takashi Iwai wrote:

> At Fri, 8 Oct 2004 10:00:08 -0700 (PDT),
> Hanbiao Wang wrote:
> >
> > On Fri, 8 Oct 2004, Takashi Iwai wrote:
> >
> > > At Thu, 7 Oct 2004 13:44:04 -0700 (PDT),
> > > Hanbiao Wang wrote:
> > > >
> > > > Hi all,
> > > >     VXPocket 440 card has two stereo input streams. Can these two streams be
> > > > synchronized by calling snd_pcm_link()?
> > > >     According to the ALSA project webpage, streams can synched only if the
> > > > hardware supports this feature. The ALSA project webpage, the
> > > > snd_pcm_info_get_sync() function returns synchronization ID -
> > > > snd_pcm_sync_id_t, which is equal for hardware synchronized streams.
> > > > I examined the sync IDs of these two streams of the VXPocket 440 card as
> > > > follows:
> > > > 1. call snd_pcm_open() on hw:0,0 in order to get pcm handle h0
> > > > 2. call snd_pcm_info() on pcm handle h0 to get pcm info f0
> > > > 3. call snd_pcm_info_get_sync() on f0 to get sync ID0 of hw:0,0
> > > >
> > > > 4. call snd_pcm_open() on hw:0,1 in order to get pcm handle h1
> > > > 5. call snd_pcm_info() on pcm handle h1 to get pcm info f1
> > > > 3. call snd_pcm_info_get_sync() on f1 to get sync ID1 of hw:0,1
> > > >
> > > > snd_pcm_sync_id_t has three data fields:
> > > > unsigned char 	id [16]
> > > > unsigned short 	id16 [8]
> > > > unsigned int 	id32 [4]
> > > >
> > > >     ID0.id is "-1073743584" while ID1.id is "-1073743600". These sync IDs
> > > > are apparently not identical. So these two streams look like not synched
> > > > by the hardware. However, the manufacture of VXPocket 440 cards told me
> > > > that these two input streams share the same internal hardware clock. So
> > > > there is no obvious reason for the hardware not to synchronizes these two
> > > > input streams. The is a contradiction to me. Is there anything wrong in my
> > > > examination code? Please help me on this issue if you have any experience
> > > > related to my question. Thanks a lot in advance.
> > >
> > > You're not wrong.  The h/w sync feature is not implemented (yet) on
> > > ALSA vx drivers :)  You can still use software sync with
> > > snd_pcm_link(), though.
> > >
> > >
> > > Takashi
> > >
> > Takashi,
> >     Thanks a lot. Your answer is very helpful. I have a related question.
> > I first run snd_pcm_link() on the PCM handles of hw:0,0 and hw:0,0 of
> > VXPocket 440,
>
> You mean hw:0,0 and hw:0,1?
>
> > and then start them by calling snd_pcm_start().
> > Then I use snd_pcm_status_get_trigger_tstamp() to examine the tigger time
> > of both PCM. I found that the difference of tigger time between these two
> > PCM is 3 us. Does this number look reasonable to you?
>
> 3 us much smaller than the sample resolution, so it wouldn't be a
> problem in practice.  But it seems higher than I thought.
>
>
> > In addition, I'm not clear what exactly is the tigger time defined. PCM
> > start probably is one of the scenarios in which "trigger is involved".
> > However, other than that, are there any more scenarios that could be
> > regarded as "triggerred"? Thanks a lot.
>
> The trigger timestamp is put when any DMA status action is done such
> as start, stop, pause, suspend and resume.  The timestamp is taken
> after the trigger action is finished, i.e. starting DMA, stopping DMA,
> etc.  In the case of linked streams, DMA on each stream is operated
> first for all streams, then the timestamp is taken for each stream,
> like below:
>
> 	for_each_stream {
> 		trigger_DMA(stream)
> 	}
> 	for_each_stream {
> 		get_timestamp(stream)
> 	}
>
>
> Takashi
>


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-10-11 16:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-07 20:44 Stream Synchronization of VXPocket 440 card Hanbiao Wang
2004-10-08 10:05 ` Takashi Iwai
2004-10-08 17:00   ` Hanbiao Wang
2004-10-11 10:38     ` Takashi Iwai
2004-10-11 16:52       ` Hanbiao Wang

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.