atari: Align audio buffer size on 4 bytes SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Sun, 13 Jan 2019 15:13:13 +0100
branchSDL-1.2
changeset 125366472da23f3ef
parent 12535 edb58d951656
child 12537 8586f153eede
atari: Align audio buffer size on 4 bytes
src/audio/mint/SDL_mintaudio.c
     1.1 --- a/src/audio/mint/SDL_mintaudio.c	Sat Jan 12 23:07:14 2019 +0100
     1.2 +++ b/src/audio/mint/SDL_mintaudio.c	Sun Jan 13 15:13:13 2019 +0100
     1.3 @@ -75,6 +75,7 @@
     1.4  
     1.5  int SDL_MintAudio_InitBuffers(SDL_AudioSpec *spec)
     1.6  {
     1.7 +	int dmabuflen;
     1.8  	SDL_AudioDevice *this = SDL_MintAudio_device;
     1.9  
    1.10  	SDL_CalculateAudioSpec(spec);
    1.11 @@ -87,13 +88,14 @@
    1.12  	}
    1.13  
    1.14  	/* Allocate audio buffers memory for hardware in DMA-able RAM */
    1.15 -	MINTAUDIO_audiobuf[0] = Atari_SysMalloc(2 * MINTAUDIO_audiosize, MX_STRAM);
    1.16 +	dmabuflen = ((2 * MINTAUDIO_audiosize) | 3)+1;
    1.17 +	MINTAUDIO_audiobuf[0] = Atari_SysMalloc(dmabuflen, MX_STRAM);
    1.18  	if (MINTAUDIO_audiobuf[0]==NULL) {
    1.19  		SDL_SetError("SDL_MintAudio_OpenAudio: Not enough memory for audio buffer");
    1.20  		return (0);
    1.21  	}
    1.22  	MINTAUDIO_audiobuf[1] = MINTAUDIO_audiobuf[0] + MINTAUDIO_audiosize;
    1.23 -	SDL_memset(MINTAUDIO_audiobuf[0], spec->silence, 2 * MINTAUDIO_audiosize);
    1.24 +	SDL_memset(MINTAUDIO_audiobuf[0], spec->silence, dmabuflen);
    1.25  
    1.26  	DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%p\n", MINTAUDIO_audiobuf[0]));
    1.27  	DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%p\n", MINTAUDIO_audiobuf[1]));