<Sound Dev> SourceDataLine behavior on Linux and Windows

Paulo Levi i30817 at gmail.com
Thu Oct 15 17:19:09 PDT 2009


Are you trying to make a pause() method in a streaming audioplayer
implementation? If you are can you tell any pointers to do it. In fact
 can AudioInputStream do it? The documentation implies that mark can
work.

On Thu, Oct 15, 2009 at 11:18 PM, cyberGn0m <cy6ergn0m at gmail.com> wrote:
> DataLine has a different behavior on Linux and Windows. I do not know, it it
> a bug or feature... may be documentation is not a full?
>
> So, steps to reproduce:
> 1. Create and open data line and start() on it.
> 2. Write data to line in a separate thread.
> 3. Stop line with a stop() method but do not stop thread from (2).
>
> On Windows:
> Thread that writes data to data line will fill line's buffer and then blocks
> (sleeps) when buffer reaches full.
>
> On Linux:
> Thread that writes data to line will spin around method write and eat CPU,
> because stopped line can't be written and write method returns 0  (no bytes
> written). This happens before line's buffer reaches full (available() > 0).
>
> Of course workaround present, but this behavior looks strange...
>


More information about the sound-dev mailing list