engine: soundlib: minor codestyle and headers-related fixes
This commit is contained in:
parent
485d4324f8
commit
960a3a1483
4 changed files with 17 additions and 19 deletions
|
@ -17,14 +17,6 @@ GNU General Public License for more details.
|
|||
#include "soundlib.h"
|
||||
#include <string.h>
|
||||
|
||||
void OggFilestream_Init( ogg_filestream_t *filestream, const char *name, const byte *buffer, size_t filesize )
|
||||
{
|
||||
filestream->name = name;
|
||||
filestream->buffer = buffer;
|
||||
filestream->filesize = filesize;
|
||||
filestream->position = 0;
|
||||
}
|
||||
|
||||
size_t OggFilestream_Read( void *ptr, size_t blockSize, size_t nmemb, void *datasource )
|
||||
{
|
||||
ogg_filestream_t *filestream = (ogg_filestream_t*)datasource;
|
||||
|
|
|
@ -17,7 +17,6 @@ GNU General Public License for more details.
|
|||
#define OGG_FILESTREAM_H
|
||||
|
||||
#include "xash3d_types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct ogg_filestream_s
|
||||
{
|
||||
|
@ -27,9 +26,16 @@ typedef struct ogg_filestream_s
|
|||
size_t position;
|
||||
} ogg_filestream_t;
|
||||
|
||||
void OggFilestream_Init( ogg_filestream_t *filestream, const char *name, const byte *buffer, size_t filesize );
|
||||
size_t OggFilestream_Read( void *ptr, size_t blockSize, size_t nmemb, void *datasource );
|
||||
int OggFilestream_Seek( void *datasource, int64_t offset, int whence );
|
||||
long OggFilestream_Tell( void *datasource );
|
||||
|
||||
static inline void OggFilestream_Init( ogg_filestream_t *filestream, const char *name, const byte *buffer, size_t filesize )
|
||||
{
|
||||
filestream->name = name;
|
||||
filestream->buffer = buffer;
|
||||
filestream->filesize = filesize;
|
||||
filestream->position = 0;
|
||||
}
|
||||
|
||||
#endif // OGG_FILESTREAM_H
|
||||
|
|
|
@ -13,12 +13,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opusfile.h>
|
||||
#include <string.h>
|
||||
#include "soundlib.h"
|
||||
#include "crtlib.h"
|
||||
#include "ogg_filestream.h"
|
||||
#include <opusfile.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct opus_streaming_ctx_s
|
||||
{
|
||||
|
|
|
@ -13,14 +13,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <vorbis/codec.h>
|
||||
#include <vorbis/vorbisfile.h>
|
||||
#include "soundlib.h"
|
||||
#include "crtlib.h"
|
||||
#include "xash3d_mathlib.h"
|
||||
#include "ogg_filestream.h"
|
||||
#include <vorbis/codec.h>
|
||||
#include <vorbis/vorbisfile.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct vorbis_streaming_ctx_s
|
||||
{
|
||||
|
@ -89,6 +88,7 @@ qboolean Sound_LoadOggVorbis( const char *name, const byte *buffer, fs_offset_t
|
|||
long ret;
|
||||
int section;
|
||||
size_t written = 0;
|
||||
vorbis_info *info;
|
||||
ogg_filestream_t file;
|
||||
OggVorbis_File vorbisFile;
|
||||
|
||||
|
@ -101,7 +101,7 @@ qboolean Sound_LoadOggVorbis( const char *name, const byte *buffer, fs_offset_t
|
|||
return false;
|
||||
}
|
||||
|
||||
vorbis_info *info = ov_info( &vorbisFile, -1 );
|
||||
info = ov_info( &vorbisFile, -1 );
|
||||
if( info->channels < 1 || info->channels > 2 ) {
|
||||
Con_DPrintf( S_ERROR "%s: failed to load (%s): unsuppored channels count\n", __func__, file.name );
|
||||
return false;
|
||||
|
@ -134,6 +134,7 @@ qboolean Sound_LoadOggVorbis( const char *name, const byte *buffer, fs_offset_t
|
|||
stream_t *Stream_OpenOggVorbis( const char *filename )
|
||||
{
|
||||
stream_t *stream;
|
||||
vorbis_info *info;
|
||||
vorbis_streaming_ctx_t *ctx;
|
||||
|
||||
ctx = (vorbis_streaming_ctx_t*)Mem_Calloc( host.soundpool, sizeof( vorbis_streaming_ctx_t ));
|
||||
|
@ -156,7 +157,7 @@ stream_t *Stream_OpenOggVorbis( const char *filename )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
vorbis_info *info = ov_info( &ctx->vf, -1 );
|
||||
info = ov_info( &ctx->vf, -1 );
|
||||
if( info->channels < 1 || info->channels > 2 ) {
|
||||
Con_DPrintf( S_ERROR "%s: failed to load (%s): unsuppored channels count\n", __func__, filename );
|
||||
FS_Close( ctx->file );
|
||||
|
|
Loading…
Add table
Reference in a new issue