Homebrew Homebrew Development

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,386
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,386
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,290
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,920
Trophies
2
XP
30,037
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,920
Trophies
2
XP
30,037
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,920
Trophies
2
XP
30,037
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
  • Psionic Roshambo @ Psionic Roshambo:
    I thought PS4/5 and Xbox One emulation would be kind of easy since they basically just a PC
  • ColdBlitz @ ColdBlitz:
    they sorta are a pc
  • K3Nv2 @ K3Nv2:
    They haslve dedicated on board chips that aren't tweaked like x64/x32 afaik
  • ColdBlitz @ ColdBlitz:
    but its a custom os for both of them
  • ColdBlitz @ ColdBlitz:
    designed for only specific hardware
  • ColdBlitz @ ColdBlitz:
    so you have to learn to emulate that specific hardware which isn't as easy as you'd think
  • K3Nv2 @ K3Nv2:
    It's a locked down Linux distro basically
  • Psionic Roshambo @ Psionic Roshambo:
    I think the only custom hardware is to do with the SSD and a security chip
  • Psionic Roshambo @ Psionic Roshambo:
    Probably combined in one chip
  • K3Nv2 @ K3Nv2:
    They place married security chips onto boards iirc
  • Psionic Roshambo @ Psionic Roshambo:
    Damn Frontier is offering 5Gbps now lol
  • K3Nv2 @ K3Nv2:
    I honestly can't recommend any of the big 3 this years I'd say buy a rog ally z1 if we're being honest
  • Psionic Roshambo @ Psionic Roshambo:
    Honestly after the PS3 and 360 I just went full PC
  • K3Nv2 @ K3Nv2:
    Every games basically cross platform they only have about 6 titles making it worth the $600 price tag
  • Psionic Roshambo @ Psionic Roshambo:
    Didn't see much need for a console, all the advantages have kind of disappeared
  • ColdBlitz @ ColdBlitz:
    the ps3 used to support installing linux because the cpu was so powerful
  • K3Nv2 @ K3Nv2:
    Then the games are $70 and they want to reboot and refresh the same game every year
  • K3Nv2 @ K3Nv2:
    The ps3 was always Linux they just found a way to make it open source
  • ColdBlitz @ ColdBlitz:
    I'm avoiding buying from the big 3 at all atm
  • Psionic Roshambo @ Psionic Roshambo:
    At one point PC game pads where poorly supported, loading a game had setup, it was complicated. Now it's almost as easy as a console.
  • ColdBlitz @ ColdBlitz:
    nintendo needs to up their game soon
  • K3Nv2 @ K3Nv2:
    Yeah even bt support for Xbox one controllers are just as easy as pairing
  • ColdBlitz @ ColdBlitz:
    considering the steamdeck can emulate the switch (yikes) theres almost 0 reason to buy the switch apart from playing online and using cartridges
  • K3Nv2 @ K3Nv2:
    Xinput and 360 dongles were a driver nightmare
  • K3Nv2 @ K3Nv2:
    I remember having to manually put in drivers and what not
    K3Nv2 @ K3Nv2: I remember having to manually put in drivers and what not