Revision: 45644
http://sourceforge.net/p/vice-emu/code/45644
Author: compyx
Date: 2025-04-27 17:41:07 +0000 (Sun, 27 Apr 2025)
Log Message:
-----------
Merge trunk (r45639:HEAD) into branch
Modified Paths:
--------------
branches/compyx/joymap-002/vice/doc/vice.texi
branches/compyx/joymap-002/vice/src/arch/sdl/joy.c
branches/compyx/joymap-002/vice/src/arch/shared/sounddrv/sounddump.c
branches/compyx/joymap-002/vice/src/sound.c
branches/compyx/joymap-002/vice/src/sound.h
Modified: branches/compyx/joymap-002/vice/doc/vice.texi
===================================================================
--- branches/compyx/joymap-002/vice/doc/vice.texi 2025-04-26 17:30:51 UTC (rev 45643)
+++ branches/compyx/joymap-002/vice/doc/vice.texi 2025-04-27 17:41:07 UTC (rev 45644)
@@ -6237,16 +6237,8 @@
@itemize @bullet
@item
-@code{ahi}, for the Amiga/Morphos/Aros sound driver.
-@item
-@code{aix}, for the IBM AIX sound driver.
-@item
-@code{allegro}, for the DOS Allegro sound driver.
-@item
@code{alsa}, for the linux ALSA sound driver.
@item
-@code{arts}, for the *nix ARTS sound driver.
-@item
@code{beos}, for the BeOS/Zeta/Haiku sound driver.
@item
@code{bsp}, for the BeOS/Zeta/Haiku BeOS Media Kit sound driver.
@@ -6254,36 +6246,26 @@
@code{coreaudio}, for the Mac OS X sound driver (@code{SoundDeviceArg}
specifies the audio device, default system output by default).
@item
-@code{dart}, for the OS/2 sound driver.
-@item
@code{dummy}, fully emulating the sound output chip(s), but not actually playing samples.
@item
+@code{dump}, writing all the write accesses to the registers to a file
+(specified by @code{SoundDeviceArg}, default value is
+@code{vicesnd.sid});
+@item
@code{dx}, for the Windows Direct-X sound driver.
@item
-@code{hpux}, for the HP-UX audio device (unfinished;
+@code{netbsd}, for the NetBDS audio device (unfinished;
@code{SoundDeviceArg} specifies the audio device, @file{/dev/audio} by
default).
@item
-@code{midas}, for the DOS Midas sound driver.
-@item
@code{pulse}, for the Pulseaudio sound driver.
@item
@code{sdl}, for the Simple DirectMedia Layer audio driver.
@item
-@code{sgi}, for the Silicon Graphics audio device (@code{SoundDeviceArg}
-specifies the audio device, @file{/dev/audio} by default);
-@item
-@code{speed}, like @code{dummy} but also calculating samples (mainly
-used to evaluate the speed of the sample generator);
-@item
-@code{sun}, for the Solaris and NetBDS audio device (unfinished;
+@code{sun}, for the Solaris audio device (unfinished;
@code{SoundDeviceArg} specifies the audio device, @file{/dev/audio} by
default).
@item
-@code{uss}, for the Linux/FreeBSD Universal Sound System driver
-(@code{SoundDeviceArg} specifies the audio device, @file{/dev/dsp} by
-default);
-@item
@code{wmm}, for the Windows Multimedia Waveout sound device.
@end itemize
@@ -6305,12 +6287,9 @@
@item
@code{aiff}, for the Apple Interchange File Format 16bit sound recorder driver.
@item
-@code{dump}, writing all the write accesses to the registers to a file
-(specified by @code{SoundDeviceArg}, default value is
-@code{vicesnd.sid});
-@item
@code{fs}, writing samples to a file (specified by
@code{SoundDeviceArg}; default is @file{vicesnd.raw});
+@item
@code{iff}, for the Amiga Interchange File Format (8SVX) 8bit sound recorder driver.
@item
@code{mp3}, for the MP3 sound recorder driver.
@@ -6411,7 +6390,7 @@
@item -sounddev <Name>
Specifies the name of the audio device
(@code{SoundDeviceName}).
-(ahi, aix, allegro, alsa, arts, beos, bsp, coreaudio, dart, dummy, dx, hpux, midas, pulse, sdl, sgi, sun, uss, wmm)
+(alsa, beos, bsp, coreaudio, dummy, dump, dx, netbsd, pulse, sdl, sun, wmm)
@findex -soundarg
@item -soundarg <args>
@@ -6422,7 +6401,7 @@
@item -soundrecdev <name>
Specify recording sound driver
(@code{SoundRecordDeviceName}).
-(aiff, dump, fs, iff, mp3, flac, ogg, speed, voc, wav)
+(aiff, fs, iff, mp3, flac, ogg, voc, wav)
@findex -soundrecarg
@item -soundrecarg <args>
Modified: branches/compyx/joymap-002/vice/src/arch/sdl/joy.c
===================================================================
--- branches/compyx/joymap-002/vice/src/arch/sdl/joy.c 2025-04-26 17:30:51 UTC (rev 45643)
+++ branches/compyx/joymap-002/vice/src/arch/sdl/joy.c 2025-04-27 17:41:07 UTC (rev 45644)
@@ -164,8 +164,16 @@
/* ------------------------------------------------------------------------- */
+/*
+ * Driver methods
+ */
+
static bool sdl_joystick_open(joystick_device_t *joydev)
{
+ /* NOP: SDL has its own mechanism for opening/closing devices and appears
+ * to just keep all host devices it found open. We return `true` here to
+ * avoid resource setters triggering an error.
+ */
return true;
}
@@ -176,18 +184,17 @@
static void sdl_joystick_close(joystick_device_t *joystick)
{
-#if 0
- SDL_JoystickClose(joystick);
- lib_free(joy_ordinal_to_id);
- joy_ordinal_to_id = NULL;
-#endif
+ /* NOP: The actual call to SDL_JoystickClose() happens on emulator shutdown,
+ * not when closing via VICE's driver */
}
+/** \brief SDL-specific host device data
+ */
typedef struct joy_priv_s {
- SDL_Joystick *sdldev;
- VICE_SDL_JoystickID id;
- int joynum;
+ SDL_Joystick *sdldev; /**< SDL device reference */
+ VICE_SDL_JoystickID id; /**< joystick ID used by VICE */
+ int joynum; /**< joystick index according to SDL */
} joy_priv_t;
Modified: branches/compyx/joymap-002/vice/src/arch/shared/sounddrv/sounddump.c
===================================================================
--- branches/compyx/joymap-002/vice/src/arch/shared/sounddrv/sounddump.c 2025-04-26 17:30:51 UTC (rev 45643)
+++ branches/compyx/joymap-002/vice/src/arch/shared/sounddrv/sounddump.c 2025-04-27 17:41:07 UTC (rev 45644)
@@ -30,7 +30,16 @@
#include "sound.h"
#include "types.h"
+#include "log.h"
+/* #define DEBUG_DUMP */
+
+#ifdef DEBUG_DUMP
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
static FILE *dump_fd = NULL;
static int dump_init(const char *param, int *speed, int *fragsize, int *fragnr, int *channels)
@@ -39,21 +48,29 @@
*channels = 1;
dump_fd = fopen(param ? param : "vicesnd.sid", "w");
- return !dump_fd;
+ DBG(("dump_init param:%p fd:%p", param, dump_fd));
+ return (dump_fd == NULL) ? -1 : 0;
}
static int dump_write(int16_t *pbuf, size_t nr)
{
+ /*DBG(("dump_write"));*/
return 0;
}
static int dump_dump(uint16_t addr, uint8_t byte, CLOCK clks)
{
+ DBG(("dump_dump %d %d %d", (int)clks, addr, byte));
return (fprintf(dump_fd, "%d %d %d\n", (int)clks, addr, byte) < 0);
}
+#if 0
+/* FIXME: it is unclear why this function does this. no other sound output
+ driver implements "flush" for that matter
+*/
static int dump_flush(char *state)
{
+ DBG(("dump_flush state:'%s'"));
if (fprintf(dump_fd, "%s", state) < 0) {
return 1;
}
@@ -60,9 +77,11 @@
return fflush(dump_fd);
}
+#endif
static void dump_close(void)
{
+ DBG(("dump_close"));
fclose(dump_fd);
dump_fd = NULL;
}
@@ -73,7 +92,7 @@
dump_init,
dump_write,
dump_dump,
- dump_flush,
+ NULL, /* dump_flush, */
NULL,
dump_close,
NULL,
@@ -85,5 +104,6 @@
int sound_init_dump_device(void)
{
+ DBG(("sound_init_dump_device"));
return sound_register_device(&dump_device);
}
Modified: branches/compyx/joymap-002/vice/src/sound.c
===================================================================
--- branches/compyx/joymap-002/vice/src/sound.c 2025-04-26 17:30:51 UTC (rev 45643)
+++ branches/compyx/joymap-002/vice/src/sound.c 2025-04-27 17:41:07 UTC (rev 45644)
@@ -59,7 +59,15 @@
#include "math.h"
#include "ui.h"
+/* #define DEBUG_SOUND */
+#ifdef DEBUG_SOUND
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
+
log_t sound_log = LOG_DEFAULT;
static void sounddev_close(const sound_device_t **dev);
@@ -123,8 +131,12 @@
works, no files will be created accidently */
{ "dummy", "Dummy sound output (no sound)", sound_init_dummy_device, SOUND_PLAYBACK_DEVICE },
+ /* FIXME: the dump device (and part of the sound system) needs to be
+ rewritten somehow, so it can be used while actually playing sound, ie as
+ a record device */
+ { "dump", "Sound chip write recording", sound_init_dump_device, SOUND_PLAYBACK_DEVICE },
+
{ "fs", "Raw sound recording", sound_init_fs_device, SOUND_RECORD_DEVICE },
- { "dump", "Sound chip state recording", sound_init_dump_device, SOUND_RECORD_DEVICE },
{ "wav", "RIFF/WAV sound recording", sound_init_wav_device, SOUND_RECORD_DEVICE },
{ "voc", "Creative Voice VOC sound recording", sound_init_voc_device, SOUND_RECORD_DEVICE },
{ "iff", "AmigaOS IFF/8SVX sound recording", sound_init_iff_device, SOUND_RECORD_DEVICE },
@@ -141,7 +153,7 @@
#ifdef USE_VORBIS
{ "ogg", "OGG sound recording", sound_init_vorbis_device, SOUND_RECORD_DEVICE },
#endif
-
+ /* the driver used for recording sound when actually recording video+sound */
{ "soundmovie", "Movie sound recording", sound_init_movie_device, SOUND_MOVIE_RECORD_DEVICE },
{ NULL, NULL, NULL, 0 }
};
@@ -459,6 +471,7 @@
#endif
}
+/* perform the actual write to the sound chip */
static void sound_machine_store(sound_t *psid, uint16_t addr, uint8_t val)
{
if (sound_calls[addr >> 5]->store) {
@@ -618,6 +631,7 @@
} else {
util_string_set(&device_name, val);
}
+ DBG(("set_device_name device_name:'%s'", device_name));
sound_state_changed = TRUE;
return 0;
}
@@ -723,6 +737,7 @@
int sound_resources_init(void)
{
+ DBG(("sound_resources_init"));
/* Set the first device in the list as default factory value. We do this
here so the default value will not end up in the config file. */
if (archdep_is_haiku() == 0) {
@@ -734,6 +749,7 @@
if (resources_register_string(resources_string) < 0) {
return -1;
}
+ DBG(("sound_resources_init resources_string[0].factory_value:'%s'", resources_string[0].factory_value));
return resources_register_int(resources_int);
}
@@ -864,7 +880,7 @@
for (i = 0; sound_register_devices[i].name; ++i) {
if (sound_register_devices[i].device_type == type) {
- ++valid;
+ ++valid;
}
}
@@ -1458,7 +1474,6 @@
bool sound_flush(void)
{
int c, i, nr, space;
- char *state;
/*
* It's possible when changing settings via UI to end up
@@ -1516,8 +1531,24 @@
}
sound_resume();
+#if 0
+ /* FIXME: This code does not make sense - whatever it is trying to do does
+ not work at all:
+ - ONLY the "dump" device even has a "flush" method registered
+ - this is called every frame, which makes the "dump" device flood the log
+ with useless data
+ - even if other drivers had a "flush" method, calling this complex string
+ constructing function every frame seems like a really bad idea.
+ */
if (snddata.playdev->flush) {
+ char *state;
+ /* dumps the state of the sound emulator - this seems to be ReSID always -
+ into a string(!). This function usually is used for the monitor
+ io command */
state = sound_machine_dump_state(snddata.psid[0]);
+ /* calls the "flush" method of the sound output driver with said string
+ as argument. the "dump" device would now output this string to the
+ sound log (vicesound.sid) */
i = snddata.playdev->flush(state);
lib_free(state);
if (i) {
@@ -1525,6 +1556,7 @@
goto done;
}
}
+#endif
/* Calculate the number of samples to flush - whole fragments. */
nr = snddata.bufptr - snddata.bufptr % snddata.fragsize;
@@ -1706,8 +1738,13 @@
/ snddata.clkstep);
}
+/* dump the state of the sound chip to the monitor
+
+ NOTE: for some reason this function is only used for SID?
+ */
int sound_dump(int chipno)
{
+ DBG(("sound_dump chipno:%d", chipno));
if (chipno >= snddata.sound_chip_channels) {
return -1;
}
@@ -1740,8 +1777,11 @@
return;
}
+ /* perform the actual write to the sound chip */
sound_machine_store(snddata.psid[chipno], addr, val);
+ /* now check if we have a "dump" method (which dumps the details of the
+ write access to a file), and if so, call it */
if (!snddata.playdev->dump) {
return;
}
Modified: branches/compyx/joymap-002/vice/src/sound.h
===================================================================
--- branches/compyx/joymap-002/vice/src/sound.h 2025-04-26 17:30:51 UTC (rev 45643)
+++ branches/compyx/joymap-002/vice/src/sound.h 2025-04-27 17:41:07 UTC (rev 45644)
@@ -190,8 +190,8 @@
int (*write)(int16_t *pbuf, size_t nr);
/* dump-routine to be called for every write to SID */
int (*dump)(uint16_t addr, uint8_t byte, CLOCK clks);
- /* flush-routine to be called every frame */
- int (*flush)(char *state);
+ /* DEPRECATED: flush-routine to be called every frame (not called anywhere) */
+ int (*deprecated_flush)(char *state);
/* return number of samples currently available in the kernel buffer */
int (*bufferspace)(void);
/* close and cleanup device */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|