~ubuntu-branches/ubuntu/wily/xmms2/wily

« back to all changes in this revision

Viewing changes to src/plugins/gme/gme/Vgm_Emu_Impl.h

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2008-07-04 16:23:34 UTC
  • mfrom: (1.1.5 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080704162334-b3esbkcapt8wbrk4
Tags: 0.5DrLecter-2ubuntu1
* Merge from debian unstable (LP: #241098), remaining changes:
  + debian/control:
    + Update Maintainer field
    + add lpia to xmms2-plugin-alsa supported architectures
    + Added liba52-0.7.4-dev to build depends
  + debian/rules: Added patch, patch-stamp and unpatch
  + changed 01_gcc4.3.patch:
    + src/include/xmmsclient/xmmsclient++/helpers.h: Added #include <climits>
* New upstream relase fixes LP: #212566, #222341

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Low-level parts of Vgm_Emu
 
2
 
 
3
// Game_Music_Emu 0.5.2
 
4
#ifndef VGM_EMU_IMPL_H
 
5
#define VGM_EMU_IMPL_H
 
6
 
 
7
#include "Dual_Resampler.h"
 
8
#include "Classic_Emu.h"
 
9
#include "Ym2413_Emu.h"
 
10
#include "Ym2612_Emu.h"
 
11
#include "Sms_Apu.h"
 
12
 
 
13
template<class Emu>
 
14
class Ym_Emu : public Emu {
 
15
protected:
 
16
        int last_time;
 
17
        short* out;
 
18
        enum { disabled_time = -1 };
 
19
public:
 
20
        Ym_Emu()                        : last_time( disabled_time ), out( NULL ) { }
 
21
        void enable( bool b )           { last_time = b ? 0 : disabled_time; }
 
22
        bool enabled() const            { return last_time != disabled_time; }
 
23
        void begin_frame( short* p );
 
24
        int run_until( int time );
 
25
};
 
26
 
 
27
class Vgm_Emu_Impl : public Classic_Emu, private Dual_Resampler {
 
28
public:
 
29
        typedef Classic_Emu::sample_t sample_t;
 
30
protected:
 
31
        enum { stereo = 2 };
 
32
        
 
33
        typedef int vgm_time_t;
 
34
        
 
35
        enum { fm_time_bits = 12 };
 
36
        typedef int fm_time_t;
 
37
        long fm_time_offset;
 
38
        int fm_time_factor;
 
39
        fm_time_t to_fm_time( vgm_time_t ) const;
 
40
        
 
41
        enum { blip_time_bits = 12 };
 
42
        int blip_time_factor;
 
43
        blip_time_t to_blip_time( vgm_time_t ) const;
 
44
        
 
45
        byte const* data;
 
46
        byte const* loop_begin;
 
47
        byte const* data_end;
 
48
        void update_fm_rates( long* ym2413_rate, long* ym2612_rate ) const;
 
49
        
 
50
        vgm_time_t vgm_time;
 
51
        byte const* pos;
 
52
        blip_time_t run_commands( vgm_time_t );
 
53
        int play_frame( blip_time_t blip_time, int sample_count, sample_t* buf );
 
54
        
 
55
        byte const* pcm_data;
 
56
        byte const* pcm_pos;
 
57
        int dac_amp;
 
58
        int dac_disabled; // -1 if disabled
 
59
        void write_pcm( vgm_time_t, int amp );
 
60
        
 
61
        Ym_Emu<Ym2612_Emu> ym2612;
 
62
        Ym_Emu<Ym2413_Emu> ym2413;
 
63
        
 
64
        Blip_Buffer blip_buf;
 
65
        Sms_Apu psg;
 
66
        Blip_Synth<blip_med_quality,1> dac_synth;
 
67
        
 
68
        friend class Vgm_Emu;
 
69
};
 
70
 
 
71
#endif