Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Help with PSGSFX

Reply to topic
Author Message
  • Joined: 06 Sep 2015
  • Posts: 236
  • Location: United States
Reply with quote
Help with PSGSFX
Post Posted: Wed Mar 25, 2020 4:07 am
I'm having trouble with PSGSFX. About 50% of the time it won't play the sound effect even when I tell it to. Right now a sound effect should happen when:
- burger touches chicken nugget
- fry has been fired
- fry shot down milkshake
- fry shot down onion ring
- fry shoots at boss

But I can't get it to consistently play every sound effect like I want it to. What am I doing wrong?
hamburgerstwo21.zip (38.51 KB)
ROM and code

  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2645
Reply with quote
Post Posted: Wed Mar 25, 2020 9:39 am
it seems to me it's working correctly. remember that if you play a SFX immediately after another, the first one gets cancelled as you can't play two SFXs together - so sometimes it might seem one SFX didn't play.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 236
  • Location: United States
Reply with quote
Post Posted: Wed Mar 25, 2020 1:32 pm
Could it be my choice of emulator then? I'm using Emulicious.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2645
Reply with quote
Post Posted: Wed Mar 25, 2020 5:59 pm
I'm also using it. I think I can hear all the SFX that don't get cancelled by others. If you think the problem still persist, please describe exactly how to reproduce it, as I couldn't do that.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 236
  • Location: United States
Reply with quote
Post Posted: Wed Mar 25, 2020 7:42 pm
I made a YouTube video of what I have been witnessing when playing the game on Emulicious.
https://youtu.be/AEgKhSwIbHY
As you can see, a couple of times, some sound effects don't play at all.
  View user's profile Send private message Visit poster's website
  • Joined: 04 Nov 2004
  • Posts: 268
  • Location: Deutschland
Reply with quote
Post Posted: Wed Mar 25, 2020 8:17 pm
When you are very close to an enemy and shoot it, the shooting sfx starts fine but is shortly afterwards interrupted by silence, as if an "empty" sfx is played if you hit an enemy.

You could try using the debug console and print messages when PSGSFXPlay is called to see which sfx are started when. Maybe there's a problem in the collision routines. Or maybe the same sfx is repeatedly triggered and has silence at the beginning? But I'm just guessing.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2645
Reply with quote
Post Posted: Thu Mar 26, 2020 10:01 am
found the problem

when you call PSGSFXPlay, you should set HL to the address of the SFX you want to play (you're doing that correctly already) *and* you should also set C to the mask that indicates which channels the SFX will use (and you're not doing that...)

possible values for C are:

  • 1 - if the SFX uses only the 3rd square wave channel
  • 2 - if the SFX uses only the noise channel
  • 3 - if the SFX uses both of these
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 236
  • Location: United States
Reply with quote
Post Posted: Thu Mar 26, 2020 2:54 pm
Yep, that was what the problem was! Thanks, sverx!
This additional info isn't in the SN76489 page https://www.smspower.org/Development/SN76489, or not that I could see, anyway. Perhaps if it's not there, it would be great if you could include it.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2645
Reply with quote
Post Posted: Thu Mar 26, 2020 3:55 pm
good you could fix it.
that info isn't listed on the SN76489 page because it has nothing to do with the hardware itself, it's how PSGlib works (yeah, I should write proper documentation...)
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 236
  • Location: United States
Reply with quote
Post Posted: Fri Mar 27, 2020 4:17 am
Another thing you should mention when redoing the PSGLib manual is state that all PSGs must have a volume of 15, and then you can adjust the volume via the code in your game and not in the PSG file itself. I had trouble, I had all the notes to volume 8 and it would not play in my game. After I adjusted the notes to 15, they played.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2645
Reply with quote
Post Posted: Fri Mar 27, 2020 10:45 am
well, I think when writing the music one should use all the needed volume range anyway, then if the game needs to lower the volume you can do that in code using PSGSetMusicVolumeAttenuation...
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!