Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SOUND_HANDLER_MKIT_H
00021 #define SOUND_HANDLER_MKIT_H
00022
00023 #include "sound_handler.h"
00024
00025 #include <set>
00026 #include <boost/thread/mutex.hpp>
00027 #include <boost/scoped_ptr.hpp>
00028
00029 #include <SoundPlayer.h>
00030
00031
00032 namespace gnash {
00033 class SimpleBuffer;
00034 namespace sound {
00035 class EmbedSound;
00036 class InputStream;
00037 }
00038 }
00039
00040 namespace gnash {
00041 namespace sound {
00042
00044 class Mkit_sound_handler : public sound_handler
00045 {
00046 boost::scoped_ptr<BSoundPlayer> _soundplayer;
00047
00049 static void FillNextBuffer(void *cookie, void *buffer, size_t size,
00050 const media_raw_audio_format &format);
00051
00053 void openAudio();
00054
00055 bool _audioopen;
00056
00058 boost::mutex _mutex;
00059
00061 mutable boost::mutex _mutedMutex;
00062
00063
00064 void mix(boost::int16_t* outSamples, boost::int16_t* inSamples,
00065 unsigned int nSamples, float volume);
00066
00067 void MixAudio (boost::uint8_t *dst, const boost::uint8_t *src, boost::uint32_t len, int volume);
00068
00069 public:
00070 Mkit_sound_handler(media::MediaHandler* m);
00071
00072 ~Mkit_sound_handler();
00073
00074
00075 virtual int create_sound(std::auto_ptr<SimpleBuffer> data, std::auto_ptr<media::SoundInfo> sinfo);
00076
00077
00078
00079 virtual StreamBlockId addSoundBlock(unsigned char* data,
00080 unsigned int data_bytes,
00081 unsigned int sample_count,
00082 int streamId);
00083
00084
00085 virtual void stop_sound(int sound_handle);
00086
00087
00088 virtual void delete_sound(int sound_handle);
00089
00090
00091 virtual void reset();
00092
00093
00094 virtual void stop_all_sounds();
00095
00096
00097 virtual int get_volume(int sound_handle);
00098
00099
00100 virtual void set_volume(int sound_handle, int volume);
00101
00102
00103 virtual media::SoundInfo* get_sound_info(int soundHandle);
00104
00105
00106
00107 virtual void mute();
00108
00109
00110
00111 virtual void unmute();
00112
00113
00114
00115 virtual bool is_muted() const;
00116
00117
00118
00119 virtual void pause();
00120
00121
00122
00123 virtual void unpause();
00124
00125
00126 virtual unsigned int get_duration(int sound_handle);
00127
00128
00129 virtual unsigned int tell(int sound_handle);
00130
00131
00132
00133 void plugInputStream(std::auto_ptr<InputStream> in);
00134
00135
00136 void fetchSamples(boost::int16_t* to, unsigned int nSamples);
00137 };
00138
00139 }
00140 }
00141
00142 #endif // SOUND_HANDLER_MKIT_H