Jump to content
Xtreme .Net Talk

Search the Community

Showing results for tags 'directsound'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • New Member at Xtreme .Net Talk?
    • Meet and Greet
    • Announcements
  • .NET
    • General
    • Windows Forms
    • ASP.NET
    • Directory / File IO / Registry
    • Database / XML / Reporting
    • Network
    • Graphics and Multimedia
    • Interoperation / Office Integration
    • Deployment
    • Regular Expressions
    • Syntax Specific
  • Knowledge Base
    • Tutors Corner
    • Code Library
    • Quick Tips
  • Xtreme .Net Talk Members Area
    • Water Cooler
    • Suggestions, Bugs, and Comments

Blogs

There are no results to display.

Categories

  • Code Samples
  • Tutorials & Guides
  • Articles
  • Code Downloads

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Location


Occupation


Visual Studio .NET Version


.NET Preferred Language


Skype


Facebook


Twitter ( X )

Found 1 result

  1. Hello, for three days now, I have been working with DirectSound, and have ran into a pretty big issue. I cannot figure out how to return a byte array from the SecondaryBuffer, I understand how to create the secondary buffer from a memory stream but not vice-versa, I need to either: A: Read the SecondaryBuffer to a Memory stream. B: Read the SecondaryBuffer to a Byte array. Here is what I have so far (please let me know if there is anything I can improve): ------------------------------------------------------------------------- Public Class DSound2 Public DSDevice As DirectSound.Device Public DSBuffers As New List(Of DirectSound.SecondaryBuffer) Public Sub Save(ByVal Path As String) 'Create directory if it does not exist. If Not IO.Directory.Exists(Path.Remove(Path.LastIndexOf("\"))) Then IO.Directory.CreateDirectory(Path.Remove(Path.LastIndexOf("\"))) End If 'Create file if it does not exist and close it. If Not IO.File.Exists(Path) Then IO.File.Create(Path).Close() End If 'Declare storage for SecondaryBuffer Dim StreamBytes As Byte() = New Byte(39999) {} Dim StreamDat As New IO.MemoryStream(StreamBytes, 0, 40000, True, True) 'Loop through each SecondaryBuffer, returning data to StreamDat. For Each File In DSBuffers 'File.Read seems to never return the correct data, ever. 'I know I am doing something wrong and it will take work to fix it but 'I thought this part would be easy, I've swapped pieces of code around many times and the best I could get was a byte array full of zeros. File.Read(0, StreamDat, DirectSound.LockFlag.EntireBuffer, DirectSound.LockFlag.None) 'Transfer the data from the MemoryStream to the Byte Array. StreamBytes = StreamDat.ToArray() Next End Sub End Class ------------------------------------------------------------------------- I would just like to convert the SecondaryStream object to Base64 data and write the combined DSBuffer objects to one single file. It's getting the data back from SecondaryStream that is the issue though. Any help/comments would very much be appreciated. I will continue research to find a fix and will post back if I find one. Thanks.
×
×
  • Create New...