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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user