home *** CD-ROM | disk | FTP | other *** search
- // seekivw.cpp : implementation of the CSeekitView class
- //
-
- #include "stdafx.h"
- #include "seekit.h"
-
- #include "seekidoc.h"
- #include "seekivw.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CSeekitView
-
- IMPLEMENT_DYNCREATE(CSeekitView, CView)
-
- BEGIN_MESSAGE_MAP(CSeekitView, CView)
- //{{AFX_MSG_MAP(CSeekitView)
- ON_COMMAND(ID_FILE_SAMPLINGRATE, OnFileSamplingrate)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CSeekitView construction/destruction
-
- CSeekitView::CSeekitView()
- {
- // TODO: add construction code here
- }
-
- CSeekitView::~CSeekitView()
- {
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CSeekitView drawing
-
- void CSeekitView::OnDraw(CDC* pDC)
- {
- CSeekitDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CSeekitView diagnostics
-
- #ifdef _DEBUG
- void CSeekitView::AssertValid() const
- {
- CView::AssertValid();
- }
-
- void CSeekitView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
-
- CSeekitDoc* CSeekitView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSeekitDoc)));
- return (CSeekitDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CSeekitView message handlers
-
- void CSeekitView::OnFileSamplingrate()
- {
- // TODO: Add your command handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- char BytesRead[2];
-
- unsigned int *ptrMyInteger;
- unsigned int MyInteger;
- char sSamplingRate[10];
- CString Message;
-
- // Create an object (for reading the .WAV file)
- CFile theWAVfile ("C:\\Windows\\DING.WAV",
- CFile::modeRead ) ;
-
- // Seek to byte number 24 (base 0)
- theWAVfile.Seek ( 24, CFile::begin );
-
- // Read 2 bytes from the .WAV file
- theWAVfile.Read ( BytesRead, 2 );
-
-
- ptrMyInteger = (unsigned int *)&BytesRead[0];
-
- MyInteger = *ptrMyInteger;
-
- // Display the sampling rate
- itoa ( MyInteger, sSamplingRate, 10 );
- Message =
- (CString)"The sampling rate of DING.WAV is: " +
- sSamplingRate ;
-
- MessageBox (Message);
-
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
- }
-