Difference between revisions of "Chili Sound Pack"
(Created page with "The Chili Sound Pack is a pack of code and .dll you can add to Chili Framework projects to enable the use of sound effects. == Tutorial == Here is a link to a video expla...") |
m (Text replacement - "http://www.planetchili.net/" to "https://www.planetchili.net/") |
||
(17 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The Chili Sound Pack is | + | The Chili Sound Pack is an optional pack of code and .dlls you can add to [[Chili Framework]] projects to enable the use of sound effects. |
== Tutorial == | == Tutorial == | ||
− | Here is a link to a video explaining how to integrate the sound module into a framework solution and how to use the <code>Sound</code> and <code>SoundEffect</code> classes. Check the [[downloads]] section below for the necessary stuff to follow along. | + | Here is a [https://youtu.be/lxBpKjAaUOI link to a video] explaining how to integrate the sound module into a framework solution and how to use the <code>Sound</code> and <code>SoundEffect</code> classes. Check the [[#Downloads|downloads]] section below for the necessary stuff to follow along. (Note that newer versions of the framework already have the sound stuff included by default.) |
+ | |||
+ | ==== Extra Notes / Errata ==== | ||
+ | |||
+ | * In the tutorial video, the constructor for <code>SoundEffect</code> is not fully explained. There are 3 parameters. The first parameter is, as shown in the video, a list of <code>std::wstring</code>s which are the names of .wav files to be loaded. The second parameter is a <code>bool</code>, and if passed in as true, it allows the loading of .wav files to soft-fail (failure to load the file will cause a silent <code>Sound</code> object to be used instead). The third parameter is a <code>float</code> which is the standard deviation used to generate the pitch shift for each playback. Larger values create more dramatic swings in pitch. | ||
+ | |||
+ | * In the portion where I demonstrate soft-fail loading of a <code>Sound</code> with a <code>try</code> ... <code>catch</code> block, in the body of the <code>catch</code> I assign a default-constructed <code>Sound</code> object, but this is unnecessary (if the constructor <code>throw</code>s, the object will be put into a default-constructed, i.e. empty sound, state). | ||
+ | |||
+ | * Never '''''EVER''''' create a <code>Sound</code> (or a <code>SoundEffect</code>) object in the global scope. If you do so, the <code>SoundSystem</code> object will end up getting destroyed before the Sound object, and then you're FUCKED. I warned you. | ||
== Downloads == | == Downloads == | ||
− | Here is the [ | + | Here is the [https://www.planetchili.net/downloads/Chili-Sound-Pack.zip sound module zip file] with the code and .dll files for the sound module. |
To follow the tutorial on the sound module, you will need the following zip files as well: | To follow the tutorial on the sound module, you will need the following zip files as well: | ||
− | * The test [ | + | * The test [https://www.planetchili.net/downloads/Sound-Tutorial-Poo.zip solution zip] |
− | * The test [ | + | * The test [https://www.planetchili.net/downloads/Test-Sounds.zip sound files zip] |
+ | |||
+ | == Inner Workings of the Module == | ||
+ | |||
+ | The inner workings of the XAudio2 code are explained in the H.U.G.S. series. The code discussed there is somewhat different than the code in the sound pack, but the fundamentals are the same. If you want the details, see the video links below. Note that these tutorials assume a relatively strong command of the C++ language. | ||
+ | |||
+ | * [https://www.youtube.com/watch?v=T51Eqbbald4 HUGS - Tutorial 11] | ||
+ | * [https://www.youtube.com/watch?v=ck2XpEZYLYs HUGS - Tutorial 12] | ||
+ | * [https://www.youtube.com/watch?v=hTEL49jCruw HUGS - Tutorial 17] |
Latest revision as of 13:26, 5 May 2022
The Chili Sound Pack is an optional pack of code and .dlls you can add to Chili Framework projects to enable the use of sound effects.
Tutorial
Here is a link to a video explaining how to integrate the sound module into a framework solution and how to use the Sound
and SoundEffect
classes. Check the downloads section below for the necessary stuff to follow along. (Note that newer versions of the framework already have the sound stuff included by default.)
Extra Notes / Errata
- In the tutorial video, the constructor for
SoundEffect
is not fully explained. There are 3 parameters. The first parameter is, as shown in the video, a list ofstd::wstring
s which are the names of .wav files to be loaded. The second parameter is abool
, and if passed in as true, it allows the loading of .wav files to soft-fail (failure to load the file will cause a silentSound
object to be used instead). The third parameter is afloat
which is the standard deviation used to generate the pitch shift for each playback. Larger values create more dramatic swings in pitch.
- In the portion where I demonstrate soft-fail loading of a
Sound
with atry
...catch
block, in the body of thecatch
I assign a default-constructedSound
object, but this is unnecessary (if the constructorthrow
s, the object will be put into a default-constructed, i.e. empty sound, state).
- Never EVER create a
Sound
(or aSoundEffect
) object in the global scope. If you do so, theSoundSystem
object will end up getting destroyed before the Sound object, and then you're FUCKED. I warned you.
Downloads
Here is the sound module zip file with the code and .dll files for the sound module.
To follow the tutorial on the sound module, you will need the following zip files as well:
- The test solution zip
- The test sound files zip
Inner Workings of the Module
The inner workings of the XAudio2 code are explained in the H.U.G.S. series. The code discussed there is somewhat different than the code in the sound pack, but the fundamentals are the same. If you want the details, see the video links below. Note that these tutorials assume a relatively strong command of the C++ language.