Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GI.GstAudio.Structs.DsdInfo
Description
Information describing DSD audio properties.
In DSD, the "sample format" is the bit. Unlike PCM, there are no further
"sample formats" in DSD. However, in software, DSD bits are grouped into
bytes (since dealing with individual bits is impractical), and these bytes
in turn are grouped into words. This becomes relevant when interleaving
channels and transmitting DSD data through audio APIs. The different
types of grouping DSD bytes are referred to as the "DSD grouping forma"
or just "DSD format". DsdFormat
has a list of valid ways of grouping
DSD bytes into words.
DSD rates are equivalent to PCM sample rates, except that they specify
how many DSD bytes are consumed per second. This refers to the bytes per
second _per channel_; the rate does not change when the number of channel
changes. (Strictly speaking, it would be more correct to measure the
*bits* per second, since the bit is the DSD "sample format", but it is
more practical to use bytes.) In DSD, bit rates are always an integer
multiple of the CD audio rate (44100) or the DAT rate (48000). DSD64-44x
is 44100 * 64 = 2822400 bits per second, or 352800 bytes per second
(the latter would be used in this info structure). DSD64-48x is
48000 * 64 = 3072000 bits per second, or 384000 bytes per second.
GST_DSD_MAKE_DSD_RATE_44x
can be used for specifying DSD-44x rates,
*and GST_DSD_MAKE_DSD_RATE_48x
can be used for specifying DSD-48x ones.
Also, since DSD-48x is less well known, when the multiplier is given
without the 44x/48x specifier, 44x is typically implied.
It is important to know that in DSD, different format widths correspond to different playtimes. That is, a word with 32 DSD bits covers two times as much playtime as a word with 16 DSD bits. This is in contrast to PCM, where one word (= one PCM sample) always covers a time period of 1/samplerate, no matter how many bits a PCM sample is made of. For this reason, DSD and PCM widths and strides cannot be used the same way.
Multiple channels are arranged in DSD data either interleaved or non- interleaved. This is similar to PCM. Interleaved layouts rotate between channels and words. First, word 0 of channel 0 is present. Then word 0 of channel 1 follows. Then word 0 of channel 2 etc. until all channels are through, then comes word 1 of channel 0 etc.
Non-interleaved data is planar. First, all words of channel 0 are
present, then all words of channel 1 etc. Unlike interleaved data,
non-interleaved data can be sparse, that is, there can be space in
between the planes. the positions
array specifies the plane offsets.
In uncommon cases, the DSD bits in the data bytes can be stored in reverse
order. For example, normally, in DSDU8, the first byte contains DSD bits
0 to 7, and the most significant bit of that byte is DSD bit 0. If this
order is reversed, then bit 7 is the first one instead. In that ase,
reversedBytes
is set to TRUE.
Use the provided macros to access the info in this structure.
Since: 1.24
Synopsis
- newtype DsdInfo = DsdInfo (ManagedPtr DsdInfo)
- newZeroDsdInfo :: MonadIO m => m DsdInfo
- dsdInfoCopy :: (HasCallStack, MonadIO m) => DsdInfo -> m DsdInfo
- dsdInfoFree :: (HasCallStack, MonadIO m) => DsdInfo -> m ()
- dsdInfoFromCaps :: (HasCallStack, MonadIO m) => Caps -> m (Bool, DsdInfo)
- dsdInfoInit :: (HasCallStack, MonadIO m) => m DsdInfo
- dsdInfoIsEqual :: (HasCallStack, MonadIO m) => DsdInfo -> DsdInfo -> m Bool
- dsdInfoNew :: (HasCallStack, MonadIO m) => m DsdInfo
- dsdInfoNewFromCaps :: (HasCallStack, MonadIO m) => Caps -> m DsdInfo
- dsdInfoSetFormat :: (HasCallStack, MonadIO m) => DsdInfo -> DsdFormat -> Int32 -> Int32 -> Maybe [AudioChannelPosition] -> m ()
- dsdInfoToCaps :: (HasCallStack, MonadIO m) => DsdInfo -> m Caps
- getDsdInfoChannels :: MonadIO m => DsdInfo -> m Int32
- setDsdInfoChannels :: MonadIO m => DsdInfo -> Int32 -> m ()
- getDsdInfoFlags :: MonadIO m => DsdInfo -> m [AudioFlags]
- setDsdInfoFlags :: MonadIO m => DsdInfo -> [AudioFlags] -> m ()
- getDsdInfoFormat :: MonadIO m => DsdInfo -> m DsdFormat
- setDsdInfoFormat :: MonadIO m => DsdInfo -> DsdFormat -> m ()
- getDsdInfoLayout :: MonadIO m => DsdInfo -> m AudioLayout
- setDsdInfoLayout :: MonadIO m => DsdInfo -> AudioLayout -> m ()
- getDsdInfoRate :: MonadIO m => DsdInfo -> m Int32
- setDsdInfoRate :: MonadIO m => DsdInfo -> Int32 -> m ()
- getDsdInfoReversedBytes :: MonadIO m => DsdInfo -> m Bool
- setDsdInfoReversedBytes :: MonadIO m => DsdInfo -> Bool -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq DsdInfo Source # | |
GBoxed DsdInfo Source # | |
Defined in GI.GstAudio.Structs.DsdInfo | |
ManagedPtrNewtype DsdInfo Source # | |
Defined in GI.GstAudio.Structs.DsdInfo Methods toManagedPtr :: DsdInfo -> ManagedPtr DsdInfo | |
TypedObject DsdInfo Source # | |
Defined in GI.GstAudio.Structs.DsdInfo | |
HasParentTypes DsdInfo Source # | |
Defined in GI.GstAudio.Structs.DsdInfo | |
tag ~ 'AttrSet => Constructible DsdInfo tag Source # | |
IsGValue (Maybe DsdInfo) Source # | Convert |
Defined in GI.GstAudio.Structs.DsdInfo Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe DsdInfo -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe DsdInfo) | |
type ParentTypes DsdInfo Source # | |
Defined in GI.GstAudio.Structs.DsdInfo |
Methods
Click to display all available methods, including inherited ones
copy
Arguments
:: (HasCallStack, MonadIO m) | |
=> DsdInfo |
|
-> m DsdInfo | Returns: a new |
Copy a GstDsdInfo structure.
Since: 1.24
free
Arguments
:: (HasCallStack, MonadIO m) | |
=> DsdInfo |
|
-> m () |
Free a GstDsdInfo structure previously allocated with dsdInfoNew
or dsdInfoCopy
.
Since: 1.24
fromCaps
Arguments
:: (HasCallStack, MonadIO m) | |
=> Caps |
|
-> m (Bool, DsdInfo) | Returns: TRUE if |
Parse caps
and update info
.
Since: 1.24
init
dsdInfoInit :: (HasCallStack, MonadIO m) => m DsdInfo Source #
Initialize info
with default values.
Since: 1.24
isEqual
Compares two DsdInfo
and returns whether they are equal or not
Since: 1.24
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> m DsdInfo | Returns: a new |
Allocate a new DsdInfo
that is also initialized with
dsdInfoInit
.
Since: 1.24
newFromCaps
Arguments
:: (HasCallStack, MonadIO m) | |
=> Caps |
|
-> m DsdInfo |
Parse caps
to generate a DsdInfo
.
Since: 1.24
setFormat
Arguments
:: (HasCallStack, MonadIO m) | |
=> DsdInfo |
|
-> DsdFormat |
|
-> Int32 |
|
-> Int32 |
|
-> Maybe [AudioChannelPosition] |
|
-> m () |
Set the default info for the DSD info of format
and rate
and channels
.
Note: This initializes info
first, no values are preserved.
Since: 1.24
toCaps
Arguments
:: (HasCallStack, MonadIO m) | |
=> DsdInfo |
|
-> m Caps | Returns: the new |
Convert the values of info
into a Caps
.
Since: 1.24
Properties
channels
number of channels (must be at least 1)
getDsdInfoChannels :: MonadIO m => DsdInfo -> m Int32 Source #
Get the value of the “channels
” field.
When overloading is enabled, this is equivalent to
get
dsdInfo #channels
setDsdInfoChannels :: MonadIO m => DsdInfo -> Int32 -> m () Source #
Set the value of the “channels
” field.
When overloading is enabled, this is equivalent to
set
dsdInfo [ #channels:=
value ]
flags
No description available in the introspection data.
getDsdInfoFlags :: MonadIO m => DsdInfo -> m [AudioFlags] Source #
Get the value of the “flags
” field.
When overloading is enabled, this is equivalent to
get
dsdInfo #flags
setDsdInfoFlags :: MonadIO m => DsdInfo -> [AudioFlags] -> m () Source #
Set the value of the “flags
” field.
When overloading is enabled, this is equivalent to
set
dsdInfo [ #flags:=
value ]
format
DSD grouping format
getDsdInfoFormat :: MonadIO m => DsdInfo -> m DsdFormat Source #
Get the value of the “format
” field.
When overloading is enabled, this is equivalent to
get
dsdInfo #format
setDsdInfoFormat :: MonadIO m => DsdInfo -> DsdFormat -> m () Source #
Set the value of the “format
” field.
When overloading is enabled, this is equivalent to
set
dsdInfo [ #format:=
value ]
layout
audio layout
getDsdInfoLayout :: MonadIO m => DsdInfo -> m AudioLayout Source #
Get the value of the “layout
” field.
When overloading is enabled, this is equivalent to
get
dsdInfo #layout
setDsdInfoLayout :: MonadIO m => DsdInfo -> AudioLayout -> m () Source #
Set the value of the “layout
” field.
When overloading is enabled, this is equivalent to
set
dsdInfo [ #layout:=
value ]
rate
DSD rate
getDsdInfoRate :: MonadIO m => DsdInfo -> m Int32 Source #
Get the value of the “rate
” field.
When overloading is enabled, this is equivalent to
get
dsdInfo #rate
setDsdInfoRate :: MonadIO m => DsdInfo -> Int32 -> m () Source #
Set the value of the “rate
” field.
When overloading is enabled, this is equivalent to
set
dsdInfo [ #rate:=
value ]
reversedBytes
true if the DSD bits in the data bytes are reversed, that is, the least significant bit comes first
getDsdInfoReversedBytes :: MonadIO m => DsdInfo -> m Bool Source #
Get the value of the “reversed_bytes
” field.
When overloading is enabled, this is equivalent to
get
dsdInfo #reversedBytes
setDsdInfoReversedBytes :: MonadIO m => DsdInfo -> Bool -> m () Source #
Set the value of the “reversed_bytes
” field.
When overloading is enabled, this is equivalent to
set
dsdInfo [ #reversedBytes:=
value ]