I am having problems using interop to call midiOutLongMsg.
in my MIDIHDR struct, i allocate MsgData as a string
I have been using a StringBuilder object to build MsgData
per byte. I am not getting the proper results, although
sometimes I do hear some notes being played, just not the
right ones...
What I think is happening is that when I do something like:
byte b=153;
Stringbuilder sb = new StringBuilder();
sb.Append(b);
i am appending the "string representation" of the byte.
ie "153" instead of just the one byte with a value of 153.
I am going to dive into the System.Text namespace, but
wanted to see if I could learn something here.
Really I have 2 questions:
1) How to append the actual byte to a stringbuilder
(byte2string function of somesort?)
2) How to properly determine the byte length of the
string. (sb.Length, sb.Capacity, sb.ToString
().SizeOf...???)
Thanks,
Tim. 3 1974
I am close to a solution, maybe:
using:
ASCIIEncoding.GetString Method (Byte[])
will give me a string that represents an array of bytes.
However, there is a restriction:
"Any element of the bytes array that is greater than
hexadecimal 0x7F is translated to a Unicode question mark
('?')."
I need to use that extra bit. Also, assuming that I get
the proper string of bytes, what must I do to insure that
it doesn't get hacked up by the marshal?
Tim. -----Original Message----- I am having problems using interop to call midiOutLongMsg.
in my MIDIHDR struct, i allocate MsgData as a string
I have been using a StringBuilder object to build MsgData per byte. I am not getting the proper results, although sometimes I do hear some notes being played, just not the right ones...
What I think is happening is that when I do something
like: byte b=153; Stringbuilder sb = new StringBuilder(); sb.Append(b);
i am appending the "string representation" of the byte. ie "153" instead of just the one byte with a value of 153. I am going to dive into the System.Text namespace, but wanted to see if I could learn something here.
Really I have 2 questions: 1) How to append the actual byte to a stringbuilder (byte2string function of somesort?)
2) How to properly determine the byte length of the string. (sb.Length, sb.Capacity, sb.ToString ().SizeOf...???)
Thanks, Tim.
.
Hi,
[inline]
"Tim" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl... I am close to a solution, maybe:
using: ASCIIEncoding.GetString Method (Byte[])
will give me a string that represents an array of bytes. However, there is a restriction:
"Any element of the bytes array that is greater than hexadecimal 0x7F is translated to a Unicode question mark ('?')."
I need to use that extra bit. Also, assuming that I get the proper string of bytes, what must I do to insure that it doesn't get hacked up by the marshal?
Tim. -----Original Message----- I am having problems using interop to call midiOutLongMsg.
in my MIDIHDR struct, i allocate MsgData as a string
I have been using a StringBuilder object to build MsgData per byte. I am not getting the proper results, although sometimes I do hear some notes being played, just not the right ones...
What I think is happening is that when I do something like: byte b=153; Stringbuilder sb = new StringBuilder(); sb.Append(b);
i am appending the "string representation" of the byte. ie "153" instead of just the one byte with a value of 153. I am going to dive into the System.Text namespace, but wanted to see if I could learn something here.
Really I have 2 questions: 1) How to append the actual byte to a stringbuilder (byte2string function of somesort?)
Cast the byte to a char, like sb.Append ( (char) b), this will not change
the number.
There might be other ways though... 2) How to properly determine the byte length of the string. (sb.Length, sb.Capacity, sb.ToString ().SizeOf...???)
Length
HTH,
greetings Thanks, Tim.
in my MIDIHDR struct, i allocate MsgData as a string
If you're working with binary data, it's better to use a byte[] than a
string.
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/
Please reply only to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Max M |
last post by:
If anybody is interrested in Midi, but are not on the Python Midi list,
I will just notify that I have released the first version of a high
level midi package for Python.
It is fully functional....
|
by: Mad Scientist Jr |
last post by:
any sample code or information would be most appreciated
i have been wanting to learn MIDI programming
but would rather learn it in my current language
(either vb.net or c#)
|
by: Kuba Araszkiewicz |
last post by:
Hello!
I have to write a program, which would convert midi files to notes, notes to
midi files and which would make one MIDI file from two different. I'm
totally lame in C (and any other...
|
by: david |
last post by:
1.I am considering doing a midi file generator for my
4th year project in B.SC.
2.I would do it using c language, but i'm not sure abou t the
level of difficulyt involved
3.Basically, the...
|
by: zDog |
last post by:
I found a lot of information on passing data from C# to a C++ dll
What I cannot find is a way to return C++ structs of TCHAR string data back
to the C# managed code!
typedef struct // C++ data...
|
by: tom |
last post by:
Hallo,
I need help on MIDI file,
and precisely about retrieving
few note values
(mainly the "Velocity" value,
corrisponding to the intensity
of a played note)
while the MIDI is playing.
|
by: tim |
last post by:
Someone using Python Midi Package from
http://www.mxm.dk/products/public/ lately?
I want to do the following :
write some note events in a midi file
then after doing that, put some controllers...
|
by: sreekant |
last post by:
Hi folks
I hope someone here might be able to help. I scavenged some info and
even code from the net and am trying to write a module that reads a text
file and spits out a midi file.
So far I...
|
by: Massi |
last post by:
Hi everyone, I'm searching for "something" which allows me to write
scripts which handle midi files. I'm totally a newbie in audio
manipulation, therefore any suggestion or link related to this...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |