ProjectABE (ArduBoy Emulator) released!


(Alex) #345

yeah im enabling it in the program.

Screenshot_71

forcing the audio on works for some reason.


(Felipe Manga) #346

try this:

arduboy.audio.begin();
arduboy.audio.on();

Because of the blank eeprom, the default is off.


(Alex) #347

Ah. also why does the sound seem a bit distorted?

also, it seems like several instances of your program pile up in the background with every recompile.


(Felipe Manga) #348

TL;DR: Because it’s surprisingly hard to emulate sound from a device that has no sound card, on a device that does.

In a bit more detail: Sound cards expect audio data to come in buffers that they can pipe out independently of the CPU. On an Arduboy, GPIO pins are connected directly to a speaker, no buffers. The emulator often has to do some guessing when it needs to fill a buffer to send to the sound card.

Edit: To make things more complicated, the javascript API for audio has been considered deprecated… and the replacement doesn’t exist yet. So I’m going to wait a bit before doing anything related to sound, I might have to re-do it when a new API comes out.

Are you sure? That’s strange. You update the hex and a new instance appears? o_O


(Alex) #349

Yeah, there were 7 background processes eating up 45% of my cpu. Not sure where they came from.


(Felipe Manga) #350

Very strange… when the hex file updates it just reads the file, it doesn’t start a process. I’ll look into this.


(Scott) #351

A blank EEPROM on the real processor will be all 0xFF, which means the “audio enable” flag will be 1, so sound will be enabled.


(Felipe Manga) #352

Ah, here it was starting with 0. Thanks!


(Alex) #353

Ive been getting the emulator working, much better than wearing out my arduboys flash.


(Alex) #354

Pharap suggested a neat idea in a post right here.

Could you possibly do this? We could add special easter eggs (or more importantly fixes) if you run it in abe.)


(Felipe Manga) #355

I guess I could make ProjectABE’s compiler add a define, but that is problematic in two ways:

  • The ifdef wouldn’t work if you compile in the Arduino IDE then ran the hex in the emulator (which is pretty common)
  • The ifdef would still be in effect if you upload the hex to your Arduboy.

The ideal would be to actually fix the bugs in ProjectABE. In your specific case, the bug was fixed soon after @MLXXXp reported it, and I’ll push it live soon.


(Alex) #356

Well could there be another compile-time type thing that could check if its running in emulator despite of where its compiled?


(Felipe Manga) #357

By definition, if it’s a compile-time decision, it has no idea what’s going on in run-time. For that, you’d use a regular if, not an ifdef.
Considering that ProjectABE is under development and will behave more like the real thing, testing for it fixes a problem now, but creates one in the future.


(Alex) #358

If you say so, it would still be neat.


(Felipe Manga) #359

The next version of ProjectABE should feature support for custom hardware. If someone makes a Hackduboy out of a Pro Micro with different wiring, or using a 328P instead of a 32u4, they’ll be able to test their games in the emulator.
With custom board support, we’ll also be able to use a “Arduboy Debug Edition”, with more flash space and different compiler settings (-Og/-O0, -DDEBUG, etc).
So you’d be able to check if DEBUG is defined.

I can’t think of a good reason to test for the emulator itself, though. Forcing audio on when the emulator is detected would annoy users the same way it would annoy them on hardware.


(Alex) #360

I want these things:

  • Support for audio.begin()
  • F3 trick On Offline mode

(Felipe Manga) #361

They are already done and will be available on the next release.


(Alex) #362

Great, do you just need to compile or…


(Felipe Manga) #363

I need to finish some features that are half-way done.


(Ignacio Viña) #364

Hi Felipe,
first of all, congrats for the emulator, it’s really fantastic!

I see that you included sound/music support but it’s not working with the PCM mode. Could you implement it? Thanks!