aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/net/java/games/joal/ALImpl.java
blob: 9ac830104ce07afa28e5cd35fbb83cd163b10622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
/**
* Copyright (c) 2003 Sun Microsystems, Inc. All  Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* -Redistribution of source code must retain the above copyright notice, 
* this list of conditions and the following disclaimer.
*
* -Redistribution in binary form must reproduce the above copyright notice, 
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may 
* be used to endorse or promote products derived from this software without 
* specific prior written permission.
* 
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in the
* design, construction, operation or maintenance of any nuclear facility.
*/

package net.java.games.joal;

import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;


final class ALImpl implements AL {
    ALImpl() {
        System.loadLibrary("joal");
    }

    // AL_BUFFER RELATED METHODS

    public void alGenBuffers(int n, IntBuffer buffers) {
        if (
            (buffers == null) ||
                !buffers.isDirect() ||
                (n > buffers.capacity())
        ) {
            throw new IllegalArgumentException(
                "buffers must be direct, can not be null" +
                " and buffer capacity must be greater than requested number of " +
                "buffers."
            );
        } else {
            alGenBuffersNative(n, buffers);
        }
    }

    private native void alGenBuffersNative(int n, IntBuffer buffers);

    public void alGenBuffers(int n, int[] buffers) {
        if ((buffers == null) || (n > buffers.length)) {
            throw new IllegalArgumentException(
                "buffers can not be null" +
                " and array length must be greater than requested number of " +
                "buffers."
            );
        } else {
            alGenBuffersNative(n, buffers);
        }
    }

    private native void alGenBuffersNative(int n, int[] buffers);

    public void alDeleteBuffers(int n, IntBuffer buffers) {
        if (
            (buffers == null) ||
                !buffers.isDirect() ||
                (n > buffers.capacity())
        ) {
            throw new IllegalArgumentException(
                "buffers must be direct, can not be null" +
                " and buffer capacity must be greater than requested number of " +
                "buffers."
            );
        } else {
            alDeleteBuffersNative(n, buffers);
        }
    }

    private native void alDeleteBuffersNative(int n, IntBuffer buffers);

    public void alDeleteBuffers(int n, int[] buffers) {
        if ((buffers == null) || (n > buffers.length)) {
            throw new IllegalArgumentException(
                "buffers can not be null" +
                " and array length must be greater than requested number of " +
                "buffers."
            );
        } else {
            alDeleteBuffersNative(n, buffers);
        }
    }

    private native void alDeleteBuffersNative(int n, int[] buffers);

    public native boolean alIsBuffer(int bufferName);

    public void alBufferData(
        int buffername,
        int format,
        byte[] data,
        int size,
        int frequency
    ) {
        if (data == null) {
            throw new IllegalArgumentException("data must not be null");
        } else {
            alBufferDataNative(buffername, format, data, size, frequency);
        }
    }

    private native void alBufferDataNative(
        int buffername,
        int format,
        byte[] data,
        int size,
        int frequency
    );

    public void alBufferData(
        int buffername,
        int format,
        ByteBuffer data,
        int size,
        int frequency
    ) {
        if ((data == null) || !data.isDirect()) {
            throw new IllegalArgumentException(
                "data must be a direct, non-null buffer"
            );
        } else {
            alBufferDataNative(buffername, format, data, size, frequency);
        }
    }

    private native void alBufferDataNative(
        int buffername,
        int format,
        ByteBuffer data,
        int size,
        int frequency
    );

    public void alGetBufferf(int bufferName, int pname, float[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException(
                "Return Value argument must not be null."
            );
        } else {
            alGetBufferfNative(bufferName, pname, retValue);
        }
    }

    private native void alGetBufferfNative(
        int bufferName,
        int pname,
        float[] retValue
    );

    public void alGetBufferf(int bufferName, int pname, FloatBuffer retValue) {
        if ((retValue == null) || !retValue.isDirect()) {
            throw new IllegalArgumentException(
                "Return Value argument must be a direct, non-null buffer"
            );
        } else {
            alGetBufferfNative(bufferName, pname, retValue);
        }
    }

    private native void alGetBufferfNative(
        int bufferName,
        int pname,
        FloatBuffer retValue
    );

    public native float alGetBufferf(int bufferName, int pname);

    public void alGetBufferi(int bufferName, int pname, int[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException(
                "Return Value argument must not be null"
            );
        } else {
            alGetBufferiNative(bufferName, pname, retValue);
        }
    }

    private native void alGetBufferiNative(
        int bufferName,
        int pname,
        int[] retValue
    );

    public void alGetBufferi(int bufferName, int pname, IntBuffer retValue) {
        if ((retValue == null) || !retValue.isDirect()) {
            throw new IllegalArgumentException(
                "Return Value argument must be a direct, non-null IntBuffer"
            );
        } else {
            alGetBufferiNative(bufferName, pname, retValue);
        }
    }

    private native void alGetBufferiNative(
        int bufferName,
        int pname,
        IntBuffer retValue
    );

    public native int alGetBufferi(int bufferName, int pname);

    // SOURCE RELATED METHODS
    public void alGenSources(int numSources, int[] sources) {
        if ((sources == null) || (numSources > sources.length)) {
            throw new IllegalArgumentException(
                "sources can not be null" +
                " and array length must be greater than requested number of " +
                "sources."
            );
        } else {
            alGenSourcesNative(numSources, sources);
        }
    }

    private native void alGenSourcesNative(int numSources, int[] sources);

    public void alGenSources(int numSources, IntBuffer sources) {
        if (
            (sources == null) ||
                !sources.isDirect() ||
                (numSources > sources.capacity())
        ) {
            throw new IllegalArgumentException(
                "sources buffer must be direct, can not be null" +
                " and capacity must be greater than requested number of " +
                "sources."
            );
        } else {
            alGenSourcesNative(numSources, sources);
        }
    }

    private native void alGenSourcesNative(int numSources, IntBuffer sources);

    public void alDeleteSources(int numSources, int[] sources) {
        if ((sources == null) || (numSources > sources.length)) {
            throw new IllegalArgumentException(
                "sources can not be null" +
                " and array length must be greater than requested number of " +
                "sources."
            );
        } else {
            alDeleteSourcesNative(numSources, sources);
        }
    }

    private native void alDeleteSourcesNative(int numSources, int[] sources);

    public void alDeleteSources(int numSources, IntBuffer sources) {
        if (
            (sources == null) ||
                !sources.isDirect() ||
                (numSources > sources.capacity())
        ) {
            throw new IllegalArgumentException(
                "sources buffer must be direct, can not be null" +
                " and capacity must be greater than requested number of " +
                "sources."
            );
        } else {
            alDeleteSourcesNative(numSources, sources);
        }
    }

    private native void alDeleteSourcesNative(
        int numSources,
        IntBuffer sources
    );

    public native boolean alIsSource(int sourceName);

    public native void alSourcei(int sourcename, int pname, int value);

    public native void alSourcef(int sourcename, int pname, float value);

    public native void alSourcefv(int sourcename, int pname, float[] value);

    public void alSourcefv(int sourcename, int pname, FloatBuffer value) {
        if ((value != null) && !value.isDirect()) {
            throw new IllegalArgumentException("buffer must be direct");
        } else {
            alSourcefvNative(sourcename, pname, value);
        }
    }

    private native void alSourcefvNative(
        int sourcename,
        int pname,
        FloatBuffer value
    );

    public native void alSource3f(
        int sourcename,
        int pname,
        float v1,
        float v2,
        float v3
    );

    public void alGetSourcef(int sourcename, int pname, float[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException("retValue must not be null");
        } else {
            alGetSourcefNative(sourcename, pname, retValue);
        }
    }

    private native void alGetSourcefNative(
        int sourcename,
        int pname,
        float[] retValue
    );

    public void alGetSourcef(int sourceName, int pname, FloatBuffer buffer) {
        if ((buffer == null) || !buffer.isDirect()) {
            throw new IllegalArgumentException(
                "Buffer must be direct and non-null"
            );
        } else {
            alGetSourcefNative(sourceName, pname, buffer);
        }
    }

    private native void alGetSourcefNative(
        int sourceName,
        int pname,
        FloatBuffer buffer
    );

    public native float alGetSourcef(int sourceName, int pname);

    public void alGetSourcefv(int sourcename, int pname, FloatBuffer value) {
        if ((value == null) || !value.isDirect()) {
            throw new IllegalArgumentException(
                "Buffer must be direct and non-null"
            );
        } else {
            alGetSourcefvNative(sourcename, pname, value);
        }
    }

    private native void alGetSourcefvNative(
        int sourcename,
        int pname,
        FloatBuffer value
    );


    public void alGetSourcefv(int sourcename, int pname, float[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException(
                "retValue arg array must not be null"
            );
        } else {
            alGetSourcefvNative(sourcename, pname, retValue);
        }
    }

    private native void alGetSourcefvNative(
        int sourcename,
        int pname,
        float[] retValue
    );


    public void alGetSourcei(int sourcename, int pname, int[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException(
                "retValue arg array must not be null"
            );
        } else {
            alGetSourceiNative(sourcename, pname, retValue);
        }
    }

    private native void alGetSourceiNative(
        int sourcename,
        int pname,
        int[] retValue
    );

    public void alGetSourcei(int sourcename, int pname, IntBuffer value) {
        if ((value == null) || !value.isDirect()) {
            throw new IllegalArgumentException(
                "Buffer must be direct and non-null"
            );
        } else {
            alGetSourceiNative(sourcename, pname, value);
        }
    }

    private native void alGetSourceiNative(
        int sourcename,
        int pname,
        IntBuffer retValue
    );

    public native int alGetSourcei(int sourcename, int pname);


    public native void alSourcePlay(int sourcename);

    public void alSourcePlayv(int numSources, int[] sourcenames) {
        if ((sourcenames == null) || (numSources > sourcenames.length)) {
            throw new IllegalArgumentException(
                "sourcenames must be non-null" +
                " and at least as large as the number of sources requested"
            );
        } else {
            alSourcePlayvNative(numSources, sourcenames);
        }
    }

    private native void alSourcePlayvNative(int numSources, int[] sourcenames);

    public void alSourcePlayv(int numSources, IntBuffer sourcenames) {
        if (
            (sourcenames == null) ||
                (numSources > sourcenames.capacity()) ||
                !sourcenames.isDirect()
        ) {
            throw new IllegalArgumentException(
                "sourcenames buffer must be direct, non-null and have a" +
                " equals or greater capacity than the number of sources" +
                " requested"
            );
        } else {
            alSourcePlayvNative(numSources, sourcenames);
        }
    }

    private native void alSourcePlayvNative(
        int numSources,
        IntBuffer sourcenames
    );

    public native void alSourcePause(int sourcename);

    public void alSourcePausev(int numSources, int[] sourcenames) {
        if ((sourcenames == null) || (numSources > sourcenames.length)) {
            throw new IllegalArgumentException(
                "sourcenames must be non-null" +
                " and at least as large as the number of sources requested"
            );
        } else {
            alSourcePausevNative(numSources, sourcenames);
        }
    }

    private native void alSourcePausevNative(int numSources, int[] sourcenames);

    public void alSourcePausev(int numSources, IntBuffer sourcenames) {
        if (
            (sourcenames == null) ||
                (numSources > sourcenames.capacity()) ||
                !sourcenames.isDirect()
        ) {
            throw new IllegalArgumentException(
                "sourcenames buffer must be direct, non-null and have a" +
                " equals or greater capacity than the number of sources" +
                " requested"
            );
        } else {
            alSourcePausevNative(numSources, sourcenames);
        }
    }

    private native void alSourcePausevNative(
        int numSources,
        IntBuffer sourcenames
    );

    public native void alSourceStop(int sourcename);

    public void alSourceStopv(int numSources, int[] sourcenames) {
        if ((sourcenames == null) || (numSources > sourcenames.length)) {
            throw new IllegalArgumentException(
                "sourcenames must be non-null" +
                " and at least as large as the number of sources requested"
            );
        } else {
            alSourceStopvNative(numSources, sourcenames);
        }
    }

    private native void alSourceStopvNative(int numSources, int[] sourcenames);

    public void alSourceStopv(int numSources, IntBuffer sourcenames) {
        if (
            (sourcenames == null) ||
                (numSources > sourcenames.capacity()) ||
                !sourcenames.isDirect()
        ) {
            throw new IllegalArgumentException(
                "sourcenames buffer must be direct, non-null and have a" +
                " equals or greater capacity than the number of sources" +
                " requested"
            );
        } else {
            alSourcePlayvNative(numSources, sourcenames);
        }
    }

    private native void alSourceStopvNative(
        int numSources,
        IntBuffer sourcenames
    );

    public native void alSourceRewind(int sourcename);

    public void alSourceRewindv(int numSources, int[] sourcenames) {
        if ((sourcenames == null) || (numSources > sourcenames.length)) {
            throw new IllegalArgumentException(
                "sourcenames must be non-null" +
                " and at least as large as the number of sources requested"
            );
        } else {
            alSourceRewindvNative(numSources, sourcenames);
        }
    }

    private native void alSourceRewindvNative(
        int numSources,
        int[] sourcenames
    );

    public void alSourceRewindv(int numSources, IntBuffer sourcenames) {
        if (
            (sourcenames == null) ||
                (numSources > sourcenames.capacity()) ||
                !sourcenames.isDirect()
        ) {
            throw new IllegalArgumentException(
                "sourcenames buffer must be direct, non-null and have a" +
                " equals or greater capacity than the number of sources" +
                " requested"
            );
        } else {
            alSourceRewindvNative(numSources, sourcenames);
        }
    }

    private native void alSourceRewindvNative(
        int numSources,
        IntBuffer sourcenames
    );

    public void alSourceQueueBuffers(
        int sourcename,
        int numBuffers,
        int[] buffernames
    ) {
        if ((buffernames == null) || (numBuffers > buffernames.length)) {
            throw new IllegalArgumentException(
                "buffernames must be non-null and equal or greater " +
                "than the numBuffers specified"
            );
        } else {
            alSourceQueueBuffersNative(sourcename, numBuffers, buffernames);
        }
    }

    private native void alSourceQueueBuffersNative(
        int sourcename,
        int numBuffers,
        int[] buffernames
    );

    public void alSourceQueueBuffers(
        int sourcename,
        int numBuffers,
        IntBuffer buffernames
    ) {
        if (
            (buffernames == null) ||
                !buffernames.isDirect() ||
                (numBuffers > buffernames.capacity())
        ) {
            throw new IllegalArgumentException(
                "only non-null, direct buffers of numBuffers capacity" +
                " or greater may be used."
            );
        } else {
            alSourceQueueBuffersNative(sourcename, numBuffers, buffernames);
        }
    }

    private native void alSourceQueueBuffersNative(
        int sourcename,
        int numBuffers,
        IntBuffer buffernames
    );

    public void alSourceUnqueueBuffers(
        int sourcename,
        int numBuffers,
        int[] buffernames
    ) {
        if ((buffernames == null) || (numBuffers > buffernames.length)) {
            throw new IllegalArgumentException(
                "buffernames must be non-null and equal or greater " +
                "than the numBuffers specified"
            );
        } else {
            alSourceUnqueueBuffersNative(sourcename, numBuffers, buffernames);
        }
    }

    private native void alSourceUnqueueBuffersNative(
        int sourcename,
        int numBuffers,
        int[] buffernames
    );

    public void alSourceUnqueueBuffers(
        int sourcename,
        int numBuffers,
        IntBuffer buffernames
    ) {
        if (
            (buffernames == null) ||
                !buffernames.isDirect() ||
                (numBuffers > buffernames.capacity())
        ) {
            throw new IllegalArgumentException(
                "only non-null, direct buffers of numBuffers capacity" +
                " or greater may be used."
            );
        } else {
            alSourceUnqueueBuffersNative(sourcename, numBuffers, buffernames);
        }
    }

    private native void alSourceUnqueueBuffersNative(
        int sourcename,
        int numBuffers,
        IntBuffer buffernames
    );

    // LISTENER RELATED METHODS
    public native void alListenerf(int pname, float value);

    public native void alListener3f(int pname, float v1, float v2, float v3);

    public native void alListenerfv(int pname, float[] values);

    public native void alListenerfv(int pname, FloatBuffer values);

    public native void alListeneri(int pname, int value);

    public void alGetListenerf(int pname, float[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException(
                "retValue must be non-null array"
            );
        }
    }

    private native void alGetListenerfNative(int pname, float[] retValue);

    public void alGetListenerf(int pname, FloatBuffer retValue) {
        if ((retValue == null) || !retValue.isDirect()) {
            throw new IllegalArgumentException(
                "retValue must be a non-null direct buffer"
            );
        } else {
            alGetListenerfNative(pname, retValue);
        }
    }

    private native void alGetListenerfNative(int pname, FloatBuffer retValue);

    public native float alGetListenerf(int pname);

    public void alGetListener3f(
        int pname,
        FloatBuffer v1,
        FloatBuffer v2,
        FloatBuffer v3
    ) {
        if (
            ((v1 == null) || !v1.isDirect()) ||
                ((v2 == null) || !v2.isDirect()) ||
                ((v3 == null) || !v3.isDirect())
        ) {
            throw new IllegalArgumentException(
                "buffers must be non-null and direct"
            );
        } else {
            alGetListener3fNative(pname, v1, v2, v3);
        }
    }

    private native void alGetListener3fNative(
        int pname,
        FloatBuffer v1,
        FloatBuffer v2,
        FloatBuffer v3
    );

    public void alGetListener3f(int pname, float[] v1, float[] v2, float[] v3) {
        if ((v1 == null) || (v2 == null) || (v3 == null)) {
            throw new IllegalArgumentException("Arrays must be non-null");
        } else {
            alGetListener3fNative(pname, v1, v2, v3);
        }
    }

    private native void alGetListener3fNative(
        int pname,
        float[] v1,
        float[] v2,
        float[] v3
    );

    public void alGetListenerfv(int pname, float[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException("Array must be non-null");
        } else {
            alGetListenerfvNative(pname, retValue);
        }
    }

    private native void alGetListenerfvNative(int pname, float[] retValue);

    public void alGetListenerfv(int pname, FloatBuffer retValue) {
        if ((retValue == null) || !retValue.isDirect()) {
            throw new IllegalArgumentException(
                "Buffer must be non-null and direct"
            );
        } else {
            alGetListenerfvNative(pname, retValue);
        }
    }

    private native void alGetListenerfvNative(int pname, FloatBuffer retValue);

    public void alGetListeneri(int pname, int[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException("Array must be non-null");
        } else {
            alGetListeneriNative(pname, retValue);
        }
    }

    private native void alGetListeneriNative(int pname, int[] retValue);

    public void alGetListeneri(int pname, IntBuffer retValue) {
        if ((retValue == null) || !retValue.isDirect()) {
            throw new IllegalArgumentException(
                "Buffer must be non-null and direct"
            );
        } else {
            alGetListeneriNative(pname, retValue);
        }
    }

    private native void alGetListeneriNative(int pname, IntBuffer retValue);

    public native int alGetListeneri(int pname);

    // STATE RELATED METHODS
    public native void alEnable(int capability);

    public native void alDisable(int capability);

    public native boolean alIsEnabled(int capability);

    public native boolean alGetBoolean(int pname);

    public native double alGetDouble(int pname);

    public native float alGetFloat(int pname);

    public native int alGetInteger(int pname);

    // No Boolean Array states at the moment
    // public native void getBooleanv(int pname, ByteBuffer value);

    public void alGetBooleanv(int pname, boolean[] value) {
        if (value == null) {
            throw new IllegalArgumentException("Array must be non-null");
        } else {
            value[0] = false;
            // do nothing for now, there are no boolean vector props
            // alGetBooleanvNative(pname, value);
        }
    }
    
    private native void alGetBooleanvNative(int pname, boolean[] value);

    public void alGetDoublev(int pname, double[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException("Array must be non-null");
        } else {
            alGetDoublevNative(pname, retValue);
        }
    }

    private native void alGetDoublevNative(int pname, double[] retValue);

    public void alGetDoublev(int pname, DoubleBuffer value) {
        if ((value == null) || !value.isDirect()) {
            throw new IllegalArgumentException(
                "Buffer must be non-null and direct"
            );
        } else {
            alGetDoublevNative(pname, value);
        }
    }

    private native void alGetDoublevNative(int pname, DoubleBuffer value);

    public void alGetFloatv(int pname, float[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException("Array must be non-null");
        } else {
            alGetFloatvNative(pname, retValue);
        }
    }

    private native void alGetFloatvNative(int pname, float[] retValue);

    public void alGetFloatv(int pname, FloatBuffer value) {
        if ((value == null) || !value.isDirect()) {
            throw new IllegalArgumentException(
                "Buffer must be non-null and direct"
            );
        } else {
            alGetFloatvNative(pname, value);
        }
    }

    private native void alGetFloatvNative(int pname, FloatBuffer value);

    public void alGetIntegerv(int pname, int[] retValue) {
        if (retValue == null) {
            throw new IllegalArgumentException("Array must be non-null");
        } else {
            alGetIntegervNative(pname, retValue);
        }
    }

    private native void alGetIntegervNative(int pname, int[] retValue);

    public void alGetIntegerv(int pname, IntBuffer value) {
        if ((value == null) || !value.isDirect()) {
            throw new IllegalArgumentException(
                "Buffer must be non-null and direct"
            );
        } else {
            alGetIntegervNative(pname, value);
        }
    }

    private native void alGetIntegervNative(int pname, IntBuffer value);

    public native String alGetString(int pname);

    public native void alDistanceModel(int model);

    public native void alDopplerFactor(float value);

    public native void alDopplerVelocity(float value);

    // ERROR RELATED METHODS
    public native int alGetError();

    // EXTENSION RELATED METHODS
    public native boolean alIsExtensionPresent(String extName);

    // public native Method getProcAddress(String methodName);
    public native int alGetEnumValue(String enumName);
    /* (non-Javadoc)
     * @see net.java.games.joal.AL#alGetBooleanv(int, boolean[])
     */

}