• Home
  • Install
  • Cosmos Website
  • Articles
  • Cosmos
  • X#
  • IL2CPU
Show / Hide Table of Contents
  • Cosmos.Core
    • ACPI
    • ACPI.RSDPtr
    • Bootstrap
    • CPU
    • GCImplementation
    • GCTable
    • Global
    • INTs
    • INTs.EFlagsEnum
    • INTs.ExceptionInterruptDelegate
    • INTs.IRQContext
    • INTs.IRQDelegate
    • INTs.MMXContext
    • INTs.TSS
    • IOPort
    • KernelPanics
    • ManagedMemoryBlock
    • MemoryBlock
    • MemoryBlock08
    • MemoryBlock16
    • MemoryBlock32
    • MemoryMapBlock
    • MemoryOperations
    • PIC
    • PIC.Cmd
    • RawMemoryMapBlock
    • VTable
    • VTablesImpl
  • Cosmos.Core.IOGroup
    • ATA
    • PIC
    • PS2Controller
  • Cosmos.Core.Memory
    • Heap
    • HeapLarge
    • HeapMedium
    • HeapSmall
    • ObjectGCStatus
    • RAT
    • RAT.PageType
    • RootSMTBlock
    • SMTBlock
    • SMTPage
  • Cosmos.Core.MemoryGroup
    • AHCI
  • Cosmos.Core.Multiboot
    • Multiboot2
  • Cosmos.Core.Multiboot.Tags
    • AcpiNew
    • AcpiOld
    • BasicMemoryInformation
    • EFI64
    • Framebuffer
    • MB2Tag
    • MemoryMap
  • Cosmos.Core_Asm
    • ArrayClearAsm
    • ArrayGetLengthAsm
    • ArrayImpl
    • ArrayInternalCopyAsm
    • BufferBlockCopyAsm
    • BufferImpl
    • CPUCanReadCPUIDAsm
    • CPUDisableINTsAsm
    • CPUEnableINTsAsm
    • CPUGetEBPValue
    • CPUGetEndOfKernelAsm
    • CPUGetESPValue
    • CPUGetStackStart
    • CPUHaltAsm
    • CPUImpl
    • CPUInitFloatAsm
    • CPUInitSSEAsm
    • CPUReadCPUIDAsm
    • CPUReadModelSpecificRegisterAsm
    • CPUReadTimestampCounterAsm
    • CPUSetESPValue
    • CPUUpdateIDTAsm
    • CPUZeroFillAsm
    • DelegateCtorAsm
    • DelegateGetMulticastInvokeAsm
    • DelegateImpl
    • DelegateInvokeAsm
    • GCImplementationImpl
    • IOPortImpl
    • Multiboot2Impl
    • Multiboot2ImplAsm
    • RuntimeHelpersImpl
  • Cosmos.Core_Asm.MemoryOperations
    • MemoryOperationsCopy128BlocksAsm
    • MemoryOperationsCopy128BytesAsm
    • MemoryOperationsCopy16BytesAsm
    • MemoryOperationsCopy32BytesAsm
    • MemoryOperationsCopy64BytesAsm
    • MemoryOperationsFill16BlocksAsm
  • Cosmos.Debug.Kernel
    • Debugger
    • DebuggerFactory
  • Cosmos.HAL
    • BaudRate
    • Bootstrap
    • CardType
    • ClassID
    • COMPort
    • DataReceivedHandler
    • Device
    • DeviceID
    • Global
    • KeyboardBase
    • KeyboardBase.KeyPressedEventHandler
    • MouseBase
    • MouseBase.MouseChangedEventHandler
    • NetworkDevice
    • PCI
    • PCIBaseAddressBar
    • PCIDevice
    • PCIDevice.Config
    • PCIDevice.DeviceClass
    • PCIDevice.PCIBist
    • PCIDevice.PCICommand
    • PCIDevice.PCIHeaderType
    • PCIDevice.PCIInterruptPIN
    • PCIDeviceBridge
    • PCIDeviceCardbus
    • PCIDeviceNormal
    • PCSpeaker
    • PIT
    • PIT.PITTimer
    • PIT.PITTimer.OnTrigger
    • Power
    • ProgramIF
    • PS2Controller
    • PS2Keyboard
    • PS2Mouse
    • RTC
    • SerialPort
    • SpeakerExtensions
    • SubclassID
    • TextScreen
    • TextScreenBase
    • TextScreenHelpers
    • VendorID
  • Cosmos.HAL.Audio
    • AudioBitDepth
    • AudioBuffer
    • IAudioBufferProvider
    • SampleFormat
  • Cosmos.HAL.BlockDevice
    • AHCI
    • Ata
    • Ata.BusPositionEnum
    • Ata.ControllerIdEnum
    • ATA_PIO
    • ATA_PIO.Cmd
    • ATA_PIO.DvcSelVal
    • ATA_PIO.Ident
    • ATA_PIO.SpecLevel
    • ATA_PIO.Status
    • ATAPI
    • ATAPI.PacketCommands
    • BlockDevice
    • BlockDeviceType
    • EBR
    • EBR.PartInfo
    • GPT
    • GPT.GPartInfo
    • IDE
    • MBR
    • MBR.PartInfo
    • Partition
  • Cosmos.HAL.BlockDevice.Ports
    • SATA
    • SATAPI
    • StoragePort
  • Cosmos.HAL.BlockDevice.Registers
    • AHCISignature
    • ATACommands
    • ATADeviceStatus
    • Base
    • Bases
    • CommandAndStatus
    • CurrentInterfaceSpeedStatus
    • DeviceDetectionStatus
    • FISRegisterD2H
    • FISRegisterH2D
    • FISSize
    • FISType
    • GenericRegisters
    • HBACommandHeader
    • HBACommandTable
    • HBAPRDTEntry
    • InterfacePowerManagementStatus
    • InterruptEnable
    • InterruptStatus
    • PortRegisters
    • PortType
  • Cosmos.HAL.Drivers.Audio
    • AC97
    • AudioDriver
  • Cosmos.HAL.Drivers.Network
    • AMDPCNetII
    • E1000
    • E1000.RXDesc
    • E1000.TXDesc
    • E1000DeviceID
    • RTL8139
  • Cosmos.HAL.Drivers.USB
    • USBHost
  • Cosmos.HAL.Drivers.Video
    • VBEDriver
    • VGADriver
    • VGADriver.ColorDepth
    • VGADriver.ScreenSize
    • VGADriver.TextSize
  • Cosmos.HAL.Drivers.Video.SVGAII
    • Capability
    • FIFO
    • FIFOCommand
    • ID
    • IOPortOffset
    • Register
    • VMWareSVGAII
  • Cosmos.HAL.Network
    • MACAddress
    • NetworkInit
  • Cosmos.System
    • Console
    • ConsoleKeyEx
    • ConsoleKeyExExtensions
    • Durations
    • Global
    • Kernel
    • KeyboardManager
    • KeyEvent
    • KeyEvent.KeyEventType
    • KeyMapping
    • MouseManager
    • MouseState
    • Notes
    • PCSExtensions
    • PCSpeaker
    • Power
    • ScanMapBase
    • VMTools
  • Cosmos.System.Audio
    • AudioManager
    • AudioMixer
    • AudioStream
  • Cosmos.System.Audio.DSP.Processing
    • AudioPostProcessor
    • GainPostProcessor
  • Cosmos.System.Audio.IO
    • AudioBufferReader
    • AudioBufferReadWriteBase
    • AudioBufferWriter
    • MemoryAudioStream
    • SeekableAudioStream
  • Cosmos.System.ExtendedASCII
    • CosmosEncodingProvider
  • Cosmos.System.FileSystem
    • CosmosVFS
    • Disk
    • FileSystem
    • FileSystemFactory
    • ManagedPartition
  • Cosmos.System.FileSystem.FAT
    • FatFileSystemFactory
  • Cosmos.System.FileSystem.FAT.Listing
    • FatDirectoryEntryAttributeConsts
    • FatDirectoryEntryMetadata
    • FatDirectoryEntryMetadata.LongFilenameEntryMetadata
  • Cosmos.System.FileSystem.ISO9660
    • ISO9660FileSystem
    • ISO9660FileSystemFactory
  • Cosmos.System.FileSystem.Listing
    • DirectoryEntry
    • DirectoryEntryTypeEnum
  • Cosmos.System.FileSystem.VFS
    • FileSystemManager
    • VFSBase
    • VFSManager
  • Cosmos.System.Graphics
    • Bitmap
    • Canvas
    • ColorDepth
    • ColorOrder
    • FullScreenCanvas
    • Image
    • ImageFormat
    • Mode
    • SVGAIICanvas
    • VBECanvas
    • VGACanvas
    • VGAScreen
  • Cosmos.System.Graphics.Fonts
    • Font
    • PCScreenFont
    • UnicodeMapping
  • Cosmos.System.Helpers
    • ArrayHelper
  • Cosmos.System.IO
    • ConsoleStream
    • SyncTextReader
  • Cosmos.System.Keyboard
    • KeyEventHelper
  • Cosmos.System.Network
    • EthernetPacket
    • NetworkDebugger
    • NetworkStack
  • Cosmos.System.Network.ARP
    • ARPPacket
  • Cosmos.System.Network.Config
    • DNSConfig
    • IPConfig
    • NetworkConfig
    • NetworkConfiguration
  • Cosmos.System.Network.IPv4
    • Address
    • EndPoint
    • ICMPClient
    • ICMPPacket
    • IPPacket
    • OutgoingBuffer
  • Cosmos.System.Network.IPv4.TCP
    • Flags
    • Status
    • Tcp
    • TCPOption
    • TCPPacket
    • TransmissionControlBlock
  • Cosmos.System.Network.IPv4.UDP
    • UdpClient
    • UDPPacket
  • Cosmos.System.Network.IPv4.UDP.DHCP
    • DHCPClient
    • DHCPOption
    • DHCPPacket
  • Cosmos.System.Network.IPv4.UDP.DNS
    • DNSAnswer
    • DnsClient
    • DNSPacket
    • DNSPacketAnswer
    • DNSPacketAsk
    • DNSQuery
    • ReplyCode
  • Cosmos.System.ScanMaps
    • DEStandardLayout
    • ESStandardLayout
    • FRStandardLayout
    • GBStandardLayout
    • TRStandardLayout
    • US_Dvorak
    • USStandardLayout

Class AudioBuffer

Represents a buffer of channel-interleaved audio samples.

Inheritance
System.Object
AudioBuffer
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Cosmos.HAL.Audio
Assembly: Cosmos.HAL2.dll
Syntax
public class AudioBuffer

Constructors

| Improve this Doc View Source

AudioBuffer(Int32, SampleFormat)

Creates an empty AudioBuffer.

Declaration
public AudioBuffer(int size, SampleFormat format)
Parameters
Type Name Description
System.Int32 size

The size of the buffer.

SampleFormat format

The target format of the audio buffer.

Fields

| Improve this Doc View Source

Format

The audio format of the buffer.

Declaration
public readonly SampleFormat Format
Field Value
Type Description
SampleFormat

Properties

| Improve this Doc View Source

RawData

Provides access to the raw buffer data.

Declaration
public byte[] RawData { get; }
Property Value
Type Description
System.Byte[]
| Improve this Doc View Source

SampleAmount

The amount of sample values the buffer contains.

Declaration
public int SampleAmount { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Size

The size of the audio buffer, in audio samples. Setting this property to a different value causes the audio buffer to flush.

Declaration
public int Size { get; set; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Flush()

Flushes (empties) the audio buffer, setting all of its sample data to zero.

Declaration
public void Flush()
| Improve this Doc View Source

ReadSample(Int32, Byte*)

Reads a sample from the audio buffer to the target pointer in memory.

Declaration
public void ReadSample(int index, byte *dest)
Parameters
Type Name Description
System.Int32 index

The index of the audio sample to read.

System.Byte* dest

The part of memory to write the sample to.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when attempting to write to a non-existent sample.

| Improve this Doc View Source

ReadSample(Int32, Byte[], Int32)

Reads a sample from the audio buffer to the target array.

Declaration
public void ReadSample(int index, byte[] dest, int destOffset = 0)
Parameters
Type Name Description
System.Int32 index

The index of the audio sample to read.

System.Byte[] dest

The array to write the sample to.

System.Int32 destOffset

The offset in the array to write data to.

Exceptions
Type Condition
System.ArgumentException

Thrown when the provided destination array is not large enough to hold all of the bytes.

System.ArgumentOutOfRangeException

Thrown when attempting to write to a non-existent sample.

| Improve this Doc View Source

ReadSampleChannel(Int32, Int32, Byte*)

Reads a single channel of a sample to the target pointer in memory.

Declaration
public void ReadSampleChannel(int index, int channel, byte *dest)
Parameters
Type Name Description
System.Int32 index

The index of the audio sample to read the channel of.

System.Int32 channel

The target channel to read.

System.Byte* dest

The part of memory to write the sample to.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when attempting to write to a non-existent channel or sample.

| Improve this Doc View Source

ReadSampleChannel(Int32, Int32, Byte[], Int32)

Reads a single channel of a sample to the target array.

Declaration
public void ReadSampleChannel(int index, int channel, byte[] dest, int destOffset = 0)
Parameters
Type Name Description
System.Int32 index

The index of the audio sample to read the channel of.

System.Int32 channel

The target channel to read.

System.Byte[] dest

The array to write the sample to.

System.Int32 destOffset

The offset in the array to write data to.

Exceptions
Type Condition
System.ArgumentException

Thrown when the provided source array is not large enough to hold all of the bytes.

System.ArgumentOutOfRangeException

Thrown when attempting to write to a non-existent channel or sample.

| Improve this Doc View Source

WriteSample(Int32, Byte*)

Writes a sample from the target pointer in memory to the buffer. The amount of bytes that will be read is equal to .

Declaration
public void WriteSample(int index, byte *src)
Parameters
Type Name Description
System.Int32 index

The index of the audio sample to overwrite.

System.Byte* src

The part of memory to read the data from.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when attempting to write to a non-existent sample.

| Improve this Doc View Source

WriteSample(Int32, Byte[], Int32)

Writes a sample to the audio buffer, reading the sample data from the specified array beginning at srcOffset.

Declaration
public void WriteSample(int index, byte[] src, int srcOffset = 0)
Parameters
Type Name Description
System.Int32 index

The index of the audio sample to overwrite.

System.Byte[] src

The array to read the sample from.

System.Int32 srcOffset

The offset in the array to read data from.

Exceptions
Type Condition
System.ArgumentException

Thrown when the provided source array is not large enough to provide all of the bytes.

System.ArgumentOutOfRangeException

Thrown when attempting to write to a non-existent sample.

| Improve this Doc View Source

WriteSampleChannel(Int32, Int32, Byte*)

Changes the value of a single channel of the specified sample to the value that's located in memory at the specified pointer. The amount of bytes that will be read is equal to the value of .

Declaration
public void WriteSampleChannel(int index, int channel, byte *src)
Parameters
Type Name Description
System.Int32 index

The index of the audio sample to overwrite the channel of.

System.Int32 channel

The channel to overwrite.

System.Byte* src

The part of memory to read the data from.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when attempting to write to a non-existent channel or sample.

| Improve this Doc View Source

WriteSampleChannel(Int32, Int32, Byte[], Int32)

Changes the value of a single channel of the specified sample to the value that's located at index srcOffset of the given array. The amount of bytes that will be read is equal to the value of .

Declaration
public void WriteSampleChannel(int index, int channel, byte[] src, int srcOffset = 0)
Parameters
Type Name Description
System.Int32 index

The index of the audio sample to overwrite the channel of.

System.Int32 channel

The channel to overwrite.

System.Byte[] src

The array to read the data from.

System.Int32 srcOffset

The starting index to read the data from src.

Exceptions
Type Condition
System.ArgumentException

Thrown when the provided source array is not large enough to provide all of the bytes.

System.ArgumentOutOfRangeException

Thrown when attempting to write to a non-existent channel or sample.

  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
☀
☾