feliwir / feliwir/SharpAudio

Null Reference Exception Playing SoundStream

Đang mở
#22 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C#
Star
194
Fork
20
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

```
private bool doEmitSound(PlaySFX req, GameState state, Instant instant)
{
if (!allowSFX)
return true;
state.Messages.EmitMsg(new ConsoleInput($"Playing {req.Resource}"));
if (!soundboard.ContainsKey(req.Resource))
soundboard.Add(req.Resource, new SoundStream(AssetManager.FindFileStream(req.Resource), sfxEngine));
soundboard[req.Resource].Volume = (currentVolume * req.Volume);//Should be at most 1*1.
soundboard[req.Resource].Play();
return true;
}
```

This code plays the sound as expected the first time, but fails with a null reference exception when the volume property is modified or the play method is called. the second time regardless of being a new SoundStream or an existing SoundStream.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.