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

Comparing Frodo4/Src/SID.cpp (file contents):
Revision 1.2 by cebix, 2003-07-01T17:51:17Z vs.
Revision 1.4 by cebix, 2003-07-09T17:01:12Z

# Line 23 | Line 23
23   * ------------------
24   *
25   *  - Lots of empirically determined constants in the filter calculations
26 *  - Voice 3 cannot be muted
26   */
27  
28   #include "sysdeps.h"
# Line 33 | Line 32
32   #include "Prefs.h"
33  
34   #ifdef __BEOS__
35 < #include <MediaKit.h>
35 > #include <media/SoundPlayer.h>
36   #endif
37  
38   #ifdef AMIGA
# Line 349 | Line 348 | struct DRVoice {
348                                          // The following bit is set for the modulating
349                                          // voice, not for the modulated one (as the SID bits)
350          bool sync;              // Sync modulation bit
351 +        bool mute;              // Voice muted (voice 3 only)
352   };
353  
354   // Renderer class
# Line 379 | Line 379 | private:
379  
380          bool ready;                                             // Flag: Renderer has initialized and is ready
381          uint8 volume;                                   // Master volume
382        bool v3_mute;                                   // Voice 3 muted
382  
383          static uint16 TriTable[0x1000*2];       // Tables for certain waveforms
384          static const uint16 TriSawTable[0x100];
# Line 418 | Line 417 | private:
417          int sample_in_ptr;                              // Index in sample_buf for writing
418  
419   #ifdef __BEOS__
420 <        static bool stream_func(void *arg, char *buf, size_t count, void *header);
420 >        static void buffer_proc(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format);
421          C64 *the_c64;                                   // Pointer to C64 object
422 <        BDACStream *the_stream;                 // Pointer to stream
423 <        BSubscriber *the_sub;                   // Pointer to subscriber
425 <        bool in_stream;                                 // Flag: Subscriber has entered stream
422 >        BSoundPlayer *the_player;               // Pointer to sound player
423 >        bool player_stopped;                    // Flag: player stopped
424   #endif
425  
426   #ifdef AMIGA
# Line 451 | Line 449 | private:
449          int fd;
450          audio_info status;
451          uint_t sent_samples,delta_samples;
452 <        WORD *sound_calc_buf;
452 >        int16 *sound_calc_buf;
453   #endif
454  
455   #ifdef __hpux
456          int fd;
457          audio_status status;
458 <        int16 * sound_calc_buf;
458 >        int16 *sound_calc_buf;
459          int linecnt;
460   #endif
461  
# Line 877 | Line 875 | DigitalRenderer::DigitalRenderer()
875   void DigitalRenderer::Reset(void)
876   {
877          volume = 0;
880        v3_mute = false;
878  
879          for (int v=0; v<3; v++) {
880                  voice[v].wave = WAVE_NONE;
# Line 887 | Line 884 | void DigitalRenderer::Reset(void)
884                  voice[v].eg_level = voice[v].s_level = 0;
885                  voice[v].a_add = voice[v].d_sub = voice[v].r_sub = EGTable[0];
886                  voice[v].gate = voice[v].ring = voice[v].test = false;
887 <                voice[v].filter = voice[v].sync = false;
887 >                voice[v].filter = voice[v].sync = voice[v].mute = false;
888          }
889  
890          f_type = FILT_NONE;
# Line 966 | Line 963 | void DigitalRenderer::WriteRegister(uint
963                          voice[v].gate = byte & 1;
964                          voice[v].mod_by->sync = byte & 2;
965                          voice[v].ring = byte & 4;
966 <                        if ((voice[v].test = byte & 8))
966 >                        if ((voice[v].test = byte & 8) != 0)
967                                  voice[v].count = 0;
968                          break;
969  
# Line 1005 | Line 1002 | void DigitalRenderer::WriteRegister(uint
1002  
1003                  case 24:
1004                          volume = byte & 0xf;
1005 <                        v3_mute = byte & 0x80;
1005 >                        voice[2].mute = byte & 0x80;
1006                          if (((byte >> 4) & 7) != f_type) {
1007                                  f_type = (byte >> 4) & 7;
1008   #ifdef USE_FIXPOINT_MATHS
# Line 1201 | Line 1198 | void DigitalRenderer::calc_buffer(int16
1198   #ifdef __riscos__       // on RISC OS we have 8 bit logarithmic sound
1199          DigitalRenderer_GetTables(&LinToLog, &LogScale);        // get translation tables
1200   #else
1204 #ifdef __BEOS__
1205        count >>= 2;    // 16 bit stereo output, count is in bytes
1206 #else
1201          count >>= 1;    // 16 bit mono output, count is in bytes
1202   #endif
1209 #endif
1203          while (count--) {
1204                  int32 sum_output;
1205                  int32 sum_output_filter = 0;
# Line 1255 | Line 1248 | void DigitalRenderer::calc_buffer(int16
1248                          envelope = (v->eg_level * master_volume) >> 20;
1249  
1250                          // Waveform generator
1251 +                        if (v->mute)
1252 +                                continue;
1253                          uint16 output;
1254  
1255                          if (!v->test)
# Line 1335 | Line 1330 | void DigitalRenderer::calc_buffer(int16
1330                  }
1331  
1332                  // Write to buffer
1333 < #ifdef __BEOS__
1339 <                int16 audio_data = (sum_output + sum_output_filter) >> 10;
1340 <                int val = *buf + audio_data;
1341 <                if (val > 32767)
1342 <                        val = 32767;
1343 <                if (val < -32768)
1344 <                        val = -32768;
1345 <                *buf++ = val;
1346 <                val = *buf + audio_data;
1347 <                if (val > 32767)
1348 <                        val = 32767;
1349 <                if (val < -32768)
1350 <                        val = -32768;
1351 <                *buf++ = val;
1352 < #elif defined(__riscos__)       // lookup in 8k (13bit) translation table
1333 > #if defined(__riscos__) // lookup in 8k (13bit) translation table
1334                  *buf++ = LinToLog[((sum_output + sum_output_filter) >> 13) & 0x1fff];
1335   #else
1336                  *buf++ = (sum_output + sum_output_filter) >> 10;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines