Re: 4a-play on M3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thierry

 

Thanks a lot for the support.

I’d like to have try but please give me some time.

 

And need to confirm something

> snd_pcm_uframes_t nbFrames = 2 * opts->rate; // Exactly 2 second of buffer

 

Does “2” stand for the delay time ?

Usually we want the delay to be as short as possible, but

as this configuration may affect the buffer that could be necessary for playback,

I’d like to know the possible value for the softmixer

 

Do you have any suggestion or it should be confirmed just by test?

 

Thanks/BR

ChenWei

From: automotive-discussions-bounces@xxxxxxxxxxxxxxxxxxxxxxxxx [mailto:automotive-discussions-bounces@xxxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thierry Bultel
Sent: Wednesday, November 7, 2018 6:45 PM
To: automotive-discussions@xxxxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [agl-discussions] 4a-play on M3

 

Hi ChenWei,

The current delay is exactly of 2 seconds. This is a lot, indeed,
and has remain as such from an early test phase with experimental versions.
This delay is not acceptable for everything that is not music (phone voice, navigation ...)
and should be decreased to another order of magnitude (20 to 200 ms for instance)

It is currently hardcoded at that place: 4a-softmixer/plugins/alsa/alsa-core-pcm.c line 705

    snd_pcm_uframes_t nbFrames = 2 * opts->rate; // Exactly 2 second of buffer

You can change it for your tests, if recompiling the softmixer is possible for you.
I will change that as a configurable option asap.

Please give us your feedback about it.
Best regards
Thierry

On 11/05/2018 08:04 AM, I37546_CHIN@xxxxxxxxxxxxxx wrote:

Hi Loic

 

Sorry for another question.

After I tried both softmixer and USB by using 4a-play to playback a sound file,

I found some delay of softmixer (about 1 second or more) compared with USB.

 

Does this delay come from softmixer/4a-framework or just depend on some configuration (I mean it’s configurable)?

 

We’d like to use 4a-play to playback the navigation guidance and are expecting short delay within it.

 

Thanks/BR

ChenWei

From: I37546 Chin I
Sent: Friday, November 2, 2018 6:19 PM
To: Loïc
Cc: automotive-discussions@xxxxxxxxxxxxxxxxxxxxxxxxx; I25461 Momiyama Yoshito
Subject: RE: [agl-discussions] 4a-play on M3

 

Hi Loic

 

Thank you very much for the explanation.

Now I can see that is exactly what happened to me.

 

After switching to card 0 (loopback), I got some json-liked message (not the device busy message)and I think that could come from afb-bindings,

which means it is the softmixer.

 

So finally we have 2 choices of PCM (softmixer/USB) for our application and that is very helpful.

Thanks again.

 

Thanks/BR

ChenWei

From: Loïc [mailto:loic.collignon@xxxxxxx]
Sent: Friday, November 2, 2018 5:37 PM
To: I37546 Chin I
Cc: automotive-discussions@xxxxxxxxxxxxxxxxxxxxxxxxx; I25461 Momiyama Yoshito
Subject: Re: [agl-discussions] 4a-play on M3

 

Hello,

You have only one more card when you plug the usb device, so it's not created by the softmixer, it's created by the usb-audio kernel's driver. It's the raw PCM from your usb device.

Here is what can happen:

1) You have two enabled HALs (the M3 and the USB)

    1.1) the usb device is unplugged at boot

            The softmixer will not find the usb hardware (obviously), so it does not bind streams. It will however find the PCM from the M3, and use it. So roles are bound to the M3 streams.

    1.2) the usb device is plugged at boot

            The softmixer will it, but there is now two cards providing the sames streams, so the softmixer will create only one multimedia stream, and the multimedia role will be bound to this stream.
            As the M3' audio hardware is called "ak4613" while the usb one is called 'Device', the M3 one will probably be the first processed by the hal-manager and the softmixer. So the usb device is ignored by 4a.

2) You have only one HAL enabled

    Then the corresponding hardware is used by the softmixer (so it cannot be used by someone else). The softmixer ignore hardware with disabled HAL, so that you can still use it normally, without 4a.

 

In all of these situation, you end up with the same audio card list as you shown: 3 cards, one for the softmixer (Loopback), one for the M3's hardware (ak4613), and one for the usb hardware.

---

Regards,
Loïc Collignon [IoT.bzh]

 

On 2018-11-01 03:43, I37546_CHIN@xxxxxxxxxxxxxx wrote:

Hi Loic

 

Thank you very much for the details.

I think I've understood the usage of 4a-stream/softmixer.

As softmixer is designed to control/arbitrate the audio of APPs, we'd like to use its PCMs instead of raw ones.

 

Sorry to say I still have a question but it could be another issue.

Before I plug-in the USB Audio, I can find

 

card 0: Loopback

card 1: ak4613

 

and after plug-in, I got

 

card 0: Loopback

card 1: ak4613

card 2: Device

 

so it seems softmixer created card 2 after plug-in and I can understand this point.

But it also means USB Audio is also necessary if I want to use softmixer. which I still couldn't understand.

 

 

Thanks/BR

ChenWei

From: Loïc [mailto:loic.collignon@xxxxxxx]
Sent: Wednesday, October 31, 2018 7:45 PM
To: I37546 Chin I
Cc: automotive-discussions@xxxxxxxxxxxxxxxxxxxxxxxxx; I25461 Momiyama Yoshito
Subject: Re: [agl-discussions] 4a-play on M3

 

To clarify the relationship of HALs and device:

A HAL is a configuration that is provided to the softmixer, so that it can create the virtual PCM with the correct bindings between the real hardware and the 4a-streams.
For example, we want a 'multimedia' and a 'navigation' stream, both with a 'Playback Volume' control, but the real hardware provides only one PCM with a control named 'Master Playback Volume".
So we wrote a HAL that tells the softmixer that we want two PCM ('multimedia', 'navigation'), with a 'Playback Volume' control, and bind both streams to the single PCM exposed by the hardware.

Because of that, we end up with 2 audio cards, 3 PCMs, and 3 controls (one per PCM).
The real audio card should be the first, so let's assume it's URI are in this form: hw:1,X,X.
The softmixer use snd-aloop to build a virtual audio card, let's assume it use: hw:2,X,X.
And finally, because softmixer is actually routing and mixing audio from the virtual card to the real one, it means that it have to open the destination PCM.
This is why you can't play anything on hw:1,X,X: the softmixer is using it, this is why you have 'busy resource'.

So, in conclusion, you can play audio on PCMs exposed by the softmixer, but you can play audio only on PCMs not used by the softmixer.
Meaning that the corresponding HAL should be disabled, to prevent the softmixer from using it.

---

Regards,
Loïc Collignon [IoT.bzh]

 

On 2018-10-31 10:08, I37546_CHIN@xxxxxxxxxxxxxx wrote:

Hi Loic

 

Thank you for the reply.

 

In fact I've also read the HAL's docs, but still not very clearly about the relationship of HAL's and device.

Maybe I missed something and if you could give some more advice it could be very helpful.

 

I can see hal-4a-rcar-m3 is currently applied on my M3(SK) board and the roles of radio/multimedia/emergency/navigation are available

through the 4a-api commands.

 

But I still don't understand why only the pair of USB Audio + hw:2,0,0 works well.

 

I can find a card 1 for ak4613 (card 0 is for loopback) and an on-board earphone output,

but hw:1,0,0 always returns a device busy.

(and hw:2,0,1 also returns a device busy, no matter which role is used)

 

Thanks

ChenWei

From: Loïc [mailto:loic.collignon@xxxxxxx]
Sent: Wednesday, October 31, 2018 5:22 PM
To: I37546 Chin I
Cc: automotive-discussions@xxxxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [agl-discussions] 4a-play on M3

 

Hello!

I agree that the note on 4a-play isn't clear enough. What it means is that the command does not check if you specify the right role according to the right device.
So if you play something on a PCM (i.e. hw:2,0,0) but specify the wrong role (i.e. navigation which is supposed to be on hw:2,0,1), it means that the wrong role will be opened, preventing others to open the same role.
But you will still play on the specified PCM (hw:2,0,0 in this case).

So nothing to do with USB or not.

The PCM exposed by 4a are streams, handled by the softmixer.
Their ID are hw:X,0,Y, where X is the card number and Y is the stream id.
Usually X=2 because it's the second audio card. But it can depend on the hardware.
4a binds roles to streams, so everything depends on the selected HAL: http://docs.iot.bzh/docs/apis_services/en/dev/reference/audio/high-level-api/TipsAndTricks/HALs.html

---

Regards,
Loïc Collignon [IoT.bzh]

 

On 2018-10-31 06:31, I37546_CHIN@xxxxxxxxxxxxxx wrote:

Hi,

 

I'm using 4a-play to playback WAV files on M3 with ff 6.0.1.

By referring the web documents, I can get sound from a USB headphone,

but nothing from the on-board earphone jack.

 

The Docs say, usually device "hw:2,0,0" matches "multimedia", while I find it also works with "navigation".

Does that mean, "hw:2,0,0" stands for a USB Audio?

And is USB Audio the only device supported currently?

 

Any suggestion appreciated.

 

Thanks

ChenWei

 

_______________________________________________
automotive-discussions mailing list
automotive-discussions@xxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/automotive-discussions




_______________________________________________
automotive-discussions mailing list
automotive-discussions@xxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/automotive-discussions

 

_______________________________________________
automotive-discussions mailing list
automotive-discussions@xxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/automotive-discussions

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux