Drag Nestopia window results in louder noise channel?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Drag Nestopia window results in louder noise channel?

Post by GradualGames »

I've been making improvements to GGSound and was certain what I was seeing must have been a regression, only the way in which I make it happen can't possibly have anything to do with my NES code. Here's what I noticed:

-I play a song that is nothing but a drum loop on the noise channel and observe the perceived volume coming from my speakers, playing this song using ggsound from Nestopia.

-I click on the title bar of Nestopia in Windows and drag it, doesn't matter how far, and let go.

-Suddenly the audio is noticeably louder. I did not notice this occur on any other channels, and yet when I isolate just the noise channel using Nestopia's volume settings, I can't seem to reproduce the issue any longer.

I can't imagine simply dragging the emulator (which presumably would pause emulation) and observing different behavior could have anything to do with my NES code...

just wondered if anybody has noticed this with Nestopia or not. It's kinda subtle, and for all I know I'm hallucinating from coding too much this evening :lol:

*edit* I can also reproduce the sudden increase in volume by restarting the song, which would point back to my NES code. I'm wondering if there's some subtle setting in the APU I am neglecting which could affect the volume. I am not familiar with or understand the "sweep unit" that couldn't affect this, could it...?

*edit* Yet, I can't seem to make this happen in any other emulator.
lidnariq
Posts: 11430
Joined: Sun Apr 13, 2008 11:12 am

Re: Drag Nestopia window results in louder noise channel?

Post by lidnariq »

Any chance the problem you're encountering is that nestopia uniquely accurately emulates the DPCM DAC nonlinearity (accidental volume control) and other emulators don't?

(The nonlinearity not only changes the volume of the triangle channel but the noise channel also)
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: Drag Nestopia window results in louder noise channel?

Post by GradualGames »

lidnariq wrote:Any chance the problem you're encountering is that nestopia uniquely accurately emulates the DPCM DAC nonlinearity (accidental volume control) and other emulators don't?

(The nonlinearity not only changes the volume of the triangle channel but the noise channel also)
That seems possible. I can make the problem happen when no DPCM samples are playing, however, though they would have played previously (one of the first tracks that plays as you advance towards this drum loop track would have played some DPCM samples).

Is there a way to control this behavior?
lidnariq
Posts: 11430
Joined: Sun Apr 13, 2008 11:12 am

Re: Drag Nestopia window results in louder noise channel?

Post by lidnariq »

If it is the DPCM+triangle+noise channel nonlinearity, you should be able to explicitly write to $4011 to set the volume.

It's a little premature to address handling techniques until you've verified whether that's what's going on.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: Drag Nestopia window results in louder noise channel?

Post by GradualGames »

lidnariq wrote:If it is the DPCM+triangle+noise channel nonlinearity, you should be able to explicitly write to $4011 to set the volume.

It's a little premature to address handling techniques until you've verified whether that's what's going on.
This is making me suspect something odd with the emulator, potentially. All channels explicitly set their volume on every frame (I store their current channel state and upload it once per frame to the apu registers). Plus, this problem can happen just from dragging the window. I don't see how dragging the window would trigger NES quirk emulation behavior...
lidnariq
Posts: 11430
Joined: Sun Apr 13, 2008 11:12 am

Re: Drag Nestopia window results in louder noise channel?

Post by lidnariq »

I've noticed that recent builds of Nestopia (i.e. UE) have grown some weird bugs with audio, especially when interacting with save states, high speed, or rewinding.

No idea if that's related.

Also, writing to $4011 isn't the same "set the volume" that the pulse and noise channels have.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: Drag Nestopia window results in louder noise channel?

Post by GradualGames »

Actually if anybody else wants to try the ggsound demo in Nestopia, advance to the last track (just hit up a bunch of times until you hear nothing but a looping drum track). You can restart the song by continuing to hit up. It sometimes suddenly gets loud just doing this. You can also try dragging the window and it'll get loud in that case too.

I know it's not a regression now because the demo linked there has none of the changes I've been working on this evening.

I forget which registers do what; just that all of their volume settings are uploaded once per frame.
Post Reply