Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/root/src/subsynth/syn/Stream/OpenALAudioOStream.h

Go to the documentation of this file.
00001 
00002 /****************** <SYN heading BEGIN do not edit this line> *****************
00003  *
00004  * subsynth - modular audio synthesizer
00005  * subsynth is (C) Copyright 2001-2002 by Kevin Meinert
00006  *
00007  * Original Author: Kevin Meinert
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Library General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Library General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Library General Public
00020  * License along with this library; if not, write to the
00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00022  * Boston, MA 02111-1307, USA.
00023  *
00024  * -----------------------------------------------------------------
00025  * File:          $RCSfile: OpenALAudioOStream.h,v $
00026  * Date modified: $Date: 2002/04/08 16:13:28 $
00027  * Version:       $Revision: 1.30 $
00028  * -----------------------------------------------------------------
00029  *
00030  ****************** <SYN heading END do not edit this line> ******************/
00031 
00032 #ifndef SUBSYNTH_OPENAL_AUDIO_STREAM
00033 #define SUBSYNTH_OPENAL_AUDIO_STREAM
00034 
00035 #ifdef HAVE_VPR
00036 # include "vpr/vpr.h"
00037 # ifdef VPR_USE_IRIX_SPROC
00038    #error "VPR_USE_IRIX_SPROC: you idiot"
00039 # endif
00040 #endif
00041 
00042 #include "syn/Util/AudioFormat.h"
00043 #include "syn/Stream/AudioContext.h"
00044 #include "syn/Stream/AudioOStream.h"
00045 
00046 namespace syn
00047 {
00051    class OpenALAudioOStream : public AudioOStream
00052    {
00053    public:
00054       OpenALAudioOStream();
00055       virtual ~OpenALAudioOStream(){}
00056 
00057       void setContext( syn::AudioContext& ctx )
00058       {
00059          mCtx = &ctx;
00060       }
00061    
00065       virtual bool open( const syn::AudioFormat& fmt );
00066 
00067       // is the stream open?
00068       virtual bool isOpen() { return mIsOpen; }
00069 
00071       void resizeBuffers( signed int numBuffers = 2 );
00072 
00074       virtual bool canAcceptMoreData()  const;
00075 
00080       virtual bool write( const void* const  data, signed int size );
00081       
00083       virtual int pcount() const { return mPcount; }
00084 
00086       virtual bool close();
00087       
00088       /* blocking call, waits until stream is done writing */
00089       virtual void flush();
00090 
00092       virtual const syn::AudioFormat& format() const 
00093       {      
00094          return mFmt;
00095       }
00096 
00097    private:
00098       // is the stream playing?
00099       bool isPlaying() const;
00100 
00101       std::vector<unsigned int>  mBuffers;
00102       unsigned int               mFormat;
00103       std::vector<unsigned int>  mSources;
00104       signed int                 mSampRate;
00105       bool                 mIsOpen;
00106       syn::AudioFormat     mFmt;
00107       unsigned int         mBufferHackSwitch;
00108       syn::AudioContext*   mCtx;
00109       signed int           mPcount;
00110    };
00111 }
00112 
00113 
00114 #endif

Generated at Mon Apr 15 09:26:08 2002 for subsynth by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001