YSetAudioModeValues - Audio values setting
#include <Y2/Y.h>
#include <Y2/Ylib.h>
int YSetAudioModeValues(
YConnection *connection,
int sample_size,
int channels,
int sample_rate,
int direction,
int allow_fragmenting,
int num_fragments,
int fragment_size
)
Audio to the values specified. Any sound objects currently being played will be killed and the owning Y clients will be notified.
If sample_rate is set to 0, then the recorder will be shelled out. Allowing other direct programs to use the recorder's devices (DSP device, mixer, etc). Y clients will not notice any differance, the Y server will emulate (but not actually perform) normal operations (including the playing of sound objects).
To unshell the recorder, simply call YSetAudioModeValues or YChangeAudioModePreset with valid values.
The YSetAudioModeValues function returns -1 on error/invalid value or 0 on success.
#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);
if(YSetAudioModeValues(
con, /* Connection. */
8, /* Sample size. */
2, /* Channels. */
11025, /* Sample rate. */
0, /* Play. */
True, /* Allow fragmenting. */
2, /* Number of buf frags. */
1024 /* Buffer frag size in bytes. */
))
printf("Failed.\n");
else
printf("Success.\n");
YCloseConnection(con, False);
YChangeAudioModePreset(3) YGetAudioStats(3)