You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> |**Figure 12-1: Microsoft Cross-Platform Audio Creation Tool**|
30
30
>
31
-
> While XACT projects are still fully supported in MonoGame, it remains a Windows-only tool that hasn't been updated since Microsoft discontinued the original XNA, nor has its source code been made open source. Though it's possible to install XACT on modern Windows, the process can be complex.
31
+
> While XACT projects are still fully supported in MonoGame, it remains a Windows-only tool that has not been updated since Microsoft discontinued the original XNA, nor has its source code been made open source. Though it is possible to install XACT on modern Windows, the process can be complex.
32
32
>
33
33
> For these reasons, this tutorial will focus on the simplified sound API, which provides all the core functionality needed for most games while remaining cross-platform compatible.
34
34
@@ -66,7 +66,7 @@ The [**Song**](xref:Microsoft.Xna.Framework.Audio.Song) class handles longer aud
66
66
- Only one song can be played at a time.
67
67
- Higher latency, but lower memory usage.
68
68
69
-
Throughout this chapter, we'll use both classes to add audio feedback to our game; sound effects for the bat bouncing and being eaten by the slime, and background music to create atmosphere.
69
+
Throughout this chapter, we will use both classes to add audio feedback to our game; sound effects for the bat bouncing and being eaten by the slime, and background music to create atmosphere.
70
70
71
71
## Loading Audio Content
72
72
@@ -82,7 +82,7 @@ MonoGame supports several audio file formats for both sound effects and music:
82
82
-`.wma`: Windows Media Audio format (not recommended for cross-platform games)
83
83
84
84
> [!TIP]
85
-
> For sound effects, `.wav` files provide the best loading and playback performance since they don't need to be decompressed. For music, `.mp3` or `.ogg` files are better choices as they reduce file size while maintaining good quality.
85
+
> For sound effects, `.wav` files provide the best loading and playback performance since they do not need to be decompressed. For music, `.mp3` or `.ogg` files are better choices as they reduce file size while maintaining good quality.
86
86
87
87
### Adding Audio Files
88
88
@@ -197,7 +197,7 @@ To get started, create a new directory called *Audio* in the *MonoGameLibrary* p
197
197
198
198
### The AudioManager Class
199
199
200
-
To effectively manage audio in our games, we'll create an `AudioManager` class that handles loading, playing, and controlling both sound effects and music. This manager will be implemented as a [**GameComponent**](xref:Microsoft.Xna.Framework.GameComponent), allowing it to receive automatic updates and cleanup.
200
+
To effectively manage audio in our games, we will create an `AudioManager` class that handles loading, playing, and controlling both sound effects and music. This manager will be implemented as a [**GameComponent**](xref:Microsoft.Xna.Framework.GameComponent), allowing it to receive automatic updates and cleanup.
201
201
202
202
In the *Audio* directory of the *MonoGameLibrary* project, add a new file named *AudioManager.cs* with this initial structure:
203
203
@@ -426,7 +426,7 @@ public void PlaySong(string assetName)
426
426
}
427
427
```
428
428
429
-
-`PlaySoundEffect`: Two overloads of this method are implemented. The first can be used to quickly fire off a sound effect if you don't need to adjust additional properties. The second contains parameters to customize the volume, pitch, panning, and looping properties of the sound effect. Both methods returns the instance for further control if needed.
429
+
-`PlaySoundEffect`: Two overloads of this method are implemented. The first can be used to quickly fire off a sound effect if you do not need to adjust additional properties. The second contains parameters to customize the volume, pitch, panning, and looping properties of the sound effect. Both methods returns the instance for further control if needed.
430
430
-`PlaySong`: Starts playing a song through the MediaPlayer. Since only one song can play at a time, this will automatically stop any currently playing song.
431
431
432
432
#### State Control Methods
@@ -546,8 +546,8 @@ public void DecreaseVolume(float amount)
546
546
}
547
547
```
548
548
549
-
-`IncreaseVolume`: Raises the volume of both music and sound effects by the specified amount, ensuring it doesn't exceed the maximum (1.0f).
550
-
-`DecreaseVolume`: Lowers the volume of both music and sound effects by the specified amount, ensuring it doesn't go below zero.
549
+
-`IncreaseVolume`: Raises the volume of both music and sound effects by the specified amount, ensuring it does not exceed the maximum (1.0f).
550
+
-`DecreaseVolume`: Lowers the volume of both music and sound effects by the specified amount, ensuring it does not go below zero.
551
551
552
552
## Adding Audio To Our Game
553
553
@@ -569,7 +569,7 @@ Add these files to your content project using the MGCB Editor:
569
569
2. Create a new directory called `audio` (right-click *Content* > *Add* > *New Folder*).
570
570
3. Right-click the new *audio* directory and choose *Add* > *Existing Item...*.
571
571
4. Navigate to and select the audio files you downloaded.
572
-
5. For each file that's added, check its properties in the Properties panel:
572
+
5. For each file that is added, check its properties in the Properties panel:
573
573
- For `.wav` files, ensure the *Processor* is set to `Sound Effect`.
574
574
- For `.mp3` files, ensure the *Processor* is set to `Song`.
575
575
@@ -665,7 +665,7 @@ Let's review what you accomplished in this chapter:
665
665
- Automatically cleans up audio resources.
666
666
- Integrates with the game component system.
667
667
668
-
In the next chapter, we'll explore scene management to handle different game screens like a title screen and a gameplay screen.
668
+
In the next chapter, we will explore scene management to handle different game screens like a title screen and a gameplay screen.
0 commit comments