use of blue.score.layers.audio.core.AudioLayer in project blue by kunstmusik.
the class AudioLayersPanel method updateAudioClipYandHeight.
private void updateAudioClipYandHeight() {
int y = 0;
int height = 0;
for (AudioLayer layer : layerGroup) {
height = layer.getAudioLayerHeight();
for (AudioClip clip : layer) {
AudioClipPanel panel = clipPanelMap.get(clip);
panel.setBounds(new Rectangle(panel.getX(), y, panel.getWidth(), height));
}
y += height;
}
}
use of blue.score.layers.audio.core.AudioLayer in project blue by kunstmusik.
the class AudioLayersPanel method removeNotify.
@Override
public void removeNotify() {
super.removeNotify();
layerGroup.removeLayerGroupListener(this);
timeState.removePropertyChangeListener(this);
for (AudioLayer layer : layerGroup) {
layer.removePropertyChangeListener(heightListener);
layer.removeAudioLayerListener(this);
}
// clipPanelMap.clear();
}
use of blue.score.layers.audio.core.AudioLayer in project blue by kunstmusik.
the class AudioLayersPanel method paintAudioLayersBackground.
private void paintAudioLayersBackground(Graphics g) {
int width = getWidth();
int height = getHeight();
g.setColor(Color.BLACK);
g.fillRect(0, 0, width, height);
int y = 0;
g.setColor(Color.DARK_GRAY);
g.drawLine(0, 0, width, 0);
for (AudioLayer layer : layerGroup) {
y += layer.getAudioLayerHeight();
g.drawLine(0, y, width, y);
}
g.drawLine(0, getHeight() - 1, width, height - 1);
if (timeState.isSnapEnabled()) {
int snapPixels = (int) (timeState.getSnapValue() * timeState.getPixelSecond());
int x = 0;
if (snapPixels <= 0) {
return;
}
double snapValue = timeState.getSnapValue();
int pixelSecond = timeState.getPixelSecond();
for (int i = 0; x < getWidth(); i++) {
x = (int) ((i * snapValue) * pixelSecond);
g.drawLine(x, 0, x, height);
}
}
}
use of blue.score.layers.audio.core.AudioLayer in project blue by kunstmusik.
the class BlueProjectPropertyChangeListener method attachListeners.
protected void attachListeners(BlueProject project) {
if (project == null) {
return;
}
Score score = project.getData().getScore();
Mixer mixer = project.getData().getMixer();
for (LayerGroup<? extends Layer> lg : score) {
if (lg instanceof AudioLayerGroup) {
AudioLayerGroup alg = (AudioLayerGroup) lg;
ChannelList channelList = findChannelListForAudioLayerGroup(mixer, alg);
lg.addLayerGroupListener(layerGroupListener);
AudioLayerGroupBinding binding = new AudioLayerGroupBinding(alg, channelList);
layerGroupBindings.put(alg, binding);
for (AudioLayer layer : alg) {
Channel channel = ChannelList.findChannelByAssociation(channelList, layer.getUniqueId());
if (channel != null) {
layerBindings.put(layer, new AudioLayerChannelBinding(layer, channel));
}
}
}
}
score.addListener(scoreListener);
}
Aggregations