Giter VIP home page Giter VIP logo

Comments (20)

plutooo avatar plutooo commented on August 10, 2024

Did you try moving the file a few additional levels, like so:
/this/is/not/csnd/related.bin

from libctru.

Kfeavel avatar Kfeavel commented on August 10, 2024

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.

Kfeavel avatar Kfeavel commented on August 10, 2024

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.

profi200 avatar profi200 commented on August 10, 2024

You should generally not free buffers as long as they are used in any way.

from libctru.

Kfeavel avatar Kfeavel commented on August 10, 2024

@profi200, will do. Thanks for the advice.

from libctru.

mtheall avatar mtheall commented on August 10, 2024
FILE *file = fopen(audio, "rb");

What is the value of " audio"

from libctru.

Kfeavel avatar Kfeavel commented on August 10, 2024

@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.

profi200 avatar profi200 commented on August 10, 2024

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.

Kfeavel avatar Kfeavel commented on August 10, 2024

@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.

Kfeavel avatar Kfeavel commented on August 10, 2024

Also, @profi200, all of my audio code is listed above. Nothing more, nothing less.

from libctru.

yellows8 avatar yellows8 commented on August 10, 2024

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.

Kfeavel avatar Kfeavel commented on August 10, 2024

@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.

Kfeavel avatar Kfeavel commented on August 10, 2024

Found the problem. Duplicate variables in seperate classes. Even after fixing this though, the folder issue still remains.

from libctru.

yellows8 avatar yellows8 commented on August 10, 2024

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.

Kfeavel avatar Kfeavel commented on August 10, 2024

@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.

yellows8 avatar yellows8 commented on August 10, 2024

Did you ever check these values? #160 (comment)

from libctru.

Kfeavel avatar Kfeavel commented on August 10, 2024

@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.

Kfeavel avatar Kfeavel commented on August 10, 2024

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.

yellows8 avatar yellows8 commented on August 10, 2024

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.

Kfeavel avatar Kfeavel commented on August 10, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.