1
//============================================================================
5
// SS tttttt eeee ll ll aaaa
6
// SSSS tt ee ee ll ll aa
7
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8
// SS SS tt ee ll ll aa aa
9
// SSSS ttt eeeee llll llll aaaaa
11
// Copyright (c) 1995-1998 by Bradford W. Mott
13
// See the file "license" for information on usage and redistribution of
14
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16
// $Id: SndDOS.cxx,v 1.1 1998/08/01 21:11:42 bwmott Exp $
17
//============================================================================
26
Compute the buffer size to use based on the given sample rate
28
@param The sample rate to compute the buffer size for
30
static unsigned long computeBufferSize(int sampleRate)
34
for(t = 7; t <= 12; ++t)
36
if((1 << t) > (sampleRate / 60))
38
return (1 << (t - 1));
45
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
48
int sampleRate = 15700;
49
int DMABufferSize = computeBufferSize(sampleRate);
51
if(OpenSB(sampleRate, DMABufferSize))
55
// Initialize TIA Sound Library
56
Tia_sound_init(31400, sampleRate);
58
// Start playing audio
59
Start_audio_output(AUTO_DMA,
60
(void (*)(unsigned char*, short unsigned int))Tia_process);
64
// Oops, couldn't open SB so we're not enabled :-(
70
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
79
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
80
void SoundDOS::set(Sound::Register reg, uInt8 value)
88
Update_tia_sound(0x15, value);
92
Update_tia_sound(0x16, value);
96
Update_tia_sound(0x17, value);
100
Update_tia_sound(0x18, value);
104
Update_tia_sound(0x19, value);
108
Update_tia_sound(0x1A, value);
116
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
117
void SoundDOS::mute(bool state)
125
Start_audio_output(AUTO_DMA,
126
(void (*)(unsigned char*, short unsigned int))Tia_process);