Esempio n. 1
0
 public void deleteTrack(X1Track track)
 {
     tracks.Remove(track);
     trackPanel.deleteTrackView(track.trackView);
     mixerWindow.deleteMixerStrip(track.mixerStrip);
     waverly.deleteChannel(track.number);
 }
Esempio n. 2
0
//- track management ----------------------------------------------------------

        //create a new empty track
        public void newTrack()
        {
            //create backend track first
            //later we'll scan through the track list and find an open slot
            //for now, just stick at end of list
            int     nextTrackNum = (tracks.Count > 0) ? tracks[tracks.Count - 1].number + 1 : 0;
            X1Track track        = new X1Track(this, nextTrackNum);

            addTrack(track);
            waverly.addChannel(nextTrackNum);
        }
Esempio n. 3
0
        static public int loadTrack(X1Project _project, byte[] trackdata, int dataPos, IntPtr inHdl)
        {
            int    trackNameLen = BitConverter.ToInt32(trackdata, dataPos);
            String _trackName   = Encoding.ASCII.GetString(trackdata, dataPos + 4, trackNameLen);

            dataPos = dataPos + 4 + trackNameLen;
            int   _number = BitConverter.ToInt32(trackdata, dataPos);
            float _level  = BitConverter.ToSingle(trackdata, dataPos + 4);
            float _pan    = BitConverter.ToSingle(trackdata, dataPos + 8);

            X1Track track = new X1Track(_project, _number);

            _project.addTrack(track);
            _project.waverly.loadChannelData(_number, inHdl);

            track.setTrackName(_trackName);
            track.setLevel(_level);
            track.setPan(_pan);

            return(dataPos + 12);
        }
Esempio n. 4
0
//- track I/O -----------------------------------------------------------------

        static public X1Project open(SignalsWindow signalsWindow, String filename)
        {
            X1Project  newProject = null;
            FileStream infile     = File.Open(filename, FileMode.Open, FileAccess.Read);

            byte[] inbuf = new byte[12];
            infile.Read(inbuf, 0, 12);
            String sig     = Encoding.ASCII.GetString(inbuf, 0, 4);
            int    version = BitConverter.ToInt32(inbuf, 4);
            int    hdrSize = BitConverter.ToInt32(inbuf, 8);

            inbuf = new byte[hdrSize];
            infile.Read(inbuf, 0, hdrSize);
            int    projectNameLen = BitConverter.ToInt32(inbuf, 0);
            String _projectName   = Encoding.ASCII.GetString(inbuf, 4, projectNameLen);
            int    hdrOfs         = projectNameLen + 4;
            int    _sampleRate    = BitConverter.ToInt32(inbuf, hdrOfs);
            int    _duration      = BitConverter.ToInt32(inbuf, hdrOfs + 4);
            int    dataSize       = BitConverter.ToInt32(inbuf, hdrOfs + 8);
            float  _leftOutLevel  = BitConverter.ToSingle(inbuf, hdrOfs + 12);
            float  _rightOutLevel = BitConverter.ToSingle(inbuf, hdrOfs + 16);
            int    trackCount     = BitConverter.ToInt32(inbuf, hdrOfs + 20);

            newProject = new X1Project(signalsWindow, _projectName, _sampleRate, _duration);
            newProject.setLeftOutLevel(_leftOutLevel);
            newProject.setRightOutLevel(_rightOutLevel);
            newProject.filename = filename;

            int    trackDataPos = hdrOfs + 24;
            IntPtr inhdl        = infile.SafeFileHandle.DangerousGetHandle();

            for (int tracknum = 0; tracknum < trackCount; tracknum++)
            {
                trackDataPos = X1Track.loadTrack(newProject, inbuf, trackDataPos, inhdl);
            }

            return(newProject);
        }
Esempio n. 5
0
        public void importTracksFromFile(String filename)
        {
            int trackCount = waverly.importWaveFile(filename);

            dataSize = waverly.getAudioDataSize();
            int importDuration = (int)((dataSize + sampleRate - 1) / sampleRate);

            //need to re-adjust durations of existing tracks both in view & in back end
            if (importDuration > duration)
            {
                duration = importDuration;
                trackPanel.updateDuration(duration);
            }

            int trackNum = tracks.Count;

            for (int i = 0; i < trackCount; i++)
            {
                X1Track track = new X1Track(this, trackNum++);
                tracks.Add(track);
                trackPanel.addTrackView(track, duration);
                mixerWindow.addMixerStrip(track);
            }
        }
Esempio n. 6
0
 //add existing track to project and UI windows
 public void addTrack(X1Track track)
 {
     tracks.Add(track);
     trackPanel.addTrackView(track, duration);
     mixerWindow.addMixerStrip(track);
 }