Merge pull request #2026 from jriwanek-forks/openal-changes

Openal changes
This commit is contained in:
Miran Grča
2022-01-30 02:49:59 +01:00
committed by GitHub
8 changed files with 50 additions and 7 deletions

View File

@@ -83,7 +83,7 @@ jobs:
run: cmake --build build --target ${{ matrix.build.target }}
- uses: actions/upload-artifact@v2
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/**
llvm-windows:
@@ -177,18 +177,21 @@ jobs:
path: build/artifacts/**
linux:
name: "Linux GCC 11"
name: "Linux GCC 11 (${{ matrix.build.name }} x86_64)"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build:
- name: Debug
slug: -Debug
dev-build: off
new-dynarec: off
type: Debug
- name: Dev
slug: -Dev
dev-build: on
new-dynarec: on
type: Debug
@@ -207,7 +210,13 @@ jobs:
-D CMAKE_BUILD_TYPE=${{ matrix.build.type }}
-D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11
- 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:
name: "macOS 11 (${{ matrix.build.name }} x86_64)"
@@ -243,7 +252,9 @@ jobs:
run: >-
cmake -S . -B build
--toolchain cmake/flags-gcc-x86_64.cmake
-D DEV_BRANCH=${{ matrix.build.dev-build }}
-D NEW_DYNAREC=${{ matrix.build.new-dynarec }}
-D VNC=OFF
-D CMAKE_BUILD_TYPE=${{ matrix.build.type }}
- name: Build
run: cmake --build build

View File

@@ -101,6 +101,7 @@ set(CMAKE_CXX_STANDARD 11)
# ------ ----------- ----
option(RELEASE "Release build" OFF)
option(DYNAREC "Dynamic recompiler" ON)
option(OPENAL "OpenAL" ON)
option(FLUIDSYNTH "FluidSynth" ON)
option(MUNT "MUNT" ON)
option(VRAMDUMP "Video RAM dumping" OFF)

View File

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

View File

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

View File

@@ -13,12 +13,17 @@
# 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
snd_lpt_dss.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_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)
target_compile_definitions(snd PRIVATE USE_FLUIDSYNTH)
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 al_set_midi(int freq, int buf_size);
#endif
static void *fluidsynth_handle; /* handle to FluidSynth DLL */
@@ -150,7 +152,9 @@ static void fluidsynth_thread(void *param)
buf_pos += buf_size;
if (buf_pos >= data->buf_size)
{
#ifdef USE_OPENAL
givealbuffer_midi(data->buffer, data->buf_size / sizeof(float));
#endif
buf_pos = 0;
}
}
@@ -163,7 +167,9 @@ static void fluidsynth_thread(void *param)
buf_pos += buf_size;
if (buf_pos >= data->buf_size)
{
#ifdef USE_OPENAL
givealbuffer_midi(data->buffer_int16, data->buf_size / sizeof(int16_t));
#endif
buf_pos = 0;
}
}
@@ -314,7 +320,9 @@ void* fluidsynth_init(const device_t *info)
data->buffer_int16 = malloc(data->buf_size);
}
#ifdef USE_OPENAL
al_set_midi(data->samplerate, data->buf_size);
#endif
dev = malloc(sizeof(midi_device_t));
memset(dev, 0, sizeof(midi_device_t));

View File

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

View File

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