1
// --------------------------------------------------------------------------
5
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
6
// CVSID: $Id: sndpcm.cpp,v 1.4 2004/11/22 20:10:25 JS Exp $
8
// --------------------------------------------------------------------------
10
#pragma implementation "sndpcm.cpp"
13
#include "wx/wxprec.h"
23
#include "wx/mmedia/sndbase.h"
24
#include "wx/mmedia/sndpcm.h"
26
wxSoundFormatPcm::wxSoundFormatPcm(wxUint32 srate, wxUint8 bps,
27
wxUint16 nchannels, bool sign,
29
: m_srate(srate), m_bps(bps), m_nchan(nchannels), m_order(order),
34
wxSoundFormatPcm::~wxSoundFormatPcm()
38
void wxSoundFormatPcm::SetSampleRate(wxUint32 srate)
43
void wxSoundFormatPcm::SetBPS(wxUint8 bps)
48
void wxSoundFormatPcm::SetChannels(wxUint16 nchannels)
53
void wxSoundFormatPcm::SetOrder(int order)
58
void wxSoundFormatPcm::Signed(bool sign)
63
wxSoundFormatBase *wxSoundFormatPcm::Clone() const
65
wxSoundFormatPcm *new_pcm;
67
new_pcm = new wxSoundFormatPcm();
68
new_pcm->m_srate = m_srate;
69
new_pcm->m_bps = m_bps;
70
new_pcm->m_nchan = m_nchan;
71
new_pcm->m_order = m_order;
72
new_pcm->m_signed= m_signed;
77
wxUint32 wxSoundFormatPcm::GetTimeFromBytes(wxUint32 bytes) const
79
return (bytes / (m_srate * (m_bps / 8) * m_nchan));
82
wxUint32 wxSoundFormatPcm::GetBytesFromTime(wxUint32 time) const
84
return (time * (m_srate * (m_bps / 8) * m_nchan));
87
bool wxSoundFormatPcm::operator!=(const wxSoundFormatBase& format) const
89
wxSoundFormatPcm *format2 = (wxSoundFormatPcm *)&format;
91
if (format.GetType() != wxSOUND_PCM)
94
return ( (m_srate != format2->m_srate) ||
95
(m_bps != format2->m_bps) ||
96
(m_nchan != format2->m_nchan) ||
97
(m_order != format2->m_order) ||
98
(m_signed != format2->m_signed) );