Help with sound/music in homebrew app development

Eguin

Active Member
OP
Newcomer
Joined
Apr 23, 2018
Messages
36
Trophies
0
Age
23
XP
120
Country
United States
Hey, I recently got into making homebrew wii apps and am having trouble adding sounds into the game.
I tried following this old tutorial on codemii http://www.codemii.com/2009/04/21/tutorial-12-using-mod-music-sound/#more-509 but I can't seem to get the libraries working correctly. I get the error message
Code:
/home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.3.1/libmodplay/gcmodplay.c:80: undefined reference to `AESND_SetVoiceBuffer'
I tried adding -laesnd which stops the error but still doesn't play make the header file for the music.

I also tried using an old wrapper called MLib but it's also like a decade old and I can't seem to get it working.

Does anyone have any advice or suggestions on getting music into the game?
 
  • Like
Reactions: newo

Eguin

Active Member
OP
Newcomer
Joined
Apr 23, 2018
Messages
36
Trophies
0
Age
23
XP
120
Country
United States
Update:
I found information on using ASND and MP3Player but it doesn't seem to be working.
I added
Code:
-lmodplay -lmad -lasnd
to the libs as well as
Code:
#---------------------------------------------------------------------------------
# This rule links in binary data with the .mp3 extension
#---------------------------------------------------------------------------------
%.mp3.o    %_mp3.h :    %.mp3
#---------------------------------------------------------------------------------
    @echo $(notdir $<)
    $(bin2o)

-include $(DEPENDS)
at the bottom of the maker file


in the source code I added
Code:
#include <asndlib.h>
#include <mp3player.h>
#include "test_mp3.h"

and in the main function (before the main while loop) I have
Code:
    ASND_Init();
    MP3Player_Init();
    MP3Player_Volume(255);

    MP3Player_PlayBuffer(test_mp3, test_mp3_size, NULL);
    ASND_Pause(0);

and in the same directory as the maker file I have a folder called "data" with "test.mp3" in it
I don't have any errors when I compile but when I launch the game no sound is actually played. I know that it at least thinks it's playing since if I do MP3Player_IsPlaying() it returns true.

I am using dolphin emulator to test
 
  • Like
Reactions: newo

Eguin

Active Member
OP
Newcomer
Joined
Apr 23, 2018
Messages
36
Trophies
0
Age
23
XP
120
Country
United States
Ok I got it! This is just for the future in case anyone is interested. I'm not 100% sure what the issue is but the sound works perfectly fine when I play on a modded wii, on dolphin emulator it seems to not play at all. There may be settings you can tweak or something when using dolphin but I highly recommend that if you're planning to play an original hardware anyway then it might be helpful to test on the original wii (at least just for the audio, for the stuff that works with an emulator it makes sense to test on that since you won't have to go back and fourth mid development)

EDIT: at least for me I was able to get the sound working on dolphin by going into the audio settings and changing it to LLE. Makes it a lot easier for development.
 
Last edited by Eguin,
  • Like
Reactions: newo

ToothyNom

Member
Newcomer
Joined
Nov 10, 2021
Messages
20
Trophies
0
Age
25
XP
65
Country
Ireland
Hi there, I've been trying to get into homebrew wii app development but I can't really find any good tutorials. Could you recommend any you've used?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
34,318
Trophies
2
Website
trastindustries.com
XP
23,396
Country
United Kingdom
Hi there, I've been trying to get into homebrew wii app development but I can't really find any good tutorials. Could you recommend any you've used?
For the most part it is probably going to be a "pull yourself up by your bootstraps" type scenario. I will skip over the hacking aspects for now (I assume you are not wanting to get into CIOS, CMIOS/GC backwards compatibility, WAD installer/manglement, firmeware modding and the like) and assume you have enough installed there ( https://sites.google.com/site/completesg/ ).

As mentioned above then devkitpro, specifically the devkitppc part of it, is the main thing used for C, C++ and assembly (an odd PowerPC setup for most purposes -- some of the CIOS stuff will go into ARM territory) development. C++ is reasonably useful here as well (a lot of things in the handheld world if they had it at all were more proof of concept) but you will still suffer some overhead issues.
Hopefully you are already reasonably familiar with the general case for those languages of around the time they were released -- not too Windows API bound or too focused on the more modern stuff (if you can do the crazy older stuff then you are probably good enough to reskill for this without my help).
The other runtimes for other languages, Wiipy ( https://wiibrew.org/wiki/WiiPy ) and Lua for Wii ( https://wiibrew.org/wiki/Lua_for_Wii ) doing python and Lua respectively, but how much you care to use those I don't know. Unlike the DS and various other devices active around the same time I did not see as much interesting stuff for Lua on the Wii. There are also various libraries -- some will be aimed more at Linux (for which there are Wii versions, which come with the perk of being all that Linux usually has and probably a bunch of other languages too) but others like SDL are more known in game development circles.

Beyond that devkitpro usually ships with examples that are widely respected.
You can also grab homebrew that was released as open source and get that going on, though I will note one of the issues with devkitpro is their insistence on only the newest versions being available (to the point of taking some very dubious legal actions to remove older versions that upset many in the homebrew scene. You might still find older versions though) and there are a great many cases of older homebrew needing some not inconsiderable work to recompile on newer versions of it.

For other consoles we do have some guides that hold your hand through not only hello world but also the basic libraries and limitations thereof. I don't really have anything, not even a mediocre thing that risks more harm than good, for the wii though beyond what you might find on wiibrew https://wiibrew.org/wiki/Main_Page, in the examples, and in existing source code ( https://pdroms.de/news/nintendo-wii for a start on wii homebrew things).

At this point I am linking favourite topics in game design https://docs.google.com/document/d/1iNSQIyNpVGHeak6isbP6AHdHD50gs8MNXF1GCf08efg/pub or general C family coding tutorials so I will leave it there.
 
  • Like
Reactions: newo and ToothyNom

Eguin

Active Member
OP
Newcomer
Joined
Apr 23, 2018
Messages
36
Trophies
0
Age
23
XP
120
Country
United States
Hi there, I've been trying to get into homebrew wii app development but I can't really find any good tutorials. Could you recommend any you've used?
Ok I am in no way an expert, I'm quite a beginner actually. So what I'm about to say is what I personally found helpful. It's very possible there are better methods/resources out there that I'm unfamiliar with so take everything I say with a grain of salt.

I used devkitpro with C (not C++), devkit pro obviously has been integral and I literally couldn't have done anything without it. To start I followed this tutorial: http://www.codemii.com/category/wii-programming-tutorials/page/2/
It's definitely old and could benefit from an update. In addition I think some of the methods they use, like how they track where objects on the screen are, could be made better, but it's good for learning the basic and how to get started.
For graphics I old did 2D but I very much did not like the graphics from that tutorial and instead used GRRLIB: https://grrlib.github.io/GRRLIB/index.html
there's a bit of a learning curve for it (at least for me) but it made drawing png's to screen muchhhhh simpler than it was before it addition it made tracking objects on the screen pretty consistent. It helps to have this companion app: https://wiibrew.org/wiki/WiiBuilder
it makes generating png header files really simple.

This thread: http://forum.wiibrew.org/read.php?11,20240
and this example: https://github.com/devkitPro/wii-examples/blob/master/audio/mp3player/source/template.c
helped me a lot with the audio

In dolphin in order to get this audio to work though you need to go into the audio settings and change it to LLE, then it should work (I found this out like an hour ago lol).


It may seem pretty daunting at first and tbh it kinda is, but once you get used to all the different libraries and such it gets into a flow and it's quite fun imo to make a game in such a low level language like C, plus I love the Wii :P

lmk if you have any questions, idk if I can answer them for sure but I can try my best
 
  • Like
  • Love
Reactions: newo and ToothyNom

newo

Well-Known Member
Member
Joined
Apr 7, 2011
Messages
714
Trophies
1
Website
wiibrew.org
XP
2,446
Country
Jamaica
actually I have never gotten audio or dynamic loading of assets to work on dolphin. My dev workflow is just to compile +run+send to wii that I have hooked up to a tv behind me.
 

Eguin

Active Member
OP
Newcomer
Joined
Apr 23, 2018
Messages
36
Trophies
0
Age
23
XP
120
Country
United States
actually I have never gotten audio or dynamic loading of assets to work on dolphin. My dev workflow is just to compile +run+send to wii that I have hooked up to a tv behind me.
I was doing that originally but sometimes when I had minor bugs it was quite annoying to have to go back and fourth when I just used an = instead of == or something.
But of course if you find it easier then whatever is best for you!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    KennieDaMeanie @ KennieDaMeanie: https://piunikaweb.com/2022/01/15/nvidia-shield-tv-plex-and-other-apps-not-working-after-android-...