-
Notifications
You must be signed in to change notification settings - Fork 3
Add SDL3_mixer.pas #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit adds a translation of SDL3_mixer. This version corresponds to upstream commit 4970bacc5954237037b00f8d2797e23b07782b2f.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general all the bools should be updated to Boolean or the new bool type name (if decided) before merge.
Great contribution, thanks :)!
(https://github.com/PascalGameDevelopment/SDL3-for-Pascal) | ||
SPDX-License-Identifier: Zlib | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please add file header description from header file. (line 24 - 30 in header file)
- Please add SDL_MIXER compiler symbol {$DEFINE SDL_MIXER}
* The different fading types supported | ||
*} | ||
type | ||
TMix_Fading = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be typed constants.
* These are types of music files (not libraries used to load them) | ||
*} | ||
type | ||
TMix_MusicType = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be typed constants.
* mixed with the rest of the channels and music for the final output stream. | ||
*} | ||
type | ||
TMix_EffectFunc = procedure(chan: cint; stream: Pointer; len: cint; udata: Pointer); cdecl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you leave out the suffix "_t" for this function definition and also for Mix_Effect_Done_t on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Something_t
is a common C convention for naming types, similar to TSomething
in Pascal. I feel that TSomething_t
is somewhat redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I see your point, but I'd like to argue against it as follows:
In C there are a lot of types (without the _t
suffix) which we always prefix with T
in Pascal. In some (kind of arbitrary) instances the C type is suffixed by _t
. Since we are tight to the Pascal convention, that does not really matter (in my mind). For instance, we kept the suffix for size_t
and intptr_t
and didn't even add the T
prefix, as we are not bound to C conventions, but to our Pascal convention. Also we decided to translate as exactly as possible, so I would prefer to keep the C suffix, although I agree, it is kind of redundant.
* | ||
* \since This function is available since SDL_mixer 3.0.0. | ||
*} | ||
function Mix_GroupChannels(first, last, tag: cint): cbool; cdecl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument names have changed, it seems: They are "from, to, tag" instead of "first, last, tag".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. to
is a keyword in Pascal, so it's either this, or using something like to_
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to_
please. Ugly, but clearer.
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_Mix_GetSoundFonts' {$ENDIF} {$ENDIF}; | ||
|
||
type | ||
TMix_EachSoundFontCallback = function(const path: PAnsiChar; userdata: Pointer): cint; cdecl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value of this function type if bool
, not int
.
This commit adds a translation of SDL3_mixer. This version corresponds to upstream commit 4970bacc5954237037b00f8d2797e23b07782b2f.