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 / midistat.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-10-08  |  4.1 KB  |  144 lines

  1. /*  midistat.h    - class midiStat, change it internally and then send it. 
  2.     This file is part of LibKMid 0.9.5
  3.     Copyright (C) 1997,98,99,2000  Antonio Larrosa Jimenez
  4.     LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libkmid.html
  5.  
  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 _MIDISTAT_H
  25. #define _MIDISTAT_H
  26.  
  27. #include <libkmid/dattypes.h>
  28.  
  29. /**
  30.  * Stores the status of a MIDI device . That is, current patch in each channel,
  31.  * controller settings, pitch bender value, etc.
  32.  *
  33.  * This is used to "play" with all those values and then send them to the
  34.  * MIDI device just by using sendData() 
  35.  *
  36.  * @short Stores the MIDI status.
  37.  * @version 0.9.5 17/01/2000
  38.  * @author Antonio Larrosa Jimenez <larrosa@kde.org>
  39.  */
  40. class MidiStatus
  41. {
  42.   private:
  43.     class MidiStatusPrivate;
  44.     MidiStatusPrivate *d;
  45.  
  46.     ulong tempo;
  47.  
  48.     unsigned char chn_patch   [16];
  49.     int           chn_bender  [16];
  50.     unsigned char chn_pressure[16];
  51.     unsigned char chn_controller[16][256];
  52.  
  53.     int           chn_lastisvolumeev[16];
  54.  
  55.   public:
  56.     /**
  57.      * Constructor.
  58.      */
  59.     MidiStatus();
  60.  
  61.     /**
  62.      * Destructor.
  63.      */ 
  64.     ~MidiStatus();
  65.  
  66.  
  67.     //    void noteOn    ( uchar chn, uchar note, uchar vel );
  68.     //    void noteOff    ( uchar chn, uchar note, uchar vel );
  69.  
  70.     /**
  71.      * Stores a new value for the key aftertouch.
  72.      * @see MidiOut::keyPressure()
  73.      */
  74.     void keyPressure    ( uchar chn, uchar note, uchar vel );
  75.  
  76.     /**
  77.      * Stores a new patch in channel @p chn.
  78.      * @see chnPatch()
  79.      * @see MidiOut::chnPatchChange()
  80.      */
  81.     void chnPatchChange    ( uchar chn, uchar patch );
  82.  
  83.     /**
  84.      * Returns the patch currently used in channel @p chn.
  85.      */
  86.     uchar chnPatch    ( uchar chn ) { return chn_patch[chn]; }
  87.  
  88.     /**
  89.      * Stores a new channel pressure value in channel @p chn.
  90.      * @see MidiOut::chnPressure()
  91.      */
  92.     void chnPressure    ( uchar chn, uchar vel );
  93.  
  94.     /**
  95.      * Returns the pressure value currently used in channel @p chn.
  96.      */
  97.     uchar chnPressure    ( uchar chn ) { return chn_pressure[chn]; }
  98.  
  99.     /**
  100.      * Stores a new pitch bender value in channel chn
  101.      */
  102.     void chnPitchBender    ( uchar chn, uchar lsb, uchar msb );
  103.  
  104.     /**
  105.      * Returns the pitch bender value used in channel @p chn
  106.      */
  107.     int chnPitchBender    ( uchar chn) { return chn_bender[chn]; }
  108.  
  109.     /**
  110.      * Stores a new value for controller @p ctl in channel @p chn.
  111.      */
  112.     void chnController    ( uchar chn, uchar ctl , uchar v ); 
  113.  
  114.     /**
  115.      * Returns the value used for controller @p ctl in channel @p chn
  116.      */
  117.     uchar chnController    ( uchar chn, uchar ctl ) 
  118.     { return chn_controller[chn][ctl]; }
  119.  
  120.     /**
  121.      * Stores a sysex message that will be send in the next call to sendData
  122.      */ 
  123.     void sysex        ( uchar *data, ulong size);
  124.  
  125.     /**
  126.      * Sets the tempo.
  127.      *
  128.      * @see DeviceManager::tmrSetTempo()
  129.      */
  130.     void tmrSetTempo    ( int v );
  131.  
  132.  
  133.     /**
  134.      * Sends the current MIDI state to the DeviceManager object used as
  135.      * parameter (you should have already set the default device to the one you
  136.      * want to use). The @p gm parameter specifies if the patches used follow
  137.      * the GM standard (1), or follow the MT32 standard (0), in which case, they
  138.      * will be converted to GM before being sent.
  139.      */
  140.     void sendData    ( class DeviceManager *midi, int gm=1 );
  141. };
  142.  
  143. #endif
  144.