diff --git a/sw/CMakeLists.txt b/sw/CMakeLists.txt index f310bf4..6bfacbf 100644 --- a/sw/CMakeLists.txt +++ b/sw/CMakeLists.txt @@ -269,13 +269,12 @@ function(build_gus TARGET_NAME MULTIFW) target_link_libraries(${TARGET_NAME} rp2040-psram hardware_interp) endfunction() +option(SOUND_WSS "Build SB firmware with WSS (AD1848) support instead of SB16 DSP" OFF) ################################################################################ # Build SB firmware -option(SOUND_WSS "Build SB firmware with WSS (AD1848) support instead of SB16 DSP" OFF) - -function(build_sb TARGET_NAME MULTIFW) +function(build_sb_8950 TARGET_NAME MULTIFW) set(USB_JOYSTICK TRUE) - set(SOUND_MPU FALSE) + set(SOUND_MPU TRUE) set(SOUND_OPL TRUE) set(CDROM TRUE) config_target(${TARGET_NAME} ${MULTIFW}) @@ -305,11 +304,11 @@ function(build_sb TARGET_NAME MULTIFW) endfunction() ################################################################################ -# Build SB firmware — ymf262 OPL3 variant +# Build SB firmware — ymfm ymf262 OPL3 function(build_sb_ymf262 TARGET_NAME MULTIFW) set(USE_YMFM_OPL TRUE) set(USB_JOYSTICK TRUE) - set(SOUND_MPU FALSE) + set(SOUND_MPU TRUE) set(SOUND_OPL TRUE) set(CDROM TRUE) config_target(${TARGET_NAME} ${MULTIFW}) @@ -544,11 +543,11 @@ if(PROJECT_TYPE STREQUAL "MULTIFW") # --------------------------------------------------------------------------- # OPL variant for the adlib slot in the multifw bundle. - # Uncomment exactly one of the three lines below: + # Uncomment exactly one of the lines below: # set(MULTIFW_OPL_VARIANT "emu8950") # original emu8950 — OPL2, assembly-optimized # set(MULTIFW_OPL_VARIANT "ym3812") # ymfm ym3812 — OPL2, ymfm quality - set(MULTIFW_OPL_VARIANT "ymf262") # ymfm ymf262 — OPL3, true stereo - #set(MULTIFW_OPL_VARIANT "dbopl") # DOSBox OPL — OPL3, true stereo + # set(MULTIFW_OPL_VARIANT "ymf262") # ymfm ymf262 — OPL3, true stereo - note not yet fast enough for RP2040 + set(MULTIFW_OPL_VARIANT "dbopl") # DOSBox OPL — OPL3, true stereo # --------------------------------------------------------------------------- if(MULTIFW_OPL_VARIANT STREQUAL "ymf262") @@ -621,19 +620,9 @@ if(PROJECT_TYPE STREQUAL "MULTIFW") build_psg(pg-psg FALSE) build_psg(pg-psg-multifw TRUE) add_dependencies(pg-psg-multifw pg-psg generate_flash_firmware_h) - build_sb(pg-sb FALSE) - build_sb(pg-sb-multifw TRUE) + build_sb_dbopl3(pg-sb FALSE) + build_sb_dbopl3(pg-sb-multifw TRUE) add_dependencies(pg-sb-multifw pg-sb generate_flash_firmware_h) - # Standalone ymf262/ym3812 targets — always built, not in combined picogus.uf2 - # (skipped if already built above as the selected MULTIFW_OPL_VARIANT) - if(NOT MULTIFW_OPL_VARIANT STREQUAL "ymf262") - build_sb_ymf262(pg-sb-ymf262 FALSE) - build_adlib_ymf262(pg-adlib-ymf262 FALSE) - endif() - if(NOT MULTIFW_OPL_VARIANT STREQUAL "ym3812") - build_sb_ym3812(pg-sb-ym3812 FALSE) - build_adlib_ym3812(pg-adlib-ym3812 FALSE) - endif() build_usb(pg-usb FALSE) build_usb(pg-usb-multifw TRUE) add_dependencies(pg-usb-multifw pg-usb generate_flash_firmware_h) @@ -671,12 +660,9 @@ if(PROJECT_TYPE STREQUAL "MULTIFW") elseif(PROJECT_TYPE STREQUAL "GUS") set(FW_TARGET pg-gus) build_gus(pg-gus FALSE) -elseif(PROJECT_TYPE STREQUAL "SB") - set(FW_TARGET pg-sb) - build_sb(pg-sb FALSE) -elseif(PROJECT_TYPE STREQUAL "SB_YMFM") - set(FW_TARGET pg-sb-ymf262) - build_sb_ymf262(pg-sb-ymf262 FALSE) +elseif(PROJECT_TYPE STREQUAL "SB_EMU8950") + set(FW_TARGET pg-sb-emu8950) + build_sb_emu8950(pg-sb-emu8950 FALSE) elseif(PROJECT_TYPE STREQUAL "SB_YMF262") set(FW_TARGET pg-sb-ymf262) build_sb_ymf262(pg-sb-ymf262 FALSE) diff --git a/sw/cdrom/cdrom.c b/sw/cdrom/cdrom.c index 7b85253..4bce3df 100644 --- a/sw/cdrom/cdrom.c +++ b/sw/cdrom/cdrom.c @@ -34,6 +34,7 @@ #include "hardware/structs/timer.h" #include "audio/volctrl.h" +int32_t cd_audio_volume = (1 << VOLCTRL_FRACT_BITS); /* The addresses sent from the guest are absolute, ie. a LBA of 0 corresponds to a MSF of 00:00:00. Otherwise, the counter displayed by the guest is wrong: there is a seeming 2 seconds in which audio plays but counter does not move, while a data track before audio jumps to 2 seconds before the actual start diff --git a/sw/cdrom/cdrom.h b/sw/cdrom/cdrom.h index 1fc437e..7a237a1 100644 --- a/sw/cdrom/cdrom.h +++ b/sw/cdrom/cdrom.h @@ -136,9 +136,7 @@ typedef struct cdrom_fifo_t { } cdrom_fifo_t; -#if USE_CD_AUDIO_FIFO #include "audio/audio_fifo.h" -#endif typedef struct cdrom { uint8_t id; diff --git a/sw/psgplay.cpp b/sw/psgplay.cpp index 7b1f376..7630560 100644 --- a/sw/psgplay.cpp +++ b/sw/psgplay.cpp @@ -174,7 +174,6 @@ void play_psg() { while (!(buffer = take_audio_buffer(ap, false))) { #ifdef USB_STACK tuh_task(); - usb_hotplug_task(); #endif } int16_t *samples = (int16_t *) buffer->buffer->bytes; diff --git a/sw/sbplay.cpp b/sw/sbplay.cpp index e671df3..1a52fdb 100644 --- a/sw/sbplay.cpp +++ b/sw/sbplay.cpp @@ -301,8 +301,10 @@ void play_adlib() { #endif #endif +#if SOUND_SB // Process DSP commands sbdsp_process(); +#endif // Generate OPL stereo pairs and add to output FIFO. for (uint32_t opl_i = 0; diff --git a/sw/usbplay.cpp b/sw/usbplay.cpp index d5c164e..0d31c37 100644 --- a/sw/usbplay.cpp +++ b/sw/usbplay.cpp @@ -111,7 +111,6 @@ void play_usb() { struct audio_buffer *buffer; while (!(buffer = take_audio_buffer(ap, false))) { tuh_task(); - usb_hotplug_task(); } int16_t *samples = (int16_t *) buffer->buffer->bytes; buffer->sample_count = cdrom_audio_callback_simple(&cdrom, samples, SAMPLES_PER_BUFFER << 1, false) >> 1;