source: roaraudio/libroaryiff/events.c @ 5270:e25346c13638

Last change on this file since 5270:e25346c13638 was 5270:e25346c13638, checked in by phi, 12 years ago

fixed some gcc -Wextra warnings

File size: 2.2 KB
Line 
1//events.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2011
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
38// RoarAudio isn't event based, so we need to trick a lot here
39// Maybe this can be overcome with the notify API
40
41int YGetNextEvent (YConnection *con, YEvent *event, Boolean block) {
42 struct roar_connection rcon;
43 struct roar_stream s;
44
45 (void)block;
46
47 if ( con == NULL || event == NULL )
48  return -1;
49
50 roar_connect_fh(&rcon, con->fd);
51
52 if ( con->prev_generated_yid != YIDNULL ) {
53  if ( roar_get_stream(&rcon, &s, ROARYIFF_YID2ROAR(con->prev_generated_yid)) == -1 ) {
54   // ok, we know something happened.
55   if ( roar_error == ROAR_ERROR_PROTO ) {
56    // the server died
57    event->type     = YDisconnect;
58    return 1;
59   } else {
60    // the stream died
61    event->type     = YSoundObjectKill;
62    event->kill.yid = con->prev_generated_yid;
63    return 1;
64   }
65  }
66  // else { nothing interesting happened }
67 }
68
69 return 0;
70}
71
72//ll
Note: See TracBrowser for help on using the repository browser.