ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/SID_Be.h
(Generate patch)

Comparing Frodo4/Src/SID_Be.h (file contents):
Revision 1.3 by cebix, 2003-07-09T13:54:22Z vs.
Revision 1.5 by cebix, 2004-01-12T15:13:20Z

# Line 1 | Line 1
1   /*
2   *  SID_Be.h - 6581 emulation, Be specific stuff
3   *
4 < *  Frodo (C) 1994-1997,2002-2003 Christian Bauer
4 > *  Frodo (C) 1994-1997,2002-2004 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
# Line 18 | Line 18
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   */
20  
21 #include <MediaKit.h>
22
21   #include "C64.h"
22  
23  
# Line 27 | Line 25
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 <        in_stream = false;
37 <
38 <        the_stream = new BDACStream();
39 <        the_sub = new BSubscriber("Frodo SID emulation");
40 <        ready = the_sub->Subscribe(the_stream) == B_NO_ERROR;
37 <        if (ready) {
38 <                the_stream->SetSamplingRate(SAMPLE_FREQ);
39 <                the_sub->EnterStream(NULL, true, this, stream_func, NULL, true);
40 <                the_stream->SetStreamBuffers(SAMPLE_FREQ / CALC_FREQ * 4, 4);   // Must be called after EnterStream()
41 <                in_stream = true;
42 <        }
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  
# Line 49 | Line 47 | void DigitalRenderer::init_sound(void)
47  
48   DigitalRenderer::~DigitalRenderer()
49   {
50 <        if (ready) {
51 <                if (in_stream) {
52 <                        the_sub->ExitStream(true);
55 <                        in_stream = false;
56 <                }
57 <                the_stream->SetStreamBuffers(4096, 8);
58 <                the_sub->Unsubscribe();
59 <                ready = false;
50 >        if (the_player) {
51 >                the_player->Stop();
52 >                delete the_player;
53          }
61        delete the_sub;
62        delete the_stream;
54   }
55  
56  
# Line 80 | Line 71 | void DigitalRenderer::EmulateLine(void)
71  
72   void DigitalRenderer::Pause(void)
73   {
74 <        if (in_stream) {
75 <                the_sub->ExitStream(true);
76 <                in_stream = false;
74 >        if (!player_stopped) {
75 >                the_player->Stop();
76 >                player_stopped = true;
77          }
78   }
79  
# Line 93 | Line 84 | void DigitalRenderer::Pause(void)
84  
85   void DigitalRenderer::Resume(void)
86   {
87 <        if (!in_stream) {
88 <                the_sub->EnterStream(NULL, true, this, stream_func, NULL, true);
89 <                in_stream = true;
87 >        if (player_stopped) {
88 >                the_player->Start();
89 >                player_stopped = false;
90          }
91   }
92  
# Line 104 | Line 95 | void DigitalRenderer::Resume(void)
95   *  Stream function
96   */
97  
98 < bool DigitalRenderer::stream_func(void *arg, char *buf, size_t count, void *header)
98 > void DigitalRenderer::buffer_proc(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format)
99   {
100 <        ((DigitalRenderer *)arg)->calc_buffer((int16 *)buf, count);
101 <        ((DigitalRenderer *)arg)->the_c64->SoundSync();
111 <        return true;
100 >        ((DigitalRenderer *)cookie)->calc_buffer((int16 *)buffer, size);
101 >        ((DigitalRenderer *)cookie)->the_c64->SoundSync();
102   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines