Data files in memory? 
Author Message
 Data files in memory?

Hi,

I need to load aiff and pict files into memory then access them. I can't
access the files directly from disk.

1) Is there any way to play a sound file (aiff and wav) using a handle to
the file laoded into memory?

2) And also to diplay a pict file using a handle to the file loaded into
memory?

Thanks,

Paul



Fri, 30 Jan 2004 14:54:21 GMT  
 Data files in memory?

Quote:

> I need to load aiff and pict files into memory then access them. I can't
> access the files directly from disk.

Load from where? If they are not coming from disk, where are they coming
from - outer space?

Seriously, at SOME point you surely do have to load the files from disk.
And when you do, there they are, loaded into memory. The sound file will
be a Movie (folderitem.openasmovie) and you can play it at any time with a
movieplayer. The picture will be a Picture (folderitem.openaspicture) and
you can do anything you like with it.

Quote:
> 1) Is there any way to play a sound file (aiff and wav) using a handle to
> the file laoded into memory?
> 2) And also to diplay a pict file using a handle to the file loaded into
> memory?

What is a "handle to the file loaded into memory"? Do you mean a "(handle
to the file) which is (loaded into memory)", or a "handle to (the file in
memory)"? If the former, you maintain a FolderItem and use it to open the
file as needed. If the latter, I've just answered that; you've got a Movie
instance or a Picture instance and you just use them. m.

--

*** REALbasic, The Definitive Guide! ***
http://www.oreilly.com/catalog/realbasic/



Fri, 30 Jan 2004 22:44:35 GMT  
 Data files in memory?

Quote:

> Hi,

> I need to load aiff and pict files into memory then access them. I can't
> access the files directly from disk.

> 1) Is there any way to play a sound file (aiff and wav) using a handle to
> the file laoded into memory?

> 2) And also to diplay a pict file using a handle to the file loaded into
> memory?

Could both be done using plugins but handles are not the thing for RB
itself!

Mfg
Christian

--
Windows 98 - echtes Multitasking:
Gleichzeitig booten und abstuerzen.
http://www.christians-software.de (Kostenlose Mac/Win Software)



Sat, 31 Jan 2004 00:25:27 GMT  
 Data files in memory?

Quote:


> > 1) Is there any way to play a sound file (aiff and wav) using a handle to
> > the file laoded into memory?

> > 2) And also to diplay a pict file using a handle to the file loaded into
> > memory?

> Could both be done using plugins but handles are not the thing for RB
> itself!

No, Christian, that's not true. You can work perfectly well with handles
using RB, without plug-ins (see the "Sharpening Pointers and Grasping
Handles" section of my book).

But I'm suggesting that the original questioner doesn't really need to do
this. He may be using a technical term ("handle") when he just means
something non-technical (e.g. picture data and a way to refer to it, which
a Picture object would take care of just fine). m.

--

*** REALbasic, The Definitive Guide! ***
http://www.oreilly.com/catalog/realbasic/



Sat, 31 Jan 2004 00:44:21 GMT  
 Data files in memory?
Hi,

Quote:
> Load from where? If they are not coming from disk, where are they coming
> from - outer space?

My data files are concatenated together and so I seek to the appropriate
position within the data file and read x bytes which may be a pict or aiff
file and use it accordingly.

Quote:
> What is a "handle to the file loaded into memory"? Do you mean a "(handle
> to the file) which is (loaded into memory)", or a "handle to (the file in
> memory)"? If the former, you maintain a FolderItem and use it to open the
> file as needed. If the latter, I've just answered that; you've got a Movie
> instance or a Picture instance and you just use them. m.

It a handle to the (file in memory). Doesn't QT usually require the file on
disk not preloaded into memory?

Thanks,

Paul



Sat, 31 Jan 2004 06:58:20 GMT  
 Data files in memory?

Quote:

> My data files are concatenated together and so I seek to the appropriate
> position within the data file and read x bytes which may be a pict or aiff
> file and use it accordingly.

There is no native way to convert from raw data to a Picture or a Movie.
So you would have to load the data as a string, save just the right part
of it to disk as a temporary file, then open that file as a Picture (if
it's the picture part of the data) or a Movie (if it's the movie part of
the data) to get the conversion. You can keep temporary files invisibly in
the TemporaryItems folder.

But I must say this is a very odd way to store data. If you want to store
multiple entities in a single file, why don't you store them as resources?
That is what resources were invented for. You can open a 'PICT' resource
or a 'moov' resource directly (pp. 464 of my book) as a Picture or a
Movie.

Hope this helps.

m.

--

*** REALbasic, The Definitive Guide! ***
http://www.oreilly.com/catalog/realbasic/



Sat, 31 Jan 2004 07:21:57 GMT  
 Data files in memory?
Hi,

Matt, thanks for your help.

Quote:
> But I must say this is a very odd way to store data. If you want to store
> multiple entities in a single file, why don't you store them as resources?
> That is what resources were invented for. You can open a 'PICT' resource
> or a 'moov' resource directly (pp. 464 of my book) as a Picture or a
> Movie.

My app is written in C/C++ (CodeWarrior on Mac & MSVC 5.0 on Win) and was
thinking about re-writing it in REALBasic just to take advantage of the
Sockets and Canvas animation among other things. (I'm self-taught and depend
on books and sample code to do even the simpliest things.)

I actually use PCX images as I had sample code for Win & Mac, and AIFF as I
managed to convert it to WAV at run-time for Win.

It has to be for both Mac and Win and this was the easiest way to do it
without having to duplicate anything. I have about 15,000 raw data files
(yes, fif{*filter*} thousand!) totaling 300meg before I concatenate them into
about 100 separate related files.

With so much data it's just too cumbersome to manage it without
concatenation. Then most QuickTime functions are useless as they want
individual files for .wav, .pic, .mov etc.

Paul



Quote:


>> My data files are concatenated together and so I seek to the appropriate
>> position within the data file and read x bytes which may be a pict or aiff
>> file and use it accordingly.

> There is no native way to convert from raw data to a Picture or a Movie.
> So you would have to load the data as a string, save just the right part
> of it to disk as a temporary file, then open that file as a Picture (if
> it's the picture part of the data) or a Movie (if it's the movie part of
> the data) to get the conversion. You can keep temporary files invisibly in
> the TemporaryItems folder.

> Hope this helps.

> m.



Sat, 31 Jan 2004 16:05:34 GMT  
 Data files in memory?
In article

Quote:

> There is no native way to convert from raw data to a Picture or a Movie.
> So you would have to load the data as a string, save just the right part
> of it to disk as a temporary file, then open that file as a Picture

Or you use the dmGraphicUtilities-Plugin from my website, which will
convert data in strings into valid picture-references. Visit
<http://www.digitalmind.de/realbasic> for more information

HTH, Stephan



Sat, 31 Jan 2004 18:56:28 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Out of memory during indexing data file.

2. Read VFP data files into Clipper data files

3. I have 100 data files, I want to join them together as one data file

4. Unix Data files vs DOS data files

5. non-gridded ASCII data file to netCDF data file

6. Ms SQL fileerror 22001=String data, right truncation when I fill data into file

7. Reading a data file from a very remote data

8. Using file data transparently as internal data?

9. help reading negative values in data file - test code and test data

10. How to recup data with Access or Excel from Cobol Data with *.ISM and *.IDX file

11. Extracting data from COBOL data files

12. distutils, data files, and data sources

 

 
Powered by phpBB® Forum Software