Re: write method for audio driver?

2023-08-28 Thread Tim Hardisty
On 27/08/2023 23:53, Gregory Nutt wrote: On 8/27/2023 4:22 PM, Tim Hardisty wrote: The classD driver DOES register itself as /dev/audio/pcm0, and works correctly as such with nx_player. You are mistaken.  The Class D driver does not register itself as a character driver.  grep -r register_dr

Re: write method for audio driver?

2023-08-28 Thread Tim Hardisty
On 27/08/2023 23:56, Gregory Nutt wrote: On 8/27/2023 4:24 PM, Tim Hardisty wrote: SAMA5D2 specific, I should add. There is no support for the Class D driver for any SAMA5D2 board in the source tree. Indeed - it's a custom/proprietary board which is why I added and contributed the missin

Re: write method for audio driver?

2023-08-28 Thread Tim Hardisty
On 28/08/2023 02:49, Nathan Hartman wrote: On Sun, Aug 27, 2023 at 6:24 PM Tim Hardisty wrote: SAMA5D2 specific, I should add. On 27 Aug 2023, at 23:23, Tim Hardisty wrote: The classD driver DOES register itself as /dev/audio/pcm0, and works correctly as such with nx_player. The conve

Re: write method for audio driver?

2023-08-27 Thread Gregory Nutt
On 8/27/2023 7:49 PM, Nathan Hartman wrote: I don't know whether you've had a chance to read [1] yet, but if not, it might help visualize the two-part structure of device drivers in NuttX. (If you've already read it, then never mind, and apologies for the noise. :-) The audio subsystem is di

Re: write method for audio driver?

2023-08-27 Thread Nathan Hartman
On Sun, Aug 27, 2023 at 6:24 PM Tim Hardisty wrote: > SAMA5D2 specific, I should add. > > > > On 27 Aug 2023, at 23:23, Tim Hardisty wrote: > > > > The classD driver DOES register itself as /dev/audio/pcm0, and works > correctly as such with nx_player. > > > > The conversions are wav (or mp3 et

Re: write method for audio driver?

2023-08-27 Thread Gregory Nutt
On 8/27/2023 4:24 PM, Tim Hardisty wrote: SAMA5D2 specific, I should add. There is no support for the Class D driver for any SAMA5D2 board in the source tree.

Re: write method for audio driver?

2023-08-27 Thread Gregory Nutt
On 8/27/2023 4:22 PM, Tim Hardisty wrote: The classD driver DOES register itself as /dev/audio/pcm0, and works correctly as such with nx_player. You are mistaken.  The Class D driver does not register itself as a character driver.  grep -r register_driver arch/arm/src/sama5/ proves that is

Re: write method for audio driver?

2023-08-27 Thread Tim Hardisty
SAMA5D2 specific, I should add. > On 27 Aug 2023, at 23:23, Tim Hardisty wrote: > > The classD driver DOES register itself as /dev/audio/pcm0, and works > correctly as such with nx_player. > > The conversions are wav (or mp3 etc) to pcm. > > Don’t if we’re talking cross purposes or the clas

Re: write method for audio driver?

2023-08-27 Thread Tim Hardisty
The classD driver DOES register itself as /dev/audio/pcm0, and works correctly as such with nx_player. The conversions are wav (or mp3 etc) to pcm. Don’t if we’re talking cross purposes or the classd driver works in a way it shouldn’t!!! > On 27 Aug 2023, at 23:00, Gregory Nutt wrote: > > A

Re: write method for audio driver?

2023-08-27 Thread Gregory Nutt
Also, I don't think the /dev/audio/pcm0 device you are talking about is what you think it is.  It is a character driver but not the Class D lower half.  So, yes it can be opened. /Caveat:  It has been ages since I worked with the audio subsystem so I might be completely wrong./ /dev/audio/pc

Re: write method for audio driver?

2023-08-27 Thread Gregory Nutt
I suppose that the easiest thing of all would be to put the tones in small PCM files in a built-in ROMFS file system On 8/27/2023 1:47 PM, Gregory Nutt wrote: On 8/27/2023 5:41 AM, Tim Hardisty wrote: Or am I completely missing the point and I just need to use the nxaudio system!!?? I think

Re: write method for audio driver?

2023-08-27 Thread Gregory Nutt
On 8/27/2023 5:41 AM, Tim Hardisty wrote: Or am I completely missing the point and I just need to use the nxaudio system!!?? I think you have been missing point.  You have two options: 1. As you suggest, extend nxaudio to be a source of tone data (just like audio file data)  and uses the

Re: write method for audio driver?

2023-08-27 Thread Gregory Nutt
On 8/27/2023 5:25 AM, Tim Hardisty wrote: Looking a little more at the write function of audio_ops_s it is not used by any existing driver and is documented to be for device-specific information...so it is not portable in terms of playing tones by simply writing PCM data word by word. I get

Re: write method for audio driver?

2023-08-27 Thread Gregory Nutt
On 8/27/2023 4:17 AM, Tim Hardisty wrote: Thanks Gregory. The existing ClassD driver is registered as /dev/audio/pcm0 and is a PCM device not PWM. It has the "usual" audio ops to configure it, start/stop/pause/enqueue etc. It is exposed via ioctls so does have a user interface; that is how b

Re: write method for audio driver?

2023-08-27 Thread Tim Hardisty
Or am I completely missing the point and I just need to use the nxaudio system!!?? On 27/08/2023 12:25, Tim Hardisty wrote: Looking a little more at the write function of audio_ops_s it is not used by any existing driver and is documented to be for device-specific information...so it is not po

Re: write method for audio driver?

2023-08-27 Thread Tim Hardisty
Looking a little more at the write function of audio_ops_s it is not used by any existing driver and is documented to be for device-specific information...so it is not portable in terms of playing tones by simply writing PCM data word by word. I get that now. So I'm thinking the right way is po

Re: write method for audio driver?

2023-08-27 Thread Tim Hardisty
Thanks Gregory. The existing ClassD driver is registered as /dev/audio/pcm0 and is a PCM device not PWM. It has the "usual" audio ops to configure it, start/stop/pause/enqueue etc. It is exposed via ioctls so does have a user interface; that is how buffers of audio are passed to it. Is that an

Re: write method for audio driver?

2023-08-27 Thread Tim Hardisty
Sort of perhaps. The SAMA5D@ needs lots of setting up and the existing driver does that with all the usual audio device ioctls and enqueue methods: it works just fine using nxplayer and can playback .wav files etc. But it it is based on creating buffers of audio - the assumption being that you

Re: write method for audio driver?

2023-08-27 Thread Tim Hardisty
Thanks Gregory. I looked at that but it produces tones using PWM. The ClassD of the SAMA5D2 is a PCM device, so not an immediately obvious match? On 26/08/2023 23:17, Gregory Nutt wrote: > >>> But I want to play simple audio tones, from a sine look-up table, >>> and filling a buffer and enqueuin

Re: write method for audio driver?

2023-08-26 Thread Tomek CEDRO
On Sat, Aug 26, 2023, 20:18 Tim Hardisty wrote: > This is, I'm sure, more a generic POSIX question than NuttX-specific but I > am still not that familiar with either! > > When I wrote the SAMA5D2 ClassD audio driver I followed the methods > appropriate for using "apb" so it works well with nxplay

Re: write method for audio driver?

2023-08-26 Thread Gregory Nutt
But I want to play simple audio tones, from a sine look-up table, and filling a buffer and enqueuing it seems over the top. If you just want to plane simple audio tones, maybe something drivers/audio/tone.c is what you need?  That is a character driver with a custom tone interface.

Re: write method for audio driver?

2023-08-26 Thread Gregory Nutt
On 8/26/2023 12:18 PM, Tim Hardisty wrote: This is, I'm sure, more a generic POSIX question than NuttX-specific but I am still not that familiar with either! When I wrote the SAMA5D2 ClassD audio driver I followed the methods appropriate for using "apb" so it works well with nxplayer (for ex

write method for audio driver?

2023-08-26 Thread Tim Hardisty
This is, I'm sure, more a generic POSIX question than NuttX-specific but I am still not that familiar with either! When I wrote the SAMA5D2 ClassD audio driver I followed the methods appropriate for using "apb" so it works well with nxplayer (for example). But I want to play simple audio tones,