Homebrew Homebrew Development

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
I'm trying to create a way to play a MP3 file with libMAD but I can't find anything on google about how to initialize it other than the official documentation which I still get errors afterwards. This is what I have so far:

Code:
/* MAD and LibCTRU streaming example
*  Author: Kaleb Provost (kprovost7314)
*  Desc: A PoC that plays MP3 Files
*/
#include <3ds.h>
#include <stdio.h>
#include <mad.h>

#include "Bokuboku_mp3.h"

struct mad_decoder decode;
struct mad_stream stream;
struct mad_header header;
struct mad_pcm output;



struct buffer {

	unsigned char const *start;
	unsigned long length;
};

struct buffer bufferData;

int main(int argc, char **argv)
{
	//Initialize gfx (note: not needed if you're using SF2Dlib)
	gfxInitDefault();
	
	consoleInit(GFX_TOP, NULL);
	printf("Streaming A MP3 file with MAD and LibCTRU\n");
	
	csndInit();
	mad_decoder_init(&decode, &bufferData, stream, 0, 0, output, 0, 0);

	
	// Main loop
	while (aptMainLoop())
	{
		//Scan all the inputs. This should be done once for each frame
		hidScanInput();
		
		//hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame)
		//hidKeysHeld returns information about which buttons are currently pressed (regardless if they were pressed or not pressed in the previous frame)
		//hidKeysUp returns information about which buttons are not pressed but were pressed in the previous frame
		u32 kDown = hidKeysDown();
		
		
		
		if (kDown & KEY_START) break; // break in order to return to hbmenu
		// YOU WANT TO LEAVE ME?????
		/*
		I'11 FL00D thE // SYSTEM f0r3v3r
		JK, Y0u'11 c0M3 b4ck
		1 kn0w y0u wi11
		*/
		
		
		// Flush and swap framebuffers, this is needed for rendering these will not be needed when using SF2D lib
		gfxFlushBuffers();
		gfxSwapBuffers();
		
		//Wait for VBlank, this is needed for rendering these will not be needed when using SF2D lib
		gspWaitForVBlank();
	}
	mad_decoder_finish(&decode);
	gfxExit();
	return 0;
}

How do I initialize it?
 

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
Is csnd related to ndsp? If not, I think it's definitely wrong, because I know anything other than ndsp is deprecated.
CSND is the less-favored version of NDSP (but not totally deprecated or else the functions would have "DEPRECATED" in the library next to them like the old GX file). I was just experimenting with them both.
 

delete12345

Well-Known Member
Member
Joined
Feb 27, 2010
Messages
695
Trophies
1
Age
32
Location
Taipei, Taiwan
XP
1,279
Country
United States
CSND is the less-favored version of NDSP (but not totally deprecated or else the functions would have "DEPRECATED" in the library next to them like the old GX file). I was just experimenting with them both.

I think you need to come over to EFNet's #3dsdev and ask away about MP3 playback on 3DS devices. That's where I heard CSND is deprecated.
 

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,897
Trophies
2
XP
29,521
Country
United Kingdom
Quick question as I haven't found it on 3dbrew yet, what's the maximum length in characters for a Title's name? More specifically, the name used for each game in the RSS feed from that titlekey site, what's the most characters it can be? Cheers!
 

ksanislo

Well-Known Member
Member
Joined
Feb 23, 2016
Messages
386
Trophies
0
Location
Seattle, WA
XP
512
Country
United States
Quick question as I haven't found it on 3dbrew yet, what's the maximum length in characters for a Title's name? More specifically, the name used for each game in the RSS feed from that titlekey site, what's the most characters it can be? Cheers!
The SMDH short name is 64 UTF-16 characters, that's the most likely limit they're using.
 
  • Like
Reactions: hippy dave

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,897
Trophies
2
XP
29,521
Country
United Kingdom
Urg, the rss actually seems to use a mix of 8 and 16 bit characters, I've got no idea how to process that.

Alternately, does anyone know how to html query the title key site (or another server eg nintendo I guess), to get a name corresponding to a supplied title id? Thanks
e: I've found the json_dec link, this might help.
 
Last edited by hippy dave,

ksanislo

Well-Known Member
Member
Joined
Feb 23, 2016
Messages
386
Trophies
0
Location
Seattle, WA
XP
512
Country
United States
Urg, the rss actually seems to use a mix of 8 and 16 bit characters, I've got no idea how to process that.

Alternately, does anyone know how to html query the title key site (or another server eg nintendo I guess), to get a name corresponding to a supplied title id? Thanks
e: I've found the json_dec link, this might help.
3dsdb.com might be a viable alternative for you as well. They provide an xml file with a list of known title ids and names for commercial releases.
 

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,897
Trophies
2
XP
29,521
Country
United Kingdom
3dsdb.com might be a viable alternative for you as well. They provide an xml file with a list of known title ids and names for commercial releases.
Thanks. Think they only have scene releases tho.
I think with the json and some borrowed json parsing code I should be able to get it sorted.
 

randomdev

Well-Known Member
Member
Joined
Jun 7, 2015
Messages
155
Trophies
0
XP
236
Country
Brazil
Hello
when I compile any sfillib homebrew (like the sample...) compiler give me this error:
Code:
C:\Users\user\Documents\Dev\3ds\projets\test>make
make[1]: *** No rule to make target `Thumbs.db.o', needed by `/c/Users/user/Doc
uments/Dev/3ds/projets/test/test.elf'.  Stop.
make: *** [build] Error 2
I've tried to reinstall devkitpro and all libraries, also it doesn't works on my other Windows.
Can anyone help me ? thanks :)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Xdqwerty @ Xdqwerty:
    I download very few songs
  • BigOnYa @ BigOnYa:
    It takes me 3 hours every week to cut my grass, and I have to have music playing, not to mention the noise canceling earbuds, so I don't have to hear that lawnmower noise. I do play iHeart radio often also when get board of my music.
  • Xdqwerty @ Xdqwerty:
    Am I weird for only listening to game music?
  • BigOnYa @ BigOnYa:
    Nuh its whatever you like to hear. Is it weird, I'm a 50 year old that mostly listens to old school hip hop?
    +1
  • K3Nv2 @ K3Nv2:
    I should be walking but legs are still sore
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, I think that listening to the same 15 songs on the music player in my dad's car all the time made me kind of hate "normal" music.
    +1
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, them use your hands
  • K3Nv2 @ K3Nv2:
    Those are tired from last night
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, stop touching yourself
  • K3Nv2 @ K3Nv2:
    I wasn't
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, then stop doing whatever you were doing last night
  • K3Nv2 @ K3Nv2:
    Uremum
  • BigOnYa @ BigOnYa:
    -insert uremum joke here-
  • K3Nv2 @ K3Nv2:
    Too late
    +2
  • BigOnYa @ BigOnYa:
    I seen a bunny rabbit get swept up and taken by a hawk yesterday in my back yard, it left a bunch of rabbit hair in grass. Wild to see it fly off carrying a rabbit.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, was Luke that Bunny rabbit?
  • BigOnYa @ BigOnYa:
    Nuh it was a small rabbit without lipstick, or no UFO propaganda
    +1
  • K3Nv2 @ K3Nv2:
    Was Leo the hawk
  • BigOnYa @ BigOnYa:
    I didn't see any kissing and loving, so prob not
    +2
  • K3Nv2 @ K3Nv2:
    True hawks have more pride
    +1
  • AncientBoi @ AncientBoi:
    [awaits K3Nv2's remarks for me] :unsure:
  • K3Nv2 @ K3Nv2:
    @AncientBoi, would be a better lover to luke he knows how to get in personal space better
  • AncientBoi @ AncientBoi:
    [sips my ☕ ]
  • BigOnYa @ BigOnYa:
    The other night was watching tv in my screened in porch, and heard something walking on my porch roof, that maybe it was a raccoon, so I grabbed my rifle and went out to look, it was just a duck, lol
    BigOnYa @ BigOnYa: The other night was watching tv in my screened in porch, and heard something walking on my porch...