Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Martin Finkel
LibVLCSharp
Commits
858df224
Commit
858df224
authored
Dec 01, 2017
by
Martin Finkel
Committed by
Martin Finkel
Dec 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Equalizer
parent
c81421ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
155 additions
and
0 deletions
+155
-0
libvlcsharp/Manual/Equalizer.cs
libvlcsharp/Manual/Equalizer.cs
+155
-0
No files found.
libvlcsharp/Manual/Equalizer.cs
0 → 100644
View file @
858df224
using
System
;
using
System.Runtime.InteropServices
;
using
System.Security
;
namespace
VideoLAN.LibVLC.Manual
{
public
class
Equalizer
:
Internal
{
struct
Native
{
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_new"
)]
internal
static
extern
IntPtr
LibVLCAudioEqualizerNew
();
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_release"
)]
internal
static
extern
void
LibVLCAudioEqualizerRelease
(
IntPtr
equalizer
);
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_new_from_preset"
)]
internal
static
extern
IntPtr
LibVLCAudioEqualizerNewFromPreset
(
uint
index
);
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_set_preamp"
)]
internal
static
extern
int
LibVLCAudioEqualizerSetPreamp
(
IntPtr
equalizer
,
float
preamp
);
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_get_preamp"
)]
internal
static
extern
float
LibVLCAudioEqualizerGetPreamp
(
IntPtr
equalizer
);
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_set_amp_at_index"
)]
internal
static
extern
int
LibVLCAudioEqualizerSetAmpAtIndex
(
IntPtr
equalizer
,
float
amp
,
uint
band
);
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_get_amp_at_index"
)]
internal
static
extern
float
LibVLCAudioEqualizerGetAmpAtIndex
(
IntPtr
equalizer
,
uint
band
);
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_get_preset_count"
)]
internal
static
extern
uint
LibVLCAudioEqualizerGetPresetCount
();
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_get_preset_name"
)]
internal
static
extern
IntPtr
LibVLCAudioEqualizerGetPresetName
(
uint
index
);
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_get_band_count"
)]
internal
static
extern
uint
LibVLCAudioEqualizerGetBandCount
();
[
SuppressUnmanagedCodeSecurity
]
[
DllImport
(
"libvlc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
EntryPoint
=
"libvlc_audio_equalizer_get_band_frequency"
)]
internal
static
extern
float
LibVLCAudioEqualizerGetBandFrequency
(
uint
index
);
}
/// <summary>
/// Create a new default equalizer, with all frequency values zeroed.
/// The new equalizer can subsequently be applied to a media player by invoking
/// libvlc_media_player_set_equalizer().
/// version LibVLC 2.2.0 or later
/// </summary>
public
Equalizer
()
:
base
(
Native
.
LibVLCAudioEqualizerNew
,
Native
.
LibVLCAudioEqualizerRelease
)
{
}
/// <summary>
/// Create a new equalizer, with initial frequency values copied from an existing preset.
/// The new equalizer can subsequently be applied to a media player by invoking
/// libvlc_media_player_set_equalizer().
/// version LibVLC 2.2.0 or later
/// </summary>
/// <param name="index">index of the preset, counting from zero</param>
public
Equalizer
(
uint
index
)
:
base
(()
=>
Native
.
LibVLCAudioEqualizerNewFromPreset
(
index
),
Native
.
LibVLCAudioEqualizerRelease
)
{
}
/// <summary>
/// Set a new pre-amplification value for an equalizer.
/// The new equalizer settings are subsequently applied to a media player by invoking
/// MediaPlayer::setEqualizer().
/// The supplied amplification value will be clamped to the -20.0 to +20.0 range.
/// </summary>
/// <param name="preamp">preamp value (-20.0 to 20.0 Hz)</param>
/// LibVLC 2.2.0 or later
/// <returns>true on success, false otherwise</returns>
public
bool
SetPreamp
(
float
preamp
)
=>
Native
.
LibVLCAudioEqualizerSetPreamp
(
NativeReference
,
preamp
)
==
0
;
/// <summary>
/// Get the current pre-amplification value from an equalizer.
/// return preamp value (Hz)
/// LibVLC 2.2.0 or later
/// </summary>
public
float
Preamp
=>
Native
.
LibVLCAudioEqualizerGetPreamp
(
NativeReference
);
/// <summary>
/// Set a new amplification value for a particular equalizer frequency band.
/// The new equalizer settings are subsequently applied to a media player by invoking MediaPlayer::setEqualizer().
/// The supplied amplification value will be clamped to the -20.0 to +20.0 range.
/// LibVLC 2.2.0 or later
/// </summary>
/// <param name="amp">amplification value (-20.0 to 20.0 Hz)</param>
/// <param name="band">index, counting from zero, of the frequency band to set</param>
public
bool
SetAmp
(
float
amp
,
uint
band
)
=>
Native
.
LibVLCAudioEqualizerSetAmpAtIndex
(
NativeReference
,
amp
,
band
)
==
0
;
/// <summary>
/// Get the amplification value for a particular equalizer frequency band.
/// LibVLC 2.2.0 or later
/// </summary>
/// <param name="band">index, counting from zero, of the frequency band to get</param>
/// <returns>amplification value (Hz); NaN if there is no such frequency band</returns>
public
float
Amp
(
uint
band
)
=>
Native
.
LibVLCAudioEqualizerGetAmpAtIndex
(
NativeReference
,
band
);
/// <summary>
/// Get the number of equalizer presets.
/// LibVLC 2.2.0 or later
/// </summary>
public
uint
PresetCount
=>
Native
.
LibVLCAudioEqualizerGetPresetCount
();
/// <summary>
/// Get the name of a particular equalizer preset.
/// This name can be used, for example, to prepare a preset label or menu in a user interface.
/// </summary>
/// <param name="index">index of the preset, counting from zero</param>
/// <returns>preset name, or empty string if there is no such preset</returns>
public
string
PresetName
(
uint
index
)
=>
(
string
)
Utf8StringMarshaler
.
GetInstance
().
MarshalNativeToManaged
(
Native
.
LibVLCAudioEqualizerGetPresetName
(
index
));
/// <summary>
/// Get the number of distinct frequency bands for an equalizer.
/// return number of frequency bands
/// LibVLC 2.2.0 or later
/// </summary>
public
uint
BandCount
=>
Native
.
LibVLCAudioEqualizerGetBandCount
();
/// <summary>
/// Get a particular equalizer band frequency.
/// This value can be used, for example, to create a label for an equalizer band control in a user interface.
/// LibVLC 2.2.0 or later
/// </summary>
/// <param name="index">index index of the band, counting from zero</param>
/// <returns>equalizer band frequency (Hz), or -1 if there is no such band</returns>
public
float
BandFrequency
(
uint
index
)
=>
Native
.
LibVLCAudioEqualizerGetBandFrequency
(
index
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment