🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #344

Simple-Minded Midi Questions

#344
From: 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);
}
//-----------------------------------------------
Technical Details
Message-ID: <42223ac7$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10d0fc,3c6ec73f5b3e98e6,start
X-Google-Attributes: gid10d0fc,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Nick Gessler" <gessler@ucla.edu>
Sender: "Nick Gessler" <gessler@ucla.edu>
Reply-To: "Nick Gessler" <gessler@ucla.edu>
Subject: Simple-Minded Midi Questions
Newsgroups: borland.public.cppbuilder.multimedia
X-User-Info: 4.60.104.55     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <42223ac7$1@newsgroups.borland.com>
Date: 27 Feb 2005 13:25:27 -0800
X-Trace: newsgroups.borland.com 1109539527 207.105.83.66 (27 Feb 2005 13:25:27 -0800)
Lines: 58
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail