mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 16:55:28 +00:00
Fixed AudioContext.IsCurrent getter (would throw if no context was current).
This commit is contained in:
parent
ab1b65520d
commit
50fd919bae
|
@ -6,18 +6,20 @@ using OpenTK.Audio;
|
||||||
|
|
||||||
using AlContext = System.IntPtr;
|
using AlContext = System.IntPtr;
|
||||||
using AlDevice = System.IntPtr;
|
using AlDevice = System.IntPtr;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Examples
|
namespace Examples
|
||||||
{
|
{
|
||||||
[Example("AudioContext Test", ExampleCategory.Test)]
|
[Example("AudioContext Test", ExampleCategory.Test)]
|
||||||
class TestApp
|
class TestApp
|
||||||
{
|
{
|
||||||
public static void GetOpenALErrors( IntPtr device )
|
public static void PrintOpenALErrors( IntPtr device )
|
||||||
{
|
{
|
||||||
ALError AlErr = AL.GetError( );
|
ALError AlErr = AL.GetError();
|
||||||
AlcError AlcErr = Alc.GetError( device );
|
// AudioContext should throw on errors, so no need to test them manually.
|
||||||
AlutError AlutErr = Alut.GetError( );
|
//AlcError AlcErr = Alc.GetError(device);
|
||||||
Console.WriteLine( " Al: " + AlErr + " Alc: " + AlcErr + " Alut: " + AlcErr + " " + Alut.GetErrorString( AlutErr ) );
|
AlutError AlutErr = Alut.GetError();
|
||||||
|
Console.WriteLine("Al: " + AlErr + " Alut: " + Alut.GetErrorString(AlutErr));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
|
@ -29,7 +31,26 @@ namespace Examples
|
||||||
{
|
{
|
||||||
AudioContext context = new AudioContext();
|
AudioContext context = new AudioContext();
|
||||||
|
|
||||||
/*
|
Trace.WriteLine("Testing AudioContext functions.");
|
||||||
|
Trace.Indent();
|
||||||
|
|
||||||
|
Trace.WriteLine("Suspend()...");
|
||||||
|
context.Suspend();
|
||||||
|
Trace.Assert(!context.IsProcessing);
|
||||||
|
|
||||||
|
Trace.WriteLine("Process()...");
|
||||||
|
context.Process();
|
||||||
|
Trace.Assert(context.IsProcessing);
|
||||||
|
|
||||||
|
Trace.WriteLine("MakeCurrent()...");
|
||||||
|
context.MakeCurrent();
|
||||||
|
Trace.Assert(context.IsCurrent);
|
||||||
|
|
||||||
|
Trace.WriteLine("IsCurrent = false...");
|
||||||
|
context.IsCurrent = false;
|
||||||
|
Trace.Assert(!context.IsCurrent);
|
||||||
|
|
||||||
|
#if false
|
||||||
AlDevice MyDevice;
|
AlDevice MyDevice;
|
||||||
AlContext MyContext;
|
AlContext MyContext;
|
||||||
|
|
||||||
|
@ -100,7 +121,7 @@ namespace Examples
|
||||||
{
|
{
|
||||||
Console.WriteLine( "Failed to find suitable Device." );
|
Console.WriteLine( "Failed to find suitable Device." );
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
/*
|
/*
|
||||||
include <stdlib.h>
|
include <stdlib.h>
|
||||||
include <AL/alut.h>
|
include <AL/alut.h>
|
||||||
|
|
|
@ -348,7 +348,9 @@ namespace OpenTK.Audio
|
||||||
if (available_contexts.Count == 0)
|
if (available_contexts.Count == 0)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return AudioContext.available_contexts[(ContextHandle)Alc.GetCurrentContext()] == this;
|
{
|
||||||
|
return AudioContext.CurrentContext == this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
|
|
Loading…
Reference in a new issue