src/audio/mint/SDL_mintaudio.c
changeset 1336 3692456e7b0f
parent 1116 080ed9ef0609
child 1350 adc8ff3c9597
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
    61 {
    61 {
    62 	Uint8 *buffer;
    62 	Uint8 *buffer;
    63 	SDL_AudioDevice *audio = SDL_MintAudio_device;
    63 	SDL_AudioDevice *audio = SDL_MintAudio_device;
    64 
    64 
    65  	buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
    65  	buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
    66 	memset(buffer, audio->spec.silence, audio->spec.size);
    66 	SDL_memset(buffer, audio->spec.silence, audio->spec.size);
    67 
    67 
    68 	if (audio->paused)
    68 	if (audio->paused)
    69 		return;
    69 		return;
    70 
    70 
    71 	if (audio->convert.needed) {
    71 	if (audio->convert.needed) {
    74 		if ( audio->convert.src_format == AUDIO_U8 ) {
    74 		if ( audio->convert.src_format == AUDIO_U8 ) {
    75 			silence = 0x80;
    75 			silence = 0x80;
    76 		} else {
    76 		} else {
    77 			silence = 0;
    77 			silence = 0;
    78 		}
    78 		}
    79 		memset(audio->convert.buf, silence, audio->convert.len);
    79 		SDL_memset(audio->convert.buf, silence, audio->convert.len);
    80 		audio->spec.callback(audio->spec.userdata,
    80 		audio->spec.callback(audio->spec.userdata,
    81 			(Uint8 *)audio->convert.buf,audio->convert.len);
    81 			(Uint8 *)audio->convert.buf,audio->convert.len);
    82 		SDL_ConvertAudio(&audio->convert);
    82 		SDL_ConvertAudio(&audio->convert);
    83 		memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
    83 		SDL_memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
    84 	} else {
    84 	} else {
    85 		audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size);
    85 		audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size);
    86 	}
    86 	}
    87 }
    87 }
    88 
    88 
   104 	}
   104 	}
   105 
   105 
   106 	/* Put all following ones farer */
   106 	/* Put all following ones farer */
   107 	if (MINTAUDIO_freqcount>0) {
   107 	if (MINTAUDIO_freqcount>0) {
   108 		for (i=MINTAUDIO_freqcount; i>p; i--) {
   108 		for (i=MINTAUDIO_freqcount; i>p; i--) {
   109 			memcpy(&MINTAUDIO_frequencies[i], &MINTAUDIO_frequencies[i-1], sizeof(mint_frequency_t));
   109 			SDL_memcpy(&MINTAUDIO_frequencies[i], &MINTAUDIO_frequencies[i-1], sizeof(mint_frequency_t));
   110 		}
   110 		}
   111 	}
   111 	}
   112 
   112 
   113 	/* And insert new one */
   113 	/* And insert new one */
   114 	MINTAUDIO_frequencies[p].frequency = frequency;
   114 	MINTAUDIO_frequencies[p].frequency = frequency;