Page 1 of 1

2.2.0 and equalizer

Posted: 24 Apr 2014 14:18
by spider58
Hello. Im using Libvlc 2.2.0 which downloaded from nightly builds.

is there any code sample for change equalizer frequency values (libvlc 2.2.0)

Im implemented DLL equalizer functions to my project but i dont know how can i change equalizer.

Thanks for relations.

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 14:27
by Jean-Baptiste Kempf
Look at the Android code.

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 14:39
by spider58
Look at the Android code.
Thanks for relations. but if your mean is https://forum.videolan.org/viewforum.php?f=35 im already look here. But nothing found. :( really sorry for inconvenience

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 14:50
by spider58
Hello again. Here is part of my code

FORM SIDE
Button_click

Code: Select all

dim myeq as new equalizer player.seteq = myeq

WRAPPER SIDE FUNCTION

Code: Select all

<dllImport("libvlc",Callingconvention:=CallingConvention.Cdecl)>_ Public Shared Function libvlc_media_player_set_equalizer(Byval player as intptr, p_equalizer as intptr) End Function

Code: Select all

Public Property seteq() as Equalizer Get return nothing End Get Set (Byval value as Equalizer) libvlc.libvlc_media_player_set_equalizer(player.handle, value.handle) End Set end function

WHEN i pressed button returns error message

Pinvoke restriction: cannot return variants

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 15:26
by sherington
There is an example in the VLC test sources:

http://git.videolan.org/?p=vlc.git;a=bl ... f4;hb=HEAD

This test code shows how to get presets, get/set individual frequency values, and enable/disable the equalizer on a media player.

Convert that to whatever language you're using.

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 15:28
by spider58
There is an example in the VLC test sources:

http://git.videolan.org/?p=vlc.git;a=bl ... f4;hb=HEAD

This test code shows how to get presets, get/set individual frequency values, and enable/disable the equalizer on a media player.

Convert that to whatever language you're using.
thank you sir. I will try now.

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 15:46
by spider58
There is an example in the VLC test sources:

http://git.videolan.org/?p=vlc.git;a=bl ... f4;hb=HEAD

This test code shows how to get presets, get/set individual frequency values, and enable/disable the equalizer on a media player.

Convert that to whatever language you're using.
hmm. cannot convert all of code. But tried somethings

preset count is returning 18 and in this code

Code: Select all

For i As UInteger = 0 To u_presets - 1 assert(Nothing IsNot libvlc_audio_equalizer_get_preset_name(i)) equalizer = libvlc_audio_equalizer_new_from_preset(i) assert(equalizer) libvlc_audio_equalizer_release(equalizer) Next i
equalizer = libvlc_audio_equalizer_new_from_preset(i)
im getting same error on this line

Pinvoke restriction: cannot return variants

what assert code mean in Vb.NET i dont know. I cant apply assert code

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 16:08
by spider58
maybe C# code is much easy than C for convert

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 19:28
by mangokm40
equalizer = libvlc_audio_equalizer_new_from_preset(i)
im getting same error on this line

Pinvoke restriction: cannot return variants

============================================================

Hope I don't waste your time with this, but....

If you're declaration looks like this:
"Public Shared Function libvlc_media_player_set_equalizer(Byval player as intptr, p_equalizer as intptr)"

The First link that Google returns for your error message suggests you do this:
"Public Shared Function libvlc_media_player_set_equalizer(Byval player as intptr, p_equalizer as intptr) as integer"

The link is here:
http://social.msdn.microsoft.com/Forums ... sexpressvb

Re: 2.2.0 and equalizer

Posted: 24 Apr 2014 21:45
by spider58
equalizer = libvlc_audio_equalizer_new_from_preset(i)
im getting same error on this line

Pinvoke restriction: cannot return variants

============================================================

Hope I don't waste your time with this, but....

If you're declaration looks like this:
"Public Shared Function libvlc_media_player_set_equalizer(Byval player as intptr, p_equalizer as intptr)"

The First link that Google returns for your error message suggests you do this:
"Public Shared Function libvlc_media_player_set_equalizer(Byval player as intptr, p_equalizer as intptr) as integer"

The link is here:
http://social.msdn.microsoft.com/Forums ... sexpressvb
yeah thanks fo reply. im already found solution but i cannot reply here because i had no time :)

All functions must has return type. That's my mistake.

Now equalizer working good. :) thanks

Re: 2.2.0 and equalizer

Posted: 25 Apr 2014 11:13
by spider58
hello again. i know i said "problem solved" but i can't changing equalizer amplitude.

WAY 1

Code: Select all

dim eq as new equalizer eq.Bands(0).Amplitude = 2.3F eq.Bands(1).Amplitude = 3.1F . . . eq.Bands(9).Amplitude = -4.5F libvlc.libvlc_media_player_set_equalizer(Player_handle,Nothing) libvlc.libvlc_media_player_set_equalizer(Player_handle,eq)
WAY 2

Code: Select all

dim eq as new equalizer libvlc.libvlc_audio_equalizer_set_amp_at_index(eq.handle,2.3F,0) libvlc.libvlc_audio_equalizer_set_amp_at_index(eq.handle,3.1F,1) . . . libvlc.libvlc_audio_equalizer_set_amp_at_index(eq.handle,-4.5F,9) libvlc.libvlc_media_player_set_equalizer(Player_handle,Nothing) libvlc.libvlc_media_player_set_equalizer(Player_handle,eq)
Anyway amplitute values of 10 bands returns 0

what im doing wrong ?

Best regards

Re: 2.2.0 and equalizer

Posted: 25 Apr 2014 20:15
by spider58
pff. this problem is annoying me :evil:

i think all my code good.

Always all amplitudes for all bands is being 0

Re: 2.2.0 and equalizer

Posted: 27 Apr 2014 11:27
by spider58
sorry for bumping but i want to know my coding is true or not.

Re: 2.2.0 and equalizer

Posted: 28 Apr 2014 16:32
by spider58
Thanks for relations. problem solved. was my fault.