Forum

Results 1 to 5 of 5

Thread: PlayWaveFile

  1. #1
    Join Date
    October 2014
    Posts
    60

    PlayWaveFile

    I'm using Playwavefile(AsoundFile, true) in the C# SDK.
    This plays my sound file looping which is what I want it to do.

    But...
    How would I stop it playing????

  2. #2
    Join Date
    May 2016
    Location
    Idar-Oberstein
    Posts
    163

  3. #3
    Join Date
    October 2014
    Posts
    60
    Quote Originally Posted by thorwe View Post
    Thanks thorwe,

    But I'm still struggling.

    I'm doing something similar to the below, which starts the wave file but doesn't Pause it.

    Calling noise.Close(); kills my app.

    Code:
    public void Connection_TalkStatusChanged(Client client, TalkStatus status, bool isReceivedWhisper)
    {
      WaveHandle noise = Connection.PlayWaveFile(staticsound, true);
    
      if (status == TalkStatus.Talking)
      {
         noise.Paused = False;
      }
     else 
     {
         noise.Paused = True;
     }
    }

  4. #4
    Join Date
    May 2016
    Location
    Idar-Oberstein
    Posts
    163
    You don't wanna create new handles on each talk status change.
    You'll want to create it once and use that throughout.

    Code:
    ...
    WaveHandle m_NoiseHandleAsClassMember = null;
    ...
    
    public void Connection_TalkStatusChanged(Client client, TalkStatus status, bool isReceivedWhisper)
    {
      if (m_NoiseHandleAsClassMember == null)
        m_NoiseHandleAsClassMember = Connection.PlayWaveFile(staticsound, true);
    
      if (status == TalkStatus.Talking)
      {
         m_NoiseHandleAsClassMember.Paused = False;
      }
     else 
     {
         m_NoiseHandleAsClassMember.Paused = True;
     }
    }

  5. #5
    Join Date
    October 2014
    Posts
    60
    Quote Originally Posted by thorwe View Post
    You don't wanna create new handles on each talk status change.
    You'll want to create it once and use that throughout.

    Code:
    ...
    WaveHandle m_NoiseHandleAsClassMember = null;
    ...
    
    public void Connection_TalkStatusChanged(Client client, TalkStatus status, bool isReceivedWhisper)
    {
      if (m_NoiseHandleAsClassMember == null)
        m_NoiseHandleAsClassMember = Connection.PlayWaveFile(staticsound, true);
    
      if (status == TalkStatus.Talking)
      {
         m_NoiseHandleAsClassMember.Paused = False;
      }
     else 
     {
         m_NoiseHandleAsClassMember.Paused = True;
     }
    }
    Thank you thorwe.

    I couldn't get m_NoiseHandleAsClassMember.Paused = True; working correctly with my code, but with your help I could now use Close.

    So the below did the trick.

    Code:
    ...
    WaveHandle m_NoiseHandleAsClassMember = null;
    ...
    
    public void Connection_TalkStatusChanged(Client client, TalkStatus status, bool isReceivedWhisper)
    {
    
      if (status == TalkStatus.Talking)
      {
          m_NoiseHandleAsClassMember = Connection.PlayWaveFile(staticsound, true);
      }
     else 
     {
         if (m_NoiseHandleAsClassMember != null)
         {
             m_NoiseHandleAsClassMember.Close();
         }
     }
    }
    Thanks again,
    Merry Christmas.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. playWaveFile: ERROR_OK but not playing anything
    By BaumwolleHD in forum Client Plugins / Lua Scripts
    Replies: 1
    Last Post: December 11th, 2015, 02:26 AM
  2. playWaveFile() not working properly? o_O
    By Dione in forum Client Plugins / Lua Scripts
    Replies: 2
    Last Post: August 10th, 2014, 07:26 PM
  3. Error playWaveFile failed
    By jurotti in forum Windows
    Replies: 3
    Last Post: September 23rd, 2010, 11:55 PM
  4. Question to ts3.playWaveFile
    By Flaver aKa hooK in forum Client Plugins / Lua Scripts
    Replies: 4
    Last Post: December 26th, 2009, 06:57 PM
  5. Question to ts3.playWaveFile
    By Flaver aKa hooK in forum Tools / Web Based
    Replies: 3
    Last Post: December 26th, 2009, 01:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •