Homebrew Homebrew Development

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,285
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,285
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,276
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,877
Trophies
2
XP
29,191
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,877
Trophies
2
XP
29,191
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,877
Trophies
2
XP
29,191
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
    Faust03 @ Faust03: hey the spam bots are acting up again