diff options
author | Chris Apers | 2005-10-12 20:36:40 +0000 |
---|---|---|
committer | Chris Apers | 2005-10-12 20:36:40 +0000 |
commit | 559bf8634c08c8291ae993f5f2fc792985e2c7c7 (patch) | |
tree | 7265ad0b157bbc128f494127fd68914f12a43bce /backends/PalmOS/Src/cd_msa.cpp | |
parent | b9cb9b6802bdd1427e595743ad3cdfbb0673b074 (diff) | |
download | scummvm-rg350-559bf8634c08c8291ae993f5f2fc792985e2c7c7.tar.gz scummvm-rg350-559bf8634c08c8291ae993f5f2fc792985e2c7c7.tar.bz2 scummvm-rg350-559bf8634c08c8291ae993f5f2fc792985e2c7c7.zip |
Added getVolume() (what the hell with these newlines :\ )
svn-id: r19047
Diffstat (limited to 'backends/PalmOS/Src/cd_msa.cpp')
-rw-r--r-- | backends/PalmOS/Src/cd_msa.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/backends/PalmOS/Src/cd_msa.cpp b/backends/PalmOS/Src/cd_msa.cpp index a91cd5eb9f..1afe41fd51 100644 --- a/backends/PalmOS/Src/cd_msa.cpp +++ b/backends/PalmOS/Src/cd_msa.cpp @@ -47,7 +47,7 @@ bool MsaCDPlayer::init() { if (!(error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) { // not found with audio adapter ?! - //if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) { + //if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) { if ((error = SysLibFind(sonySysLibNameMsa, &_msaRefNum))) if (error == sysErrLibNotFound) error = SysLibLoad(sonySysFileTMsaLib, sonySysFileCMsaLib, &_msaRefNum); @@ -57,11 +57,11 @@ bool MsaCDPlayer::init() { // this doesn't work the same way on build-in MP3 device and external MP3 devices if (!error) { //MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); // close the lib if we previously let it open (?) Need to add Notify for sonySysNotifyMsaEnforceOpenEvent just in case ... - error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum); + error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum); //if (error == msaErrAlreadyOpen) // error = MsaLibEnforceOpen(_msaRefNum, msaLibOpenModeAlbum, appFileCreator); - + //error = (error != msaErrStillOpen) ? error : errNone; } //} @@ -93,8 +93,15 @@ void MsaCDPlayer::initInternal() { e = MsaSetAlbum(_msaRefNum, _msaAlbum.albumRefNum, &dummy); // TODO : use RMC to control volume - // move this to setSolume - MsaOutSetVolume(_msaRefNum, 20, 20); + MsaOutCapabilityType capability; + MsaOutGetCapability(_msaRefNum, &capability); + _volumeLLimit = capability.volumeLLimit; + _volumeRLimit = capability.volumeRLimit; +} + +void MsaCDPlayer::setVolume(int volume) { + _volumeLevel = volume; + MsaOutSetVolume(_msaRefNum, (_volumeLLimit * volume) / 100, (_volumeRLimit * volume) / 100); } void MsaCDPlayer::release() { @@ -147,7 +154,7 @@ void MsaCDPlayer::update() { } MsaStop(_msaRefNum, true); - + if (_msaLoops == 0) return; @@ -185,13 +192,13 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration) if (!num_loops && !start_frame) return; - + _msaTrack = track + gVars->CD.firstTrack - 1; // first track >= 1 ?, not 0 (0=album) _msaLoops = num_loops; _msaStartFrame = TO_MSECS(start_frame); _msaDuration = TO_MSECS(duration); - Err e; + Err e; MemHandle trackH; // stop current play if any @@ -206,19 +213,19 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration) MsaTime msaTime; MsaTrackInfo *trackP; UInt32 SU, fullLength; - + // FIXME (?) : this enable MsaSuToTime to return the right value in some cases MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); MsaStop(_msaRefNum, true); - - // get the msa time - trackP = (MsaTrackInfo *)MemHandleLock(trackH); + + // get the msa time + trackP = (MsaTrackInfo *)MemHandleLock(trackH); MsaSuToTime(_msaRefNum, trackP->totalsu, &msaTime); SU = trackP->totalsu; MemPtrUnlock(trackP); MemHandleFree(trackH); - - // MSA frame in milli-seconds + + // MSA frame in milli-seconds fullLength = FROM_MIN(msaTime.minute); fullLength += FROM_SEC(msaTime.second); fullLength += msaTime.frame; @@ -231,7 +238,7 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration) } else { _msaTrackLength = fullLength; } - + // try to play the track if (start_frame == 0 && duration == 0) { MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); @@ -241,7 +248,7 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration) _msaTrackStartSu = (UInt32) ((float)(_msaStartFrame) / ((float)fullLength / (float)SU)); _msaTrackEndSu = (UInt32) ((float)(_msaTrackLength) / ((float)fullLength / (float)SU)); _msaTrackEndSu += _msaTrackStartSu; - + if (_msaTrackEndSu > SU) _msaTrackEndSu = SU; |