ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/SID_Be.h
Revision: 1.6
Committed: 2005-06-27T19:55:48Z (17 years, 5 months ago) by cebix
Content type: text/plain
Branch: MAIN
CVS Tags: VERSION_4_2, HEAD
Changes since 1.5: +1 -1 lines
Log Message:
updated copyright dates

File Contents

# Content
1 /*
2 * SID_Be.h - 6581 emulation, Be specific stuff
3 *
4 * Frodo (C) 1994-1997,2002-2005 Christian Bauer
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include "C64.h"
22
23
24 /*
25 * Initialization, open subscriber
26 */
27
28 #if B_HOST_IS_LENDIAN
29 const media_raw_audio_format audio_format = {SAMPLE_FREQ, 1, media_raw_audio_format::B_AUDIO_SHORT, B_MEDIA_LITTLE_ENDIAN, SAMPLE_FREQ / CALC_FREQ * 2};
30 #else
31 const media_raw_audio_format audio_format = {SAMPLE_FREQ, 1, media_raw_audio_format::B_AUDIO_SHORT, B_MEDIA_BIG_ENDIAN, SAMPLE_FREQ / CALC_FREQ * 2};
32 #endif
33
34 void DigitalRenderer::init_sound(void)
35 {
36 the_player = new BSoundPlayer(&audio_format, "Frodo", buffer_proc, NULL, this);
37 the_player->SetHasData(true);
38 the_player->Start();
39 player_stopped = false;
40 ready = true;
41 }
42
43
44 /*
45 * Destructor, close subscriber
46 */
47
48 DigitalRenderer::~DigitalRenderer()
49 {
50 if (the_player) {
51 the_player->Stop();
52 delete the_player;
53 }
54 }
55
56
57 /*
58 * Sample volume (for sampled voice)
59 */
60
61 void DigitalRenderer::EmulateLine(void)
62 {
63 sample_buf[sample_in_ptr] = volume;
64 sample_in_ptr = (sample_in_ptr + 1) % SAMPLE_BUF_SIZE;
65 }
66
67
68 /*
69 * Pause sound output
70 */
71
72 void DigitalRenderer::Pause(void)
73 {
74 if (!player_stopped) {
75 the_player->Stop();
76 player_stopped = true;
77 }
78 }
79
80
81 /*
82 * Resume sound output
83 */
84
85 void DigitalRenderer::Resume(void)
86 {
87 if (player_stopped) {
88 the_player->Start();
89 player_stopped = false;
90 }
91 }
92
93
94 /*
95 * Stream function
96 */
97
98 void DigitalRenderer::buffer_proc(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format)
99 {
100 ((DigitalRenderer *)cookie)->calc_buffer((int16 *)buffer, size);
101 ((DigitalRenderer *)cookie)->the_c64->SoundSync();
102 }