Exemplo n.º 1
0
            public static void Create()
            {
                IntPtr ctx;

                try
                {
                    FAudio.FAudioCreate(
                        out ctx,
                        0,
                        FAudio.FAUDIO_DEFAULT_PROCESSOR
                        );
                }
                catch
                {
                    /* FAudio is missing, bail! */
                    return;
                }

                uint devices;

                FAudio.FAudio_GetDeviceCount(
                    ctx,
                    out devices
                    );
                if (devices == 0)
                {
                    /* No sound cards, bail! */
                    FAudio.FAudio_Release(ctx);
                    return;
                }

                Context = new FAudioContext(ctx, devices);
            }
Exemplo n.º 2
0
            public static void Create()
            {
                IntPtr ctx;

                try
                {
                    FAudio.FAudioCreate(
                        out ctx,
                        0,
                        FAudio.FAUDIO_DEFAULT_PROCESSOR
                        );
                }
                catch (Exception e)
                {
                    /* FAudio is missing, bail! */
                    FNALoggerEXT.LogWarn("FAudio failed to load: " + e.ToString());
                    return;
                }

                uint devices;

                FAudio.FAudio_GetDeviceCount(
                    ctx,
                    out devices
                    );
                if (devices == 0)
                {
                    /* No sound cards, bail! */
                    FAudio.FAudio_Release(ctx);
                    return;
                }

                FAudioContext context = new FAudioContext(ctx, devices);

                if (context.Handle == IntPtr.Zero)
                {
                    /* Soundcard failed to configure, bail! */
                    context.Dispose();
                    return;
                }

                Context = context;
            }