Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2016-12-02 16:26:07

Mills
Member
Registered: 2012-12-21
Posts: 132

Wave player in games for GBDK

This is my first test to play wave sounds in the background for GBDK.

The function included in gbdk stops all other tasks untill it finishes, so I figured out a way to use it without stopping the program.

Code:

if (play == 1){
    if (byte > 934) {byte = 0; play = 0;}
    play_sample((unsigned char *) &boing+(byte), 1);
    byte+=16;
}

It will play a 16 byte chunk of the wave each loop, The (unsigned char *) & makes possible to advance in the array to play the next part.


Then you have to use it wothout any delay or wait_vbl_done();, so you'll have to add an VBL function to time the rest ot the program.


It would be easy to create an asm function to do this using gbdk source, But I'm not an ASM programmer.


Here is the GBDK sample rom and source: Sample Player for GBDK

Last edited by Mills (2016-12-02 16:28:59)

Offline

 

#2 2016-12-13 10:23:33

nordloef
New member
From: Sweden
Registered: 2008-03-11
Posts: 7
Website

Re: Wave player in games for GBDK

Really cool! Thanks for sharing!


Game Boy music composer using Carillon Editor for games and demos. Check out my work HERE. Need music or sfx for your homebrew project? Feel free to drop me a line.

Offline

 

#3 2017-02-19 18:37:58

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: Wave player in games for GBDK

That's awesome! I'll put ths into a game in the future for certain!

Offline

 

#4 2018-01-16 14:10:41

rail5
New member
Registered: 2018-01-16
Posts: 3

Re: Wave player in games for GBDK

Registered for this thread,
would absolutely love to mess with this but the link is dead. Do you still have a copy you can upload? Thank you!

Offline

 

#5 2018-01-17 09:31:55

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: Wave player in games for GBDK

rail5 wrote:

Registered for this thread,
would absolutely love to mess with this but the link is dead. Do you still have a copy you can upload? Thank you!

Here it is: https://github.com/mills32/GAMEBOY-DEMO … _Player.7z

There is a sample and a how to included.

Offline

 

#6 2018-01-17 10:58:42

Hell_666
Member
Registered: 2017-12-13
Posts: 18

Re: Wave player in games for GBDK

Sounds interesting, I need to try this when I will have some time !

Thanks for sharing.

Offline

 

#7 2018-08-20 00:57:11

26F
Member
Registered: 2018-07-25
Posts: 13
Website

Re: Wave player in games for GBDK

Is there anyway to get wav to play louder on the gbc? It's really quite.

Offline

 

#8 2018-08-30 08:25:54

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: Wave player in games for GBDK

Volume is low and you can't do anything about it sad.

Last edited by Mills (2018-08-30 08:28:19)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson