Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looking for a MIDI solution
#11
(09-03-2023, 01:37 AM)mnrvovrfc Wrote: Welcome to consequences with using MIDI and Soundfonts. The Soundfont will become part of the EXE file to ensure playback of any MIDI file that could possibly use that Soundfont. The system cannot assume which patch will be used, so it could include a few and throw away the others. This malady happens anywhere else that a Soundfont has to be packed along with other data and the execution of music related to it.
This solution is stupid and bears no relation to the actual use.

I think that if you use the API MCIsendStringA via Winmm, it's 10 times more optimal than if everything is shot into the EXE.

As I said: The sound font is 1 to 3MB in size. The midi only few bytes. And that becomes a 200MB file in the EXE? This is absolutely unacceptable. For a midi probably noted. Who programmed that?


This solution is already better. But I can't send the MIDI from a buffer to the MCI. Anyway, don't know exactly how.
Code: (Select All)
DECLARE DYNAMIC LIBRARY "WINMM"
  FUNCTION mciSendStringA% (lpstrCommand AS STRING, lpstrReturnString AS STRING, BYVAL uReturnLength AS INTEGER, BYVAL hwndCallback AS INTEGER)
  FUNCTION mciGetErrorStringA% (BYVAL dwError AS INTEGER, lpstrBuffer AS STRING, BYVAL uLength AS INTEGER)
END DECLARE

DIM filedata AS STRING

SCREEN 13

filedata = "game-over.mid"

StartMID (filedata)

DO
  _LIMIT 30
LOOP UNTIL INKEY$ <> ""

StopMID (filedata)

END


'==================================================================

SUB StartMID (filename AS STRING)
  ' Loading File in a Buffer
  ' ----------------------------------------
  'DIM SIZE AS _UNSIGNED LONG
  'DIM BUFFER AS STRING
  '
  'OPEN filename FOR BINARY ACCESS READ AS #1
  'SIZE = LOF(1)
  'BUFFER = SPACE$(SIZE)
  'GET #1, , BUFFER
  'CLOSE #1
  ' ----------------------------------------

  ReturnString$ = SPACE$(255): ErrorString$ = SPACE$(255)
  a% = mciSendStringA%("open " + filename + " type sequencer ", ReturnString$, LEN(ReturnString$), 0)
  IF a% THEN
    x% = mciGetErrorStringA%(a%, ErrorString$, LEN(ErrorString$))
    PRINT ErrorString$
    END
  END IF

  b% = mciSendStringA%("play " + filename, "", 0, 0)
END SUB

SUB StopMID (filename$)
  x% = mciSendStringA%("stop " + filename$, "", 0, 0)
  x% = mciSendStringA%("close " + filename$, "", 0, 0)
END SUB
Reply


Messages In This Thread
Looking for a MIDI solution - by SagaraS - 09-02-2023, 07:17 PM
RE: Looking for a MIDI solution - by bplus - 09-02-2023, 07:35 PM
RE: Looking for a MIDI solution - by SMcNeill - 09-02-2023, 07:41 PM
RE: Looking for a MIDI solution - by SMcNeill - 09-02-2023, 07:43 PM
RE: Looking for a MIDI solution - by DSMan195276 - 09-02-2023, 08:22 PM
RE: Looking for a MIDI solution - by SagaraS - 09-03-2023, 12:40 AM
RE: Looking for a MIDI solution - by SMcNeill - 09-03-2023, 12:43 AM
RE: Looking for a MIDI solution - by SagaraS - 09-03-2023, 01:27 AM
RE: Looking for a MIDI solution - by mnrvovrfc - 09-03-2023, 01:37 AM
RE: Looking for a MIDI solution - by SagaraS - 09-03-2023, 01:52 AM
RE: Looking for a MIDI solution - by SMcNeill - 09-03-2023, 02:22 AM
RE: Looking for a MIDI solution - by SagaraS - 09-03-2023, 02:36 AM
RE: Looking for a MIDI solution - by SMcNeill - 09-03-2023, 09:30 PM
RE: Looking for a MIDI solution - by grymmjack - 09-06-2023, 12:07 AM
RE: Looking for a MIDI solution - by SMcNeill - 09-03-2023, 02:33 AM
RE: Looking for a MIDI solution - by DSMan195276 - 09-03-2023, 03:09 AM
RE: Looking for a MIDI solution - by mnrvovrfc - 09-03-2023, 03:13 AM
RE: Looking for a MIDI solution - by MasterGy - 09-03-2023, 06:48 AM
RE: Looking for a MIDI solution - by grymmjack - 09-03-2023, 02:18 PM
RE: Looking for a MIDI solution - by SagaraS - 09-03-2023, 11:26 AM
RE: Looking for a MIDI solution - by a740g - 09-03-2023, 12:09 PM
RE: Looking for a MIDI solution - by grymmjack - 09-03-2023, 02:27 PM
RE: Looking for a MIDI solution - by SagaraS - 09-03-2023, 06:37 PM
RE: Looking for a MIDI solution - by mnrvovrfc - 09-05-2023, 04:40 PM
RE: Looking for a MIDI solution - by grymmjack - 09-06-2023, 12:10 AM
RE: Looking for a MIDI solution - by mnrvovrfc - 09-06-2023, 07:05 AM



Users browsing this thread: 12 Guest(s)