Sound Driver
Description
The PC Speaker is used to play some sound in k. It is used by moduling the frequency to produce sound with the channel 2 of the PIT.
Syscall interface
NAME
playsound - play a melody
SYNOPSIS
int playsound(t_melody *melody, int repeat);
DESCRIPTION
playsound() launches the given melody, and repeats it, if the repeat
flag is set.
RETURN VALUE
playsound() returns 0 on success or -1 otherwise.
Recommended methodology
- Enable the channel 2 of the PIT
- Prepare the PIT
- Make a function to stop the sound
- Make the sound you want: COUNT = PIT Frequency (Hz) / Sound Frequency (Hz)
- Play the sound as long as requested (Using the first timer)
- Handle the repeat option
Possible bug causes
- You may have disabled the counter 0 of the PIT by enabling the counter 2
- You may have disabled the PC speaker in the BIOS
- If you already are listening to something, you may not have any sound
Notes
The creation of each t_melody can be found in sdk/mkksf/mkksf.c