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