Changing the volume in a playlist

This forum is about all development around libVLC.
vinifr
New Cone
New Cone
Posts: 9
Joined: 20 May 2013 19:18

Changing the volume in a playlist

Postby vinifr » 29 May 2013 20:47

Is it possible to change the volume on a playlist? I tried various way and could not. :(
There is a specific libvlc_audio_set_volume for playlist?

log:
[0x40f00598] pulse audio output error: PulseAudio server connection failure: Connection refused

Code: Select all

#include <stdio.h> #include <stdlib.h> #include <vlc/vlc.h> int main(int argc, char* argv[]) { int i; libvlc_instance_t *vlc; libvlc_media_list_player_t *mlp; libvlc_media_player_t *mp; //libvlc_exception_t *excp; libvlc_media_t *md; libvlc_media_t *md2; libvlc_media_t *md3; libvlc_media_t *md4; libvlc_media_t *md5; libvlc_media_list_t *ml; //libvlc_media_list_t *ml2; /* Load the VLC engine */ vlc = libvlc_new(argc, (const char * const*)argv); mp = libvlc_media_player_new(vlc); // volume test ml = libvlc_media_list_new (vlc); mlp = libvlc_media_list_player_new (vlc); /* Create a new item */ md = libvlc_media_new_path (vlc, "/home/vini/musica/1992 - Dirt/12 - Would.mp3"); libvlc_media_player_set_media(mp, md); // volume test libvlc_media_list_set_media(ml, md); // volume test md2 = libvlc_media_new_path (vlc, "/home/vini/musica/1992 - Dirt/03 - Rain When I Die.mp3"); md3 = libvlc_media_new_path (vlc, "/home/vini/musica/Freak show/01 - Trilha 1.mp3"); // libvlc_media_list_add_media (ml, md); libvlc_media_list_add_media (ml, md2); libvlc_media_list_add_media (ml, md3); // ---------------------------- libvlc_media_list_player_set_media_list (mlp, ml); /* play the media_player */ //libvlc_media_list_player_play(mlp); libvlc_media_list_player_play_item(mlp, md); // volume test printf("Play\n"); // volume test libvlc_audio_set_volume(mp, 100); sleep(5); libvlc_audio_set_volume(mp, 50); sleep(5); libvlc_audio_set_volume(mp, 100); sleep(5); libvlc_media_release (md); libvlc_media_release (md2); libvlc_media_release (md3); sleep (15); /* Let it play a bit */ libvlc_media_list_player_next(mlp); sleep (20); /* Let it play a bit */ // next libvlc_media_list_player_next(mlp); sleep (20); /* Let it play a bit */ /* Stop playing */ stop_and_wait (mlp); /* Free the media_player */ libvlc_media_list_player_release (mlp); //libvlc_media_player_release (mp); libvlc_release (vlc); return 0; }

vinifr
New Cone
New Cone
Posts: 9
Joined: 20 May 2013 19:18

Re: Changing the volume in a playlist

Postby vinifr » 20 Jun 2013 02:08

Hi, I found the solution. :D Just call the function libvlc_media_list_player_set_media_player(). After that the function libvlc_audio_set_volume() starts to work. :geek:


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 2 guests