YCalculateCycle - Y server cycle interval calculation
#include <Y2/Y.h>
#include <Y2/Ylib.h>
long YCalculateCycle(
YConnection *connection,
int sample_rate,
int channels,
int sample_size,
int fragment_size
)
The YCalculateCycle function calculates the theoretical cycle value in microseconds with respect to the given inputs. The input connection can be NULL, however if it is NULL then a less accurate and more generalized answer will be returned.
The YCalculateCycle returns the theoretical cycle value in microseconds. This value is not gauranteed to always work, cycle values defined on the Y server's preset Audio modes should be considered more accurate.
#include <stdio.h>
#include <Y2/Y.h>
#include <Y2/Ylib.h>
int main(int argc, char *argv[])
{
YConnection *con = YOpenConnection(
"/usr/sbin/starty",
"127.0.0.1:9433"
);
if(con == NULL)
return(1);
printf("Cycle %ld microseconds\n",
YCalculateCycle(
con, 11025, 2, 8, 1024
)
);
YCloseConnection(con, False);
YSetCycle(3) YGetAudioModes(3)