YMatchAudioModeValues(3) Audio mode matching

SYNTAX

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

Boolean YMatchAudioModeValues(

        YConnection *connection,

        YAudioModeValuesStruct *buf,

        int sample_rate,

        int sample_size,

        int channels,

        int direction
)

ARGUMENTS

connection
Specifies the connection to the Y server, obtained by a call to YOpenConnection.
buf
Specifies a pointer to a YAudioModeValuesStruct in which the matched Audio mode values will be stored. The values will only be stored if an Audio mode is matched (when True is returned), otherwise the values are not modified.
sample_rate
Specifies the sample rate in Hz.
sample_size
Specifies the sample size in bits.
channels
Specifies the number of channels.
direction
Specifies the direction, 0 = play and 1 = record.

DESCRIPTION

The YMatchAudioModeValues function checks the given values with a list of Audio mode values obtained from the Y server. If an Audio mode who's values match the given values then True is returned and buf is set with the values of the matched Audio mode, otherwise False is returned.

RETURN VALUE

The YMatchAudioModeValues function returns True if an Audio mode is matched or False if no match is made.

EXAMPLE

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

int main(int argc, char *argv[])
{

        YAudioModeValuesStruct buf;

        YConnection *con = YOpenConnection(

                "/usr/sbin/starty",

                "127.0.0.1:9433"

        );

        if(con == NULL)

                return(1);


        if(YMatchAudioModeValues(

                con, &buf,

                11025,     /* 11025 Hz */

                8,         /* 8 bits */

                2,         /* Stereo */

                0          /* Play */

        ))

                printf(
"Matched Audio mode \"%s\"\n",

                        buf.name

                );


        YCloseConnection(con, False);


        return(0);
}