Merge branch '86Box:master' into ps1-audio

This commit is contained in:
Jasmine Iwanek
2022-01-29 21:53:55 -05:00
committed by GitHub
9 changed files with 54 additions and 15 deletions

View File

@@ -83,7 +83,7 @@ jobs:
run: cmake --build build --target ${{ matrix.build.target }} run: cmake --build build --target ${{ matrix.build.target }}
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: '86Box-${{ matrix.build.name }}-MSYS2-${{ matrix.environment.msystem }}-gha${{ github.run_number }}' name: '86Box${{ matrix.build.slug }}-MSYS2-${{ matrix.environment.msystem }}-gha${{ github.run_number }}'
path: build/artifacts/** path: build/artifacts/**
llvm-windows: llvm-windows:
@@ -177,18 +177,21 @@ jobs:
path: build/artifacts/** path: build/artifacts/**
linux: linux:
name: "Linux GCC 11" name: "Linux GCC 11 (${{ matrix.build.name }} x86_64)"
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
build: build:
- name: Debug - name: Debug
slug: -Debug
dev-build: off dev-build: off
new-dynarec: off new-dynarec: off
type: Debug type: Debug
- name: Dev - name: Dev
slug: -Dev
dev-build: on dev-build: on
new-dynarec: on new-dynarec: on
type: Debug type: Debug
@@ -207,7 +210,13 @@ jobs:
-D CMAKE_BUILD_TYPE=${{ matrix.build.type }} -D CMAKE_BUILD_TYPE=${{ matrix.build.type }}
-D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11 -D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11
- name: Build - name: Build
run: cmake --build build --target install run: cmake --build build
- name: Generate package
run: cmake --install build --prefix ./build/artifacts ${{ matrix.build.strip }}
- uses: actions/upload-artifact@v2
with:
name: '86Box${{ matrix.build.slug }}-Linux-x86_64-gha${{ github.run_number }}'
path: build/artifacts/**
macos: macos:
name: "macOS 11 (${{ matrix.build.name }} x86_64)" name: "macOS 11 (${{ matrix.build.name }} x86_64)"
@@ -243,7 +252,9 @@ jobs:
run: >- run: >-
cmake -S . -B build cmake -S . -B build
--toolchain cmake/flags-gcc-x86_64.cmake --toolchain cmake/flags-gcc-x86_64.cmake
-D DEV_BRANCH=${{ matrix.build.dev-build }}
-D NEW_DYNAREC=${{ matrix.build.new-dynarec }} -D NEW_DYNAREC=${{ matrix.build.new-dynarec }}
-D VNC=OFF
-D CMAKE_BUILD_TYPE=${{ matrix.build.type }} -D CMAKE_BUILD_TYPE=${{ matrix.build.type }}
- name: Build - name: Build
run: cmake --build build run: cmake --build build

View File

@@ -100,8 +100,8 @@ set(CMAKE_CXX_STANDARD 11)
# Option Description Def. # Option Description Def.
# ------ ----------- ---- # ------ ----------- ----
option(RELEASE "Release build" OFF) option(RELEASE "Release build" OFF)
option(USB "USB support" OFF)
option(DYNAREC "Dynamic recompiler" ON) option(DYNAREC "Dynamic recompiler" ON)
option(OPENAL "OpenAL" ON)
option(FLUIDSYNTH "FluidSynth" ON) option(FLUIDSYNTH "FluidSynth" ON)
option(MUNT "MUNT" ON) option(MUNT "MUNT" ON)
option(VRAMDUMP "Video RAM dumping" OFF) option(VRAMDUMP "Video RAM dumping" OFF)

View File

@@ -932,7 +932,9 @@ pc_reset_hard_close(void)
scsi_disk_close(); scsi_disk_close();
#ifdef USE_OPENAL
closeal(); closeal();
#endif
video_reset_close(); video_reset_close();

View File

@@ -87,9 +87,11 @@ if(APPLE)
target_link_libraries(86Box Freetype::Freetype) target_link_libraries(86Box Freetype::Freetype)
endif() endif()
find_package(OpenAL REQUIRED) if(OPENAL)
include_directories(${OPENAL_INCLUDE_DIR}) find_package(OpenAL REQUIRED)
target_link_libraries(86Box ${OPENAL_LIBRARY}) include_directories(${OPENAL_INCLUDE_DIR})
target_link_libraries(86Box ${OPENAL_LIBRARY})
endif()
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS}) include_directories(${SDL2_INCLUDE_DIRS})

View File

@@ -13,13 +13,8 @@
# Copyright 2020,2021 David Hrdlička. # Copyright 2020,2021 David Hrdlička.
# #
set(cpu_SOURCES cpu.c cpu_table.c fpu.c x86.c 808x.c 386.c 386_common.c 386_dynarec.c x86seg.c x87.c x87_timings.c) add_library(cpu OBJECT cpu.c cpu_table.c fpu.c x86.c 808x.c 386.c 386_common.c
386_dynarec.c x86seg.c x87.c x87_timings.c)
if (DYNAREC)
set(cpu_SOURCES ${cpu_SOURCES} 386_dynarec_ops.c)
endif()
add_library(cpu OBJECT ${cpu_SOURCES})
if(AMD_K5) if(AMD_K5)
target_compile_definitions(cpu PRIVATE USE_AMD_K5) target_compile_definitions(cpu PRIVATE USE_AMD_K5)
@@ -30,6 +25,8 @@ if(CYRIX_6X86)
endif() endif()
if(DYNAREC) if(DYNAREC)
target_sources(cpu PRIVATE 386_dynarec_ops.c)
add_library(cgt OBJECT codegen_timing_486.c codegen_timing_686.c add_library(cgt OBJECT codegen_timing_486.c codegen_timing_686.c
codegen_timing_common.c codegen_timing_k6.c codegen_timing_common.c codegen_timing_k6.c
codegen_timing_pentium.c codegen_timing_p6.c codegen_timing_pentium.c codegen_timing_p6.c

View File

@@ -13,12 +13,17 @@
# Copyright 2020,2021 David Hrdlička. # Copyright 2020,2021 David Hrdlička.
# #
add_library(snd OBJECT sound.c openal.c snd_opl.c snd_opl_nuked.c snd_resid.cc add_library(snd OBJECT sound.c snd_opl.c snd_opl_nuked.c snd_resid.cc
midi.c midi_rtmidi.cpp snd_speaker.c snd_pssj.c snd_lpt_dac.c snd_ac97_codec.c snd_ac97_via.c midi.c midi_rtmidi.cpp snd_speaker.c snd_pssj.c snd_lpt_dac.c snd_ac97_codec.c snd_ac97_via.c
snd_lpt_dss.c snd_ps1.c snd_adlib.c snd_adlibgold.c snd_ad1848.c snd_audiopci.c snd_lpt_dss.c snd_ps1.c snd_adlib.c snd_adlibgold.c snd_ad1848.c snd_audiopci.c
snd_azt2316a.c snd_cms.c snd_cs423x.c snd_gus.c snd_sb.c snd_sb_dsp.c snd_azt2316a.c snd_cms.c snd_cs423x.c snd_gus.c snd_sb.c snd_sb_dsp.c
snd_emu8k.c snd_mpu401.c snd_sn76489.c snd_ssi2001.c snd_wss.c snd_ym7128.c) snd_emu8k.c snd_mpu401.c snd_sn76489.c snd_ssi2001.c snd_wss.c snd_ym7128.c)
if(OPENAL)
target_compile_definitions(snd PRIVATE USE_OPENAL)
target_sources(snd PRIVATE openal.c)
endif()
if(FLUIDSYNTH) if(FLUIDSYNTH)
target_compile_definitions(snd PRIVATE USE_FLUIDSYNTH) target_compile_definitions(snd PRIVATE USE_FLUIDSYNTH)
target_sources(snd PRIVATE midi_fluidsynth.c) target_sources(snd PRIVATE midi_fluidsynth.c)

View File

@@ -40,8 +40,10 @@ enum fluid_interp {
}; };
#ifdef USE_OPENAL
extern void givealbuffer_midi(void *buf, uint32_t size); extern void givealbuffer_midi(void *buf, uint32_t size);
extern void al_set_midi(int freq, int buf_size); extern void al_set_midi(int freq, int buf_size);
#endif
static void *fluidsynth_handle; /* handle to FluidSynth DLL */ static void *fluidsynth_handle; /* handle to FluidSynth DLL */
@@ -150,7 +152,9 @@ static void fluidsynth_thread(void *param)
buf_pos += buf_size; buf_pos += buf_size;
if (buf_pos >= data->buf_size) if (buf_pos >= data->buf_size)
{ {
#ifdef USE_OPENAL
givealbuffer_midi(data->buffer, data->buf_size / sizeof(float)); givealbuffer_midi(data->buffer, data->buf_size / sizeof(float));
#endif
buf_pos = 0; buf_pos = 0;
} }
} }
@@ -163,7 +167,9 @@ static void fluidsynth_thread(void *param)
buf_pos += buf_size; buf_pos += buf_size;
if (buf_pos >= data->buf_size) if (buf_pos >= data->buf_size)
{ {
#ifdef USE_OPENAL
givealbuffer_midi(data->buffer_int16, data->buf_size / sizeof(int16_t)); givealbuffer_midi(data->buffer_int16, data->buf_size / sizeof(int16_t));
#endif
buf_pos = 0; buf_pos = 0;
} }
} }
@@ -314,7 +320,9 @@ void* fluidsynth_init(const device_t *info)
data->buffer_int16 = malloc(data->buf_size); data->buffer_int16 = malloc(data->buf_size);
} }
#ifdef USE_OPENAL
al_set_midi(data->samplerate, data->buf_size); al_set_midi(data->samplerate, data->buf_size);
#endif
dev = malloc(sizeof(midi_device_t)); dev = malloc(sizeof(midi_device_t));
memset(dev, 0, sizeof(midi_device_t)); memset(dev, 0, sizeof(midi_device_t));

View File

@@ -13,8 +13,10 @@
#include <86box/midi.h> #include <86box/midi.h>
#ifdef USE_OPENAL
extern void givealbuffer_midi(void *buf, uint32_t size); extern void givealbuffer_midi(void *buf, uint32_t size);
extern void al_set_midi(int freq, int buf_size); extern void al_set_midi(int freq, int buf_size);
#endif
static const mt32emu_report_handler_i_v0 handler_v0 = { static const mt32emu_report_handler_i_v0 handler_v0 = {
/** Returns the actual interface version ID */ /** Returns the actual interface version ID */
@@ -136,7 +138,9 @@ static void mt32_thread(void *param)
buf_pos += bsize; buf_pos += bsize;
if (buf_pos >= buf_size) if (buf_pos >= buf_size)
{ {
#ifdef USE_OPENAL
givealbuffer_midi(buffer, buf_size / sizeof(float)); givealbuffer_midi(buffer, buf_size / sizeof(float));
#endif
buf_pos = 0; buf_pos = 0;
} }
} }
@@ -148,7 +152,9 @@ static void mt32_thread(void *param)
buf_pos += bsize; buf_pos += bsize;
if (buf_pos >= buf_size) if (buf_pos >= buf_size)
{ {
#ifdef USE_OPENAL
givealbuffer_midi(buffer_int16, buf_size / sizeof(int16_t)); givealbuffer_midi(buffer_int16, buf_size / sizeof(int16_t));
#endif
buf_pos = 0; buf_pos = 0;
} }
} }
@@ -200,7 +206,9 @@ void* mt32emu_init(char *control_rom, char *pcm_rom)
mt32emu_set_reversed_stereo_enabled(context, device_get_config_int("reversed_stereo")); mt32emu_set_reversed_stereo_enabled(context, device_get_config_int("reversed_stereo"));
mt32emu_set_nice_amp_ramp_enabled(context, device_get_config_int("nice_ramp")); mt32emu_set_nice_amp_ramp_enabled(context, device_get_config_int("nice_ramp"));
#ifdef USE_OPENAL
al_set_midi(samplerate, buf_size); al_set_midi(samplerate, buf_size);
#endif
dev = malloc(sizeof(midi_device_t)); dev = malloc(sizeof(midi_device_t));
memset(dev, 0, sizeof(midi_device_t)); memset(dev, 0, sizeof(midi_device_t));

View File

@@ -324,10 +324,12 @@ sound_cd_thread(void *param)
} }
} }
#ifdef USE_OPENAL
if (sound_is_float) if (sound_is_float)
givealbuffer_cd(cd_out_buffer); givealbuffer_cd(cd_out_buffer);
else else
givealbuffer_cd(cd_out_buffer_int16); givealbuffer_cd(cd_out_buffer_int16);
#endif
} }
} }
@@ -431,10 +433,12 @@ sound_poll(void *priv)
} }
} }
#ifdef USE_OPENAL
if (sound_is_float) if (sound_is_float)
givealbuffer(outbuffer_ex); givealbuffer(outbuffer_ex);
else else
givealbuffer(outbuffer_ex_int16); givealbuffer(outbuffer_ex_int16);
#endif
if (cd_thread_enable) { if (cd_thread_enable) {
cd_buf_update--; cd_buf_update--;
@@ -463,7 +467,9 @@ sound_reset(void)
midi_device_init(); midi_device_init();
midi_in_device_init(); midi_in_device_init();
#ifdef USE_OPENAL
inital(); inital();
#endif
timer_add(&sound_poll_timer, sound_poll, NULL, 1); timer_add(&sound_poll_timer, sound_poll, NULL, 1);