OpenForWrite() публичный Метод

* * public int OpenForRead (String Filename) { // Verify filename parameter as best we can... if (Filename == null) { return DDC_INVALID_CALL; } int retcode = Open ( Filename, RFM_READ ); if ( retcode == DDC_SUCCESS ) { retcode = Expect ( "WAVE", 4 ); if ( retcode == DDC_SUCCESS ) { retcode = Read(wave_format,24); if ( retcode == DDC_SUCCESS && !wave_format.VerifyValidity() ) { // This isn't standard PCM, so we don't know what it is! retcode = DDC_FILE_ERROR; } if ( retcode == DDC_SUCCESS ) { pcm_data_offset = CurrentFilePosition(); Figure out number of samples from // file size, current file position, and // WAVE header. retcode = Read (pcm_data, 8 ); num_samples = filelength(fileno(file)) - CurrentFilePosition(); num_samples /= NumChannels(); num_samples /= (BitsPerSample() / 8); } } } return retcode; } Pass in either a FileName or a Stream.
public OpenForWrite ( System Filename, System stream, int SamplingRate, short BitsPerSample, short NumChannels ) : int
Filename System
stream System
SamplingRate int
BitsPerSample short
NumChannels short
Результат int
Пример #1
0
        public WaveFileObuffer(int number_of_channels, int freq, System.IO.Stream stream)
        {
            InitBlock();

            buffer = new short[OBUFFERSIZE];
            bufferp = new short[MAXCHANNELS];
            channels = number_of_channels;

            for (int i = 0; i < number_of_channels; ++i)
                bufferp[i] = (short) i;

            outWave = new WaveFile();

            int rc = outWave.OpenForWrite(null, stream, freq, (short) 16, (short) channels);
        }
Пример #2
0
        public WaveFileObuffer(int number_of_channels, int freq, System.IO.Stream stream)
        {
            InitBlock();

            buffer   = new short[OBUFFERSIZE];
            bufferp  = new short[MAXCHANNELS];
            channels = number_of_channels;

            for (int i = 0; i < number_of_channels; ++i)
            {
                bufferp[i] = (short)i;
            }

            outWave = new WaveFile();

            int rc = outWave.OpenForWrite(null, stream, freq, (short)16, (short)channels);
        }
Пример #3
0
        /// <summary> Creates a new WareFileObuffer instance. 
        /// 
        /// </summary>
        /// <param name="">number_of_channels	
        /// The number of channels of audio data
        /// this buffer will receive. 
        /// 
        /// </param>
        /// <param name="freq	The">sample frequency of the samples in the buffer.
        /// 
        /// </param>
        /// <param name="fileName	The">filename to write the data to.
        /// 
        /// </param>
        public WaveFileObuffer(int number_of_channels, int freq, System.String FileName)
        {
            InitBlock();
            if (FileName == null)
                throw new System.NullReferenceException("FileName");

            buffer = new short[OBUFFERSIZE];
            bufferp = new short[MAXCHANNELS];
            channels = number_of_channels;

            for (int i = 0; i < number_of_channels; ++i)
                bufferp[i] = (short) i;

            outWave = new WaveFile();

            int rc = outWave.OpenForWrite(FileName, null, freq, (short) 16, (short) channels);
        }
Пример #4
0
        /// <summary> Creates a new WareFileObuffer instance.
        ///
        /// </summary>
        /// <param name="">number_of_channels
        /// The number of channels of audio data
        /// this buffer will receive.
        ///
        /// </param>
        /// <param name="freq	The">sample frequency of the samples in the buffer.
        ///
        /// </param>
        /// <param name="fileName	The">filename to write the data to.
        ///
        /// </param>
        public WaveFileObuffer(int number_of_channels, int freq, System.String FileName)
        {
            InitBlock();
            if (FileName == null)
            {
                throw new System.NullReferenceException("FileName");
            }

            buffer   = new short[OBUFFERSIZE];
            bufferp  = new short[MAXCHANNELS];
            channels = number_of_channels;

            for (int i = 0; i < number_of_channels; ++i)
            {
                bufferp[i] = (short)i;
            }

            outWave = new WaveFile();

            int rc = outWave.OpenForWrite(FileName, null, freq, (short)16, (short)channels);
        }