Commit 8e4f8548 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Add NullVolumeControl for the NullPlayer.

parent 0c832f17
......@@ -79,6 +79,8 @@ More detailed changes:
launch a program once the program list is read.
* When a program is launched, instead of saying just "Loading..." instead
allow show the program which is being loaded in the title.
* `media-api`
* Add null media support for: players, and volume control.
* `meep-midlet`
* Implement `MIDlet.checkPermission()`.
* `meep-rms`
......
......@@ -140,9 +140,16 @@ public final class NullPlayer
* @since 2019/04/15
*/
@Override
public final Control getControl(String __a)
public final Control getControl(String __v)
{
throw new todo.TODO();
// {@squirreljme.error AE07 No control specified.}
if (__v == null)
throw new IllegalArgumentException("AE07");
if (__v.equals("VolumeControl") ||
__v.equals("javax.microedition.media.control.VolumeControl"))
return new NullVolumeControl();
return null;
}
/**
......
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.runtime.media;
import javax.microedition.media.control.VolumeControl;
/**
* This is a volume control which does nothing.
*
* @since 2019/06/29
*/
public final class NullVolumeControl
implements VolumeControl
{
/** Current volume level. */
private int _level =
100;
/** Is muted? */
private boolean _mute;
/**
* {@inheritDoc}
* @since 2019/06/29
*/
@Override
public final int getLevel()
{
return this._level;
}
/**
* {@inheritDoc}
* @since 2019/06/29
*/
@Override
public final boolean isMuted()
{
return this._mute;
}
/**
* {@inheritDoc}
* @since 2019/06/29
*/
@Override
public final int setLevel(int __v)
{
this._level = (__v = (__v < 0 ? 0 : (__v > 100 ? 100 : __v)));
return __v;
}
/**
* {@inheritDoc}
* @since 2019/06/29
*/
@Override
public final void setMute(boolean __v)
{
this._mute = __v;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment