f@0: /* f@0: accessPD - An accessible PD patches editor f@0: f@0: Copyright (C) 2014 Fiore Martin f@0: f@0: This program is free software: you can redistribute it and/or modify f@0: it under the terms of the GNU General Public License as published by f@0: the Free Software Foundation, either version 3 of the License, or f@0: (at your option) any later version. f@0: f@0: This program is distributed in the hope that it will be useful, f@0: but WITHOUT ANY WARRANTY; without even the implied warranty of f@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the f@0: GNU General Public License for more details. f@0: f@0: You should have received a copy of the GNU General Public License f@0: along with this program. If not, see . f@0: */ f@0: package uk.ac.qmul.eecs.ccmi.pdsupport; f@0: f@0: import java.awt.geom.Rectangle2D; f@0: import java.io.InputStream; f@0: f@0: import uk.ac.qmul.eecs.ccmi.sound.SoundFactory; f@0: f@0: public class PdNumber extends PdObject implements PdElement { f@0: private static final long serialVersionUID = 1L; f@0: private static InputStream asound; f@0: f@0: static{ f@0: asound = PdNumber.class.getResourceAsStream("audio/PdNumber.mp3"); f@0: SoundFactory.getInstance().loadSound(asound); f@0: } f@0: f@0: public PdNumber(){ f@0: super("Number"); f@0: } f@0: f@0: @Override f@0: public String toPdFile(){ f@0: Rectangle2D bounds = getBounds(); f@0: return f@0: getChunckType() + f@0: " floatatom " + f@0: ((int)bounds.getX()) + f@0: ' ' + f@0: ((int)bounds.getY()) + f@0: " 5 0 0 0 "+getName()+" - -"; f@0: f@0: } f@0: f@0: @Override f@0: protected Rectangle2D.Double getMinBounds(){ f@0: return new Rectangle2D.Double(0,0,150,40); f@0: } f@0: f@0: @Override f@0: public String getChunckType() { f@0: return "#X"; f@0: } f@0: f@0: @Override f@0: public InputStream getSound() { f@0: return asound; f@0: } f@0: }