Giter Club home page Giter Club logo

hugedriver's Introduction

hUGEDriver

This is the repository for hUGEDriver, the music driver for the Game Boy which plays music created in hUGETracker.

If you want help using the tracker, driver, or just want to chat, join the hUGETracker Discord server!

Quick start (RGBDS)

  1. Export your song in "RGBDS .asm" format in hUGETracker.
  2. Choose a song descriptor name. This is what you will refer to the song as in your code. It must be a valid RGBDS symbol.
  3. Place the exported .asm file in your RGBDS project.
  4. Load hl with your song descriptor name, and call hUGE_init
  5. In your game's main loop or in a VBlank interrupt, call hUGE_dosound
  6. When assembling your game, be sure to specify your music file and hUGEDriver.asm in your call to rgbasm/rgblink!

Be sure to enable sound playback before you start!

ld a, $80
ld [rAUDENA], a
ld a, $FF
ld [rAUDTERM], a
ld a, $77
ld [rAUDVOL], a

See the rgbds_example directory for a working example!

Quick start (GBDK)

  1. Export your song in "GBDK .c" format in hUGETracker.
  2. Choose a song descriptor name. This is what you will refer to the song as in your code. It must be a valid C variable name.
  3. Place the exported .C file in your GBDK project.
  4. #include "hUGEDriver.h" in your game's main file
  5. Define extern const hUGESong_t your_song_descriptor_here in your game's main file
  6. Call hUGE_init(&your_song_descriptor_here) in your game's main file
  7. In your game's main loop or in a VBlank interrupt, call hUGE_dosound
  8. When compiling your game, be sure to specify your music file and hUGEDriver.o in your call to lcc!

Be sure to enable sound playback before you start!

NR52_REG = 0x80;
NR51_REG = 0xFF;
NR50_REG = 0x77;

See gbdk_example/src/gbdk_player_example.c for a working example!

Usage

This driver is suitable for use in homebrew games. hUGETracker exports data representing the various components of a song, as well as a song descriptor which is a small block of pointers that tell the driver how to initialize and play a song.

hUGETracker can export the data and song descriptor as a .asm or .c for use in RGBDS or GBDK based projects, respectively. Playing a song is as simple as calling hUGE_init with a pointer to your song descriptor, and then calling hUGE_dosound at a regular interval (usually on VBlank, the timer interrupt, or simply in your game's main loop)

In assembly:

ld hl, SONG_DESCRIPTOR
call hUGE_init

;; Repeatedly
call hUGE_dosound

In C:

extern const hUGESong_t song;

// In your initializtion code
__critical {
    hUGE_init(&song);
    add_VBL(hUGE_dosound);
}

Check out player.asm for a full fledged example of how to use the driver in an RGBDS project, and gbdk_example/gbdk_player_example.c for usage with GBDK C likewise.

hUGE_mute_channel

Caution: As an optimization, hUGEDriver avoids loading the same wave present in wave RAM; when "muting" CH3 and loading your own wave, make sure to set hUGE_current_wave to hUGE_NO_WAVE (a dummy value) to force a refresh.

License

hUGETracker and hUGEDriver are dedicated to the public domain.

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.