Skip to content

Commit

Permalink
Patches to make SDL_sound more Visual C happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jan 31, 2003
1 parent 6ac20f4 commit e13264f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
3 changes: 2 additions & 1 deletion SDL_sound.c
Expand Up @@ -38,6 +38,7 @@
#include <ctype.h>

#include "SDL.h"
#include "SDL_thread.h"
#include "SDL_sound.h"

#define __SDL_SOUND_INTERNAL__
Expand Down Expand Up @@ -389,7 +390,7 @@ void __Sound_SetError(const char *str)
Uint32 __Sound_convertMsToBytePos(Sound_AudioInfo *info, Uint32 ms)
{
/* "frames" == "sample frames" */
float frames_per_ms = ((float) info->rate) / 1000.0;
float frames_per_ms = ((float) info->rate) / 1000.0f;
Uint32 frame_offset = (Uint32) (frames_per_ms * ((float) ms));
Uint32 frame_size = (Uint32) ((info->format & 0xFF) / 8) * info->channels;
return(frame_offset * frame_size);
Expand Down
9 changes: 9 additions & 0 deletions SDL_sound_internal.h
Expand Up @@ -236,6 +236,15 @@ typedef struct Sound_AudioCVT
} Sound_AudioCVT;
#endif

extern SNDDECLSPEC int Sound_BuildAudioCVT(Sound_AudioCVT *cvt,
Uint16 src_format, Uint8 src_channels, Uint32 src_rate,
Uint16 dst_format, Uint8 dst_channels, Uint32 dst_rate,
Uint32 dst_size);

extern SNDDECLSPEC int Sound_ConvertAudio(Sound_AudioCVT *cvt);



typedef struct __SOUND_SAMPLEINTERNAL__
{
Sound_Sample *next;
Expand Down
4 changes: 2 additions & 2 deletions alt_audio_convert.c
Expand Up @@ -1011,8 +1011,8 @@ static void show_AudioCVT( Sound_AudioCVT *Data )


int Sound_BuildAudioCVT(Sound_AudioCVT *Data,
Uint16 src_format, Uint8 src_channels, int src_rate,
Uint16 dst_format, Uint8 dst_channels, int dst_rate, Uint32 bufsize)
Uint16 src_format, Uint8 src_channels, Uint32 src_rate,
Uint16 dst_format, Uint8 dst_channels, Uint32 dst_rate, Uint32 bufsize)
{
SDL_AudioSpec src, dst;
int ret;
Expand Down
6 changes: 0 additions & 6 deletions alt_audio_convert.h
Expand Up @@ -76,15 +76,9 @@ typedef struct{
#define SNDDECLSPEC DECLSPEC
#endif

extern SNDDECLSPEC int Sound_ConvertAudio( Sound_AudioCVT *Data );

extern SNDDECLSPEC int Sound_AltConvertAudio( Sound_AudioCVT *Data,
Uint8* buffer, int length, int mode );

extern SNDDECLSPEC int Sound_BuildAudioCVT( Sound_AudioCVT *Data,
Uint16 src_format, Uint8 src_channels, int src_rate,
Uint16 dst_format, Uint8 dst_channels, int dst_rate, Uint32 bufsize );

extern SNDDECLSPEC int Sound_AltBuildAudioCVT( Sound_AudioCVT *Data,
SDL_AudioSpec src, SDL_AudioSpec dst );

Expand Down
1 change: 1 addition & 0 deletions decoders/mpglib/layer3.c
Expand Up @@ -5,6 +5,7 @@
* All rights reserved. See also 'README'
*/

#include <stdio.h>
#include <stdlib.h>

#include "SDL_sound.h"
Expand Down
9 changes: 9 additions & 0 deletions decoders/mpglib/mpglib_sdlsound.h
@@ -1,4 +1,11 @@

#ifndef _INCLUDE_MPGLIB_SDLSOUND_H_
#define _INCLUDE_MPGLIB_SDLSOUND_H_

#ifdef _MSC_VER
#define snprintf _snprintf
#endif

struct buf {
unsigned char *pnt;
long size;
Expand Down Expand Up @@ -51,4 +58,6 @@ void ExitMP3(struct mpstr *mp);
}
#endif

#endif


0 comments on commit e13264f

Please sign in to comment.