fna-workbench

fna-workbench Commit Details


Date:2016-03-08 09:03:41 (8 years 9 months ago)
Author:Ethan Lee
Branch:master
Commit:1bf3f96715c82c04c83b6d699a44362e9ac07abd
Parents: 6273c3309a475d83c421f1cb2b0626d54552dd93
Message:Track NumCueInstances and JustStarted differently

Changes:

File differences

src/Audio/AudioCategory.cs
5757
5858
5959
60
60
6161
6262
6363
......
8080
8181
8282
83
83
8484
8585
8686
......
131131
132132
133133
134
135
136134
137135
136
137
138
139
138140
139141
140142
......
190192
191193
192194
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212195
213196
214197
......
252235
253236
254237
255
256238
257239
258240
......
269251
270252
271253
272
273
254
274255
275256
276257
......
314295
315296
316297
317
318298
319299
320300
......
332312
333313
334314
335
315
336316
337317
338318
339319
340320
321
322
323
324
325
326
327
328
329
341330
342331
343332
private List<Cue> activeCues;
private Dictionary<string, int> cueInstanceCounts;
private Dictionary<string, List<Cue>> cueInstanceCounts;
private byte maxCueInstances;
private MaxInstanceBehavior maxCueBehavior;
INTERNAL_name = name;
INTERNAL_volume = new PrimitiveInstance<float>(volume);
activeCues = new List<Cue>();
cueInstanceCounts = new Dictionary<string, int>();
cueInstanceCounts = new Dictionary<string, List<Cue>>();
maxCueInstances = maxInstances;
maxCueBehavior = (MaxInstanceBehavior) maxBehavior;
{
Cue curCue = activeCues[0];
curCue.Stop(options);
curCue.SetVariable("NumCueInstances", 0);
cueInstanceCounts[curCue.Name] -= 1;
}
activeCues.Clear();
foreach (List<Cue> count in cueInstanceCounts.Values)
{
count.Clear();
}
}
}
i -= 1;
}
}
foreach (Cue curCue in activeCues)
{
curCue.SetVariable(
"NumCueInstances",
cueInstanceCounts[curCue.Name]
);
}
}
}
internal void INTERNAL_initCue(Cue newCue)
{
lock (activeCues)
{
if (!cueInstanceCounts.ContainsKey(newCue.Name))
{
cueInstanceCounts.Add(newCue.Name, 0);
}
newCue.SetVariable("NumCueInstances", cueInstanceCounts[newCue.Name]);
}
}
}
if (lowestIndex > -1)
{
cueInstanceCounts[activeCues[lowestIndex].Name] -= 1;
activeCues[lowestIndex].Stop(AudioStopOptions.AsAuthored);
}
else
}
}
}
cueInstanceCounts[newCue.Name] += 1;
newCue.SetVariable("NumCueInstances", cueInstanceCounts[newCue.Name]);
cueInstanceCounts[newCue.Name].Add(newCue);
activeCues.Add(newCue);
}
return true;
if (lowestIndex > -1)
{
cueInstanceCounts[name] -= 1;
activeCues[lowestIndex].Stop(AudioStopOptions.AsAuthored);
return true;
}
if (activeCues.Contains(cue))
{
activeCues.Remove(cue);
cueInstanceCounts[cue.Name] -= 1;
cueInstanceCounts[cue.Name].Remove(cue);
}
}
}
}
internal int INTERNAL_cueInstanceCount(string name)
{
if (!cueInstanceCounts.ContainsKey(name))
{
cueInstanceCounts.Add(name, new List<Cue>());
}
return cueInstanceCounts[name].Count;
}
#endregion
}
}
src/Audio/Cue.cs
8888
8989
9090
91
9192
9293
9394
9495
95
96
96
9797
9898
9999
......
306306
307307
308308
309
310
311
312
309313
310314
311315
......
328332
329333
330334
331
332
333
335
334336
335337
336338
......
369371
370372
371373
374
372375
373376
374377
......
461464
462465
463466
467
464468
465469
466470
#region Internal Properties
private ulong elapsedFrames;
internal bool JustStarted
{
get
{
// Arbitrarily 1/12 of a second, with some wiggle room -flibit
return INTERNAL_timer.ElapsedMilliseconds < 80;
return elapsedFrames < 2;
}
}
return curVar.GetValue();
}
}
if (name.Equals("NumCueInstances"))
{
return INTERNAL_category.INTERNAL_cueInstanceCount(Name);
}
throw new ArgumentException("Instance variable not found!");
}
throw new InvalidOperationException("Cue already playing!");
}
INTERNAL_category.INTERNAL_initCue(this);
if (GetVariable("NumCueInstances") >= INTERNAL_data.InstanceLimit)
if (INTERNAL_category.INTERNAL_cueInstanceCount(Name) >= INTERNAL_data.InstanceLimit)
{
if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.Fail)
{
return;
}
elapsedFrames = 0;
INTERNAL_timer.Start();
if (INTERNAL_data.FadeInMS > 0)
{
{
return true;
}
elapsedFrames += 1;
// Play events when the timestamp has been hit.
for (int i = 0; i < INTERNAL_eventList.Count; i += 1)

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06147s using 13 queries.