SFX only plays static

support for the gba/nds sound library from www.maxmod.org

Moderator: eKid

Post Reply
digithree

SFX only plays static

Post by digithree » Sun Sep 12, 2010 1:30 am

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?

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: SFX only plays static

Post by WinterMute » Sun Sep 12, 2010 2:13 am

The sample needs to be mono.
Help keep devkitPro toolchains free, Donate today

Personal Blog

ShotgunNinja
Posts: 34
Joined: Tue May 11, 2010 2:29 am

Re: SFX only plays static

Post by ShotgunNinja » Tue Sep 14, 2010 1:54 am

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?

relminator
Posts: 84
Joined: Sun Apr 11, 2010 10:43 am

Re: SFX only plays static

Post by relminator » Tue Sep 14, 2010 5:33 am

You could cheat using maxmod.

Set panning to 0 or 255.

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: SFX only plays static

Post by WinterMute » Tue Sep 14, 2010 9:26 am

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.
Help keep devkitPro toolchains free, Donate today

Personal Blog

ShotgunNinja
Posts: 34
Joined: Tue May 11, 2010 2:29 am

Re: SFX only plays static

Post by ShotgunNinja » Wed Sep 22, 2010 4:15 pm

All right, my apologies, I meant the suite of libraries accompanying it, namely libnds/maxmod. And thanks, that answered my question perfectly.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest