Show Posts
|
|
Pages: [1] 2 3 ... 6
|
|
1
|
Developments / BASS / BassMidi.BASS_MIDI_StreamGetEvent
|
on: 31 Mar '13 - 23:43
|
|
At position 0 of a midi file BassMidi.BASS_MIDI_StreamGetEvent returns the default value. Is it possible to return the value of the first event of a given type if no notes are played before it?
for example Stream->[Event]->[Event]->[Event]->[Event]->[Event]->[programChange]->[Note On]...
At any position BEFORE the program change, BassMidi.BASS_MIDI_StreamGetEvent(BASSMIDIEvent.MIDI_EVENT_PROGRAM) would return the value of the first program change event
Stream->[Event]->[Note On]->[Event]->[Event]->[Event]->[Event]->[programChange]->[Note On]...
Here, at any position before the program change, BassMidi.BASS_MIDI_StreamGetEvent(BASSMIDIEvent.MIDI_EVENT_PROGRAM) would return the default value because there were note events...
This just to keep the controls on my UI from resetting at position zero, only to jump to the correct value immediately when the music starts.
Thanks
|
Reply
Quote
|
|
|
3
|
Developments / BASS / Re: Help getting Bass Library to Link
|
on: 30 Dec '12 - 22:08
|
|
Have you been able to get any of the samples to compile and run? I don't run 64 bit windows. Are you using 64 bit BASS DLLs?
Here's what I would do. Start a new project. Use C++ or C but not managed c++. Don't link anything to do with bass. Get this to compile and run. Link the bass lib, don't make any bass calls in code, just link the lib, and compile and run. Add a call to bass init. Get this to compile and run.
At this point you should be ok.
Avoid managed C++ until you get to know what you are doing. Write your app in C or C++.
If you can, switch to C#, as this language removes most all of the pain of project management, stuff like linking and libs and header files and project and such. You get to forget about housekeeping and boilerplate UI code and focus on programming your program.
|
Reply
Quote
|
|
|
4
|
Developments / BASS / Re: Old retired programmer trying to learn new tricks
|
on: 27 Dec '12 - 20:03
|
|
You do need to be sure the bass.dll is in the compiled program directory... or somewhere the system can find it. Otherwise when the app starts loading it won't be able to load the dll because it cant find it. it's not enough to just link to the dll, you have to make sure it is either copied to or placed in the bin folder along with the executable or somewhere in a defined path search location.
|
Reply
Quote
|
|
|
5
|
Developments / BASS / Re: C#, Creating a metronome, problem with mixer syncs
|
on: 6 Dec '12 - 08:27
|
What sort of problems did the sync at 0 cause? It seems like it should be fine. This is a bit hard to describe because I'm not sure what the underlying problem is... The symptom is that at the faster interval (120bpm @ 24PPQN), nothing would play. The only way this could happen it seemed would be if the initial sync callback (at 0) was missed, so I tried delaying the initial sync and it started working. After these two fixes I noticed that after restarting, the syncs from the previous time would refire! That is, it seems like even though the syncs were onetime, they would not be removed from the queue, and would refire if the stream was rewound and restarted.
That's strange. You would need to remove the final/untriggered sync, but the rest should have been removed automatically due to the ONETIME flag. So the BASS_ChannelRemoveSync call is needed in your buttonStartStop_Click function, but it shouldn't be necessary in the MixerPosSync function. If the syncs are definitely being triggered again, I think I will have to send you a debug version to find out why that is.
The symptom is that I'd get uneven sometimes machine-gun like triggers of my sample after a few seconds, which would only happen after stopping and restarting. The problem went away after I added the remove sync line in the sync callback. No idea whats going on though. It might be something I'm doing (or not doing) in that sample code below, or something going on with .NET but I'd be happy to try a debug build.
|
Reply
Quote
|
|
|
6
|
Developments / BASS / Re: C#, Creating a metronome, problem with mixer syncs
|
on: 2 Dec '12 - 18:18
|
Ok... I managed to solve part of the problem. First, I was neglecting to set an initial sync when i re-started the metronome. After I fixed this, I found that I needed to delay that initial sync. Setting the initial sync to position 0 would cause problems at faster intervals e.g. 24 ppqn. After these two fixes I noticed that after restarting, the syncs from the previous time would refire! That is, it seems like even though the syncs were onetime, they would not be removed from the queue, and would refire if the stream was rewound and restarted. Does any of that make sense? I fixed it by removing the position sync in the callback. Something's wrong or I am not using this correctly...
private void buttonStartStop_Click(object sender, EventArgs e) { if (Bass.BASS_ChannelIsActive(this.mixer) != BASSActive.BASS_ACTIVE_PLAYING) { this.index = 0; this.syncpos = 100000;
Bass.BASS_ChannelRemoveSync(this.mixer, this.lastSync); Bass.BASS_ChannelSetPosition(this.mixer, 0); this.lastSync=Bass.BASS_ChannelSetSync(this.mixer, BASSSync.BASS_SYNC_POS | BASSSync.BASS_SYNC_MIXTIME | BASSSync.BASS_SYNC_ONETIME, this.syncpos, this.mixerPosSync, IntPtr.Zero); Bass.BASS_ChannelPlay(this.mixer, true); } else { Bass.BASS_ChannelStop(this.mixer); } }
... private void MixerPosSync(int handle, int channel, int data, IntPtr user) { this.syncpos += updateInterval; long pos = Bass.BASS_ChannelGetPosition(mixer); SetText(pos, syncpos); // Just to see the values
Bass.BASS_ChannelRemoveSync(this.mixer, this.lastSync); // Seems to solve the retriggering problem after restarting this.lastSync = Bass.BASS_ChannelSetSync( this.mixer, BASSSync.BASS_SYNC_POS | BASSSync.BASS_SYNC_MIXTIME | BASSSync.BASS_SYNC_ONETIME, this.syncpos, this.mixerPosSync, IntPtr.Zero);
int y = this.index % PPQN;
// for this test, play loud on the quarter note, a little softer on the 16th note if (y == 0) {
Bass.BASS_ChannelSetAttribute(sample, BASSAttribute.BASS_ATTRIB_VOL, 1);
// rewind the sample BassMix.BASS_Mixer_ChannelSetPosition(sample, 0, BASSMode.BASS_POS_BYTES);
// Play it BassMix.BASS_Mixer_ChannelPlay(this.sample);
} else if (y == 6 || y==12 ||y==18) { Bass.BASS_ChannelSetAttribute(sample, BASSAttribute.BASS_ATTRIB_VOL, .50f);
// rewind the sample BassMix.BASS_Mixer_ChannelSetPosition(sample, 0, BASSMode.BASS_POS_BYTES);
// Play it BassMix.BASS_Mixer_ChannelPlay(this.sample); }
this.index++; }
|
Reply
Quote
|
|
|
7
|
Developments / BASS / C#, Creating a metronome, problem with mixer syncs
|
on: 25 Nov '12 - 02:38
|
Hello, I am attempting to write a metronome, and I've run into a bit of trouble. I intend for the metronome to play a pattern using multiple samples rather than just quarter notes (like Dr. Beat if anyone has one of those), so the sync must be called 24 times per quarter note so that I can do sixteenth notes and triplets and whatever. Even though the sync code in my test program below is very short, it can't seem to keep up. If i set PPQN = 1, it plays OK. If I set PPQN=24 the next sync is missed and the sound stops. My questions: Is my technique below correct, If so, is there any way to speed up the sync proc so that the syncs aren't missed at 24ppqn (even at fast tempos) and if not do you think i'll have better luck using C or C++? Thanks JS
public class FormTest : Form { private System.ComponentModel.IContainer components = null; private System.Windows.Forms.TrackBar trackBarTempo; private System.Windows.Forms.Button buttonStartStop; private int mixer = 0; private SYNCPROC mixerPosSync; private long syncpos = 0; private int sample = 0; private int index = 0; private long updateInterval; private int PPQN = 1; // PPQN = 24 does not work public FormTest() { InitializeComponent(); }
protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.trackBarTempo = new System.Windows.Forms.TrackBar(); this.buttonStartStop = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.trackBarTempo)).BeginInit(); this.SuspendLayout(); this.trackBarTempo.Location = new System.Drawing.Point(12, 50); this.trackBarTempo.Maximum = 1000; this.trackBarTempo.Minimum = 50; this.trackBarTempo.Name = "trackBarTempo"; this.trackBarTempo.Size = new System.Drawing.Size(264, 45); this.trackBarTempo.TabIndex = 1; this.trackBarTempo.TickFrequency = 20; this.trackBarTempo.Value = 800; this.trackBarTempo.ValueChanged += new System.EventHandler(this.trackBarTempo_ValueChanged); // // buttonStartStop // this.buttonStartStop.Location = new System.Drawing.Point(102, 12); this.buttonStartStop.Name = "buttonStartStop"; this.buttonStartStop.Size = new System.Drawing.Size(75, 23); this.buttonStartStop.TabIndex = 4; this.buttonStartStop.Text = "Start"; this.buttonStartStop.UseVisualStyleBackColor = true; this.buttonStartStop.Click += new System.EventHandler(this.buttonStartStop_Click); // // FormTest // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(297, 107); this.Controls.Add(this.buttonStartStop); this.Controls.Add(this.trackBarTempo); this.Name = "FormTest"; this.Text = "Form1"; this.TopMost = true; this.Load += new System.EventHandler(this.FormTest_Load); ((System.ComponentModel.ISupportInitialize)(this.trackBarTempo)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void FormTest_Load(object sender, EventArgs e) { Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle);
Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 500); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 20);
this.mixerPosSync = new SYNCPROC(MixerPosSync); this.mixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_MIXER_NONSTOP); this.sample = Bass.BASS_StreamCreateFile("ds_kick_dry_wood_beater.wav", 0, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);
BassMix.BASS_Mixer_StreamAddChannel(mixer, this.sample, BASSFlag.BASS_MIXER_PAUSE);
SetTempo();
Bass.BASS_ChannelSetSync(this.mixer, BASSSync.BASS_SYNC_POS | BASSSync.BASS_SYNC_MIXTIME | BASSSync.BASS_SYNC_ONETIME, this.syncpos, this.mixerPosSync, IntPtr.Zero); }
private void buttonStartStop_Click(object sender, EventArgs e) { if (Bass.BASS_ChannelIsActive(this.mixer) != BASSActive.BASS_ACTIVE_PLAYING) { Bass.BASS_ChannelPlay(this.mixer, false); } else { Bass.BASS_ChannelStop(this.mixer); } }
private void trackBarTempo_ValueChanged(object sender, EventArgs e) { SetTempo(); }
private void SetTempo() { // update interval for the test is 500ms (120bpm) / PPQN (24)
this.updateInterval = Bass.BASS_ChannelSeconds2Bytes(mixer, .5 / PPQN); }
private void MixerPosSync(int handle, int channel, int data, IntPtr user) { // for this test, play on the quarter note (24 ppqn)
if (this.index % PPQN == 0) { // rewind the sample Bass.BASS_ChannelSetPosition(sample, 0, BASSMode.BASS_POS_BYTES);
// Play it BassMix.BASS_Mixer_ChannelPlay(this.sample); }
this.index++;
this.syncpos += updateInterval;
Bass.BASS_ChannelSetSync( this.mixer, BASSSync.BASS_SYNC_POS | BASSSync.BASS_SYNC_MIXTIME | BASSSync.BASS_SYNC_ONETIME, this.syncpos, this.mixerPosSync, IntPtr.Zero); } }
|
Reply
Quote
|
|
|
8
|
Developments / BASS / Re: MidiMessageEventArgs to BASSMIDIEvent : Control Change with C# / Bass.net
|
on: 10 Jul '11 - 14:39
|
Is this your actual working code? You're converting the status type to a string and then doing a string comparison? And then doing it twice whether you need to or not? That's a pretty expensive operation for a simple numeric comparison. Hello folks ! I want to send midi events from an external midi keyboard to a VST In order to achieve this, I've simply copied the example "MIDIdevices" included as sample in order to capture the events and modified the function "private void InDevice_MessageReceived(object sender, MidiMessageEventArgs e)" in order to send message to the VST with conditionnal test, "translating" the MidiMessageEventArgs to a BASSMIDIEvent like this : private void InDevice_MessageReceived(object sender, MidiMessageEventArgs e) {
//******************** // TRANSLATE MESSAGES ... //********************
if (e.ShortMessage.StatusType.ToString() == "NoteOn") { BassVst.BASS_VST_ProcessEvent(_vstStream, 0, BASSMIDIEvent.MIDI_EVENT_NOTE, Utils.MakeWord(e.ShortMessage.Note, e.ShortMessage.Velocity)); }
if (e.ShortMessage.StatusType.ToString() == "NoteOff") { BassVst.BASS_VST_ProcessEvent(_vstStream, 0, BASSMIDIEvent.MIDI_EVENT_NOTE, Utils.MakeWord(e.ShortMessage.Note, 0)); }
... ... ...
The code WORKS but I wonder if there's not a more elegant way to send BASSMIDIEvent from MidiMessageEventArgs I've also noticed that I can not access the control change I want with BASSMIDIEvent because there's no "general" event as indicated in the doc: MIDI controller 0 : MIDI_EVENT_BANK MIDI controller 1 : MIDI_EVENT_MODULATION MIDI controller 7 : MIDI_EVENT_VOLUME MIDI controller 10 : MIDI_EVENT_PAN MIDI controller 11 : MIDI_EVENT_EXPRESSION MIDI controller 64 : MIDI_EVENT_SUSTAIN MIDI controller 120 : MIDI_EVENT_SOUNDOFF MIDI controller 121 : MIDI_EVENT_RESET MIDI controller 123 : MIDI_EVENT_NOTESOFF MIDI controller 65 : MIDI_EVENT_PORTAMENTO MIDI controller 5 : MIDI_EVENT_PORTATIME MIDI controller 84 : MIDI_EVENT_PORTANOTE MIDI controllers 126 & 127 : MIDI_EVENT_MODE MIDI controller 91 : MIDI_EVENT_REVERB MIDI controller 93 : MIDI_EVENT_CHORUS (MIDI controller 74 : MIDI_EVENT_CUTOFF (MIDI controller 71 : MIDI_EVENT_RESONANCE MIDI controller 72 : MIDI_EVENT_RELEASE MIDI controller 73 : MIDI_EVENT_ATTACK I there a way to send all type of midi control change to the vststream ? A more convenient way ? Hoping beeing accurate to my description, thanks for your reply
|
Reply
Quote
|
|
|
9
|
Developments / BASS / Re: Bass.Net API
|
on: 8 Sep '10 - 17:14
|
just do a simple subtraction on the data to reverse it.........What ,Please  ? I have try with +,- When I write: Master.GTrackBar11.Value = e.ShortMessage.Data2 , then I can change the Value of the Trackbar. When I write: Master.GTrackBar11.Value = e.ShortMessage.Data2 == 0 or 10 or 127, then there is nothing. The Trackbar goes to the left Side and that is all. ( the same is with Data1,the Trackbar goes to the left Side) I have this Problem only with the Crossfader. My Volume Fader are ok. Ahh.... This shouldn't even compile... not to mention the fact that making the trackbar visible outside of the master class is just bad programming practice..........I have a MDI Form with Player A and B, Master, and Playlist. Believe me,there was no other Way for this App. I had many Problems with the both Players by using with only one Form. But please, what can I do with a simple subtraction .......what? First of all, "needing" to make data members of a class public is pure crapola. It's just bad software engineering. So no, I don't believe you. If you have a slider that has a min and max range of 0 to 127, with 0 being far left and 127 being far right and you want to reverse it, subtract 127 from the new value before assigning it to the slider. This is ridiculously simple math. slider.value = 127 - newvalue; "Master.GTrackBar11.Value = e.ShortMessage.Data2 == 0 or 10 or 127" e.ShortMessage.Data2 == 0 is a boolean statement. "Master.GTrackBar11.Value = e.ShortMessage.Data2 == 0" is assigning a boolean value (the result of e.ShortMessage.Data2 == 0) to an integer variable (Master.GTrackBar11.Value). This code will not compile: int value = 3; this.trackBar1.Value = value == 0; So I have no idea whatsoever what you're doing here. I suspect that the second "==" (evaluation) is actually "=" (assignment) in your "code".
|
Reply
Quote
|
|
|
10
|
Developments / BASS / Re: Bass.Net API
|
on: 8 Sep '10 - 00:16
|
One Question....is that right ?
{ if (e.IsShortMessage) { if e.ShortMessage.ControllerType == MIDIControllerType.Panorama && e.ShortMessage.Channel == 0) { Master.GTrackBar11.Value = e.ShortMessage.Data2 == 127; } } }
This shouldn't even compile... not to mention the fact that making the trackbar visible outside of the master class is just bad programming practice.
|
Reply
Quote
|
|
|
11
|
Developments / BASS / Re: Bass.Net API
|
on: 8 Sep '10 - 00:13
|
I have a second Controller, the XSession Pro from M-Audio.
There is the same Problem with the Crossfader !!
Did you have a other Idea?
you need to figure out what the value ranges are for the hardware, and change the minimum and maximum values of the trackbar in your program to match. If the trackbar is going in the wrong direction, just do a simple subtraction on the data to reverse it. You need to do more reading and studying my friend. These are really basic questions.
|
Reply
Quote
|
|
|
12
|
Developments / BASS / Re: Bass.Net API
|
on: 6 Sep '10 - 15:55
|
The Notes of my Controller can I see in the Textbox of the MidiDevicesSample. So ,I have...
Play Button (Player B) = 0 : 00:00:01.5740000 Channel 0 NoteOn Key=E4, Velocity=127 1 : 00:00:01.7380000 Channel 0 NoteOff Key=E4, Velocity=0
Stop Button (Player B) = 2 : 00:03:40.2010000 Channel 0 NoteOn Key=C3, Velocity=127 3 : 00:03:40.3850000 Channel 0 NoteOff Key=C3, Velocity=0
Pause Button (Player B) = 4 : 00:05:22.6780000 Channel 0 NoteOn Key=GSharp3, Velocity=127 5 : 00:05:22.8320000 Channel 0 NoteOff Key=GSharp3, Velocity=0
What I need is a Code which included : Channel Nr. , Key (Note) Nr. and Maybe Note On or Off
With this Code ,my Program knows,wich button I have pressed on my Controller
Radio42 givs me this Code :
private void InDevice_MessageReceived(object sender, MidiMessageEventArgs e) { if (e.IsShortMessage) { if (e.ShortMessage.StatusType == MIDIStatus.NoteOn && e.ShortMessage.Channel == 1 && e.ShortMessage.Data1 == 1) { buttonStart.PerformClick(); } } }
But there is no MIDI Note ( Key ) for the Button of my Controller
Do you have the Bass.NET documentation installed? the "MidiMessageEventArgs" variable "e" contains the data for the midi message that was received from the midi device. When e.IsShortMessage == true then it's the received message is a short message type. When e.IsShortMessage == true and e.ShortMessage.StatusType == MIDIStatus.NoteOn then it's the received message is a "note on" message. When e.IsShortMessage == true and e.ShortMessage.StatusType == MIDIStatus.NoteOn then e.Data1 and e.Data2 contain data specific to a midi note on messages. Read about the "MidiMessageEventArgs" and "MIDIStatus Enumeration" in the documentation to better understand the data being passed back to InDevice_MessageReceived. Then you will be able to figure out the "codes" for your button and trackbars. A shortmessage of statustype noteon contains data for the key number and velocity.
|
Reply
Quote
|
|
|
13
|
Developments / BASS / Re: Bass.Net API
|
on: 6 Sep '10 - 07:43
|
At First...Excuse me for the last Post
Now to your Codes :
This can I read, when I press the Play Button of my Controller ! ( in the MidiDivices Sample )
Midi device 0 opened. Midi device 0 started. 0 : 00:00:02.1800000 Channel 0 NoteOn Key=E4, Velocity=127 1 : 00:00:02.3420000 Channel 0 NoteOff Key=E4, Velocity=0
------------------------------------------------------------------------------------------ This can I read, when I move the Crossfader of my Controller ! ( in the MidiDivices Sample )
Midi device 0 opened. Midi device 0 started. 0 : 00:00:02.2790000 Channel 0 ControlChange Controller=Panorama, Value=46 1 : 00:00:02.3000000 Channel 0 ControlChange Controller=Panorama, Value=45 2 : 00:00:02.3200000 Channel 0 ControlChange Controller=Panorama, Value=42 3 : 00:00:02.3410000 Channel 0 ControlChange Controller=Panorama, Value=36 4 : 00:00:02.3610000 Channel 0 ControlChange Controller=Panorama, Value=24 5 : 00:00:02.3820000 Channel 0 ControlChange Controller=Panorama, Value=0
------------------------------------------------------------------------------------------ I understand your Codes, but I didnīt know the code for the Button or Trackbar.
I mean the Key or ControlChange.
Ahh..... I put in your MidiDivices Sample a Button namned " Test " for closing the Program. Can you give me an Code for my Controller Button with the Key E4 for activate This Test Button ?
sorry , but itīs the first Time with MIDI
Are you trying to make something happen when "e4" is received by the program from your controller? If so, the code sample he provided above will do that. You just need to substitute the midi note number for e4. You can Google "midi note numbers". http://tomscarff.110mb.com/midi_analyser/midi_note_numbers_for_octaves.htm
|
Reply
Quote
|
|
|
14
|
Developments / BASS / Re: Bass.Net API
|
on: 4 Sep '10 - 21:41
|
Do you want to send midi messages when you press a button and move the trackbar?
Yes,Yes,Yes.......(er hat es)
I want send it from my Controller to my App.
Yes... you want to send "it" from your controller to your app. Try this: public It WaitForIt() { It it = myController.WaitForIt(); return it; } private void trackbar_scroll(object sender, EventArgs e) { It it = new It(); it.Send(myController); } private void button_click(object sender, EventArgs e) { It it = new It(); it.Send(myController); } Now that I understand that you want to send and receive "it", things become so simple! Hope this helps.
|
Reply
Quote
|
|
|
15
|
Developments / BASS / Re: Bass.Net API
|
on: 4 Sep '10 - 18:04
|
At First....my Software is ready!!!!! Only what I want is .....control it with my Controller!!!!! ------------------------------------------------------ Can you write a simple application in C#? .... Yes I can .... But "no" with this Hardware!!!! (the same in VB ) ------------------------------------------------------ What specifically are you trying to do with your knob and trackbar? What did you mean ,what I want.....cooking Coffee I want control my Software with my ControllerAnd for this , I need a Code Example of a Trackbar and a Button!!!!!! And with the Sample " MidiDevices" , I can see the Valuechange of my Controller, but I canīt realize the codes for my Hardware for changing the Value of the Trackbars in my Software. The same is for the Buttons in my App. Radio42 wrote: Well, pretty easy I guess - when you take a look to the MIDI sample you'll find an event callback called "InDevice_MessageReceived". Use this to get notified when a new MIDI-ShortMessage arrives and evaluate it in there. In the sample the incomming MIDI-ShortMessage is just printed to the message box. But you might also evaluate it yourself further, e.g. if a certain channel/status or data1/2 byte is used - then you might call your code to change the trackbar or whatever you like. You just need a kind of 'mapping' between the incomming short message data and the action you'd like to perform.I know what he means, but I canīt realize it. Thatīs the problem I need these codes.......for a Trackbar .....and a Button....... "I need these codes.......for a Trackbar .....and a Button......." does not tell me much. What specifically do you want to do with the trackbar and the button? Trackbars and buttons are a means, not an end. Do you want to send midi messages when you press a button and move the trackbar? I don't know what your "software" does. "I need these codes.......for a Trackbar .....and a Button......." translates to me to be "I don't know how to use trackbars and buttons" What are you trying to do? Ask a specific question and you may get an answer. If you want, you can email me your code.
|
Reply
Quote
|
|
|
16
|
Developments / BASS / Re: Bass.Net API
|
on: 3 Sep '10 - 23:36
|
Please can you give me an Example. I know you have other thinks to do as wrote for other People a Code. But my Code is now in C#. And coding in c# is difficult for me as in VB. What I need is a Instruction for a Knob ( Note on , Note off ) and for a Trackbar ( ControlChange)
I hope you have a little Time to help me !!!
Have you studied the Bass documentation and examples? You are not going to be able to accomplish very much until you do. Can you write a simple application in C#? Do you know how to use controls and events? Have you studied the API at all? There are scores of books, online resources and university classes to learn this stuff. You are wasting your time and the time of others if you do not have the patience or desire to learn to use the tools, the language, and how to design software in general before you ask questions. What specifically are you trying to do with your knob and trackbar?
|
Reply
Quote
|
|
|
17
|
Developments / BASS / Re: Slider
|
on: 20 Jul '10 - 00:20
|
What programming language are you using? I assume it's C#/.net since Radio42 has answered. How much thought have you put into this? You will need to: - Import the images into your project as resources
- Create a user-control that has Minimum, Maximum and Value fields and properties. Modifying the value of any of these properties should cause the control to repaint. (Invalidate()). Actually, a control-derived class is a better choice than a user control.
- Override the OnPaint method of your user control. Do a little math to to determine the portion of the bitmap you want to draw to the screen. You calculate this using the
minimum, maximum and value values, and the height and/or width of the images. - In the SizeChanged event set the size of the control to the size of one frame of the image. Be careful not to adjust the size until the control handle has been created.
- Override OnMousedown. Set a variable called "capture" to true
- Override OnMouseup. Set a variable called "capture" to false
- Override OnMouseMove. If capture is true, use the Mouse.Y value to determine if you should add or subtract some number from the Value property. Do not allow the code to modify the Value property outside the bounds of Minimum and Maximum. If it's not obvious, you will need to keep track of the last Mouse.Y
This is not a difficult programming task, but you will need to do some thinking and studying on your own. You will need to understand how SetStyle() works, and how to avoid unnecessary or redundant painting in your control. You should also understand that .NET is unbelievably slow when it comes to drawing anything to the screen, and it gets worse if transparency is involved. Your animations will not be as smooth as you like, especially with larger images, and you will be eating much CPU time as you scroll your knobs. For reasons that escape me, MS chose not to use hardware acceleration in GDI+. I did exactly what you're attempting to do in my own project (actually I designed a bitmapped control library) , but wound up using on P/Invoke to use regular GDI to paint my bitmaps to the screen... it's many, many times faster. Ok , I understand , what you want to tell me.  Many work, for many CPU ! But, I have read in the PCDJ Forum that "DEX" (that is the App with my Skin) is created with VB. And it included in my Skin :a bmp as Background, many Knobs ,some Sliders and two Platters with a Size of 275*275 pix.( a Line of 40 Pictures ). The CPU in my System is 6%. Ah, my Problem is, I have created in my Skin (PCDJ) with KnobMan an Analog VU Meter ( as a Slider ). In my owen App I would put an Analog VU Meter,too. I have found one Control, but there is no " value ". When I use this Code: Bass.BASS_ChannelGetLevel(stream, Peak) Dim VuMeter1_value As Integer = (Math.Round(Peak(1), 3) * 100) VuMeter1.value = VuMeter1_valueThe Error: "Value" is no Member of VUMeter1. That is the Reason, why I want to create my owen Control.But my Know how about VB is at this Time not so high, so...... ....... if you have an other Idea, please let it me know..... Thanks My idea is for you to get proficient in the language of your choice before you attempt a project of this magnitude. Good, Luck, JJS
|
Reply
Quote
|
|
|
18
|
Developments / BASS / Re: Slider
|
on: 18 Jul '10 - 10:52
|
What programming language are you using? I assume it's C#/.net since Radio42 has answered. How much thought have you put into this? You will need to: - Import the images into your project as resources
- Create a user-control that has Minimum, Maximum and Value fields and properties. Modifying the value of any of these properties should cause the control to repaint. (Invalidate()). Actually, a control-derived class is a better choice than a user control.
- Override the OnPaint method of your user control. Do a little math to to determine the portion of the bitmap you want to draw to the screen. You calculate this using the
minimum, maximum and value values, and the height and/or width of the images. - In the SizeChanged event set the size of the control to the size of one frame of the image. Be careful not to adjust the size until the control handle has been created.
- Override OnMousedown. Set a variable called "capture" to true
- Override OnMouseup. Set a variable called "capture" to false
- Override OnMouseMove. If capture is true, use the Mouse.Y value to determine if you should add or subtract some number from the Value property. Do not allow the code to modify the Value property outside the bounds of Minimum and Maximum. If it's not obvious, you will need to keep track of the last Mouse.Y
This is not a difficult programming task, but you will need to do some thinking and studying on your own. You will need to understand how SetStyle() works, and how to avoid unnecessary or redundant painting in your control. You should also understand that .NET is unbelievably slow when it comes to drawing anything to the screen, and it gets worse if transparency is involved. Your animations will not be as smooth as you like, especially with larger images, and you will be eating much CPU time as you scroll your knobs. For reasons that escape me, MS chose not to use hardware acceleration in GDI+. I did exactly what you're attempting to do in my own project (actually I designed a bitmapped control library) , but wound up using on P/Invoke to use regular GDI to paint my bitmaps to the screen... it's many, many times faster.
|
Reply
Quote
|
|
|
19
|
Developments / BASS / Re: [C#]Seemingly simple things refuse to work
|
on: 13 Jul '10 - 17:01
|
|
Bass.NET puts all the C/C++ #defines in Enums. You will need to keep this in mind when translating C/C++ code or looking at the regular Bass help.
C# doesn't use #defines or loose functions. Everything is strongly typed, and is part of a class, an enumeration, etc.
|
Reply
Quote
|
|
|
20
|
Developments / BASS / Re: Center Cut
|
on: 27 Jun '10 - 19:52
|
The best way to do this is to have the instrumental version of the song, invert it and add it to the original with vocals. You must make sure both versions come from the same source and are of the same quality. You must also make sure they both line up perfectly before performing the operation.
How does this help this person remove the vocals from a song?
|
Reply
Quote
|
|
|