We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Recording and Playback of InputStream -- SOLUTION!
Page Index Toggle Pages: 1
Recording and Playback of InputStream -- SOLUTION! (Read 823 times)
Recording and Playback of InputStream -- SOLUTION!
Oct 10th, 2005, 8:28pm
 
This isn't strictly a processing question, but I don't know a better place to ask, so here goes:

I'm part of a team developing a relatively complex interactive dance installation.  Eyesweb is providing computer vision data,  communicated to Processing via the Eyeswebserversocket that dr3 created (there's a link over in the Video forum).  I'm generating video natively in processing, but the composer I'm working with wants to use MAX/MSP for the music.  He works solely on a mac, and would like to be able to work at home, without the project's Eyesweb PC handy.

For this reason, I'm trying to create a Java program that will save the contents of a network input stream to disk with timestamps, so I can write another program to play it back.

Is that making sense?  It sounds like what I want to do is open a ServerSocket's socket's InputStream, then write the data immediately out to a FileOutputStream.  That sounds fine, but the data is coming in over time, and I need to maintain the timing for accurate output.

I'm a newbie to input/output streams, but it looks like, in Rune's eyesweb code, after the initial setup tasks, it loops waiting for any new data to be in the input buffer, then processes that..  I'd like to tack in a field with "number of millis since the last chunk of data" at the beginning of this and parse it somehow..

Any thoughts?
Ryan

Edited:


I thought about this long and hard today, and came up with a solution: I built a custom serializable object called a DataPoint, which contained a private int[][] to contain the two dimensional array, and a private int to contain the time delay in millis, a constructor, and getter methods for both.  Then I created an ArrayList of these, and created a new one and added it to the list every time a set of data was received.  After a set number of frames, I wrote the serializable ArrayList (and its component DataPoints) out to a file.  The loader does the reverse, updating an int[][] every however many millis.

I know its horribly space-inefficient, but, its quick, relatively simple, and seems to work, which, for my purposes is good enough.

Is there any interest in seeing the source posted, after I clean it up a bit?
Page Index Toggle Pages: 1