|
Hi,
I am building a wind synth that uses the API midi functions of
a soundcard. m_Note2 is an int value according to the keys pressed
and m_PBAD_2 is an int value ranging from 0-127 according to the airflow
thru the synth, updated according to the timer set at 250 millisec.
When I blow into the synth a note is played every 25msec but does not
stop, because the m_note in stopnote() outdated.
I have no idea what to add to the playnote() function. Any suggestions appreciated,
my knowledge of VC++ is very limited.
Cheers,
Rob
robert.harrington2@mail.dcu.ie
void CAD_mouthDlg::PlayNote()
{
UpdateData(TRUE);
MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,m_PBAD_2) ;
}
void CAD_mouthDlg::StopNote()
{
if(m_Key_Press == FALSE)
{
MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,0) ;
}
else
{
}
}
void CAD_mouthDlg::OnTimer(UINT nIDEvent)
{
CAD_mouthDlg::read_analog();
CAD_mouthDlg::SetPortChigh();
CAD_mouthDlg::OnButtonReadPort();
CAD_mouthDlg::PlayNote();
CAD_mouthDlg::StopNote();
CDialog::OnTimer(nIDEvent);
}
|
|
|
|
|
bob_000 wrote:
void CAD_mouthDlg::StopNote()
{
if(m_Key_Press == FALSE)
{
MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,0) ;
}
else
{
}
}
Well, one of your problems is that the MIDI note off message code is 0x80 (to 0x8F for different channels), not 0x90 (0x90 - 0x9F are note-on messages for channels 0-15)). As you probably know, MIDI uses a Note On message to start a note and a Note Off message to stop it.
[Edit] Oops - I just checked a MIDI spec, and a Note On message with velocity zero, which is what you're doing, should also work as a Note Off. Sorry![/Edit]
However, you're still going to run into problems. Calling StopNote() immediately after PlayNote() (assuming m_Key_Press == FALSE) will result in a note too short for you to hear. But if m_Key_Press is TRUE (so the stop message doesn't get sent), the next time your timer triggers another note on will be sent (maybe with the same pitch) without you having sent a stop message. You might get the same note played again, which will sound wierd, or the previous note might stop - it kinda depends on the synth you're sending the MIDI messages to. Anyway, wind instruments are normally monophonic so you'd want to stop the previous note before starting the new one. But that's more an app-logic problem, and that all depends on what you're trying to do!
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
I´m trying to get the Image attributes (width,height and dpi)
from cgm and eps files. I use the GDI+ to get it from jpg,tif
and wmf like this:
Image image(L"D:\\Code\\testbilder\\jpg1.jpg");
UINT imageHeight = image.GetHeight();
UINT imageWidth = image.GetWidth();
REAL horizResDpi = image.GetHorizontalResolution();
REAL vertiResDpi = image.GetVerticalResolution();
But I cant open eps or cgm images.
Can anybody please help me?
Vandaley
|
|
|
|
|
|
|
How to create a directory using WinApi or MFC?
|
|
|
|
|
refer to MSDN:
::CreateDirectory(path,NULL);
hope this helps...
|
|
|
|
|
::CreateDirectory will do the work if you already have a parent directory. If you want to create a directory "sequence" (e.g. parent doesn't have to exist), here is an example of such function:
bool CreateDirectorySeq(IN LPCTSTR lpszDirPath)
{
TCHAR szShorterPath[MAX_PATH];
TCHAR szDirectory[MAX_PATH];
if(!CreateDirectory(lpszDirPath, NULL)){
_tcscpy(szDirectory, lpszDirPath);
if(szDirectory[_tcslen(szDirectory) - 1] == TCHAR('\\'))
szDirectory[_tcslen(szDirectory) - 1] = TCHAR('\0');
LPSTR lpszLastDir = _tcsrchr(szDirectory, TCHAR('\\'));
if(lpszLastDir == NULL)
return true;
ZeroMemory(szShorterPath, MAX_PATH);
_tcsncpy(szShorterPath, szDirectory, _tcslen(szDirectory) - _tcslen(lpszLastDir));
}else
return true;
if(CreateDirectorySeq(szShorterPath))
return (CreateDirectory(szDirectory, NULL) == TRUE);
return false;
}
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Excellent function that helped out a lot, thanks for posting it!
Mike Ellertson
|
|
|
|
|
Hi, everyone!
I want to know where can I find a software that can do
PtoP video and audio interactions between two ends of users,
just like netmeeting.
Additional requisite is:
1. it runs on windows platform;
2. it is open source project.
Thanks in advance,
George
|
|
|
|
|
Hey pal,
sorrie I am not able to offer any help, but jus wanna tell you that I am in the same boat. Trying to find something along that line, cos needed to tweak something when doing conferencing.
Just to let you know that somewhere out there, there is another fella that is desperately doing so as well, hope that eases your woes of sort. FYI, I have not managed to find any.
Trying my best to write one myself one, though I am a complete newbie. Will keep you posted if i find any. Or if i successfully write out something. Hope you will do the same too.
Cheers
extremalis
<extremalis@catcha.com>
|
|
|
|
|
Thanks, extremalis buddie!
I am waiting for you ... hurryyyyyy~~
regards,
George
|
|
|
|
|
hey, jus an update,
I am able to locally display my video after grabbing it from the camera.
Basically, whatever I am doing is definitely not efficient, but I suppose I wanna get something going first, my deadline is getting near, so no point harping on how I can do better. Enuff of crap...this is basically how i did it, I dun have my exact codes now, its in office, kinda hard to get it out too...basically copy it to DIB format, den display a single bitmap, den use a timer to repeat the grab frame and display fast, at about 15fps.
I used the following from VFW:
capGrabFrame: to get a frame from the capture window
capCopyEdit: to copy the stuff to a clipboard i think...
den do the usual stuff for a clipboard, like opening one and closing one..
all these will be copied to a char buffer. I then used these data over at my other dialog box meant to display this to show lor.
used <capstretchblt> coz somehow I could not managed to use <drawdibdraw> which is supposed to be the right command.
It works now, am trying to figure out how best to transfer all these via socket to the other end. Hope that you are making good progress as well.
Regards
|
|
|
|
|
Hi, extremalis buddy!
Maybe our purpose is different. I think I need to transfer
the media stream through network. But is that your purpose?
regards,
George
|
|
|
|
|
Media stream? Meaning you open an 'avi' file and then you transfer over the network?
My purpose is to capture via the webcam and transfer this thing over the network real time. So I suppose you go find the functions to open an avi file or something into DIB format, you can achieve something similar to mine.
I gotta work on my stuff first, such that it can transfer across the network on Sockets.
Keep me posted on what you are doing, we can exchange views on whatever we are doing, and hopefully we can gain some inspirations from it.
Cheers.
|
|
|
|
|
Hi, extremalis buddy!
Try this,
http://www.banasoft.net/avphone3/demos/sourcedemo.htm
regards,
George
|
|
|
|
|
Visit here:
http://www.banasoft.net/avphone3/demos/sourcedemo.htm
|
|
|
|
|
Thanks, Anonymous buddy!
George
|
|
|
|
|
Hi,
I have a SOCKET handle (in intermediate driver). Is it possible to obtain the name of a process who created this socket ?
Yours sincerely,
Alex Bash
|
|
|
|
|
I am writing the Kernel mode driver.Here I tried use of OutputDebugString()
..But it says
unresolved external symbol __imp__OutputDebugStringA@4
What I need to do?
VIkrams
|
|
|
|
|
I think you should use KdPrint or DbgPrint.
|
|
|
|
|
I tried using both but it says:
error C2065: 'KdPrint' : undeclared identifier
error C2065: 'DbgPrint' : undeclared identifier
|
|
|
|
|
It is in Kernel32.lib, at least this what worked on my machine (Win2k)
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
What is the socket dll that holds its error description?
I use FormatMessage to translate winsock error.
when using the handle to WSock32.dll module i get different error description than in MSDN.
For example, error 10061 is "connection refused" but i get "Bad address".
error 10060 is "Connection timed out" but i get "permission denied".
This is the translation code:
LPVOID lpMsgBuf;
HANDLE hModule = GetModuleHandle("WSOCK32.dll");
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_IGNORE_INSERTS,
hModule,
nErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL
);
CString text = (LPCTSTR) lpMsgBuf;
LocalFree( lpMsgBuf );
Can anyone help me with this?
|
|
|
|
|
Hi guys:
I want to draw the caption bar of frame window in my own style,but the system button(CLOSE) always draw
by system unexpectedly, it cover my drawing. I remove the WS_SYSMENU attribute from windows style,but the
button of my application which shown on system taskbar has had no icon,I want it show icon on taskbar. How can I
resolve this problem, can anyone give me some instructions? Thanks!
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|