xref: /haiku/src/apps/mediaplayer/media_node_framework/audio/AudioVolumeConverter.h (revision fce4895d1884da5ae6fb299d23c735c598e690b1)
1 /*
2  * Copyright 2008 Stephan Aßmus <superstippi@gmx.de>
3  * All rights reserved. Distributed under the terms of the MIT licensce.
4  */
5 #ifndef AUDIO_VOLUME_CONVERTER_H
6 #define AUDIO_VOLUME_CONVERTER_H
7 
8 
9 /*! This AudioReader just filters the volume. It depends on floating point
10  *	audio format.
11 */
12 
13 
14 #include "AudioReader.h"
15 
16 
17 class AudioVolumeConverter : public AudioReader {
18 public:
19 								AudioVolumeConverter(AudioReader* source,
20 									float volume = 1.0);
21 	virtual						~AudioVolumeConverter();
22 
23 	virtual bigtime_t			InitialLatency() const;
24 	virtual	status_t			Read(void* buffer, int64 pos, int64 frames);
25 
26 	virtual	status_t			InitCheck() const;
27 
28 			AudioReader*		Source() const;
29 
30 			void				SetVolume(float volume);
31 			float				Volume() const;
32 
33 protected:
34 			AudioReader*		fSource;
35 			float				fVolume;
36 			float				fPreviousVolume;
37 };
38 
39 #endif	// AUDIO_VOLUME_CONVERTER_H
40