Make sure NativeAudioSource.handle is non-null.

Using `getGain()` and `setGain()` as a template. Like gain, you won't be able to set pitch before calling `init()`.
This commit is contained in:
player-03
2022-01-07 20:44:28 -05:00
committed by GitHub
parent f46ed3dc7e
commit c328d0c85c

View File

@@ -512,7 +512,14 @@ class NativeAudioSource
public function getPitch():Float
{
return AL.getSourcef(handle, AL.PITCH);
if (handle != null)
{
return AL.getSourcef(handle, AL.PITCH);
}
else
{
return 1;
}
}
public function setPitch(value:Float):Float
@@ -533,7 +540,10 @@ class NativeAudioSource
}
}
AL.sourcef(handle, AL.PITCH, value);
if (handle != null)
{
AL.sourcef(handle, AL.PITCH, value);
}
return value;
}