]> git.sesse.net Git - vlc/blob - bindings/java/core/src/main/java/org/videolan/jvlc/Audio.java
MediaInstance renamed to MediaPlayer
[vlc] / bindings / java / core / src / main / 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 org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
31
32
33 public class Audio
34 {
35
36     private final JVLC jvlc;
37
38     /**
39      * Constant for left channel audio
40      */
41     public static final int LEFT_CHANNEL = 3;
42
43     /**
44      * Constant for right channel audio
45      */
46     public static final int RIGHT_CHANNEL = 4;
47
48     /**
49      * Constant for reverse channel audio
50      */
51     public static final int REVERSE_CHANNEL = 2;
52
53     /**
54      * Constant for stereo channel audio
55      */
56     public static final int STEREO_CHANNEL = 1;
57
58     /**
59      * Constant for dolby channel audio
60      */
61     public final int DOLBY_CHANNEL = 5;
62
63     
64     public Audio(JVLC jvlc)
65     {
66         this.jvlc = jvlc;
67     }
68
69     public int getTrack(MediaPlayer mediaInstance)
70     {
71         libvlc_exception_t exception = new libvlc_exception_t();
72         return jvlc.getLibvlc().libvlc_audio_get_track(mediaInstance.getInstance(), exception);
73     }
74
75     public void setTrack(MediaPlayer mediaInstance, int track)
76     {
77         libvlc_exception_t exception = new libvlc_exception_t();
78         jvlc.getLibvlc().libvlc_audio_set_track(mediaInstance.getInstance(), track, exception);
79     }
80
81     public int getChannel()
82     {
83         libvlc_exception_t exception = new libvlc_exception_t();
84         return jvlc.getLibvlc().libvlc_audio_get_channel(jvlc.getInstance(), exception);
85     }
86
87     public void setChannel(int channel)
88     {
89         libvlc_exception_t exception = new libvlc_exception_t();
90         jvlc.getLibvlc().libvlc_audio_set_channel(jvlc.getInstance(), channel, exception);
91     }
92
93     public boolean getMute()
94     {
95         libvlc_exception_t exception = new libvlc_exception_t();
96         return jvlc.getLibvlc().libvlc_audio_get_mute(jvlc.getInstance(), exception) == 1 ? true : false;
97     }
98
99     public void setMute(boolean value)
100     {
101         libvlc_exception_t exception = new libvlc_exception_t();
102         jvlc.getLibvlc().libvlc_audio_set_mute(jvlc.getInstance(), value ? 1 : 0, exception);
103     }
104
105     public void toggleMute()
106     {
107         libvlc_exception_t exception = new libvlc_exception_t();
108         jvlc.getLibvlc().libvlc_audio_toggle_mute(jvlc.getInstance(), exception);
109     }
110
111     public int getVolume()
112     {
113         libvlc_exception_t exception = new libvlc_exception_t();
114         return jvlc.getLibvlc().libvlc_audio_get_volume(jvlc.getInstance(), exception);
115     }
116
117     public void setVolume(int volume)
118     {
119         libvlc_exception_t exception = new libvlc_exception_t();
120         jvlc.getLibvlc().libvlc_audio_set_volume(jvlc.getInstance(), volume, exception);
121     }
122 }