1 #include "config.h"
2 
3 #include <stdio.h>
4 #include "portab.h"
5 
6 #include "music_client.h"
7 #include "night.h"
8 
9 struct _ntsnd {
10 	int no;
11 	int vol;
12 	int loop;
13 	boolean waitend;
14 };
15 static struct _ntsnd ntsnd[10];
16 
17 
nt_voice_set(int no)18 void nt_voice_set(int no) {
19 	if (night.waitskiplv < 1) {
20 		mus_wav_load(100, no);
21 		mus_wav_play(100, 1);
22 	}
23 }
24 
nt_cd_play(int no)25 void nt_cd_play(int no) {
26 	mus_cdrom_stop();
27 	mus_cdrom_start(no +1, 0);
28 }
29 
nt_cd_stop(int msec)30 void nt_cd_stop(int msec) {
31 	mus_mixer_fadeout_start(MIX_CD, msec, 0, TRUE);
32 }
33 
nt_cd_mute(boolean mute)34 void nt_cd_mute(boolean mute) {
35 	if (mute) {
36 		mus_mixer_fadeout_start(MIX_CD, 0, 0, FALSE);
37 	} else {
38 		mus_mixer_fadeout_start(MIX_CD, 0, 100, FALSE);
39 	}
40 }
41 
nt_snd_setwave(int ch,int no)42 void nt_snd_setwave(int ch, int no) {
43 	if (ch < 1) return;
44 	ntsnd[ch -1].no = no;
45 	mus_wav_load(ch, no);
46 }
47 
nt_snd_setloop(int ch,int num)48 void nt_snd_setloop(int ch, int num) {
49 	if (ch < 1) return;
50 
51 	ntsnd[ch -1].loop = num;
52 }
53 
nt_snd_setvol(int ch,int vol)54 void nt_snd_setvol(int ch, int vol) {
55 	if (ch < 1) return;
56 
57 	ntsnd[ch -1].vol = vol;
58 }
59 
nt_snd_waitend(int ch,boolean waitend)60 void nt_snd_waitend(int ch, boolean waitend) {
61 	if (ch < 1) return;
62 
63 	ntsnd[ch -1].waitend = waitend;
64 }
65 
nt_snd_play(int ch)66 void nt_snd_play(int ch) {
67 	if (ch < 1) return;
68 
69 	mus_wav_play(ch, ntsnd[ch -1].loop);
70 	if (ntsnd[ch -1].waitend) {
71 		mus_wav_waitend(ch);
72 	}
73 }
74 
nt_snd_stop(int ch,int msec)75 void nt_snd_stop(int ch, int msec) {
76 	if (ch < 1) return;
77 
78 	mus_wav_fadeout_start(ch, msec, 0, TRUE);
79 }
80 
nt_snd_stopall(int msec)81 void nt_snd_stopall(int msec) {
82 	int i;
83 
84 	for (i = 1; i <= 10; i++) {
85 		mus_wav_fadeout_start(i, msec, 0, TRUE);
86 	}
87 }
88