Regular sound that can be played in the audio environment
Inheritance: SFML.System.ObjectBase
Esempio n. 1
0
        public SoundInstance(ScriptEngine parent, string filename)
            : base(parent)
        {
            PopulateFunctions();

            string[] sounds = { ".wav", ".flac" };
            string[] music = { ".ogg" };

            if (!System.IO.File.Exists(filename)) {
                _soundType = SoundType.None;
                return;
            }

            _filename = filename;
            string ending = System.IO.Path.GetExtension(filename);
            if (Array.Exists(sounds, x => x == ending))
            {
                _sound = new Sound(new SoundBuffer(filename));
                _soundType = SoundType.Sound;
            }
            else if (Array.Exists(music, x => x == ending))
            {
                _music = new Music(filename);
                _soundType = SoundType.Music;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Load a new sound from a filepath. If this file has been used before it will be loaded from the cache.
 /// </summary>
 /// <param name="source">The path to the sound file.</param>
 /// <param name="loop">Determines if the sound should loop.</param>
 public Sound(string source, bool loop = false)
 {
     buffer = Sounds.Load(source);
     sound  = new SFML.Audio.Sound(buffer);
     Loop   = loop;
     sound.RelativeToListener = false;
 }
Esempio n. 3
0
        public void PlaySound(string name, bool loop = false, int volume = 100)
        {
            for (var i = 0; i < _sounds.Count; i++)
            {
                if (_sounds[i].Sound.Status == SoundStatus.Stopped)
                {
                    _sounds[i].Dispose();
                    _sounds.RemoveAt(i);
                    i--;
                }
            }

            if (name.Contains("background") && _sounds.Any(t => t.Name == name))
            {
                if (_sounds.Single(t => t.Name == name).Sound.Status != SoundStatus.Playing)
                {
                    _sounds.Single(t => t.Name == name).Sound.Play();
                }
            }
            else
            {
                var sound = new Sound(ResourceManager.Instance[name] as SoundBuffer);
                _sounds.Add(new SoundData(name, sound));
                sound.Loop = loop;
                sound.Volume = volume;
                sound.Play();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioStream"/> class.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="sndBuffer">The SND buffer.</param>
        public AudioStream(string fileName, SoundBuffer sndBuffer)
        {
            OutputBuffer = sndBuffer;
            _outputSound = new Sound(sndBuffer);

            Init(fileName, false);
        }
        public static void PlaySound(string filename)
        {
            var buffer = new SoundBuffer(filename);

            var sound = new Sound(buffer);
            sound.Play();
        }
Esempio n. 6
0
 /// <summary>
 /// Load a new sound from a filepath. If this file has been used before it will be loaded from the cache.
 /// </summary>
 /// <param name="source"></param>
 public Sound(string source, bool loop = false)
 {
     buffer = Sounds.Load(source);
     sound = new SFML.Audio.Sound(buffer);
     Loop = loop;
     sound.RelativeToListener = false;
 }
Esempio n. 7
0
        /// <summary>
        /// Play a sound
        /// </summary>
        private static void PlaySound()
        {
            // Load a sound buffer from a wav file
            SoundBuffer Buffer = new SoundBuffer("datas/sound/footsteps.wav");

            // Display sound informations
            Console.WriteLine("footsteps.wav :");
            Console.WriteLine(" " + Buffer.Duration      + " sec");
            Console.WriteLine(" " + Buffer.SampleRate    + " samples / sec");
            Console.WriteLine(" " + Buffer.ChannelsCount + " channels");

            // Create a sound instance and play it
            Sound Sound = new Sound(Buffer);
            Sound.Play();

            // Loop while the sound is playing
            while (Sound.Status == SoundStatus.Playing)
            {
                // Display the playing position
                Console.CursorLeft = 0;
                Console.Write("Playing... " + Sound.PlayingOffset + " sec     ");

                // Leave some CPU time for other processes
                Thread.Sleep(100);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioStreamImp"/> class.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="sndBuffer">The SND buffer.</param>
        public AudioStreamImp(string fileName, SoundBuffer sndBuffer)
        {
            OutputBuffer = sndBuffer;
            _outputSound = new SFML.Audio.Sound(sndBuffer);

            Init(fileName, false);
        }
Esempio n. 9
0
 public void SetSong(string key)
 {
     if (Sound.Status == SoundStatus.Playing)
         Sound.Stop();
     Sound = AssetManager.GetSound(key);
     Sound.PlayingOffset = 0f;
     Sound.Loop = false;
 }
Esempio n. 10
0
 public SoundInstance(SoundBuffer sound, float basePitch, float pitchVariance, float volume, bool looped = false)
 {
     this.sound = new Sound(sound);
     this.basePitch = basePitch;
     this.pitchVariance = pitchVariance;
     this.volume = volume;
     this.looped = looped;
 }
Esempio n. 11
0
        public static void Load()
        {
            // Redimensiona a lista
            Array.Resize(ref List, (byte)Sounds.Amount);

            // Carrega todos os arquivos e os adiciona a lista
            for (int i = 1; i < List.Length; i++)
                List[i] = new SFML.Audio.Sound(new SoundBuffer(Directories.Sounds.FullName + i + Format));
        }
Esempio n. 12
0
        public void PlaySound(string soundName)
        {
            var sound = new Sound(_sounds[soundName])
            {
                Loop = true
            };

            sound.Play();
        }
Esempio n. 13
0
 /// <summary>
 /// コンストラクター
 /// </summary>
 /// <param name="fileName">ファイル名</param>
 public SoundEffectTrack(string fileName)
 {
     if (fileName == null || fileName == "") {
         throw new ArgumentNullException ("FileName is null or empty");
     }
     this.fileName = fileName;
     this.data = new Sound (new SoundBuffer (fileName));
     this.data.Loop = false;
 }
Esempio n. 14
0
 public void PlaySound(string name)
 {
     Sound sound = new Sound();
     if (m_SoundBufferList.ContainsKey(name))
     {
         sound.SoundBuffer = m_SoundBufferList[name];
         sound.Play();
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioStream"/> class.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="streaming">if set to <c>true</c> [streaming].</param>
        public AudioStream(string fileName, bool streaming)
        {
            if (streaming)
                _outputStream = new Music(fileName);
            else
            {
                OutputBuffer = new SoundBuffer(fileName);
                _outputSound = new Sound(OutputBuffer);
            }

            Init(fileName, streaming);
        }
Esempio n. 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioStreamImp"/> class.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="streaming">if set to <c>true</c> [streaming].</param>
        public AudioStreamImp(string fileName, bool streaming)
        {
            if (streaming)
            {
                _outputStream = new Music(fileName);
            }
            else
            {
                OutputBuffer = new SoundBuffer(fileName);
                _outputSound = new SFML.Audio.Sound(OutputBuffer);
            }

            Init(fileName, streaming);
        }
Esempio n. 17
0
        public static void play(Sample sample, float volume = 0.65f, float pan = 0f, float pitch = 1f)
        {
            if (sample == null) return;
            if (Application.audio_disabled) return;

            var sound = new SA.Sound();

            sounds.Add(sound);
            sound.SoundBuffer = sample.buffer;
            sound.Loop = false;
            sound.Pitch = pitch;

            sound.Volume = volume * volume * sample.volume_modifier * 100f;
            sound.Play();
        }
Esempio n. 18
0
 /// <summary>
 /// Load a new sound from copying another sound.
 /// </summary>
 /// <param name="sound">The sound to copy from.</param>
 public Sound(Sound sound)
 {
     buffer     = sound.buffer;
     this.sound = new SFML.Audio.Sound(buffer);
     Loop       = sound.Loop;
     sound.RelativeToListener = sound.RelativeToListener;
     X               = sound.X;
     Y               = sound.Y;
     Z               = sound.Z;
     Volume          = sound.Volume;
     Pitch           = sound.Pitch;
     Attenuation     = sound.Attenuation;
     MinimumDistance = sound.MinimumDistance;
     Offset          = sound.Offset;
 }
Esempio n. 19
0
 public Sound Create(string key)
 {
     if (Sounds.ContainsKey(key))
     {
         return Sounds[key];
     }
     else if (Sounds.Count < MaxSoundCount)
     {
         Sounds[key] = new Sound(Game.Assets.Sounds[key]);
         return Sounds[key];
     }
     else
     {
         throw new Exception("Not enough channels. Use Release(...) to free unused channels.");
     }
 }
Esempio n. 20
0
        static public bool LoadSounds()
        {
            for (int i = 0; i < sound.Count(); i++) sound[i] = new Sound();

            sounds.Add("jump", new SoundBuffer(assembly.GetManifestResourceStream("TrainBox.snd.jump.wav")));
            sounds.Add("drop", new SoundBuffer(assembly.GetManifestResourceStream("TrainBox.snd.drop.wav")));
            sounds.Add("pickup", new SoundBuffer(assembly.GetManifestResourceStream("TrainBox.snd.pickup.wav")));
            sounds.Add("open", new SoundBuffer(assembly.GetManifestResourceStream("TrainBox.snd.open.wav")));
            sounds.Add("explode", new SoundBuffer(assembly.GetManifestResourceStream("TrainBox.snd.explode.wav")));
            sounds.Add("win", new SoundBuffer(assembly.GetManifestResourceStream("TrainBox.snd.win.wav")));

            music = new Music(assembly.GetManifestResourceStream("TrainBox.snd.m1.ogg"));
            endingMusic = new Music(assembly.GetManifestResourceStream("TrainBox.snd.m2.ogg"));

            return true;
        }
Esempio n. 21
0
        /// <summary>
        /// initialize Player and Enemies, by calling the constructors
        /// </summary>
        public static void Initialize()
        {
            gTime = new GameTime();
            BackgroundMusic = new Sound(new SoundBuffer("Sound/asia_1.ogg"));
            BackgroundMusic.Loop = true;
            BackgroundMusic.Volume = 30;
            BackgroundMusic.Play();

            JumpSound = new Sound(new SoundBuffer("Sound/jumpSound.wav"));
            JumpSound.Volume = 100;

            map = new Map(new System.Drawing.Bitmap("Pictures/Map.bmp"));
            Player = new Player(new Vector2f(map.TileSize + 30,map.TileSize + 30));
            enemy1 = new Enemy("Pictures/EnemyGreen.png", new Vector2f(800, 100), "Pictures/EnemyGreenMove.png");
            enemy2 = new Enemy("Pictures/EnemyRed.png", new Vector2f(100, 600), "Pictures/EnemyGreenMove.png");
        }
Esempio n. 22
0
        public void PlaySound(string soundName, double listenerX, double listenerY, double soundX, double soundY, int maxSoundDistance)
        {
            var distanceX = Math.Abs(listenerX - soundX);
            var distanceY = Math.Abs(listenerY - soundY);
            var totalDistance = Math.Sqrt((Math.Pow(distanceX, 2) + Math.Pow(distanceY, 2)));

            if (totalDistance > maxSoundDistance) return;

            var volume = (int)(maxSoundDistance - totalDistance) * (100 / maxSoundDistance);

            var sound = new Sound(_sounds[soundName])
            {
                Volume = volume
            };
            sound.Play();
        }
Esempio n. 23
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        public void Dispose()
        {
            if (_outputStream != null)
            {
                _outputStream.Dispose();
                _outputStream = null;
            }

            if (OutputBuffer != null)
            {
                //OutputBuffer.Dispose();
                OutputBuffer = null;
            }

            if (_outputSound != null)
            {
                _outputSound.Dispose();
                _outputSound = null;
            }
        }
Esempio n. 24
0
        static void Main(string[] args)
        {
            // Test();
            // return;

            Logger.WriteLine(args[0]);

            AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
            {
                Logger.WriteLine(eventArgs.ExceptionObject);
            };

            var fileStream = File.Open("C:\\Users\\Admin\\Downloads\\Similar Outskirts - Shockwave.mp3", FileMode.Open);

            MemoryStream ms     = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(ms);

            var sound = new Sound(new BinaryReader(fileStream));

            sound.decodeFullyInto(writer);
            fileStream.Close();

            var wavBytes = ms.ToArray();

            short[] samples = new short[wavBytes.Length / 2];
            Buffer.BlockCopy(wavBytes, 0, samples, 0, wavBytes.Length);

            var sound1 = new SFML.Audio.Sound(new SoundBuffer(samples, 2, 44100));

            sound1.Play();


            //Music sfmlMusic = new Music(wavBytes);
            //sfmlMusic.Play();

            Console.Read();

            Window window = new AudioPlayerWindow(args[0]);

            window.Run();
        }
Esempio n. 25
0
        public static Sound Play(string soundName, Vector3f position)
        {
            if (sounds.ContainsKey(soundName))
            {
                var sound = new Sound(sounds[soundName])
                                {
                                    RelativeToListener = false, // Don't follow the listener around.
                                    Position = position,
                                    MinDistance = 400f,
                                    Attenuation = 1f,
                                };

                sound.Play();

                return sound;
            }
            else
            {
                Console.WriteLine("Unable to play sound, file not found: " + soundName);

                return null;
            }
        }
Esempio n. 26
0
        public GameModeBase()
        {
            myId = 0;
            idSet = false;

            map = new TileMap();

            alerts = new List<HUDAlert>();
            entities = new Dictionary<ushort, EntityBase>();
            players = new Dictionary<byte, Player>();

            Effects = new List<EffectBase>();

            pathFinding = null;

            Fog = null;

            deathSound_Cliff = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/Death/0.wav"));
            unitCompleteSound_Worker = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/UnitCompleted/0.wav"));
            useSound_Cliff = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/UseCommand/0.wav"));
            gatherResourceSound_Cliff = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/GetResources/0.wav"));
            attackSound_Cliff = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/OnAttack/0.wav"));
        }
Esempio n. 27
0
        public CannonWeapon(Game game, Entity sourceObject)
            : base(game, sourceObject)
        {
            ProjectileSpeed = 600.0f;
            Damage = 4000;

            ProjectileRotateSpeed = 10;

            ShootSoundBuffer1 = new SoundBuffer("assets/audio/shotgun1.ogg");
            ShootSoundBuffer2 = new SoundBuffer("assets/audio/shotgun2.ogg");
            ShootSound1 = new Sound(ShootSoundBuffer1);
            ShootSound2 = new Sound(ShootSoundBuffer2);

            ExplosionSoundBuffer1 = new SoundBuffer("assets/audio/explode1.ogg");
            ExplosionSoundBuffer2 = new SoundBuffer("assets/audio/explode2.ogg");
            ExplosionSound1 = new Sound(ExplosionSoundBuffer1);
            ExplosionSound2 = new Sound(ExplosionSoundBuffer2);

            SplashSoundBuffer1 = new SoundBuffer("assets/audio/splash1.ogg");
            SplashSoundBuffer2 = new SoundBuffer("assets/audio/splash2.ogg");
            SplashSound1 = new Sound(SplashSoundBuffer1);
            SplashSound2 = new Sound(SplashSoundBuffer2);
        }
Esempio n. 28
0
        private void LoadResources()
        {
            // Set up start screen graphics
            Texture txStart = new Texture(@"resources\logo.png");

            spStart = new Sprite(txStart);

            // Main game screen background
            Texture txBack = new Texture(@"resources\back.png");

            spBack = new Sprite(txBack);

            Texture txDot = new Texture(@"resources\dot.png");

            spDot = new Sprite(txDot);

            powerSprites[0] = new Texture(@"resources\power-1.png");
            powerSprites[1] = new Texture(@"resources\power-2.png");
            powerSprites[2] = new Texture(@"resources\power-3.png");

            spPower = new Sprite((Texture)powerSprites[powerSpriteId]);

            startBuffer = new SFML.Audio.SoundBuffer(@"resources\pacman_beginning.wav");
            startSound  = new SFML.Audio.Sound(startBuffer);

            chompBuffer = new SFML.Audio.SoundBuffer(@"resources\dot.wav");
            chompSound  = new SFML.Audio.Sound(chompBuffer);

            energizerBuffer = new SFML.Audio.SoundBuffer(@"resources\energizer.wav");
            energizerSound  = new SFML.Audio.Sound(energizerBuffer);

            sirenBuffer = new SFML.Audio.SoundBuffer(@"resources\siren.wav");
            sirenSound  = new SFML.Audio.Sound(sirenBuffer);

            playerDeathBuffer = new SFML.Audio.SoundBuffer(@"resources\pacman_death.wav");
            playerDeathSound  = new SFML.Audio.Sound(playerDeathBuffer);
        }
Esempio n. 29
0
        public StandardMelee(InputHandler handler)
        {
            _mousePosition = new Vector2f(500, 500);

            CurrentStatus = StatusState.WaitingForPlayers;

            uiState = UIStateTypes.Normal;
            currentHotkey = null;
            currentHotkeySheet = null;
            standardHotkeys = Settings.GetSheet("standard_game_mode_controls");

            InputHandler = handler;
            myId = 0;
            map = new TileMap();

            allowMinimapCameraMove = true;
            selectedUnits = null;
            controlGroups = new Dictionary<Keyboard.Key, List<EntityBase>>();

            for (int i = 27; i <= 35; i++)
            {
                controlGroups.Add((Keyboard.Key) i, new List<EntityBase>());
            }

            controlBoxP1 = new Vector2f(0, 0);
            controlBoxP2 = new Vector2f(0, 0);
            selectedAttackMove = false;
            releaseSelect = false;

            CameraPosition = new Vector2f(0, 0);

            miniMap = new MiniMap(map, Fog, entities);

            //Load Sprites
            bottomHUDGUI = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/BottomGUI.png"));
            alertHUDAlert = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/Alert_Alert.png"));
            alertHUDUnitCreated = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/Alert_UnitCreated.png"));
            alertHUDBuildingCreated =
                new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/Alert_BuildingFinished.png"));

            avatarWorker = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/HUD_AVATAR_WORKER.png"));

            hudBoxUnit = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/HUD_BOX_Unit.png"));
            hudBoxBuilding = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/HUD_BOX_Building.png"));

            hudControlBox = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/ControlGroupBox.png"));
            hudControlBox.Origin = new Vector2f(hudControlBox.TextureRect.Width/2, 0);

            viewBounds = new Sprite(ExternalResources.GTexture("Resources/Sprites/Hud/ViewBounds.png"));

            //Load Sounds
            moveSound = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/MoveCommand/0.wav"));
            attackMoveSound = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/AttackCommand/0.wav"));

            backgroundMusic = new Music("Resources/Audio/Music/In Game/mario.wav");
            backgroundMusic.Loop = true;
            backgroundMusic.Volume = Settings.MUSICVOLUME;
            backgroundMusic.Play();
        }
 public void Load(string path)
 {
     this.sound = new Sound(new SoundBuffer(path));
 }
 public SoundResource(Sound sound)
 {
     this.sound = sound;
 }
Esempio n. 32
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            // Check that the device can capture audio
            if (SoundRecorder.IsAvailable == false)
            {
                Console.WriteLine("Sorry, audio capture is not supported by your system");
                return;
            }

            // Choose the sample rate
            Console.WriteLine("Please choose the sample rate for sound capture (44100 is CD quality) : ");
            uint sampleRate = uint.Parse(Console.ReadLine());

            // Wait for user input...
            Console.WriteLine("Press enter to start recording audio");
            Console.ReadLine();

            // Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer
            SoundBufferRecorder recorder = new SoundBufferRecorder();

            // Audio capture is done in a separate thread, so we can block the main thread while it is capturing
            recorder.Start(sampleRate);
            Console.WriteLine("Recording... press enter to stop");
            Console.ReadLine();
            recorder.Stop();

            // Get the buffer containing the captured data
            SoundBuffer buffer = recorder.SoundBuffer;

            // Display captured sound informations
            Console.WriteLine("Sound information :");
            Console.WriteLine(" " + buffer.Duration     + " seconds");
            Console.WriteLine(" " + buffer.SampleRate   + " samples / seconds");
            Console.WriteLine(" " + buffer.ChannelCount + " channels");

            // Choose what to do with the recorded sound data
            Console.WriteLine("What do you want to do with captured sound (p = play, s = save) ? ");
            char choice = char.Parse(Console.ReadLine());

            if (choice == 's')
            {
                // Choose the filename
                Console.WriteLine("Choose the file to create : ");
                string filename = Console.ReadLine();

                // Save the buffer
                buffer.SaveToFile(filename);
            }
            else
            {
                // Create a sound instance and play it
                Sound sound = new Sound(buffer);
                sound.Play();

                // Wait until finished
                while (sound.Status == SoundStatus.Playing)
                {
                    // Display the playing position
                    Console.CursorLeft = 0;
                    Console.Write("Playing... " + sound.PlayingOffset + " sec     ");

                    // Leave some CPU time for other threads
                    Thread.Sleep(100);
                }
            }

            // Finished !
            Console.WriteLine("\nDone !");
        }
Esempio n. 33
0
 public SoundInstance(SoundBuffer sound, float basePitch, float pitchVariance)
 {
     this.sound = new Sound(sound);
     this.basePitch = basePitch;
     this.pitchVariance = pitchVariance;
 }
Esempio n. 34
0
 /// <summary>
 /// Load a new sound from copying another sound.
 /// </summary>
 /// <param name="sound">The sound to copy from.</param>
 public Sound(Sound sound) {
     buffer = sound.buffer;
     this.sound = new SFML.Audio.Sound(buffer);
     Loop = sound.Loop;
     sound.RelativeToListener = sound.RelativeToListener;
     X = sound.X;
     Y = sound.Y;
     Z = sound.Z;
     Volume = sound.Volume;
     Pitch = sound.Pitch;
     Attenuation = sound.Attenuation;
     MinimumDistance = sound.MinimumDistance;
     Offset = sound.Offset;
 }
Esempio n. 35
0
 /// <summary>
 /// Load a new sound from an IO Stream.
 /// </summary>
 /// <param name="stream">The memory stream of the sound data.</param>
 /// <param name="loop">Determines if the sound should loop.</param>
 public Sound(Stream stream, bool loop = false) {
     buffer = new SoundBuffer(stream);
     sound = new SFML.Audio.Sound(buffer);
     Loop = loop;
 }
Esempio n. 36
0
 /// <summary>
 /// Load a new sound from an IO Stream.
 /// </summary>
 /// <param name="stream"></param>
 public Sound(Stream stream)
 {
     buffer = new SoundBuffer(stream);
     sound  = new SFML.Audio.Sound(buffer);
 }
Esempio n. 37
0
 /// <summary>
 /// Load a new sound from an IO Stream.
 /// </summary>
 /// <param name="stream">The memory stream of the sound data.</param>
 /// <param name="loop">Determines if the sound should loop.</param>
 public Sound(Stream stream, bool loop = false)
 {
     buffer = new SoundBuffer(stream);
     sound  = new SFML.Audio.Sound(buffer);
     Loop   = loop;
 }
Esempio n. 38
0
 public void Prepare(ref Sound sound, string key, int volume = 100, float pitch = 1.0f)
 {
     if (sound == null)
     {
         sound = Create(key);
         sound.Volume = volume;
         sound.Pitch = pitch;
     }
 }
Esempio n. 39
0
 public MusicManager()
 {
     Sound = new Sound();
     base.AddToList();
 }
Esempio n. 40
0
 public BasicFirework(Vector2f position, Vector2f initialVelocity, Vector2f gravity)
     : base(position, initialVelocity, gravity, 0.5f, 0.01f)
 {
     whistleSound = SoundManager.Play("whistlingrocket_" + Helper.GetRandomNumber(1, 4), new Vector3f(Position.X, 0, Position.Y));
     Modifiers.Add(new FadeModifier());
 }
Esempio n. 41
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the sound from another source
 /// </summary>
 /// <param name="copy">Sound to copy</param>
 ////////////////////////////////////////////////////////////
 public Sound(Sound copy) :
     base(sfSound_copy(copy.CPointer))
 {
     SoundBuffer = copy.SoundBuffer;
 }