Mehrere Musikstücke

  • hey, ich bin gerade dabei etwas mit der Bass UDF zu experimentieren und wollte wissen wie man es macht, dass
    man mehrere Sounddatein in einem Steam hat
    also so in der art eine Playlist die er runter spielt
    oder muss man das alles einzelnd machen?

    ich habe schon ein bischen gemacht und dabei kahm das raus:

    Spoiler anzeigen
    [autoit]

    #include <Bass.au3>
    #include <BassConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    OnAutoItExitRegister("OnAutoItExit")
    HotKeySet("{F1}", "_EventX")
    HotKeySet("{F2}", "_EventY")

    [/autoit] [autoit][/autoit] [autoit]

    _BASS_STARTUP()
    _BASS_Init(0, -1, 44100, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    Dim $SoundChannel[3][3]
    $steam = 1

    [/autoit] [autoit][/autoit] [autoit]

    $SoundChannel[0][0] = 1
    $SoundChannel[0][1] = _BASS_StreamCreateFile(False, @ScriptDir & "\sound\8.ogg", 0, 0, 0)
    $SoundChannel[0][2] = _BASS_StreamCreateFile(False, @ScriptDir & "\sound\9.ogg", 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $SoundChannel[2][0] = 1
    $SoundChannel[2][1] = _BASS_StreamCreateFile(False, @ScriptDir & "\sound\19.ogg", 0, 0, 0)
    $SoundChannel[2][2] = _BASS_StreamCreateFile(False, @ScriptDir & "\sound\20.ogg", 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $SoundChannel[1][0] = _BASS_StreamCreateFile(False, @ScriptDir & "\sound\252.ogg", 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    _BASS_ChannelPlay($SoundChannel[0][1], 1)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(200)
    _ControllMusic_Channel_1()
    _ControllMusic_Channel_2()
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _ControllMusic_Channel_1()
    If $steam <> 1 Then Return -1

    [/autoit] [autoit][/autoit] [autoit]

    If $SoundChannel[0][0] = 1 Then
    If _BASS_ChannelIsActive($SoundChannel[0][1]) = $BASS_ACTIVE_STOPPED Then
    _BASS_ChannelPlay($SoundChannel[0][2], 1)
    $SoundChannel[0][0] = 2
    EndIf
    ElseIf $SoundChannel[0][0] = 2 Then
    If _BASS_ChannelIsActive($SoundChannel[0][2]) = $BASS_ACTIVE_STOPPED Then
    _BASS_ChannelPlay($SoundChannel[0][1], 1)
    $SoundChannel[0][0] = 1
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ControllMusic_Channel_2()
    If $steam <> 2 Then Return -1

    [/autoit] [autoit][/autoit] [autoit]

    If $SoundChannel[2][0] = 1 Then
    If _BASS_ChannelIsActive($SoundChannel[2][1]) = $BASS_ACTIVE_STOPPED Then
    _BASS_ChannelPlay($SoundChannel[2][2], 1)
    $SoundChannel[2][0] = 2
    EndIf
    ElseIf $SoundChannel[2][0] = 2 Then
    If _BASS_ChannelIsActive($SoundChannel[2][2]) = $BASS_ACTIVE_STOPPED Then
    _BASS_ChannelPlay($SoundChannel[2][1], 1)
    $SoundChannel[2][0] = 1
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _EventY()
    If $steam = 1 Then

    [/autoit] [autoit][/autoit] [autoit]

    _BASS_ChannelPause($SoundChannel[0][$SoundChannel[0][0]])
    _BASS_ChannelPlay($SoundChannel[2][$SoundChannel[2][0]], 0)
    $steam = 2
    Return 2
    ElseIf $steam = 2 Then

    [/autoit] [autoit][/autoit] [autoit]

    _BASS_ChannelPause($SoundChannel[2][$SoundChannel[2][0]])
    _BASS_ChannelPlay($SoundChannel[0][$SoundChannel[0][0]], 0)
    $steam = 1
    Return 1
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _EventX()
    _BASS_ChannelPlay($SoundChannel[1][0], 1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func OnAutoItExit()
    _BASS_Free()
    EndFunc ;==>OnAutoItExit

    [/autoit]


    wenn man F1 drückt spielt er nebenbei eine kleine Suunddatei ab, bei F2 wechselt er von Playlist 1 zu 2
    und andersrum

    aber die frage ist halt: kann man eine art Playlist machen?

  • Eine Playlist? Klar kannst du das machen.. Am besten packst du einfach die Pfade zu allen Sounddateien in eine externe Datei und ließt diese dann mit FileRead aus (du kannst auch eine ini Datenstruktur verwenden). Dann kannst du sie einfach in einer Schleife abspielen.

  • habs erstmal gelöst

    hatte nur gehofft es gäbe ne andere art das zu tun
    ist halt nur mehr schreibarbeit ;)