internal void StartSound(SoundEffect effect)
 {
     IntPtr stream = OpenStream(effect);
     effect.Stream = stream;
     StartStream(stream);
     playingSounds.Add(stream);
 }
 private unsafe IntPtr OpenStream(SoundEffect soundEffect)
 {
     IntPtr stream;
     PortAudio.PaStreamCallbackDelegate callback = new PortAudio.PaStreamCallbackDelegate(soundEffect.CallBack);
     PortAudio.PaErrorCode errorCode = PortAudio.Pa_OpenDefaultStream(out stream, 0, 2, (uint)PortAudio.PaSampleFormat.paFloat32, 22000, 256, callback, IntPtr.Zero);
     return stream;
 }
 internal void StopSound(SoundEffect effect)
 {
     StopStream(effect.Stream);
     CloseStream(effect.Stream);
     playingSounds.Remove(effect.Stream);
 }