Another Custom DAC driver

Discussion in 'Utilities' started by ValleyBell, Jan 6, 2016.

  1. ValleyBell

    ValleyBell Well-Known Member Member

    Dec 23, 2011
    Do you remember the DAC driver from Sonic 2 Recreation Part 1?
    This is what I release today.

    Here is a list of the most important features:
    • volume control (16 levels)
    • reversed playback, looping, flip-flop
    • artificial sample rate reduction (used by S2R for the underwater effect)
    • parameters (volume/pitch/...) can be changed while a sound is playing
    • 2 sound banks with up to 254 sample definitions each (The default RAM layout has space for 128 and 126 samples respectively.)
    • multiple sound priority levels (for DAC SFX)
    There is no support for DPCM sounds though.

    Since redhotsonic uploaded all of the S2R song a while ago, you can listen to a demo song that shows some of the features, including DAC pitch changes. (Of course this required a few sound driver modifications.)

    If you are interested, you can download the source code. Sorry, no precompiled binary.

    Now you may ask: How do I add this to my hack?

    Well, to make things more interesting, I decided against doing a detailed tutorial. So you'll need a tiny bit more than basic programming knowledge.
    The readme file contains basic usage instructions and some you-need-to-know facts. But you need to get exact offsets that control the DAC driver from the ASM source. (They should be easy to find.)
    You can look up the spots where you need to modify the SMPS driver in the MegaPCM installation guide. That guide also has lots of other things that should help you on your way. (including a neat IncludeDAC macro)
    And don't waste time compressing/decompressing the DAC driver - it doesn't compress well and it's very simple to write a loop that copies all the data to offset $A00000.

    If you need help, feel free to join the SSRG IRC channel and ask me.


    small bonus - DAC rate conversion:
    • new rate = S1/S3K rate + 1
    • new rate = jman2050 rate - 1
    • new rate = MegaPCM DPCM rate - 2
    • new rate = MegaPCM PCM rate - 1
    And yes, my DAC driver is slower than the other homebrew DAC drivers. It really does lots of stuff though.
  2. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Aug 8, 2008
    Jardim Capelinha, São Paulo
    Is it me or it does DAC mixing?
  3. ValleyBell

    ValleyBell Well-Known Member Member

    Dec 23, 2011
    No, the driver doesn't do 2-channel DAC mixing.