Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news


  

Author Topic: [Solved] Audio speedups and slowdowns with HLSL enabled  (Read 759 times)

0 Members and 1 Guest are viewing this topic.

oomek

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 132
  • Mame forever.
[Solved] Audio speedups and slowdowns with HLSL enabled
« on: December 31, 2017, 11:38:13 am »
I'm experiencing periodical audio pitch modulation every 3-5 seconds if I enable HLSL filters.
I use a Freesync monitor with custom resolutions 1600x1080@72 for horizontal and 986x1080@72 for vertical games.
I use Portaudio as an output.
My CPU is i7 4770k and GPU Radeon R7 260X so I doubt the problem is caused by hardware.
« Last Edit: January 03, 2018, 11:12:35 am by oomek »

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6049
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #1 on: January 02, 2018, 05:49:32 am »
Hi oomek,

This is strange because you're not using -syncrefresh, so sound pitch should not be manipulated by GM. Try making your own build and log the m_speed member in video.c to monitor whether it is being updated somehow.
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

oomek

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 132
  • Mame forever.
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #2 on: January 02, 2018, 07:36:49 am »
I cannot build at the moment. I do not have vmware installed yet as Iím in the process of reinstalling Windows.
This is even more strange. The audio pitch fluctuations are the worst on starting the game and the pitch stabilizes after 1-2 minutes of playing. Whatís more it does not affect every game. Maybe its some rounding error of the framerate as I play games in their native refresh rates.

Here is a video I recorded showing it.
https://youtu.be/E8PPEQgwwpk

intealls

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 306
  • I want to build my own arcade controls!
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #3 on: January 02, 2018, 09:14:05 am »
Have you tried baseline?

Just to rule that out.

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6049
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #4 on: January 02, 2018, 09:39:25 am »
Also, press F11 to show the speed percentage during game play, to make sure it's not a speed issue (not meaning your pc isn't powerful enough, we've seen timing issues caused by many reasons).
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

oomek

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 132
  • Mame forever.
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #5 on: January 02, 2018, 09:50:08 am »
Baseline is fine. And you are right. When the glitch happens the game speed goes to 99%,101% and back to 100%.
CPU usage hovers at 15%
GPU at 17%

intealls

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 306
  • I want to build my own arcade controls!
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #6 on: January 02, 2018, 10:05:33 am »
Also, press F11 to show the speed percentage during game play, to make sure it's not a speed issue (not meaning your pc isn't powerful enough, we've seen timing issues caused by many reasons).

A sidenote, the speed seems to be much more stable when using syncrefresh compared to relying on the CPU timer (Windows 7, Z97, i3). Had issues with this a while back when experimenting with the ASIO stuff.

oomek

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 132
  • Mame forever.
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #7 on: January 02, 2018, 10:11:54 am »
I canít use syncrefresh as I run my games with freesync.
I found another thing that adds up to confusion. Normally with hlsl enabled the audio glitches happen for 1-2 minutes, BUT as soon as I press F11 they go away :/ when I press F11 immediately there is only one syncing glitch. Does it give any usefull clues to you?

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6049
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #8 on: January 02, 2018, 10:18:53 am »
There's a specific patch in GM that changes the timing library used by mainline. This was done to avoid issues similar to yours under Windows XP. Maybe you should try building GM without that patch.

When you press F11 an overlay is added to the frame which may affect the rendering time, this probably is what modifies the overall behaviour.
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

oomek

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 132
  • Mame forever.
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #9 on: January 02, 2018, 11:56:03 am »
I donít know what patch you are talking about unfortunately. Is it a separate diff or a part of GM diff?
After further testing I realised that all I neeed to do is to press F11 twice and the audio glitches are gone. It seems like some variable used for timing calculations may be not initialised or calculated too early. It would explain that over time the average value builds up and stabilises the timing. Maybe F11 reinitialises it somehow, idk, I havenít looked at the code yet. Iím posting from the phone.

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6049
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #10 on: January 02, 2018, 12:16:37 pm »
This is the diff that is applied by GM's patch and I'm suggesting you remove:

Code: [Select]
diff -Nru src/osd/osdcore.cpp src/osd/osdcore.cpp
--- src/osd/osdcore.cpp 2017-12-27 11:16:13.000000000 +0100
+++ src/osd/osdcore.cpp 2017-12-27 17:42:08.000000000 +0100
@@ -175,13 +175,19 @@
 }
 #endif
 
+#ifdef OSD_WINDOWS
+ typedef std::chrono::steady_clock s_clock;
+#else
+    typedef std::chrono::high_resolution_clock s_clock;
+#endif
+
 //============================================================
 //  osd_ticks
 //============================================================
 
 osd_ticks_t osd_ticks(void)
 {
- return std::chrono::high_resolution_clock::now().time_since_epoch().count();
+ return s_clock::now().time_since_epoch().count();
 }
 
 
@@ -191,7 +197,7 @@
 
 osd_ticks_t osd_ticks_per_second(void)
 {
- return std::chrono::high_resolution_clock::period::den / std::chrono::high_resolution_clock::period::num;
+ return s_clock::period::den / s_clock::period::num;
 }
 
 //============================================================
@@ -200,7 +206,7 @@
 
 void osd_sleep(osd_ticks_t duration)
 {
- std::this_thread::sleep_for(std::chrono::high_resolution_clock::duration(duration));
+ std::this_thread::sleep_for(s_clock::duration(duration));
 }
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6049
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #11 on: January 02, 2018, 12:22:35 pm »
There's another change applied to sound.cpp and sound.h cocerning sound management that makes GM different from baseline:

Code: [Select]
diff -Nru src/emu/sound.cpp src/emu/sound.cpp
--- src/emu/sound.cpp 2017-12-27 11:15:53.000000000 +0100
+++ src/emu/sound.cpp 2017-12-27 17:42:08.000000000 +0100
@@ -841,16 +841,13 @@
  machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(&sound_manager::resume, this));
  machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(&sound_manager::reset, this));
  machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&sound_manager::stop_recording, this));
+ machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(&sound_manager::update, this));
 
  // register global states
  machine.save().save_item(NAME(m_last_update));
 
  // set the starting attenuation
  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);
 }

@@ -1052,7 +1049,7 @@
 //  and send it to the OSD layer
 //-------------------------------------------------
 
-void sound_manager::update(void *ptr, int param)
+void sound_manager::update()
 {
  VPRINTF(("sound_update\n"));
 

...and

Code: [Select]
--- src/emu/sound.h 2017-12-27 11:15:53.000000000 +0100
+++ src/emu/sound.h 2017-12-27 17:42:08.000000000 +0100
@@ -223,7 +223,7 @@
  void config_load(config_type cfg_type, util::xml::data_node const *parentnode);
  void config_save(config_type cfg_type, util::xml::data_node *parentnode);
 
- void update(void *ptr = nullptr, s32 param = 0);
+ void update();
 
  // internal state
  running_machine &   m_machine;              // reference to our machine

Other than that, GM and baseline are the same thing.

Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

oomek

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 132
  • Mame forever.
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #12 on: January 03, 2018, 09:50:00 am »
Thanks Calamity, I'll try to look into it today. But guess what, after enabling triplebuffer the audio pitch does not fluctuate, but what is the most bizarre, It did not affect the input lag at all. I'm still getting 5-22ms with freesync on the thunderx test screen. Still trying to wrap my head around it  :dizzy:

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6049
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #13 on: January 03, 2018, 11:08:29 am »
Thanks Calamity, I'll try to look into it today. But guess what, after enabling triplebuffer the audio pitch does not fluctuate, but what is the most bizarre, It did not affect the input lag at all. I'm still getting 5-22ms with freesync on the thunderx test screen. Still trying to wrap my head around it  :dizzy:

It could be that freesync is handling vsync on its own even with triplebuffer enabled, seems possible. I'd indeed expect more fluent performance with triplebuffer enabled since it enables a separate thread for rendering.
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

oomek

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 132
  • Mame forever.
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #14 on: January 03, 2018, 11:12:06 am »
Itís a great find, as itís not docummented anywhere. I will mark this thread as solved.

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6049
Re: Audio speedups and slowdowns with HLSL enabled
« Reply #15 on: January 03, 2018, 11:35:28 am »
Itís a great find, as itís not docummented anywhere. I will mark this thread as solved.

Have you noticed any scroll stuttering due to triplebuffer?
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

oomek

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 132
  • Mame forever.
Re: [Solved] Audio speedups and slowdowns with HLSL enabled
« Reply #16 on: January 03, 2018, 11:37:35 am »
No I havenít. Only usual slowdowns from gamesí cpu cap

  
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31