@cv_ wrote:
Hey!
I am writing some simple recorder / player applications that I plan to implement to raspberry pi.
The writer application generates lowrez animations and saves them into a binary file. The file contains a header with information about the animation, most important the number of values per frame.
The reader application will use the information in the header to send the data to the LED screens. For now I am making a simple test using ofPixels in both ends, comparing results to see if it is looking promising.
It is not.
The data coming played by the binary file looks scrambled. I wonder if I am messing up the datatypes?
The code is a bit involved to share but it looks like this:
- load binary to memory
- move pointer to binary to correct position ( current frame * bytes_per_frame )
copy from pointer bytes_per_frame into a ofPixels
// avoid having to type animations[current_animation] all the time
animationData_WS *anim = &animations[current_animation];int pointTo = anim->frame_size * loaded_frame_in_file;
//reset pointer (just in case)
anim->data = (char *)anim->animation_buffer.getData();
anim->data += HEADER_SIZE;
anim->data += anim->frame_size * loaded_frame_in_file;// ofPixels is for visualization only, data should end up in a UDP or so
ofPixels pixels;pixels.allocate(anim->w, anim->h, 3);
memcpy(pixels, anim->data, anim->frame_size);
Posts: 4
Participants: 3