00001 #ifndef OUTPUT_NULL_HPP 00002 #define OUTPUT_NULL_HPP 00003 00004 00005 #include <set> 00006 #include "config.h" 00007 #include "output.hpp" 00008 00009 00010 class NullOutputStream; 00011 00012 00013 class NullOutputContext : public IOutputContext 00014 { 00015 public: 00016 NullOutputContext(); 00017 ~NullOutputContext(); 00018 00019 bool Initialize(const char* parameters); 00020 void Update(); 00021 IOutputStream* OpenStream(ISampleSource* source); 00022 00023 private: 00024 void RemoveStream(NullOutputStream* stream); 00025 00026 typedef std::set<NullOutputStream*> StreamList; 00027 StreamList m_streams; 00028 00029 friend class NullOutputStream; 00030 }; 00031 00032 00033 class NullOutputStream : public IOutputStream 00034 { 00035 private: 00036 NullOutputStream(NullOutputContext* context, ISampleSource* source); 00037 ~NullOutputStream(); 00038 00039 public: 00040 void Play(); 00041 void Stop(); 00042 void Reset(); 00043 bool IsPlaying(); 00044 void SetVolume(int volume); 00045 int GetVolume(); 00046 00047 private: 00048 void ResetTimer(); 00049 void Update(); 00050 int DummyRead(int samples_to_read); 00051 00052 NullOutputContext* m_context; 00053 00054 ISampleSource* m_source; 00055 int m_channel_count; // 00056 int m_sample_rate; // cached stream format 00057 int m_bits_per_sample; // 00058 00059 bool m_is_playing; 00060 int m_volume; 00061 00062 adr_u64 m_last_update; 00063 00064 friend class NullOutputContext; 00065 }; 00066 00067 00068 #endif