Imagine kitchen mixers here

The SL Mixer Library.

By Steve Baker

Introduction.

This library allows one to drive the mixer controls of most PC-style sound cards. It relies on the Open Sound System drivers (formerly known as 'VoxWare') - which are generally a standard part of the Linux Kernel - and which is also available on some other UNIX platforms.

A port of SM to the Windows family of operating systems is currently underway.

SM does not work under SGI's IRIX.

Using the Library.

To use this library, you must '#include "sm.h"' and link to libsm.a or libsm.so.

class smMixer.

This library comprises a single class 'smMixer'.

Most programs will only ever create a single smMixer object.

Here are the member functions:


  class smMixer
  {
    public:

      smMixer () ;
      smMixer ( char *device ) ;
     ~smMixer () ;
  
      int not_working () ;

      /* Volume/Treble/Bass controls are in integer percentages */

      void setTreble       ( int treble ) ;
      void setBass         ( int bass   ) ;

      void setMasterVolume ( int volume ) ;
      void setSynthVolume  ( int volume ) ;
      void setPCMVolume    ( int volume ) ;
      void setSpeakerVolume( int volume ) ;
      void setLineVolume   ( int volume ) ;
      void setMicVolume    ( int volume ) ;
      void setCDVolume     ( int volume ) ;

      void setMasterVolume ( int left, int right ) ;
      void setSynthVolume  ( int left, int right ) ;
      void setPCMVolume    ( int left, int right ) ;
      void setSpeakerVolume( int left, int right ) ;
      void setLineVolume   ( int left, int right ) ;
      void setMicVolume    ( int left, int right ) ;
      void setCDVolume     ( int left, int right ) ;
  } ;

Basically, each of the mixer devices can be driven with either mono or stereo volume controls, each volume is a expressed as an integer percentage of maximum.

By default, "/dev/mixer" is the device used by this class, but an alternative device may be accessed if it's name is passed into the constructor.

The 'not_working()' function returns TRUE if there is any kind of problem with the driver. Mostly it returns TRUE if your system isn't set up for audio.

The driver will not fail if you call it's member functions when 'not_working()' returns TRUE - so programs written for audio should work OK even on Linux boxes with no audio support.


Valid HTML 4.0!
Steve J. Baker. <sjbaker1@airmail.net>