dsound.h File Reference

Interface: direct control of sound. More...

#include <config.h>
#include <time.h>
#include <unistd.h>
Include dependency graph for dsound.h:

Go to the source code of this file.

Classes

struct  note_t
 the note structure describing a single note. More...
 

Macros

#define WHOLE   16
 Whole note in terms of sixteenths. More...
 
#define HALF   8
 Half note in terms of sixteenths. More...
 
#define QUARTER   4
 Quater note in terms of sixteenths. More...
 
#define EIGHTH   2
 Eighth note in terms of sixteenths. More...
 
#define PITCH_A0   0
 \defgoup notePitches standard note pitch values More...
 
#define PITCH_Am0   1
 
#define PITCH_H0   2
 
#define PITCH_C1   3
 
#define PITCH_Cm1   4
 
#define PITCH_D1   5
 
#define PITCH_Dm1   6
 
#define PITCH_E1   7
 
#define PITCH_F1   8
 
#define PITCH_Fm1   9
 
#define PITCH_G1   10
 
#define PITCH_Gm1   11
 
#define PITCH_A1   12
 
#define PITCH_Am1   13
 
#define PITCH_H1   14
 
#define PITCH_C2   15
 
#define PITCH_Cm2   16
 
#define PITCH_D2   17
 
#define PITCH_Dm2   18
 
#define PITCH_E2   19
 
#define PITCH_F2   20
 
#define PITCH_Fm2   21
 
#define PITCH_G2   22
 
#define PITCH_Gm2   23
 
#define PITCH_A2   24
 
#define PITCH_Am2   25
 
#define PITCH_H2   26
 
#define PITCH_C3   27
 
#define PITCH_Cm3   28
 
#define PITCH_D3   29
 
#define PITCH_Dm3   30
 
#define PITCH_E3   31
 
#define PITCH_F3   32
 
#define PITCH_Fm3   33
 
#define PITCH_G3   34
 
#define PITCH_Gm3   35
 
#define PITCH_A3   36
 
#define PITCH_Am3   37
 
#define PITCH_H3   38
 
#define PITCH_C4   39
 
#define PITCH_Cm4   40
 
#define PITCH_D4   41
 
#define PITCH_Dm4   42
 
#define PITCH_E4   43
 
#define PITCH_F4   44
 
#define PITCH_Fm4   45
 
#define PITCH_G4   46
 
#define PITCH_Gm4   47
 
#define PITCH_A4   48
 
#define PITCH_Am4   49
 
#define PITCH_H4   50
 
#define PITCH_C5   51
 
#define PITCH_Cm5   52
 
#define PITCH_D5   53
 
#define PITCH_Dm5   54
 
#define PITCH_E5   55
 
#define PITCH_F5   56
 
#define PITCH_Fm5   57
 
#define PITCH_G5   58
 
#define PITCH_Gm5   59
 
#define PITCH_A5   60
 
#define PITCH_Am5   61
 
#define PITCH_H5   62
 
#define PITCH_C6   63
 
#define PITCH_Cm6   64
 
#define PITCH_D6   65
 
#define PITCH_Dm6   66
 
#define PITCH_E6   67
 
#define PITCH_F6   68
 
#define PITCH_Fm6   69
 
#define PITCH_G6   70
 
#define PITCH_Gm6   71
 
#define PITCH_A6   72
 
#define PITCH_Am6   73
 
#define PITCH_H6   74
 
#define PITCH_C7   75
 
#define PITCH_Cm7   76
 
#define PITCH_D7   77
 
#define PITCH_Dm7   78
 
#define PITCH_E7   79
 
#define PITCH_F7   80
 
#define PITCH_Fm7   81
 
#define PITCH_G7   82
 
#define PITCH_Gm7   83
 
#define PITCH_A7   84
 
#define PITCH_Am7   85
 
#define PITCH_H7   86
 
#define PITCH_C8   87
 
#define PITCH_Cm8   88
 
#define PITCH_D8   89
 
#define PITCH_Dm8   90
 
#define PITCH_E8   91
 
#define PITCH_F8   92
 
#define PITCH_Fm8   93
 
#define PITCH_G8   94
 
#define PITCH_Gm8   95
 
#define PITCH_A8   96
 
#define PITCH_PAUSE   97
 specify a pause (rest) More...
 
#define PITCH_MAX   98
 maximum pitch value More...
 
#define PITCH_END   255
 mark the end of a list of note_t entries More...
 
#define DSOUND_BEEP   0
 system sounds More...
 
#define DSOUND_SYS_MAX   1
 max system sound More...
 
#define DSOUND_DEFAULT_16th_ms   200
 default duration of 1/16th note in ms More...
 
#define DSOUND_DEFAULT_internote_ms   15
 default duration internote spacing in ms More...
 

Functions

static void dsound_play (const note_t *notes)
 play a sequence of notes More...
 
static void dsound_system (unsigned nr)
 play a system sound More...
 
static unsigned dsound_set_duration (unsigned duration)
 set duration of a 16th note in ms; return the previous duration. More...
 
static void dsound_set_internote (unsigned duration)
 set duration of inter-note spacing (subtracted from note duration) More...
 
static int dsound_playing (void)
 returns nonzero value if a sound is playing More...
 
wakeup_t dsound_finished (wakeup_t data)
 sound finished event wakeup function More...
 
void dsound_stop (void)
 stop playing sound More...
 

Detailed Description

Interface: direct control of sound.

Author
Markus L. Noga marku.nosp@m.s@no.nosp@m.ga.de

Definition in file dsound.h.

Macro Definition Documentation

◆ DSOUND_BEEP

#define DSOUND_BEEP   0

system sounds

Definition at line 197 of file dsound.h.

◆ DSOUND_DEFAULT_16th_ms

#define DSOUND_DEFAULT_16th_ms   200

default duration of 1/16th note in ms

Definition at line 204 of file dsound.h.

◆ DSOUND_DEFAULT_internote_ms

#define DSOUND_DEFAULT_internote_ms   15

default duration internote spacing in ms

Definition at line 207 of file dsound.h.

◆ DSOUND_SYS_MAX

#define DSOUND_SYS_MAX   1

max system sound

Definition at line 200 of file dsound.h.

◆ EIGHTH

#define EIGHTH   2

Eighth note in terms of sixteenths.

Definition at line 75 of file dsound.h.

◆ HALF

#define HALF   8

Half note in terms of sixteenths.

Definition at line 69 of file dsound.h.

◆ PITCH_A0

#define PITCH_A0   0

\defgoup notePitches standard note pitch values

Note Pitch Value

Definition at line 86 of file dsound.h.

◆ PITCH_A1

#define PITCH_A1   12

Definition at line 98 of file dsound.h.

◆ PITCH_A2

#define PITCH_A2   24

Definition at line 110 of file dsound.h.

◆ PITCH_A3

#define PITCH_A3   36

Definition at line 122 of file dsound.h.

◆ PITCH_A4

#define PITCH_A4   48

Definition at line 134 of file dsound.h.

◆ PITCH_A5

#define PITCH_A5   60

Definition at line 146 of file dsound.h.

◆ PITCH_A6

#define PITCH_A6   72

Definition at line 158 of file dsound.h.

◆ PITCH_A7

#define PITCH_A7   84

Definition at line 170 of file dsound.h.

◆ PITCH_A8

#define PITCH_A8   96

Definition at line 182 of file dsound.h.

◆ PITCH_Am0

#define PITCH_Am0   1

Definition at line 87 of file dsound.h.

◆ PITCH_Am1

#define PITCH_Am1   13

Definition at line 99 of file dsound.h.

◆ PITCH_Am2

#define PITCH_Am2   25

Definition at line 111 of file dsound.h.

◆ PITCH_Am3

#define PITCH_Am3   37

Definition at line 123 of file dsound.h.

◆ PITCH_Am4

#define PITCH_Am4   49

Definition at line 135 of file dsound.h.

◆ PITCH_Am5

#define PITCH_Am5   61

Definition at line 147 of file dsound.h.

◆ PITCH_Am6

#define PITCH_Am6   73

Definition at line 159 of file dsound.h.

◆ PITCH_Am7

#define PITCH_Am7   85

Definition at line 171 of file dsound.h.

◆ PITCH_C1

#define PITCH_C1   3

Definition at line 89 of file dsound.h.

◆ PITCH_C2

#define PITCH_C2   15

Definition at line 101 of file dsound.h.

◆ PITCH_C3

#define PITCH_C3   27

Definition at line 113 of file dsound.h.

◆ PITCH_C4

#define PITCH_C4   39

Definition at line 125 of file dsound.h.

◆ PITCH_C5

#define PITCH_C5   51

Definition at line 137 of file dsound.h.

◆ PITCH_C6

#define PITCH_C6   63

Definition at line 149 of file dsound.h.

◆ PITCH_C7

#define PITCH_C7   75

Definition at line 161 of file dsound.h.

◆ PITCH_C8

#define PITCH_C8   87

Definition at line 173 of file dsound.h.

◆ PITCH_Cm1

#define PITCH_Cm1   4

Definition at line 90 of file dsound.h.

◆ PITCH_Cm2

#define PITCH_Cm2   16

Definition at line 102 of file dsound.h.

◆ PITCH_Cm3

#define PITCH_Cm3   28

Definition at line 114 of file dsound.h.

◆ PITCH_Cm4

#define PITCH_Cm4   40

Definition at line 126 of file dsound.h.

◆ PITCH_Cm5

#define PITCH_Cm5   52

Definition at line 138 of file dsound.h.

◆ PITCH_Cm6

#define PITCH_Cm6   64

Definition at line 150 of file dsound.h.

◆ PITCH_Cm7

#define PITCH_Cm7   76

Definition at line 162 of file dsound.h.

◆ PITCH_Cm8

#define PITCH_Cm8   88

Definition at line 174 of file dsound.h.

◆ PITCH_D1

#define PITCH_D1   5

Definition at line 91 of file dsound.h.

◆ PITCH_D2

#define PITCH_D2   17

Definition at line 103 of file dsound.h.

◆ PITCH_D3

#define PITCH_D3   29

Definition at line 115 of file dsound.h.

◆ PITCH_D4

#define PITCH_D4   41

Definition at line 127 of file dsound.h.

◆ PITCH_D5

#define PITCH_D5   53

Definition at line 139 of file dsound.h.

◆ PITCH_D6

#define PITCH_D6   65

Definition at line 151 of file dsound.h.

◆ PITCH_D7

#define PITCH_D7   77

Definition at line 163 of file dsound.h.

◆ PITCH_D8

#define PITCH_D8   89

Definition at line 175 of file dsound.h.

◆ PITCH_Dm1

#define PITCH_Dm1   6

Definition at line 92 of file dsound.h.

◆ PITCH_Dm2

#define PITCH_Dm2   18

Definition at line 104 of file dsound.h.

◆ PITCH_Dm3

#define PITCH_Dm3   30

Definition at line 116 of file dsound.h.

◆ PITCH_Dm4

#define PITCH_Dm4   42

Definition at line 128 of file dsound.h.

◆ PITCH_Dm5

#define PITCH_Dm5   54

Definition at line 140 of file dsound.h.

◆ PITCH_Dm6

#define PITCH_Dm6   66

Definition at line 152 of file dsound.h.

◆ PITCH_Dm7

#define PITCH_Dm7   78

Definition at line 164 of file dsound.h.

◆ PITCH_Dm8

#define PITCH_Dm8   90

Definition at line 176 of file dsound.h.

◆ PITCH_E1

#define PITCH_E1   7

Definition at line 93 of file dsound.h.

◆ PITCH_E2

#define PITCH_E2   19

Definition at line 105 of file dsound.h.

◆ PITCH_E3

#define PITCH_E3   31

Definition at line 117 of file dsound.h.

◆ PITCH_E4

#define PITCH_E4   43

Definition at line 129 of file dsound.h.

◆ PITCH_E5

#define PITCH_E5   55

Definition at line 141 of file dsound.h.

◆ PITCH_E6

#define PITCH_E6   67

Definition at line 153 of file dsound.h.

◆ PITCH_E7

#define PITCH_E7   79

Definition at line 165 of file dsound.h.

◆ PITCH_E8

#define PITCH_E8   91

Definition at line 177 of file dsound.h.

◆ PITCH_END

#define PITCH_END   255

mark the end of a list of note_t entries

Definition at line 193 of file dsound.h.

◆ PITCH_F1

#define PITCH_F1   8

Definition at line 94 of file dsound.h.

◆ PITCH_F2

#define PITCH_F2   20

Definition at line 106 of file dsound.h.

◆ PITCH_F3

#define PITCH_F3   32

Definition at line 118 of file dsound.h.

◆ PITCH_F4

#define PITCH_F4   44

Definition at line 130 of file dsound.h.

◆ PITCH_F5

#define PITCH_F5   56

Definition at line 142 of file dsound.h.

◆ PITCH_F6

#define PITCH_F6   68

Definition at line 154 of file dsound.h.

◆ PITCH_F7

#define PITCH_F7   80

Definition at line 166 of file dsound.h.

◆ PITCH_F8

#define PITCH_F8   92

Definition at line 178 of file dsound.h.

◆ PITCH_Fm1

#define PITCH_Fm1   9

Definition at line 95 of file dsound.h.

◆ PITCH_Fm2

#define PITCH_Fm2   21

Definition at line 107 of file dsound.h.

◆ PITCH_Fm3

#define PITCH_Fm3   33

Definition at line 119 of file dsound.h.

◆ PITCH_Fm4

#define PITCH_Fm4   45

Definition at line 131 of file dsound.h.

◆ PITCH_Fm5

#define PITCH_Fm5   57

Definition at line 143 of file dsound.h.

◆ PITCH_Fm6

#define PITCH_Fm6   69

Definition at line 155 of file dsound.h.

◆ PITCH_Fm7

#define PITCH_Fm7   81

Definition at line 167 of file dsound.h.

◆ PITCH_Fm8

#define PITCH_Fm8   93

Definition at line 179 of file dsound.h.

◆ PITCH_G1

#define PITCH_G1   10

Definition at line 96 of file dsound.h.

◆ PITCH_G2

#define PITCH_G2   22

Definition at line 108 of file dsound.h.

◆ PITCH_G3

#define PITCH_G3   34

Definition at line 120 of file dsound.h.

◆ PITCH_G4

#define PITCH_G4   46

Definition at line 132 of file dsound.h.

◆ PITCH_G5

#define PITCH_G5   58

Definition at line 144 of file dsound.h.

◆ PITCH_G6

#define PITCH_G6   70

Definition at line 156 of file dsound.h.

◆ PITCH_G7

#define PITCH_G7   82

Definition at line 168 of file dsound.h.

◆ PITCH_G8

#define PITCH_G8   94

Definition at line 180 of file dsound.h.

◆ PITCH_Gm1

#define PITCH_Gm1   11

Definition at line 97 of file dsound.h.

◆ PITCH_Gm2

#define PITCH_Gm2   23

Definition at line 109 of file dsound.h.

◆ PITCH_Gm3

#define PITCH_Gm3   35

Definition at line 121 of file dsound.h.

◆ PITCH_Gm4

#define PITCH_Gm4   47

Definition at line 133 of file dsound.h.

◆ PITCH_Gm5

#define PITCH_Gm5   59

Definition at line 145 of file dsound.h.

◆ PITCH_Gm6

#define PITCH_Gm6   71

Definition at line 157 of file dsound.h.

◆ PITCH_Gm7

#define PITCH_Gm7   83

Definition at line 169 of file dsound.h.

◆ PITCH_Gm8

#define PITCH_Gm8   95

Definition at line 181 of file dsound.h.

◆ PITCH_H0

#define PITCH_H0   2

Definition at line 88 of file dsound.h.

◆ PITCH_H1

#define PITCH_H1   14

Definition at line 100 of file dsound.h.

◆ PITCH_H2

#define PITCH_H2   26

Definition at line 112 of file dsound.h.

◆ PITCH_H3

#define PITCH_H3   38

Definition at line 124 of file dsound.h.

◆ PITCH_H4

#define PITCH_H4   50

Definition at line 136 of file dsound.h.

◆ PITCH_H5

#define PITCH_H5   62

Definition at line 148 of file dsound.h.

◆ PITCH_H6

#define PITCH_H6   74

Definition at line 160 of file dsound.h.

◆ PITCH_H7

#define PITCH_H7   86

Definition at line 172 of file dsound.h.

◆ PITCH_MAX

#define PITCH_MAX   98

maximum pitch value

Definition at line 190 of file dsound.h.

◆ PITCH_PAUSE

#define PITCH_PAUSE   97

specify a pause (rest)

Definition at line 187 of file dsound.h.

◆ QUARTER

#define QUARTER   4

Quater note in terms of sixteenths.

Definition at line 72 of file dsound.h.

◆ WHOLE

#define WHOLE   16

Whole note in terms of sixteenths.

Definition at line 66 of file dsound.h.

Function Documentation

◆ dsound_finished()

wakeup_t dsound_finished ( wakeup_t  data)

sound finished event wakeup function

◆ dsound_play()

static void dsound_play ( const note_t notes)
inlinestatic

play a sequence of notes

Definition at line 234 of file dsound.h.

Referenced by dsound_system(), and Sound::play().

◆ dsound_playing()

static int dsound_playing ( void  )
inlinestatic

returns nonzero value if a sound is playing

Definition at line 260 of file dsound.h.

Referenced by Sound::playing().

◆ dsound_set_duration()

static unsigned dsound_set_duration ( unsigned  duration)
inlinestatic

set duration of a 16th note in ms; return the previous duration.

Definition at line 246 of file dsound.h.

Referenced by Sound::duration().

◆ dsound_set_internote()

static void dsound_set_internote ( unsigned  duration)
inlinestatic

set duration of inter-note spacing (subtracted from note duration)

set to 0 for perfect legato.

Definition at line 255 of file dsound.h.

Referenced by Sound::internote().

◆ dsound_stop()

void dsound_stop ( void  )

stop playing sound

Referenced by Sound::stop().

◆ dsound_system()

static void dsound_system ( unsigned  nr)
inlinestatic

play a system sound

Definition at line 240 of file dsound.h.

References dsound_play(), and DSOUND_SYS_MAX.

Referenced by Sound::beep().


brickOS is released under the Mozilla Public License.
Original code copyright 1998-2005 by the authors.

Generated for brickOS C++ by doxygen 1.9.4