Skip to content
Alvaro Gallo edited this page Jan 10, 2022 · 5 revisions

Play Music:

  1. In your project setup, you should have the "assets_src" folder, that's where you put your assets in human formats.
  2. Make two folders inside "assets_src": "audio" and "audio_event".
  3. In "audio" you can put your files, but I prefer to make two folders inside "audio": "music" and "sfx".
  4. Once you have your audio files inside "audio", go to "audio_event" folder and create a YAML file called as you would refer after in your code.
  5. Put these contents inside your yaml file:
---
actions:
  - type: play
    clips: [ music/music.ogg ]
    loop: false
...

This file contains an action and has a clip called music.ogg, inside "assets_src/audio/music", and it sets the music not loop.

  1. Run halley-cmd import projDir halleyDir.
  2. In your Stage make a member example: Halley::AudioHandle m_music.
  3. In YourStage::Init() put this:
  // Stop things from previous Stage
  getAudioAPI().stopAllMusic();
  // Play some music
  m_music = getAudioAPI().playMusic("music");
  1. Done!! your m_music will have some utilities to tweak your sounds.
Clone this wiki locally