- fixes to audio_oss_esd.cpp from Alexander R. Pruss (8-bit mode)

- added configuration summary to configure script
- prefs_editor_amiga.cpp: output of SCSI prefs was broken
This commit is contained in:
cebix 1999-10-25 19:01:43 +00:00
parent 04199a0f56
commit d42b29ae5d
7 changed files with 271 additions and 203 deletions

View File

@ -1,10 +1,19 @@
V0.8 -
- added replacement for BlockMove() trap
- removed Windows sources from the source archive; a version of
these that actually compiles and works can be downloaded from
Lauri Pesonen's site
- medium removal is allowed in CDROMExit()
- Unix: added support for ESD audio output; merged with OSS audio
and put in a new "audio_oss_esd.cpp" file which is also used under
FreeBSD 3.x
- Unix: added mkinstalldirs to "make install" target
- Unix: cleaned up the configure script
- Unix/audio_oss_esd.cpp: AudioStatus is re-set after determining
audio device capabilities (actual sample rate is also determined)
[Alexander R. Pruss]
- Unix/audio_oss_esd.cpp: "silence" in 8-bit mode used wrong fill
value (0 instead of 0x80) [Alexander R. Pruss]
V0.8 (snapshot) - 21.Oct.1999
- sony.cpp/disk.cpp/cdrom.cpp: disk insertions are now checked for

View File

@ -1071,7 +1071,7 @@ static void read_scsi_settings(void)
if (strlen(scsi_dev[i])) {
char str[256];
sprintf("%s/%ld", scsi_dev[i], scsi_unit[i]);
sprintf(str, "%s/%ld", scsi_dev[i], scsi_unit[i]);
PrefsReplaceString(prefs_name, str);
} else
PrefsRemoveItem(prefs_name);

View File

@ -49,7 +49,7 @@
#include "debug.h"
// Supported sample rates, sizes and channels
// Supported sample rates, sizes and channels (defaults)
int audio_num_sample_rates = 1;
uint32 audio_sample_rates[] = {44100 << 16};
int audio_num_sample_sizes = 1;
@ -67,6 +67,7 @@ static sem_t audio_irq_done_sem; // Signal from interrupt to streaming threa
static bool sem_inited = false; // Flag: audio_irq_done_sem initialized
static int sound_buffer_size; // Size of sound buffer in bytes
static bool little_endian = false; // Flag: DSP accepts only little-endian 16-bit sound data
static uint8 silence_byte; // Byte value to use to fill sound buffers with silence
static pthread_t stream_thread; // Audio streaming thread
static pthread_attr_t stream_thread_attr; // Streaming thread attributes
static bool stream_thread_active = false; // Flag: streaming thread installed
@ -80,6 +81,14 @@ static void *stream_func(void *arg);
* Initialization
*/
// Set AudioStatus to reflect current audio stream format
static void set_audio_status_format(void)
{
AudioStatus.sample_rate = audio_sample_rates[0];
AudioStatus.sample_size = audio_sample_sizes[0];
AudioStatus.channels = audio_channel_counts[0];
}
// Init using /dev/dsp, returns false on error
bool audio_init_dsp(void)
{
@ -94,22 +103,30 @@ bool audio_init_dsp(void)
audio_fd = -1;
return false;
}
if (format & (AFMT_S16_BE | AFMT_S16_LE))
if (format & (AFMT_S16_BE | AFMT_S16_LE)) {
audio_sample_sizes[0] = 16;
else
silence_byte = 0;
} else {
audio_sample_sizes[0] = 8;
silence_byte = 0x80;
}
if (!(format & AFMT_S16_BE))
little_endian = true;
// Set DSP parameters
format = AudioStatus.sample_size == 8 ? AFMT_U8 : (little_endian ? AFMT_S16_LE : AFMT_S16_BE);
format = audio_sample_sizes[0] == 8 ? AFMT_U8 : (little_endian ? AFMT_S16_LE : AFMT_S16_BE);
ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format);
int frag = 0x0004000c; // Block size: 4096 frames
ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag);
int stereo = (AudioStatus.channels == 2);
int stereo = (audio_channel_counts[0] == 2);
ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo);
int rate = AudioStatus.sample_rate >> 16;
int rate = audio_sample_rates[0] >> 16;
ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate);
audio_sample_rates[0] = rate << 16;
// Set AudioStatus again because we now know more about the sound
// system's capabilities
set_audio_status_format();
// Get sound buffer size
ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &audio_frames_per_block);
@ -140,6 +157,7 @@ bool audio_init_esd(void)
#else
little_endian = true;
#endif
silence_byte = 0; // Is this correct for 8-bit mode?
// Open connection to ESD server
audio_fd = esd_play_stream(format, AudioStatus.sample_rate >> 16, NULL, NULL);
@ -165,9 +183,7 @@ void AudioInit(void)
char str[256];
// Init audio status (defaults) and feature flags
AudioStatus.sample_rate = audio_sample_rates[0];
AudioStatus.sample_size = audio_sample_sizes[0];
AudioStatus.channels = audio_channel_counts[0];
set_audio_status_format();
AudioStatus.mixer = 0;
AudioStatus.num_sources = 0;
audio_component_flags = cmpWantsRegisterMessage | kStereoOut | k16BitOut;
@ -277,7 +293,7 @@ static void *stream_func(void *arg)
{
int16 *silent_buffer = new int16[sound_buffer_size / 2];
int16 *last_buffer = new int16[sound_buffer_size / 2];
memset(silent_buffer, 0, sound_buffer_size);
memset(silent_buffer, silence_byte, sound_buffer_size);
while (!stream_thread_cancel) {
if (AudioStatus.num_sources) {
@ -311,7 +327,7 @@ static void *stream_func(void *arg)
last_buffer[i] = ntohs(p[i]);
} else
memcpy(last_buffer, Mac2HostAddr(ReadMacInt32(apple_stream_info + scd_buffer)), work_size);
memset((uint8 *)last_buffer + work_size, 0, sound_buffer_size - work_size);
memset((uint8 *)last_buffer + work_size, silence_byte, sound_buffer_size - work_size);
write(audio_fd, last_buffer, sound_buffer_size);
}
D(bug("stream: data written\n"));

File diff suppressed because it is too large Load Diff

View File

@ -6,14 +6,10 @@ AC_PREREQ(2.12)
AC_CONFIG_HEADER(config.h)
dnl Options.
WANT_XF86_DGA=yes
WANT_FBDEV_DGA=yes
WANT_ESD=yes
WANT_UI=yes
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [])
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [])
AC_ARG_ENABLE(esd, [ --enable-esd Enlightened Sound Daemon support [default=yes]], [WANT_ESD=$enableval], [])
AC_ARG_ENABLE(ui, [ --enable-ui use GTK user interface [default=yes]], [WANT_UI=$enableval], [])
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
AC_ARG_ENABLE(esd, [ --enable-esd Enlightened Sound Daemon support [default=yes]], [WANT_ESD=$enableval], [WANT_ESD=yes])
AC_ARG_ENABLE(ui, [ --enable-ui use GTK user interface [default=yes]], [WANT_UI=$enableval], [WANT_UI=yes])
dnl Checks for programs.
AC_PROG_CC
@ -27,11 +23,13 @@ MONSRCS=
AC_MSG_CHECKING(for mon)
if grep mon_init ../../../mon/src/mon.h >/dev/null 2>/dev/null; then
AC_MSG_RESULT(yes)
WANT_MON=yes
DEFINES="$DEFINES -DENABLE_MON=1"
MONSRCS="../../../mon/src/mon.cpp ../../../mon/src/mon_6502.cpp ../../../mon/src/mon_68k.cpp ../../../mon/src/mon_8080.cpp ../../../mon/src/mon_cmd.cpp ../../../mon/src/mon_ppc.cpp ../../../mon/src/mon_x86.cpp"
CXXFLAGS="$CXXFLAGS -I../../../mon/src"
else
AC_MSG_RESULT(no)
WANT_MON=no
DEFINES="$DEFINES -DENABLE_MON=0"
fi
@ -237,11 +235,15 @@ if [[ "x$HAVE_GCC27" = "xyes" ]]; then
fi
dnl Select appropriate CPU source and REGPARAM define.
WANT_X86_ASSEMBLY=no
WANT_SPARC_V8_ASSEMBLY=no
WANT_SPARC_V9_ASSEMBLY=no
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
dnl i386 CPU
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
if [[ "x$HAVE_GAS" = "xyes" ]]; then
WANT_X86_ASSEMBLY=yes
DEFINES="$DEFINES -DX86_ASSEMBLY"
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
fi
@ -254,11 +256,13 @@ elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xy
AC_MSG_RESULT($SPARC_TYPE)
case "$SPARC_TYPE" in
SPARC_V8)
WANT_SPARC_V8_ASSEMBLY=yes
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY"
CFLAGS="$CFLAGS -Wa,-Av8"
CXXFLAGS="$CXXFLAGS -Wa,-Av8"
;;
SPARC_V9)
WANT_SPARC_V9_ASSEMBLY=yes
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY"
CFLAGS="$CFLAGS -Wa,-Av9"
CXXFLAGS="$CXXFLAGS -Wa,-Av9"
@ -278,4 +282,18 @@ AC_SUBST(SYSSRCS)
AC_SUBST(CPUINCLUDES)
AC_SUBST(CPUSRCS)
AC_OUTPUT(Makefile)
dnl Print summary.
echo
echo Basilisk II configuration summary:
echo
echo XFree86 DGA support .............. : $WANT_XF86_DGA
echo fbdev DGA support ................ : $WANT_FBDEV_DGA
echo ESD sound support ................ : $WANT_ESD
echo GTK user interface ............... : $WANT_UI
echo mon debugger support ............. : $WANT_MON
echo i386 assembly optimizations ...... : $WANT_X86_ASSEMBLY
echo SPARC V8 assembly optimizations .. : $WANT_SPARC_V8_ASSEMBLY
echo SPARC V9 assembly optimizations .. : $WANT_SPARC_V9_ASSEMBLY
echo
echo "Configuration done. Now type \"make\"."

View File

@ -34,7 +34,7 @@
#include "prefs.h"
#include "rom_patches.h"
#define DEBUG 1
#define DEBUG 0
#include "debug.h"

View File

@ -39,7 +39,7 @@
#include "prefs.h"
#include "sony.h"
#define DEBUG 1
#define DEBUG 0
#include "debug.h"
#ifdef AMIGA