Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. [Message Deleted]

[Message Deleted]

Scheduled Pinned Locked Moved C#
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hkjghkj1
    wrote on last edited by
    #1

    [Message Deleted]

    D D A 3 Replies Last reply
    0
    • H hkjghkj1

      [Message Deleted]

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You can't use more than one instance of a SoundPlayer and have them all playing at the same time. You'll have to use the MediaPlayer component to play the background sound and use the SoundPlayer to play your button click sounds.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      1 Reply Last reply
      0
      • H hkjghkj1

        [Message Deleted]

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #3

        I believe (from previous research a while ago) it can be done with DirectX. I've never attempted it so I can't offer any working samples/articles but adding that into your search terms may yield some useful results.

        Dave
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
        Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
        Why are you using VB6? Do you hate yourself? (Christian Graus)

        1 Reply Last reply
        0
        • H hkjghkj1

          [Message Deleted]

          A Offline
          A Offline
          ARon_
          wrote on last edited by
          #4

          You can use: 1) DirectX 9 Managed Wrapper which I understand to be obsolete

          using Microsoft.DirectX.AudioVideoPlayback;
          ...
          BackgroundMusic = new Audio(fileName, false);
          BackgroundMusic.Play();

          and

          using Microsoft.DirectX.DirectSound;
          ...

          public class Sound : IDisposable
          {
          private static Device SoundDevice;
          private SecondaryBuffer MyBuffer;
          ...

          public static void Initialize()
          {
          SoundDevice = new Microsoft.DirectX.DirectSound.Device();
          SoundDevice.SetCooperativeLevel(Form.Handle, CooperativeLevel.Priority);
          }
          ...
          public Sound(string AudioFileName)
          {
          BufferDescription desc = new BufferDescription();
          desc.Flags = BufferDescriptionFlags.ControlPan | BufferDescriptionFlags.ControlVolume |
          BufferDescriptionFlags.ControlFrequency;
          MyBuffer = new SecondaryBuffer(AudioFileName, desc, SoundDevice);
          }
          ...
          MyBuffer.Play();

          Go to DigiPen Webcast[^] Puc The Pirate - Hour 11 2) OpenAL, I don't have an example but there are example in the Toa Framework[^]

          ARon

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups