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 org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
36 private final JVLC jvlc;
39 * Constant for left channel audio
41 public static final int LEFT_CHANNEL = 3;
44 * Constant for right channel audio
46 public static final int RIGHT_CHANNEL = 4;
49 * Constant for reverse channel audio
51 public static final int REVERSE_CHANNEL = 2;
54 * Constant for stereo channel audio
56 public static final int STEREO_CHANNEL = 1;
59 * Constant for dolby channel audio
61 public final int DOLBY_CHANNEL = 5;
64 public Audio(JVLC jvlc)
69 public int getTrack(MediaInstance mediaInstance)
71 libvlc_exception_t exception = new libvlc_exception_t();
72 return jvlc.getLibvlc().libvlc_audio_get_track(mediaInstance.getInstance(), exception);
75 public void setTrack(MediaInstance mediaInstance, int track)
77 libvlc_exception_t exception = new libvlc_exception_t();
78 jvlc.getLibvlc().libvlc_audio_set_track(mediaInstance.getInstance(), track, exception);
81 public int getChannel()
83 libvlc_exception_t exception = new libvlc_exception_t();
84 return jvlc.getLibvlc().libvlc_audio_get_channel(jvlc.getInstance(), exception);
87 public void setChannel(int channel)
89 libvlc_exception_t exception = new libvlc_exception_t();
90 jvlc.getLibvlc().libvlc_audio_set_channel(jvlc.getInstance(), channel, exception);
93 public boolean getMute()
95 libvlc_exception_t exception = new libvlc_exception_t();
96 return jvlc.getLibvlc().libvlc_audio_get_mute(jvlc.getInstance(), exception) == 1 ? true : false;
99 public void setMute(boolean value)
101 libvlc_exception_t exception = new libvlc_exception_t();
102 jvlc.getLibvlc().libvlc_audio_set_mute(jvlc.getInstance(), value ? 1 : 0, exception);
105 public void toggleMute()
107 libvlc_exception_t exception = new libvlc_exception_t();
108 jvlc.getLibvlc().libvlc_audio_toggle_mute(jvlc.getInstance(), exception);
111 public int getVolume()
113 libvlc_exception_t exception = new libvlc_exception_t();
114 return jvlc.getLibvlc().libvlc_audio_get_volume(jvlc.getInstance(), exception);
117 public void setVolume(int volume)
119 libvlc_exception_t exception = new libvlc_exception_t();
120 jvlc.getLibvlc().libvlc_audio_set_volume(jvlc.getInstance(), volume, exception);