📄 zp_dspdoc.cpp
字号:
// ZP_DspDoc.cpp : implementation of the C_ZP_DspDoc class
//
#include "stdafx.h"
#include "ZP_Dsp.h"
#include "ZP_DspDoc.h"
#include "ZP_Decim.h"
///自动读取文件,批处理
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#define _WIN32_WINNT 0x0501
///自动读取文件,批处理
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// C_ZP_DspDoc
IMPLEMENT_DYNCREATE(C_ZP_DspDoc, CDocument)
BEGIN_MESSAGE_MAP(C_ZP_DspDoc, CDocument)
//{{AFX_MSG_MAP(C_ZP_DspDoc)
ON_COMMAND(ID_ZP_Decim, OnZPDecim)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
ON_COMMAND(ID_ZP_Decim1, OnZPDecim1)
ON_COMMAND(ID_ZP_Decim2, OnZPDecim2)
ON_COMMAND(ID_fix_head, Onfixhead)
ON_COMMAND(ID_2to1_8_7, On2to187)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// C_ZP_DspDoc construction/destruction
C_ZP_DspDoc::C_ZP_DspDoc()
{
// TODO: add one-time construction code here
}
C_ZP_DspDoc::~C_ZP_DspDoc()
{
}
BOOL C_ZP_DspDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// C_ZP_DspDoc serialization
void C_ZP_DspDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// C_ZP_DspDoc diagnostics
#ifdef _DEBUG
void C_ZP_DspDoc::AssertValid() const
{
CDocument::AssertValid();
}
void C_ZP_DspDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// C_ZP_DspDoc commands
void C_ZP_DspDoc::OnZPDecim()
{
// TODO: Add your command handler code here
TRACE("begin\n");
CZP_Decim A;
CreateDirectory("48kTo8k",NULL);//新建文件夹
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char DirSpec[MAX_PATH] = "*.wav"; // directory specification
char * file_seq[2048];
int i=0,file_num;
DWORD dwError;
hFind = FindFirstFile(DirSpec, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
TRACE("Invalid file handle. Error is %u\n", GetLastError());
}
else
{
printf ("First file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char*)malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
while (FindNextFile(hFind, &FindFileData) != 0)
{
TRACE("Next file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char* )malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
}
dwError = GetLastError();
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES)
{
TRACE("FindNextFile error. Error is %u\n", dwError);
}
}
TRACE("end\n");
file_num = i;
for(i=0;i<file_num;i++)
{ A.CZP_Decim_6_File(file_seq[i]);
free(file_seq[i]);
}
}
void C_ZP_DspDoc::OnFileOpen()
{
// TODO: Add your command handler code here
}
void C_ZP_DspDoc::OnZPDecim1()
{
// TODO: Add your command handler code here
TRACE("begin\n");
CZP_Decim B;
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char DirSpec[MAX_PATH] = "*.wav"; // directory specification
char * file_seq[2048];
int i=0,file_num;
DWORD dwError;
CreateDirectory("8kTo1k",NULL);//新建文件夹
hFind = FindFirstFile(DirSpec, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
TRACE("Invalid file handle. Error is %u\n", GetLastError());
}
else
{
printf ("First file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char*)malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
while (FindNextFile(hFind, &FindFileData) != 0)
{
TRACE("Next file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char* )malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
}
dwError = GetLastError();
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES)
{
TRACE("FindNextFile error. Error is %u\n", dwError);
}
}
TRACE("end\n");
file_num = i;
for(i=0;i<file_num;i++)
{ B.CZP_Decim_8_File(file_seq[i]);
free(file_seq[i]);
}
}
void C_ZP_DspDoc::OnZPDecim2()
{
// TODO: Add your command handler code here
TRACE("begin\n");
CZP_Decim C;
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char DirSpec[MAX_PATH] = "*.wav"; // directory specification
char * file_seq[2048];
int i=0,file_num;
DWORD dwError;
CreateDirectory("24kTo8k",NULL);//新建文件夹
hFind = FindFirstFile(DirSpec, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
TRACE("Invalid file handle. Error is %u\n", GetLastError());
}
else
{
printf ("First file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char*)malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
while (FindNextFile(hFind, &FindFileData) != 0)
{
TRACE("Next file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char* )malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
}
dwError = GetLastError();
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES)
{
TRACE("FindNextFile error. Error is %u\n", dwError);
}
}
TRACE("end\n");
file_num = i;
for(i=0;i<file_num;i++)
{ C.CZP_Decim_3_File(file_seq[i]);
free(file_seq[i]);
}
}
void C_ZP_DspDoc::Onfixhead()
{
// TODO: Add your command handler code here
CZP_Decim D;
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char DirSpec[MAX_PATH] = "*.wav"; // directory specification
char * file_seq[2048];
int i=0,file_num;
DWORD dwError;
CreateDirectory("fix",NULL);//新建文件夹
hFind = FindFirstFile(DirSpec, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
TRACE("Invalid file handle. Error is %u\n", GetLastError());
}
else
{
printf ("First file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char*)malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
while (FindNextFile(hFind, &FindFileData) != 0)
{
TRACE("Next file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char* )malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
}
dwError = GetLastError();
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES)
{
TRACE("FindNextFile error. Error is %u\n", dwError);
}
}
TRACE("end\n");
file_num = i;
for(i=0;i<file_num;i++)
{ D.Cfix_head(file_seq[i]);
free(file_seq[i]);
}
}
void C_ZP_DspDoc::On2to187()
{
// TODO: Add your command handler code here
CZP_Decim E;
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char DirSpec[MAX_PATH] = "*.wav"; // directory specification
char * file_seq[2048];
int i=0,file_num;
DWORD dwError;
CreateDirectory("fix",NULL);//新建文件夹
hFind = FindFirstFile(DirSpec, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
TRACE("Invalid file handle. Error is %u\n", GetLastError());
}
else
{
printf ("First file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char*)malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
while (FindNextFile(hFind, &FindFileData) != 0)
{
TRACE("Next file name is %s\n", FindFileData.cFileName);
{
file_seq[i] = (char* )malloc (_MAX_PATH);
strcpy(file_seq[i],FindFileData.cFileName);i++;
}
}
dwError = GetLastError();
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES)
{
TRACE("FindNextFile error. Error is %u\n", dwError);
}
}
TRACE("end\n");
file_num = i;
for(i=0;i<file_num;)
{ E.C2to187(file_seq[i]);
free(file_seq[i++]);
free(file_seq[i++]);
free(file_seq[i++]);free(file_seq[i++]);
free(file_seq[i++]);free(file_seq[i++]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -