]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/mmedia/sndpcm.cpp
1 // --------------------------------------------------------------------------
5 // Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
8 // --------------------------------------------------------------------------
10 #include "wx/wxprec.h"
20 #include "wx/mmedia/sndbase.h"
21 #include "wx/mmedia/sndpcm.h"
23 wxSoundFormatPcm::wxSoundFormatPcm(wxUint32 srate
, wxUint8 bps
,
24 wxUint16 nchannels
, bool sign
,
26 : m_srate(srate
), m_bps(bps
), m_nchan(nchannels
), m_order(order
),
31 wxSoundFormatPcm::~wxSoundFormatPcm()
35 void wxSoundFormatPcm::SetSampleRate(wxUint32 srate
)
40 void wxSoundFormatPcm::SetBPS(wxUint8 bps
)
45 void wxSoundFormatPcm::SetChannels(wxUint16 nchannels
)
50 void wxSoundFormatPcm::SetOrder(int order
)
55 void wxSoundFormatPcm::Signed(bool sign
)
60 wxSoundFormatBase
*wxSoundFormatPcm::Clone() const
62 wxSoundFormatPcm
*new_pcm
;
64 new_pcm
= new wxSoundFormatPcm();
65 new_pcm
->m_srate
= m_srate
;
66 new_pcm
->m_bps
= m_bps
;
67 new_pcm
->m_nchan
= m_nchan
;
68 new_pcm
->m_order
= m_order
;
69 new_pcm
->m_signed
= m_signed
;
74 wxUint32
wxSoundFormatPcm::GetTimeFromBytes(wxUint32 bytes
) const
76 return (bytes
/ (m_srate
* (m_bps
/ 8) * m_nchan
));
79 wxUint32
wxSoundFormatPcm::GetBytesFromTime(wxUint32 time
) const
81 return (time
* (m_srate
* (m_bps
/ 8) * m_nchan
));
84 bool wxSoundFormatPcm::operator!=(const wxSoundFormatBase
& format
) const
86 wxSoundFormatPcm
*format2
= (wxSoundFormatPcm
*)&format
;
88 if (format
.GetType() != wxSOUND_PCM
)
91 return ( (m_srate
!= format2
->m_srate
) ||
92 (m_bps
!= format2
->m_bps
) ||
93 (m_nchan
!= format2
->m_nchan
) ||
94 (m_order
!= format2
->m_order
) ||
95 (m_signed
!= format2
->m_signed
) );