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,919
Trophies
2
XP
30,031
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,919
Trophies
2
XP
30,031
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,919
Trophies
2
XP
30,031
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
  • BigOnYa @ BigOnYa:
    Did you feed the hamster in your internet router? It prob died and is running slow now.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, why did you start saying my pc has a hamster in the first place?
    +1
  • BigOnYa @ BigOnYa:
    Its actua!ly just a old joke, meaning its slow. Was just kidding around with you.
    +1
  • BigOnYa @ BigOnYa:
    I bet @AncientBoi has some hamsters hidden somewhere tho....
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    I think Game streaming should work like this.... Local Hardware able the run the game fine, game engine and common assets stored locally, all FMV and music and textures could be streaming
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Some temporary storage
  • Xdqwerty @ Xdqwerty:
    also @BigOnYa im making some progress on my gdevelop project, implemented various mechanics
  • Psionic Roshambo @ Psionic Roshambo:
    They went all in on streaming, should have been more of a hybrid approach
    +1
  • BigOnYa @ BigOnYa:
    Or free government supplied high speed internet be nice also. Like Obama care. Xdqwerty that's cool, its time consuming but rewarding once done or playable, to see what you've made from scratch. Animations take forever, but worth it.
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, although the bullets are a bit buggy
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Not to mention this would be a massive pain to pirate
  • Xdqwerty @ Xdqwerty:
    @BigOnYa,
    and the visual aspect of the game is quite crude (the sprite that looks best is that of the protagonist just because he is a stickman with sunglasses)
    +1
  • BigOnYa @ BigOnYa:
    There is a bullets behaviour you assign to your character, that makes the code easier, under "behaviours"
  • Xdqwerty @ Xdqwerty:
    i meant that when the character is pointing to the right, the bullets spawn where they should, but when he is on the right, they move to the right but the spawn point is incorrect
  • BigOnYa @ BigOnYa:
    Itch.io has lots of free assets also. Under the bullets behavior tab, there is a "rotate bullets" option, can try that. Or in the code can try
    - fire bullet Player.X(PlayerDirection)
  • Xdqwerty @ Xdqwerty:
    im taking a break for today anyway
    +1
  • BigOnYa @ BigOnYa:
    YEa gotta after a while, looking at code for long periods will bug your eyes.
    +1
  • BigOnYa @ BigOnYa:
    That's cool tho, I'm proud of you going back to it, not giving up. It is difficult at first to learn, but fun once you get the hang of it. I think I've watched every tutorial video there is, but I still struggle sometimes to get stuff to work right. But gotta keep trying dif things, and eventually you will get it right.
    +1
  • K3Nv2 @ K3Nv2:
    Lol McDonald's has a grandma mcflurry
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, furry grandma?
  • BigOnYa @ BigOnYa:
    It sounds good actually, I like butterscotch
  • K3Nv2 @ K3Nv2:
    It sucked don't know wtf these little bits and pieces are they use now
    +1
    K3Nv2 @ K3Nv2: It sucked don't know wtf these little bits and pieces are they use now +1