]> git.sesse.net Git - vlc/blob - bindings/java/org/videolan/jvlc/Audio.java
9426dcb48bcf2af7c316f9aafe963e0f661ba973
[vlc] / bindings / java / org / videolan / jvlc / Audio.java
1 /*****************************************************************************
2  * Audio.java: VLC Java Bindings, audio methods
3  *****************************************************************************
4  *
5  * Copyright (C) 1998-2008 the VideoLAN team
6  * 
7  * Author: Filippo Carone <filippo@carone.org>
8  *
9  *
10  * $Id: $
11  *
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.
16  * 
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.
21  * 
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.
25  * 
26  */
27
28 package org.videolan.jvlc;
29
30 import java.util.HashMap;
31 import java.util.HashSet;
32 import java.util.Iterator;
33 import java.util.Map;
34 import java.util.Set;
35
36 import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
37
38
39 public class Audio
40 {
41
42     private final JVLC jvlc;
43
44     public Audio(JVLC jvlc)
45     {
46         this.jvlc = jvlc;
47     }
48
49     public int getTrack(MediaInstance mediaInstance) throws VLCException
50     {
51         libvlc_exception_t exception = new libvlc_exception_t();
52         return jvlc.getLibvlc().libvlc_audio_get_track(mediaInstance.getInstance(), exception);
53     }
54
55     public void setTrack(MediaInstance mediaInstance, int track) throws VLCException
56     {
57         libvlc_exception_t exception = new libvlc_exception_t();
58         jvlc.getLibvlc().libvlc_audio_set_track(mediaInstance.getInstance(), track, exception);
59     }
60
61     public int getChannel() throws VLCException
62     {
63         libvlc_exception_t exception = new libvlc_exception_t();
64         return jvlc.getLibvlc().libvlc_audio_get_channel(jvlc.getInstance(), exception);
65     }
66
67     public void setChannel(int channel) throws VLCException
68     {
69         libvlc_exception_t exception = new libvlc_exception_t();
70         jvlc.getLibvlc().libvlc_audio_set_channel(jvlc.getInstance(), channel, exception);
71     }
72
73     public boolean getMute() throws VLCException
74     {
75         libvlc_exception_t exception = new libvlc_exception_t();
76         return jvlc.getLibvlc().libvlc_audio_get_mute(jvlc.getInstance(), exception) == 1 ? true : false;
77     }
78
79     public void setMute(boolean value) throws VLCException
80     {
81         libvlc_exception_t exception = new libvlc_exception_t();
82         jvlc.getLibvlc().libvlc_audio_set_mute(jvlc.getInstance(), value ? 1 : 0, exception);
83     }
84
85     public void toggleMute() throws VLCException
86     {
87         libvlc_exception_t exception = new libvlc_exception_t();
88         jvlc.getLibvlc().libvlc_audio_toggle_mute(jvlc.getInstance(), exception);
89     }
90
91     public int getVolume() throws VLCException
92     {
93         libvlc_exception_t exception = new libvlc_exception_t();
94         return jvlc.getLibvlc().libvlc_audio_get_volume(jvlc.getInstance(), exception);
95     }
96
97     public void setVolume(int volume) throws VLCException
98     {
99         libvlc_exception_t exception = new libvlc_exception_t();
100         jvlc.getLibvlc().libvlc_audio_set_volume(jvlc.getInstance(), volume, exception);
101     }
102 }