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

@@ -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,13 +13,8 @@
# 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)
if (DYNAREC)
set(cpu_SOURCES ${cpu_SOURCES} 386_dynarec_ops.c)
endif()
add_library(cpu OBJECT ${cpu_SOURCES})
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(AMD_K5)
target_compile_definitions(cpu PRIVATE USE_AMD_K5)
@@ -30,6 +25,8 @@ if(CYRIX_6X86)
endif()
if(DYNAREC)
target_sources(cpu PRIVATE 386_dynarec_ops.c)
add_library(cgt OBJECT codegen_timing_486.c codegen_timing_686.c
codegen_timing_common.c codegen_timing_k6.c
codegen_timing_pentium.c codegen_timing_p6.c

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_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_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

@@ -324,10 +324,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
}
}
@@ -431,10 +433,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--;
@@ -463,7 +467,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);