Author Topic: Sound delay problem in ALL emulators  (Read 10635 times)

CXC

  • Guest
Sound delay problem in ALL emulators
« on: March 02, 2011, 02:32:50 am »
I received my Gemei today in the mail, but already I am having problems. As soon as I got it, I transferred my roms over from my old dingoo to my new gemei. However, every game, nes, genesis, gba, etc. has about a half-second sound delay. I updated the firmware to 1.1, but the problem persisted. Has this happened to anyone else? Is there a solution? I have searched, but haven't found anyone else in this situation... Help please!

rotation

  • Posts: 31
    • Check out my band!
Re: Sound delay problem in ALL emulators
« Reply #1 on: March 02, 2011, 04:18:31 am »
that's really odd- it sounds defective to me.
hate to say it!
Cuz I dont...





hear...




any...



delay.
Yinlips YDG18, Caanoo, Gemei A330,Black Dingoo a320 w/Dingux, White Dingoo a320, Xbox, PS3, another Modded Ps3, Wii, TG16, SNES, NES, Atari 7800, Genesis....even an FC Twin.

1wiierdguy

  • Posts: 218
Re: Sound delay problem in ALL emulators
« Reply #2 on: March 02, 2011, 06:41:47 am »
 The Nes and Megadrive/Genesis Emulators are known to have sound delay. I have not heard of  the other emulators being affected though.

Kryptofacist

  • Posts: 217
Re: Sound delay problem in ALL emulators
« Reply #3 on: March 02, 2011, 12:47:00 pm »
I have sound delay in GBA, NES, MD/Genesis and Neo Geo. It's less noticeable in GBA and you can hardly tell with Neo Geo, but it is sill there. SNES doesn't seem to sound lag, but that emulator has so many problems, I try to avoid it anyway. I don't really use CPS1 or CPS2 so I don't know what that's like.

I hope that this problem will be fixed once Linux finally gets ported. You aren't alone.
"The problem with internet quotes and statistics is that often times, they're wrongfully believed to be real."
- Abraham Lincoln

nardich

  • Posts: 25
Re: Sound delay problem in ALL emulators
« Reply #4 on: March 17, 2011, 04:20:47 pm »
GREAT sound delay here also, terrible with megadrive.
As well as with CPS2...
Did not find any solution, but I am still in firmware 1.0 (can't manage to update)

nardich

  • Posts: 25
Re: Sound delay problem in ALL emulators
« Reply #5 on: June 26, 2011, 10:57:50 pm »
Does somebody have a clue about this lag?
Is it still there when using TV-out?
And also, everybody encounter it? Nobody has some "magical" gemei or settings that does not lag?
That should be some programming and/or compiling errors more that hardware problem, for that it is not there for the SNES emulator, and very slight for the neogeo one, right?

Juan

  • Posts: 123
Re: Sound delay problem in ALL emulators
« Reply #6 on: June 27, 2011, 12:16:56 am »
NES is very noticeable, half a second on every game I tried.

cex

  • Posts: 144
Re: Sound delay problem in ALL emulators
« Reply #7 on: June 27, 2011, 08:34:29 am »
I algo get quite a huge delay in all the games I tested, including native PrBoom.

Minexew

  • Guest
Re: Sound delay problem in ALL emulators
« Reply #8 on: June 27, 2011, 12:25:36 pm »
cex, Have you tried changing the arguments to sys_sound_init? Just a blind guess, but lowering samplefreq or bit depth could at least reduce the delay.

cex

  • Posts: 144
Re: Sound delay problem in ALL emulators
« Reply #9 on: June 27, 2011, 12:49:01 pm »
cex, Have you tried changing the arguments to sys_sound_init? Just a blind guess, but lowering samplefreq or bit depth could at least reduce the delay.

I have not tested it, but if the SNES simulator is working better I'll try to find out if it is using different settings.
I'll also try to get the samplerate to a lower value.

nardich

  • Posts: 25
Re: Sound delay problem in ALL emulators
« Reply #10 on: June 27, 2011, 02:47:30 pm »
Wow, that is good to hear some ideas!
These arcade, NES and GBA emulators would be perfect without this sound problem!

cex

  • Posts: 144
Re: Sound delay problem in ALL emulators
« Reply #11 on: June 30, 2011, 10:29:39 am »
cex, Have you tried changing the arguments to sys_sound_init? Just a blind guess, but lowering samplefreq or bit depth could at least reduce the delay.

As I said in the development news thread, I was getting a huge delay in the Space invaders @22050 (around 1 second).
It's really weird, but I changed to 11025 and the lag got worse (2 seconds), so I changed to 44100, and now it works better (but still some lag). I'll try some tweaks and post the new version soon (with Kryptofacist Artwork).


Regards.

DarkCrono

  • Guest
Re: Sound delay problem in ALL emulators
« Reply #12 on: June 30, 2011, 11:41:42 am »
can't you go up to 48kHz?
It's strange but seems to be a sync problem. The graphics are binded to sound?

Harteex

  • * Administrator
  • Posts: 713
    • Harteex Productions
Re: Sound delay problem in ALL emulators
« Reply #13 on: June 30, 2011, 12:50:49 pm »
Well the problem is most likely mp4sdk creating a too large buffer.
44100 sound data takes up more space, which reduces the delay.

If you use waveout functions directly, such as:
waveout_open
waveout_write
waveout_close
...there shouldn't be any delay.

However, you'd probably need to create some threads handling this... I'm currently having some problems with threads, where it seems like they take up almost all cpu, even though I use delay functions in them. If I solve that I can fix a replacement for sys_sound or whatever it's called.

cex

  • Posts: 144
Re: Sound delay problem in ALL emulators
« Reply #14 on: June 30, 2011, 01:09:03 pm »
can't you go up to 48kHz?
It's strange but seems to be a sync problem. The graphics are binded to sound?

I tested 48000 -> no noticeable improvement, and audio gets some clicking.
              88100 -> almost no lag, but a lot of background noise
              96000 -> as 88100

Decreasing the buffer size in the call to OpenAudio seems to make no difference.
Lowering to 8-bit/sample get things worse.

So Harteex shall be right and the OS buffer (I don't think it is the sdk buffer, although I'll take a look) is too big.
I'll try to modify the calls to sys_sound by waveout (which seem to be used by SNES emulator), but I don't know if the parameters are the same.
Does someone have the prototypes for waveout functions?


Harteex

  • * Administrator
  • Posts: 713
    • Harteex Productions
Re: Sound delay problem in ALL emulators
« Reply #15 on: June 30, 2011, 01:13:24 pm »
From dingoo-sdk:

Code: [Select]
typedef struct {
uint32_t sample_rate;
uint16_t format;
uint8_t  channel;
uint8_t  volume;
} waveout_args;

typedef void waveout_inst;

extern void* waveout_open(waveout_args*);
extern int   waveout_write(waveout_inst*, char* buffer, int count);
extern int   waveout_close(waveout_inst*);
extern void  waveout_close_at_once(waveout_inst*);
extern int   waveout_can_write();
extern int   waveout_set_volume(unsigned int vol);

If you don't need any sound mixing (you only play one sound at a time), you can use waveout_write directly. Make sure to remove all sys_sound references though, so that it doesn't init anything.
« Last Edit: June 30, 2011, 01:18:45 pm by Harteex »

cex

  • Posts: 144
Re: Sound delay problem in ALL emulators
« Reply #16 on: June 30, 2011, 01:37:01 pm »
Thank you, I'll check this.

The progrma is using SDL_mixer, but all the calls to the system within the SDL are located at a single file, so it should be easy to patch.
Will let you know if it makes any difference.

cex

  • Posts: 144
Re: Sound delay problem in ALL emulators
« Reply #17 on: June 30, 2011, 03:58:38 pm »
I have modified the calls to sys_sound by waveout calls, but I don't get any sound... maybe they are different form the dingoo ones.
I'll check the console output to find out if it is complaining about something.


cex

  • Posts: 144
Re: Sound delay problem in ALL emulators
« Reply #18 on: July 01, 2011, 09:46:16 am »
As waveout does not work for me, I got back to the sys_sound and added a pair of sys_delay calls to the SMSsdl emulator.
Now I got the game to run with sound, but the sound is very chopped(it sounds like it was being played with a huge "vibrato" effect, not cuts).

I have tried to decrease/increase the sample rate and buffersize, and it varies a bit, but is still choppy.

Any ideas?

EDIT: Modified sound thread priority and changed sys_delay by sys_event and now the sound is quite acceptable. (Thanks to Babelfish for the translation on the BIOS document in the SDK DOC folder).

« Last Edit: July 01, 2011, 12:41:02 pm by cex »

Harteex

  • * Administrator
  • Posts: 713
    • Harteex Productions
Re: Sound delay problem in ALL emulators
« Reply #19 on: July 01, 2011, 02:11:53 pm »
Here's a simple usage with waveout:

Binary, there's no delay here.
http://www.harteex.com/temp/SimpleSound.cc

Source: http://pastebin.com/YN8PmTuS
You can't really compile that right now because of dependencies, but it should show usage.
However to make it work, you probably have to make sure there are no other calls to sound somewhere, such as any sys_sound_init or whatever that is called. I tried to play around with waveout_can_write at the same time, but while using that, sound no longer worked...

 

Post a new topic
Post a new topic