]>
git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia2/lib/sndpcm.cpp
1 // --------------------------------------------------------------------------
5 // Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
7 // --------------------------------------------------------------------------
9 #pragma implementation "sndpcm.cpp"
12 #include <wx/wxprec.h>
16 wxSoundFormatPcm::wxSoundFormatPcm(wxUint32 srate
, wxUint8 bps
,
17 wxUint16 nchannels
, bool sign
,
19 : m_srate(srate
), m_bps(bps
), m_nchan(nchannels
), m_order(order
),
24 wxSoundFormatPcm::~wxSoundFormatPcm()
28 void wxSoundFormatPcm::SetSampleRate(wxUint32 srate
)
33 void wxSoundFormatPcm::SetBPS(wxUint8 bps
)
38 void wxSoundFormatPcm::SetChannels(wxUint16 nchannels
)
43 void wxSoundFormatPcm::SetOrder(int order
)
48 void wxSoundFormatPcm::Signed(bool sign
)
53 wxSoundFormatBase
*wxSoundFormatPcm::Clone() const
55 wxSoundFormatPcm
*new_pcm
;
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
;
67 wxUint32
wxSoundFormatPcm::GetTimeFromBytes(wxUint32 bytes
) const
69 return (bytes
/ (m_srate
* (m_bps
/ 8) * m_nchan
));
72 wxUint32
wxSoundFormatPcm::GetBytesFromTime(wxUint32 time
) const
74 return (time
* (m_srate
* (m_bps
/ 8) * m_nchan
));
77 bool wxSoundFormatPcm::operator!=(const wxSoundFormatBase
& format
) const
79 wxSoundFormatPcm
*format2
= (wxSoundFormatPcm
*)&format
;
81 if (format
.GetType() != wxSOUND_PCM
)
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
) );