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:

  1. have method called getdata(int size) client call periodically after have started recording. return size audio samples, or data available. thought client run asynctask periodically call more data. problems approach is less efficient, , more complicated client, allow them have more control on when , how data receive.
  2. have client pass in output stream start method send data have it. simpler more restrictive.
  3. similarly, instead of output stream, have client pass in sort of structure arraylist, shared between , push data onto.
  4. lastly, have thought having start method return output stream (or arraylist similarly) 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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -