java - Audio/FFT Library Design -
i have library records real time audio , computes real time fft data audio. client must call start method start recording, , stop method end recording.
my design question concerning best way data client. have considered following approaches:
- have method called
getdata(int size)client call periodically after have started recording. return size audio samples, or data available. thought client runasynctaskperiodically call more data. problems approach is less efficient, , more complicated client, allow them have more control on when , how data receive. - have client pass in output stream start method send data have it. simpler more restrictive.
- similarly, instead of output stream, have client pass in sort of structure
arraylist, shared between , push data onto. - lastly, have thought having start method return output stream (or
arraylistsimilarly) client read from.
from client's point of view, prefer , why? or there other alternatives overlooking? input appreciated, thanks!
1- checking data periodically calling getdata make client inefficient , more complex, not recommend this.
2- using shared memorystream solution can investigated
another alternative, , simpler, solution pass callback object library called whenever new data available i.e. event-driven communication
Comments
Post a Comment