Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:52 21 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Problem with "PLAY WAV" and PicoMite 5.070606

Author Message
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 1001
Posted: 08:57pm 30 Dec 2022
Copy link to clipboard 
Print this post

Hi!
I want to play a few WAV files in continuous loop for a future Halloween project. Unfortunately I get an error message after some playback time. The WAV are on the flash drive (PicoMite 5.070606).
Option Explicit

Dim WAVbusy As INTEGER

Const TRUE=1
Const FALSE=0

Do
 WAVbusy=TRUE
 Play wav "WIZSIT.wav",IROUTINE
 Do
 Loop While WAVbusy=TRUE
 Pause 5

 WAVbusy=TRUE
 Play wav "MUMSIT.wav",IROUTINE
 Do
 Loop While WAVbusy=TRUE
 Pause 5

 WAVbusy=TRUE
 Play wav "WIZSIT.wav",IROUTINE
 Do
 Loop While Wavbusy=TRUE
 Pause 5

 WAVbusy=TRUE
 Play wav "MINACT.wav",IROUTINE
 Do
 Loop While Wavbusy=TRUE
 Pause 5
Loop

Sub IROUTINE
 WAVbusy=FALSE
IReturn


It works for some time, then I get this error message:
  Quote  [27] Loop While Wavbusy=TRUE
Error : Too many SUBs for interrupt


Here are my WAV files: WAV.zip

What am I doing wrong??? Is there any way to make it easier to query for the WAV end???

THANKS!

Frank
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1682
Posted: 09:01pm 30 Dec 2022
Copy link to clipboard 
Print this post

@Frank

From manual
  Quote  IRETURN
Returns from an interrupt when the interrupt destination was a line number
or a label.
New programs should use a user defined subroutine as an interrupt
destination. In that case END SUB or EXIT SUB will cause a return from
the interrupt.

Regards
Michael
causality ≠ correlation ≠ coincidence
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 1001
Posted: 09:26pm 30 Dec 2022
Copy link to clipboard 
Print this post

Do you think I should exchange IReturn for END SUB? I do not fully understand the text from the manual...  

Frank
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8304
Posted: 09:36pm 30 Dec 2022
Copy link to clipboard 
Print this post

Yes. An interrupt routine is now a normal SUB so IRETURN isn't required. END SUB or EXIT SUB can be used as usual.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 1001
Posted: 09:45pm 30 Dec 2022
Copy link to clipboard 
Print this post

Thank you both so much!!!
Now it works as it should.    The program now looks like this:
Option Explicit

Dim WAVbusy As INTEGER

Const TRUE=1
Const FALSE=0

Do
 PlayWAV "WIZSIT.wav"
 PlayWAV "MUMSIT.wav"
 PlayWAV "WIZSIT.wav"
 PLAYWAV "MINACT.wav"
Loop

Sub PlayWAV wav$
 WAVbusy=TRUE
 Play WAV wav$,IROUTINE
 Do
 Loop While Wavbusy=TRUE
End Sub

Sub IROUTINE
 WAVbusy=FALSE
End Sub    


MANY THANKS!!!

Frank
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1682
Posted: 09:53pm 30 Dec 2022
Copy link to clipboard 
Print this post

  Frank N. Furter said  Now it works as it should.    

Cool!  

and "guten Rutsch!" (happy New Year!)
causality ≠ correlation ≠ coincidence
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 1001
Posted: 03:26pm 31 Dec 2022
Copy link to clipboard 
Print this post

    Dito!

Frank
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025