All of lore.kernel.org
 help / color / mirror / Atom feed
* Copy ALSA buffer to the buffer allocated in my driver.
       [not found] <4E32C3F4.4050105@globaledgesoft.com>
@ 2011-07-29 14:37 ` `/ET!-i1S!-i
  2011-07-29 14:58   ` Clemens Ladisch
  0 siblings, 1 reply; 8+ messages in thread
From: `/ET!-i1S!-i @ 2011-07-29 14:37 UTC (permalink / raw)
  To: alsa-devel

Hi everyone.

I'm writing a virtual ALSA driver for a playback device, with the help of
dummy driver available at the linux kernel source code.

I need to manually copy data from the ALSA buffer to my buffer.

I have no idea how to do this, since dummy driver has completely discarded
handling of buffers.

So can anyone please provide a sample code to copy the audio data to the my
buffer allocated in the driver.

Is it ok to use the hrtimer interrupts (which is used in dummy driver) or
mutex / spinlocks for my driver.

Best regards,

cherry

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

* Re: Copy ALSA buffer to the buffer allocated in my driver.
  2011-07-29 14:37 ` `/ET!-i1S!-i
@ 2011-07-29 14:58   ` Clemens Ladisch
  0 siblings, 0 replies; 8+ messages in thread
From: Clemens Ladisch @ 2011-07-29 14:58 UTC (permalink / raw)
  To: `/ET!-i1S!-i; +Cc: alsa-devel

`/ET!-i1S!-i wrote:
> I'm writing a virtual ALSA driver for a playback device, with the help of
> dummy driver available at the linux kernel source code.
> ...
> Is it ok to use the hrtimer interrupts (which is used in dummy driver) or
> mutex / spinlocks for my driver.

What is the actual destination of your virtual device?  (I.e., can it be
used as a timing source?)


Regards,
Clemens

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

* Re: Copy ALSA buffer to the buffer allocated in my driver.
       [not found] <CAB+ez9uWAFcL_K353Q5BCYj4AAF051a=SQU++BQ5ygV+SnqDjQ@mail.gmail.com>
@ 2011-07-29 16:34 ` Clemens Ladisch
  0 siblings, 0 replies; 8+ messages in thread
From: Clemens Ladisch @ 2011-07-29 16:34 UTC (permalink / raw)
  To: `/ET!-i1S!-i; +Cc: alsa-devel

`/ET!-i1S!-i wrote:
> Actually i need to stream the audio data  to other system through kernel
> socket.

Why aren't you using PulseAudio?


Regards,
Clemens

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

* Re: Copy ALSA buffer to the buffer allocated in my driver.
       [not found]   ` <CAB+ez9tA3CGxwb=1pge2RB+P97rUzDCNx36kJ1VLLDpFGyRdTg@mail.gmail.com>
@ 2011-08-01  9:28     ` Clemens Ladisch
  0 siblings, 0 replies; 8+ messages in thread
From: Clemens Ladisch @ 2011-08-01  9:28 UTC (permalink / raw)
  To: `/ET!-i1S!-i; +Cc: alsa-devel

`/ET!-i1S!-i wrote:
> 1. I guess pulse audio inturn calls Alsa and  i want to write a Alsa driver.

But the sound cards on the networked PCs already have drivers.

> The problem i am facing is receiving Alsa buffer to my buffer

Your driver's buffer _is_ the ALSA buffer.

> and updating the buffer position to middle layer.

The hardware position is returned by the pointer callback.
The software position should be of no concern to the driver.

> 2. Is it substream->runtime->dma_area or substream->dma_buffer.area holds
> the audio data? What is the difference between them?

These fields are controlled by your driver, although typically they are
set by ALSA helper functions.

substream->dma_buffer is the preallocated buffer; if your driver doesn't
do preallocation, it is not set.  The actual buffer, if it exists and is
accessible by the CPU from kernel space, is in substream->runtime->dma_area.


Regards,
Clemens

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

* Copy ALSA buffer to the buffer allocated in my driver.
@ 2011-08-02 12:03 `/ET!-i1S!-i
  2011-08-02 12:08 ` Daniel Mack
  0 siblings, 1 reply; 8+ messages in thread
From: `/ET!-i1S!-i @ 2011-08-02 12:03 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org

Hi all,

I am writing my own alsa driver for playback application.1. I have no idea
how to copy the alsa buffer to intermediate buffer (my Buffer) .
2.  I have taken dummy driver code as example.
3. Can anyone help me. What code has to be included in the dummy driver to
copy alsa buffer to intermediate buffer.

Regards

      Cherry

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

* Re: Copy ALSA buffer to the buffer allocated in my driver.
  2011-08-02 12:03 `/ET!-i1S!-i
@ 2011-08-02 12:08 ` Daniel Mack
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Mack @ 2011-08-02 12:08 UTC (permalink / raw)
  To: `/ET!-i1S!-i; +Cc: alsa-devel@alsa-project.org

On Tue, Aug 2, 2011 at 2:03 PM, `/ET!-i1S!-i <yethish7@gmail.com> wrote:
> I am writing my own alsa driver for playback application.1. I have no idea
> how to copy the alsa buffer to intermediate buffer (my Buffer) .
> 2.  I have taken dummy driver code as example.
> 3. Can anyone help me. What code has to be included in the dummy driver to
> copy alsa buffer to intermediate buffer.

Dude,

Clemens already answered your questions. There are also plenty of
drivers in the mainline kernel that can serve as an example. Unless
you get more specific about what you're planning to do, I doubt that
anyone can give you more specific help. What hardware is your driver
for, or is it purley virtual? What's the end application?



Daniel

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

* Re: Copy ALSA buffer to the buffer allocated in my driver.
       [not found] <CAB+ez9vpzWQ3CXwoC64X6BEg=quzvJ8u-BhdMTr6vP+-=L4WRQ@mail.gmail.com>
@ 2011-08-02 12:25 ` Daniel Mack
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Mack @ 2011-08-02 12:25 UTC (permalink / raw)
  To: `/ET!-i1S!-i; +Cc: alsa-devel

Please don't drop any addresses from Cc:, and please quote original
postings appropriately.


On Tue, Aug 2, 2011 at 2:21 PM, `/ET!-i1S!-i <yethish7@gmail.com> wrote:
> The driver i am writing is purely virtual .
>
> The role of my driver is to receive the audio data played in the application
> program and stream it to remote system.

Over the network?

> For this purpose i need to copy the audio data from alsa buffer to my
> Buffer. I have no idea how this can be done. So i am looking for sample code
> to copy the audio data to my Buffer.

I'd bet there is no need to write any ALSA driver for this. You can
either use the ALSA plugin mechanism to achive this, or even some
higher level. PulseAudio for example allows seamless streaming over
the network out of the box.

Why are you confident that you need to write a driver?


Daniel

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

* Re: Copy ALSA buffer to the buffer allocated in my driver.
       [not found] <CAB+ez9uo=4ruqp0yXXJ9Ny=GRXVP6ALYYvhHaTEbp_D9y7AgPg@mail.gmail.com>
@ 2011-08-02 13:07 ` Clemens Ladisch
  0 siblings, 0 replies; 8+ messages in thread
From: Clemens Ladisch @ 2011-08-02 13:07 UTC (permalink / raw)
  To: `/ET!-i1S!-i; +Cc: alsa-devel

`/ET!-i1S!-i wrote:
> 1. I have no idea how to copy the alsa buffer to intermediate buffer (my
> Buffer) for playback application .
> 2.  I have taken dummy driver code as example.
> 3. Can you please help me. What code has to be included in the below copy
> function to copy alsa buffer to my Buffer.

Something like copy_from_user().
See sound/pci/rme9652/hdsp.c for an example.


Regards,
Clemens

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

end of thread, other threads:[~2011-08-02 13:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAB+ez9uo=4ruqp0yXXJ9Ny=GRXVP6ALYYvhHaTEbp_D9y7AgPg@mail.gmail.com>
2011-08-02 13:07 ` Copy ALSA buffer to the buffer allocated in my driver Clemens Ladisch
     [not found] <CAB+ez9vpzWQ3CXwoC64X6BEg=quzvJ8u-BhdMTr6vP+-=L4WRQ@mail.gmail.com>
2011-08-02 12:25 ` Daniel Mack
2011-08-02 12:03 `/ET!-i1S!-i
2011-08-02 12:08 ` Daniel Mack
     [not found] <CAB+ez9vVkGiefO8oQhyUZ+fqRn-vphpZPztu+S=iWsnk73nJLw@mail.gmail.com>
     [not found] ` <CAB+ez9tumzPRXcweBWW6EBEM6ySduG36Aue8a_p8_cmubSwopg@mail.gmail.com>
     [not found]   ` <CAB+ez9tA3CGxwb=1pge2RB+P97rUzDCNx36kJ1VLLDpFGyRdTg@mail.gmail.com>
2011-08-01  9:28     ` Clemens Ladisch
     [not found] <CAB+ez9uWAFcL_K353Q5BCYj4AAF051a=SQU++BQ5ygV+SnqDjQ@mail.gmail.com>
2011-07-29 16:34 ` Clemens Ladisch
     [not found] <4E32C3F4.4050105@globaledgesoft.com>
2011-07-29 14:37 ` `/ET!-i1S!-i
2011-07-29 14:58   ` Clemens Ladisch

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.