]> git.sesse.net Git - vlc/blob - bindings/java/src/audio-jni.cc
Fix include for WIN32 version.
[vlc] / bindings / java / src / audio-jni.cc
1 /*****************************************************************************
2  * audio-jni.cc: JNI native audio functions for VLC Java Bindings
3  *****************************************************************************
4  * Copyright (C) 1998-2006 the VideoLAN team
5  *
6  * Authors: Filippo Carone <filippo@carone.org>
7  *          Philippe Morin <phmorin@free.fr>
8  *
9  *
10  * $Id $
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
25  *****************************************************************************/
26
27 /* These are a must*/
28 #include <jni.h>
29
30 #include <vlc/libvlc.h>
31
32 /* JVLC internal imports, generated by gcjh */
33 #include "../includes/Audio.h"
34 #include "utils.h"
35
36 JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getTrack (JNIEnv *env, jobject _this)
37 {
38     INIT_FUNCTION;
39     jint res = 0;
40     
41     res = libvlc_audio_get_track( ( libvlc_instance_t * ) instance, exception );
42     
43     CHECK_EXCEPTION_FREE;
44     
45     return res;
46 }
47
48 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setTrack (JNIEnv *env, jobject _this, jint value)
49 {
50     INIT_FUNCTION;
51
52     libvlc_audio_set_track( ( libvlc_instance_t * ) instance, value, exception );
53
54     CHECK_EXCEPTION_FREE;
55 }
56
57 JNIEXPORT jstring JNICALL Java_org_videolan_jvlc_Audio__1getChannel (JNIEnv *env, jobject _this)
58 {
59     INIT_FUNCTION;
60
61     char* res;
62
63     res = libvlc_audio_get_channel( (libvlc_instance_t *) instance, exception);
64
65     CHECK_EXCEPTION_FREE;
66
67     return env->NewStringUTF(res);
68 }
69
70 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setChannel (JNIEnv *env, jobject _this, jstring channel)
71 {
72     INIT_FUNCTION;
73
74     const char* value = env->GetStringUTFChars( channel, 0 );
75
76     libvlc_audio_set_channel( (libvlc_instance_t *) instance, (char *) value, exception);
77
78     env->ReleaseStringUTFChars( channel, value );
79     
80     CHECK_EXCEPTION_FREE;
81 }
82
83
84 JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Audio__1getMute (JNIEnv *env, jobject _this) 
85 {
86     INIT_FUNCTION;
87     jboolean res;
88
89     res = (jboolean) libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, exception );
90
91     CHECK_EXCEPTION_FREE;
92
93     return res;
94     
95 }
96
97 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setMute (JNIEnv *env, jobject _this, jboolean value) 
98 {
99     INIT_FUNCTION;
100
101     libvlc_audio_set_mute( ( libvlc_instance_t * ) instance, value, exception );
102   
103     CHECK_EXCEPTION_FREE;
104 }
105
106 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1toggleMute (JNIEnv *env, jobject _this) 
107 {
108     INIT_FUNCTION;
109
110     libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, exception );
111     
112     CHECK_EXCEPTION_FREE;
113 }
114
115 JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getVolume (JNIEnv *env, jobject _this)
116 {
117     INIT_FUNCTION;
118     jint res = 0;
119
120     res = libvlc_audio_get_volume( ( libvlc_instance_t * ) instance, exception );
121
122     CHECK_EXCEPTION_FREE;
123
124     return res;
125 }
126
127 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setVolume (JNIEnv *env, jobject _this, jint volume)
128 {
129     INIT_FUNCTION;
130
131     libvlc_audio_set_volume( ( libvlc_instance_t * ) instance, volume, exception );
132
133     CHECK_EXCEPTION_FREE;
134 }