Float buffers from APIs are fast to read, aren't they?
-
markussomething markussomething https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=266974
- KVRist
- Topic Starter
- 38 posts since 19 Oct, 2011
iOS can give me a buffer of floats where I'm supposed to write the sound. Am I supposed to do mixing (reading) in there too? I do that and it seems to be fast (I haven't compared it to mixing in other memory). Can I safely assume that it won't be slow on some other Apple hardware? I mean.. "video memory" is slow to read, but sound memory isn't, right?
- KVRAF
- 12555 posts since 7 Dec, 2004
The memory it gives you is just like any other. There is nothing special about it.
You might want to be concerned about whether it is aligned but it most likely already is.
You might want to be concerned about whether it is aligned but it most likely already is.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
- KVRian
- 1000 posts since 1 Dec, 2004
You shouldn't do mixing - you should just overwrite what was there before.markussomething wrote:iOS can give me a buffer of floats where I'm supposed to write the sound. Am I supposed to do mixing (reading) in there too? I do that and it seems to be fast (I haven't compared it to mixing in other memory). Can I safely assume that it won't be slow on some other Apple hardware? I mean.. "video memory" is slow to read, but sound memory isn't, right?
The sound buffer you write to is in ordinary RAM, it's not a memory map to some strange device memory across a slow bus, and I'm pretty sure it's not involved in any DMA as well. In fact, iOS will usually do some more conversions on the buffer contents after your callback returns anyways - sample rate conversion if it's not 44khz, volume+mixing with other programs, final conversion to 16bits...
-
markussomething markussomething https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=266974
- KVRist
- Topic Starter
- 38 posts since 19 Oct, 2011
Ok, then my code should be fine.
Thanks a lot for the replies.
Thanks a lot for the replies.