| | 95 | } |
|---|
| | 96 | |
|---|
| | 97 | void |
|---|
| | 98 | open_audio(PluginWindowInfo *info) { |
|---|
| | 99 | int err; |
|---|
| | 100 | |
|---|
| | 101 | info->audio_opened = TRUE; |
|---|
| | 102 | info->playback_target = 0; |
|---|
| | 103 | |
|---|
| | 104 | err = sa_device_create_pcm(&(info->audio_handle), "Mozilla Plugin", |
|---|
| | 105 | SA_PCM_WRONLY, SA_PCM_S16_LE, AUDIO_RATE, AUDIO_CHANNELS); |
|---|
| | 106 | |
|---|
| | 107 | if (err) { |
|---|
| | 108 | printf("Error creating audio device\n"); |
|---|
| | 109 | info->audio_opened = FALSE; |
|---|
| | 110 | return; |
|---|
| | 111 | } |
|---|
| | 112 | |
|---|
| | 113 | err = sa_device_open(info->audio_handle); |
|---|
| | 114 | if (err) { |
|---|
| | 115 | printf("Error opening audio device\n"); |
|---|
| | 116 | info->audio_opened = FALSE; |
|---|
| | 117 | return; |
|---|
| | 118 | } |
|---|
| | 119 | return; |
|---|
| 189 | | sa_device_close(info->audio_handle); |
|---|
| 190 | | err = sa_device_create_pcm(&(info->audio_handle), "Mozilla Plugin", |
|---|
| 191 | | SA_PCM_WRONLY, SA_PCM_S16_LE, AUDIO_RATE, AUDIO_CHANNELS); |
|---|
| 192 | | if (err) { |
|---|
| 193 | | printf("Error creating audio device\n"); |
|---|
| 194 | | info->audio_opened = FALSE; |
|---|
| 195 | | } |
|---|
| 196 | | err = sa_device_open(info->audio_handle); |
|---|
| 197 | | if (err) { |
|---|
| 198 | | printf("Error opening audio device\n"); |
|---|
| 199 | | info->audio_opened = FALSE; |
|---|
| 200 | | } |
|---|
| 201 | | |
|---|
| 202 | | if (info->audio_opened == TRUE) |
|---|
| 203 | | { |
|---|
| 204 | | info->playback_target = 0; |
|---|
| 205 | | } |
|---|
| 206 | | else |
|---|
| 207 | | #endif |
|---|
| 208 | | { |
|---|
| 209 | | info->playback_target = get_curr_time(); |
|---|
| 210 | | } |
|---|
| | 225 | if (info->audio_opened == TRUE) |
|---|
| | 226 | sa_device_close(info->audio_handle); |
|---|
| | 227 | info->audio_opened = FALSE; |
|---|
| | 228 | info->tried_audio = FALSE; |
|---|
| | 229 | #endif |
|---|
| | 230 | offset = 40; |
|---|
| 244 | | /* open audio device for playback */ |
|---|
| 245 | | info->playback_target = 0; |
|---|
| 246 | | #ifdef USE_AUDIO |
|---|
| 247 | | info->audio_opened = TRUE; |
|---|
| 248 | | err = sa_device_create_pcm(&(info->audio_handle), "Mozilla Plugin", |
|---|
| 249 | | SA_PCM_WRONLY, SA_PCM_S16_LE, AUDIO_RATE, AUDIO_CHANNELS); |
|---|
| 250 | | |
|---|
| 251 | | if (err) { |
|---|
| 252 | | printf("Error creating audio device\n"); |
|---|
| 253 | | info->audio_opened = FALSE; |
|---|
| 254 | | } |
|---|
| 255 | | |
|---|
| 256 | | err = sa_device_open(info->audio_handle); |
|---|
| 257 | | if (err) { |
|---|
| 258 | | printf("Error opening audio device\n"); |
|---|
| 259 | | info->audio_opened = FALSE; |
|---|
| 260 | | } |
|---|
| 261 | | |
|---|
| 262 | | if (info->audio_opened == FALSE) |
|---|
| 263 | | #endif |
|---|
| 264 | | { |
|---|
| 265 | | info->playback_target = get_curr_time(); |
|---|
| 266 | | } |
|---|
| 267 | | |
|---|