Reply to thread
GBAtemp.net - The Independent Video Game Community
Search
Search titles only
By:
Search titles only
By:
Reply to thread
GBAtemp.net - The Independent Video Game Community
Home
Log in
Terms & Rules
Donate
Forums
New posts
Search forums
Groups
Public Events
New
New posts
New resources
New blog entries
New profile posts
New blog entry comments
New threadmarks
Latest activity
Cheats
Cheat Codes Add and Request group
The Legend of Zelda: Tears of the Kingdom cheat codes
Pokémon Legends: Arceus cheat codes
Xenoblade Chronicles 3 cheat codes
Fire Emblem Engage cheat codes
Request a cheat...
Tutorials
Nintendo Switch tutorials
Nintendo 3DS tutorials
Nintendo Wii U tutorials
Reviews
Overview
Official reviews
User reviews
Downloads
Latest reviews
Search resources
Blogs
New entries
New comments
Blog list
Search blogs
Chat
Top chatters
Search
Search titles only
By:
Search titles only
By:
Log in
Register
New posts
Search forums
Log in
Register
Home
Forums
PC, Console & Handheld Discussions
Nintendo 3DS
I need help - Homebrew Audio Examples
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="LionMemess" data-source="post: 8177196" data-attributes="member: 458945"><p>its a wav file. all i plan to do is make the wav file play when an event happens and make it stop playing when an event happens, if i take the ndsp-example from curryguy on github, cant post link cus im new</p><p></p><p>a bunch of errors come up, this isnt because lack of import files but mainly i have no clue</p><p></p><p>if you want ill show you the compiler errors later but rn i need to know because this is really sad xd</p><p></p><p>[MERGED]auto[/MERGED]</p><p></p><p>btw heres the ndsp example.</p><p>[SPOILER]</p><p>[CODE]</p><p>#include <3ds.h></p><p>#include <stdio.h></p><p>#include <string.h></p><p>#include <stdlib.h></p><p>#include <time.h></p><p></p><p>int main(int argc, char* argv[])</p><p>{</p><p> gfxInitDefault();</p><p> </p><p> consoleInit(GFX_TOP, nullptr);</p><p> </p><p> // The dsp channel number</p><p> constexpr int channel = 1;</p><p> </p><p> u32 sampleRate;</p><p> u32 dataSize;</p><p> u16 channels;</p><p> u16 bitsPerSample;</p><p> </p><p> // Initialize ndsp</p><p> ndspInit();</p><p> </p><p> ndspSetOutputMode(NDSP_OUTPUT_STEREO);</p><p> ndspSetOutputCount(1); // Num of buffers</p><p> </p><p> // Reading wav file</p><p> FILE* fp = fopen("./example.wav", "rb");</p><p> </p><p> if(!fp)</p><p> {</p><p> printf("Could not open the example.wav file.\n");</p><p> return 1;</p><p> }</p><p> </p><p> char signature[4];</p><p> </p><p> fread(signature, 1, 4, fp);</p><p> </p><p> if( signature[0] != 'R' &&</p><p> signature[1] != 'I' &&</p><p> signature[2] != 'F' &&</p><p> signature[3] != 'F')</p><p> {</p><p> printf("Wrong file format.\n");</p><p> fclose(fp);</p><p> return 1;</p><p> }</p><p> </p><p> fseek(fp, 40, SEEK_SET);</p><p> fread(&dataSize, 4, 1, fp);</p><p> fseek(fp, 22, SEEK_SET);</p><p> fread(&channels, 2, 1, fp);</p><p> fseek(fp, 24, SEEK_SET);</p><p> fread(&sampleRate, 4, 1, fp);</p><p> fseek(fp, 34, SEEK_SET);</p><p> fread(&bitsPerSample, 2, 1, fp);</p><p> </p><p> if(dataSize == 0 || (channels != 1 && channels != 2) ||</p><p> (bitsPerSample != 8 && bitsPerSample != 16))</p><p> {</p><p> printf("Corrupted wav file.\n");</p><p> fclose(fp);</p><p> return 1;</p><p> }</p><p> </p><p> // Allocating and reading samples</p><p> u8* data = static_cast<u8*>(linearAlloc(dataSize));</p><p> </p><p> if(!data)</p><p> {</p><p> fclose(fp);</p><p> return 1;</p><p> }</p><p> </p><p> fseek(fp, 44, SEEK_SET);</p><p> fread(data, 1, dataSize, fp);</p><p> fclose(fp);</p><p> </p><p> // Find the right format</p><p> u16 ndspFormat;</p><p> </p><p> if(bitsPerSample == 8)</p><p> {</p><p> ndspFormat = (channels == 1) ?</p><p> NDSP_FORMAT_MONO_PCM8 :</p><p> NDSP_FORMAT_STEREO_PCM8;</p><p> }</p><p> else</p><p> {</p><p> ndspFormat = (channels == 1) ?</p><p> NDSP_FORMAT_MONO_PCM16 :</p><p> NDSP_FORMAT_STEREO_PCM16;</p><p> }</p><p> </p><p> ndspChnReset(channel);</p><p> ndspChnSetInterp(channel, NDSP_INTERP_NONE);</p><p> ndspChnSetRate(channel, float(sampleRate));</p><p> ndspChnSetFormat(channel, ndspFormat);</p><p> </p><p> // Create and play a wav buffer</p><p> ndspWaveBuf waveBuf;</p><p> std::memset(&waveBuf, 0, sizeof(ndspWaveBuf));</p><p> </p><p> waveBuf.data_vaddr = reinterpret_cast<u32>(data);</p><p> waveBuf.nsamples = dataSize / (bitsPerSample >> 3);</p><p> waveBuf.looping = true; // Loop enabled</p><p> waveBuf.status = NDSP_WBUF_FREE;</p><p> </p><p> DSP_FlushDataCache(data, dataSize);</p><p> </p><p> ndspChnWaveBufAdd(channel, &waveBuf);</p><p> </p><p> while(aptMainLoop())</p><p> {</p><p> hidScanInput();</p><p> </p><p> u32 keys = hidKeysDown();</p><p> </p><p> if(keys & KEY_START)</p><p> break;</p><p> </p><p> gfxFlushBuffers();</p><p> gfxSwapBuffers();</p><p> gspWaitForVBlank();</p><p> }</p><p> </p><p> ndspChnWaveBufClear(channel);</p><p> </p><p> linearFree(data);</p><p> </p><p> gfxExit();</p><p> ndspExit();</p><p> </p><p> return 0;</p><p>}</p><p>[CODE]</p><p>[SPOILER]</p><p></p><p>and if you compile that with the make command in devkitpro u get errors[/CODE][/SPOILER]</p><p></p><p>[MERGED]auto[/MERGED]</p><p></p><p>if u compile that u get errors for like no reason. Remember im trying out all sorts of examples to make it work and none of them work</p><p></p><p>[MERGED]auto[/MERGED]</p><p></p><p>cant show a screenie cus im new ;-;</p></blockquote><p></p>
[QUOTE="LionMemess, post: 8177196, member: 458945"] its a wav file. all i plan to do is make the wav file play when an event happens and make it stop playing when an event happens, if i take the ndsp-example from curryguy on github, cant post link cus im new a bunch of errors come up, this isnt because lack of import files but mainly i have no clue if you want ill show you the compiler errors later but rn i need to know because this is really sad xd [MERGED]auto[/MERGED] btw heres the ndsp example. [SPOILER] [CODE] #include <3ds.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> int main(int argc, char* argv[]) { gfxInitDefault(); consoleInit(GFX_TOP, nullptr); // The dsp channel number constexpr int channel = 1; u32 sampleRate; u32 dataSize; u16 channels; u16 bitsPerSample; // Initialize ndsp ndspInit(); ndspSetOutputMode(NDSP_OUTPUT_STEREO); ndspSetOutputCount(1); // Num of buffers // Reading wav file FILE* fp = fopen("./example.wav", "rb"); if(!fp) { printf("Could not open the example.wav file.\n"); return 1; } char signature[4]; fread(signature, 1, 4, fp); if( signature[0] != 'R' && signature[1] != 'I' && signature[2] != 'F' && signature[3] != 'F') { printf("Wrong file format.\n"); fclose(fp); return 1; } fseek(fp, 40, SEEK_SET); fread(&dataSize, 4, 1, fp); fseek(fp, 22, SEEK_SET); fread(&channels, 2, 1, fp); fseek(fp, 24, SEEK_SET); fread(&sampleRate, 4, 1, fp); fseek(fp, 34, SEEK_SET); fread(&bitsPerSample, 2, 1, fp); if(dataSize == 0 || (channels != 1 && channels != 2) || (bitsPerSample != 8 && bitsPerSample != 16)) { printf("Corrupted wav file.\n"); fclose(fp); return 1; } // Allocating and reading samples u8* data = static_cast<u8*>(linearAlloc(dataSize)); if(!data) { fclose(fp); return 1; } fseek(fp, 44, SEEK_SET); fread(data, 1, dataSize, fp); fclose(fp); // Find the right format u16 ndspFormat; if(bitsPerSample == 8) { ndspFormat = (channels == 1) ? NDSP_FORMAT_MONO_PCM8 : NDSP_FORMAT_STEREO_PCM8; } else { ndspFormat = (channels == 1) ? NDSP_FORMAT_MONO_PCM16 : NDSP_FORMAT_STEREO_PCM16; } ndspChnReset(channel); ndspChnSetInterp(channel, NDSP_INTERP_NONE); ndspChnSetRate(channel, float(sampleRate)); ndspChnSetFormat(channel, ndspFormat); // Create and play a wav buffer ndspWaveBuf waveBuf; std::memset(&waveBuf, 0, sizeof(ndspWaveBuf)); waveBuf.data_vaddr = reinterpret_cast<u32>(data); waveBuf.nsamples = dataSize / (bitsPerSample >> 3); waveBuf.looping = true; // Loop enabled waveBuf.status = NDSP_WBUF_FREE; DSP_FlushDataCache(data, dataSize); ndspChnWaveBufAdd(channel, &waveBuf); while(aptMainLoop()) { hidScanInput(); u32 keys = hidKeysDown(); if(keys & KEY_START) break; gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForVBlank(); } ndspChnWaveBufClear(channel); linearFree(data); gfxExit(); ndspExit(); return 0; } [CODE] [SPOILER] and if you compile that with the make command in devkitpro u get errors[/CODE][/SPOILER] [MERGED]auto[/MERGED] if u compile that u get errors for like no reason. Remember im trying out all sorts of examples to make it work and none of them work [MERGED]auto[/MERGED] cant show a screenie cus im new ;-; [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
PC, Console & Handheld Discussions
Nintendo 3DS
I need help - Homebrew Audio Examples
General chit-chat
Help
Users
Settings
Notifications
Miscellaneous
Inverse message direction
Display editor on top
Enable maximized mode
Display images as links
Hide bot messages
Hide statuses
Hide chatter list
Show messages from ignored users
Temporarily disable chat
Receive mention alerts
Sound notifications
Normal messages
Private messages
Whisper messages
Mention messages
Bot messages
Desktop notifications
Normal messages
Private messages
Whisper messages
Mention messages
Bot messages
Options
Options
View top chatters
No one is chatting at the moment.
@
BakerMan
:
you go bro
+1
Today at 2:59 AM
@
BakerMan
:
i know, i know, i'm late
Today at 2:59 AM
@
Sicklyboy
:
@BigOnYa
, I'll rip a bag off my Volcano to that, brother
+2
Today at 3:01 AM
@
a_username_that_is_cool
:
DDDS . Dual Developer Dedede System
+1
Today at 3:02 AM
@
BakerMan
:
also happy birthday
@Xdqwerty
+1
Today at 4:13 AM
@
MysticStarlight
:
Hello
Today at 5:30 AM
@
BigOnYa
:
Is it me you're looking for?
Today at 5:32 AM
@
MysticStarlight
:
'Cause I wonder where you are
Today at 5:34 AM
@
MysticStarlight
:
wait I got the lyrics mixed up
+1
Today at 5:35 AM
@
BigOnYa
:
And I wonder what you do...Lol
Today at 5:35 AM
@
BigOnYa
:
Its all good, I'm here to talk to you.
Today at 5:37 AM
@
BigOnYa
:
Hello
Today at 5:39 AM
@
MysticStarlight
:
It's me
+1
Today at 5:43 AM
@
BigOnYa
:
I've been playing fallout4 all day, I went into a elevator and it kept going, never stopped, waited 5 minutes, must of been a bug. How bout you, whatcha do today?
+1
Today at 5:43 AM
@
MysticStarlight
:
I'm wondering why a stray tuxedo cat has a cloudy eye
Today at 5:45 AM
@
MysticStarlight
:
I've been playing TOTK all day also
+1
Today at 5:46 AM
@
MysticStarlight
:
Oh you reminded me of those elevator nightmares
Today at 5:47 AM
@
BigOnYa
:
Awesome game, fun how they force you to build, but you can build as you want
Today at 5:47 AM
@
MysticStarlight
:
It is super fun, I actually prefer it over BoTW
+1
Today at 5:48 AM
@
BigOnYa
:
The guy holding the sign always cracked me up, esp when you fail, and it falls
Today at 5:48 AM
@
MysticStarlight
:
Ah yes, that guy lol. I still need to find all his signs. The game has a lot to do though so I don't know what to finish first
Today at 5:50 AM
@
MysticStarlight
:
I'm 120 hours in and am still like 44.4% done
+1
Today at 5:51 AM
@
BigOnYa
:
Good times. Building is starting to get good around now for you. You making me want to make run thru again.
Today at 5:52 AM
@
BigOnYa
:
Ok good chatting, enjoy your gaming, and avoid the lightning, or put your sword away. Good night.
Today at 6:02 AM
@
Veho
:
https://i.imgur.com/E1U7Nlt.mp4
+1
46 minutes ago
Submit
@
Veho
:
https://i.imgur.com/E1U7Nlt.mp4
+1
46 minutes ago
Chat
0