-#if 0
-struct SoundHeader_SUN
-{
- unsigned long magic;
- unsigned long hdr_size;
- unsigned long data_size;
- unsigned long encoding;
- unsigned long sample_rate;
- unsigned long channels;
-};
+#define SOUND_VOLUME_FROM_PERCENT(v,p) ((p) < 0 ? SOUND_MIN_VOLUME : \
+ (p) > 100 ? (v) : \
+ (p) * (v) / 100)
+
+#define SOUND_VOLUME_SIMPLE(v) SOUND_VOLUME_FROM_PERCENT(v, setup.volume_simple)
+#define SOUND_VOLUME_LOOPS(v) SOUND_VOLUME_FROM_PERCENT(v, setup.volume_loops)
+#define SOUND_VOLUME_MUSIC(v) SOUND_VOLUME_FROM_PERCENT(v, setup.volume_music)
+
+#define SETUP_SOUND_VOLUME(v,s) ((s) == SND_CTRL_PLAY_MUSIC ? \
+ SOUND_VOLUME_MUSIC(v) : \
+ (s) == SND_CTRL_PLAY_LOOP ? \
+ SOUND_VOLUME_LOOPS(v) : \
+ SOUND_VOLUME_SIMPLE(v))