Open NI92 opened 3 years ago
Create multiple SAPlayer
instances? Is that not possible?
I get what you mean, the SAPlayer
essentially creates the instance of AVAudioEngine
, but as a workaround to your problem.
The biggest issue is I'm trying to 'connect' the underlying AVAudioPlayer
to another node. Which means the there can only be 1 AVAudioEngine for all the nodes I connect.
Hey! Sorry and caching up to these issues now. Could you elaborate on the exact use case you're trying to do? You have an AVAudioPlayer
that you want to connect to this engine?
Hi @tanhakabir, I think that he's having the same "issue" I'm running into, basically it would be nice to have multiple AVAudioPlayerNode
on the main engine, while keeping all of the features you already developed (awesome job btw).
You think that we can achieve that adding support directly to the AudioEngine
classes? Or rather adding a new engine that adheres to the AudioEngineProtocol
?
Problem with the second approach would be that we (probably) want all of the behaviours of the AudioDiskEngine
and AudioStreamEngine
, as in "I would like to play in the same time a local file and a remote file".
What do you think? I can help with this if you want!
The engine currently has a single
playerNode = AVAudioPlayerNode()
. Are there plans to allow streaming of multiple sounds at the same time?I see that
SAPlayer
usesplayer = AudioStreamEngine(withRemoteUrl: url, delegate: presenter)
to initiate streaming data into the engine itself. But the engine only has a singleAVAudioPlayerNode
pointer (playerNode). How difficult would it be to create an array ofAVAudioPlayerNode
?Next day follow up:
I created a
StreamingAudioPlayerNode
object & an accompanyingAudioURLStream
object & carried logic out of theAudioStreamEngine
(& some logic out of theAudioEngine
) & placed it inside theAudioURLStream
object.Now
AudioEngine
has an array ofStreamingAudioPlayerNode
objects. I pass a URL into the engine & it creates anStreamingAudioPlayerNode
instance. Calling play makes the streamed audio work on a device (I even used URL's from your example project for testing). However, streaming of multiple audio sources still does NOT work.I'm guessing the issue lies deeper within the library (haven't completely studied it) & how buffers are created, or something like that. Any ideas what I can try doing?