Search the Community
Showing results for tags 'bass.dll'.
-
Easy To Use - Bass Example (by nend) with _BASSChannelGetTags() nend says : #include <Bass.au3> #include <BassConstants.au3> Global $BASS_PAUSE_POS Func Example() Local $MusicHandle _Audio_init_start() $MusicHandle = _Set_url("http://ice1.somafm.com/groovesalad-128.mp3") _Set_volume(50) _Audio_play($MusicHandle) while 1 ConsoleWrite(_Get_streamtitle($MusicHandle) & @CRLF) Sleep(1000) WEnd _Audio_init_stop($MusicHandle) EndFunc Example() Func _Audio_init_start() If _BASS_STARTUP(@ScriptDir & "\bass.dll") Then If _BASS_Init(0, -1, 44100, 0) Then If _BASS_SetConfig($BASS_CONFIG_NET_PLAYLIST, 1) = 0 Then SetError(3) EndIf Else SetError(2) EndIf Else SetError(@error) EndIf EndFunc Func _Set_buffer($buffer) _BASS_SetConfig($BASS_CONFIG_NET_BUFFER, $buffer) EndFunc Func _Audio_stop($MusicHandle) _BASS_ChannelStop($MusicHandle) EndFunc Func _Audio_play($MusicHandle) _BASS_ChannelPlay($MusicHandle, 1) EndFunc Func _Audio_pause($MusicHandle) If _Get_playstate($MusicHandle) = 2 Then $BASS_PAUSE_POS = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) _BASS_ChannelPause($MusicHandle) ElseIf _Get_playstate($MusicHandle) = 3 Then _Audio_play($MusicHandle) _BASS_ChannelSetPosition($MusicHandle, $BASS_PAUSE_POS, $BASS_POS_BYTE) EndIf EndFunc Func _Audio_init_stop($MusicHandle) _BASS_StreamFree($MusicHandle) _BASS_Free() EndFunc Func _Set_url($file) If FileExists($file) Then $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0) Else $MusicHandle = _BASS_StreamCreateURL($file, 0, 1) EndIf If @error Then Return SetError(1) EndIf Return $MusicHandle EndFunc Func _Get_pos($MusicHandle) $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) Return Round(_Bass_ChannelBytes2Seconds($MusicHandle, $current)) EndFunc Func _Get_len($MusicHandle) $current = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE) Return Round(_Bass_ChannelBytes2Seconds($MusicHandle, $current)) EndFunc Func _Set_pos($MusicHandle, $seconds) _BASS_ChannelSetPosition($MusicHandle, _BASS_ChannelSeconds2Bytes($MusicHandle, $seconds), $BASS_POS_BYTE) EndFunc Func _Set_volume($volume) _BASS_SetConfig($BASS_CONFIG_GVOL_STREAM, $volume * 100) EndFunc Func _Get_volume() Return _BASS_GetConfig($BASS_CONFIG_GVOL_STREAM) / 100 EndFunc Func _Get_bitrate($MusicHandle) $a = Round(_Bass_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE))) $return = Round(_BASS_StreamGetFilePosition($MusicHandle, $BASS_FILEPOS_END) * 8/ $a/ 1000) If StringInStr($return, "-") Then $return = _BASS_StreamGetFilePosition($MusicHandle, $BASS_FILEPOS_END) * 8 / _BASS_GetConfig($BASS_CONFIG_NET_BUFFER) EndIf Return $return EndFunc Func _Get_playstate($MusicHandle) Switch _BASS_ChannelIsActive($MusicHandle) Case $BASS_ACTIVE_STOPPED $returnstate = 1 Case $BASS_ACTIVE_PLAYING $returnstate = 2 Case $BASS_ACTIVE_PAUSED $returnstate = 3 Case $BASS_ACTIVE_STALLED $returnstate = 4 EndSwitch Return $returnstate EndFunc Func _Get_streamtitle($MusicHandle) $pPtr = _BASS_ChannelGetTags($MusicHandle, $BASS_TAG_META) $sStr = _BASS_PtrStringRead($pPtr) If StringInStr($sStr, ";") Then $infosplit = StringSplit($sStr, ";") $infosplit[1] = StringReplace($infosplit[1], "'", "") $infosplit[1] = StringReplace($infosplit[1], "StreamTitle=", "") If StringInStr($infosplit[1], "-") Then Return $infosplit[1] EndIf EndIf EndFunc You need : 1 dll : bass.dll source : http://www.un4seen.com/bass.html (v2.4.12.1) 2 au3 : bass.au3 source : bass related forum post (patch 9.2/Constant from 9.0)
-
hello Greetings to all dears i have a big problem in the bass.dll e.g If you play an audio file using the bass.dll and You changed the audio output Such as setting or removing headphones The sound output of bass.dll does not change Is there any solution If it exists, please give it to me Greetings and thanks in advance I apologize for my bad English