sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* is libsox thread safe?
@ 2019-07-11 21:13 Diemo Schwarz
  2019-07-12 17:10 ` Måns Rullgård
  0 siblings, 1 reply; 3+ messages in thread
From: Diemo Schwarz @ 2019-07-11 21:13 UTC (permalink / raw)
  To: sox-devel


Hi all,

is libsox's audio file reading safe and meant to be used in a multi-threaded 
situation?
I just replaced libsndfile by libsox in a program that mixes two audio files, 
where file reading and buffering is done in two separate threads, and I'm 
getting weird behaviour.

Thanks for any hints, cheers...
								...Diemo

-- 
Diemo Schwarz, PhD -- http://diemo.concatenative.net
Sound–Music–Movement Interaction Team -- http://ismm.ircam.fr
IRCAM - Centre Pompidou -- 1, place Igor-Stravinsky, 75004 Paris, France
Phone +33-1-4478-4879 -- Fax +33-1-4478-1540


_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

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

* Re: is libsox thread safe?
  2019-07-11 21:13 is libsox thread safe? Diemo Schwarz
@ 2019-07-12 17:10 ` Måns Rullgård
  2019-07-12 18:05   ` Diemo Schwarz
  0 siblings, 1 reply; 3+ messages in thread
From: Måns Rullgård @ 2019-07-12 17:10 UTC (permalink / raw)
  To: Diemo Schwarz; +Cc: sox-devel

Diemo Schwarz <Diemo.Schwarz@ircam.fr> writes:

> Hi all,
>
> is libsox's audio file reading safe and meant to be used in a multi-threaded
> situation?
> I just replaced libsndfile by libsox in a program that mixes two audio
> files, where file reading and buffering is done in two separate threads, and
> I'm getting weird behaviour.

Concurrent operations on the same file or effects chain are not supported.

-- 
Måns Rullgård


_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

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

* Re: is libsox thread safe?
  2019-07-12 17:10 ` Måns Rullgård
@ 2019-07-12 18:05   ` Diemo Schwarz
  0 siblings, 0 replies; 3+ messages in thread
From: Diemo Schwarz @ 2019-07-12 18:05 UTC (permalink / raw)
  To: Måns Rullgård; +Cc: sox-devel


Hi Måns, thanks for getting back!

On 12/07/19 19:10, Måns Rullgård wrote:
> Diemo Schwarz <Diemo.Schwarz@ircam.fr> writes:
> 
>> Hi all,
>>
>> is libsox's audio file reading safe and meant to be used in a multi-threaded
>> situation?
>> I just replaced libsndfile by libsox in a program that mixes two audio
>> files, where file reading and buffering is done in two separate threads, and
>> I'm getting weird behaviour.
> 
> Concurrent operations on the same file or effects chain are not supported.

understood. It also seems that separate files in separate threads do work fine 
(no global data structures in libsox). At least my program is now working nicely 
with two decoding threads.

Small observation: I found a malloc/free pair in the macro generating the low 
level read routines sox_read_ ## sign ## type ## _samples.  For small sizes, 
alloca or a preallocated buffer might be slightly more efficient here (but 
probably not worth the architectural and cross-platform related changes).

All the best...
								...Diemo

-- 
Diemo Schwarz, PhD -- http://diemo.concatenative.net
Sound–Music–Movement Interaction Team -- http://ismm.ircam.fr
IRCAM - Centre Pompidou -- 1, place Igor-Stravinsky, 75004 Paris, France
Phone +33-1-4478-4879 -- Fax +33-1-4478-1540


_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

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

end of thread, other threads:[~2019-07-12 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 21:13 is libsox thread safe? Diemo Schwarz
2019-07-12 17:10 ` Måns Rullgård
2019-07-12 18:05   ` Diemo Schwarz

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).