Page 1 of 1

SFX only plays static

Posted: Sun Sep 12, 2010 1:30 am
by digithree
Hi, I'm new to NDS coding so please forgive my basic knowledge, I'm very familiar with C++ but have only coded for Intel based systems. I always look for my own answers online and only resort to this forum when I'm really stuck.

I'm trying to get a sound effect to play with MaxMod. It seem ludicracly simple to use, I don't know where the problem is.

The relivant code (I left EVERYTHING else out, there are other inlcudes, etc.) in my program is as follows:

Code: Select all

#include <maxmod9.h>
/* Sounds */
#include "soundbank.h"
#include "soundbank_bin.h"

...

mmInitDefaultMem((mm_addr)soundbank_bin);

mmLoadEffect(SFX_AHHH);

mm_sound_effect sound;
sound.id      = SFX_AHHH; // sample ID (make sure it is loaded)
sound.rate    = 0x400/2;     // playback rate, 1024 = original sound
sound.handle  = 0;           // 0 = allocate new handle
sound.volume  = 255;         // 200/255 volume level
sound.panning = 128;
mmEffectEx( &sound );
So my question, does this look like all you need for MaxMod to work? Sound was the only thing I added, it compiled before and compiles now but all I hear is static for the length of the sample.

The sample I'm using is a 44,100Hz 16 bit Stereo PCM WAV, .401 secs long with a file size of 70,786 bytes.
Any ideas?

Re: SFX only plays static

Posted: Sun Sep 12, 2010 2:13 am
by WinterMute
The sample needs to be mono.

Re: SFX only plays static

Posted: Tue Sep 14, 2010 1:54 am
by ShotgunNinja
A bit off topic, but in response to WinterMute's answer, IS there a way to play stereo sound on the DS? Obviously there are games which DO, but how exactly would this be done via devkitPro, if it is even possible?

Re: SFX only plays static

Posted: Tue Sep 14, 2010 5:33 am
by relminator
You could cheat using maxmod.

Set panning to 0 or 255.

Re: SFX only plays static

Posted: Tue Sep 14, 2010 9:26 am
by WinterMute
It wouldn't be done via devkitPro anyway - http://devkitpro.org/wiki/About

devkitPro is a vendor of tools not a tool, distribution or anything else you might use to build code. You wouldn't ask how you draw pictures via Adobe or how you calculate spreadsheet cells via Microsoft.

The DS hardware isn't capable of playing stereo samples directly in hardware, you need to separate the channels and set the appropriate panning. I wouldn't call that cheating exactly.

Re: SFX only plays static

Posted: Wed Sep 22, 2010 4:15 pm
by ShotgunNinja
All right, my apologies, I meant the suite of libraries accompanying it, namely libnds/maxmod. And thanks, that answered my question perfectly.