═══ 1. Disclaimer ═══ POP-Play is supplied as is with no warranty whatsoever. All I can say is that it works for me and will occupy space on your hard disk. ═══ 2. Registeration ═══ POP-Play is SHAREWARE product if you intend to use it COMMERCIALLY. Basically the rule is: If you're asking money for the product you're using POP-Play with, you have to register. Registering POP-Play gives you the right to sell an unlimited number of copies of the product you're using it for. A POP-Play registration cannot be transferred from one person to another, or from one person to a company, or from one company to another company. To register send $20 USD to: Seppo Lehikoinen Kolmas linja 19 D 87 00530 Helsinki FINLAND slehiko@ibm.net ═══ 3. Rexx interface functions ═══ subchapters: PopAddWav PopChannels PopDropFuncs PopGetPatPos PopGetSongBPM PopGetSongPos PopGetSongSpeed PopGetVolume PopInfo PopInitWav PopLoadFuncs PopMaxSongPos PopNextSongPos PopPause PopPlay PopPlayThread PopPlayWav PopPrevSongPos PopReadDir PopSetDriver PopSetLooping PopSetPriority PopSetSongPos PopSetVolume PopSleep PopStatus PopStop PopVersion next chapter: Rexx example ═══ 3.1. PopAddWav ═══ PopAddWav Adds user sound effects to the memory. Maximum 128 effects are possible. Syntax wavhnd = PopAddWav(filename) Parameters filename Name of the wave file. RIFF,WAV and FMT-type mono wave files are supported. Return wavhnd Wave handle. Integer value beetween 0..127. NOTICE! Waves are actually loaded in the PopPlayThread() function so don't try add extra effects during play or pause it won't work. If you need diffrent set of waves, stop the playing, add effects and call PopPlayThread() again. All old waves are destoyed from the memory when a stop is issued. Use always the following order to add extra WAVs call PopInitWav 2 /* HAVE TO BE FIRST!*/ wavhnd1 = PopAddWav( wavfile1 ) /* sound effect 1 */ wavhnd2 = PopAddWav( wavfile2 ) /* sound effect 2 */ wavhnd3 = PopAddWav( wavfile3 ) /* sound effect 3 aso...*/ status = PopPlayThread( modfile,freq,bits,chan,pri ) call PopPlayWav wavhnd2,usrchn,freq,vol,pan See also PopInitWav, PopPlayWav Since 1.00 ═══ 3.2. PopChannels ═══ PopChannels Get channel count from the played song including user channels. Maximum channel count is 32. Syntax channels=PopChannels() Return channels Integer value beetween 0 to 32. Channel value zero indicates that there is no song currenly available. Since 1.00 ═══ 3.3. PopDropFuncs ═══ PopDropFuncs Deregister player functions. Syntax call PopDropFuncs Return nothing See also PopLoadFuncs Since always ═══ 3.4. PopGetPatPos ═══ PopGetPatPos Gets pattern position. Positive integer value. Syntax patpos=PopGetPatPos() Return patpos Pattern position. Positive integer value. See also PopGetSongPos, PopSetSongPos, PopNextSongPos, PopPrevSongPos,PopGetSongBPM, PopChannels Since 1.00 ═══ 3.5. PopGetSongBPM ═══ PopGetSongBPM Gets beats per minute value. Positive integer value. Syntax bpm=PopGetSongBPM() Return bpm Gets beats per minute value. Positive integer value. See also PopGetSongPos, PopSetSongPos,PopNextSongPos, PopPrevSongPos,PopGetSongSpeed, PopChannels Since 1.00 ═══ 3.6. PopGetSongPos ═══ PopGetSongPos Syntax songpos=PopGetSongPos() Return songpos Gets current song position. Positive integer value. See also PopSetSongPos,PopNextSongPos, PopPrevSongPos Since 1.00 ═══ 3.7. PopGetSongSpeed ═══ PopGetSongSpeed Gets songspeed. Syntax speed=PopGetSongSpeed() Return speed Song speed. Positive integer value. See also PopGetSongPos, PopGetSongBPM Since v1.00 ═══ 3.8. PopGetVolume ═══ PopGetVolume Gets the master volume. Syntax volume = PopGetVolume() Return volume Master volume from 0% to 100%. See also PopSetVolume Since v0.97 ═══ 3.9. PopInfo ═══ PopInfo Returns the copyright info string. Syntax info = PopInfo() Parameters None. Return info Copyright info string. See also PopVersion Since Always. ═══ 3.10. PopInitWav ═══ PopInitWav Adds number of extra user channels to the player. Maximum 32 channels is allowed. Syntax call PopInitWav nr Parameters nr Number of channels to add 0 to 30. Return Nothing. See also PopAddWav, PopPlayWav Since 1.00 ═══ 3.11. PopLoadFuncs ═══ PopLoadFuncs Register player functions. Syntax call PopLoadFuncs Params none Return nothing See also PopDropFuncs Since always ═══ 3.12. PopMaxSongPos ═══ PopMaxSongPos Get the maximum song position. Syntax maxsongpos=PopMaxSongPos() Return maxsongpos Maximum song position. Positive integer value. See also PopSetSongPos, PopGetSongPos Since 1.00 ═══ 3.13. PopNextSongPos ═══ PopNextSongPos Jump to next song position. Syntax call PopNextSongPos Return nothing See also PopSetSongPos, PopPrevSongPos Since v1.00 ═══ 3.14. PopPause ═══ PopPause Toggle beetween PLAY and PAUSE. Syntax call PopPause Return nothing See also PopStatus, PopPlay, PopPlayThread, PopStop Since Always ═══ 3.15. PopPlay ═══ PopPlay Plays the module file (no threading). Syntax status = PopPlay( file, frequency, bits, channels, priority) Parameters Frequency Module mixing speed. Any value beetween 11025 to 44100 will be accepted. Since some MMPM drivers do not allow all these values, use one of the following; 11025, 22050 or 44100. bits Soundcard's output sample size. 8 or 16 bits. channels Stereo or mono playing. 1 - mono 2 - stereo priority Sets predefined priority. Values 1,2,3 and 4 accepted. Recomendation 3 or 4. Return status 0 = No error. 1 = Can't open sound device. 2 = Can't load module (module doesn't exist or illegal module type). 3 = Channel count over 32. See also PopPlayThread, PopStop, PopPlayWav Function first time represented. Always (changed v1.00) ═══ 3.16. PopPlayThread ═══ PopPlayThread Plays the module file using a thread Syntax status = PopPlayThread( file, frequency, bits, channels, priority) Parameters Frequency Module mixing speed. Any value beetween 11025 to 44100 will be accepted. Since some MMPM drivers do not allow all these values, use one of the following; 11025, 22050 or 44100. bits Soundcard's output sample size. 8 or 16 bits. channels Stereo or mono playing. 1 - mono 2 - stereo priority Sets predefined priority. Values 1,2,3 and 4 accepted. Recomendation 3 or 4. Return status 0 = No error. 4 = Thread error. See also PopPlay, PopStop, PopPause, PopPlayWav Since v0.97 ═══ 3.17. PopPlayWav ═══ PopPlayWav Syntax status = PopPlayWav( wavnr,channel,freq,vol,pan ) Parameters wawnr Wave handle. channel User channel ( 0 - depends how many you added ) freq Wave frequency. vol Wave volume (0-255) pan Wave balance (0-255, 127 is middle) Return status 0 = No error. 7 = Parameter error. See also PopInitWav, PopAddWav, PopPlay, PopPlayThread Since 1.00 ═══ 3.18. PopPrevSongPos ═══ PopPrevSongPos Jump to previous song position Syntax call PopPrevSongPos Return nothing See also PopNextSongPos, PopSetSongPos Since v1.00 ═══ 3.19. PopReadDir ═══ PopReadDir Read all MODULEs in the directory. File extension could be anyting ie XM.SBRIGADE is valid name for a module. Syntax call PopReadDir dir,mask,file.,name.,type. Parameters dir Search directory mask Mask for the search (usually "*.*") Returned stem parameters file. Filenames with full path. name. Real song name type. Module type ('Protracker' aso..) Returns rc 0 = No error. 12 = Memory allocation error. Limitations Maximum module count in one directory is 3000! Since v0.90 ═══ 3.20. PopSetDriver ═══ PopSetDriver Sets to output device witch is one of the following: MMPM, DART or FILE. Syntax call PopSetDriver device, buffer, sharing or call PopSetDriver device Parameters device Output device string: 'MMPM', 'DART' or 'FILE'. If output device is 'FILE' no other parametrs are accepted. File output is always file 'MUSIC.RAW'. Default output driver is 'MMPM'. buffer Output device buffer size in kilobytes. Integer beetween 1 to 63. Default is 16. Recommended buffer size for DART 8kB and MMPM 16kB. sharing Output device sharing. String witch is either 'EXCLUSIVE' or 'SHARED'. Default is 'EXCLUSIVE'. Return status 0 = No error. 5 = Illegal play mode (Paramters take effect when new module is loaded). Since v1.00 ═══ 3.21. PopSetLooping ═══ PopSetLooping Allows the player to process looping commands embedded in the module. This means that the player will play such songs forever. Modules which do not contain looping commands are unaffected. The user must use PopStop to end playing of a looping module. Syntax call PopSetLooping state Parameters state String 'ON' or 'OFF'. Default value is 'OFF'. Return nothing Since v1.00 ═══ 3.22. PopSetPriority ═══ PopSetPriority Syntax rc=PopSetPriority( scope, class, delta, id ) Parameters Parameters are same as API function DosSetPriority. Propably you don't need this function because there is now priority setting in both PopPlay() and PopPlayThread() funtions. Return rc 0 = No error. 6 = API function failed. See also PopPlay, PopPlayThread Since 0.90 ═══ 3.23. PopSetSongPos ═══ PopSetSongPos Set the song position Syntax call PopSetSongPos pos Parameters pos Song position to set. Positive integer value. Return nothing See also PopGetSongPos, PopNextSongPos, PopPrevSongPos Since v1.00 ═══ 3.24. PopSetVolume ═══ PopSetVolume Sets the new master volume.(without saving) Syntax rc = PopSetVolume( volume ) Parameters volume Master volume from 0% to 100%. Return rc 0 = No error. 6 = API function failed. See also PopGetVolume Since v0.97 ═══ 3.25. PopSleep ═══ PopSleep Gives timeslices to other processes. Syntax rc = PopSleep( time_ms ) Parameters time_ms Time to sleep in milliseconds. Return rc 0 = No error. 6 = API function failed. Since v0.90 ═══ 3.26. PopStatus ═══ PopStatus Get current player status (during the play) Syntax status=PopStatus() or status=PopStatus('TEXT') Parameters 'TEXT' Returns player state as string. Return status Current playing status (number). 0=STOP 1=PAUSE 2=PLAY 3=LOAD Current playing status (text). status STOP PAUSE PLAY LOAD See also PopPause, PopStop Since always ═══ 3.27. PopStop ═══ PopStop Immediatly stop playing Syntax call PopStop Return nothing See also PopPlay, PopPlayThread, PopStatus Since always ═══ 3.28. PopVersion ═══ PopVersion Get the DLL version string. Syntax ver = PopVersion() Return ver Version number string. See also PopInfo Since Always. ═══ 4. Rexx example ═══ /* REXX TEST */ /* THIS IS ONLY AN EXAMPLE*/ /* DON'T EXPECT THAT THIS PROGRAM WORKS WITHOUT MODIFICATION */ signal on HALT signal on ERROR parse arg dir if dir='' then dir='.\' call ModInit call ModSetDriver 'DART',1,'SHARED' call ModSetLooping 'OFF' call SCls call ModDspProduct call ModDspWait call ModReadDir dir, '*.*', f., n., t. call SCls call ModDspProduct noabort=1 if f.0 == 0 then do call ModDspCmdLineHelp noabort=0 end do while noabort i = RANDOM(1, f.0, TIME('S')) gl.file=f.i gl.name=n.i gl.volume = ModGetVolume() gl.mix = 22050 /*Mixing speed*/ gl.bits = 8 /*Bits per sample*/ gl.channels = 2 /*Stereo*/ gl.priority = 3 gl.rc = 0 call SCurState OFF call SCls call ModDspProduct call ModDspSettings call ModDspHelp call ModInitWav 4 /* now your module have four channels more*/ /*add our test effects to the memory*/ handle00 = ModAddWav("C:\MMOS2\SOUNDS\DRUMROLL.WAV") handle01 = ModAddWav("C:\MMOS2\SOUNDS\BEEOONG.WAV") handle02 = ModAddWav("C:\MMOS2\SOUNDS\BELLS.WAV") handle03 = ModAddWav("C:\MMOS2\SOUNDS\BOING.WAV") handle04 = ModAddWav("C:\MMOS2\SOUNDS\BOO.WAV") handle05 = ModAddWav("C:\MMOS2\SOUNDS\BWAAANG.WAV") handle06 = ModAddWav("C:\MMOS2\SOUNDS\BWEEEP.WAV") handle07 = ModAddWav("C:\MMOS2\SOUNDS\CUCKOO.WAV") handle08 = ModAddWav("C:\MMOS2\SOUNDS\DOINK.WAV") handle09 = ModAddWav("C:\MMOS2\SOUNDS\DOORCLS.WAV") /* LET'S PLAY SOME MUSIC */ s=ModPlayThread( gl.file, gl.mix, gl.bits, gl.channels, gl.priority ) noexit=1 if s>0 then noexit=0 do while (noexit) key=ModGetKey(0) /*Undocumented function, please don't use this in your program*/ if key\==0 then do /* VOLUME UP - '+' */ if key == 43 then do gl.volume=gl.volume+4; if gl.volume>100 then gl.volume=100 call ModSetVolume gl.volume end /* VOLUME DOWN - '-' */ if key == 45 then do gl.volume=gl.volume-4; if gl.volume<0 then gl.volume=0 call ModSetVolume gl.volume end /* PAUSE/PLAY - 'SPACE' */ if key == 32 then do call ModPause end if key == 78 then do call ModNextSongPos end if key == 80 then do call ModPrevSongPos end if key == 83 then do call ModSetSongPos(0) end /* PLAY VOICE- '0' */ if (key == 48) then do call ModPlayWav handle01, 0, 3000, 255, 127 call ModPlayWav handle02, 1, 7000, 255, 127 call ModPlayWav handle03, 2, 7100, 255, 255 call ModPlayWav handle04, 3, 12000, 255, 0 end /* PLAY VOICE- '1' */ if (key == 49) then do call ModPlayWav handle05, 0, 11025, 255, 255 call ModPlayWav handle04, 1, 10100, 255, 0 call ModPlayWav handle05, 3, 11025, 255, 255 call ModPlayWav handle06, 4, 19100, 255, 0 end /* PLAY VOICE - '2' */ if (key == 50) then do call ModPlayWav handle07, 0, 19025, 255, 127 call ModPlayWav handle08, 1, 10025, 255, 0 call ModPlayWav handle09, 3, 11025, 255, 255 end /* PLAY VOICE - '3' */ if (key == 51) then do call ModPlayWav handle09, 0, 11025, 255, 255 call ModPlayWav handle09, 1, 11425, 255, 0 end /* SET SONG POSITION TO END - 'E' */ if (key == 69) then do call ModSetSongPos ModMaxSongPos()-1 end /*EXIT - CHECK ESC KEY*/ if key == 27 then do noexit=0 noabort=0 end /*NEXT SONG - ENTER*/ if key == 13 then noexit=0 end status = ModStatus('TEXT') if status == 'STOP' then noexit=0 /* UPDATE DISPLAY */ call ModDspSongInfo call ModDspInfo status call ModSleep 256 /* 256ms */ end call ModStop do while ModStatus() \= 0 end end call ModDone exit /*** END MAIN ***/ HALT: ERROR: call ModStop do while ModStatus() \= 0 end call ModDone exit ModInit:procedure call RxFuncAdd 'SCurState' , 'RexxUtil', 'SysCurState' call RxFuncAdd 'SCurPos' , 'RexxUtil', 'SysCurPos' call RxFuncAdd 'SCls' , 'RexxUtil', 'SysCls' call RxFuncAdd 'ModVersion' , 'POPPLAY', 'PopVersion' call RxFuncAdd 'ModInfo' , 'POPPLAY', 'PopInfo' call RxFuncAdd 'ModPlay' , 'POPPLAY', 'PopPlay' call RxFuncAdd 'ModPlayThread' , 'POPPLAY', 'PopPlayThread' call RxFuncAdd 'ModStop' , 'POPPLAY', 'PopStop' call RxFuncAdd 'ModPause' , 'POPPLAY', 'PopPause' call RxFuncAdd 'ModStatus' , 'POPPLAY', 'PopStatus' call RxFuncAdd 'ModSetVolume' , 'POPPLAY', 'PopSetVolume' call RxFuncAdd 'ModGetVolume' , 'POPPLAY', 'PopGetVolume' call RxFuncAdd 'ModSetPriority' , 'POPPLAY', 'PopSetPriority' call RxFuncAdd 'ModReadDir' , 'POPPLAY', 'PopReadDir' call RxFuncAdd 'ModSleep' , 'POPPLAY', 'PopSleep' call RxFuncAdd 'ModGetKey' , 'POPPLAY', 'PopGetKey' call RxFuncAdd 'ModGetSongPos' , 'POPPLAY', 'PopGetSongPos' call RxFuncAdd 'ModGetPatPos' , 'POPPLAY', 'PopGetPatPos' call RxFuncAdd 'ModGetSongSpeed', 'POPPLAY', 'PopGetSongSpeed' call RxFuncAdd 'ModGetSongBPM' , 'POPPLAY', 'PopGetSongBPM' call RxFuncAdd 'ModSetLooping' , 'POPPLAY', 'PopSetLooping' call RxFuncAdd 'ModInitWav' , 'POPPLAY', ' PopInitWav' call RxFuncAdd 'ModAddWav' , 'POPPLAY', 'PopAddWav' call RxFuncAdd 'ModPlayWav' , 'POPPLAY', 'PopPlayWav' call RxFuncAdd 'ModSetSongPos' , 'POPPLAY', 'PopSetSongPos' call RxFuncAdd 'ModNextSongPos' , 'POPPLAY', 'PopNextSongPos' call RxFuncAdd 'ModPrevSongPos' , 'POPPLAY', 'PopPrevSongPos' call RxFuncAdd 'ModMaxSongPos' , 'POPPLAY', 'PopMaxSongPos' call RxFuncAdd 'ModGetChannels' , 'POPPLAY', 'PopGetChannels' call RxFuncAdd 'ModSetDriver' , 'POPPLAY', 'PopSetDriver' return ModDone:procedure return ModDspWait:procedure x= 10 y= 10 call ModDsp x,y+0,'Wait. Reading directory...' return ModDspSettings:procedure expose gl. x=5 y=4 call ModDsp x,y+0,"Module file : "gl.file call ModDsp x,y+1,"Module name : "gl.name call ModDsp x,y+2,"Mixing rate : "gl.mix call ModDsp x,y+3,"Bits per sample : "gl.bits call ModDsp x,y+4,"Channels : "gl.channels call ModDsp x,y+5,"Priority : "gl.priority call ModDsp x,y+6,"Error : "gl.rc return ModDspProduct:procedure x= 1 y= 1 call ModDsp x,y+0,ModInfo() " - Version "ModVersion() call ModDsp x,y+1,"Random play demo" return ModDspInfo:procedure parse arg line x= 5 y= 23 call ModDsp x,y,line return ModDspSongInfo:procedure expose gl. x= 5 y= 13 call ModDsp x,y+0,'Channels : 'ModGetChannels()" " call ModDsp x,y+1,'Song position : 'ModGetSongPos()" " call ModDsp x,y+2,'Max song position: 'ModMaxSongPos()" " call ModDsp x,y+3,'Pattern position : 'ModGetPatPos()" " call ModDsp x,y+4,'Song speed : 'ModGetSongSpeed()" " call ModDsp x,y+5,'Beats per minute : 'ModGetSongBPM()" " call ModDsp x,y+8,'Volume : 'gl.volume'% '" " return ModDspHelp:procedure x=40 y=7 call ModDsp x,y+00, " HELP " call ModDsp x,y+01, "======keys=are=casesensitive!======" call ModDsp x,y+03, " <+> Volume up. " call ModDsp x,y+04, " <-> Volume down. " call ModDsp x,y+05, " Pause/Play. " call ModDsp x,y+06, " Quit. " call ModDsp x,y+08, " Jump to next song. " call ModDsp x,y+09, "

Previous song position." call ModDsp x,y+10, " Next song position. " call ModDsp x,y+11, " Set position 0. " call ModDsp x,y+12, "<0...9> Wav sound effects. " return ModDsp:procedure parse arg x,y,text call SCurPos y, x call charout ,text return ModDspCmdLinehelp:procedure 'CLS' x=1 y=1 call ModDspProduct call ModDsp x,y+03, "Usage: mod [dircetory]" call ModDsp x,y+06, "NOTICE!" call ModDsp x,y+08, "This demo uses following settins:" call ModDsp x,y+09, " -mixing speed 22kHz" call ModDsp x,y+10, " -8 bits/sample" call ModDsp x,y+11, " -2 channels ie. stereo" call ModDsp x,y+12, " -Audio driver DART" call ModDsp x,y+13, " -uses default mmp/2 soundeffects from C:\MMOS2\SOUNDS" call ModDsp x,y+15, "If these settings don't match for you, checkout the Rexx source!" say return