Game Development Community

Sound isn't working (SOLVED)

by Myles Blasonato · in iTorque 2D · 01/29/2011 (11:32 pm) · 12 replies

Hi guys :)
I purchased iTorque and was going through the docs quite easiliy until I had a look at adding sound.
I havent in the last 2 days been able to get it to work.

I followed what it said in the documentation.
I create a profile and description.

new AudioDescription(AudioNonLooping)
{
    volume = 1.0;
    isLooping= false;
    is3D = false;
    type = $GuiAudioType;
};

new AudioDescription(AudioLooping)
{
    volume = 1.0;
    isLooping= true;
    is3D = false;
    type = $GuiAudioType;
};


// --------------------------------------------------------------------
// Background Loop.
// --------------------------------------------------------------------
new AudioProfile(backgroundAudio)
{
    filename = "../data/audio/here.wav";
    description = "AudioLooping";
    preload = true;
};

// --------------------------------------------------------------------
// Single Blip.
// --------------------------------------------------------------------
new AudioProfile(blipAudio)
{
    filename = "../data/audio/here.wav";
    description = "AudioNonLooping";
    preload = true;
};

Then in game.cs I execute the script

function startGame(%level)
{
   exec("./audioDatablocks.cs");
   alxPlay(blipAudio);

This will not play any sound. Why?

Cheers,
Myles Blasonato.
PS: Is it easy to create classes and stuff in case I wanted to do a point and click adventure with an inventory system and stuff. I have good c++ skills.

About the author

A passionate game designer that has worked on some great games such as Lost Monsters.


#1
01/30/2011 (12:26 am)
Hi, my first guess is, that the relative file path is not correct
filename = "../data/audio/here.wav"; 
// should be
filename = "~/data/audio/here.wav";
#2
01/30/2011 (12:31 am)
Hi Juraj :)
I tried that one before but it didn't work which is why I changed it.
I changed it
"~/data/audio/here.wav
to see if that worked but it didn't.

Cheers,
Myles Blasonato.
#3
01/30/2011 (1:09 am)
Hmm...try also
alxPlay(blipAudio.getName());
#4
01/30/2011 (2:21 am)
I tried that and still nothing however I came across something.
The output window through out the following.

OpenAL Driver Init
 Missing OpenAL Extension function 'EAXSet'
 Missing OpenAL Extension function 'EAXGet'
OpenAL Driver Init Success

Cheers,
Myles Blasonato.
#5
01/30/2011 (5:06 am)
Ok so I fixed it.
I had to put the code after I load the level as well as copy the OpenAL32.dll over into the main directory.

Cheers,
Myles Blasonato.
#6
01/30/2011 (5:09 am)
Hmm...can you upload your whole test project somewhere ? I could try it by my self and find the problem, if you want.
#7
01/30/2011 (5:11 am)
You were probably replying at the same time as I wrote my thing :P
I fixed it. Thanks for all your help :)

Cheers,
Myles Blasonato.
#8
01/30/2011 (5:27 am)
Well, i was not much of a help, as you solved it all by yourself. Can you tell, what was the problem ? Your solution might be helpful to other users when they run into similar problem.
#9
01/30/2011 (5:31 am)
Sure!
So as stated above I had to move the following code to after the level has been loaded.

function startGame(%level)
{
   exec("./audioDatablocks.cs");
   alxPlay(blipAudio);

I then also needed to copy and paste the OpenAL32.dll over into my games main directory.

After that it worked nicely :)

Hope that helps people.
Cheers,
Myles Blasonato.
#10
01/30/2011 (9:34 am)
I have been wondering this. Where do you store your audioDatablocks.cs? Anywhere?



:s
#11
01/30/2011 (9:49 am)
Anywhere is fine, as long as they are executed :)
#12
01/30/2011 (1:15 pm)
Ok so as long as the call calls that proper location

Great.
Thanks.