first commit

This commit is contained in:
2026-06-22 11:49:35 +02:00
commit d805f2ba86
619 changed files with 126873 additions and 0 deletions

View File

@ -0,0 +1,63 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __AUDIOOGGSTREAM__
#define __AUDIOOGGSTREAM__
#include "filesystem/io_handle.h"
#define STB_VORBIS_HEADER_ONLY
#include "stb_vorbis.c"
#undef STB_VORBIS_HEADER_ONLY
#include "audio/stream_interface.h"
#include "memory/ring_buffer.h"
#include "memory/nauto_ptr.h"
namespace GS {
/*
@short OGG audio stream.
@author Emmanuel Julien (ejulien@nworks.fr)
*/
class AudioStreamOGG : public IAudioStream
{
protected:
AutoPtr <IO::Handle> h;
Array <char> buffer;
size_t byte_left;
size_t RefillBuffer();
void ConsumeBuffer(size_t);
int seek_correction, consumed, err;
stb_vorbis_info vorbis_info;
stb_vorbis *vf;
public:
/// Return the stream data format (eg. "OGG").
const char *GetFormat() { return "OGG"; }
bool Seek(int t_ms = 0);
bool IsEOF() const;
size_t GetPCM(void *);
size_t GetPCMBufferSize() const;
bool Open(const char *uri);
void Close();
AudioStreamOGG();
~AudioStreamOGG();
};
} // GS
#endif // __AUDIOOGGSTREAM__

View File

@ -0,0 +1,31 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __OGGSTREAMFACTORY__
#define __OGGSTREAMFACTORY__
#include "audio/stream_factory.h"
namespace GS {
/*
@short OGG stream factory.
@author Emmanuel Julien (ejulien@owloh.com)
*/
struct OGGStreamFactory : public IAudioStreamFactory
{
/// Get factory name.
virtual const char *GetName() { return "OGG"; }
/// Open a stream.
virtual IAudioStream *Open(const char *path);
};
} // GS
#endif // __OGGSTREAMFACTORY__