mirror of https://github.com/McSinyx/palace
9.2 KiB
9.2 KiB
<html class="writer-html5" lang="en" >
<head>
</head>
palace
Built with Sphinx using a
theme
provided by Read the Docs.
</html>
Table of Contents
Quick Navigation
- »
- Tutorial »
- Context Creation
- View page source
Context Creation¶
A context is an object that allows palace to access OpenAL, which is essential when you work with palace. Context maintains the audio environment and contains environment settings and components such as sources, buffers, and effects.
Creating a Device Object¶
To create a context, we must first create a device, since it’s a parameter of the context object.
To create an object, well, you just have to instantiate
the Device
class.
from palace import Device with Device() as dev: # Your code goes here
This is how you declare a Device
object with the default device.
There can be several devices available, which can be found
in device_names
.
Creating a Context¶
Now that we’ve created a device, we can create the context:
from palace import Device, Context with Device() as dev, Context(dev) as ctx: # Your code goes here
© Copyright 2019, 2020 Nguyễn Gia Phong et al