Crossfire Client, Branch  R11627
Data Structures | Defines | Functions | Variables
alsa9.c File Reference
#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 "soundsdef.h"
#include <alsa/asoundlib.h>
#include <alsa/pcm_plugin.h>
#include "common.c"
Include dependency graph for alsa9.c:

Go to the source code of this file.

Data Structures

struct  sound_settings

Defines

#define ALSA9_ERROR(str, err)
#define ALSA_PCM_NEW_HW_PARAMS_API
#define AUDIODEV   "default:0,0"
#define CONFIG_FILE   "/.crossfire/sndconfig"
#define SOUND_DEBUG
#define SOUND_DECREASE   0.1

Functions

void alsa_audio_close (void)
void alsa_recover (int e)
int audio_play (int buffer, int off)
int init_audio (void)
int main (int argc, char *argv[])
 The client entry point.
void play_sound (int soundnum, int soundtype, int x, int y)

Variables

static snd_pcm_uframes_t chunk_size = 0
int current_buffer = 0
int err = 0
int first_free_buffer = 0
int frequency = 0
snd_pcm_t * handle = NULL
snd_pcm_hw_params_t * params
static char * rcsid_cfsndserv_c = "$Id: alsa9.c 6716 2007-06-27 18:57:31Z akirschbaum $"
int sample_size = 0
struct sound_settings settings
int sign = 0
int sndbuf_pos = 0
int soundfd = 0
int * sounds_in_buffer = NULL
int stereo = 0
int zerolevel = 0

Define Documentation

#define ALSA9_ERROR (   str,
  err 
)
Value:
{ \
                fprintf(stderr,"ALSA9 Error: %s %s\n",str,snd_strerror(err)); }

Definition at line 85 of file alsa9.c.

Referenced by alsa_recover(), and init_audio().

Definition at line 80 of file alsa9.c.

#define AUDIODEV   "default:0,0"

Definition at line 81 of file alsa9.c.

Referenced by init_audio().

#define CONFIG_FILE   "/.crossfire/sndconfig"

Definition at line 88 of file alsa9.c.

Referenced by read_settings(), and write_settings().

#define SOUND_DEBUG

Definition at line 31 of file alsa9.c.

#define SOUND_DECREASE   0.1

Definition at line 91 of file alsa9.c.

Referenced by play_sound().


Function Documentation

void alsa_audio_close ( void  )

Definition at line 115 of file alsa9.c.

References handle.

Referenced by init_audio().

Here is the caller graph for this function:

void alsa_recover ( int  e)

Definition at line 228 of file alsa9.c.

References ALSA9_ERROR, err, and handle.

Referenced by audio_play().

Here is the caller graph for this function:

int audio_play ( int  buffer,
int  off 
)

Definition at line 260 of file alsa9.c.

References alsa_recover(), buffers, sound_settings::buflen, chunk_size, err, handle, sample_size, and settings.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int init_audio ( void  )

Definition at line 117 of file alsa9.c.

References ALSA9_ERROR, alsa_audio_close(), AUDIODEV, sound_settings::bit8, chunk_size, err, frequency, sound_settings::frequency, handle, params, sample_size, settings, sign, sound_settings::sign, stereo, sound_settings::stereo, and zerolevel.

Referenced by init_sounds().

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

The client entry point.

Parameters:
argc
argv
Returns:

Definition at line 461 of file alsa9.c.

References audio_play(), sound_settings::buffers, buffers, sound_settings::buflen, current_buffer, err, first_free_buffer, handle, init_sounds(), rcsid_cfsndserv_c, read_settings(), settings, sndbuf_pos, SoundCmd(), sounds_in_buffer, write_settings(), and zerolevel.

Here is the call graph for this function:

void play_sound ( int  soundnum,
int  soundtype,
int  x,
int  y 
)

Variable Documentation

snd_pcm_uframes_t chunk_size = 0 [static]

Definition at line 112 of file alsa9.c.

Referenced by audio_play(), and init_audio().

int current_buffer = 0

Definition at line 95 of file alsa9.c.

Referenced by main(), and play_sound().

int err = 0

Definition at line 113 of file alsa9.c.

Referenced by alsa_recover(), audio_play(), init_audio(), and main().

Definition at line 96 of file alsa9.c.

Referenced by main().

int frequency = 0

Definition at line 101 of file alsa9.c.

Referenced by init_audio(), and init_sounds().

snd_pcm_t* handle = NULL

Definition at line 82 of file alsa9.c.

Referenced by alsa_audio_close(), alsa_recover(), audio_play(), init_audio(), and main().

snd_pcm_hw_params_t* params

Definition at line 111 of file alsa9.c.

Referenced by init_audio(), script_dead(), script_init(), and script_list().

char* rcsid_cfsndserv_c = "$Id: alsa9.c 6716 2007-06-27 18:57:31Z akirschbaum $" [static]

Definition at line 1 of file alsa9.c.

Referenced by main().

int sample_size = 0

Definition at line 101 of file alsa9.c.

Referenced by audio_play(), init_audio(), init_sounds(), and play_sound().

int sign = 0

Definition at line 101 of file alsa9.c.

Referenced by init_audio(), and init_sounds().

int sndbuf_pos = 0

Definition at line 83 of file alsa9.c.

Referenced by main().

int soundfd = 0

Definition at line 98 of file alsa9.c.

Referenced by main(), and play_sound().

int* sounds_in_buffer = NULL

Definition at line 94 of file alsa9.c.

Referenced by init_sounds(), main(), and play_sound().

int stereo = 0

Definition at line 101 of file alsa9.c.

Referenced by init_audio(), init_sounds(), and play_sound().

int zerolevel = 0

Definition at line 101 of file alsa9.c.

Referenced by init_audio(), init_sounds(), and main().