HOME
www.Junoland.de
(c) Copyright 2008 °Andreas Klotz, Cologne, Germany [upd.Oct.2008]
AKL@Junoland.de
C# JunoLand Composer 0.24 C#.Net
Free Download 0.2 MB
Just extract Zip-file to any directory and start Midi24.exe -that's all! (no registry)
... and turn your soundcard on and have fun with this little drum-sequencer-demo!
C# is rocking!
Just after three weeks of study, I could write this little multi-media-App. It is not that I pretend to be that mega-coder - it is in that great language itself!
To demonstrate typical issues of the C#-beginner,
the most important parts of the sourcecode of this program will be explained below.
|
|
C#-Nuts
The first itching things I broke my brain - having read tutorials for C#-beginners
So, let's have a look at those things that a C# beginner got to know. I will explain those little things that I needed for my first C#-program, the JunoCompose-DrumSequencer. Commands and classes and the usage of them that were hard to find or difficult to understand for me - to say it in one word : C# °Nuts....
how can I:
↑ top
C# °nut Timer
Timer (System.Timers.Timer)
- declare (in your class): Timer ti;
- how to react? write a function for it (in your class):
private void Animatio1 (object sender, EventArgs e){ ..}
- setup (in the constructor of your class):
ti = new Timer();
ti.Interval = 1;
ti.Enabled = true;
-
// assign delegate timer-event to reacting function "animatio1".......
ti.Tick += new EventHandler (Animatio1);
Here is a vaster runnable timer example :
↑ top
C# °nut enum
Enum (=Enumerations)
- declare (in your namespace): public enum Midmod :byte {run,stop,rewind};
- use sending: midireplay.playmid(midireplay.lastmidnam,Midmod.rewind);
- use receiving: static void playmid(string finam, Midmod mimo) {..}
- use evaluating: if (mimo==Midmod.rewind) {....}; if (mimo== ..) {..}
Here is a vaster enum example (not runnable, because it is with omissions) :
Hey guy (gal) - did you see that it is useful to work with enums? :
I could also say : 1 for run, 2 for stop and 3 for rewind,
and call playmid(midireplay.lastmidnam,3)
and then evaluate it in the function playmid:
if (mimo==3) ...;
- but it makes it a little bit more handy. You don't need to remember, what "3" means, you just can use it as you speak "Midmod.rewind" - isn't it better?
Why working with functions at all?
To avoid that midimode-parameter you do all the things that the function midireplay would do here and now and immediately. Then you would have no function and no parmeter to transfer. But this you has to do for middireplay.stop and also for midireplay.run - so this is the purpose of working with functions. In function midirerplay you make something same for each kind of midimode. This you had to repeat if you wouldn't build a function midireplay.
↑ top
C# °nut Split String
Split - (string).Split -
Here an example:
string s="DRUMS,PIANO,CHROM-PERCUS,ORGAN,GUITAR,BASS,STRINGS,"
+"BRASS,REED,PIPE,SYNTI-LEAD,SYNTI-PAD,SYNTI-FX,ETHNIC";
char[] separators = {','};
igroup = s.Split(separators);
Now you can use the array - that was easy doing ( MesageBox.Show(igroup[5] )
draw a line
to be continued....
↑ top