Go to the source code of this file.
Data Structures | |
struct | snd_t |
Functions | |
void | kb_snd_init (snd_t *snd, const char *mixer_device, const char *dsp_device) |
void | kb_snd_exit (snd_t *snd) |
int | kb_snd_open (snd_t *snd) |
void | kb_snd_close (snd_t *snd) |
int | kb_snd_doMmap (snd_t *snd) |
int | kb_snd_doMunmap (snd_t *snd) |
int | kb_snd_enableTrigger (snd_t *snd, int mask) |
int | kb_snd_enableFrag (snd_t *snd) |
short * | kb_snd_getIPtr (snd_t *snd) |
short * | kb_snd_getOPtr (snd_t *snd) |
unsigned int | kb_snd_getFragSize (snd_t *snd) |
void | kb_snd_copyFragTo (snd_t *snd, short *buf) |
void | kb_snd_copyFragFrom (snd_t *snd, short *buf) |
int | kb_snd_setVolume (snd_t *snd, unsigned int line, unsigned int vol_left, unsigned int vol_right) |
int | kb_snd_setSampleRate (snd_t *snd, unsigned int sampleRate) |
int | kb_snd_waitFrag (snd_t *snd) |
int | kb_snd_record (snd_t *snd, short *data, unsigned long nsamples) |
int | kb_snd_play (snd_t *snd, short *data, unsigned long nsamples) |
int | kb_snd_reset (snd_t *snd) |
int | kb_snd_flush (snd_t *snd) |
int | kb_snd_openDevices (snd_t *snd) |
unsigned long | kb_smplfromdur (unsigned int duration, unsigned smplrate) |
unsigned long | kb_durfromsmpl (unsigned int smplnbr, unsigned smplrate) |
unsigned int | kb_snd_fragInit (snd_t *snd, int line1Vol, int line2Vol, int smplRate, int mode) |
void | kb_snd_fragPlay (snd_t *snd, int fragSize) |
unsigned long kb_durfromsmpl | ( | unsigned int | smplnbr, | |
unsigned | smplrate | |||
) |
This function get the duration for a given sample number
smplnbr | duration in second | |
smplrate | sample rate ie 44100 |
Definition at line 530 of file kb_sound.c.
unsigned long kb_smplfromdur | ( | unsigned int | duration, | |
unsigned | smplrate | |||
) |
This function get the number of samples for a given duration
duration | duration in second | |
smplrate | sample rate ie 44100 |
Definition at line 516 of file kb_sound.c.
void kb_snd_close | ( | snd_t * | snd | ) |
This function closes the file descriptor opened by kb_snd_open
Definition at line 111 of file kb_sound.c.
References snd_t::dsp_fd, snd_t::ibuf, kb_snd_doMunmap(), and snd_t::mix_fd.
Referenced by kb_snd_exit(), and kb_snd_open().
void kb_snd_copyFragFrom | ( | snd_t * | snd, | |
short * | buf | |||
) |
Definition at line 344 of file kb_sound.c.
References snd_t::fragSize, and kb_snd_getOPtr().
void kb_snd_copyFragTo | ( | snd_t * | snd, | |
short * | buf | |||
) |
Definition at line 331 of file kb_sound.c.
References snd_t::fragSize, and kb_snd_getIPtr().
int kb_snd_doMmap | ( | snd_t * | snd | ) |
Definition at line 131 of file kb_sound.c.
References snd_t::dsp_fd, snd_t::fragCount, snd_t::fragSize, snd_t::ibuf, snd_t::iend, snd_t::isize, KB_DEBUG, snd_t::obuf, snd_t::oend, and snd_t::osize.
Referenced by kb_snd_fragInit().
int kb_snd_doMunmap | ( | snd_t * | snd | ) |
Definition at line 175 of file kb_sound.c.
References snd_t::ibuf, snd_t::iend, snd_t::isize, snd_t::obuf, snd_t::oend, and snd_t::osize.
Referenced by kb_snd_close().
int kb_snd_enableFrag | ( | snd_t * | snd | ) |
Definition at line 229 of file kb_sound.c.
References snd_t::dsp_fd, snd_t::fragCount, snd_t::fragSize, KB_DEBUG, KB_ERROR, KB_ERROR_DUPLEX, KB_ERROR_FRAGEXP, and KB_ERROR_FRAGMENT.
Referenced by kb_snd_fragInit().
int kb_snd_enableTrigger | ( | snd_t * | snd, | |
int | mask | |||
) |
Definition at line 195 of file kb_sound.c.
References snd_t::dsp_fd, and KB_DEBUG.
Referenced by kb_snd_fragInit().
void kb_snd_exit | ( | snd_t * | snd | ) |
Definition at line 28 of file kb_sound.c.
References kb_snd_close().
int kb_snd_flush | ( | snd_t * | snd | ) |
unsigned int kb_snd_fragInit | ( | snd_t * | snd, | |
int | line1Vol, | |||
int | line2Vol, | |||
int | smplRate, | |||
int | mode | |||
) |
This function completely initialise then open the sound devices various volumes such as the "Line IN", sample rate and mode are set from the various arguments
snd | pointer to a snd_t structure | |
line1Vol | "Line 1" volume ( from 0 to 255 ) | |
line2Vol | "Line 2" volume ( from 0 to 255 ) | |
smplrate | sample rate, ie 44100 | |
mode | Trigger mode :
|
Definition at line 554 of file kb_sound.c.
References kb_snd_doMmap(), kb_snd_enableFrag(), kb_snd_enableTrigger(), kb_snd_getFragSize(), kb_snd_openDevices(), kb_snd_setSampleRate(), and kb_snd_setVolume().
void kb_snd_fragPlay | ( | snd_t * | snd, | |
int | fragSize | |||
) |
This function just play a fragment from the sound card both argument supposed to be retrieved with the kb_snd_fragInit()
snd | pointer to an initialised snd_t structure | |
fragSize | fragment size |
just do some OutFrag = InFrag
Definition at line 603 of file kb_sound.c.
References kb_snd_getIPtr(), kb_snd_getOPtr(), and kb_snd_waitFrag().
unsigned int kb_snd_getFragSize | ( | snd_t * | snd | ) |
Definition at line 323 of file kb_sound.c.
References snd_t::fragSize.
Referenced by kb_snd_fragInit().
short* kb_snd_getIPtr | ( | snd_t * | snd | ) |
Definition at line 271 of file kb_sound.c.
References snd_t::dsp_fd, snd_t::fragSize, snd_t::ibuf, snd_t::isize, KB_ERROR, and KB_ERROR_IPTR.
Referenced by kb_snd_copyFragTo(), and kb_snd_fragPlay().
short* kb_snd_getOPtr | ( | snd_t * | snd | ) |
Definition at line 296 of file kb_sound.c.
References snd_t::dsp_fd, snd_t::fragSize, KB_ERROR, KB_ERROR_OPTR, snd_t::obuf, snd_t::oend, and snd_t::osize.
Referenced by kb_snd_copyFragFrom(), and kb_snd_fragPlay().
void kb_snd_init | ( | snd_t * | snd, | |
const char * | mixer_device, | |||
const char * | dsp_device | |||
) |
Definition at line 9 of file kb_sound.c.
References snd_t::dsp_device, snd_t::dsp_fd, snd_t::fragCount, snd_t::fragSize, snd_t::ibuf, snd_t::iend, snd_t::mix_fd, snd_t::mixer_device, snd_t::obuf, and snd_t::oend.
Referenced by kb_snd_openDevices(), koa_sound_task(), and main().
int kb_snd_open | ( | snd_t * | snd | ) |
This function opens all devices need for producing sound.
Definition at line 37 of file kb_sound.c.
References snd_t::bytePerSample, snd_t::dsp_device, snd_t::dsp_fd, snd_t::fragCount, snd_t::fragSize, KB_DEBUG, kb_snd_close(), snd_t::mix_fd, snd_t::mixer_device, snd_t::nbChannels, and snd_t::sampleSize.
Referenced by kb_snd_openDevices(), koa_sound_task(), and main().
int kb_snd_openDevices | ( | snd_t * | snd | ) |
This function open and initializes the default sound devices
snd | pointer to a snd_t structure |
Definition at line 484 of file kb_sound.c.
References KB_DEBUG, kb_init(), kb_snd_init(), and kb_snd_open().
Referenced by kb_snd_fragInit().
int kb_snd_play | ( | snd_t * | snd, | |
short * | data, | |||
unsigned long | size | |||
) |
This function plays a given number of samples
Definition at line 440 of file kb_sound.c.
References snd_t::dsp_fd, and kb_snd_flush().
Referenced by kb_wav_play(), koa_sound_task(), and main().
int kb_snd_record | ( | snd_t * | snd, | |
short * | data, | |||
unsigned long | size | |||
) |
This function records a given number of samples
Definition at line 421 of file kb_sound.c.
References snd_t::dsp_fd.
int kb_snd_reset | ( | snd_t * | snd | ) |
int kb_snd_setSampleRate | ( | snd_t * | snd, | |
unsigned int | sampleRate | |||
) |
This function sets the sampling rate
Definition at line 375 of file kb_sound.c.
References snd_t::dsp_fd, and KB_DEBUG.
Referenced by kb_snd_fragInit(), koa_sound_task(), and main().
int kb_snd_setVolume | ( | snd_t * | snd, | |
unsigned int | line, | |||
unsigned int | vol_left, | |||
unsigned int | vol_right | |||
) |
This function sets the input/output volume and selects the input.
Definition at line 358 of file kb_sound.c.
References snd_t::mix_fd.
Referenced by kb_snd_fragInit().
int kb_snd_waitFrag | ( | snd_t * | snd | ) |
Definition at line 390 of file kb_sound.c.
References snd_t::dsp_fd.
Referenced by kb_snd_fragPlay().