# SoVRMLAudioClip.h

    00001 /**************************************************************************\
    00002  *
    00003  *  This file is part of the Coin 3D visualization library.
    00004  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00005  *
    00006  *  This library is free software; you can redistribute it and/or
    00007  *  modify it under the terms of the GNU General Public License
    00008  *  ("GPL") version 2 as published by the Free Software Foundation.
    00009  *  See the file LICENSE.GPL at the root directory of this source
    00010  *  distribution for additional information about the GNU GPL.
    00011  *
    00012  *  For using Coin with software that can not be combined with the GNU
    00013  *  GPL, and for taking advantage of the additional benefits of our
    00014  *  support services, please contact Systems in Motion about acquiring
    00015  *  a Coin Professional Edition License.
    00016  *
    00017  *  See <URL:http://www.coin3d.org> for  more information.
    00018  *
    00019  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00020  *  <URL:http://www.sim.no>.
    00021  *
    00022 \**************************************************************************/
    00023
    00024 #ifndef COIN_SOVRMLAUDIOCLIP_H
    00025 #define COIN_SOVRMLAUDIOCLIP_H
    00026
    00027 #include <Inventor/nodes/SoSubNode.h>
    00028 #include <Inventor/nodes/SoNode.h>
    00029 #include <Inventor/fields/SoSFString.h>
    00030 #include <Inventor/fields/SoMFString.h>
    00031 #include <Inventor/fields/SoSFBool.h>
    00032 #include <Inventor/fields/SoSFFloat.h>
    00033 #include <Inventor/fields/SoSFTime.h>
    00034 #include <Inventor/lists/SbStringList.h>
    00035 #include <Inventor/SbTime.h>
    00036
    00037 class SoVRMLAudioClipP;
    00038
    00039 class COIN_DLL_API SoVRMLAudioClip : public SoNode
    00040 {
    00041   typedef SoNode inherited;
    00042   SO_NODE_HEADER(SoVRMLAudioClip);
    00043
    00044 public:
    00045   typedef void *open_func(const SbStringList &url,
    00046                             SoVRMLAudioClip *clip, void *userdataptr);
    00047   typedef size_t read_func(void *datasource,
    00048                              void *buffer, int numframes, int &channels,
    00049                              SoVRMLAudioClip *clip, void *userdataptr);
    00050   typedef int seek_func(void *datasource, long offset, int whence,
    00051                           SoVRMLAudioClip *clip, void *userdataptr);
    00052   typedef long tell_func(void *datasource,
    00053                          SoVRMLAudioClip *clip, void *userdataptr);
    00054   typedef int close_func(void *datasource,
    00055                          SoVRMLAudioClip *clip, void *userdataptr);
    00056
    00057   static void initClass(void);
    00058   SoVRMLAudioClip(void);
    00059
    00060   SoSFString description;
    00061   SoSFBool loop;
    00062   SoSFFloat pitch;
    00063   SoSFTime startTime;
    00064   SoSFTime stopTime;
    00065   SoMFString url;
    00066
    00067   static void  setSubdirectories(const SbList<SbString> &subdirectories);
    00068   static const SbStringList & getSubdirectories();
    00069   static void setDefaultPauseBetweenTracks(SbTime pause);
    00070   static SbTime getDefaultPauseBetweenTracks();
    00071   static void setDefaultIntroPause(SbTime pause);
    00072   static SbTime getDefaultIntroPause();
    00073   static void setDefaultSampleRate(int samplerate);
    00074   static int getDefaultSampleRate();
    00075   static void setDefaultTimerInterval(SbTime interval);
    00076   static SbTime getDefaultTimerInterval();
    00077
    00078   int getSampleRate();
    00079
    00080   void * open(const SbStringList &url);
    00081   size_t read(void *datasource, void *buffer, int numframes, int &channels);
    00082   int    seek(void *datasource, long offset, int whence);
    00083   long   tell(void *datasource);
    00084   int    close(void *datasource);
    00085
    00086   void setCallbacks(open_func *opencb, read_func *readcb, seek_func *seekcb,
    00087                     tell_func *tellcb, close_func *closecb, void *userdataptr);
    00088
    00089 protected:
    00090   virtual ~SoVRMLAudioClip();
    00091   SoSFTime duration_changed; // eventOut
    00092   SoSFBool isActive;         // eventOut
    00093
    00094 private:
    00095   SoVRMLAudioClipP *pimpl;
    00096   friend class SoVRMLAudioClipP;
    00097 };
    00098
    00099 #endif // ! COIN_SOVRMLAUDIOCLIP_H