Examples of using Echo with SGDK?
Moderator: Stef
-
- Newbie
- Posts: 5
- Joined: Mon Nov 18, 2013 10:42 pm
- Location: Germany
Examples of using Echo with SGDK?
Hello,
I'm trying to figure out how to make Echo work with SGDK and it's certainly not easy. Trying to include and compiling it is not easy as well, not only the missing stdint.h is causing trouble but I get weird compiler errors when I include it (for example .h files from recourses suddently do not recognise the datatype "u8"). Also all these C abstractions like void pointers sometimes give me headaches as well, in my opinion pointers are a lot easier to use in assembly because there is not so much stuff going on in the background.
I'm still relatively new to SGDK but I wanted to start with the sound/music because I tought that this field is usually causing the most trouble (and I was right). I can't use SGDKs internal drivers because they're just too slow for my needs (I need PCM for the drums because otherwise they sound horrible), I'm stuck with MIDIs here and there is only a midi2vgm converter (VGMGen) and nothing else.
If someone could link me to a tutorial, give me an example or explain this stuff to me, I would greatly appreciate it.
Also, please note that I'm not trying to programm a demo or anything, I'm trying to make a game.
I'm trying to figure out how to make Echo work with SGDK and it's certainly not easy. Trying to include and compiling it is not easy as well, not only the missing stdint.h is causing trouble but I get weird compiler errors when I include it (for example .h files from recourses suddently do not recognise the datatype "u8"). Also all these C abstractions like void pointers sometimes give me headaches as well, in my opinion pointers are a lot easier to use in assembly because there is not so much stuff going on in the background.
I'm still relatively new to SGDK but I wanted to start with the sound/music because I tought that this field is usually causing the most trouble (and I was right). I can't use SGDKs internal drivers because they're just too slow for my needs (I need PCM for the drums because otherwise they sound horrible), I'm stuck with MIDIs here and there is only a midi2vgm converter (VGMGen) and nothing else.
If someone could link me to a tutorial, give me an example or explain this stuff to me, I would greatly appreciate it.
Also, please note that I'm not trying to programm a demo or anything, I'm trying to make a game.
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
These might be helpful to you, when I was working with SGDK+Echo:
viewtopic.php?p=16160
This is a post where I listed the steps involved in getting data into Echo:
viewtopic.php?p=16104#16104
viewtopic.php?p=16160
This is a post where I listed the steps involved in getting data into Echo:
viewtopic.php?p=16104#16104
-
- Newbie
- Posts: 5
- Joined: Mon Nov 18, 2013 10:42 pm
- Location: Germany
I already read some of your threads, when I was searching for a solution before.
Didn't help me though.
To make these lines of code work I have to include genesis.h in echo.c, however if I do so, I get a ton of weird compiler errors sooner or later (like I said, .h files from recourses suddenly don't recognise data types). Don't ask me why but that has happened to me. The SGDK compiler isn't very helpful with it's error messages either.
I didn't have much trouble trying to figure out how to convert stuff (I'm not going to use any tracker anyway) but more with the usage of echo itself as a C library (hence why I asked for a fully-fledged example). Also I read something about errors that occur when your recourses are on adresses bigger than 0x8000, I wonder how things are supposed work out, when you have a lot music files. I've read your post about the instrument lists as well, that one piece of code was even more confusing. Why does everything always have to be so compliated? :S
Gives me the feeling that this would be even easier to implement in assembly because you have more control over the things you want to do and there isn't so much weird stuff going on in the background.
Didn't help me though.
Code: Select all
#define uint8_t u8
#define uint16_t u16
#define uint32_t u32
#define int8_t s8
#define int16_t s16
#define int32_t s32
I didn't have much trouble trying to figure out how to convert stuff (I'm not going to use any tracker anyway) but more with the usage of echo itself as a C library (hence why I asked for a fully-fledged example). Also I read something about errors that occur when your recourses are on adresses bigger than 0x8000, I wonder how things are supposed work out, when you have a lot music files. I've read your post about the instrument lists as well, that one piece of code was even more confusing. Why does everything always have to be so compliated? :S
Gives me the feeling that this would be even easier to implement in assembly because you have more control over the things you want to do and there isn't so much weird stuff going on in the background.
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
You can also try to get in touch with sikthehedgehog and Oerg688, see if they can help you.
Unfortunately, you won't find any tutorials. The community's pretty small so it's not as well served as, say, nesdev. Not a lot of people have been asking about or using Echo. You'll have to muddle your way through until you figure it out.
Unfortunately, you won't find any tutorials. The community's pretty small so it's not as well served as, say, nesdev. Not a lot of people have been asking about or using Echo. You'll have to muddle your way through until you figure it out.
-
- Newbie
- Posts: 5
- Joined: Mon Nov 18, 2013 10:42 pm
- Location: Germany
After many hours of frustration and trying destroy my computer euqipment, I've managed to make (most stuff) work.
main.c
It's really important that you copy echo.c and echo.h, echoblob.h into the same folder as your project, otherwise you might get compiler errors. Include echo.h in your main.h. Edit echo.h and replace #include <stdint.h> with #include "echoblob.h".
Replace ther following code in echo.c:
with:
Copy the following code into main.h:
Also don't forget to add test-flute.esf (rename it to testflute.esf) and flute.eif to your project.
Everything should work now.
The driver is fine for everything not using samples though.
main.c
Code: Select all
#include "main.h"
int main(void)
{
// Initialize Echo
echo_init(Instruments); // Load Instruments
echo_set_pcm_rate(4); // Default PCM Rate
echo_play_bgm(testflute); // Play your Song
JOY_init();
// Mainloop
while(1)
{
// Wait for screen refresh
VDP_waitVSync();
}
// This will never be reached :(
return(0);
}
Replace ther following code in echo.c:
Code: Select all
#include <stdint.h>
#include "echoblob.h"
#include "echo.h"
Code: Select all
#include "main.h"
Code: Select all
#include "testflute.esf"
#include "flute.eif"
static const void* const Instruments[] =
{
flute,
NULL
};
Everything should work now.
And I can tell you that it will stay that way, aslong as nobody is going to write any tutorials or give atleast examples about the most basic things of Megadrive development. :/djcouchycouch wrote:Unfortunately, you won't find any tutorials. The community's pretty small so it's not as well served as, say, nesdev.
The problem with that is, that it's not fast enough for my needs. Songs with samples are pretty slow using the VGM driver.kubilus1 wrote:The VGM driver in SGDK can do PCM, but is limited to 8kHZ samples. The nice thing about that is you simply need to:
SND_startPlay_VGM(yoursong)
The driver is fine for everything not using samples though.
Yeah, there a couple different ways that PCM samples are represented in VGM files. One way is much less efficient and tends to have the samples play way too slowly with the VGM player in SGDK.The problem with that is, that it's not fast enough for my needs. Songs with samples are pretty slow using the VGM driver.
The driver is fine for everything not using samples though.
I have been working on a program to convert the inefficient format to the more efficient format. This actually results in much smaller files as well.
It sounds like you have Echo up and going, though, so that should do well for you.
aouch...it's rude edit : difficult to hear thatS. P. Gardebiter wrote:And I can tell you that it will stay that way, aslong as nobody is going to write any tutorials or give atleast examples about the most basic things of Megadrive development. :/djcouchycouch wrote:Unfortunately, you won't find any tutorials. The community's pretty small so it's not as well served as, say, nesdev.
did you follow the SGDK tutorial ?
and no, sorry, Echo isn't basic thing.
It took perhaps 10 years to get this driver....
Last edited by KanedaFr on Fri Nov 29, 2013 11:30 pm, edited 1 time in total.
-
- Newbie
- Posts: 5
- Joined: Mon Nov 18, 2013 10:42 pm
- Location: Germany
Good to know. But what I mean is, for example, that is one of the pieces of information that is really hard to find.kubilus1 wrote:Yeah, there a couple different ways that PCM samples are represented in VGM files. One way is much less efficient and tends to have the samples play way too slowly with the VGM player in SGDK.
I'm sorry, this wasn't directed at Stef or anyone helping him. I think you did a great job and gave the community a lot but the community has to give something back and help with the project, in my opinion.KanedaFr wrote:aouch...it's rude
I'm not going to grumble about something and then do nothing anyway, in fact I already offered Stef my help and I hope that that Stef has no problem with me being a bit too straightforward sometimes (you don't want to see me when I'm programming and things don't work, I'm like a freaking vulcano sometimes).
A lot of it, yeah. Problem is that it mostly cover graphics stuff only. I had a lot problems getting stuff to work and got weird errors and that is because I didn't knew that you have to put sources, headers and resources into specific directories to make it work.KanedaFr wrote:difficult to hear that
did you follow the SGDK tutorial ?
There were other subtle things as well, that made me kinda frustrated.
It's all good though, I know about this stuff now and here I am to deliever it to posterity.
Ah, I think you got me wrong there. I wasn't refering to Echo but to music playback with PCMs and other stuff, that isn't there in the basic tutorial. With the VGM driver you can't also play SFX at the same time, as far as I know (if that's outdated information, then sorry), wouldn't you call this basic functionality?KanedaFr wrote:and no, sorry, Echo isn't basic thing.
It took perhaps 10 years to get this driver....
If you think that what is needed is tutorials, then write some tutorials. That's kind of how this whole open source community project stuff works. You have an itch so you scratch it.
When you say that the community needs to give back, I'm just very confused by that statement. *This* is the community, or at least a decent part of the Genesis development community. You have a lot of people on here that spend their time to learn and development for a discontinued platform. We give back when we answer questions to people on the forums, or when KanedaFr spends resources to keep this site going, or Stef works on SGDK, or TmEE works on awesome sound stuff, and many other people show the projects they are working on or share the code snippets they are struggling with.
I joined this community about a year ago. I wanted to be able to develop on Linux so I took a lot of the awesome work by Chilly Willy and packaged it up to make the build environment setup a bit easier. I then put that code out into the wild for others to use, and give feedback on. I wanted a way to play tunes created in Deflemask without using up the main CPU so I wrote the Z80 VGM driver (based off some code by Sigflup). Stef then incorporated that into SGDK.
I want to add sound FX support to the driver as well at some point, but I'm also working on quite a number of other projects. Some related to making it simpler to program with the SGDK kit, and some others completely unrelated to anything I would post on here. Plus, real life and work.
My point is, I had a particular itch, so I scratched it. I didn't expect some else to do so for me, and I learned quite a bit in the process.
When you say that the community needs to give back, I'm just very confused by that statement. *This* is the community, or at least a decent part of the Genesis development community. You have a lot of people on here that spend their time to learn and development for a discontinued platform. We give back when we answer questions to people on the forums, or when KanedaFr spends resources to keep this site going, or Stef works on SGDK, or TmEE works on awesome sound stuff, and many other people show the projects they are working on or share the code snippets they are struggling with.
I joined this community about a year ago. I wanted to be able to develop on Linux so I took a lot of the awesome work by Chilly Willy and packaged it up to make the build environment setup a bit easier. I then put that code out into the wild for others to use, and give feedback on. I wanted a way to play tunes created in Deflemask without using up the main CPU so I wrote the Z80 VGM driver (based off some code by Sigflup). Stef then incorporated that into SGDK.
I want to add sound FX support to the driver as well at some point, but I'm also working on quite a number of other projects. Some related to making it simpler to program with the SGDK kit, and some others completely unrelated to anything I would post on here. Plus, real life and work.
My point is, I had a particular itch, so I scratched it. I didn't expect some else to do so for me, and I learned quite a bit in the process.
-
- Very interested
- Posts: 75
- Joined: Sun Jan 04, 2015 10:27 pm
- Location: Pennsylvania
- Contact:
Some errors
Read this thread in order to port my Echo engine from a cancelled BEX project to SGDK, but had some problems.S. P. Gardebiter wrote:After many hours of frustration and trying destroy my computer euqipment, I've managed to make (most stuff) work.
SNIP
Copy the following code into main.h:
Also don't forget to add test-flute.esf (rename it to testflute.esf) and flute.eif to your project.Code: Select all
#include "testflute.esf" #include "flute.eif" static const void* const Instruments[] = { flute, NULL };
Everything should work now.
Not to necrobump, but the #include'ing of the .esf and .eif files technically should not work under C. When I tried that in Code::Blocks, I kept getting compiler errors of "stray ‘\[insert octal code of ASCII character]’ in program. This is because the #include command parses the file in question as a C file in order to find more source code. Since .eif and .esf are binary data files, the compiler tries to parse non-sense and unprintable ASCII characters as C code . Just to point that out to somebody else who finds this thread useful and is confused why that part of the guide is not working...
Instead, I used the latest version of SGDK's ResComp to compile those .esf/.eif/.ewf echo files and to create a .s and a .h file. Create a .res file, with for each echo file "BIN", "[Pointer variable Name to file]", and "[relative echo file path]"; i.e,:
Code: Select all
File: mus.res
BIN sfx_01 "music/s_01.esf"
BIN PCM_01 "pcm/s_HiLite.ewf"
BIN FM_1_01 "fm/1_01.eif"
[ETC]
Code: Select all
#include "echo.h"
#include "[compiled resource file.h]"
static const nullptr const Instruments[] =
{
[Insert array list of file pointer names for instruments in order; ex: sfx_01
};
SGDK homebrew dev and Unity3D Indie dev.
Sega does what Nintendont!
Sega does what Nintendont!
What are you looking for ?
Play a song ?
https://bitbucket.org/SpritesMind/genre ... o.c?at=dev
Play a sfx ?
https://bitbucket.org/SpritesMind/genre ... c.c?at=dev
I'm using this driver
https://bitbucket.org/SpritesMind/genre ... ls/?at=dev
with this binary
https://bitbucket.org/SpritesMind/genre ... bin?at=dev
also available at Sik's page
https://github.com/sikthehedgehog/Echo/ ... ster/built
To play a Echo song or sfx isn't that difficult...
To CREATE a Echo song or sfx is another story....
Play a song ?
https://bitbucket.org/SpritesMind/genre ... o.c?at=dev
Play a sfx ?
https://bitbucket.org/SpritesMind/genre ... c.c?at=dev
I'm using this driver
https://bitbucket.org/SpritesMind/genre ... ls/?at=dev
with this binary
https://bitbucket.org/SpritesMind/genre ... bin?at=dev
also available at Sik's page
https://github.com/sikthehedgehog/Echo/ ... ster/built
To play a Echo song or sfx isn't that difficult...
To CREATE a Echo song or sfx is another story....
Thanks i think I got it.KanedaFr wrote:What are you looking for ?
Play a song ?
https://bitbucket.org/SpritesMind/genre ... o.c?at=dev
Play a sfx ?
https://bitbucket.org/SpritesMind/genre ... c.c?at=dev
I'm using this driver
https://bitbucket.org/SpritesMind/genre ... ls/?at=dev
with this binary
https://bitbucket.org/SpritesMind/genre ... bin?at=dev
also available at Sik's page
https://github.com/sikthehedgehog/Echo/ ... ster/built
To play a Echo song or sfx isn't that difficult...
To CREATE a Echo song or sfx is another story....
I have to use rescomp to include all song sequences and instruments, then I declare them as in the code of the first link, and that's it.
I'll try to create echo songs from XM files, maybe the music part it easier for me.