FileDocCategorySizeDatePackage
QSoundMIDIPlayBase.javaAPI DocphoneME MR2 API (J2ME)4479Wed May 02 18:00:46 BST 2007com.sun.mmedia

QSoundMIDIPlayBase

public abstract class QSoundMIDIPlayBase extends Object

Fields Summary
private int
qsMIDI
private int
globMan
private Player
player
private int
loopCount
private int
currentLoopCount
private int
lastLoopCount
private boolean
opened
Constructors Summary
QSoundMIDIPlayBase()

        globMan = QSoundHiddenManager.getMIDIGlobalPeer();
        opened = false;
    
QSoundMIDIPlayBase(Player p)

        globMan = QSoundHiddenManager.getMIDIGlobalPeer();
        player = p;
        opened = false;
    
Methods Summary
voidclose()

        nDeallocateBuffer(qsMIDI);
        nClose(globMan, qsMIDI);
        qsMIDI = 0;    
    
booleanfillBuffer(byte[] b)

        boolean r = nFillBuffer(globMan, qsMIDI, b);
        
        if(r)
        {
            if(loopCount != 0) nSetLoopCount(qsMIDI, loopCount);
        }
        
        return r;
    
abstract ControlgetControl(java.lang.String controlType)

longgetDuration()

        if(qsMIDI == 0) return Player.TIME_UNKNOWN;
                
        return ((long)(nGetDuration(qsMIDI))) * 100L;
    
longgetMediaTime()

        
        if(qsMIDI == 0) return Player.TIME_UNKNOWN;
        
        return ((long)(nGetPosition(qsMIDI))) * 100L;        
    
booleanisDone()

        boolean r = nIsDone(qsMIDI);
        
        if(!r && (loopCount != 0))
            currentLoopCount = nLoopsDone(qsMIDI);
        
        return r;
    
private native voidnClose(int gm, int qsMpeer)

private native voidnDeallocateBuffer(int qsMpeer)

private native booleannFillBuffer(int gm, int qsMpeer, byte[] buffer)

private native intnGetDuration(int peer)

private native intnGetPosition(int peer)

private native booleannIsDone(int qsMpeer)

private native intnLoopsDone(int qsMpeer)

private native intnOpen(int gm)

private native voidnSetLoopCount(int peer, int count)

private native intnSetPosition(int peer, int now)

private native voidnStart(int qsMpeer)

private native voidnStop(int qsMpeer)

intnumLoopComplete()

        int numLoops = currentLoopCount - lastLoopCount;
        
        lastLoopCount = currentLoopCount;
                        
        return numLoops;
    
booleanopen()

        return open(false);
    
booleanopen(boolean forceOpen)

        if(opened && !forceOpen)
            return opened;
        
        qsMIDI = nOpen(globMan);        
           
        opened = true;
        return opened;
    
intpeer()

        return qsMIDI;
    
Playerplayer()

        return player;
    
voidsetLoopCount(int count)

        loopCount = count;
        nSetLoopCount(qsMIDI, loopCount);
    
longsetMediaTime(long now)

        if(qsMIDI == 0) return 0;
        
        int pos = nSetPosition(qsMIDI, ((int)now/100));
        
        return ((long)pos) * 100L;
    
voidsetPlayer(Player p)

        player = p;
    
voidstart()

   
        lastLoopCount = loopCount == -1 ? 0 : loopCount;
        nStart(qsMIDI);
    
voidstop()

   
        nStop(qsMIDI);