source: roaraudio/libroaryiff/playback.c @ 4037:d36b139145df

Last change on this file since 4037:d36b139145df was 4037:d36b139145df, checked in by phi, 14 years ago

corrected (c)

File size: 2.4 KB
Line 
1//playback.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2010
5 *
6 *  The code (may) include prototypes and comments (and maybe
7 *  other code fragements) from the yiff sound system.
8 *  According to the debian/copyright file upstream author is
9 *  Tara Milana <learfox@twu.net>. Also copyright is listed as:
10 *  Copyright (C)  1997-2003 WolfPack Entertainment
11 *
12 *  This file is part of libroaryiff a part of RoarAudio,
13 *  a cross-platform sound system for both, home and professional use.
14 *  See README for details.
15 *
16 *  This file is free software; you can redistribute it and/or modify
17 *  it under the terms of the GNU General Public License version 3
18 *  as published by the Free Software Foundation.
19 *
20 *  libroaryiff is distributed in the hope that it will be useful,
21 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 *  GNU General Public License for more details.
24 *
25 *  You should have received a copy of the GNU General Public License
26 *  along with this software; see the file COPYING.  If not, write to
27 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28 *  Boston, MA 02110-1301, USA.
29 *
30 * NOTE: code fragments (like prototypes) taken from the yiff package
31 *       are 'GPLv2 or later' and are upgraded to GPLv3 by being used
32 *       within this document.
33 *
34 */
35
36#include <libroaryiff.h>
37
38YID YStartPlaySoundObjectSimple (YConnection *con, const char *path) {
39 return YStartPlaySoundObject(con, path, NULL);
40}
41
42YID YStartPlaySoundObject (YConnection *con, const char *path, YEventSoundPlay *value) {
43 struct roar_connection rcon;
44 struct roar_stream     stream[1];
45
46 if ( !con )
47  return YIDNULL;
48
49 if ( !path )
50  return YIDNULL;
51
52 roar_connect_fh(&rcon, con->fd);
53
54 // hm,... find out how to do this.
55 // need to start ssize_t roar_file_play (struct roar_connection * con, char * file, int exec)
56 // in background
57
58 if ( roar_file_play_full(&rcon, (char*)path, 0, 1, stream) == -1 ) {
59  ROAR_ERR("Can not start playback");
60  return YIDNULL;
61 }
62
63 return con->prev_generated_yid = ROARYIFF_ROAR2YID(stream->id);
64}
65
66void YDestroyPlaySoundObject(YConnection *con, YID yid) {
67 struct roar_connection rcon;
68
69 if ( !con )
70  return ;
71
72 if ( yid == YIDNULL )
73  return;
74
75 roar_connect_fh(&rcon, con->fd);
76
77 roar_kick(&rcon, ROAR_OT_STREAM, ROARYIFF_YID2ROAR(yid));
78}
79
80//ll
Note: See TracBrowser for help on using the repository browser.