I am writing an application, which sends audio data to server in real-time. I have done this task but, some time it make error. I believe, this is due to the bad architecture of my program. The program content is as follows:
--For audio recording I wrote AudioRecorder class, which has implemented AudioCallBack method which is called by the AudioQueue. Inside this method I capture the audio data into buffer and send to server, using NSOutputStream.
--The streams, NSOutputStream and NSInputStream s are instantiates in the init method of AudioREcorder.
--The stream handle event method (delegated by stream) also implemented the in the same AudioRecorder class.
While developing this application I got following problems
1) I wanted to write Streaming in another class and send the buffer using some method. But it wasnt work. So I implemented it in the same class.
2) When I want to send the "end" message (After clicking end button), I tried to send it inside Button end method using the instance of NSOutputStream. But, it wast success. So, I fixed it putting some parameters inside AudioCallBack.
q1) Why I cannot make streaming part in another class ? q2) What is the better way to organize this type of application in order to iPhone application development.
/thx