Exemplo n.º 1
0
def test_bass():
    lucia.initialize(audiobackend=lucia.AudioBackend.BASS)
    assert lucia.running == True

    print(f"Playing sound {audio_file_path}.")
    testsound = lucia.audio_backend.Sound()
    testsound.load(audio_file_path)
    testsound.play()
    assert testsound.get_source_object().is_playing
    testpool = lucia.audio_backend.SoundPool()
    testpool.play_stationary(audio_file_path)
    testpool.play_1d(audio_file_path, 0, 1000, False)
    testpool.play_2d(audio_file_path, 0, 0, 1000, 1000, False)
    testpool.play_3d(audio_file_path, 0, 0, 0, 1000, 1000, 1000, False)
    testpool.update_audio_system()
    testpool.update_listener_1d(1)
    testpool.update_listener_2d(1, 2)
    testpool.update_listener_3d(1, 2, 3, 0)
Exemplo n.º 2
0
def test_initialization_openal():
    lucia.initialize(audiobackend=lucia.AudioBackend.OPENAL)
    assert lucia.running == True
Exemplo n.º 3
0
def test_process_events():
    if lucia.running == False:
        lucia.initialize()
    assert lucia.process_events() is not None
Exemplo n.º 4
0
def test_show_window():
    if lucia.running == False:
        lucia.initialize()
    lucia.show_window()
    assert lucia.window is not None
Exemplo n.º 5
0
def test_audio_backend_initialization():
    if lucia.running == False:
        lucia.initialize()
    assert lucia.audio_backend is not None
    assert lucia.audio_backend_class is not None
Exemplo n.º 6
0
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see https://github.com/LuciaSoftware/lucia/blob/master/LICENSE.

# Importing lucia
import lucia

# Initializing lucia
lucia.initialize(audiobackend=lucia.AudioBackend.BASS)

# Showing the window
demo = lucia.show_window("A yes or no question")

SOUNDS = {
    "open": "sounds\\mPop.wav",
    "scroll": "sounds\\mChange.wav",
    "border": "sounds\\mRoll.wav",
    "enter": "sounds\\mSelect.wav",
}

question = lucia.ui.SimpleQuestion("agree",
                                   "disagree",
                                   scroll_sound=SOUNDS["scroll"])
question.align_selection_vertical()
Exemplo n.º 7
0
        self._x = value

    @property
    def y(self):
        return self._y

    @y.setter
    def y(self, value):
        self._y = value


#Call init in lucia
#Must be called in order for lucia to work properly
#Since we are using bass, I will just call init without the open Al parameter.
#Should you wish to change it, the desired param is in __init__.py in Lucia's directory
lucia.initialize()
#Create a sound pool
#Must be done after lucia is initialized, otherwise the engine will throw a fit
sound_pool = lucia.audio_backend.SoundPool()


#Create a moving function to simplify updating of sounds
def move_object(obj, value):
    #From lowest to highest, the values are 0, 1, 2, or 3 moving the object forward, right, backward, and left respectively.
    if value == 0: obj.y += 1
    elif value == 1: obj.x += 1
    elif value == 2: obj.y -= 1
    elif value == 3: obj.x -= 1
    #Update listener after all is said and done
    sound_pool.update_listener_2d(obj.x, obj.y)
Exemplo n.º 8
0
import logging, lucia, time
from lucia import utils

# Un comment this for debugging messages
#handler = logging.StreamHandler() # Logs to terminal
#formatter = logging.Formatter('%(asctime)s: %(levelname)s from %(name)s - %(message)s') # Sets the format in which the messages are displayed
#handler.setFormatter(formatter)
#lucia.logger.addHandler(handler)

lucia.initialize(audiobackend=lucia.AudioBackend.OPENAL)
window = lucia.show_window("shapes demo")

# Listener coordinates
x = 0
y = 0
width = 30
height = 30

# Set up the game field
field = list(range(width))
for ix in range(0, width):
    field[ix] = list(range(height))
    for iy in range(0, height):
        field[ix][iy] = 0


def MainLoop():
    global x, y, width, height
    timer = utils.Timer(
    )  # Prevents the user from walking faster than the sound can play. You're not the Flash.
    WALK_SPEED = 300  # milliseconds