codesimian
Class MP3

java.lang.Object
  extended by codesimian.CS<CSGeneric>
      extended by codesimian.DefaultCS
          extended by codesimian.MP3
All Implemented Interfaces:
CodeSimian

Deprecated.

@Deprecated
public class MP3
extends DefaultCS

THIS CLASS IS NOT USED. REPLACED BY SlowMP3.java. Maybe I'll finish this class later. The advantage of this class, theoretically, is it caches frames of the MP3 so more of the MP3 can be loaded (and the rest stored in compressed form).

Returns the audio data from an mp3 sound file (range -1.0 to 1.0), after a delay from downloading and decompressing only for frames that are requested at runtime or predicted to be requested soon.

mp3(fileName)
or
mp3(fileName position)
or
mp3(fileName position megabyteLimit)
or
mp3(fileName position megabyteLimit frameList)
or
mp3(fileName position megabyteLimit frameList framePredictor)

Use 1 - 5 params, leaving up to 4 of the last params as the default values.

FrameList is interpreted as a short[] array size 1152, the default mp3 frame size, but the caching is strange. A frame is not always all loaded into memory or not at all. A frame can be partially loaded, usually in multiples of 1/2^someInteger, including: 1152, 576, 288, 144, 72, 36, 18, 9. This way, when a frame is requested but can not be loaded into memory in time to play it, it sounds a little like the data that was loaded for that frame previously, but at a much lower quality. It will not skip/studder, but the frequency will decrease during those times.

1 FramePredictor is a CS whose P(1) is input and whose P(0) is output. Probably they input and output lists of integer numbers, indexs of frames. Input which frames, ON AVERAGE (for efficiency), are input and in which order, as a list of indexs. Get the output, a list of indexs to load. ... Or maybe the input and output size should both equal the quantity of frames, and return a number between 0.0 and 1 depending on how probable that frame is to be used soon or how much it will probably be used, combined a little with how much it has been used recently (cant ignore the obvious events).

See Also:
the class that MP3 will make obsolete, assuming it is fast enough.

Nested Class Summary
static class MP3.DefaultMP3Decoder
          Deprecated.  
 
Field Summary
 CS decoder
          Deprecated. Inside a mp3 decoder:
P(1) is the bytes of an mp3 file (probably a wrapper for ByteArrayInputStream).
P(2) is a boolean array, 1 boolean for each frame, assuming false for all frames above array bounds.
P(0) is set to a list of lists of shorts (1 audio sample each short).
 CS downloader
          Deprecated. input String filename or URL of mp3 file into P(0).
 int executesUntilDecompressMore
          Deprecated. for efficiency and not too much lag time, set this to approximately 200 executions (of this CS).
 java.io.ByteArrayInputStream mp3Bytes
          Deprecated. used to decompress specific frames at runtime, usually many frames in 1 pass over mp3Bytes for efficiency
static int samplesPerFrame
          Deprecated. each sample is 16 bits
 
Fields inherited from class codesimian.CS
DESCRIPTION, END, EXECPROXY, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS
 
Constructor Summary
MP3()
          Deprecated.  
 
Method Summary
 double DForProxy()
          Deprecated. mp3(fileName position megabyteLimit frameList framePredictor)
 java.io.ByteArrayInputStream getMP3Bytes(java.lang.String fileName)
          Deprecated.  
 
Methods inherited from class codesimian.DefaultCS
B, C, countP, decrementMyFuel, deleteP, description, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, javaCode, keyword, LForProxy, LForProxy, minP, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, PType, S, setB, setC, setCountP, setD, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL, setL1, setMyFuel, setName, setObject, setP, setPrevExec, setPType, setS, setZ, start, toString, V, Z
 
Methods inherited from class codesimian.CS
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, GETS, GETZ, IForProxy, isIllusion, JForProxy, L, L, L, L, L, maxD, maxP, minD, overwrites, parent, parsePriority, PB, PC, PD, PF, PI, PJ, PL, prevB, prevC, prevF, prevI, prevJ, prevS, prevZ, proxyOf, PS, PZ, reflect, reflect, reflect6, setB, SETB, setC, SETC, setCost, SETD, setDescription, setF, SETF, setHeap, setI, SETI, setJ, SETJ, SETL, setL, setL, setParent, setParsePriority, setProxyOf, setS, SETS, setTester, setZ, SETZ, SForProxy, tester, toJavaCode, VForProxy, voidReflect, ZForProxy
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mp3Bytes

public java.io.ByteArrayInputStream mp3Bytes
Deprecated. 
used to decompress specific frames at runtime, usually many frames in 1 pass over mp3Bytes for efficiency


downloader

public CS downloader
Deprecated. 
input String filename or URL of mp3 file into P(0). Get bytes out of P(1). Use downloader.P(1).L(byte[].class) for efficiency.


samplesPerFrame

public static final int samplesPerFrame
Deprecated. 
each sample is 16 bits

See Also:
Constant Field Values

decoder

public CS decoder
Deprecated. 
Inside a mp3 decoder:
P(1) is the bytes of an mp3 file (probably a wrapper for ByteArrayInputStream).
P(2) is a boolean array, 1 boolean for each frame, assuming false for all frames above array bounds.
P(0) is set to a list of lists of shorts (1 audio sample each short). Each list in the outer list is 1 frame, samplesPerFrame quantity of samples, same as countP().

Maybe P(2) should return a short if you call S() and return (double)S()/Short.MAX_VALUE if you call D().

If P(2), the boolean array, does not exist (countP()<3), maybe it should be assumed to be all true.

defaultMP3Decoder(list(add mp3 frames here...) mp3Bytes booleanArray)


executesUntilDecompressMore

public int executesUntilDecompressMore
Deprecated. 
for efficiency and not too much lag time, set this to approximately 200 executions (of this CS). When it reaches 0, you need to set it to a positive number again.

Constructor Detail

MP3

public MP3()
Deprecated. 
Method Detail

DForProxy

public double DForProxy()
Deprecated. 
mp3(fileName position megabyteLimit frameList framePredictor)

Specified by:
DForProxy in class DefaultCS

getMP3Bytes

public java.io.ByteArrayInputStream getMP3Bytes(java.lang.String fileName)
Deprecated.