Tanoda
RecordedAudio.cs
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) Ultraleap, Inc. 2011-2020. *
3
* *
4
* Use subject to the terms of the Apache License 2.0 available at *
5
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6
* between Ultraleap and you, your company or other organization. *
7
******************************************************************************/
8
9
using
System;
10
using
System.Collections.Generic;
11
using
UnityEngine
;
12
13
namespace
Leap.Unity.Recording
{
14
15
public
class
RecordedAudio
: MonoBehaviour {
16
17
public
AudioSource
target
;
18
public
List<ClipData>
data
=
new
List<ClipData>();
19
20
private
bool
_prevWasPlaying =
false
;
21
private
float
_prevTime = 0;
22
private
AudioClip _prevClip =
null
;
23
24
private
void
LateUpdate() {
25
bool
didStartNewClip =
false
;
26
27
if
(
target
.isPlaying && !_prevWasPlaying) {
28
didStartNewClip =
true
;
29
}
30
31
if
(
target
.time < _prevTime &&
target
.isPlaying) {
32
didStartNewClip =
true
;
33
}
34
35
if
(
target
.clip !=
null
&&
target
.clip != _prevClip &&
target
.isPlaying) {
36
didStartNewClip =
true
;
37
}
38
39
if
(didStartNewClip) {
40
data
.Add(
new
ClipData() {
41
clip =
target
.clip,
42
startTime = HierarchyRecorder.instance.recordingTime,
43
pitch =
target
.pitch,
44
volume =
target
.volume
45
});
46
}
47
48
_prevWasPlaying =
target
.isPlaying;
49
_prevTime =
target
.time;
50
_prevClip =
target
.clip;
51
}
52
53
[Serializable]
54
public
class
ClipData
{
55
public
AudioClip
clip
;
56
public
float
startTime
;
57
public
float
pitch
;
58
public
float
volume
;
59
}
60
}
61
}
Leap.Unity.Recording.RecordedAudio.ClipData
Definition:
RecordedAudio.cs:54
Leap.Unity.Recording.RecordedAudio.ClipData.pitch
float pitch
Definition:
RecordedAudio.cs:57
Leap.Unity.Recording.RecordedAudio.ClipData.clip
AudioClip clip
Definition:
RecordedAudio.cs:55
Leap.Unity.Recording.RecordedAudio.ClipData.volume
float volume
Definition:
RecordedAudio.cs:58
Leap.Unity.Recording.RecordedAudio.ClipData.startTime
float startTime
Definition:
RecordedAudio.cs:56
Leap.Unity.Recording.RecordedAudio
Definition:
RecordedAudio.cs:15
Leap.Unity.Recording.RecordedAudio.target
AudioSource target
Definition:
RecordedAudio.cs:17
Leap.Unity.Recording.RecordedAudio.data
List< ClipData > data
Definition:
RecordedAudio.cs:18
Leap.Unity.Recording
Definition:
HierarchyPostProcessEditor.cs:15
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Plugins
LeapMotion
Experimental
HierarchyRecording
Scripts
RecordedAudio.cs
Generated by
1.9.3