Minor changes in the sound lowlevel code.

This commit is contained in:
Volker Ruppert 2014-11-21 23:03:19 +00:00
parent 1924780b06
commit 9805324c42
4 changed files with 9 additions and 9 deletions

View File

@ -327,7 +327,7 @@ int bx_sound_alsa_c::sendwavepacket(int length, Bit8u data[])
BX_ERROR(("sendwavepacket(): pcm is not open")); BX_ERROR(("sendwavepacket(): pcm is not open"));
return BX_SOUNDLOW_ERR; return BX_SOUNDLOW_ERR;
} }
if ((alsa_pcm[0].audio_bufsize+length) <= BX_SOUND_LINUX_BUFSIZE) { if ((alsa_pcm[0].audio_bufsize+length) <= BX_SOUND_ALSA_BUFSIZE) {
memcpy(audio_buffer[0]+alsa_pcm[0].audio_bufsize, data, length); memcpy(audio_buffer[0]+alsa_pcm[0].audio_bufsize, data, length);
alsa_pcm[0].audio_bufsize += length; alsa_pcm[0].audio_bufsize += length;
} else { } else {

View File

@ -2,7 +2,7 @@
// $Id$ // $Id$
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2013 The Bochs Project // Copyright (C) 2013-2014 The Bochs Project
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -23,7 +23,7 @@
#if BX_HAVE_ALSASOUND #if BX_HAVE_ALSASOUND
#define BX_SOUND_LINUX_BUFSIZE BX_SOUNDLOW_WAVEPACKETSIZE * 2 #define BX_SOUND_ALSA_BUFSIZE BX_SOUNDLOW_WAVEPACKETSIZE * 2
#define ALSA_PCM_NEW_HW_PARAMS_API #define ALSA_PCM_NEW_HW_PARAMS_API
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
@ -76,7 +76,7 @@ private:
int oldfreq, oldbits, oldformat; int oldfreq, oldbits, oldformat;
bx_bool oldstereo; bx_bool oldstereo;
} wave_ch[2]; } wave_ch[2];
Bit8u audio_buffer[2][BX_SOUND_LINUX_BUFSIZE]; Bit8u audio_buffer[2][BX_SOUND_ALSA_BUFSIZE];
}; };
#endif #endif

View File

@ -2,7 +2,7 @@
// $Id$ // $Id$
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001-2013 The Bochs Project // Copyright (C) 2001-2014 The Bochs Project
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -25,8 +25,6 @@
#if (defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) #if (defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
#define BX_SOUND_LINUX_BUFSIZE BX_SOUNDLOW_WAVEPACKETSIZE * 2
class bx_sound_linux_c : public bx_sound_lowlevel_c { class bx_sound_linux_c : public bx_sound_lowlevel_c {
public: public:
bx_sound_linux_c(); bx_sound_linux_c();
@ -63,7 +61,6 @@ private:
int oldfreq, oldbits, oldformat; int oldfreq, oldbits, oldformat;
bx_bool oldstereo; bx_bool oldstereo;
} wave_ch[2]; } wave_ch[2];
Bit8u audio_buffer[2][BX_SOUND_LINUX_BUFSIZE];
}; };
#endif #endif

View File

@ -2,7 +2,7 @@
// $Id$ // $Id$
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2012-2013 The Bochs Project // Copyright (C) 2012-2014 The Bochs Project
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -162,6 +162,9 @@ int bx_sound_sdl_c::sendwavepacket(int length, Bit8u data[])
int bx_sound_sdl_c::stopwaveplayback() int bx_sound_sdl_c::stopwaveplayback()
{ {
while (audio_buffer.optr != audio_buffer.iptr) {
SDL_Delay(1);
}
SDL_CloseAudio(); SDL_CloseAudio();
return BX_SOUNDLOW_OK; return BX_SOUNDLOW_OK;
} }