| 1 /* purple |
|
| 2 * |
|
| 3 * Purple is the legal property of its developers, whose names are too numerous |
|
| 4 * to list here. Please refer to the COPYRIGHT file distributed with this |
|
| 5 * source distribution. |
|
| 6 * |
|
| 7 * This program is free software; you can redistribute it and/or modify |
|
| 8 * it under the terms of the GNU General Public License as published by |
|
| 9 * the Free Software Foundation; either version 2 of the License, or |
|
| 10 * (at your option) any later version. |
|
| 11 * |
|
| 12 * This program is distributed in the hope that it will be useful, |
|
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 15 * GNU General Public License for more details. |
|
| 16 * |
|
| 17 * You should have received a copy of the GNU General Public License |
|
| 18 * along with this program; if not, write to the Free Software |
|
| 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
| 20 */ |
|
| 21 |
|
| 22 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION) |
|
| 23 # error "only <purple.h> may be included directly" |
|
| 24 #endif |
|
| 25 |
|
| 26 #ifndef PURPLE_SOUND_H |
|
| 27 #define PURPLE_SOUND_H |
|
| 28 /** |
|
| 29 * SECTION:sound |
|
| 30 * @section_id: libpurple-sound |
|
| 31 * @short_description: Sound subsystem definition. |
|
| 32 * @title: Sound API |
|
| 33 * @see_also: <link linkend="chapter-signals-sound">Sound signals</link> |
|
| 34 */ |
|
| 35 |
|
| 36 #include "account.h" |
|
| 37 |
|
| 38 #define PURPLE_TYPE_SOUND_UI_OPS (purple_sound_ui_ops_get_type()) |
|
| 39 |
|
| 40 /**************************************************************************/ |
|
| 41 /* Data Structures */ |
|
| 42 /**************************************************************************/ |
|
| 43 typedef struct _PurpleSoundUiOps PurpleSoundUiOps; |
|
| 44 |
|
| 45 /** |
|
| 46 * PurpleSoundStatus: |
|
| 47 * @PURPLE_SOUND_STATUS_AVAILABLE: Only play sound when Status is Available. |
|
| 48 * @PURPLE_SOUND_STATUS_AWAY: Only play sound when Status is Not Available. |
|
| 49 * @PURPLE_SOUND_STATUS_ALWAYS: Always play sound. |
|
| 50 * |
|
| 51 * A preference option on when to play sounds depending on the current status |
|
| 52 */ |
|
| 53 typedef enum { |
|
| 54 PURPLE_SOUND_STATUS_AVAILABLE = 1, |
|
| 55 PURPLE_SOUND_STATUS_AWAY, |
|
| 56 PURPLE_SOUND_STATUS_ALWAYS, |
|
| 57 } PurpleSoundStatus; |
|
| 58 |
|
| 59 /** |
|
| 60 * PurpleSoundEventID: |
|
| 61 * @PURPLE_SOUND_BUDDY_ARRIVE: Buddy signs on. |
|
| 62 * @PURPLE_SOUND_BUDDY_LEAVE: Buddy signs off. |
|
| 63 * @PURPLE_SOUND_RECEIVE: Receive an IM. |
|
| 64 * @PURPLE_SOUND_FIRST_RECEIVE: Receive an IM that starts a conv. |
|
| 65 * @PURPLE_SOUND_SEND: Send an IM. |
|
| 66 * @PURPLE_SOUND_CHAT_JOIN: Someone joins a chat. |
|
| 67 * @PURPLE_SOUND_CHAT_LEAVE: Someone leaves a chat. |
|
| 68 * @PURPLE_SOUND_CHAT_YOU_SAY: You say something in a chat. |
|
| 69 * @PURPLE_SOUND_CHAT_SAY: Someone else says somthing in a chat. |
|
| 70 * @PURPLE_SOUND_POUNCE_DEFAULT: Default sound for a buddy pounce. |
|
| 71 * @PURPLE_SOUND_CHAT_NICK: Someone says your name in a chat. |
|
| 72 * @PURPLE_SOUND_GOT_ATTENTION: Got an attention. |
|
| 73 * @PURPLE_NUM_SOUNDS: Total number of sounds. |
|
| 74 * |
|
| 75 * A type of sound. |
|
| 76 */ |
|
| 77 typedef enum |
|
| 78 { |
|
| 79 PURPLE_SOUND_BUDDY_ARRIVE = 0, |
|
| 80 PURPLE_SOUND_BUDDY_LEAVE, |
|
| 81 PURPLE_SOUND_RECEIVE, |
|
| 82 PURPLE_SOUND_FIRST_RECEIVE, |
|
| 83 PURPLE_SOUND_SEND, |
|
| 84 PURPLE_SOUND_CHAT_JOIN, |
|
| 85 PURPLE_SOUND_CHAT_LEAVE, |
|
| 86 PURPLE_SOUND_CHAT_YOU_SAY, |
|
| 87 PURPLE_SOUND_CHAT_SAY, |
|
| 88 PURPLE_SOUND_POUNCE_DEFAULT, |
|
| 89 PURPLE_SOUND_CHAT_NICK, |
|
| 90 PURPLE_SOUND_GOT_ATTENTION, |
|
| 91 PURPLE_NUM_SOUNDS |
|
| 92 |
|
| 93 } PurpleSoundEventID; |
|
| 94 |
|
| 95 /** |
|
| 96 * PurpleSoundUiOps: |
|
| 97 * @init: Called when the UI should initialize sound |
|
| 98 * @uninit: Called when the UI should teardown sound |
|
| 99 * @play_file: Called when a file should be played. |
|
| 100 * <sbr/>@filename: The filename to play |
|
| 101 * @play_event: Called when a sound event should be played. |
|
| 102 * <sbr/>@event: The #@PurpleSoundEventID to play |
|
| 103 * |
|
| 104 * Operations used by the core to request that particular sound files, or the |
|
| 105 * sound associated with a particular event, should be played. |
|
| 106 */ |
|
| 107 struct _PurpleSoundUiOps |
|
| 108 { |
|
| 109 void (*init)(void); |
|
| 110 void (*uninit)(void); |
|
| 111 void (*play_file)(const char *filename); |
|
| 112 void (*play_event)(PurpleSoundEventID event); |
|
| 113 |
|
| 114 /*< private >*/ |
|
| 115 void (*_purple_reserved1)(void); |
|
| 116 void (*_purple_reserved2)(void); |
|
| 117 void (*_purple_reserved3)(void); |
|
| 118 void (*_purple_reserved4)(void); |
|
| 119 }; |
|
| 120 |
|
| 121 G_BEGIN_DECLS |
|
| 122 |
|
| 123 /**************************************************************************/ |
|
| 124 /* Sound API */ |
|
| 125 /**************************************************************************/ |
|
| 126 |
|
| 127 /** |
|
| 128 * purple_sound_ui_ops_get_type: |
|
| 129 * |
|
| 130 * Returns: The #GType for the #PurpleSoundUiOps boxed structure. |
|
| 131 */ |
|
| 132 GType purple_sound_ui_ops_get_type(void); |
|
| 133 |
|
| 134 /** |
|
| 135 * purple_sound_play_file: |
|
| 136 * @filename: The file to play. |
|
| 137 * @account: (nullable): The account that this sound is associated with, or |
|
| 138 * NULL if the sound is not associated with any specific |
|
| 139 * account. This is needed for the "sounds while away?" |
|
| 140 * preference to work correctly. |
|
| 141 * |
|
| 142 * Plays the specified sound file. |
|
| 143 */ |
|
| 144 void purple_sound_play_file(const char *filename, PurpleAccount *account); |
|
| 145 |
|
| 146 /** |
|
| 147 * purple_sound_play_event: |
|
| 148 * @event: The event. |
|
| 149 * @account: (nullable): The account that this sound is associated with, or |
|
| 150 * NULL if the sound is not associated with any specific |
|
| 151 * account. This is needed for the "sounds while away?" |
|
| 152 * preference to work correctly. |
|
| 153 * |
|
| 154 * Plays the sound associated with the specified event. |
|
| 155 */ |
|
| 156 void purple_sound_play_event(PurpleSoundEventID event, PurpleAccount *account); |
|
| 157 |
|
| 158 /** |
|
| 159 * purple_sound_set_ui_ops: |
|
| 160 * @ops: The UI sound operations structure. |
|
| 161 * |
|
| 162 * Sets the UI sound operations |
|
| 163 */ |
|
| 164 void purple_sound_set_ui_ops(PurpleSoundUiOps *ops); |
|
| 165 |
|
| 166 /** |
|
| 167 * purple_sound_get_ui_ops: |
|
| 168 * |
|
| 169 * Gets the UI sound operations |
|
| 170 * |
|
| 171 * Returns: The UI sound operations structure. |
|
| 172 */ |
|
| 173 PurpleSoundUiOps *purple_sound_get_ui_ops(void); |
|
| 174 |
|
| 175 /** |
|
| 176 * purple_sound_init: |
|
| 177 * |
|
| 178 * Initializes the sound subsystem |
|
| 179 */ |
|
| 180 void purple_sound_init(void); |
|
| 181 |
|
| 182 /** |
|
| 183 * purple_sound_uninit: |
|
| 184 * |
|
| 185 * Shuts down the sound subsystem |
|
| 186 */ |
|
| 187 void purple_sound_uninit(void); |
|
| 188 |
|
| 189 /** |
|
| 190 * purple_sounds_get_handle: |
|
| 191 * |
|
| 192 * Returns the sound subsystem handle. |
|
| 193 * |
|
| 194 * Returns: The sound subsystem handle. |
|
| 195 */ |
|
| 196 void *purple_sounds_get_handle(void); |
|
| 197 |
|
| 198 G_END_DECLS |
|
| 199 |
|
| 200 #endif /* PURPLE_SOUND_H */ |
|