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
Copy file name to clipboardExpand all lines: articles/monogame/howto/audio/HowTo_ChangePitchAndVolume.md
+60-21Lines changed: 60 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -1,44 +1,89 @@
1
1
---
2
2
title: How to adjust Pitch and Volume
3
3
description: Demonstrates how to manipulate the pitch and volume of sound effects as they play.
4
+
requireMSLicense: true
4
5
---
5
6
6
-
# Adjusting Pitch and Volume
7
+
The **[SoundEffect.Play](xref:Microsoft.Xna.Framework.Audio.SoundEffect.Play)** method allows you to specify the pitch and volume of a sound to play. However, after you call **[Play](xref:Microsoft.Xna.Framework.Audio.SoundEffect.Play)**, you cannot modify the sound. Using **[SoundEffectInstance](xref:Microsoft.Xna.Framework.Audio.SoundEffectInstance)** for a given **[SoundEffect](xref:Microsoft.Xna.Framework.Audio.SoundEffect)** allows you to change the **pitch** and **volume** of a sound at any time during playback.
7
8
8
-
The [SoundEffect.Play](xref:Microsoft.Xna.Framework.Audio.SoundEffect.Play) method allows you to specify the pitch and volume of a sound to play. However, after you call [Play](xref:Microsoft.Xna.Framework.Audio.SoundEffect.Play), you cannot modify the sound. Using [SoundEffectInstance](xref:Microsoft.Xna.Framework.Audio.SoundEffectInstance) for a given [SoundEffect](xref:Microsoft.Xna.Framework.Audio.SoundEffect) allows you to change the pitch and volume of a sound at any time during playback.
9
+
> [!NOTE]
10
+
> The pitch of a sound changes the frequency of the sound, which in turn changes the speed of the sound. The volume of a sound changes the amplitude of the sound, which in turn changes the loudness of the sound.
9
11
10
12
## Change Pitch and Volume of Sound
11
13
12
-
1. Declare [SoundEffect](xref:Microsoft.Xna.Framework.Audio.SoundEffect) and [Stream](http://msdn.microsoft.com/en-us/library/system.io.stream.aspx) by using the method shown in [Playing a Sound](HowTo_PlayASound.md). In addition to the method described in [Playing a Sound](HowTo_PlayASound.md), declare [SoundEffectInstance](xref:Microsoft.Xna.Framework.Audio.SoundEffectInstance).
14
+
1. Declare a **[SoundEffect](xref:Microsoft.Xna.Framework.Audio.SoundEffect)** and a [Stream](http://msdn.microsoft.com/en-us/library/system.io.stream.aspx)file by using the method shown in [Playing a Sound](HowTo_PlayASound.md). In addition to the method described in [Playing a Sound](HowTo_PlayASound.md), declare a **[SoundEffectInstance](xref:Microsoft.Xna.Framework.Audio.SoundEffectInstance)** and a **Sound Effect** field member. We also create two float fields for **pitch** and **volume** to store the pitch and volume of the sound effect and assign initial values to them.
>Usingsaredeclaredatthetopofthefiletoensurethatthenecessarynamespacesareavailabletothe class. The fields are declared at the top of the classto ensure that they are accessible to all methods in the class.
33
+
34
+
2. In the [Game.LoadContent](xref:Microsoft.Xna.Framework.Game.LoadContent) method, set the **SoundEffectInstance** object to the return value of [SoundEffect.CreateInstance](xref:Microsoft.Xna.Framework.Audio.SoundEffect.CreateInstance).
35
+
36
+
3. In the **[Game.LoadContent](xref:Microsoft.Xna.Framework.Game.LoadContent)** method, set the **SoundEffectInstance** object to the return value of **[SoundEffect.CreateInstance](xref:Microsoft.Xna.Framework.Audio.SoundEffect.CreateInstance)**. We also optionally define a variable **soundFile** to store the location of the sound file being used with the **[TitleContainer.OpenStream](xref:Microsoft.Xna.Framework.TitleContainer#Microsoft_Xna_Framework_TitleContainer_OpenStream_System_String_)** method, which is accessed with the **using** keyword, and include a field member variable called **soundEffect**, to hold the stream.
Copy file name to clipboardExpand all lines: articles/monogame/howto/content_pipeline/HowTo_Add_XML.md
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,6 @@ description: Describes how to add custom game data as an XML file through the Co
4
4
requireMSLicense: true
5
5
---
6
6
7
-
## Adding XML files to game content
8
-
9
7
Custom game data that is expressed in an XML format can be easily integrated into your game through the MonoGame Content Pipeline.
10
8
11
9
This example demonstrates the procedure for integrating custom XML data into the content project of a simple game for the Windows platform.
@@ -17,7 +15,7 @@ Within the MonoGame solution, you create a new Windows Game Library project.
17
15
1. Right-click the solution node, point to `Add`, click `New Project`, and then select the `MonoGame Game Library` template.
18
16
19
17
> [!TIP]
20
-
> A `MonoGame Game Library` project is created instead of a Content Pipeline Extension Library project so that the class we will define can be used by both the [Content Importer](xref:Microsoft.Xna.Framework.Content.Pipeline.ContentImporter-1) that runs at build-time and the [Content Loader](xref:Microsoft.Xna.Framework.Content.ContentManager#Microsoft_Xna_Framework_Content_ContentManager_Load__1_System_String_) at game runtime.
18
+
> A `MonoGame Game Library` project is created instead of a Content Pipeline Extension Library project so that the class we will define can be used by both the [Content Importer](https://docs.monogame.net/api/Microsoft.Xna.Framework.Content.Pipeline.ContentImporter-1.html) that runs at build-time and the [Content Loader](xref:Microsoft.Xna.Framework.Content.ContentManager#Microsoft_Xna_Framework_Content_ContentManager_Load__1_System_String_) at game runtime.
21
19
22
20
2. In the `Name` box, type `MyDataTypes`, and then click `OK`.
Copy file name to clipboardExpand all lines: articles/monogame/howto/graphics/HowTo_Create_a_RenderTarget.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ The example is very basic but the principles are the same, when drawing to a Ren
13
13
5. Draw your game as normal.
14
14
6. Draw the Render Texture to the screen in the position we desire (e.g. in the lower corner for a mini-map), most likely on top of your game graphics.
15
15
16
-
> TIP
16
+
> [!TIP]
17
17
> The technique is very useful, especially if you are doing split-screen gaming and need to draw multiple camera views.
Copy file name to clipboardExpand all lines: articles/monogame/howto/graphics/HowTo_RenderModel.md
+4-11Lines changed: 4 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,10 @@
1
1
---
2
2
title: How to render a Model using a Basic Effect
3
-
description: Demonstrates how to rotate a group of sprites around a single point.
3
+
description: Demonstrates how to load and render a model using the MonoGame Content Pipeline.
4
+
requireMSLicense: true
4
5
---
5
6
6
-
# Rendering a Model with a Basic Effect
7
-
8
-
Demonstrates how to load and render a model using the MonoGame Content Pipeline. It is assumed that an existing Windows game project is loaded in MonoGame. In this example, the project is called "CPModel."
7
+
> It is assumed that an existing Windows game project is loaded in MonoGame. In this example, the project is called "CPModel."
9
8
10
9
This example has three main parts: importing and processing the model, drawing the resultant managed object as a model with full lighting effect in the game, and enabling movement of the model with a game pad.
11
10
@@ -150,11 +149,5 @@ Development is complete so you are ready to build and run the game. Control the
0 commit comments