Skip to content

Commit

Permalink
fix: Handle when no devices connected
Browse files Browse the repository at this point in the history
  • Loading branch information
adrenak committed Dec 3, 2020
1 parent f3c206f commit 2e07121
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
8 changes: 6 additions & 2 deletions Assets/UniMic/Runtime/Mic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ public int SampleLength {
/// <summary>
/// Index of the current Mic device in m_Devices
/// </summary>
public int CurrentDeviceIndex { get; private set; }
public int CurrentDeviceIndex { get; private set; } = -1;

/// <summary>
/// Gets the name of the Mic device currently in use
/// </summary>
public string CurrentDeviceName {
get { return Devices[CurrentDeviceIndex]; }
get {
if (CurrentDeviceIndex < 0 || CurrentDeviceIndex >= Microphone.devices.Length)
return string.Empty;
return Devices[CurrentDeviceIndex];
}
}

int m_SampleCount = 0;
Expand Down
9 changes: 5 additions & 4 deletions Assets/UniMic/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "com.adrenak.unimic",
"version": "1.0.2",
"displayName": "UniMic",
"displayName": "Adrenak.UniMic",
"description": "Convenience wrapper over Unity's Microphone class.",
"unity": "2018.4",
"author": {
"name": "Vatsal Ambastha",
"email": "adrenak_@outlook.com",
"email": "ambastha.vatsal@gmail.com",
"url": "www.vatsalambastha.com"
},
"dependencies": {},
"scopedRegistries": []
"publishConfig" :{
"registry":"https://registry.npmjs.org"
}
}
8 changes: 8 additions & 0 deletions Logs/Packages-Update.log
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,11 @@ The following packages were added:
[email protected]
[email protected]
[email protected]

=== Thu Dec 3 23:27:50 2020

Packages were changed.
Update Mode: updateDependencies

The following packages were updated:
com.unity.package-manager-ui from version 2.0.8 to 2.0.13
4 changes: 2 additions & 2 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"com.unity.package-manager-ui": "2.0.8",
"com.unity.package-manager-ui": "2.0.13",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
Expand Down Expand Up @@ -32,4 +32,4 @@
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
}
}
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m_EditorVersion: 2018.4.13f1
m_EditorVersion: 2018.4.28f1

0 comments on commit 2e07121

Please sign in to comment.