The Dink Network

can't use .WAV???

August 17th 2005, 02:56 PM
dragon.gif
i have a problem, in my new D-mod, i have a nice song on a .WAV file, but i can't play it as an .MIDI, a normal dink song, i must use the Playsound command, but when i try to use it on as my intro song, it dosent play, here is my START.C, maybe you can find the problem...

//this is run when dink is loaded, directly after the dink.ini file
//is processed.

void main( void )
{
debug("Loading sounds..");
load_sound("QUACK.WAV", 1);
load_sound("PIG1.WAV", 2);
load_sound("PIG2.WAV", 3);
load_sound("PIG3.WAV", 4);
load_sound("PIG4.WAV", 5);
load_sound("BURN.WAV", 6);
load_sound("OPEN.WAV", 7);
load_sound("SWING.WAV", 8);
load_sound("PUNCH.WAV", 9);
load_sound("SWORD2.WAV", 10);
load_sound("SELECT.WAV", 11);
load_sound("ENTER.WAV", 12);
load_sound("PICKER.WAV", 13);
load_sound("GOLD.WAV", 14);
load_sound("GRUNT1.WAV", 15);
load_sound("GRUNT2.WAV", 16);
load_sound("SEL1.WAV", 17);
load_sound("ESCAPE.WAV", 18);
load_sound("NONO.WAV", 19);
load_sound("SEL2.WAV", 20);
load_sound("SEL3.WAV", 21);
load_sound("HIGH2.WAV", 22);
load_sound("FIRE.WAV", 23);
load_sound("SPELL1.WAV", 24);
load_sound("CAVEENT.WAV", 25);
load_sound("SNARL1.WAV", 26);
load_sound("SNARL2.WAV", 27);
load_sound("SNARL3.WAV", 28);
load_sound("HURT1.WAV", 29);
load_sound("HURT2.WAV", 30);
load_sound("ATTACK1.WAV", 31);
load_sound("CAVEENT.WAV", 32);
load_sound("LEVEL.WAV", 33);
load_sound("SAVE.WAV", 34);
load_sound("SPLASH.WAV", 35);
load_sound("SWORD1.WAV", 36);
load_sound("BHIT.WAV", 37);
load_sound("SQUISH.WAV", 38);
load_sound("STAIRS.WAV", 39);
load_sound("STEPS.WAV", 40);
load_sound("ARROW.WAV", 41);
load_sound("FLYBY.WAV", 42);
load_sound("SECRET.WAV", 43);
load_sound("BOW1.WAV", 44);
load_sound("KNOCK.WAV", 45);
load_sound("DRAG1.WAV", 46);
load_sound("DRAG2.WAV", 47);
load_sound("AXE.WAV", 48);
load_sound("BIRD1.WAV", 49);
load_sound("win_british.WAV", 50);
load_sound("freedom.WAV", 51);
load_sound("win_american.WAV", 52);

//Playsound(36,22050,0,0,0);

int &crap;

//fill 255 fills the screen white... I use a full-sized BMP so it covers up
//The whole screen & doesn't really matter. You could use 0 to fill it with
//black if you weren't using a full-sized BMP for title-01.bmp.

fill_screen(255);

//Make sure the screen isn't locked now. Kinda fixes a bug where if you die
//when the screen is locked, the "screenlock" bars remain on the title.

screenlock(0);

//Get the "sprite #1" (which is actually Dink) set to be a mouse pointer

sp_seq(1, 0);
sp_brain(1, 13);
sp_pseq(1,10);
sp_pframe(1,8);
sp_que(1,20000);
sp_noclip(1, 1);

//This is where we create the TITLE SCREEN. This line is ok if you're using
//a 640 x 480 full-sized bitmap as the title (as I do, usually). If you
//don't, be sure to change this line to fit.

&dinklogo = create_sprite(426,344, 0, 453, 1);
sp_que(&dinklogo, -800);
sp_noclip(&dinklogo, 1);

//Create the START button....

&crap = create_sprite(76, 434, 14, 194, 1);
sp_script(&crap, "start-1");
sp_noclip(&crap, 1);
sp_touch_damage(&crap, -1);

//Create the CONTINUE button....

&crap = create_sprite(314, 434, 14, 195, 1);
sp_script(&crap, "start-2");
sp_noclip(&crap, 1);
sp_touch_damage(&crap, -1);

//Create the QUIT button....

&crap = create_sprite(560, 434, 14, 193, 1);
sp_noclip(&crap, 1);
sp_script(&crap, "start-4");
sp_touch_damage(&crap, -1);

stopcd();

//If you're going to play a title midi, uncomment & change the following:

playsound(50, 22050,0,¤t_sprite, 0);

kill_this_task();
}
August 17th 2005, 03:25 PM
goblinm.gif
I would suggest changing &current_sprite to 0 in your playsound command, except &current_sprite is already equal to 0 (probably... sprite creation does funny things.) In other words, I have no idea what the problem is.
August 17th 2005, 04:18 PM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
I read in a sound FAQ that Dink looks for a DETAIL, DESCRIPTION, COPYRIGHT information inside the WAV file. Therefore, if you tape yourself, or convert an MP3, without using some sort of REAL sound editor ( Like SoundForge or GoldWave ), your WAV files will not have that information.
There was also written that we should blame Seth for this. Of course, in the original game the Seth character said that he was everething we love and everything we hate, so we love him for releasing Dink Smallwood, but we can blame him for every bug.
August 17th 2005, 04:55 PM
dragon.gif
well, what shall i do now, if i cant use my intro music...?
August 17th 2005, 04:58 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Try changing the filename so it has 8 characters and an extension. Like win_brit.wav instead of win_british.wav. It might work, you never know
August 18th 2005, 02:41 AM
dragon.gif
okay, thanks.
August 18th 2005, 01:26 PM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
I don't think a waw file works in Dink, unless it has those informations I told about before.
February 28th 2006, 10:56 PM
old.gif
jjohn
Peasant He/Him
 
It sure would be sweet if the Dink engine threw a warning message into the DEBUG.TXT log about that.
February 28th 2006, 11:51 PM
old.gif
jjohn
Peasant He/Him
 
Wow. This should not not be, but here it is.

There appears to be something "funny" about WavePad and
Dink.

I edited a WAV from Search for Milli Vanilli with WavePad.
I simply took a smaller sample of the entire file. I saved
this as a 22050hz, 8 bit mono PCM file (176 bitrate). When
I right clicked on the file, I confirmed that these settings
were the same as the original.

I copied the file into my DMOD, added a load_sound("", XX)
line to start.c. I then started my DMOD.

Dink crashed hard.

I turned on debugging, but I didn't see anything helpful there.
I know that it finds the file.

I dug around the source code to Dink, but I didn't see anything
obvious.

I then opened my "problem file" in crappy old Windows Sound
Recorder and resaved the file. The Dink engine was then fine
with the file.

Grrrr...

If Dan or the folks working on the Dink source want reproducible
test files to crash their builds, drop me a line. I would be
nice to know where the crash happens and at least trap it.

(It might be in ReadData() [who the heck implements functions in
header files?!]).

Just to make life interesting, a WAV file I produced with Cakewalk
Sonar 4 worked fine. Also note: do not load_sound() 4MB files.
Dink.exe gets grumpy.
March 1st 2006, 07:26 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
From the Sound FAQ:

Q: My sounds STOP abruptly while being played, or Dink crashes !

A: Dink Engine BUUUUG. Blame Seth at sethable@rtsoft.com. Flame him all want, and send him all kinds of destructive emails. I dont object Anyhow, the problem is that Dink looks for a DETAIL, DESCRIPTION, COPYRIGHT information inside the WAV file. Therefore, if you tape yourself, or convert an MP3, without using some sort of REAL sound editor ( Like SoundForge or GoldWave ), your WAV files will not have that information. And as the result, your files wont play the whole time, ( 5 secs instead of 20 ..and such ). To correct this problem just download ANY shareware or freeware sound editor (that allows you to save and add the detailed information) open your file in that application and save it...That is all. To check if your file is in correct format do the following:

1. Right-click your wav file, and select PROPERTIES on the bottom.

2. Look for DETAIL tab, if you have it, you dont have to change/add anything.

3. If you dont have it, re-save your file and any professional sound editor.

P.S I understood that bug at 3:00am after spending 14 hours figuring out why my sounds wouldn't play... I am still thinking sometimes about suing Seth )
March 1st 2006, 10:39 AM
old.gif
jjohn
Peasant He/Him
 
It's a bug, but I'm not entirely sure that the ID3 info stuff is to blame.
I'm having a hard time believing that Sound Record populates that part of a file.

In any case, there is a work around, which is either to find a wave editor that dink likes or to resave the file with Sound Record.

However, I do think that you, as the keeper of the code, can at least shove in some additional debug messages sprinkled through dinkvar.h file to isolate which function is
a'sploding. That will help us all to understand the reason for the crash.

It's probably going to be a NULL pointer issue.

Thanks.
March 1st 2006, 11:16 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Well... is it actually a Dink bug, or a DirectX thing? Dink bugs can now be fixed, you know (yeah I know, you're busy already...)
March 1st 2006, 01:12 PM
pq_knight.gif
and1
Peasant He/Him
 
How to put midi to play on starting screen
March 1st 2006, 01:42 PM
old.gif
jjohn
Peasant He/Him
 
Look in the story/start.c file. Look for playmidi().
March 1st 2006, 02:02 PM
pq_knight.gif
and1
Peasant He/Him
 
THIS IS MY START.c

//runs after main.c
void main( void )
{
//color of screen behind title, 0 is black 255 is white
fill_screen(255);
//unlock screen if dink died in a screenlocked room
screenlock(0);

//mouse pointer
sp_seq(1, 0);
sp_brain(1, 13);
sp_pseq(1,10);
sp_pframe(1,8);
sp_que(1,20000);
sp_noclip(1, 1);

//title screen
int &crap = create_sprite(426,344, 0, 453, 1);
sp_que(&crap, -800);
sp_noclip(&crap, 1);

//start
&crap = create_sprite(76, 434, 14, 192, 1);
sp_script(&crap, "start-1");
sp_noclip(&crap, 1);
sp_touch_damage(&crap, -1);

//load
&crap = create_sprite(314, 434, 14, 193, 1);
sp_script(&crap, "start-2");
sp_noclip(&crap, 1);
sp_touch_damage(&crap, -1);

//exit
&crap = create_sprite(560, 434, 14, 194, 1);
sp_noclip(&crap, 1);
sp_script(&crap, "start-3");
sp_touch_damage(&crap, -1);

//is this necessary? kept it just to be safe.
//(who the hell runs dink off a CD?)
stopcd();

kill_this_task();
}
March 1st 2006, 03:22 PM
old.gif
jjohn
Peasant He/Him
 
In that case, you'll need to add playmidi() after the buttons are added.
Consider downloading any of the excellent
Dink references.

playmidi("<filename without .mid>"); // works

From the r4.0 help file:

playmidi

Category: Sound

Version: 1.00+

Prototype: void playmidi(string midi_file[14]);

playmidi plays the midi_file found in the Sound
directory in the D-Mod. If it is not found, it
will look in Dink's sound directory and play it
if it exists there.

If a number is specified, Dink will attempt to
play "###.mid".

The numbers 1002-1018 as a 'midi_file' have special
meaning. They play the audio tracks on the Dink Smallwood CD.
All but 1003, 1008, 1014, 1015 and 1017 have MIDI alternatives
for those people (the majority) using the freeware version
without the original CD in the drive. 1001 and 1020 also play
MIDIs if the Dink CD is not present, although with the CD, 1001
has no effect (since track 1 is the data track on the CD) and
1020 stops the music (since the CD has no track 20). These numbers
also work for screens (press M in DinkEdit). Lastly, it's
interesting that it will confuse certain audio CDs
(such as the 'O Brother, Where Art Thou?' soundtrack)
with the Dink CD. [PP]

playmidi("1001");
// without the CD, plays "1.mid" (specified number less 1000);
// with the CD, no effect -- will not try to "play" data track

playmidi("1003");
// plays track 3 of CD, or "3.mid" (if dmod has one)

playmidi("1003.mid");
// plays, as specified, "1003.mid"

playmidi("1020");
// with CD, does nothing (no track 20);
// without CD, plays "20.mid" if found
March 1st 2006, 03:25 PM
pq_knight.gif
and1
Peasant He/Him
 
Thanks.

EDIT:I OWE YOU ONE