2 * Copyright 2003-2009 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
12 #ifndef __SGI_STL_INTERNAL_ALGOBASE_H
13 template<class t
> const t
& max(const t
&t1
, const t
&t2
) { return (t1
> t2
) ? t1
: t2
; }
14 template<class t
> const t
& min(const t
&t1
, const t
&t2
) { return (t1
< t2
) ? t1
: t2
; }
16 template<class t
> const t
abs(const t t1
) { return (t1
< 0) ? - t1
: t1
; }
19 void fix_multiaudio_format(media_multi_audio_format
*format
);
21 int count_nonzero_bits(uint32 value
);
23 uint32
GetChannelMask(int channel
, uint32 all_channel_masks
);
24 int GetChannelType(int channel
, uint32 all_channel_masks
);
28 void ZeroFill(float *_dst
, int32 _dst_sample_offset
, int32 _sample_count
);
30 bigtime_t
buffer_duration(const media_multi_audio_format
& format
);
32 int bytes_per_sample(const media_multi_audio_format
& format
);
34 int bytes_per_frame(const media_multi_audio_format
& format
);
35 int frames_per_buffer(const media_multi_audio_format
& format
);
37 int64
frames_for_duration(double framerate
, bigtime_t duration
);
38 bigtime_t
duration_for_frames(double framerate
, int64 frames
);
40 int ChannelMaskToChannelType(uint32 mask
);
41 uint32
ChannelTypeToChannelMask(int type
);
43 double us_to_s(bigtime_t usecs
);
44 bigtime_t
s_to_us(double secs
);
49 const char *StringForFormat(char *buf
, MixerOutput
*output
);
50 const char *StringForFormat(char *buf
, MixerInput
*input
);
51 const char *StringForChannelMask(char *buf
, uint32 mask
);
52 const char *StringForChannelType(char *buf
, int type
);
54 #endif // _MIXER_UTILS_H