PetitFS Streaming Read - arduino

Propably a pretty stupid/simple question:
I'm using the arduino wrapper of Petit FS and I'm trying to do a streaming read of data into a FIFO.
The Library says it supports streaming read and I need to pass buffer=NULL to activate it but I can't figure out which method I need to implement/Rewrite/Overrite to handle my data while reading/streaming
Can anyone help me out?
Never mind, in the avr_mmcp file, is a constant defining a function which is used as streaming function. No idea how I missed it.

In the avr_mmcp file, is a constant defining a function which is used as streaming function.

Related

How to create a program from the program's code rather than from it's filename

Using the typescript compiler api I can easily create a Program with
let program = ts.createProgram([file], {});
where file is the filename, but is there a way to do this with the actual code instead?
To do this, you will need to provide a custom ts.CompilerHost. On that interface you can provide a getSourceFile method that provides a source file with the text you want.
Doing this is a lot of work though. It might be faster to use ts-morph/bootstrap which will handle a lot of this for you.

Convert InputStream to Mediaplayer

I use android platform . I have file in InputStream Datatybe , I want to convert it to MediaPlayer and play it
I have two suggestions for you:
Get the entire input into a properly formatted file, and pass that file to MediaPlayer. You're going to have to figure out if your data is formatted properly and how to format it.
Instead of using MediaPlayer, use MediaCodec (http://developer.android.com/reference/android/media/MediaCodec.html) where instead of passing a file or a link you're passing the data itself. With this solution, you're going to have to figure out if you're passing the data properly to Media Codec, but I suspect this is the solution you're looking for. The google documentation does have an example to get you started a bit.
Good luck to you!
What is the format of the data? MP4?
If it is a standard container like MP4 and is a file accessible as a URI in local filesystem (file://) or network (http://) then you should use Google's ExoPlayer library, with demo code here.
I would only resort to using MediaCodec if you have a custom container or transport mechanism.

Erlang nitrogen file download

I need to provie file download feature in my nitrogen app.
In principle I need to set headers like this:
wf:header("Content-Disposition", "attachment; filename=\"" ++ Filename ++ "\""),
but now I can't find a function in Nitrogen API to send data blocks of my file.
I need to upload file in portions because they might be very large, in addition to that, the files are not available on the local storage but the binary data are obtained from other modules. So in practice I need to handle by myself sending blocks of data to the http stream.
Any idea, or example how to do that, what api function can be used?
The best answer I can give you is one I answered a few days ago on the Nitrogen mailing list:
There isn't a great way to deal with this.
There are two ways to deal with this:
1) Using the underlying server's streaming mechanisms (such as making
a cowboy-specific dispatch table to targets a cowboy handler module that
deals with the streaming), or a yaws outfile.
2) Using cowboy, there's a bit of a hack that can work in
simple_bridge if you're using cowboy. If your module's main() function
returns the tuple: {stream, StreamFun} where StreamFun is a function
with arity 2 that (fun(Socket, Transport) - Transport being a ranch
transport). Really, this is just a shortcut way that allows you to
use Transport:send(socket) to send data. I'll admit I haven't done
this before, but it should work with a little bit of tinkering.
Adding this as an actual option to simple_bridge and Nitrogen would
probably be worthwhile.

Using libsndfile to play sound real time c++ in qt

I am using using libsndfile read and manipulate sound files.
I am wandering what whould be the simplest way to play these sounds in real time
in Qt.
I have tried to look at QtAudioOutput, however has to use QtAudioFormat, which is
quite cumbersome to configure.
All i want is to
1) Read data using libsndfile
2) manipulate the data
3) send the buffer to an audio output library.
Try using sndfile-play to play audio files using libsndfile, or a library based on libsndfile such as ALURE
http://kcat.strangesoft.net/alure.html
You could load the audio file yourself manually using libsndfile and play the file using OpenAL. This is essentially what ALURE is doing.
You can output the audio using Phonon. Here is the piece of the docu from Phonon module
The type of the source is set by the media source itself, and is dependent on the constructor used to create it. Note that it is possible to provide data from any source by implementing a QIODevice.
Basically you have to implement your own QIODevice if you want to do it Qt way

Parse a large JSON file in ActionScript 3

I need to parse a large trace file (up to 200-300 MB) in a Flex application. I started using JSON instead of XML hoping to avoid these problems, but it did not help much. When the file is bigger than 50MB, JSON decoder can't handle it (I am using the as3corelib).
I have doing some research and I found some options:
Try to split the file: I would really like to avoid this; I don't want to change the current format of the trace files and, in addition, it would be very uncomfortable to handle.
Use a database: I was thinking of writing the trace into a SQLite database and then reading from there, but that would force me to modify the program that creates the trace file.
From your experience, what do you think of these options? Are there better options?
The program that writes the trace file is in C++.
Using AMF will give you much smaller data sizes for transfer because it is a binary, not text format. That is the best option. But, you'll need some middleware to translate the C++ program's output into AMF data.
Check out James Ward's census application for more information about benchmarks when sharing data:
http://www.jamesward.com/census/
http://www.jamesward.com/2009/06/17/blazing-fast-data-transfer-in-flex/
Maybe you could parse the file into chunks, without splitting the file itself. That supposes some work on the as3 core lib Json parser, but it should be doable, I think.
I found this library which is a lot faster than the official one: https://github.com/mherkender/actionjson
I am using it now and works perfectly. It also has asynchronous decoder and encoder

Resources