Comments (20)
Did you try moving the file a few additional levels, like so:
/this/is/not/csnd/related.bin
from libctru.
Yes, I've tried multiple levels and it seems to only read files on higher levels. Also, here is the file reading code:
FILE *file = fopen(audio, "rb");
fseek(file, 0, SEEK_END);
off_t size = ftell(file);
fseek(file, 0, SEEK_SET);
buffer = linearAlloc(size);
off_t bytesRead = fread(buffer, 1, size, file);
fclose(file);
// Audio MUST be at bitrate 32000, in 16bit headerless PMC format for this to work.
// I'm looking at you, future themers!
CSND_SetVol(8, 1, 1);
csndPlaySound(8, SOUND_FORMAT_16BIT | SOUND_REPEAT, 44100, 1, 0, buffer, buffer, size);
linearFree(buffer);
from libctru.
I've run it using Citra-Emu and it threw a few errors, but none of them related to CSND or file reading. I'll take your suggestion though and try keeping the buffer until the sound is no longer needed.
from libctru.
You should generally not free buffers as long as they are used in any way.
from libctru.
@profi200, will do. Thanks for the advice.
from libctru.
FILE *file = fopen(audio, "rb");
What is the value of " audio"
from libctru.
@mtheall the value is "/brew/audio/themes/default/audio.bin"
EDIT: Also, that last line that everyone said to leave out ( linearFree(buffer); ), I have to have it or the audio won't play. So I guess I'm keeping it.
from libctru.
You must have some other problem in your code because it makes no difference if you free or not (except everything can allocate there and overwrite your audio data if you free the buffer).
from libctru.
@profi200 Yeah, I understand that. I'm confused as to where the code is going wrong, but even if I get the audio to play, it still won't load a file from a few levels down, like listed above. (i.e. /brew/themes/default/audio.bin)
from libctru.
Also, @profi200, all of my audio code is listed above. Nothing more, nothing less.
from libctru.
You're not checking for errors. Try printing "size" and "bytesRead"(on hardware).
"Also, that last line that everyone said to leave out ( linearFree(buffer); ), I have to have it or the audio won't play." You may have an issue elsewhere, can you gist/whatever all of your code(not just audio)?
from libctru.
@yellows8 Here ya go: https://github.com/Kfeavel/3ds_new_hb_menu
As you can tell, its just a fork of Smealum's launcher. Just trying to add more features to it (such as audio, themes and settings.)
Edit: Well, apparently it is something in my code that is cauing it to fail because it won't even load top level files now. It was working just a while ago, and I don't recall making any changes to my code. Could it be the SD card or something like that?
from libctru.
Found the problem. Duplicate variables in seperate classes. Even after fixing this though, the folder issue still remains.
from libctru.
Uh, you really shouldn't have build/ in git.
"the folder issue still remains." In the commented out code, you have this relative path: "brew/themes/default/music.bin". While in a previous comment you had an absolute path. Are you sure the file actually exists at the relative path location?
from libctru.
@yellows8 I've tried it both ways without success. The program sits on the top directory so even if it were relative, it should still yield the same results.
from libctru.
Did you ever check these values? #160 (comment)
from libctru.
@yellows8 I ran it using Citra on Windows (easier to see the log output) and it threw some warnings, but no errors. The audio played correctly on my real 3DS when I fixed the code, but the file was on the top level and not in the folder. I can re-log all the values and warning and post the results here later when I have my 3DS with me.
from libctru.
This is what Citra dumped when I ran the program for about a minute or so:
https://www.dropbox.com/s/m1ak870gqlhhhsm/output.txt?dl=0
from libctru.
None of that log is relevant to your branch, except for maybe the GetPointer one(don't know if the original hbmenu triggers that or not).
from libctru.
@yellows8 Alright, I'll set up a temporary console and log the results from an actual 3DS. I was wondering if that log pertained mostly to Citra instead of the hbmenu.
from libctru.
Related Issues (20)
- Performance issue in font.c HOT 5
- sys/lock.h: No such file or directory HOT 3
- GDB Debugging Issue: using 'c' and then pressing CTRL + C in GDB points to wrong file HOT 2
- How to easily play sound effects with ndsp?
- romfsMountFromTitle error HOT 1
- nfcCmd21 / nfcCmd22 HOT 2
- Memory access out-of-bounds while using std::cout HOT 1
- MEMREGION_APPLICATION : MemRegionUsed and MemRegionSize return the same value, MemRegionFree returns 0 HOT 1
- If homebrew is launched directly after NSMB 2, GPU commands aren't being executed anymore HOT 1
- Where is sockaddr_in6 defined? HOT 4
- Global macros clash with other things
- Socket connections fail to work if DHCP just assigned IP this boot HOT 3
- Latest libctru makes app crash on exit HOT 1
- shaderInstanceInit doesn't initialize numFloat24Uniforms if no constant table is present
- Document alignment requirements for ndspWaveBuf
- DmaConfig's DmaDeviceConfig flags and structure reversed in terms of src/dst
- PTM:CheckNew3DS is wrong
- NDSP apparently over-reads data on short sound effects
- GPU Command Buffer Causes Crash When Filled/Overran HOT 1
- 1. In included file: 'sys/lock.h' file not found [pp_file_not_found] HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libctru.