1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package com
.nokia
.mid
.sound
;
12 import cc
.squirreljme
.runtime
.cldc
.annotation
.Api
;
13 import cc
.squirreljme
.runtime
.cldc
.annotation
.ApiDefinedDeprecated
;
14 import cc
.squirreljme
.runtime
.cldc
.debug
.Debugging
;
15 import javax
.microedition
.media
.Manager
;
16 import javax
.microedition
.media
.MediaException
;
19 * Provides an interface for playing digitized audio along with simple sounds.
21 * All implementations must support tone based sounds.
29 /** A simple tone based sound. */
32 public static final int FORMAT_TONE
= 1;
34 /** A digitized waveform audio. */
37 public static final int FORMAT_WAVE
= 5;
39 /** A sound is playing. */
42 public static final int SOUND_PLAYING
= 0;
44 /** A sound is stopped. */
47 public static final int SOUND_STOPPED
= 1;
49 /** A sound is not initialized. */
52 public static final int SOUND_UNINITIALIZED
= 3;
56 public Sound(byte[] __data
, int __type
)
58 this.init(__data
, __type
);
63 public Sound(int __freq
, long __duration
)
65 this.init(__freq
, __duration
);
72 throw Debugging
.todo();
79 throw Debugging
.todo();
84 public void init(byte[] __data
, int __type
)
86 Debugging
.todoNote("init(%p, %d)", __data
, __type
);
87 throw new IllegalArgumentException("TODO");
91 * Plays a simple tone through the device speaker.
93 * @param __freq The frequency to play the sound at.
94 * @param __duration The duration in milliseconds to play the sound for.
95 * @throws IllegalArgumentException If the frequency is not within range
96 * of what the device support, or the duration is zero or negative.
97 * @see Manager#playTone(int, int, int)
101 @ApiDefinedDeprecated
102 public void init(int __freq
, long __duration
)
103 throws IllegalArgumentException
105 // {@squirreljme.error AI01 Invalid frequency and/or duration.}
106 if (__freq
< 0 || __duration
<= 0)
107 throw new IllegalArgumentException("AI01");
111 Manager
.playTone(__freq
,
112 (int)Math
.min(__duration
, Integer
.MAX_VALUE
), 100);
114 catch (MediaException e
)
116 // {@squirreljme.error AI02 Sound out of range or failed to
118 throw new IllegalArgumentException("AI02", e
);
123 @ApiDefinedDeprecated
124 public void play(int __loop
)
126 throw Debugging
.todo();
130 @ApiDefinedDeprecated
131 public void release()
133 throw Debugging
.todo();
137 @ApiDefinedDeprecated
140 throw Debugging
.todo();
144 @ApiDefinedDeprecated
145 public void setGain(int __gain
)
147 throw Debugging
.todo();
151 @ApiDefinedDeprecated
152 public void setSoundListener(SoundListener __listener
)
154 throw Debugging
.todo();
158 @ApiDefinedDeprecated
161 throw Debugging
.todo();
165 @ApiDefinedDeprecated
166 public static int getConcurrentSoundCount(int __type
)
168 throw Debugging
.todo();
172 @ApiDefinedDeprecated
173 public static int[] getSupportedFormats()
175 throw Debugging
.todo();