YCalculateCycle(3) Y server cycle interval calculation

SYNTAX

#include <Y2/Y.h>
#include <Y2/Ylib.h>

long YCalculateCycle(

        YConnection *connection,

        int sample_rate,

        int channels,

        int sample_size,

        int fragment_size
)

ARGUMENTS

connection
Specifies the connection to the Y server, obtained by a call to YOpenConnection.
sample_rate
Specifies the sample rate in Hz.
channels
Specifies the number of channels.
sample_size
Specifies the sample size in bits.
fragment_size
Specifies the fragmented buffer size in bytes, must be a 2^n value.

DESCRIPTION

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.

RETURN VALUE

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.

EXAMPLE

#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);


        return(0);
}