git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1756 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-05-14 21:12:01 +00:00
parent 680d4af79c
commit 5329d59080
+19 -8
View File
@@ -50,19 +50,24 @@ typedef struct {
void fill_audio(void *u, Uint8 *stream, int len);
unsigned long clocks_per_sec = 1000;
unsigned long get_clock()
unsigned long
get_clock()
{
return (SDL_GetTicks());
}
void init_sound ()
void
init_sound ()
{
if(SDL_Init(SDL_INIT_AUDIO) < 0) {
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
fprintf(stderr,"could not initialize SDL audio\n");
exit(-1);
}
}
WAVESTRUCT *play_sound(AUDIOHDR *audiohdr)
WAVESTRUCT *
play_sound(AUDIOHDR *audiohdr)
{
WAVESTRUCT *WaveData = new WAVESTRUCT;
/*
@@ -89,19 +94,22 @@ WAVESTRUCT *play_sound(AUDIOHDR *audiohdr)
return (WaveData);
}
void pause_sound(WAVESTRUCT *WaveData)
void
pause_sound(WAVESTRUCT *WaveData)
{
if (WaveData)
SDL_PauseAudio(1);
}
void unpause_sound (WAVESTRUCT *WaveData)
void
unpause_sound (WAVESTRUCT *WaveData)
{
if (WaveData)
SDL_PauseAudio(0);
}
void reset_sound (WAVESTRUCT *WaveData)
void
reset_sound (WAVESTRUCT *WaveData)
{
if (WaveData) {
SDL_CloseAudio();
@@ -109,6 +117,7 @@ void reset_sound (WAVESTRUCT *WaveData)
delete WaveData;
}
}
/*
void fill_audio (void *u, Uint8 *stream, int len)
{
@@ -129,7 +138,8 @@ void fill_audio (void *u, Uint8 *stream, int len)
}
*/
void fill_audio (void *u, Uint8 *stream, int len)
void
fill_audio (void *u, Uint8 *stream, int len)
{
Sint16 *b;
int l, i;
@@ -144,3 +154,4 @@ void fill_audio (void *u, Uint8 *stream, int len)
}
#endif