Added missing fields

Added Uri-related enums
Added Microphone class and related enum
Updated whitespace
This commit is contained in:
Tom Lint 2014-02-03 22:35:46 +01:00
parent 9335b2e748
commit 9cfedf1e78
19 changed files with 667 additions and 232 deletions

View File

@ -12,9 +12,9 @@ import Microsoft.Xna.Framework.Net.*;
*/
public class Game1 extends Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D background;
private GraphicsDeviceManager graphics;
private SpriteBatch spriteBatch;
private Texture2D background;
public Game1()
{

View File

@ -74,13 +74,19 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
synchronized (super.VoiceHandleLock)
{
if (super.IsDisposed())
{
throw new ObjectDisposedException(super.getClass().getName(), "This object has already been disposed.");
}
if (sizeInBytes < 0)
{
throw new ArgumentException("Buffer size cannot be negative.");
}
if (sizeInBytes == 0)
{
return TimeSpan.Zero;
}
// TODO: get this from AudioFormat
throw new NotImplementedException();
@ -121,9 +127,10 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
}
catch(OverflowException ex)
{
throw new ArgumentOutOfRangeException("duration");
throw new ArgumentOutOfRangeException("duration", ex);
}
}
return num;
}
@ -138,7 +145,9 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
synchronized(super.VoiceHandleLock)
{
if (super.IsDisposed())
{
throw new ObjectDisposedException(super.getClass().getName(), "This object has already been disposed.");
}
// TODO: implement
throw new NotImplementedException();
@ -178,8 +187,11 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
synchronized(super.VoiceHandleLock)
{
int num = 0;
if (super.IsDisposed())
{
throw new ObjectDisposedException(super.getClass().getName(), "This object has already been disposed.");
}
if (((buffer == null) || (buffer.length == 0)) || !this.format.IsAligned(buffer.length))
{
@ -195,7 +207,7 @@ public final class DynamicSoundEffectInstance extends SoundEffectInstance
}
catch(OverflowException ex)
{
throw new ArgumentException("Ensure that count is valid and meets the block alignment requirements for the audio format. Offset and count must define a valid region within the buffer boundaries.");
throw new ArgumentException("Ensure that count is valid and meets the block alignment requirements for the audio format. Offset and count must define a valid region within the buffer boundaries.", ex);
}
if (((count <= 0) || (num > buffer.length)) |!this.format.IsAligned(count))
{

View File

@ -0,0 +1,150 @@
package Microsoft.Xna.Framework.Audio;
import System.*;
import System.Collections.ObjectModel.*;
/**
* Provides properties, methods, and fields and events for capturing audio data with microphones.
*
* @author Halofreak1990
*/
public final class Microphone
{
/**
* Returns the collection of all currently-available microphones.
*/
public static ReadOnlyCollection<Microphone> getAll()
{
throw new NotImplementedException();
}
/**
* Gets audio capture buffer duration of the microphone.
*/
public TimeSpan getBufferDuration()
{
throw new NotImplementedException();
}
/**
* Sets audio capture buffer duration of the microphone.
*
* @param value
*/
public void setBufferDuration(TimeSpan value)
{
throw new NotImplementedException();
}
/**
* Returns the default attached microphone.
*/
public static Microphone getDefault()
{
throw new NotImplementedException();
}
/**
* Determines if the microphone is a wired headset or a Bluetooth device.
*/
public boolean IsHeadset()
{
throw new NotImplementedException();
}
/**
* Returns the friendly name of the microphone.
*/
public final String Name = ""; // TODO: use constructor to get this at run-time.
/**
* Returns the sample rate at which the microphone is capturing audio data.
*/
public int getSampleRate()
{
throw new NotImplementedException();
}
/**
* Returns the recording state of the Microphone object.
*/
public MicrophoneState getState()
{
throw new NotImplementedException();
}
/**
* The event that occurs when the audio capture buffer is ready to processed.
*/
public final Event<EventArgs> BufferReady = new Event<EventArgs>();
protected void finalize()
{
}
/**
* Gets the latest recorded data from the microphone based on the audio capture buffer.
*
* @param buffer
* Buffer, in bytes, containing the captured audio data. The audio format must be PCM wave data.
*/
public int GetData(byte[] buffer)
{
return this.GetData(buffer, 0, buffer.length);
}
/**
* Gets the latest captured audio data from the microphone based on the specified offset and byte count.
*
* @param buffer
* Buffer, in bytes, containing the captured audio data. The audio format must be PCM wave data.
*
* @param offset
* Offset, in bytes, to the starting position of the data.
*
* @param count
* Amount, in bytes, of desired audio data.
*/
public int GetData(byte[ ] buffer, int offset, int count)
{
throw new NotImplementedException();
}
/**
* Returns the duration of audio playback based on the size of the buffer.
*
* @param sizeInBytes
* Size, in bytes, of the audio data.
*/
public TimeSpan GetSampleDuration(int sizeInBytes)
{
throw new NotImplementedException();
}
/**
* Returns the size of the byte array required to hold the specified duration of audio for this microphone object.
*
* @param duration
* TimeSpan object that contains the duration of the audio sample.
*/
public int GetSampleSizeInBytes(TimeSpan duration)
{
throw new NotImplementedException();
}
/**
* Starts microphone audio capture.
*/
public void Start()
{
throw new NotImplementedException();
}
/**
* Stops microphone audio capture.
*/
public void Stop()
{
throw new NotImplementedException();
}
}

View File

@ -0,0 +1,18 @@
package Microsoft.Xna.Framework.Audio;
/**
* Current state of the Microphone audio capture (started or stopped).
*
* @author Halofreak1990
*/
public enum MicrophoneState
{
/**
* The Microphone audio capture has started.
*/
Started,
/**
* The Microphone audio capture has stopped.
*/
Stopped
}

View File

@ -51,10 +51,14 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
if (value < -1f || value > 1f)
{
throw new ArgumentOutOfRangeException("value");
}
//Helpers.ThrowExceptionFromErrorCode(SoundEffectUnsafeNativeMethods.SetPan(this.voiceHandle, value));
this.currentPan = value;
@ -77,10 +81,14 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
if (value < -1f || value > 1f)
{
throw new ArgumentOutOfRangeException("value");
}
//Helpers.ThrowExceptionFromErrorCode(SoundEffectUnsafeNativeMethods.SetPitch(this.voiceHandle, value));
this.currentPitch = value;
@ -100,7 +108,9 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
@ -123,10 +133,14 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
if (value < -1f || value > 1f)
{
throw new ArgumentOutOfRangeException("value");
}
//Helpers.ThrowExceptionFromErrorCode(SoundEffectUnsafeNativeMethods.SetVolume(this.voiceHandle, value));
this.currentVolume = value;
@ -145,7 +159,9 @@ public class SoundEffectInstance implements IDisposable
this.currentVolume = 1f;
this.VoiceHandleLock = new Object();
if (parentEffect.IsDisposed())
{
throw new ObjectDisposedException(SoundEffect.class.getName(), "This object has already been disposed.");
}
this.parent = parentEffect;
this.setVolume(1f);
@ -183,7 +199,9 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
@ -235,7 +253,9 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
@ -250,7 +270,9 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
@ -265,7 +287,9 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();
@ -291,7 +315,9 @@ public class SoundEffectInstance implements IDisposable
synchronized(this)
{
if (this.isDisposed)
{
throw new ObjectDisposedException(super.getClass().toString(), "FrameworkResources.ObjectDisposedException");
}
// TODO: implement
throw new NotImplementedException();

View File

@ -1,5 +1,6 @@
package Microsoft.Xna.Framework.Content;
import java.io.InputStream;
import java.lang.reflect.*;
import java.util.*;
@ -20,18 +21,30 @@ public class ContentManager implements IDisposable
private IServiceProvider serviceProvider;
private Action<IDisposable> recordDisposableObject;
/**
* Gets the root directory associated with this ContentManager.
*/
public String getRootDirectory()
{
return this.rootDirectory;
}
/**
* Sets the root directory associated with this ContentManager.
*
* @param value
*/
public void setRootDirectory(String value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (this.assets.size() > 0)
{
throw new InvalidOperationException("");
}
this.rootDirectory = value;
/*this.fullRootDirectory = value;
@ -48,15 +61,22 @@ public class ContentManager implements IDisposable
}*/
}
/**
* Gets the service provider associated with the ContentManager.
*/
public IServiceProvider getServiceProvider()
{
return this.serviceProvider;
}
/**
* Initializes a new instance of ContentManager.
*
* @param serviceProvider
* The service provider that the ContentManager should use to locate services.
*
* @throws ArgumentNullException
* serviceProvider is null.
*/
public ContentManager(IServiceProvider serviceProvider)
{
@ -64,10 +84,16 @@ public class ContentManager implements IDisposable
}
/**
* Initializes a new instance of ContentManager.
*
* @param serviceProvider
* The service provider the ContentManager should use to locate services.
*
* @param rootDirectory
* The root directory to search for content.
*
* @throws ArgumentNullException
* serviceProvider or rootDirectory is null.
*/
public ContentManager(IServiceProvider serviceProvider, String rootDirectory)
{
@ -87,7 +113,7 @@ public class ContentManager implements IDisposable
}
/**
*
* Releases all resources used by the ContentManager class.
*/
@Override
public void Dispose()
@ -95,6 +121,12 @@ public class ContentManager implements IDisposable
Dispose(true);
}
/**
* Releases the unmanaged resources used by the ContentManager and optionally releases the managed resources.
*
* @param disposing
* true to release both managed and unmanaged resources; false to release only unmanaged resources.
*/
protected void Dispose(boolean disposing)
{
if (!this.disposed)
@ -158,6 +190,17 @@ public class ContentManager implements IDisposable
return asset;
}
/**
* Opens a stream for reading the specified asset. Derived classes can replace this to implement pack files or asset compression.
*
* @param assetName
* The name of the asset being read.
*/
protected InputStream OpenStream(String assetName)
{
throw new NotImplementedException();
}
/**
* Low-level worker method that reads asset data.
*

View File

@ -2,6 +2,8 @@ package Microsoft.Xna.Framework.GamerServices;
import java.util.EnumSet;
import System.*;
/**
* Provides the presence information of a friend of the local gamer.
*
@ -13,7 +15,29 @@ public final class FriendGamer extends Gamer
private FriendCollection parent;
private String presence;
/**
* Gets whether the local gamer who requested the friends list has received a friend request from this gamer.
*/
public boolean FriendRequestReceivedFrom()
{
throw new NotImplementedException();
}
/**
* Gets whether the local gamer who requested the friends list has sent a friend request to this gamer.
*/
public boolean FriendRequestSentTo()
{
throw new NotImplementedException();
}
/**
* Gets a title-defined presence string describing what this friend is currently doing.
*/
public String getPresence()
{
return presence;
}
FriendGamer(FriendCollection parent, String gamertag, String presence, EnumSet<FriendState> friendState)
{

View File

@ -73,13 +73,9 @@ public final class Album implements IEquatable<Album>, IDisposable
if (!isDisposed)
{
this.isDisposed = true;
// TODO: implement
if (false)
{
}
songs = SongCollection.Empty;
}
}

View File

@ -11,6 +11,8 @@ import System.*;
*/
public final class AlbumCollection implements Iterable<Album>
{
static final AlbumCollection Empty = null;
/**
* Returns an iterator that iterates through the AlbumCollection.
*/

View File

@ -51,6 +51,7 @@ public final class Artist implements IEquatable<Artist>, IDisposable
this.songs = SongCollection.Empty;
this.albums = AlbumCollection.Empty;
this.handle = handle;
if (this.IsValidHandle)
{
StringBuilder sbName = new StringBuilder(260);

View File

@ -9,6 +9,8 @@ import System.*;
*/
public final class Genre implements IEquatable<Genre>, IDisposable
{
static final Genre Empty = null;
/**
* Gets the AlbumCollection for the Genre.
*/

View File

@ -12,6 +12,8 @@ import System.*;
public final class SongCollection implements Iterable<Song>
{
static final SongCollection Empty = null;
/**
*
*/

View File

@ -148,7 +148,8 @@ public class TitleContainer
{
if (exception instanceof java.io.FileNotFoundException)
{
throw new FileNotFoundException("", "name", exception);
// TODO: error message
throw new FileNotFoundException("", name, exception);
}
}

View File

@ -20,6 +20,26 @@ public class Uri
throw new NotImplementedException();
}
/**
* This instance represents a relative URI, and this property is valid only for absolute URIs.
*
* @return
* A boolean value that is true if the System.Uri is a file URI; otherwise, false.
*
* @exception System.InvalidOperationException
* This instance represents a relative URI, and this property is valid only for absolute URIs.
*/
public boolean IsFile()
{
if (!this.IsAbsoluteUri())
{
// TODO: error message
throw new InvalidOperationException();
}
throw new NotImplementedException();
}
/**
* Gets the original URI string that was passed to the System.Uri constructor.
*
@ -39,11 +59,22 @@ public class Uri
return uriString;
}
/**
*
*
* @param uriString
*/
public Uri(String uriString)
{
this.uriString = uriString;
}
/**
*
*
* @param uriString
* @param dontEscape
*/
public Uri(String uriString, boolean dontEscape)
{
this.uriString = uriString;
@ -68,4 +99,36 @@ public class Uri
{
}
protected void Canonicalize()
{
throw new NotImplementedException();
}
protected void CheckSecurity()
{
throw new NotImplementedException();
}
public static UriHostNameType CheckHostName(String name)
{
throw new NotImplementedException();
}
public static boolean CheckSchemeName(String schemeName)
{
throw new NotImplementedException();
}
/**
* Gets a canonical string representation for the specified System.Uri instance.
*
* @return
* A java.lang.String instance that contains the unescaped canonical representation of the System.Uri instance. All characters are unescaped except #, ?, and %.
*/
@Override
public String toString()
{
throw new NotImplementedException();
}
}

View File

@ -0,0 +1,22 @@
package System;
/**
* Controls how URI information is escaped.
*
* @author Halofreak1990
*/
public enum UriFormat
{
/**
* Escaping is performed according to the rules in RFC 2396.
*/
UriEscaped,
/**
* No escaping is performed.
*/
Unescaped,
/**
* Characters that have a reserved meaning in the requested URI components remain escaped. All others are not escaped. See Remarks.
*/
SafeUnescaped
}

View File

@ -0,0 +1,43 @@
package System;
/**
* The exception that is thrown when an invalid Uniform Resource Identifier (URI) is detected.
*
* @author Halofreak1990
*/
public class UriFormatException extends FormatException
{
private static final long serialVersionUID = 3724278989095091838L;
/**
* Initializes a new instance of the System.UriFormatException class.
*/
public UriFormatException()
{
}
/**
* Initializes a new instance of the System.UriFormatException class with the specified message.
*
* @param textString
* The error message string.
*/
public UriFormatException(String textString)
{
super(textString);
}
/**
* Initializes a new instance of the System.UriFormatException class with a specified error message and a reference to the inner exception that is the cause of this exception.
*
* @param textString
* The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
*
* @param e
* The exception that is the cause of the current exception. If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.
*/
public UriFormatException(String textString, RuntimeException e)
{
super(textString, e);
}
}

View File

@ -0,0 +1,30 @@
package System;
/**
* Defines host name types for the System.Uri.CheckHostName(System.String) method.
*
* @author Halofreak1990
*/
public enum UriHostNameType
{
/**
* The type of the host name is not supplied.
*/
Unknown,
/**
* The host is set, but the type cannot be determined.
*/
Basic,
/**
* The host name is a domain name system (DNS) style host name.
*/
Dns,
/**
* The host name is an Internet Protocol (IP) version 4 host address.
*/
IPv4,
/**
* The host name is an Internet Protocol (IP) version 6 host address.
*/
IPv6
}