BBC BASIC for Windows
General >> General Board >> copy right error ......LOL........:)............?
http://bb4w.conforums.com/index.cgi?board=general&action=display&num=1265086388

copy right error ......LOL........:)............?
Post by hitsware on Feb 2nd, 2010, 03:53am

hMidiOut% +=0
ON CLOSE IF hMidiOut% SYS "midiOutClose", hMidiOut%
ON ERROR IF hMidiOut% SYS "midiOutClose", hMidiOut%
REPORT : END


Re: copy right error ......LOL........:).........
Post by admin 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.

Re: copy right error ......LOL........:).........
Post by hitswarecant register 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
Re: copy right error ......LOL........:).........
Post by admin on Feb 3rd, 2010, 08:16am

Quote:
ref : http://tech.groups.yahoo.com/group/bb4w/message/12429

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.
Re: copy right error ......LOL........:).........
Post by hitswarecantregister 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 ?
Re: copy right error ......LOL........:).........
Post by admin 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.
Re: copy right error ......LOL........:).........
Post by hitswarecantregister on Feb 3rd, 2010, 3:58pm

>What is your objection to using PROC?

Just need to get used to it I guess.

http://home.comcast.net/~mnjmiller/midi_explore.bbc