brickOS Kernel Developer v0.9.0
Sound.H
Go to the documentation of this file.
1
7//
8// The contents of this file are subject to the Mozilla Public License
9// Version 1.0 (the "License"); you may not use this file except in
10// compliance with the License. You may obtain a copy of the License
11// at http://www.mozilla.org/MPL/
12//
13// Software distributed under the License is distributed on an "AS IS"
14// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15// the License for the specific language governing rights and
16// limitations under the License.
17//
18// This software was developed as part of the legOS project.
19//
20// Contributor: Pat Welch (legOS@mousebrains.com)
21
22#ifndef _Sound_H_
23#define _Sound_H_
24
25#include <config.h>
26#include <dsound.h>
27
28#if defined(CONF_DSOUND)
29
37class Sound {
38public:
46 static void play(const note_t *notes) {return dsound_play(notes);}
52 static int playing() {return dsound_playing();}
57 static void beep() {dsound_system(DSOUND_BEEP);}
62 static void stop() {dsound_stop();}
69 static void duration(const unsigned int len) {dsound_set_duration(len);}
76 static void internote(const unsigned int len) {dsound_set_internote(len);}
77};
78
79#else
80#warning Enable CONF_DSOUND to use Sound.H
81#endif // CONF_DSOUND
82#endif // _Sound_H_
Sound generation interface.
Definition Sound.H:37
static void beep()
Play the system_beep sound.
Definition Sound.H:57
static void stop()
Stop a currently playing sound.
Definition Sound.H:62
static void internote(const unsigned int len)
Set the amount of time between notes.
Definition Sound.H:76
static void duration(const unsigned int len)
Set the default duration.
Definition Sound.H:69
static void play(const note_t *notes)
Play a list of notes (song).
Definition Sound.H:46
static int playing()
Determine if a sound is currently playing.
Definition Sound.H:52
kernel configuration file
static int dsound_playing(void)
returns nonzero value if a sound is playing
Definition dsound.h:260
#define DSOUND_BEEP
system sounds
Definition dsound.h:197
static void dsound_set_internote(unsigned duration)
set duration of inter-note spacing (subtracted from note duration)
Definition dsound.h:255
static void dsound_system(unsigned nr)
play a system sound
Definition dsound.h:240
static void dsound_play(const note_t *notes)
play a sequence of notes
Definition dsound.h:234
static unsigned dsound_set_duration(unsigned duration)
set duration of a 16th note in ms; return the previous duration.
Definition dsound.h:246
void dsound_stop(void)
stop playing sound
the note structure describing a single note.
Definition dsound.h:56