diff -Naur -x *.p* -x *.orig -x *.rej -x *.bak -x neogeo_noslot.c -x arcade.lst -x z80*.c -x hk68*.c --ignore-all-space gmame167/src/emu/sound.c gmame167-asio/src/emu/sound.c --- gmame167/src/emu/sound.c Wed Oct 28 09:47:18 2015 +++ gmame167-asio/src/emu/sound.c Wed Oct 28 22:20:54 2015 @@ -851,8 +851,8 @@ set_attenuation(machine.options().volume()); // start the periodic update flushing timer - m_update_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(sound_manager::update), this)); - m_update_timer->adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME); + //m_update_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(sound_manager::update), this)); + //m_update_timer->adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME); } @@ -1031,7 +1031,7 @@ // and send it to the OSD layer //------------------------------------------------- -void sound_manager::update(void *ptr, int param) +void sound_manager::update() { VPRINTF(("sound_update\n")); diff -Naur -x *.p* -x *.orig -x *.rej -x *.bak -x neogeo_noslot.c -x arcade.lst -x z80*.c -x hk68*.c --ignore-all-space gmame167/src/emu/sound.h gmame167-asio/src/emu/sound.h --- gmame167/src/emu/sound.h Wed Oct 28 09:47:18 2015 +++ gmame167-asio/src/emu/sound.h Wed Oct 28 22:20:54 2015 @@ -216,6 +216,8 @@ // user gain controls bool indexed_mixer_input(int index, mixer_input &info) const; + void update(); + private: // internal helpers void mute(bool mute, UINT8 reason); @@ -225,8 +227,6 @@ void config_load(int config_type, xml_data_node *parentnode); void config_save(int config_type, xml_data_node *parentnode); - void update(void *ptr = NULL, INT32 param = 0); - // internal state running_machine & m_machine; // reference to our machine emu_timer * m_update_timer; // timer to drive periodic updates diff -Naur -x *.p* -x *.orig -x *.rej -x *.bak -x neogeo_noslot.c -x arcade.lst -x z80*.c -x hk68*.c --ignore-all-space gmame167/src/emu/video.c gmame167-asio/src/emu/video.c --- gmame167/src/emu/video.c Wed Oct 28 22:12:21 2015 +++ gmame167-asio/src/emu/video.c Fri Oct 30 15:23:42 2015 @@ -262,6 +262,8 @@ if (machine().first_screen() != NULL && (machine().paused() || debug || debugger_within_instruction_hook(machine()))) machine().first_screen()->reset_partial_updates(); } + + machine().sound().update(); } diff -Naur -x *.p* -x *.orig -x *.rej -x *.bak -x neogeo_noslot.c -x arcade.lst -x z80*.c -x hk68*.c --ignore-all-space gmame167/src/osd/modules/lib/osdobj_common.c gmame167-asio/src/osd/modules/lib/osdobj_common.c --- gmame167/src/osd/modules/lib/osdobj_common.c Wed Oct 28 22:12:21 2015 +++ gmame167-asio/src/osd/modules/lib/osdobj_common.c Wed Oct 28 22:20:54 2015 @@ -553,6 +554,7 @@ m_sound = select_module_options(options(), OSD_SOUND_PROVIDER); m_sound->m_sample_rate = options().sample_rate(); m_sound->m_audio_latency = options().audio_latency(); + m_sound->set_machine(machine()); m_debugger = select_module_options(options(), OSD_DEBUG_PROVIDER); diff -Naur -x *.p* -x *.orig -x *.rej -x *.bak -x neogeo_noslot.c -x arcade.lst -x z80*.c -x hk68*.c --ignore-all-space gmame167/src/osd/modules/sound/direct_sound.c gmame167-asio/src/osd/modules/sound/direct_sound.c --- gmame167/src/osd/modules/sound/direct_sound.c Wed Oct 28 22:12:21 2015 +++ gmame167-asio/src/osd/modules/sound/direct_sound.c Wed Oct 28 22:20:54 2015 @@ -72,6 +72,7 @@ // sound_module virtual void update_audio_stream(bool is_throttled, INT16 const *buffer, int samples_this_frame); virtual void set_mastervolume(int attenuation); + virtual void set_machine(running_machine& machine) { } private: class buffer diff -Naur -x *.p* -x *.orig -x *.rej -x *.bak -x neogeo_noslot.c -x arcade.lst -x z80*.c -x hk68*.c --ignore-all-space gmame167/src/osd/modules/sound/none.c gmame167-asio/src/osd/modules/sound/none.c --- gmame167/src/osd/modules/sound/none.c Wed Oct 28 09:47:28 2015 +++ gmame167-asio/src/osd/modules/sound/none.c Wed Oct 28 22:20:54 2015 @@ -27,6 +27,7 @@ virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) { } virtual void set_mastervolume(int attenuation) { } + virtual void set_machine(running_machine& machine) { } }; diff -Naur -x *.p* -x *.orig -x *.rej -x *.bak -x neogeo_noslot.c -x arcade.lst -x z80*.c -x hk68*.c --ignore-all-space gmame167/src/osd/modules/sound/sdl_sound.c gmame167-asio/src/osd/modules/sound/sdl_sound.c --- gmame167/src/osd/modules/sound/sdl_sound.c Wed Oct 28 22:12:21 2015 +++ gmame167-asio/src/osd/modules/sound/sdl_sound.c Fri Oct 30 19:04:41 2015 @@ -11,6 +11,12 @@ #include "sound_module.h" #include "modules/osdmodule.h" +#include + +#include +#include +#include + #if (defined(OSD_SDL) || defined(USE_SDL_SOUND)) // standard sdl header @@ -34,6 +40,8 @@ static void sdl_callback(void *userdata, Uint8 *stream, int len); +static unsigned int samples_received = 0, samples_requested = 0, audio_update = 0; + //============================================================ // CLASS //============================================================ @@ -65,6 +73,8 @@ virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame); virtual void set_mastervolume(int attenuation); + virtual void set_machine(running_machine& machine) { m_machine = &machine; } + private: int lock_buffer(bool is_throttled, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2); void unlock_buffer(void); @@ -72,6 +82,7 @@ void copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy); int sdl_create_buffers(void); void sdl_destroy_buffers(void); + void log(void); int sdl_xfer_samples; int stream_in_initialized; @@ -90,6 +101,10 @@ int buffer_underflows; int buffer_overflows; + std::ofstream m_logfile; + std::stringstream m_log; + + running_machine* m_machine; }; @@ -241,6 +256,22 @@ unlock_buffer(); } +void sound_sdl::log(void) +{ + static const double tps = (double)osd_ticks_per_second(); + static const double time_start = (double)osd_ticks() / tps; + double time_now = (double)osd_ticks() / tps - time_start; + if (m_log.good()) { + m_log << m_machine->video().speed_percent() << + ",\t\t" << samples_received << + ",\t\t" << samples_requested << + ",\t\t" << audio_update << + ",\t\t" << std::fixed << std::setprecision(5) << time_now << + ",\t\t" << m_machine->video().speed_factor() << + std::endl; + } +} + //============================================================ // update_audio_stream @@ -319,6 +350,13 @@ // now we know where to copy; let's do it stream_buffer_in = stream_in; copy_sample_data(is_throttled, buffer, bytes_this_frame); + + if (!m_machine->video().fastforward()) + samples_received += samples_this_frame; + + audio_update++; + + log(); } } @@ -395,6 +433,8 @@ if (LOG_SOUND) fprintf(sound_log, "callback: xfer len1 %d len2 %d, playpos %d\n", len1, len2, thiz->stream_playpos); + + samples_requested += len; } @@ -506,6 +546,10 @@ fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows); fclose(sound_log); } + + m_logfile.open("sdl.log"); + m_logfile << m_log.str(); + m_logfile.close(); } diff -Naur -x *.p* -x *.orig -x *.rej -x *.bak -x neogeo_noslot.c -x arcade.lst -x z80*.c -x hk68*.c --ignore-all-space gmame167/src/osd/modules/sound/sound_module.h gmame167-asio/src/osd/modules/sound/sound_module.h --- gmame167/src/osd/modules/sound/sound_module.h Wed Oct 28 09:47:28 2015 +++ gmame167-asio/src/osd/modules/sound/sound_module.h Wed Oct 28 22:20:54 2015 @@ -26,6 +26,7 @@ virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) = 0; virtual void set_mastervolume(int attenuation) = 0; + virtual void set_machine(running_machine& machine) = 0; int sample_rate() { return m_sample_rate; }