Sound Playing error

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
accucore12
Posts: 14
Joined: May 18th, 2012, 1:06 pm

Sound Playing error

Post by accucore12 » May 20th, 2012, 6:39 pm

Image
Can someone help me with this error? I am trying to add sound using the sound.h provided in the framework.


Here is what i added in order to add sound.Not sure if i did it correctly or left out any important steps. The wave file that i am trying to play is 705kbps.

Added this in game.h
private:
Sound lose;

In the constructor of Game::Game

lose = audio.CreateSound( "Lose.wav" );


In my execution code ,
lose.Play( -1000 );//anyway what does the -1000 mean?



I found some clues in the sound.cpp file but have no idea on how to edit it.
Sound.cpp

// In this case it is a .WAV file recorded at 44,100 samples per second in 16-bit stereo (cd audio format).
waveFormat.wFormatTag = WAVE_FORMAT_PCM;
waveFormat.nSamplesPerSec = //44100;
waveFormat.wBitsPerSample = 16;
Last edited by accucore12 on May 20th, 2012, 7:16 pm, edited 1 time in total.

Code: Select all

Occupation: Reverse Engineer
[/color]

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Sound Playing error

Post by LuX » May 20th, 2012, 6:51 pm

The music files kilo bits per second rate has to be 1411 kbps.
the (-1000) is the volume. 0 being max, I think, or then chili has put some restriction on the volume...

PS to see the info of the music file, right click on it and press properties at the bottom of the popup menu, the click the last tab of the properties menu.
ʕ •ᴥ•ʔ

User avatar
accucore12
Posts: 14
Joined: May 18th, 2012, 1:06 pm

Re: Sound Playing error

Post by accucore12 » May 20th, 2012, 6:58 pm

Is there a way to change the code to suit my 705kbps .wav file?
It seems abit restrictive if we can only use a certain type.

Code: Select all

Occupation: Reverse Engineer
[/color]

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Sound Playing error

Post by LuX » May 20th, 2012, 7:00 pm

Use online converters, google is your good ol' friend :-)
Personally I use Freestudio's audio converter, but that will f up the music file, so you cant use it on chili's framework. A quick conversion on another converter fixed it up, tho.
ʕ •ᴥ•ʔ

User avatar
accucore12
Posts: 14
Joined: May 18th, 2012, 1:06 pm

Re: Sound Playing error

Post by accucore12 » May 20th, 2012, 7:08 pm

Yeah converting the sound file to the form required would be a fix.Thanks for the info.

I would like to know if it is possible to change the code so that the sound file work as well.This would aid in deepening my understanding of the setup of the code.Anyone knows how?

Code: Select all

Occupation: Reverse Engineer
[/color]

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Sound Playing error

Post by LuX » May 20th, 2012, 7:12 pm

Master chili knows.

You could try to mess around with the numbers is "music", just remember to make a backup of it. Usually messing around will teach you new stuff when your like "aha, so this changes that, but not those things".
ʕ •ᴥ•ʔ

uglypie
Posts: 21
Joined: May 5th, 2012, 5:05 pm

Re: Sound Playing error

Post by uglypie » May 20th, 2012, 8:22 pm

Try switching from 2 to 1 channel. (All you have to do is swap a few numbers)

uglypie
Posts: 21
Joined: May 5th, 2012, 5:05 pm

Re: Sound Playing error

Post by uglypie » May 20th, 2012, 8:24 pm

Damn it, that can't be right. Didn't notice the picture with the error. It must be the sample rate that's different. I guess you could set some breakpoints around to find out what the actual values are.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Sound Playing error

Post by chili » May 21st, 2012, 12:29 pm

Yeah, you can modify sound.cpp to make it load and play .wav files of different formats. You'll have to do a bit of research first though I guess, but it shouldn't be that difficult.
Chili

Post Reply