isndsys/ss_stream.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 #define CS_SNDSYS_STREAM_COMPLETED  2
    00041
    00042 #define CS_SNDSYS_STREAM_DONTLOOP   0
    00043 #define CS_SNDSYS_STREAM_LOOP       1
    00044
    00046 enum
    00047 {
    00049   CS_SND3D_DISABLE=0,
    00051   CS_SND3D_RELATIVE,
    00053   CS_SND3D_ABSOLUTE
    00054 };
    00055
    00057 //
    00058 //  All audio is presented to the sound system in the form of a stream.
    00059 //  This interface is the minimal interface that all audio providing
    00060 //  objects must implement in order to produce sound.
    00061 //
    00062 struct iSndSysStream : public virtual iBase
    00063 {
    00064   SCF_INTERFACE(iSndSysStream,1,2,0);
    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
    00144   virtual int GetPauseState() = 0;
    00145
    00151   virtual bool SetLoopState(int loopstate) = 0;
    00152
    00157   virtual int GetLoopState() = 0;
    00158
    00163   virtual void SetPlayRatePercent(int percent) = 0;
    00164
    00169   virtual int GetPlayRatePercent() = 0;
    00170
    00175   virtual void SetAutoUnregister(bool autounreg) = 0;
    00176
    00181   virtual bool GetAutoUnregister() = 0;
    00182
    00187   virtual bool GetAutoUnregisterRequested() = 0;
    00188
    00189
    00204   virtual void AdvancePosition(size_t frame_delta) = 0;
    00205
    00242   virtual void GetDataPointers(size_t* position_marker, size_t max_requested_frames,
    00243         void **buffer1, size_t *buffer1_frames, void **buffer2, size_t *buffer2_frames) = 0;
    00244
    00251   virtual void InitializeSourcePositionMarker (size_t* position_marker) = 0;
    00252
    00258   virtual void ProcessNotifications() = 0;
    00259
    00261   virtual bool RegisterCallback(iSndSysStreamCallback *pCallback) = 0;
    00262
    00264   virtual bool UnregisterCallback(iSndSysStreamCallback *pCallback) = 0;
    00265
    00267   //   it's crossed.
    00268   virtual bool RegisterFrameNotification(size_t frame_number) = 0;
    00269
    00271   virtual bool AlwaysStream() const = 0;
    00272
    00278   virtual size_t GetLoopStart() = 0;
    00279
    00285   virtual size_t GetLoopEnd() = 0;
    00286
    00298   virtual bool SetLoopBoundaries(size_t startPosition, size_t endPosition) = 0;
    00299
    00306   virtual bool PendingSeek () = 0;
    00307
    00308 };
    00309
    00311 //
    00312 //  A component wishing to receive notification of Sound Stream events
    00313 //  should implement this interface, and call iSndSysStream::RegisterCallback()
    00314 //  to register with the stream of interest.
    00315 //
    00316 struct iSndSysStreamCallback : public virtual iBase
    00317 {
    00318   SCF_INTERFACE(iSndSysStreamCallback,0,1,0);
    00319
    00321   virtual void StreamLoopNotification() = 0;
    00322
    00324   virtual void StreamPauseNotification() = 0;
    00325
    00327   virtual void StreamUnpauseNotification() = 0;
    00328
    00330   virtual void StreamFrameNotification(size_t frame_number) = 0;
    00331 };
    00332
    00333
    00334
    00335
    00336
    00339 #endif // __CS_SNDSYS_STREAM_H__