Programming | Standard acquisition modes |
|
|
Example for SpcGetData, no memory allocation error checking performed:
for (i = 0; i < | 2; i++) | // both | memory channels have been | used | ||||||
pnData[i] = | (ptr16) malloc (lMemsize * lBytesPerSample); | // allocate | memory for the data pointers | |||||||
|
|
|
|
| // with | the | maximum | size (lMemsize) | ||
SpcGetData | (hDrv, | 0, | 0, lMemsize, (dataptr) pnData[0]); | // | no demultiplexing is necessary | on channel 0 | ||||
SpcGetData | (hDrv, | 1, | 0, lMemsize, (dataptr) pnData[1]); | // | neither it is on | channel 1 |
|
If you use two channels for recording using only one memory channel or four channels, the data in the memory channel(s) is multiplexed and needs to be unsorted by the user. The following example shows how to unsort the data for the recording of two channels using memory chan- nel 0.
for (i = 0; i < 2; i++) | // 2 channels to read out from 1 memory channel | |
pnData[i] = (ptr16) malloc (lMemsize * lBytesPerSample); | // allocate | memory for the data pointers |
| // with the | maximum size (lMemsize) per channel |
pnTmp = (ptr16) malloc (lMemsize * 2 * lBytesPerSample); | // allocate | temporary buffer for copy |
SpcGetData (hDrv, 0, 0, 2 * lMemsize, (dataptr) pnTmp); | // get both | channels together |
| // from memory channel 0 | |
for (i = 0; i < lMemsize; i++) | // split data in the two channels | |
{ |
|
|
pnData[0][i] = pnTmp[(2 * i)]; |
|
|
pnData[1][i] = pnTmp[(2 * i) + 1]; |
|
|
} |
|
|
free (pnTmp); | // free the | temporary buffer |
|
|
|
52 | MC.31xx Manual |