🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
3 messages
3 total messages Started by Nick Gessler Sun, 27 Feb 2005 21:25
Simple-Minded Midi Questions
#344
Author: Nick Gessler
Date: Sun, 27 Feb 2005 21:25
58 lines
2445 bytes
Yes, I admit to being a simple-minded newbie re Midi, but I'm 
happy to start with simple-minded solutions.  So here goes:

I would simply like to be able to select and play Midi keys 
with certain loudness, patches, durations, and L or R 
speakersand one at a time.

I've succeedes with the keys and loudness.
The duration, I have kludged with "Sleep(xx)".
I cannot figure out how to select a patch.
Device 0 seems to be monaural.
And changing the volume from FF00 to 00FF, which should switch
speakers, simply shuts down the audio in the second case.

Can anyone help with some simple command?

Many thanks,
Nick
 
Yes, it's dumb, but it works...
=================================
int midiport = 0;
HMIDIOUT device;

union {
   public:
   unsigned long word;
   unsigned char data[4];
} message;

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   midiOutSetVolume(device, 0xFFFF);
   for (int i = 0; i < 128; i++) {
      message.data[1] = i;
      midiOutShortMsg(device, message.data[1]);
      midiOutShortMsg(device, message.word);
      Sleep(50);
   }
   midiOutSetVolume(device, 0xFFFF);
   for (int i = 0; i < 50; i++) {
      message.data[1] = random(100);
      midiOutShortMsg(device, message.data[1]);
      midiOutShortMsg(device, message.word);
      Sleep(100);
   }
}
//---------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
message.data[0] = 0x90;
message.data[1] = 60;
message.data[2] = 100;
message.data[3] = 0;
midiOutOpen(&device, midiport, 0, 0, CALLBACK_NULL);
}
//-----------------------------------------------
Re: Simple-Minded Midi Questions
#345
Author: Nick Gessler
Date: Mon, 28 Feb 2005 03:08
5 lines
875 bytes
Hello Nick,
OK, I've figured out the key, patch and loudness.
What about the device and duration?
Nick
Re: Simple-Minded Midi Questions
#346
Author: Nick Gessler
Date: Mon, 28 Feb 2005 17:24
9 lines
1223 bytes
Well, OK...
So here's the application I came up with:
http://www.sscnet.ucla.edu/geog/gessler/borland/sound.htm
What can I say?  It works!
But I'd still appreciate suggestions on how get stereo to work
and other improvements.
Cheers,
Nick
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads