ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a callback after n buffers

Hi,
 
 I am using the 1427 PCIe card and I am writting a code in c++.
I am just wondering if there is a way to have a callback after a specific number of buffers are filled up rather than in every buffer.
I have a ring setup and I want every 1600 frames to have a callback to get these frames and manipulate them while it continues to acquire and fill up the other buffers.   
 
Is there a simple way to get this done?
 
Thanks
Alex
0 Kudos
Message 1 of 4
(3,601 Views)
Hi Alex,

I'm afraid I don't think there is a specific function that will callback when x number of buffers are full. Can I have a little more information on your problem so I can suggest an alternative approach? Specifically what type of buffer are you filling?

Regards,

Ian C.
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 4
(3,580 Views)
Hi Alex,

Have you found a good way to do the n-buffers callback? My solution for a similar probelm was using a "multimedia timer" to check for the position in the ring ever few millisecs, but I'm not very happy with the result. I'd love to hear of a better way to do this.

Thanks,
Oded.
0 Kudos
Message 3 of 4
(3,419 Views)

well the best way that I have found is this, which works nicely for the moment:

imgSessionExamineBuffer(Sid, IMG_CURRENT_BUFFER, &real_index, &buffAddr);

start_frames = real_index + nframes;

imgSessionReleaseBuffer(Sid);

for(int j = 0; j < nframes; j++)

{

imgSessionExamineBuffer(Sid, start_frames, &real_index, &buffAddr);

for (int i=0;i<2048;i++) data[i + 2048*j] = ((unsigned short*)buffAddr)[i];

start_frames++;

imgSessionReleaseBuffer(Sid);

}

 

Alex

0 Kudos
Message 4 of 4
(3,402 Views)