YStartPlaySoundObject(3)

NAME

YStartPlaySoundObject - sound object playing

SYNTAX

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

YID YStartPlaySoundObject(
        YConnection *connection,
        const char *path,
        YEventSoundPlay *value
)

ARGUMENTS

connection
    Specifies the connection to the Y server, obtained by a call to YOpenConnection.

path
    Specifies the path (in UNIX path notation) to the sound object on the VFS (virtual file system) of the machine that the Y server is running on. If the path is not absolute, then a set of search paths defined on the Y server will be searched through.

value
    Specifies the values of the sound object at the start of the play. See YEventSoundPlay for more information about this structure.

DESCRIPTION

The YStartPlaySoundObject function begins playing a sound object specified by path with the given values.

On success a YSoundObjectPlay event will be generated.

RETURN VALUE

The YStartPlaySoundObject function returns the YID of the sound object being played or YIDNULL on failure. The returned YID represents the playing instance of the sound object (not the sound object's file data).

At any time YDestroyPlaySoundObject can be called to stop the play of the sound object.

When this sound object stops playing (either when it reaches the end of its life cycle or interrupted by the Y client) a YSoundObjectKill event will be sent to the Y client.

EXAMPLE

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

int main(int argc, char *argv[])
{
        YID yid;
        YEventSoundPlay value;
        YConnection *con = YOpenConnection(
                "/usr/sbin/starty",
                "127.0.0.1:9433"
        );
        if(con == NULL)
                return(1);

        value.flags = (YPlayValuesFlagPosition |
                       YPlayValuesFlagTotalRepeats |
                       YPlayValuesFlagVolume);
        value.position = 0;
        value.total_repeats = 1;
        value.left_volume = 1.0;
        value.right_volume = 1.0;
        yid = YStartPlaySoundObject(
                con, "/usr/share/sounds/info.wav", &value
        );

        sleep(3);

        YDestroyPlaySoundObject(con, yid);

        YCloseConnection(con, False);

        return(0);
}

SEE ALSO

YStartPlaySoundObjectSimple(3) YSetPlaySoundObjectValues(3) YGetSoundObjectAttributes(3) YDestroyPlaySoundObject(3) YEventSoundPlay(3)