mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
commit
2fd881e559
@ -968,6 +968,7 @@ project "portaudio"
|
|||||||
buildoptions {
|
buildoptions {
|
||||||
"/wd4204", -- warning C4204: nonstandard extension used : non-constant aggregate initializer
|
"/wd4204", -- warning C4204: nonstandard extension used : non-constant aggregate initializer
|
||||||
"/wd4701", -- warning C4701: potentially uninitialized local variable 'xxx' used
|
"/wd4701", -- warning C4701: potentially uninitialized local variable 'xxx' used
|
||||||
|
"/wd4057", -- warning C4057: 'function': 'xxx' differs in indirection to slightly different base types from 'xxx'
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration { }
|
configuration { }
|
||||||
@ -999,6 +1000,10 @@ project "portaudio"
|
|||||||
}
|
}
|
||||||
includedirs {
|
includedirs {
|
||||||
MAME_DIR .. "3rdparty/portaudio/src/os/win",
|
MAME_DIR .. "3rdparty/portaudio/src/os/win",
|
||||||
|
}
|
||||||
|
|
||||||
|
configuration { "mingw*" }
|
||||||
|
includedirs {
|
||||||
MAME_DIR .. "3rdparty/portaudio/src/hostapi/wasapi/mingw-include",
|
MAME_DIR .. "3rdparty/portaudio/src/hostapi/wasapi/mingw-include",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// copyright-holders:intealls, R.Belmont
|
// copyright-holders:intealls, R.Belmont
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
pa_sound.c
|
pa_sound.c
|
||||||
|
|
||||||
PortAudio interface.
|
PortAudio interface.
|
||||||
|
|
||||||
*******************************************************************c********/
|
*******************************************************************c********/
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ private:
|
|||||||
/* Lock free SPSC ring buffer */
|
/* Lock free SPSC ring buffer */
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct audio_buffer {
|
struct audio_buffer {
|
||||||
T* buf;
|
T* buf;
|
||||||
int size;
|
int size;
|
||||||
int reserve;
|
int reserve;
|
||||||
std::atomic<int> rd_pos, wr_pos;
|
std::atomic<int> rd_pos, wr_pos;
|
||||||
@ -190,7 +190,7 @@ int sound_pa::init(osd_options const &options)
|
|||||||
try {
|
try {
|
||||||
m_ab = new audio_buffer<s16>(m_sample_rate, 2);
|
m_ab = new audio_buffer<s16>(m_sample_rate, 2);
|
||||||
} catch (std::bad_alloc&) {
|
} catch (std::bad_alloc&) {
|
||||||
osd_printf_verbose("PortAudio: Unable to allocate audio buffer, sound is disabled\n");
|
osd_printf_error("PortAudio: Unable to allocate audio buffer, sound is disabled\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +272,8 @@ int sound_pa::init(osd_options const &options)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pa_error:
|
pa_error:
|
||||||
osd_printf_verbose("PortAudio error: %s\n", Pa_GetErrorText(err));
|
delete m_ab;
|
||||||
|
osd_printf_error("PortAudio error: %s\n", Pa_GetErrorText(err));
|
||||||
Pa_Terminate();
|
Pa_Terminate();
|
||||||
error:
|
error:
|
||||||
m_sample_rate = 0;
|
m_sample_rate = 0;
|
||||||
@ -406,24 +407,22 @@ void sound_pa::exit()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#if LOG_BUFCNT
|
#if LOG_BUFCNT
|
||||||
if (m_log.good())
|
std::ofstream m_logfile(LOG_FILE);
|
||||||
{
|
|
||||||
std::ofstream m_logfile(LOG_FILE);
|
|
||||||
|
|
||||||
if (m_logfile.is_open()) {
|
if (m_log.good() && m_logfile.is_open()) {
|
||||||
m_logfile << m_log.str();
|
m_logfile << m_log.str();
|
||||||
m_logfile.close();
|
m_logfile.close();
|
||||||
} else {
|
|
||||||
osd_printf_verbose("PortAudio: Could not write log.\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_log.good() || m_logfile.fail())
|
||||||
|
osd_printf_error("PortAudio: Error writing log.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Pa_StopStream(m_pa_stream);
|
Pa_StopStream(m_pa_stream);
|
||||||
err = Pa_Terminate();
|
err = Pa_Terminate();
|
||||||
|
|
||||||
if (err != paNoError)
|
if (err != paNoError)
|
||||||
osd_printf_verbose("PortAudio error: %s\n", Pa_GetErrorText(err));
|
osd_printf_error("PortAudio error: %s\n", Pa_GetErrorText(err));
|
||||||
|
|
||||||
delete m_ab;
|
delete m_ab;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user