Hi, I wrote a simple but very efficient real time safe memory allocator
in C++ that is useful in real time audio apps where you need to allocate
objects dynamically.
(badly enough there are still too many audio developers that
call new,delete, malloc() and free() within the audio RT thread !)
It works by pre-allocating a fixed pool of elements which can then
dynamically allocated and freed.
The alloc() and free() have fixed execution times and are inlined
thus if you look at the resulting assembly code it takes only
8-9 instruction for full allocation/deallocation.
It has the limitation that the pool contain elements of
the same datatype/size. Each element is a node of a doubly linked
list (the free-list) so keep in mind that if you create a pool
of N elements with s=sizeof(your_datatype).
The total memory usage is (N+2)*(s+8).
So it is not ideal to create large memory pools of chars (1 byte)
because for each char you would need 1+8 bytes of mem.
But for larger data structures it is ok.
creation of the memory pool:
RTMemoryPool *mypool=RTMemoryPool<your_datatype>(number_of_elements);
allocation of a element:
my_datatype *element=mypool->alloc();
freeing of an element:
mypool->free(element);
destruction of the memorypool: (frees up all the memory):
delete mypool;
Using the RTMemoryPool class requires only the inclusion of
the rtmemorypool.h header file, no .cpp files required.
You can download the RT memory allocator (which contains an small
example that user the class)
here:
http://www.linuxdesktop.it/download/rtallocator-0.0.2.tgz
if you find bugs or have suggestions let me know.
(write to benno@ and not sbenno@ because I do not read that mailbox,
too much spam).
cheers,
Benno
-------------------------------------------------
This mail sent through http://www.gardena.net
Hi,
Just a compilation fix:
* fixed a missing parameter that stopped compilation with recent GCC
versions
http://pkl.net/~node/alsa-patch-bay.html
Bob
--
Bob Ham <rah(a)bash.sh>
Can you say "death chambers at Guantanamo with no real trial"?
Greetings:
While profiling FLAC I discovered that the format includes a metadata
format for including cue sheet data for use in CD mastering
applications. When I looked for a Linux-based cue sheet editor I found
only the very outdated CDB (CD Builder), which, true to its author's
advice, will not build under GTK 1.2 or 2.x. I thought perhaps JAM would
concern itself with cue sheet data but I think that's not its domain
(the FLAC docs note that the cue sheet data is intended for CD authoring
apps).
Btw, I downloaded and tried running some Windows-based cue sheet
editors under WINE, with varying success, but none were completely
useful. Maybe I should update my WINE installation again, but I'd prefer
a Linux-based solution anyway.
Sorry for the cross-post, I thought perhaps someone on LAD might be
developing such a creature (?). Do any users on LAU utilize a cue sheet
editor for any of their work ?
Best regards,
== dp
>
>Hello,
>
>the german magazine KEYBOARDS has answered a readers question about audio
>and linux with tremendous ignorance. I think this is a good chance to push
>linux to the attention of "the masses".
>
>Here is the full text of question and answer (first in german, so anyone
>can correct my errors ;-).
>
>... snip
well the answer from the guy is in my opinion correct atleast for now.
You need a LL-patch to get audio work as desired and AFAIK there is
no main stream distro with that patch already applied.
Please dont misunderstand me, i love audio on Linux but there is still
some work to do until its is ready for "anyone". And i think thats what
the answer was about.
- Stefan
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
Greg Reddin wrote:
> Is there a web resource or book or something where one can learn
> about these programming caveats for audio developers? I knew nothing
> of this problem, but it makes sense when you mention it.
I don't think that there is an all-in-one howto around, most infos
are scattered around the net (and most issues can be solved
with a bit of knowledge of the real time paradigm and a bit of
common sense)
>
>
> Or do I just have to do this for a few years and learn the hard way?
> :-)
Most developers seems to do so, they are just too lazy to think
about the constraints that real time programming imposes.
They believe they can make full use of the operating system,
call any system calls they like, C++ constructors, malloc()s etc,
accesss to mutexes locked by low priority GUI threads
and then after wonder why their application does not work with
low latencies or why there are sporadic dropouts they cannot get rid of.
most problems go away if you increase the buffer sizes (thus latency)
to let's say 20-50 msec, but as we know any soft-instrument with
bigger than 15-20msec latencies becomes unplayable
(measured by professional standards).
Anyway there are not many rules to follow:
run the audio thread SCHED_FIFO
(and do not use SCHED_FIFO on other threads, except
when you know exactly what you are doing).
in the audio thread just do not call any system calls except
read/write to the audio device .
especially file system ops memory allocation, calling C++
constructors/destructors (cause memory allocation/deallocation)
etc. Basically any operation that could possibly be blocked
because it has to wait for some event, data, etc.
Do all communication between audio thread and other threads
via lock free FIFOs or shared mem.
Avoid mutexes like they were radioactive material.
(there are a few execptions where they are allowed
like using mutexes between two real time threads where you know
that they will not tie up the CPU for more than a certain amount of time,
or using pthread_mudex_trylock() in the audio thread that
tries to acquire the mutex but if it fails it returns immediately
without stalling).
For example Ardour is well designed in this regard, and this is why
Paul is an experianced programmer (and probably learned some RT issues
the hard way too).
Unfortunately many audio apps on linux do not meet "low latency standards"
or better are not designed with real time safeness in mind and I think
it is one of the obstacles that keep them out of the professional
domain making them look like a toy.
It is sad because there are many nice apps with an excellent
sound generation engine, but often the framework around that engine
is weak.
It does not that actually that much energy to fix it but people
seem either too lazy to do that or either do not know what the
RT-safeness guidelines are. I never understood it ...
it is much more complex to desing a synthesis algorithm, etc
than just avoiding a few mutexes and use a lockfree-fifo instead etc.
Anyway I agree it would be cool to have page on the LAD site that
explain all these issues and provide source for some basic routines
and classes. This would prevent that the mistakes are made
all over again.
cheers,
Benno
http://linuxsampler.sourceforge.net
-------------------------------------------------
This mail sent through http://www.gardena.net
Hallo,
hat jemand von euch in der aktuellen Keyboards die Antwort von
Herrn Hain auf die Leseranfrage zu Linux und Audio gelesen? Die
strotzt ja nur so von Unwissen, das schier danach schreit eines
besseren belehrt zu werden. Vielleicht könnten wir ja gemeinsam
eine Antwort erarbeiten.
Bei Interesse könnte ich heute abend auch den Text von Frage und
Antwort hier posten (leider gibt's die Leserbriefe nicht auf der
Keyboards Webseite).
So long
Uwe
--
voiceINTERconnect www.voiceinterconnect.de
... smart speech applications from germany
I too have a pair of Midiman 24/96's, and they sound great.
I've been toying with .asoundrc (I've read the RME Hammerfall config and
the TwoCardsAsOne page too), and so far I dont have what I want.
I looking for both cards to function in sync, as a four (or eight?) -
track recording platform.
Can someone point me in the right direction with my .asoundrc file,
and jackd options? how do i ensure the cards are synched?
Dear Sir,
I need your help,I am John Mboma the son of a
Late minister during the reign of mobutu seseko,
I came to know you in the course of my search for
a reliable and God fearing partner and I decide
to contact you because I believe you are a reputable
person and I felt you can help us over this confidential
matter. I count on your intergrity and honesty to be
able to handle this business.
My father was a minister in Democratic Republic of
Congo during the reign of Late President Mobutu.
Our father was killed during the rebel attack and
our house was burnt. We manage to escape to South
Africa with my mother and two of my sisters
where we are now taking refuge.Before the death of
my father he deposited US$30.5 MILLION, with a security
company in Europe.The money is kept in a trunk boxes
and was registered as precious substance. Thus there is
nobody that knows that it is money that is in the box.
All the document with which the money was deposited
is with us. I am looking for somebody to that is
capable and willing to travel to Europe Country to
receive the two trunk boxes of money on behalf of my
family from the security company.
We need a trust worthy and experience person that
will help us to invest this money in your country and
take us as one family and will also buy a house for us
over there where we can live safely.
We are expecting to hear from you.Please contact me
on this Email Address: johnmboma(a)uymail.com
Thanks for your anticipated and cooperation.please
include your telephone number and fax number in
your reply
Best Regards,
John Mboma.
EL GORDO SWEEPSTAKE LOTTERY COMPANY S.L
PLAZA COLONE-28080
MADRID-SPAIN.
FROM: THE DESK OF THE MANAGING DIRECTOR INTERNATIONAL PROMOTIONS/PRICE AWARD DEPARTMENT.
REF N�: EGSL/25003127/CSL/02
BATCH N�: 0007571982
DEAR FRIEND,
RE: AWARD NOTIFICATION/ FINAL NOTICE.
We are pleased to inform you of the release of the results EL GORDO SPANISH SWEEPSTAKE LOTTERY/ INTERNATIONAL PROGRAM, Held 12THJuly 2003. Your name attached to a ticket number 025-1146992-750 with serial number 2113-05 drew the lucky numbers 4-18-24-30-31-35 which consequently won the lottery in the 3rd category. You have therefore been approved for a lump sum payout of 625,000.39 (Six hundred and twenty five thousand dollars and thirty-nine cents) in cash credited to the file reference number: EGSL/25003127/CSL/02. This is the from a total cash price of 5,368,770.00 (Five million three hundred and sixty-eight thousand, seven hundred and seventy dollars only) shared among the seventeen international winners in this category.
CONGRATULATIONS!!!
Your fund is now deposited with a Trust and Security Company insured to your name.
We advice that you keep this award from public notice until your claiming or unwarranted taking advantage of this program by participants. All participants were selected through a computer ballot system drawn from 25,000 names from Asia, Africa, Australia, Canada, U.S.A. ,New Zealand, Europe and North America as part of our international promotions program which we conduct once every year. We hope that with part of your prize, you will part-take in our end of year high stake $1,300,000,000.00 international lottery.
To begin your claim please contact your claim agent, Mr. William Lopez, foreign services manager, payment and release order department, Tel: +34 696 023 002, OR via Email: superstandard(a)terra.es for processing and remittance of your prize fund into your designated bank account.
Note: All prize funds must be claimed before the end of September 2003 after this date all funds will be returned to the MINISTERIO DE ECONOMIA Y HACIENDA as unclaimed. In order to avoid unnecessary delays and complications, please endeavour to quote your reference and batch numbers in every correspondence with us to your claim agent. Furthermore, should there be any change in your address do inform your claim agent as soon as possible. Congratulation once again from all members of our staff and thank you for being part of our promotion program.
N.B. Any breach of confidentiality on the part of the winners will result to disqualification. Please do not reply to this email address. Contact your claim agent.
Best regards
The Management.
From; Mr. Michael Makeh,
Banque Financiere De L'Afrique,
Lome-Togo.
My dear,
I wish this my proposal will not come to you as a surprise. I am Mr. Michael Makeh, with Banque Financier De L'Afrique with regional office in Lome-Togo. We had a foreign client (Mohamed Hussein Hanadi ), who deposited the sum of US$7.8 million (Seven Million Eight Hundred Thousand United States Dollars) with our bank. Unfortunately,this client was among the victims of EGYPTAIR FLIGHT NO.990 that crashed on the 31-10-1999 in the atlantic ocean, U.S.A. Confirmable from the website; ( www.cnn.com/us/9911/02/egyptair990.list/index.html ). But, since that year after the death of our client, we have not had anybody that comes for the claims of this money as the next of kin to our client. A situation I have monitored closely with my position in our bank.
Now, having monitored this deposit and managed it over the years before and after his death, and hence nobody has showed up as the next of kin for the past years now, I have removed the file to my "private vault". I now humbly solicit for your assistance in this issue. I wish to present you as the next of kin to this our client so as to claim out this money, before it is remmited into the fedral account where other people may aswell claim it directly without going to this lenght. I have taken every necessary precautionary measures concerning this issue and arrangement has been concluded by me in achieving this goal, provided you will follow my instructions in the process. I am only waiting for your response to enable me move the funds to your agreed safe account. This does not have any risk attached to it as all the internal documentations would be handled by me and every loop holes sealed also provided you give me your assistance and support.
I therefore request you to confirm your interest by a return message and I will furnish you with the full details and what to do concerning this deal. What you stand to gain would be discussed and it is negotiable before the deal commences.
Thank you in anticipation of your urgent response to my request stating your wish in this deal.
Kind regards,
Mr. Michael Makeh.