]> git.saurik.com Git - wxWidgets.git/blame - utils/wxMMedia2/lib/sndpcm.cpp
Added ogl to the module list
[wxWidgets.git] / utils / wxMMedia2 / lib / sndpcm.cpp
CommitLineData
526ddb13
GL
1// --------------------------------------------------------------------------
2// Name: sndpcm.cpp
3// Purpose:
4// Date: 08/11/1999
5// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
6// CVSID: $Id$
7// --------------------------------------------------------------------------
8#ifdef __GNUG__
9#pragma implementation "sndpcm.cpp"
10#endif
11
6c5e6376 12#include <wx/wxprec.h>
526ddb13
GL
13#include "sndbase.h"
14#include "sndpcm.h"
15
526ddb13
GL
16wxSoundFormatPcm::wxSoundFormatPcm(wxUint32 srate, wxUint8 bps,
17 wxUint16 nchannels, bool sign,
18 int order)
19 : m_srate(srate), m_bps(bps), m_nchan(nchannels), m_order(order),
20 m_signed(sign)
21{
22}
23
24wxSoundFormatPcm::~wxSoundFormatPcm()
25{
26}
27
28void wxSoundFormatPcm::SetSampleRate(wxUint32 srate)
29{
30 m_srate = srate;
31}
32
33void wxSoundFormatPcm::SetBPS(wxUint8 bps)
34{
35 m_bps = bps;
36}
37
38void wxSoundFormatPcm::SetChannels(wxUint16 nchannels)
39{
40 m_nchan = nchannels;
41}
42
43void wxSoundFormatPcm::SetOrder(int order)
44{
45 m_order = order;
46}
47
48void wxSoundFormatPcm::Signed(bool sign)
49{
50 m_signed = sign;
51}
52
53wxSoundFormatBase *wxSoundFormatPcm::Clone() const
54{
55 wxSoundFormatPcm *new_pcm;
56
57 new_pcm = new wxSoundFormatPcm();
58 new_pcm->m_srate = m_srate;
59 new_pcm->m_bps = m_bps;
60 new_pcm->m_nchan = m_nchan;
61 new_pcm->m_order = m_order;
62 new_pcm->m_signed= m_signed;
63
64 return new_pcm;
65}
66
622e48cb 67wxUint32 wxSoundFormatPcm::GetTimeFromBytes(wxUint32 bytes) const
526ddb13
GL
68{
69 return (bytes / (m_srate * (m_bps / 8) * m_nchan));
70}
71
622e48cb 72wxUint32 wxSoundFormatPcm::GetBytesFromTime(wxUint32 time) const
526ddb13
GL
73{
74 return (time * (m_srate * (m_bps / 8) * m_nchan));
75}
76
77bool wxSoundFormatPcm::operator!=(const wxSoundFormatBase& format) const
78{
79 wxSoundFormatPcm *format2 = (wxSoundFormatPcm *)&format;
80
81 if (format.GetType() != wxSOUND_PCM)
82 return TRUE;
83
84 return ( (m_srate != format2->m_srate) ||
85 (m_bps != format2->m_bps) ||
86 (m_nchan != format2->m_nchan) ||
87 (m_order != format2->m_order) ||
88 (m_signed != format2->m_signed) );
89}