Author |
Topic: copy right error ......LOL........:)............? (Read 622 times) |
|
hitsware
Guest
|
 |
copy right error ......LOL........:)............?
« Thread started on: Feb 2nd, 2010, 03:53am » |
|
hMidiOut% +=0 ON CLOSE IF hMidiOut% SYS "midiOutClose", hMidiOut% ON ERROR IF hMidiOut% SYS "midiOutClose", hMidiOut% REPORT : END
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: copy right error ......LOL........:).........
« Reply #1 on: Feb 2nd, 2010, 11:21am » |
|
Code:hMidiOut% +=0
ON CLOSE IF hMidiOut% SYS "midiOutClose", hMidiOut%
ON ERROR IF hMidiOut% SYS "midiOutClose", hMidiOut%
REPORT : END What is this code supposed to do? It appears to be gibberish!
Richard.
|
|
Logged
|
|
|
|
hitswarecant register
Guest
|
 |
Re: copy right error ......LOL........:).........
« Reply #2 on: Feb 2nd, 2010, 12:28pm » |
|
on Feb 2nd, 2010, 11:21am, Richard Russell wrote: Code:hMidiOut% +=0
ON CLOSE IF hMidiOut% SYS "midiOutClose", hMidiOut%
ON ERROR IF hMidiOut% SYS "midiOutClose", hMidiOut%
REPORT : END What is this code supposed to do? It appears to be gibberish!
Richard. |
| ref : http://tech.groups.yahoo.com/group/bb4w/message/12429
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: copy right error ......LOL........:).........
« Reply #3 on: Feb 3rd, 2010, 08:16am » |
|
Quote: The code there seems to be quite different from the code you posted here, so I don't understand.
If you want some assistance please ask less cryptic questions!
Richard.
|
|
Logged
|
|
|
|
hitswarecantregister
Guest
|
 |
Re: copy right error ......LOL........:).........
« Reply #4 on: Feb 3rd, 2010, 09:59am » |
|
To start midi I've been using: hMidiOut% +=0 ON CLOSE IF hMidiOut% SYS "midiOutClose", hMidiOut%:END SYS "midiOutOpen",^hMidiOut%,-1,0,0,0 TO ret% IF ret% ERROR 100,"Failed to open MIDI output device"
Mike Hutton suggested:
ON CLOSE PROC_Cleanup: QUIT ON ERROR PROC_Cleanup: REPORT : END SYS "midiOutOpen",^hMidiOut%,-1,0,0,0 TO ret% IF ret% ERROR 100,"Failed to open MIDI output device" DEF PROC_Cleanup hMidiOut% +=0 :IF hMidiOut% SYS "midiOutClose", hMidiOut% ENDPROC
With my method (as Mike says) if you hit 'Escape', then try to restart you get "failure to open MIDI" until you close and then reopen the file. I was trying to reduce Mike's method to as few lines as possible (not use PROC). Or any other real short method ?
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: copy right error ......LOL........:).........
« Reply #5 on: Feb 3rd, 2010, 11:34am » |
|
Quote:I was trying to reduce Mike's method to as few lines as possible (not use PROC). |
|
What is your objection to using PROC? You won't get very far in BBC BASIC without using PROCs and FNs!
Any substitute for the PROC would involve code duplication (because PROC_Cleanup is called from two different places) and it's never a good idea to do that - it risks you modifying one but forgetting to modify the other if the code needs to be changed.
Also, if you don't use a PROC you can end up with code which you don't really want to see (because it's incidental to the main purpose of the program) cluttering up the listing and making it less readable. Better to move it to the end so it's not 'in your face'.
Another benefit of a PROC in this particular example is that, as your program gets more complicated, there may be many more things you need to do as part of your 'cleanup' on exit. In that case you just add them to PROC_Cleanup.
Richard.
|
|
Logged
|
|
|
|
|