Mednafen Members Members   Search Search   Help Help   Register Register   Login Login   Home Home
Home » Mednafen » Development » Enhanced sound support
Show: Today's Messages  :: Show Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Enhanced sound support [message #111] Wed, 07 December 2005 19:15 Go to next message
Administrator  [PM]
This topic is for my notes regarding implementing a system to play back custom WAV and Ogg Vorbis files for music and sound effects, replacing the game machine's music and sound effects, in all supported systems. It should be able to be implemented in hardware as well as emulators.

All music and sound effects must have the same number of channels, and be recorded at the same rate.

One song can be playing at a time. A larger, but limited, number of sound effects may be played at one time.

Fade in and fade out can be logarithmic or linear. Fade time is the amount of time, in milliseconds, required to achieve half of full amplitude.


Hardware Registers:

Song number, 16-bit.
Song play count, 16-bit, 0 = infinite, 1 = play one time, 2 = loop once(play two times), etc.
Song fadein, 15-bit, upper 1-bit = 0=linear/1=logarithmic.
Song fadeout,15-bit, upper 1-bit = 0=linear/1=logarithmic.
Song volume, 8-bit, 255 = 100%, 0 = 0%

Effect number, 15-bit, upper 1-bit = 0=linear/1=logarithmic.
Effect play count, 16-bit, same as song play count.
Effect volume.

Global fadein, 15-bit, upper 1-bit = 0=linear/1=logarithmic.
Global fadeout, 15-bit, upper 1-bit = 0=linear/1=logarithmic.
Global volume.

Action register(each bit performs an action, action copies from the hardware register latches to internal data structures), multiple bits can be set.

Fadein/fadeout should only be copied internally on "play song" and "play sound effect" events. Volume should be copied internally on play events and also on the "set song volume" and "set effect volume" events.

For 8-bit systems, the actions should be taken when the upper byte of the command is written(meaning the lower bits should be latched!).

D0: Play song.
D1: Set song volume.
D2: Stop song.

D3: Play sound effect.
D4: Set all instances of sound effect volume.
D5: Stop all instances of sound effect.
D6: Stop all sound effects.

D7: Global fadein.
D8: Global fadeout.
D9: Set global volume.

Archive format(in ZIP file, music and sound effects mustn't be compressed in ZIP file, just stored):

config.txt
patch.ips
<music and sound effect filenames>

config.txt:
Loop points given in samples.

Allow mapping in additional RAM("ram") or ROM("overlay"). "file" statements can be used in the ram section, and the contents will be set on virtual system power toggle and reset.

Multiple ram and overlay sections are allowed, but they mustn't overlap.


example:

[registers]
base = 0x4200

[ram]
address = 0x5000
size = 2048

[overlay]
address = 0x4800
size = 2048
file = "player-code.bin"

[music00]
file = "goomh.ogg"
title = "Get out of my House!"
loop_point = 90432

[music01]
file = "blueberries.ogg"
title = "We Like these Blueberries"
loop_point = 240504

[sfx00]
file = "explosion.wav"
title = "Kablammo!"

[Updated on: Thu, 01 February 2007 09:13]

Re: Enhanced sound support [message #650 is a reply to message #111 ] Wed, 31 January 2007 17:56 Go to previous messageGo to next message
Administrator  [PM]
Updated, WIP!
Re: Enhanced sound support [message #688 is a reply to message #111 ] Fri, 09 February 2007 06:53 Go to previous message
Dryer Lint  [PM]
I've always wished for this kind of thing!
Very nice.

This could even be advantageous if you replaced the original music with ogg versions of the same music. Because the music always (partially) stops on games when certain sound effects are played, like in the SMB games for NES, for example.
Or you could just replace all the music in Castlevania 3 with rock cover versions of the same songs...
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic:WonderSwan emulation notes
Next Topic:22 Feb 2007 WIP Screenshots
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ ]

Current Time: Sat May 18 05:31:17 CDT 2024
.:: Contact :: Home ::.

Powered by FUDforum.
Copyright © FUDforum Bulletin Board Software