//////////////////////////////////////////////////////////////////////////////
//
//  This file is part of the Atari graphical interface for GNU Chess,
//  and is Copyright 1992 by Warwick W. Allison.
//
//  You are free to copy and modify these sources, provided you acknowledge
//  the origin by retaining this notice, and adhere to the conditions
//  of the CHESS General Public License described in the main chess file
//  gnuchess.cc.
//
//////////////////////////////////////////////////////////////////////////////

#include <osbind.h>

// Low level macros
#define PitchA(p) 0,(p)&255,1,(p)>>8
#define PitchB(p) 2,(p)&255,3,(p)>>8
#define PitchC(p) 4,(p)&255,5,(p)>>8
#define Noise(n) 6,(n)
#define Control(c) 7,63-(c)
#define VolumeA(v) 8,(v)
#define VolumeB(v) 9,(v)
#define VolumeC(v) 10,(v)
#define WaveA VolumeA(16)
#define WaveB VolumeB(16)
#define WaveC VolumeC(16)
#define Sustain(s) 11,(s)&255,12,(s)>>8
#define Wave(w) 13,(w)

// Control macros
#define Atone 1
#define Btone 2
#define Ctone 4
#define Anoise 8
#define Bnoise 16
#define Cnoise 32

// Wave macros
#define Pop Wave(0)
#define Bang Wave(4)
#define BangBang Wave(8)
#define PopBang Wave(10)
#define PopBeep Wave(11)
#define PopPop Wave(12)
#define BangBeep Wave(13)
#define BangPop Wave(14)

// Dosound level macros
#define ForBy(r,f,t,b) 0x80,(f),0x81,(r),b,(t)
#define For(r,f,t) ForBy(r,f,t,(f)<(t) ? 1 : -1)
#define Pause(t) 0x82,(t)
#define End 0x82,0

// Second level Dosound macros
#define StartA Control(Atone)
#define StartB Control(Atone)
#define StartC Control(Atone)
#define ForVolumeA(f,t) For(8,f,t)
#define ForVolumeB(f,t) For(8,f,t)
#define ForVolumeC(f,t) For(8,f,t)

// stdsnd macros
#define Start StartA
#define Pitch PitchA
#define Volume VolumeA
#define ForVolume ForVolumeA


char ChimeSound[]={ Start, Pitch(30), ForVolume(14,0), End };
char RaspberrySound[]={ Control(Atone|Anoise), Noise(20), Pitch(100), ForVolume(14,0), End };

void Chime()
{
	Dosound(ChimeSound);
}

void Raspberry()
{
	Dosound(RaspberrySound);
}
