-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working audio mixer, speaker, audio player
- Loading branch information
Showing
95 changed files
with
2,847 additions
and
765 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ public enum TheatricalScreen { | |
|
||
GENERIC_DMX, | ||
BASIC_LIGHTING_DESK, | ||
FRESNEL | ||
FRESNEL, | ||
MIXER | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../theatrical/api/dmx/BelongsToNetwork.java → ...atrical/api/network/BelongsToNetwork.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dev.imabad.theatrical.api.dmx; | ||
package dev.imabad.theatrical.api.network; | ||
|
||
import java.util.UUID; | ||
|
||
|
12 changes: 12 additions & 0 deletions
12
common/src/main/java/dev/imabad/theatrical/api/network/audio/AudioChannelDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.imabad.theatrical.api.network.audio; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
|
||
public record AudioChannelDefinition(String name, int index, AudioChannelType channelType) { | ||
public static final Codec<AudioChannelDefinition> CODEC = RecordCodecBuilder.create(i -> i.group( | ||
Codec.STRING.fieldOf("name").forGetter(AudioChannelDefinition::name), | ||
Codec.INT.fieldOf("index").forGetter(AudioChannelDefinition::index), | ||
AudioChannelType.CODEC.fieldOf("channelType").forGetter(AudioChannelDefinition::channelType) | ||
).apply(i, AudioChannelDefinition::new)); | ||
} |
18 changes: 18 additions & 0 deletions
18
common/src/main/java/dev/imabad/theatrical/api/network/audio/AudioChannelType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package dev.imabad.theatrical.api.network.audio; | ||
|
||
import com.mojang.serialization.Codec; | ||
import net.minecraft.util.StringRepresentable; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public enum AudioChannelType implements StringRepresentable { | ||
|
||
INPUT, | ||
OUTPUT; | ||
|
||
public static final Codec<AudioChannelType> CODEC = StringRepresentable.fromEnum(AudioChannelType::values); | ||
|
||
@Override | ||
public @NotNull String getSerializedName() { | ||
return name(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
common/src/main/java/dev/imabad/theatrical/api/network/audio/AudioDeviceDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package dev.imabad.theatrical.api.network.audio; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import dev.imabad.theatrical.util.DimensionBlockPos; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public record AudioDeviceDefinition(String name, List<AudioChannelDefinition> channelDefinitions) { | ||
public static final Codec<AudioDeviceDefinition> CODEC = RecordCodecBuilder.create(i -> i.group( | ||
Codec.STRING.fieldOf("name").forGetter(AudioDeviceDefinition::name), | ||
AudioChannelDefinition.CODEC.listOf().fieldOf("channelDefinitions").forGetter(AudioDeviceDefinition::channelDefinitions) | ||
).apply(i, AudioDeviceDefinition::new)); | ||
public static final Codec<Map<DimensionBlockPos, AudioDeviceDefinition>> POS_MAP_CODEC = | ||
Codec.unboundedMap(Codec.STRING.xmap(DimensionBlockPos::fromString, DimensionBlockPos::toString), AudioDeviceDefinition.CODEC); | ||
} |
16 changes: 16 additions & 0 deletions
16
common/src/main/java/dev/imabad/theatrical/api/network/audio/AudioNetworkDevice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dev.imabad.theatrical.api.network.audio; | ||
|
||
import dev.imabad.theatrical.api.network.BelongsToNetwork; | ||
import dev.imabad.theatrical.audio.AudioSink; | ||
import dev.imabad.theatrical.audio.AudioSource; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public interface AudioNetworkDevice extends BelongsToNetwork { | ||
AudioDeviceDefinition getDefinition(); | ||
|
||
@Nullable | ||
AudioSink getSinkForChannel(int channel); | ||
|
||
@Nullable | ||
AudioSource getSourceForChannel(int channel); | ||
} |
3 changes: 2 additions & 1 deletion
3
...mabad/theatrical/api/dmx/DMXConsumer.java → ...eatrical/api/network/dmx/DMXConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ad/theatrical/api/dmx/DMXPersonality.java → ...rical/api/network/dmx/DMXPersonality.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ev/imabad/theatrical/api/dmx/DMXSlot.java → ...d/theatrical/api/network/dmx/DMXSlot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
common/src/main/java/dev/imabad/theatrical/audio/AudioBuffer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package dev.imabad.theatrical.audio; | ||
|
||
public class AudioBuffer { | ||
|
||
private byte[] samples; | ||
private int sampleRate; | ||
private int channels; | ||
|
||
public AudioBuffer(byte[] samples, int sampleRate, int channels) { | ||
this.samples = samples; | ||
this.sampleRate = sampleRate; | ||
this.channels = channels; | ||
} | ||
|
||
public byte[] getSamples() { | ||
return samples; | ||
} | ||
|
||
public void setSamples(byte[] samples) { | ||
this.samples = samples; | ||
} | ||
|
||
public int getSampleRate() { | ||
return sampleRate; | ||
} | ||
|
||
public void setSampleRate(int sampleRate) { | ||
this.sampleRate = sampleRate; | ||
} | ||
|
||
public int getChannels() { | ||
return channels; | ||
} | ||
|
||
public void setChannels(int channels) { | ||
this.channels = channels; | ||
} | ||
} |
Oops, something went wrong.