I use bass.dll to play music files from http://www.un4seen.com/
I try to use function called BASS_ChannelSetPosition. I use ctypes to access the Library. Below is the part of documentation (comes with bass as help file)
I need somebody to tell me whether the mode (BASS_POS_BYTE, BASS_MUSIC_POSRESET...etc) is a function or constant, and how do I set it as a flag in function. Below is the actual erroronous code
def onSetPosition(self, handle, position, mode):
#QWORD BASS_ChannelSetPosition(DWORD handle, QWORD pos DWORD mode, ); - older version
bass.BASS_ChannelSetPosition.argtypes = [ct.c_uint, ct.c_int64, ct.c_char_p]
bass.BASS_ChannelSetPosition.restype = BOOL
successful2 = bass.BASS_ChannelSetPosition(handle, position, mode)
error = bass.BASS_ErrorGetCode()# don't worry, this is for debugging purposes only
successful = (successful2, error)# don't worry, this is for debugging purposes only
return successful # don't worry, this is for debugging purposes only
Sets the playback position of a sample, MOD music, or stream.
BOOL BASS_ChannelSetPosition(
DWORD handle,
QWORD pos,
DWORD mode
);
Parameters
handle The channel handle... a HCHANNEL, HSTREAM or HMUSIC.
pos The position, in units determined by the mode.
mode How to set the position. One of the following, with optional flags.
BASS_POS_BYTE The position is in bytes, which will be rounded down to the nearest sample boundary.
BASS_POS_MUSIC_ORDER The position is in orders and rows... use MAKELONG(order,row). (HMUSIC only)
BASS_MUSIC_POSRESET Flag: Stop all notes. This flag is applied automatically if it has been set on the channel, eg. via BASS_ChannelFlags. (HMUSIC)
BASS_MUSIC_POSRESETEX Flag: Stop all notes and reset bpm/etc. This flag is applied automatically if it has been set on the channel, eg. via BASS_ChannelFlags. (HMUSIC)
other modes & flags may be supported by add-ons, see the documentation.
Return value
If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_HANDLE handle is not a valid channel.
BASS_ERROR_NOTFILE The stream is not a file stream.
BASS_ERROR_POSITION The requested position is invalid, eg. it is beyond the end or the download has not yet reached it.
BASS_ERROR_NOTAVAIL The requested mode is not available. Invalid flags are ignored and do not result in this error.
BASS_ERROR_UNKNOWN Some other mystery problem!