社区
C#
帖子详情
DirectSound + Framework
boycxd
2011-01-06 12:59:54
同样的程序使用Framework 4.0调用DirectSound就不行,程序死住了.用3.5可以
是不是direct版本的事呀,我使用的是9,应该使用什么版本?怎么解决?希望给个完整的解决办法.
程序在下:
http://www.codeproject.com/KB/directx/AmbientSounds.aspx
...全文
74
回复
打赏
收藏
DirectSound + Framework
同样的程序使用Framework 4.0调用DirectSound就不行,程序死住了.用3.5可以 是不是direct版本的事呀,我使用的是9,应该使用什么版本?怎么解决?希望给个完整的解决办法. 程序在下: http://www.codeproject.com/KB/directx/AmbientSounds.aspx
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Di
rect
X 11 Tutorials(
di
rect
x11 入门教程)
不错的dx11入门教程 Tutorial 1: Setting up
Di
rect
X 11 with Visual Stu
di
o Tutorial 2: Creating a
Framework
and Window Tutorial 3: Initializing
Di
rect
X 11 Tutorial 4: Buffers, Shaders, and HLSL Tutorial 5: Texturing Tutorial 6:
Di
ffuse Lighting Tutorial 7: 3D Model Rendering Tutorial 8: Loa
di
ng Maya 2011 Models Tutorial 9: Ambient Lighting Tutorial 10: Specular Lighting Tutorial 11: 2D Rendering Tutorial 12: Font Engine Tutorial 13:
Di
rect
Input Tutorial 14:
Di
rect
Sound
Tutorial 15: FPS, CPU Usage, and Timers Tutorial 16: Frustum Culling Tutorial 17: Multitexturing and Texture Arrays Tutorial 18: Light Maps Tutorial 19: Alpha Mapping Tutorial 20: Bump Mapping Tutorial 21: Specular Mapping Tutorial 22: Render to Texture Tutorial 23: Fog Tutorial 24: Clipping Planes Tutorial 25: Texture Translation Tutorial 26: Transparency Tutorial 27: Reflection Tutorial 28: Screen Fades Tutorial 29: Water Tutorial 30: Multiple Point Lights Tutorial 31: 3D
Sound
Tutorial 32: Glass and Ice Tutorial 33: Fire Tutorial 34: Billboar
di
ng Tutorial 35: Depth Buffer Tutorial 36: Blur Tutorial 37: Coming Soon...
Di
rect
X 10 Tutorials: Tutorial 1: Setting up
Di
rect
X 10 with Visual Stu
di
o Tutorial 2: Creating a
Framework
and Window Tutorial 3: Initializing
Di
rect
X 10 Tutorial 4: Buffers, Shaders, and HLSL Tutorial 5: Texturing Tutorial 6:
Di
ffuse Lighting Tutorial 7: 3D Model Rendering Tutorial 8: Loa
di
ng Maya 2011 Models Tutorial 9: Ambient Lighting Tutorial 10: Specular Lighting Tutorial 11: 2D Rendering Tutorial 12: Font Engine Tutorial 13:
Di
rect
Input Tutorial 14:
Di
rect
Sound
Tutorial 15: FPS, CPU Usage, and Timers Tutorial 16: Frustum Culling Tutorial 17: Multitexturing and Texture Arrays Tutorial 18: Light Maps Tutorial 19: Alpha Mapping Tutorial 20: Bump Mapping Tutorial 21: Specular Mapping Tutorial 22: Render to Texture Tutorial 23: Fog Tutorial 24: Clipping Planes Tutorial 25: Texture Translation Tutorial 26: Transparency Tutorial 27: Reflection Tutorial 28: Screen Fades Tutorial 29: Water Tutorial 30: Multiple Point Lights Tutorial 31: 3D
Sound
Tutorial 32: Glass and Ice Tutorial 33: Fire Tutorial 34: Billboar
di
ng Tutorial 35: Depth Buffer Tutorial 36: Blur Tutorial 37: Coming Soon...
Di
rect
X 10 Terrain Tutorials: Tutorial 1: Grid and Camera Movement Tutorial 2: Height Maps Tutorial 3: Terrain Lighting Tutorial 4: Terrain Texturing Tutorial 5: Color Mapped Terrain Tutorial 6: Quad Trees Tutorial 7: Coming Soon... 。。。。。。。。
c# 利用socket和
di
rect
X实现局域网语音通信[初步]
现在时下的VOIP软件很多,比较有名的就是Skype,还有其它诸如UUcall、快门等等。它们提供的功能除了网络上的语音通话外,还可以与固定电话、手机等通话。在本篇中主要介绍利用C#实现语音通信的基本方法。但是目前只实现了网络上语音传输的基本功能,而且比较粗糙,没有采用什么算法来优化,所以大家千万不要期望过高。我写这篇的目的除了记录自己的经历之外,更希望有高手能给出改进的意见或算法。 Vs 2005制作.运行软件需.net
framework
2.0. 其中包括了可执行文件和源代码。 留言请到:http://www.cnblogs.com/stg609/archive/2008/11/19/1334544.html
用DX写的吃豆人
PACMAN吃豆人游戏
运行项目请运行“PacMan.exe”
项目运行环境
Microsoft Windows XP;
.net
Framework
1.0;
Di
rect
9.0c
帧速率50以上
config:配置文件
doc:项目文档
include:项目头文件(.h文件)
src:项目源文件(.cpp文件)
sound
:项目声音资源
texture:项目图片资源
d3dx9_30.dll是为了支持项目运行的dll文件
[原创]FavChat爱聊全能隐蔽穿透型聊天平台完整源码源程序包(Hedda)
特点:- 开源诚交志友、任您扩展- 文本语音让您“爱上”聊- 隐蔽型设计、老板键支持- 无视防火墙局域网关障碍- 线程运用及周全的缓冲架构- XML/XSL呈现技术浏览地址:http://www.favnet.cn/Exhibition.aspx?OriginalKeyword=&OriginalPageIndex=0&OriginalPageSize=7&OriginalId=20080423075449842429■ “FavChat 爱聊”平台分为客户端(Windows Application)和服务端(Web Service)两部分,两者采用当前时尚的HTTP/SOAP协议进行通讯,服务器端采用特殊数据结构作为数据的交换媒介,由客户端收集客户操作请求主动连接服务器发送和接受数据来完成事务流程。由于自身技术和协议的优势,基本上可以无视防火墙和局域网关障碍,唯一前提是您具备一个支持服务器端Web Service运行的空间。■ 考虑FavChat实际工作中的计算机因素和网络延迟,平台充分地利用线程并发运作和多阶段队列缓冲机制,保证事务处理的顺畅和聊天过程中最重要的全双工能力的完美实现。(参考附件流程图)■ 语音部分则使用当前比较流行的
Di
rect
X技术实现。由于该领域网上的资料不多,所以我也是在不断的试验和摸索中找到门路,已封装好的Recorder(录音机)和Player(播放器)类,理应有比较大的参考学习和应用价值。■ 本平台的设计初衷其实是为方便我和妻子日常交流,大型企业里一般都限制即时通讯软件的使用,于是我运用所学开发了具备一定隐蔽性和系统热键功能的私人聊天工具,加上通用型的HTTP协议和XML节点内的密码验证,即使有上网记录也难查出是在干啥米 ^_^ 与爱人聊,会让您越来越“爱聊”哦,客户端通过修改本地配置参数还可以轻易实现个性化的多方畅聊……■ XML也是不得不说的一块,Web Service通讯和本地消息框的呈现,都使用了相关的处理方法。可以说XML是当代程序里不可或缺的一项重要通用技术。FavChat作为开源项目,作者仅在FavNet.cn(附件)和CSDN网站原创发布,其它网站皆为转载,您可以下载源程序参考或进行自由扩展,但请尊重分享,尊重开源,保留作者的版权信息或注明来源。项目使用Visual Stu
di
o 2008基于.NET
Framework
2.0兼容模式开发,您若使用Visual Stu
di
o 2005打开,在编译时会出现错误(少量无法识别的C#3.0语法),您可能有必要修改少量非核心代码即可解决。另外,您还需要安装微软
Di
rect
X End-User Runtimes(March 2008)以获得对Microsoft.
Di
rect
X和Microsoft.
Di
rect
X.
Di
rect
Sound
命名空间的支持。如果您是志同道合的朋友,可以给我来信(HeddaZ@live.com)交流,亦很乐意提供底层的Source互相学习探讨。本程序不尽完善,还请各位同僚前辈指教……谢谢!程序采用WinRAR压缩打包-----------FavNet.cn 专勤致精想您所思 专业IT技术服务http://www.FavNet.cn展示技术实力,寻求合作伙伴、合作项目中…… --------------------------------------------- Powered by FavNet.cn 专业IT技术服务 [Plusii 您的企业附加值]旗下品牌
简易的播放器
基于
Di
rect
Sound
的简易播放器 #include "stdafx.h" #include "test.h" #include "testDlg.h" #include "process.h" #ifdef _DEBUG #define new DEBUG_NEW #en
di
f // CAboutDlg
di
alog used for App About class CAboutDlg : public C
Di
alog { public: CAboutDlg(); //
Di
alog Data enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : C
Di
alog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { C
Di
alog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, C
Di
alog) END_MESSAGE_MAP() // CtestDlg
di
alog CtestDlg::CtestDlg(CWnd* pParent /*=NULL*/) : C
Di
alog(CtestDlg::IDD, pParent) { m_hIcon = AfxGetApp()->Loa
dI
con(IDR_MAINFRAME); } void CtestDlg::DoDataExchange(CDataExchange* pDX) { C
Di
alog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CtestDlg, C
Di
alog) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP ON_BN_CLICKED(IDC_BUTTON_OPEN, &CtestDlg::OnBnClickedButtonOpen) ON_BN_CLICKED(IDC_BUTTON_PLAY, &CtestDlg::OnBnClickedButtonPlay) ON_WM_DESTROY() ON_BN_CLICKED(IDC_BUTTON_STOP, &CtestDlg::OnBnClickedButtonStop) END_MESSAGE_MAP() //ON_BN_CLICKED(IDC_
Sound
_Play, On
Sound
2) //ON_BN_CLICKED(IDC_
Sound
_stop, On
Sound
1) //ON_BN_CLICKED(IDC_
sound
_pause, OnBoth
Sound
s) //ON_WM_DESTROY() //ON_BN_CLICKED(IDC_BUTTON_Slow, OnBUTTONSlow) //ON_BN_CLICKED(IDC_BUTTON_Fast, OnBUTTONFast) //ON_BN_CLICKED(IDC_BUTTON_Normal, OnBUTTONNormal) // CtestDlg message handlers BOOL CtestDlg::OnInit
Di
alog() { C
Di
alog::OnInit
Di
alog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this
di
alog. The
framework
does this automatically // when the application's main window is not a
di
alog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here m_snd
Sound
1 = new C
Di
rect
Sound
(); if(!m_snd
Sound
1) { exit(-1); } return TRUE; // return TRUE unless you set the focus to a control } void CtestDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { C
Di
alog::OnSysCommand(nID, lParam); } } // If you add a minimize button to your
di
alog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the
framework
. void CtestDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast
(dc.GetSafeHdc()), 0); // Center icon in client
rect
angle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); C
Rect
rect
; GetClient
Rect
(&
rect
); int x = (
rect
.Width() - cxIcon + 1) / 2; int y = (
rect
.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { C
Di
alog::OnPaint(); } } // The system calls this function to obtain the cursor to
di
splay while the user drags // the minimized window. HCURSOR CtestDlg::OnQueryDragIcon() { return static_cast
(m_hIcon); } //--------------------------------------------------------------------------------- void CtestDlg::OnBnClickedButtonOpen() { // TODO: Add your control notification handler code here LPCTSTR lpszFilter =L"Wave File(*.wav)|*.wav|All Files|*.*||"; CFile
Di
alog dlg(TRUE,NULL,NULL,/*OFN_HIDEREADONLY |*/ OFN_OVERWRITEPROMPT,lpszFilter); if(dlg.DoModal()==IDOK) { m_
sound
file = dlg.GetPathName(); } } // unsigned int WINAPI FileReadProc(LPVOID pOwner) { CtestDlg* pThis = (CtestDlg*)pOwner; pThis->ReadFileProc(); return 1; } // typedef struct _WAVE_FORMAT { WORD Au
di
oFormat; WORD NumChannels; DWORD SampleRate; DWORD ByteRate; WORD BlockAlign; WORD BitsPerSample; }WAVE_FORMAT,*PWAVE_FORMAT; void CtestDlg::OnBnClickedButtonPlay() { // TODO: Add your control notification handler code here if(m_
sound
file.IsEmpty()) { MessageBox(L"请选中播放文件!"); return; } USES_CONVERSION; fp = fopen(W2A(m_
sound
file.GetBuffer(m_
sound
file.GetLength())),"rb"); if(NULL == fp) { MessageBox(L"打开所所定的播放文件失败,请确认文件是否存在!"); return; } fseek(fp,20,0); //Skip previous 20 bytes RIFF header WAVE_FORMAT waveFormat; int nLen =fread(&waveFormat,1,sizeof(WAVE_FORMAT),fp); AU
DI
O_CONFIG WaveHead; WaveHead.wFormatTag = 1; WaveHead.nChannels = 2; WaveHead.nSamplesPerSec = 44100; WaveHead.nAvgBytesPerSec = 176400; WaveHead.nBlockAlign = 4; WaveHead.wBitsPerSample = 16; WaveHead.nBlockAlign=waveFormat.BlockAlign; WaveHead.nChannels=waveFormat.NumChannels; WaveHead.nSamplesPerSec=waveFormat.SampleRate; WaveHead.wBitsPerSample=waveFormat.BitsPerSample; WaveHead.nAvgBytesPerSec=waveFormat.ByteRate; m_snd
Sound
1->CreateD
Sound
(&WaveHead,8000); fseek(fp,20+sizeof(WAVE_FORMAT),0); unsigned int dwRea
dI
D; m_hThread = (HANDLE)_beginthreadex(0,0,FileReadProc,this,0,&dwRea
dI
D); Sleep(200); m_bStop = 0; m_bContine = 1; m_snd
Sound
1->Play(); } void CtestDlg::ReadFileProc() { //BYTE buf[1025]; int n = 0; while(1) { BYTE buf[1025]; int nlen; if(m_bStop) break; nlen = fread(buf,1,1024,fp); if(!nlen) break; while(m_snd
Sound
1->WriteDataToBuf(buf,nlen)==-1) { Sleep(100); } } if(fp) { fclose(fp); fp = NULL; } } void CtestDlg::OnDestroy() { C
Di
alog::OnDestroy(); // TODO: Add your message handler code here m_bStop = 1; OnBnClickedButtonStop(); if(m_hThread) { WaitForSingleObject(m_hThread,2000); CloseHandle(m_hThread); m_hThread = 0; } if(m_snd
Sound
1) { delete m_snd
Sound
1; m_snd
Sound
1 = NULL; } if(fp) { fclose(fp); fp = NULL; } } void CtestDlg::OnBnClickedButtonStop() { // TODO: Add your control notification handler code here m_bStop = 1; if(m_hThread) { WaitForSingleObject(m_hThread,2000); CloseHandle(m_hThread); m_hThread = NULL; } m_snd
Sound
1->Stop(); }
C#
110,571
社区成员
642,568
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章