CrystalSpace

Public API Reference

isndsys/ss_stream.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2004 by Andrew Mann
00003     Copyright (C) 1998-2000 by Jorrit Tyberghein
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library 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 GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_SNDSYS_STREAM_H__
00021 #define __CS_SNDSYS_STREAM_H__
00022 
00027 #include "csutil/scf.h"
00028 
00032 struct csSndSysSoundFormat;
00033 struct iSndSysData;
00034 struct iSndSysStreamCallback;
00035 
00036 const size_t CS_SNDSYS_STREAM_UNKNOWN_LENGTH = (size_t)-1;
00037 
00038 #define CS_SNDSYS_STREAM_PAUSED     0
00039 #define CS_SNDSYS_STREAM_UNPAUSED   1
00040 
00041 #define CS_SNDSYS_STREAM_DONTLOOP   0
00042 #define CS_SNDSYS_STREAM_LOOP       1
00043 
00045 enum
00046 {
00048   CS_SND3D_DISABLE=0,
00050   CS_SND3D_RELATIVE,
00052   CS_SND3D_ABSOLUTE
00053 };
00054 
00056 //
00057 //  All audio is presented to the sound system in the form of a stream.
00058 //  This interface is the minimal interface that all audio providing 
00059 //  objects must implement in order to produce sound.
00060 //
00061 struct iSndSysStream : public virtual iBase
00062 {
00064   SCF_INTERFACE(iSndSysStream,0,2,1);
00065 
00067   //  This is not guaranteed to be useful for any particular purpose, different,
00068   //  or even accurate.  This is mainly for diagnostic purposes.
00069   virtual const char *GetDescription() = 0;
00070 
00075   virtual const csSndSysSoundFormat *GetRenderedFormat() = 0;
00076 
00078   virtual int Get3dMode() = 0;
00079 
00086   virtual size_t GetFrameCount() = 0;
00087 
00098   virtual size_t GetPosition() = 0;
00099 
00105   virtual bool ResetPosition() = 0;
00106 
00112   virtual bool SetPosition (size_t newposition) = 0;
00113 
00126   virtual bool Pause() = 0;
00127 
00132   virtual bool Unpause() = 0;
00133 
00140   virtual int GetPauseState() = 0;
00141 
00147   virtual bool SetLoopState(int loopstate) = 0;
00148 
00153   virtual int GetLoopState() = 0;
00154 
00159   virtual void SetPlayRatePercent(int percent) = 0;
00160 
00165   virtual int GetPlayRatePercent() = 0;
00166 
00171   virtual void SetAutoUnregister(bool autounreg) = 0;
00172 
00177   virtual bool GetAutoUnregister() = 0;
00178 
00183   virtual bool GetAutoUnregisterRequested() = 0;
00184 
00185 
00200   virtual void AdvancePosition(size_t frame_delta) = 0;
00201 
00238   virtual void GetDataPointers(size_t* position_marker, size_t max_requested_frames,
00239         void **buffer1, size_t *buffer1_frames, void **buffer2, size_t *buffer2_frames) = 0;
00240 
00247   virtual void InitializeSourcePositionMarker (size_t* position_marker) = 0;
00248 
00254   virtual void ProcessNotifications() = 0;
00255 
00257   virtual bool RegisterCallback(iSndSysStreamCallback *pCallback) = 0;
00258 
00260   virtual bool UnregisterCallback(iSndSysStreamCallback *pCallback) = 0;
00261 
00263   //   it's crossed.
00264   virtual bool RegisterFrameNotification(size_t frame_number) = 0;
00265 };
00266 
00268 //
00269 //  A component wishing to receive notification of Sound Stream events
00270 //  should implement this interface, and call iSndSysStream::RegisterCallback()
00271 //  to register with the stream of interest.
00272 //
00273 struct iSndSysStreamCallback : public virtual iBase
00274 {
00276   SCF_INTERFACE(iSndSysStreamCallback,0,1,0);
00277 
00279   virtual void StreamLoopNotification() = 0;
00280 
00282   virtual void StreamPauseNotification() = 0;
00283 
00285   virtual void StreamUnpauseNotification() = 0;
00286 
00288   virtual void StreamFrameNotification(size_t frame_number) = 0;
00289 };
00290 
00291 
00292 
00293 
00294 
00297 #endif // __CS_SNDSYS_STREAM_H__

Generated for Crystal Space by doxygen 1.4.7