Commit 7e59ec88 authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL
Browse files

Import of ESP Player front end

Special thanks to Dr. Andy Pierson (ESP) and Alan Gibson (Liquid Silicon) for
taking the time to locate the sources, and agreeing to them being published.
This is Player 1.37a, though note an earlier dated version 1.39 also exists,
yet to be merged.
parents
|
| Copyright (c) 2021, RISC OS Open Ltd
| All rights reserved.
|
| Redistribution and use in source and binary forms, with or without
| modification, are permitted provided that the following conditions are met:
| * Redistributions of source code must retain the above copyright
| notice, this list of conditions and the following disclaimer.
| * Redistributions in binary form must reproduce the above copyright
| notice, this list of conditions and the following disclaimer in the
| documentation and/or other materials provided with the distribution.
| * Neither the name of RISC OS Open Ltd nor the names of its contributors
| may be used to endorse or promote products derived from this software
| without specific prior written permission.
|
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
| POSSIBILITY OF SUCH DAMAGE.
|
Dir <Obey$Dir>
amu_machine clean
stripdepnd
|
| Copyright (c) 2021, RISC OS Open Ltd
| All rights reserved.
|
| Redistribution and use in source and binary forms, with or without
| modification, are permitted provided that the following conditions are met:
| * Redistributions of source code must retain the above copyright
| notice, this list of conditions and the following disclaimer.
| * Redistributions in binary form must reproduce the above copyright
| notice, this list of conditions and the following disclaimer in the
| documentation and/or other materials provided with the distribution.
| * Neither the name of RISC OS Open Ltd nor the names of its contributors
| may be used to endorse or promote products derived from this software
| without specific prior written permission.
|
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
| POSSIBILITY OF SUCH DAMAGE.
|
Dir <Obey$Dir>
amu_machine install INSTDIR=<install$dir>.HardDisc4.Apps
*,ffb gitlab-language=bbcbasic linguist-language=bbcbasic linguist-detectable=true
bas/** gitlab-language=bbcbasic linguist-language=bbcbasic linguist-detectable=true
Copyright (c) 1994, Expressive Software Projects
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Expressive Software Projects nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Copyright (c) 2021, RISC OS Open Ltd
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of RISC OS Open Ltd nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Makefile for Player
#
COMPONENT = Player
TARGET = !RunImage
CUSTOMLINK = custom
INSTTYPE = app
INSTAPP_FILES = !Boot !Run !RunImage !Help Templates\
!Sprites !Sprites22 Sprites Sprites22 CheckSound
INSTAPP_VERSION = Messages
INSTAPP_DEPENDS = !RunImage
include CApp
!RunImage: bas${SEP}PlayerSrc
${RUN}BasCrunch -1 bas${SEP}PlayerSrc $@
# Dynamic dependencies:
| !Player boot file
If "<File$Type_BF7>" = "" Then Set File$Type_BF7 RIFF
If "<File$Type_FB1>" = "" Then Set File$Type_FB1 WaveForm
If "<File$Type_D3C>" = "" Then Set File$Type_D3C ArmSamp
Iconsprites <Obey$Dir>.!Sprites
| !Player Run file
Wimpslot -min 90K -max 90K
If "<File$Type_BF7>" = "" Then Set File$Type_BF7 RIFF
If "<File$Type_FB1>" = "" Then Set File$Type_FB1 WaveForm
If "<File$Type_D3C>" = "" Then Set File$Type_D3C ArmSamp
Iconsprites <Obey$Dir>.!Sprites
|RMEnsure RealTime 0.01 RMload System:Modules.RTime
Set Player$Dir <Obey$Dir>
Run <Player$Dir>.CheckSound
Wimpslot -min 90K -max 90K
/<Player$Dir>.!RunImage %*0
!Player can play MIDI files (through MIDIPort 0, i.e. the default MIDI OUT
port) and sound sample player (through SharedSound). Sample formats supported
are: ArmMovie, 'Data', Armadeus, AudioWrk, WaveForm (WAV), Riff, DOS and
Modules.
For sales and support, please contact sales@liquid-silicon.com and NOT ESP.
!Player history
===============
1.37 26/32-bit neutral modules. Requires RISC OS 3.50 or later.
Fixed MIDIPlay module, had problems with dynamic areas. Now doesn't
use them.
Removed hourglass when playing samples.
Stopped Menu button confusingly activating the icons.
Fixed Control button bring greyed out unless loading a MIDI file
first. Don't know if this was a bug or a feature!
File/song name increased from 10 to 16 characters.
Now resets song pointer on new sample loads.
1.37a Had left some test lines in e.g. when dragging an unknown file in.
There appear to be some issues on 8-bit sound Risc PCs, where the sound can
sometimes give crackles or white noise after pressing Stop. This hasn't been
tracked down. Usually having !Synth loaded solves the problems.
# ESP Sample Player Messages
# ESP MAY 1994,Dec 1996
# 0.2 04/12/96
#
# -- Icon menu contains 2 items
iconM0:Player
iconM1:Info
iconM2:Quit
#
# -- Sample rate title
rateM0:Sample rate
#
# -- Bit messages
Bit4:4 bit
Bit8:8 bit
Bit12:12 bit
Bit16:16 bit
#
# -- Error/Report messages
Report0:Incorrect file type
Report1:Don't know how to play %1 files; play %2 as raw data?
Report2:Sample rate must be greater than or equal to 1000 Hz
Report3:ADPCM sample rates can only be taken from those in the menu list
Report4:Movie does not contain sound
Report5:Sound playback not available
Report6:MIDI playback not available
#
/* (1.37)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 1.37
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 18 Apr 2007
#define Module_MajorVersion "1.37"
#define Module_Version 137
#define Module_MinorVersion ""
#define Module_Date "18 Apr 2007"
#define Module_ApplicationDate "18-Apr-07"
#define Module_ComponentName "Player"
#define Module_FullVersion "1.37"
#define Module_HelpVersion "1.37 (18 Apr 2007)"
#define Module_LibraryVersionInfo "1:37"
REM >!RunImage
REM Copyright (c) 1994, Expressive Software Projects
REM All rights reserved.
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions are met:
REM * Redistributions of source code must retain the above copyright
REM notice, this list of conditions and the following disclaimer.
REM * Redistributions in binary form must reproduce the above copyright
REM notice, this list of conditions and the following disclaimer in the
REM documentation and/or other materials provided with the distribution.
REM * Neither the name of Expressive Software Projects nor the names of its
REM contributors may be used to endorse or promote products derived from
REM this software without specific prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
REM ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
REM WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
REM DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
REM DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
REM (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
REM LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
REM (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
REM SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
REM
d$=" (18 Apr 2007)"
v$="1.37a"
REM Sample Player - Using ESP Module
REM MIDI Player - Using ESP MIDIPlay
REM Version including WIMP File Message handling
REM 1.35x Is first attempt at RealTime Synch
REM 1.37 (26/32-bit neutral) on maintained by Liquid Silicon
ON ERROR PROCErr
PROCMakeDims
PROCSet
PROCStartWimp
rcode%=FNCheckRealTime
PROCLoadWimpSprites
PROCLoadWindows
PROCLoadMenus
PROCGetType(TRUE,TRUE)
REMPROCshadeIcon(playerWin%,playerMenuIcon%,TRUE):REM 1.37 - Didn't allow access to Control window when loading a sample before a MIDI file.
PROCSetVolume(currentVolume%)
ON ERROR PROCError
PROCGo
END
REM ---------------------------------------
DEFPROCGo
quit%=FALSE
Control%=0
oldmtime%=0
REPEAT
PROCpoll
IF playOn%=TRUE THEN
CASE playType% OF
WHEN playWAVE%
SYS"Audio_Poll" TO posn%,stop%:REM ,R2%,R3%,R4%,R5%
REM PROCe("R2="+STR$(R2%)+" R3="+STR$(R3%)+" R4="+STR$(R4%)+" R5="+STR$(R5%))
PROCSetTime(posn%)
REM *********SYS "SharedSound_CheckDriver"
REM SYS "SharedSound_CheckDriver" :REM 1.37 It needs this
:REM for some reason to
:REM fix sample rate
REM SYS"Sound_LinearHandler",0 TO ,newHand%
REM IF newHand%=0 THEN stop%=TRUE
WHEN playMIDI%
SYS"XMIDIPlay_Info" TO L%,posn%,stop%,mtext%:stop%=stop% EOR 1
IF ?mtext%<>mtx% THEN
mtx%=?mtext%
IF mtx%=1 THEN
mtext$=FNstring(mtext%+1)
ELSE
mtext$=mtext$+FNstring(mtext%+1)
ENDIF
$MControlTextPtr%=mtext$
PROCSetIcon(MControlWin%,MControlText%,FALSE)
ENDIF
IF L%>midiLen% THEN midiLen%=L%
REM PROCe("Len: "+STR$(midiLen%)+" posn:"+STR$(posn%)+" stop:"+STR$(stop%))
IF (stop%AND1) AND (NOT pause%) THEN
IF loop% THEN
stop%=FALSE
posn%=0
SYS"XMIDIPlay_Start",0,posn%
ELSE
stop%=TRUE
ENDIF
ELSE
stop%=FALSE
PROCSetTime(posn%)
ENDIF
ENDCASE
IF stop% THEN
PROCStop(FALSE)
PROCSetIcon(playerWin%,playerStop%,FALSE)
posn%=0
ENDIF
ENDIF
IF dragOn% THEN
MOUSE X%,Y%,B%
CASE whichDrag% OF
WHEN dragTime%
PROCChangeTime(X%)
WHEN dragVolume%
PROCChangeVol(X%)
WHEN dragTempo%
PROCChangeTempo(X%)
ENDCASE
ENDIF
UNTIL quit%
PROCShutDown
ENDPROC
DEFPROCShutDown
PROCStop(FALSE)
IF playType%=playWAVE% THEN
*RMREINIT SamplePlayer
ENDIF
SYS"Wimp_CloseDown",taskHandle%,Z%
ENDPROC
DEFPROCpoll
SYS"Wimp_Poll",,pollSpace% TO reason%
REM PROCe("Memory:"+STR$(HIMEM-END))
CASE reason% OF
WHEN 1:REM PROCRedrawWindow
WHEN 2:PROCOpenWindow(0,pollSpace%)
WHEN 3:PROCCloseWindow(pollSpace%)
WHEN 4:REM
WHEN 5:REM
WHEN 6:PROCMouse(!pollSpace%,pollSpace%!4,pollSpace%!8,pollSpace%!12,pollSpace%!16)
WHEN 7:dragOn%=FALSE
WHEN 8:REM Key
WHEN 9:PROCDecodeMenu(pollSpace%)
WHEN 17,18:REM Message
CASE pollSpace%!16 OF
WHEN 0:quit%=TRUE
WHEN &400C1:REM Read mode
OTHERWISE: PROCmessage
ENDCASE
ENDCASE
ENDPROC
REM ------------------- Mouse handling
DEFPROCMouse(X%,Y%,button%,handle%,icon%)
shift%=INKEY(-1)
CASE handle% OF
WHEN -2
CASE button% OF
WHEN 4:PROCOpenWindow(playerWin%,-1)
WHEN 2:PROCOpenMenu(iconMenuPtr%,iconMenuNum%,iconM%,X%,180)
ENDCASE
WHEN playerWin% AND button%<>2 :REM 1.37 Disable menu button
CASE icon% OF
WHEN playerMenuIcon%:
CASE playType% OF
WHEN playWAVE%
PROCGetType(FALSE,FALSE)
SYS"Wimp_CreateMenu",,optionWin%,X%,Y%
WHEN playMIDI%
SYS"Wimp_CreateMenu",,MControlWin%,X%,Y%
ENDCASE
WHEN playerPlay% : IF NOT playOn% THEN PROCPlay
WHEN playerStop% : PROCStop(playOn%=FALSE)
WHEN playerLoop% : loop%=NOT loop%:loopCount%=0:PROCLoop
WHEN playerPause% : pause%=NOT pause%:PROCPause
WHEN playerVolBar% :
CASE button% OF
WHEN 4 :PROCChangeVol(X%)
WHEN 4*16:PROCstartDrag(handle%,icon%,X%,Y%,dragVolume%)
ENDCASE
WHEN playerTimeBar% :
IF dataLoad% THEN
CASE button% OF
WHEN 4 :PROCChangeTime(X%)
WHEN 4*16:PROCstartDrag(handle%,icon%,X%,Y%,dragTime%)
ENDCASE
ENDIF
WHEN playerVolLeft% : PROCSetVolume((button%=4)+256*(button%=1))
WHEN playerVolRight%: PROCSetVolume((button%=1)+256*(button%=4))
WHEN playerMute% : mute%=NOT mute%:PROCMute
WHEN playerRewind% : PROCMovePlay(-1+shift%*9)
WHEN playerForward% : PROCMovePlay(1-shift%*9)
ENDCASE
WHEN optionWin%
CASE icon% OF
WHEN optionsSRateUp% :PROCRateChange(button%,4,1)
WHEN optionsSRateDown%:PROCRateChange(button%,1,4)
WHEN optionsRateMenu% :PROCOpenMenu(rateMenuPtr%,rateMenuNum%,rateM%,X%,Y%)
WHEN optionsOK%:
PROCStop(TRUE)
IF button%=1 OR button%=4 THEN PROCGetType(TRUE,TRUE)
IF button%=4 THEN SYS"Wimp_CreateMenu",,-1
WHEN optionsCancel%
IF button%=4 THEN SYS"Wimp_CreateMenu",,-1
ENDCASE
PROCGetType(TRUE,FALSE)
WHEN MControlWin%
CASE icon% OF
WHEN MControlTempoLeft% : PROCSetTempo((button%=4)*(1-shift%*8)+(button%=1)*(shift%*8-1))
WHEN MControlTempoRight%: PROCSetTempo((button%=4)*(shift%*8-1)+(button%=1)*(1-shift%*8))
WHEN MControlTempoBar% :
CASE button% OF
WHEN 4 :PROCChangeTempo(X%)
WHEN 4*16:PROCstartDrag(handle%,icon%,X%,Y%,dragTempo%)
ENDCASE
ENDCASE
ENDCASE
ENDPROC
DEFPROCRateChange(button%,b1%,b2%)
A%=VAL($optionsSRatePtr%)
IF button%>-1 THEN
IF button%=b1% THEN B%=A%+1-shift%*9
IF button%=b2% THEN B%=A%-1+shift%*9
IF B%>99999 THEN B%=99999
IF B%<1000 THEN B%=1000
ELSE
B%=b1%
ENDIF
IF B%<>A% THEN
SYS"Wimp_SetCaretPosition",-1
$optionsSRatePtr%=STR$(B%)
!T%=optionWin%:T%!4=optionsSampleRate%:T%!8=0:T%!12=0
SYS"Wimp_SetIconState",,T%
ENDIF
ENDPROC
DEFPROCChangeVol(X%)
!Z%=playerWin%
SYS "Wimp_GetWindowState",,Z%
D%=Z%+256
!D%=playerWin%
D%!4=playerVolBar%
SYS"Wimp_GetIconState",,D%
V%=(X%-(Z%!4)-(D%!8))/4
IF V%<0 THEN V%=0
IF V%>128 THEN V%=128
PROCSetVolume(V%)
ENDPROC
DEFPROCChangeTime(X%)
LOCAL t%,p%
!Z%=playerWin%
SYS "Wimp_GetWindowState",,Z%
D%=Z%+256
!D%=playerWin%
D%!4=playerTimeBar%
SYS"Wimp_GetIconState",,D%
t%=(X%-(Z%!4)-(D%!8))/2
CASE playType% OF
WHEN playWAVE%
t%=(armLen%*t%)/barWidth%
IF t%<0 THEN t%=0
IF t%>armLen% THEN t%=armLen%
t%=((t%*8)/sampleBits%)/channels%
WHEN playMIDI%
t%=(midiLen%*t%)/barWidth%
IF t%<0 THEN t%=0
IF t%>midiLen% THEN t%=midiLen%
ENDCASE
IF playOn% THEN
p%=playOn%
PROCStop(FALSE)
posn%=t%
IF p%=TRUE THEN PROCPlay ELSE PROCSetTime(posn%)
ELSE
posn%=t%
PROCSetTime(posn%)
ENDIF
REM PROCe("Position = "+STR$(posn%))
ENDPROC
DEFPROCChangeTempo(X%)
LOCAL t%,p%
!Z%=MControlWin%
SYS "Wimp_GetWindowState",,Z%
D%=Z%+256
!D%=MControlWin%
D%!4=MControlTempoBar%
SYS"Wimp_GetIconState",,D%
t%=(X%-(Z%!4)-(D%!8))/2
t%=(tempoMax%*t%)/tempoWidth%
IF t%<0 THEN t%=0
IF t%>tempoMax% THEN t%=tempoMax%
PROCSetTempo(t%-tempo%)
ENDPROC
REM ---------------- Window handling
DEFPROCOpenWindow(handle%,blk%)
IF blk%<=0 THEN
!Z%=handle%
SYS "Wimp_GetWindowState",,Z%
IF blk%<0 THEN Z%!28=-1
blk%=Z%
ENDIF
SYS "Wimp_OpenWindow",,blk%
ENDPROC
DEFPROCCloseWindow(blk%)
SYS "Wimp_CloseWindow",,blk%
ENDPROC
DEFFNwindowOpen(H%):!Z%=H%:SYS"Wimp_GetWindowState",,Z%:=(((Z%!32) AND (1<<16))<>0)
DEFFNwx(X%,R%)=X%-(R%!20)+(R%!4)
DEFFNwy(Y%,R%)=Y%-(R%!24)+(R%!16)
DEFPROCstartDrag(handle%,icon%,X%,Y%,which%)
!Z%=handle%
SYS"Wimp_GetWindowState",,Z%
D%=Z%+256
!D%=handle%
D%!4=icon%
SYS"Wimp_GetIconState",,D%
!T%=handle%
T%!4=7
T%!8=X%
T%!12=Y%
T%!16=X%
T%!20=Y%
IF which%=dragTime% THEN O%=barWidth% ELSE O%=volWidth%
O%=(((D%!16)-(D%!8))/2)-O%
T%!24=FNwx(D%!8,Z%)+O%
T%!28=FNwy(D%!12,Z%)
T%!32=FNwx(D%!16,Z%)-O%
T%!36=FNwy(D%!20,Z%)
SYS"Wimp_DragBox",,T%
whichDrag%=which%
dragOn%=TRUE
ENDPROC
DEFPROCGetType(set%,player%)
LOCAL V%,type%,bits,chans%,S%,rev%,inter%
CASE playType% OF
WHEN playMIDI%:
$playerDescPtr%="MIDI"
WHEN playWAVE%:
IF player% THEN P%=playerDescPtr%:$P%=""
IF set% THEN V%=FNwhichIcon(optionWin%,optionsTypeESG%) ELSE V%=-1
CASE V% OF
WHEN optionsSignedLin%
IF player% THEN $P%=$optionsSignedLinText%
type%=signedLin%
WHEN optionsUnsignedLin%
IF player% THEN $P%=$optionsUnsignedLinText%
type%=unsignedLin%
WHEN optionsArcLog%
IF player% THEN $P%=$optionsArcLogText%
type%=arcLog%
WHEN optionsADPCM%
IF player% THEN $P%=$optionsADPCMText%
type%=adpcm%
OTHERWISE
type%=sampleType%
CASE sampleType% OF
WHEN signedLin%
A%=optionsSignedLinText%
B%=optionsSignedLin%
WHEN unsignedLin%
A%=optionsUnsignedLinText%
B%=optionsUnsignedLin%
WHEN arcLog%
A%=optionsArcLogText%
B%=optionsArcLog%
WHEN adpcm%
A%=optionsADPCMText%
B%=optionsADPCM%
ENDCASE