FreeBSD kernel sound device code
mixer.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MIXER_CMD_DIRECT   0 /* send command within driver */
 
#define MIXER_CMD_CDEV   1 /* send command from cdev/ioctl */
 
#define MIXER_TYPE_PRIMARY   0 /* mixer_init() */
 
#define MIXER_TYPE_SECONDARY   1 /* mixer_create() */
 
#define MIXER_SIZE
 
#define MIXER_DECLARE(name)   static DEFINE_CLASS(name, name ## _methods, MIXER_SIZE)
 

Functions

struct snd_mixermixer_create (device_t dev, kobj_class_t cls, void *devinfo, const char *desc)
 
int mixer_delete (struct snd_mixer *m)
 
int mixer_init (device_t dev, kobj_class_t cls, void *devinfo)
 
int mixer_uninit (device_t dev)
 
int mixer_reinit (device_t dev)
 
int mixer_ioctl_cmd (struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td, int from)
 
int mixer_oss_mixerinfo (struct cdev *i_dev, oss_mixerinfo *mi)
 Handler for SNDCTL_MIXERINFO. More...
 
int mixer_hwvol_init (device_t dev)
 
void mixer_hwvol_mute_locked (struct snd_mixer *m)
 
void mixer_hwvol_mute (device_t dev)
 
void mixer_hwvol_step_locked (struct snd_mixer *m, int l_step, int r_step)
 
void mixer_hwvol_step (device_t dev, int left_step, int right_step)
 
int mixer_busy (struct snd_mixer *m)
 
int mix_get_locked (struct snd_mixer *m, u_int dev, int *pleft, int *pright)
 
int mix_set_locked (struct snd_mixer *m, u_int dev, int left, int right)
 
int mix_set (struct snd_mixer *m, u_int dev, u_int left, u_int right)
 
int mix_get (struct snd_mixer *m, u_int dev)
 
int mix_setrecsrc (struct snd_mixer *m, u_int32_t src)
 
u_int32_t mix_getrecsrc (struct snd_mixer *m)
 
int mix_get_type (struct snd_mixer *m)
 
void mix_setdevs (struct snd_mixer *m, u_int32_t v)
 
void mix_setrecdevs (struct snd_mixer *m, u_int32_t v)
 Record mask of available recording devices. More...
 
u_int32_t mix_getdevs (struct snd_mixer *m)
 
u_int32_t mix_getrecdevs (struct snd_mixer *m)
 
void mix_setparentchild (struct snd_mixer *m, u_int32_t parent, u_int32_t childs)
 
void mix_setrealdev (struct snd_mixer *m, u_int32_t dev, u_int32_t realdev)
 
u_int32_t mix_getparent (struct snd_mixer *m, u_int32_t dev)
 
u_int32_t mix_getchild (struct snd_mixer *m, u_int32_t dev)
 
void * mix_getdevinfo (struct snd_mixer *m)
 
struct mtx * mixer_get_lock (struct snd_mixer *m)
 

Variables

int mixer_count
 

Macro Definition Documentation

#define MIXER_CMD_CDEV   1 /* send command from cdev/ioctl */

Definition at line 72 of file mixer.h.

Referenced by mixer_ioctl(), and mixer_ioctl_cmd().

#define MIXER_CMD_DIRECT   0 /* send command within driver */

Definition at line 71 of file mixer.h.

Referenced by dsp_ioctl().

#define MIXER_DECLARE (   name)    static DEFINE_CLASS(name, name ## _methods, MIXER_SIZE)

Definition at line 84 of file mixer.h.

#define MIXER_SIZE
Value:
(512 + sizeof(struct kobj) + \
sizeof(oss_mixer_enuminfo))

Definition at line 81 of file mixer.h.

#define MIXER_TYPE_PRIMARY   0 /* mixer_init() */

Definition at line 74 of file mixer.h.

Referenced by mixer_init(), mixer_obj_create(), and mixer_uninit().

#define MIXER_TYPE_SECONDARY   1 /* mixer_create() */

Definition at line 75 of file mixer.h.

Referenced by mixer_create(), mixer_delete(), and mixer_obj_create().

Function Documentation

int mix_get ( struct snd_mixer m,
u_int  dev 
)

Definition at line 983 of file mixer.c.

References snd_mixer::lock, mixer_get(), snd_mtxlock, and snd_mtxunlock.

Referenced by chn_syncstate(), and sysctl_es137x_single_pcm_mixer().

Here is the call graph for this function:

Here is the caller graph for this function:

int mix_get_locked ( struct snd_mixer m,
u_int  dev,
int *  pleft,
int *  pright 
)

Definition at line 1524 of file mixer.c.

References mixer_get().

Here is the call graph for this function:

int mix_get_type ( struct snd_mixer m)

Definition at line 1025 of file mixer.c.

References snd_mixer::type.

u_int32_t mix_getchild ( struct snd_mixer m,
u_int32_t  dev 
)

Definition at line 585 of file mixer.c.

References snd_mixer::child, and dev.

u_int32_t mix_getdevs ( struct snd_mixer m)

Definition at line 593 of file mixer.c.

References snd_mixer::devs.

Referenced by dsp_ioctl(), emu_dspmixer_init(), mixer_ioctl_channel(), mixer_ioctl_cmd(), sysctl_es137x_single_pcm_mixer(), and ymmix_init().

Here is the caller graph for this function:

u_int32_t mix_getparent ( struct snd_mixer m,
u_int32_t  dev 
)

Definition at line 577 of file mixer.c.

References dev, and snd_mixer::parent.

Referenced by chn_syncstate().

Here is the caller graph for this function:

u_int32_t mix_getrecdevs ( struct snd_mixer m)

Definition at line 599 of file mixer.c.

References snd_mixer::recdevs.

Referenced by emu_dspmixer_init(), es1370_mixsetrecsrc(), hdaa_audio_ctl_ossmixer_setrecsrc(), mixer_ioctl_cmd(), and sysctl_es137x_single_pcm_mixer().

Here is the caller graph for this function:

u_int32_t mix_getrecsrc ( struct snd_mixer m)

Definition at line 1011 of file mixer.c.

References snd_mixer::lock, mixer_getrecsrc(), snd_mtxlock, and snd_mtxunlock.

Referenced by sysctl_es137x_single_pcm_mixer().

Here is the call graph for this function:

Here is the caller graph for this function:

int mix_set ( struct snd_mixer m,
u_int  dev,
u_int  left,
u_int  right 
)

Definition at line 969 of file mixer.c.

References snd_mixer::lock, mixer_set(), snd_mtxlock, and snd_mtxunlock.

Referenced by emu_dspmixer_set(), hdaa_audio_ctl_set_defaults(), and sysctl_es137x_single_pcm_mixer().

Here is the call graph for this function:

Here is the caller graph for this function:

int mix_set_locked ( struct snd_mixer m,
u_int  dev,
int  left,
int  right 
)

Definition at line 1541 of file mixer.c.

References mixer_set().

Here is the call graph for this function:

void mix_setparentchild ( struct snd_mixer m,
u_int32_t  parent,
u_int32_t  childs 
)

Definition at line 545 of file mixer.c.

References snd_mixer::child, mask, and snd_mixer::parent.

Referenced by ac97mix_init(), hdaa_audio_ctl_ossmixer_init(), and uaudio_mixer_init_sub().

Here is the caller graph for this function:

void mix_setrealdev ( struct snd_mixer m,
u_int32_t  dev,
u_int32_t  realdev 
)

Definition at line 568 of file mixer.c.

References dev, and snd_mixer::realdev.

Referenced by ac97mix_init(), hdaa_audio_ctl_ossmixer_init(), and uaudio_mixer_init_sub().

Here is the caller graph for this function:

void mix_setrecdevs ( struct snd_mixer m,
u_int32_t  v 
)

Record mask of available recording devices.

Calling functions are responsible for defining the mask of available recording devices. This function records that value in a structure used by the rest of the mixer code.

This function also populates a structure used by the SNDCTL_DSP_*RECSRC* family of ioctls that are part of OSSV4. All recording device labels are concatenated in ascending order corresponding to their routing numbers. (Ex: a system might have 0 => 'vol', 1 => 'cd', 2 => 'line', etc.) For now, these labels are just the standard recording device names (cd, line1, etc.), but will eventually be fully dynamic and user controlled.

Parameters
mmixer device context container thing
vmask of recording devices

Definition at line 495 of file mixer.c.

References snd_mixer::dev, snd_mixer::enuminfo, snd_mixer::recdevs, and snd_mixernames.

Referenced by ac97mix_init(), ad1816mix_init(), alsmix_init(), cmimix_init(), cs4231_mixer_init(), emu_dspmixer_init(), emu_efxmixer_init(), envy24htmixer_init(), envy24mixer_init(), es1370_mixinit(), essmix_init(), hdaa_audio_ctl_ossmixer_init(), mssmix_init(), sb16mix_init(), sbmix_init(), sbpromix_init(), sv_mix_init(), sysctl_es137x_single_pcm_mixer(), and uaudio_mixer_init_sub().

Here is the caller graph for this function:

int mix_setrecsrc ( struct snd_mixer m,
u_int32_t  src 
)

Definition at line 997 of file mixer.c.

References snd_mixer::lock, mixer_setrecsrc(), snd_mtxlock, and snd_mtxunlock.

Referenced by emu_dspmixer_setrecsrc(), hdaa_autorecsrc_handler(), and sysctl_es137x_single_pcm_mixer().

Here is the call graph for this function:

Here is the caller graph for this function:

int mixer_busy ( struct snd_mixer m)

Definition at line 961 of file mixer.c.

References snd_mixer::busy.

Referenced by sysctl_es137x_single_pcm_mixer().

Here is the caller graph for this function:

struct snd_mixer* mixer_create ( device_t  dev,
kobj_class_t  cls,
void *  devinfo,
const char *  desc 
)
read

Definition at line 672 of file mixer.c.

References m, mixer_count, mixer_obj_create(), and MIXER_TYPE_SECONDARY.

Referenced by emu_dspmixer_init().

Here is the call graph for this function:

Here is the caller graph for this function:

int mixer_delete ( struct snd_mixer m)

Definition at line 653 of file mixer.c.

References snd_mixer::lock, mixer_count, MIXER_TYPE_SECONDARY, snd_mtxfree(), and snd_mixer::type.

Referenced by emu_dspmixer_uninit().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mtx* mixer_get_lock ( struct snd_mixer m)
read

Definition at line 1515 of file mixer.c.

References snd_mixer::lock.

Referenced by onyx_set(), snapper_set(), tumbler_set(), ua_mixer_set(), ua_mixer_setrecsrc(), and uaudio_mixer_init_sub().

Here is the caller graph for this function:

int mixer_hwvol_init ( device_t  dev)

Definition at line 874 of file mixer.c.

References snd_mixer::hwvol_mixer, snd_mixer::hwvol_step, m, mixer_get_devt(), and sysctl_hw_snd_hwvol_mixer().

Referenced by agg_attach(), m3_pci_attach(), and uaudio_attach_sub().

Here is the call graph for this function:

Here is the caller graph for this function:

void mixer_hwvol_mute ( device_t  dev)

Definition at line 908 of file mixer.c.

References snd_mixer::lock, m, mixer_get_devt(), mixer_hwvol_mute_locked(), snd_mtxlock, and snd_mtxunlock.

Referenced by agg_intr(), and m3_intr().

Here is the call graph for this function:

Here is the caller graph for this function:

void mixer_hwvol_mute_locked ( struct snd_mixer m)

Definition at line 895 of file mixer.c.

References snd_mixer::hwvol_mixer, snd_mixer::hwvol_mute_level, snd_mixer::hwvol_muted, mixer_get(), and mixer_set().

Referenced by mixer_hwvol_mute(), and uaudio_hid_rx_callback().

Here is the call graph for this function:

Here is the caller graph for this function:

void mixer_hwvol_step ( device_t  dev,
int  left_step,
int  right_step 
)

Definition at line 948 of file mixer.c.

References snd_mixer::lock, m, mixer_get_devt(), mixer_hwvol_step_locked(), snd_mtxlock, and snd_mtxunlock.

Referenced by agg_intr(), and m3_intr().

Here is the call graph for this function:

Here is the caller graph for this function:

void mixer_hwvol_step_locked ( struct snd_mixer m,
int  l_step,
int  r_step 
)

Definition at line 921 of file mixer.c.

References snd_mixer::hwvol_mixer, snd_mixer::hwvol_mute_level, snd_mixer::hwvol_muted, snd_mixer::hwvol_step, left, mixer_get(), mixer_set(), and right.

Referenced by mixer_hwvol_step(), and uaudio_hid_rx_callback().

Here is the call graph for this function:

Here is the caller graph for this function:

int mixer_ioctl_cmd ( struct cdev *  i_dev,
u_long  cmd,
caddr_t  arg,
int  mode,
struct thread *  td,
int  from 
)
int mixer_oss_mixerinfo ( struct cdev *  i_dev,
oss_mixerinfo *  mi 
)

Handler for SNDCTL_MIXERINFO.

This function searches for a mixer based on the numeric ID stored in oss_miserinfo::dev. If set to -1, then information about the current mixer handling the request is provided. Note, however, that this ioctl may be made with any sound device (audio, mixer, midi).

Note
Caller must not hold any PCM device, channel, or mixer locks.

See http://manuals.opensound.com/developer/SNDCTL_MIXERINFO.html for more information.

Parameters
i_devcharacter device on which the ioctl arrived
arguser argument (oss_mixerinfo *)
Return values
EINVALoss_mixerinfo::dev specified a bad value
0success
Todo:
Fill in
See Also
oss_mixerinfo::mixerhandle.
Note
From 4Front: "mixerhandle is an arbitrary string that identifies the mixer better than the device number (mixerinfo.dev). Device numbers may change depending on the order the drivers are loaded. However the handle should remain the same provided that the sound card is not moved to another PCI slot."
See Also
oss_mixerinfo::magic is a reserved field.
From 4Front: "magic is usually 0. However some devices may have dedicated setup utilities and the magic field may contain an unique driver specific value (managed by [4Front])."

The only flag for

See Also
oss_mixerinfo::caps is currently MIXER_CAP_VIRTUAL, which I'm not sure we really worry about.

Mixer extensions currently aren't supported, so leave

See Also
oss_mixerinfo::nrext blank for now.
Todo:
Fill in
See Also
oss_mixerinfo::priority (requires touching drivers?)
Note
The priority field is for mixer applets to determine which mixer should be the default, with 0 being least preferred and 10 being most preferred. From 4Front: "OSS drivers like ICH use higher values (10) because such chips are known to be used only on motherboards. Drivers for high end pro devices use 0 because they will never be the default mixer. Other devices use values 1 to 9 depending on the estimated probability of being the default device.

XXX Described by Hannu@4Front, but not found in soundcard.h. strlcpy(mi->devnode, devtoname(d->mixer_dev), sizeof(mi->devnode)); mi->legacy_device = i;

Definition at line 1387 of file mixer.c.

References snd_mixer::dev, snd_mixer::lock, m, mixer_cdevsw, snddev_info::mixer_dev, snd_mixer::modify_counter, snd_mixer::name, pcm_devclass, PCM_LOCK, PCM_REGISTERED, PCM_UNLOCK, and PCM_UNLOCKASSERT.

Referenced by dsp_ioctl(), and mixer_ioctl_cmd().

Here is the caller graph for this function:

int mixer_reinit ( device_t  dev)
int mixer_uninit ( device_t  dev)

Definition at line 765 of file mixer.c.

References snd_mixer::busy, snd_mixer::lock, m, mixer_count, snddev_info::mixer_dev, mixer_get_devt(), mixer_set(), mixer_setrecsrc(), MIXER_TYPE_PRIMARY, snd_mtxfree(), snd_mtxlock, snd_mtxunlock, and snd_mixer::type.

Referenced by pcm_unregister(), and uaudio_detach_sub().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int mixer_count

Keeps a count of mixer devices; used only by OSSv4 SNDCTL_SYSINFO ioctl.

Definition at line 111 of file mixer.c.

Referenced by mixer_create(), mixer_delete(), mixer_init(), mixer_uninit(), and sound_oss_sysinfo().