|
Crossfire Client, Trunk
R18666
|
#include <config.h>#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <time.h>#include <math.h>#include <stdlib.h>#include <ctype.h>#include <errno.h>#include "newclient.h"#include "client-types.h"#include "def_sounds.h"#include "sndproto.h"#include "common.h"#include <alsa/asoundlib.h>#include <alsa/pcm_plugin.h>
Go to the source code of this file.
Defines | |
| #define | SOUND_DEBUG |
| #define | ALSA_PCM_NEW_HW_PARAMS_API |
| #define | AUDIODEV "default:0,0" |
| #define | ALSA9_ERROR(str, err) |
| #define | SOUND_DECREASE 0.1 |
Functions | |
| void | alsa_audio_close (void) |
| int | init_audio (void) |
| void | alsa_recover (int e) |
| int | audio_play (int buffer, int off) |
| void | play_sound (int soundnum, int soundtype, int x, int y) |
| void | play_music (const char *name) |
| int | main (int argc, char *argv[]) |
Variables | |
| snd_pcm_t * | handle = NULL |
| int | sndbuf_pos = 0 |
| int * | sounds_in_buffer = NULL |
| int | current_buffer = 0 |
| int | first_free_buffer = 0 |
| int | soundfd = 0 |
| sound_settings | settings = { 0, 1, 0, 8000, 200, 2048, 4, AUDIODEV } |
| snd_pcm_hw_params_t * | params |
| int | err = 0 |
Used only for alsa 0.9 and later sound. Alsa sound code is sufficiently different from the rest that trying to keep it common didn't make much sense.
Definition in file alsa9.c.
| #define ALSA9_ERROR | ( | str, | |
| err | |||
| ) |
| #define ALSA_PCM_NEW_HW_PARAMS_API |
| #define SOUND_DEBUG |
| #define SOUND_DECREASE 0.1 |
| void alsa_audio_close | ( | void | ) |
| void alsa_recover | ( | int | e | ) |
| int audio_play | ( | int | buffer, |
| int | off | ||
| ) |
Play a sound using the Alsa9 sound system.
Does the actual task of writing the data to the socket. The ALSA write logic is a bit odd, in that the count you pass in is not the number of bytes you are writing, but the number of samples you are writing. Thus, if you have stereo with 1 byte/channel, you'd divide the number by 2. If you have 16 bit audio with stereo, you'd divide the number by 4.
| buffer | |
| off |
Definition at line 268 of file alsa9.c.


| int init_audio | ( | void | ) |
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
| void play_music | ( | const char * | name | ) |
| void play_sound | ( | int | soundnum, |
| int | soundtype, | ||
| int | x, | ||
| int | y | ||
| ) |
| int current_buffer = 0 |
| int first_free_buffer = 0 |
| sound_settings settings = { 0, 1, 0, 8000, 200, 2048, 4, AUDIODEV } |
| int sndbuf_pos = 0 |
| int* sounds_in_buffer = NULL |
1.7.6.1