git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22791 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2007-11-01 18:08:42 +00:00
parent c727d6fd76
commit 2d01adeaf4
3 changed files with 256 additions and 320 deletions
@@ -2,28 +2,7 @@
* multiaudio replacement media addon for BeOS * multiaudio replacement media addon for BeOS
* *
* Copyright (c) 2002, 2003 Jerome Duval ([email protected]) * Copyright (c) 2002, 2003 Jerome Duval ([email protected])
* * Distributed under the terms of the MIT License.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
#include <MediaDefs.h> #include <MediaDefs.h>
#include <MediaNode.h> #include <MediaNode.h>
@@ -1621,7 +1600,21 @@ MultiAudioNode::FillNextBuffer(node_input &input, BBuffer* buffer)
case media_raw_audio_format::B_AUDIO_FLOAT: case media_raw_audio_format::B_AUDIO_FLOAT:
switch(input.fFormat.u.raw_audio.format) { switch(input.fFormat.u.raw_audio.format) {
case media_raw_audio_format::B_AUDIO_FLOAT: case media_raw_audio_format::B_AUDIO_FLOAT: {
size_t frame_size = input.fInput.format.u.raw_audio.channel_count * sizeof(float);
size_t stride = fDevice->MBL.playback_buffers[input.fBufferCycle][input.fChannelId].stride;
//PRINT(("stride : %i, frame_size : %i, return_playback_buffer_size : %i\n", stride, frame_size, fDevice->MBL.return_playback_buffer_size));
for(uint32 channel = 0; channel < input.fInput.format.u.raw_audio.channel_count; channel++) {
char *sample_dest = fDevice->MBL.playback_buffers[input.fBufferCycle][input.fChannelId + channel].base;
//char *sample_src = (char*)buffer->Data() + (input.fInput.format.u.raw_audio.channel_count - 1 - channel) * sizeof(int16);
char *sample_src = (char*)buffer->Data() + channel * sizeof(float);
for(uint32 i=fDevice->MBL.return_playback_buffer_size; i>0; i--) {
*(float *)sample_dest = *(float *)sample_src;
sample_dest += stride;
sample_src += frame_size;
}
}
}
break; break;
case media_raw_audio_format::B_AUDIO_INT: case media_raw_audio_format::B_AUDIO_INT:
break; break;
@@ -1819,10 +1812,10 @@ MultiAudioNode::UpdateTimeSource(multi_buffer_info &MBI, multi_buffer_info &oldM
//CALLED(); //CALLED();
if(fTimeSourceStarted) { if(fTimeSourceStarted) {
bigtime_t perf_time = (bigtime_t)(MBI.played_frames_count / bigtime_t perf_time = (bigtime_t)(MBI.played_frames_count /
input.fInput.format.u.raw_audio.frame_rate * 1000000); input.fInput.format.u.raw_audio.frame_rate * 1000000LL);
bigtime_t real_time = MBI.played_real_time; bigtime_t real_time = MBI.played_real_time;
float drift = ((MBI.played_frames_count - oldMBI.played_frames_count) float drift = ((MBI.played_frames_count - oldMBI.played_frames_count)
/ input.fInput.format.u.raw_audio.frame_rate * 1000000) / input.fInput.format.u.raw_audio.frame_rate * 1000000LL)
/ (MBI.played_real_time - oldMBI.played_real_time); / (MBI.played_real_time - oldMBI.played_real_time);
PublishTime(perf_time, real_time, drift); PublishTime(perf_time, real_time, drift);
@@ -2,28 +2,7 @@
* multiaudio replacement media addon for BeOS * multiaudio replacement media addon for BeOS
* *
* Copyright (c) 2002, Jerome Duval ([email protected]) * Copyright (c) 2002, Jerome Duval ([email protected])
* * Distributed under the terms of the MIT License.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
#ifndef _MULTIAUDIONODE_H #ifndef _MULTIAUDIONODE_H
#define _MULTIAUDIONODE_H #define _MULTIAUDIONODE_H
@@ -369,26 +348,11 @@ private:
// not the defaults that are in the parameters // not the defaults that are in the parameters
bigtime_t fBufferPeriod; bigtime_t fBufferPeriod;
//volatile uint32 fBufferCycle;
sem_id fBuffer_free; sem_id fBuffer_free;
thread_id fThread; thread_id fThread;
MultiAudioDevice *fDevice; MultiAudioDevice *fDevice;
//multi_description MD;
//multi_format_info MFI;
//multi_buffer_list MBL;
//multi_mix_control_info MMCI;
//multi_mix_control MMC[MAX_CONTROLS];
bool fTimeSourceStarted; bool fTimeSourceStarted;
BParameterWeb *fWeb; BParameterWeb *fWeb;
BMessage fConfig; BMessage fConfig;
}; };
@@ -2,28 +2,7 @@
* multiaudio replacement media addon for BeOS * multiaudio replacement media addon for BeOS
* *
* Copyright (c) 2002, Jerome Duval (jerome.duval@free.fr) * Copyright (c) 2002, Jerome Duval (jerome.duval@free.fr)
* * Distributed under the terms of the MIT License.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
#ifndef _DRIVER_IO_H #ifndef _DRIVER_IO_H
#define _DRIVER_IO_H #define _DRIVER_IO_H