$MIDISOUNDFONT: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Added documentation of new $MIDISOUNDFONT metacommand)
 
No edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The [[$MIDISOUNDFONT]] metacommand enables MIDI support for [[_SNDOPEN]].
The now {{Text|deprecated|red}} [[$MIDISOUNDFONT]] metacommand did enable MIDI support for [[_SNDOPEN]] in QB64-PE versions prior to v3.14.0, and was also considered unstable. It could only be used with the [[$UNSTABLE]]:MIDI flag set. Since v3.14.0 MIDI support is stable and you can use [[_MIDISOUNDBANK]] to load a soundfont.
 
MIDI functionality is current unstable, and requires [[$UNSTABLE]]:MIDI to be able to use.




{{PageSyntax}}
{{PageSyntax}}
:[[$MIDISOUNDFONT]]: {DEFAULT|"{{Parameter|Filename}}"}
: [[$MIDISOUNDFONT]]: {DEFAULT|"{{Parameter|Filename}}"}




{{Parameters}}
{{PageParameters}}
* DEFAULT indicates that the soundfont provided by QB64-PE should be used to play MIDI files.
* DEFAULT indicates that the soundfont provided by QB64-PE should be used to play MIDI files.
** The provided soundfont is about 1MB in size.
** The provided soundfont is about 1MB in size.
Line 21: Line 19:


{{PageAvailability}}
{{PageAvailability}}
* '''QB64-PE v3.2 and up''' (QB64 Phoenix Edition)
<!-- QB64 = a version or none, QBPE = a version or all, Platforms = yes or no -->
<gallery widths="48px" heights="48px" mode="nolines">
File:Qb64.png|'''none'''
File:Qbpe.png|'''v3.2.0'''
File:Apix.png
File:Win.png|'''yes'''
File:Lnx.png|'''yes'''
File:Osx.png|'''yes'''
</gallery>
<!-- additional availability notes go below here -->
* '''$MIDISOUNDFONT''' was {{Text|deprecated|red}} in '''QB64-PE v3.14.0'''. Use [[_MIDISOUNDBANK]] instead.




Line 28: Line 36:
{{Cl|$UNSTABLE}}:MIDI
{{Cl|$UNSTABLE}}:MIDI


' This line is only allowed when {{cl|$UNSTABLE}}:MIDI is used
' This line is only allowed when {{Cl|$UNSTABLE}}:MIDI is used
{{cl|$MIDISOUNDFONT}}: Default
{{Cl|$MIDISOUNDFONT}}: Default


{{cl|_SNDPLAYFILE}} "example.mid"
{{Cl|_SNDPLAYFILE}} "example.mid"
{{CodeEnd}}
{{CodeEnd}}
{{CodeStart}}
{{CodeStart}}
Line 37: Line 45:


' Using a custom soundfont rather than the default
' Using a custom soundfont rather than the default
{{cl|$MIDISOUNDFONT}}: "soundfont.sf2"
{{Cl|$MIDISOUNDFONT}}: "soundfont.sf2"


{{cl|_SNDPLAYFILE}} "example.mid"
{{Cl|_SNDPLAYFILE}} "example.mid"
{{CodeEnd}}
{{CodeEnd}}


{{PageSeeAlso}}
{{PageSeeAlso}}
* [[$UNSTABLE]]
* [[$UNSTABLE]]
* [[_SNDOPEN]]
* [[_MIDISOUNDBANK]], [[_SNDOPEN]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 15:30, 9 August 2024

The now deprecated $MIDISOUNDFONT metacommand did enable MIDI support for _SNDOPEN in QB64-PE versions prior to v3.14.0, and was also considered unstable. It could only be used with the $UNSTABLE:MIDI flag set. Since v3.14.0 MIDI support is stable and you can use _MIDISOUNDBANK to load a soundfont.


Syntax

$MIDISOUNDFONT: {DEFAULT|"Filename"}


Parameters

  • DEFAULT indicates that the soundfont provided by QB64-PE should be used to play MIDI files.
    • The provided soundfont is about 1MB in size.
  • Filename can be used to provide your own soundfont for playing MIDI files.
    • The specified soundfont file is compiled into your program and is not required at runtime.


Description

  • The use of this metacommand allows _SNDOPEN to open MIDI files.
  • The selected soundfont is what is used to play all MIDI files.


Availability

  • $MIDISOUNDFONT was deprecated in QB64-PE v3.14.0. Use _MIDISOUNDBANK instead.


Examples

$UNSTABLE:MIDI

' This line is only allowed when $UNSTABLE:MIDI is used
$MIDISOUNDFONT: Default

_SNDPLAYFILE "example.mid"
$UNSTABLE:MIDI

' Using a custom soundfont rather than the default
$MIDISOUNDFONT: "soundfont.sf2"

_SNDPLAYFILE "example.mid"


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link