1 /*****************************************************************************
2 * Audio.java: VLC Java Bindings, audio methods
3 *****************************************************************************
5 * Copyright (C) 1998-2008 the VideoLAN team
7 * Author: Filippo Carone <filippo@carone.org>
12 * This program is free software; you can redistribute it
13 * and/or modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU General Public
23 * License along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
28 package org.videolan.jvlc;
30 import java.util.HashMap;
31 import java.util.HashSet;
32 import java.util.Iterator;
36 import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
42 private final JVLC jvlc;
44 public Audio(JVLC jvlc)
49 public int getTrack(MediaInstance mediaInstance) throws VLCException
51 libvlc_exception_t exception = new libvlc_exception_t();
52 return jvlc.getLibvlc().libvlc_audio_get_track(mediaInstance.getInstance(), exception);
55 public void setTrack(MediaInstance mediaInstance, int track) throws VLCException
57 libvlc_exception_t exception = new libvlc_exception_t();
58 jvlc.getLibvlc().libvlc_audio_set_track(mediaInstance.getInstance(), track, exception);
61 public int getChannel() throws VLCException
63 libvlc_exception_t exception = new libvlc_exception_t();
64 return jvlc.getLibvlc().libvlc_audio_get_channel(jvlc.getInstance(), exception);
67 public void setChannel(int channel) throws VLCException
69 libvlc_exception_t exception = new libvlc_exception_t();
70 jvlc.getLibvlc().libvlc_audio_set_channel(jvlc.getInstance(), channel, exception);
73 public boolean getMute() throws VLCException
75 libvlc_exception_t exception = new libvlc_exception_t();
76 return jvlc.getLibvlc().libvlc_audio_get_mute(jvlc.getInstance(), exception) == 1 ? true : false;
79 public void setMute(boolean value) throws VLCException
81 libvlc_exception_t exception = new libvlc_exception_t();
82 jvlc.getLibvlc().libvlc_audio_set_mute(jvlc.getInstance(), value ? 1 : 0, exception);
85 public void toggleMute() throws VLCException
87 libvlc_exception_t exception = new libvlc_exception_t();
88 jvlc.getLibvlc().libvlc_audio_toggle_mute(jvlc.getInstance(), exception);
91 public int getVolume() throws VLCException
93 libvlc_exception_t exception = new libvlc_exception_t();
94 return jvlc.getLibvlc().libvlc_audio_get_volume(jvlc.getInstance(), exception);
97 public void setVolume(int volume) throws VLCException
99 libvlc_exception_t exception = new libvlc_exception_t();
100 jvlc.getLibvlc().libvlc_audio_set_volume(jvlc.getInstance(), volume, exception);