home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libkmid / fmout.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  4.1 KB  |  156 lines

  1. /*  fmout.h    - class fmOut which handles the /dev/sequencer device
  2.             for FM synths
  3.     This file is part of LibKMid 0.9.5
  4.     Copyright (C) 1998,99,2000  Antonio Larrosa Jimenez
  5.     LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libkmid.html                                         
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20.  
  21.     Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
  22.  
  23. ***************************************************************************/
  24. #ifndef _FMOUT_H
  25. #define _FMOUT_H
  26.  
  27. #include <libkmid/midiout.h>
  28. #include <libkmid/voiceman.h>
  29.  
  30. /**
  31.  * FM device output class . FMOut is used to send MIDI events to 
  32.  * FM devices, such as AdLib cards, or OPL3 synthesizers.
  33.  *
  34.  * FMOut inherits MidiOut and supports the same simple API.
  35.  * 
  36.  * The preferred way to use this class is by selecting a FM device
  37.  * on the MidiManager and using a MidiManager object directly
  38.  *
  39.  * @short Sends MIDI events to FM devices
  40.  * @version 0.9.5 17/01/2000
  41.  * @author Antonio Larrosa Jimenez <larrosa@kde.org>
  42.  */
  43. class KMID_EXPORT FMOut : public MidiOut
  44. {
  45.   private:
  46.     class FMOutPrivate;
  47.     FMOutPrivate *di;
  48.  
  49.     int patchloaded[256];
  50.     /**
  51.      * Takes a value of 2 or 3, for FM or OPL3 support
  52.      */
  53.     int opl;
  54.     int nvoices;
  55.  
  56.     VoiceManager *vm;
  57.  
  58.     void modifyPatch(char *buf, int key);
  59.     void loadFMPatches  (void);
  60.  
  61.   public:
  62.     /**
  63.      * Constructor. See MidiOut::MidiOut() for more information.
  64.      */
  65.     FMOut  ( int d=0, int total =12 );
  66.  
  67.     /**
  68.      * Destructor. 
  69.      */
  70.     ~FMOut ();
  71.  
  72.     /**
  73.      * See MidiOut::openDev()
  74.      */
  75.     virtual void openDev    ( int sqfd );
  76.  
  77.     /**
  78.      * See MidiOut::closeDev()
  79.      */
  80.     virtual void closeDev    ( void );
  81.  
  82.     /**
  83.      * See MidiOut::initDev()
  84.      */
  85.     virtual void initDev    ( void );
  86.  
  87.     /**
  88.      * See MidiOut::noteOn()
  89.      */
  90.     virtual void noteOn        ( uchar chn, uchar note, uchar vel );
  91.  
  92.     /**
  93.      * See MidiOut::noteOff()
  94.      */
  95.     virtual void noteOff        ( uchar chn, uchar note, uchar vel );
  96.  
  97.     /**
  98.      * See MidiOut::keyPressure()
  99.      */
  100.     virtual void keyPressure    ( uchar chn, uchar note, uchar vel );
  101.  
  102.     /**
  103.      * See MidiOut::chnPatchChange()
  104.      */
  105.     virtual void chnPatchChange    ( uchar chn, uchar patch );
  106.  
  107.     /**
  108.      * See MidiOut::chnPressure()
  109.      */
  110.     virtual void chnPressure    ( uchar chn, uchar vel );
  111.  
  112.     /**
  113.      * See MidiOut::chnPitchBender()
  114.      */
  115.     virtual void chnPitchBender    ( uchar chn, uchar lsb,  uchar msb );
  116.  
  117.     /**
  118.      * See MidiOut::chnController()
  119.      */
  120.     virtual void chnController    ( uchar chn, uchar ctl , uchar v ); 
  121.  
  122.     /**
  123.      * It's an empty function, as FM devices don't support System Exclusive
  124.      * messages
  125.      */
  126.     virtual void sysex        ( uchar *data,ulong size);
  127.  
  128.     /**
  129.      * See MidiOut::setVolumePercentage()
  130.      */
  131.     virtual void setVolumePercentage    ( int i );
  132.  
  133.     /**
  134.      * Returns @p p if the patch p has been loaded, or another patch (already loaded)
  135.      * if @p p hasn't been loaded. 
  136.      */
  137.     int patch(int p);
  138.  
  139.   private:
  140.     static const char *FMPatchesDirectory;
  141.     static int deleteFMPatchesDirectory;
  142.  
  143.   public:
  144.     /**
  145.      * Sets the directory where the FM patches are stored, that is, where the
  146.      * std.o3, std.sb, drums.o3 and drums.sb files can be found.
  147.      *
  148.      * It will store a copy of the parameter, so you should delete the memory
  149.      * used by the parameter you passed.
  150.      */
  151.     static void setFMPatchesDirectory(const char *dir);
  152.  
  153. };
  154.  
  155. #endif
  156.