Mercurial > SDL_sound_CoreAudio
comparison playsound/playsound.c @ 82:7505dcf8d3b7
Fixes some Visual C++ 6.0 compiler complaints.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 25 Sep 2001 21:02:20 +0000 |
parents | 4a51162099e0 |
children | 3fcb23da06ba |
comparison
equal
deleted
inserted
replaced
81:c047ae35d5fa | 82:7505dcf8d3b7 |
---|---|
88 static volatile int done_flag = 0; | 88 static volatile int done_flag = 0; |
89 | 89 |
90 static void audio_callback(void *userdata, Uint8 *stream, int len) | 90 static void audio_callback(void *userdata, Uint8 *stream, int len) |
91 { | 91 { |
92 static Uint8 overflow[16384]; /* this is a hack. */ | 92 static Uint8 overflow[16384]; /* this is a hack. */ |
93 static Uint32 overflowBytes = 0; | 93 static int overflowBytes = 0; |
94 Sound_Sample *sample = *((Sound_Sample **) userdata); | 94 Sound_Sample *sample = *((Sound_Sample **) userdata); |
95 Uint32 bw = 0; /* bytes written to stream*/ | 95 int bw = 0; /* bytes written to stream*/ |
96 Uint32 rc; /* return code */ | 96 Uint32 rc; /* return code */ |
97 | 97 |
98 if (overflowBytes > 0) | 98 if (overflowBytes > 0) |
99 { | 99 { |
100 bw = (overflowBytes < len) ? overflowBytes : len; | 100 bw = (overflowBytes < len) ? overflowBytes : len; |
105 while ((bw < len) && (!done_flag)) | 105 while ((bw < len) && (!done_flag)) |
106 { | 106 { |
107 rc = Sound_Decode(sample); | 107 rc = Sound_Decode(sample); |
108 if (rc > 0) | 108 if (rc > 0) |
109 { | 109 { |
110 if (bw + rc > len) | 110 if ((bw + (int) rc) > len) |
111 { | 111 { |
112 overflowBytes = (bw + rc) - len; | 112 overflowBytes = (bw + rc) - len; |
113 memcpy(overflow, | 113 memcpy(overflow, |
114 ((Uint8 *) sample->buffer) + (rc - overflowBytes), | 114 ((Uint8 *) sample->buffer) + (rc - overflowBytes), |
115 overflowBytes); | 115 overflowBytes); |
138 } /* audio_callback */ | 138 } /* audio_callback */ |
139 | 139 |
140 | 140 |
141 static void output_usage(const char *argv0) | 141 static void output_usage(const char *argv0) |
142 { | 142 { |
143 fprintf(stderr, "USAGE: %s <soundFile1> [soundFile2] ... [soundFileN]\n", | 143 fprintf(stderr, |
144 "USAGE: %s [--decoders] [soundFile1] ... [soundFileN]\n", | |
144 argv0); | 145 argv0); |
145 } /* output_usage */ | 146 } /* output_usage */ |
146 | 147 |
147 | 148 |
148 int main(int argc, char **argv) | 149 int main(int argc, char **argv) |