# Guia de Funciones Avanzadas de Canal

## Slide (Transicion Suave)

Permite cambiar atributos gradualmente (fade in/out, pan suave).

```python
from basskit.dlls.bass import bass
from basskit.constantes.bass import BASS_ATTRIB_VOL

# Fade out en 3 segundos (vol actual -> 0)
bass.BASS_ChannelSlideAttribute(stream, BASS_ATTRIB_VOL, 0.0, 3000)

# Verificar si esta en transicion
while bass.BASS_ChannelIsSliding(stream, BASS_ATTRIB_VOL):
    time.sleep(0.1)
print("Fade completado")
```

## Link (Vincular Canales)

Vincula canales para que play/stop/pause se sincronicen.

```python
# Vincular: cuando s1 hace play, s2 tambien
bass.BASS_ChannelSetLink(s1, s2)

bass.BASS_ChannelPlay(s1, 0)  # Ambos empiezan

# Desvincular
bass.BASS_ChannelRemoveLink(s1, s2)
```

## Lock (Thread-Safe)

Bloquea un canal para acceso seguro desde multiples hilos.

```python
bass.BASS_ChannelLock(stream, 1)   # Bloquear
# ... operaciones seguras ...
bass.BASS_ChannelLock(stream, 0)   # Desbloquear
```

## Cambio de Dispositivo

```python
# Obtener dispositivo actual
dev = bass.BASS_ChannelGetDevice(stream)

# Mover a otro dispositivo
bass.BASS_ChannelSetDevice(stream, 2)
```

## Crossfade entre Pistas

```python
# Pista 1 sonando, pista 2 en silencio
bass.BASS_ChannelSetAttribute(s2, BASS_ATTRIB_VOL, 0.0)
bass.BASS_ChannelPlay(s2, 0)

# Crossfade de 5 seg: s1 baja, s2 sube
bass.BASS_ChannelSlideAttribute(s1, BASS_ATTRIB_VOL, 0.0, 5000)
bass.BASS_ChannelSlideAttribute(s2, BASS_ATTRIB_VOL, 1.0, 5000)
```

## Reverse Playback

Requiere bass_fx.dll.

```python
from basskit.dlls.bass_fx import bass_fx
from basskit.constantes.bass_fx import BASS_FX_FREESOURCE, BASS_ATTRIB_REVERSE_DIR

decode = bass.BASS_StreamCreateFile(0, ruta, 0, 0, BASS_STREAM_DECODE | BASS_UNICODE)
stream = bass_fx.BASS_FX_ReverseCreate(decode, 2.0, BASS_FX_FREESOURCE)

bass.BASS_ChannelPlay(stream, 0)

# Cambiar direccion
bass.BASS_ChannelSetAttribute(stream, BASS_ATTRIB_REVERSE_DIR, -1.0)  # Reversa
bass.BASS_ChannelSetAttribute(stream, BASS_ATTRIB_REVERSE_DIR, 1.0)   # Normal
```
