We're using cookies to ensure you get the best experience on our website. More info
Understood
@danbRegistered September 3, 2003Active 4 years, 4 months ago
420 Replies made

VirtualChris wrote:
Why won’t someone work on that for me?

Why won’t someone just do everything I want done for me? Nice attitude… :thumpdown:

Well, it’s up to you to decide the tempo by controlling how often you call PlayNote()…

To play a simple song, you can do something like:

u16 song[] = {C_4, D_4, E4, FS4, A_5};
u32 songTick = 0;
u8 currNote = 0;
while(1){
  //Playing the song in the background is easy,
  //just control its tempo by only calling playnote every
  //57:th (or whatever) pass through the game loop
  if (songTick == 57) {
    PlayNote(0, song[currNote], 8);
    currNote++;
    if (currNote > 4)
      currNote = 0;
    songTick = 0;
  }
  
  //Do other game-stuff

  songTick++;
}

For more complex song playing, you’ll have to wait some more for the full midi player 😛

  • This reply was modified 14 years ago by DanB.

I think you do need to fill the waveform RAM to get sound?
At least in Mednafen…

Anyways, maybe it’s time to share a little 🙂
Here is a basic function from my midi player that plays a single note:

void PlayNote(u8 chan, u16 freq, u8 vol) {
	//Set up the frequency the channel will play
	SND_REGS[chan].SxFQH = freq >> 8;
	SND_REGS[chan].SxFQL = freq & 0xFF;

	//Set the volume for the channel (0-15, same for left/right)
	SND_REGS[chan].SxLRV = (vol << 4) | vol;

	//Envelope for the channel (makes the tone fade out)
	SND_REGS[chan].SxEV0 = 0xF7;
	SND_REGS[chan].SxEV1 = 0x01;

	//Start the channel without interval
	SND_REGS[chan].SxINT = 0x9F;
}

Usage:

#include "audio.h"
#include "notes.h"
#include "voices.h"

//Copy the piano "instrument" to soundbank 1
copymem((void*)WAVEDATA1, (void*)PIANO, 128);

//Tell channel 0 to use soundbank 1
SND_REGS[0].SxRAM = 0;

//Play a "Middle-C" note on channel 0 with volume 8
PlayNote(0, C_4, 8);

The file "voices.h" includes a couple of different "instruments" that I made, to be loaded into the soundbanks.

The file "notes.h" defines all standard notes, fine-tuned manually to fit the VB's frequencies.

This should help you to get some tunes flowing 🙂
Just call PlayNote() with different note values (E_4, D_4, G_4 etc.) within your main loop (or better, on a timer interrupt)

  • This reply was modified 14 years ago by DanB.
Attachments:

Wohoo! Thanks guys! 😀
I had never hoped to get this many votes, after all there were many cool entries this year 🙂

I’d like to thank everyone who voted, KR155E, and our nice community as a whole. Without you guys, none of these great demos would have materialized.

Now it’s time to continue working to make this thing into a full game!

Thanks for your support!

Cool! Did you do any benchmarks of how much faster it is over the “standard” copymem?

That bug is only visible when you play on the real hardware, and is caused by changing/updating the OBJs at the “wrong” time…

You should only change OBJs between frames, while the screen is not being updated. Otherwise you get this effect with garbled OBJ tiles appearing all over the screen.

I would gladly pay $40 hands down for a professionally made link cable.

Also, if someone could make GDB work with (one end of) it for debugging on hardware from a PC, it would be the best thing ever! (I know both you and David Tucker have been tinkering with it in the past.)

HorvatM wrote:
I suggest we use

http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3

or

http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

preceded by an “H”, if we want to make a distinction between licensed and homebrew titles.

I second that.

Lol, yeah. There will never be a “complete” set of homebrew roms. I can release a new build every hour if I wanted to, will you be able to keep up? 😛

I second “Press”. And on a somewhat related matter, I always thought it is strange that there are different tabs for “Multimedia” and “Images” in the games section… Why not put images under multimedia too?

Well, I for one will not put a single point on my own entry, and I hope all other participants will do the same. It just doesn’t seem ethical, and how good would it feel to win if you know you put 10 points down on yourself? 🙁

Since you managed to take a screenshot for the news article where the main character isn’t even visible, I’m providing some better “press photos” here 😉 (In fact, if you could insert these into my first post instead of the anaglyph one and delete this post, it would be great)

  • This reply was modified 14 years, 2 months ago by DanB.

It’s because of the space in mina dokument… try:

c:\documents and settings\nihongo1>”mina dokument\mednafen\mednafen.exe” “mina dokument\vbroms\hunter.vb”

I’ll still be busy with my own projects for a while, but sure, I could help with this too on the side. It’s a nice idea.

I’m planning to continue with my Zelda on my own, so I won’t be sharing that, but that doesn’t stop another Zelda from starting up and I could help writing parts of that too…

I’d be more interested in Metroid though, or a different game altogether 🙂

You should only need to type

C:\program\mednafen\mednafen.exe C:\vbroms\hunter.vb

Or whatever path you have to the exe and the rom.
If that doesn’t work, Mednafen doesn’t like your pc for some reason…

Ah, I didn’t notice which forum this was posted in… heh, my bad 😛

In what context? Where do you get it?

Thanks guys!

To be honest I have tried but never understood how to open mednafen

Actually, the simplest way is to just drag and drop the rom onto mednafen.exe…

There is no instruction or story at all to tell me what I’m supposed to do or why.

That’s because there isn’t really any objective in the game yet… Just explore and wreak havoc!

Also, why does the car “auto drive”?

Because it does so in the original 😀

and the map, although it doesn’t actually indicate your character

Actually it does (but it’s just one pixel, that doesn’t blink) It’s more visible when you’re on the boat at sea.

The only major “failure” IMO is the HUD that’s “embedded” in the world.

That’s also on my todo list 🙂

I wondered if the full moon rises and sets… where’s the sun?

Heh, I am going to make full day/night cycles, but time was running short and I had to push it out before the deadline 😛

I can’t understand why you keep insisting on using older emus like Red Dragon when we have Mednafen. There is no blinking in Mednafen.

(And it takes 2 bombs to destroy the houses 😉 )

LOL, That’s the laugh of the morning 😀