Code Search for Developers
 
 
  

noggfile.h from The Nebula Device at Krugle


Show noggfile.h syntax highlighted

#ifndef N_OGGFILE_H
#define N_OGGFILE_H
//------------------------------------------------------------------------------
/**
    @class nOggFile
    @ingroup Audio3
    @brief Provide read-access to a ogg file.

    (C) 2005 Radon Labs GmbH
*/
#include "audio3/naudiofile.h"
#include "kernel/nfile.h"

#include <vorbis/codec.h>

//------------------------------------------------------------------------------
class nOggFile : public nAudioFile
{
public:
    /// constructor
    nOggFile();
    /// destructor
    virtual ~nOggFile();

    /// open the file
    virtual bool Open(const nString& filename);
    /// close the file
    virtual void Close();

    /// return size of audio data in file in bytes
    virtual int GetSize() const;
    /// return pointer to format description
    virtual WAVEFORMATEX* GetFormat() const;

    /// read bytes from file
    virtual uint Read(void* buffer, uint bytesToRead);
    /// reset to beginning of audio data
    virtual bool Reset();

private:
    static const int    INPUTBUFFER = 4096;

    bool                InitOGG();
    bool                ReleaseOGG();

    bool                m_bFileEndReached;
    int                 size;               /* ogg filesize in bytes */

    nFile*              file;               /* Input File ; reads from Memory or File */
    WAVEFORMATEX        wfx;                /* audio format */

    int                 bytesIn;
    char*               bufferIn;

    ogg_sync_state      oSyncState;         /* sync and verify incoming physical bitstream */
    ogg_stream_state    oStreamState;       /* take physical pages, weld into a logical stream of packets */
    ogg_page            oBitStreamPage;     /* one Ogg bitstream page.  Vorbis packets are inside */
    ogg_packet          oRawPacket;         /* one raw packet of data for decode */

    vorbis_info         vBitStreamInfo;     /* struct that stores all the static vorbis bitstream settings */
    vorbis_comment      vComments;          /* struct that stores all the bitstream user comments */
    vorbis_dsp_state    vDecoderState;      /* central working state for the packet->PCM decoder */
    vorbis_block        vDecoderWorkSpace;  /* local working space for packet->PCM decode */

    bool                readEarlyLoopExit;  /* read:important to continue read-loop correctly */
    bool                endOfStream;        /* read:remember end of the stream */
    int                 keepAlive;
};
//------------------------------------------------------------------------------
#endif





See more files for this project here

The Nebula Device

Realtime 3D game/visualization engine, written in C++, scriptable through Tcl/Tk, Python and Lua. Supports D3D and OpenGL for rendering, runs under Linux and Windows.

Project homepage: http://sourceforge.net/projects/nebuladevice
Programming language(s): C,C++,Python
License: other

  audio.dox
  dsutil.h
  dxutil.h
  naudiofile.h
  naudioserver3.h
  ndsound3.h
  ndsoundresource.h
  ndsoundserver3.h
  nlistener3.h
  noggfile.h
  nsound3.h
  nsoundresource.h
  nwavfile.h