FluidSynthMidiDriver.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (C) 2001-2005 The ScummVM project
00003  * Copyright (C) 2005 The Pentagram Team
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifdef USE_FLUIDSYNTH_MIDI
00021 
00022 #include "LowLevelMidiDriver.h"
00023 #include <fluidsynth.h>
00024 
00025 class FluidSynthMidiDriver : public LowLevelMidiDriver {
00026 private:
00027         fluid_settings_t *_settings;
00028         fluid_synth_t *_synth;
00029         int _soundFont;
00030 
00031         const static MidiDriverDesc     desc;
00032         static MidiDriver *createInstance() {
00033                 return new FluidSynthMidiDriver();
00034         }
00035 
00036 public:
00037         static const MidiDriverDesc* getDesc() { return &desc; }
00038         FluidSynthMidiDriver();
00039 
00040 protected:
00041         // Because GCC complains about casting from const to non-const...
00042         void setInt(const char *name, int val);
00043         void setNum(const char *name, double num);
00044         void setStr(const char *name, const char *str);
00045 
00046         // LowLevelMidiDriver implementation
00047         virtual int open();
00048         virtual void close();
00049         virtual void send(uint32 b);
00050         virtual void lowLevelProduceSamples(sint16 *samples, uint32 num_samples);
00051 
00052         // MidiDriver overloads
00053         virtual bool            isSampleProducer() { return true; }
00054         virtual bool            noTimbreSupport() { return true; }
00055 };
00056 
00057 
00058 #endif

Generated on Fri Jul 27 22:27:14 2007 for pentagram by  doxygen 1.4.7